?? mainapp.c
字號:
#include "Header.h"
#include "GenCode.h"
#include "GBStrTab.h"
#include "LYCond.h"
#include "Error.h"
#include <stdio.h>
#include <stdlib.h>
//#include <dir.h>
#define MAXPATH 255
#include <string.h>
#include <assert.h>
char in[MAXPATH], out[MAXPATH];
int yyparse();
void dispCopyRight()
{
puts("Micro C Compiler Version 1.0");
puts("Copyright (c) 2001 by Ocean_LR Group. All rights reserved.\n");
}
void get_in_out(int argc, char *argv[])
{
char *p;
// gen in file name
strcpy(in, argv[1]); //in="try"
p = strchr(in, '.');
if ( !p )
strcat(in, ".c");
// gen out file name
if (argc > 2)
{
strcpy(out, argv[2]);
p = strchr(out, '.');
if ( !p )
strcat(out, ".asm");
}
else
{
strcpy(out, in);
p = strchr(out, '.');
assert( p );
strcpy(p, ".asm");
}
}
void main(int argc, char *argv[])
{
int ret;
dispCopyRight();
//argv[1]="add1" ;
if (argc < 2)
{
printf("Usage: MC source[.c] [ output[.asm] ]\n");
// return 1;
}
get_in_out(argc, argv);
printf("Compiling file %s......\n", in);
InitYacc(in);
gen_data_segment_head();
gen_code_segment_head();
ret = yyparse();
// gen string tab code
gen_string_tab(get_string_tab_head());
gen_data_segment_end();
gen_code_segment_end();
if ( !is_main_function_exist() )
{
yyerror("check main error: unresolved external symbol _main");
user_exit(1);
}
DestoryYacc(out);
if ( !ret )
puts("OK, Compile Success\n");
#ifndef NDEBUG
printf("debug info in debug.txt\n");
#endif
// return ret;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -