?? tj.cpp
字號:
// Tj.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Make.h"
#include "Executable.h"
long fgetsize (FILE *stream);
void debug(int x);
void Executable(vector <CSub> Subs);
int main(int argc, char* argv[])
{
if(argc<=1)
{
printf("tj filename\n");
return 0;
}
vector<CSub> m_Subs;
FILE *fp=fopen(argv[1],"rb");
if(fp==NULL)
{
printf("Can't open the file!");
return 0;
}
int filesize=fgetsize(fp); // 得到源程序文件長度
char *pfiledata=new char[filesize]; // 創建裝源程序文件數據的指針
fread(pfiledata,filesize,1,fp); // 讀文件數據
pfiledata[filesize]='\0';
fclose(fp);
CMake Make(pfiledata,filesize); // 創建Make對象,用來生成class代碼
Make.Make(); // Make對象內部進行Make token的工作
m_Subs=Make.m_Subs; // 將Make內部生成的m_Subs傳出來
Executable(m_Subs);
return 0;
}
void debug(int x)
{
char m[30];
sprintf(m,"%d",x);
printf(m);
}
long fgetsize (FILE *stream) //返回得到文件長度
{
long filesize;
long oldseek=ftell(stream);
fseek(stream,0L,2);
filesize=ftell(stream);
fseek(stream,oldseek,0);
return filesize;
}
void Executable(vector <CSub> Subs)
{
CExecutable m_Executable(Subs);
vector <CToken> Subarg;
m_Executable.Run("Main",Subarg);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -