?? checkc.c
字號:
#include <stdio.h>#include <string.h>#include "Stack.h"#define cMAX_BUFFER_SIZE 1024int main(int argc, char *argv[]){ FILE *fp; BYTE aBuffer[cMAX_BUFFER_SIZE]; BYTE *pTmp, *pEnd; UINT32 dwByteRead, line = 1; TOKEN token, preferToken = NONE; if(2 != argc){ printf("Bad command format!\n"); printf("checkc <sourcefile> \n"); return 1; } if(NULL == (fp = fopen(argv[1], "r"))){ printf("The source file doesn\'t exist or have no permission to access it.\n"); return 2; } while(!feof(fp)){ memset(aBuffer, 0, cMAX_BUFFER_SIZE); dwByteRead = fread(aBuffer, 1, cMAX_BUFFER_SIZE, fp); pTmp = &aBuffer[0]; pEnd = pTmp + dwByteRead; while(NONE != (token = GetNextToken(&pTmp, pEnd, preferToken))){ if(Newline == token)
line++;
if(isTokenMatchTop(token)){ pop();
preferToken = NONE;
} else{
switch(token){
case SingleQuotation:
case DoubleQuotation:
push(token, line);
preferToken = token;
break;
case LeftCommentLine:
push(token, line);
preferToken = RightCommentLine;
break;
case DoubleSlashComment:
push(token, line);
preferToken = Newline;
break;
case Newline:
break;
default: push(token, line); preferToken = NONE;
break;
} } } } fclose(fp); PrintError();
return 0; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -