#pragma warning(disable:4786) #include "libs.h" #include #include "../config/config.h" #include "../stdutil/stdutil.h" #include #include #include #include #include #include #include #include using namespace std; #include "../linker/linker.h" #include "../compiler/environ.h" #include "../compiler/parser.h" #include "../compiler/assem_x86/assem_x86.h" #include "../compiler/codegen_x86/codegen_x86.h" #include "../bbruntime_dll/bbruntime_dll.h" static void showInfo(){ const int major=(VERSION&0xffff)/100,minor=(VERSION&0xffff)%100; cout<<"BlitzCC V"<funcDecls->findDecl( tolower( kw ) ); if( !d || d->type->funcType()==0 ) return "No quick help available for "+kw; string t=kw; FuncType *f=d->type->funcType(); if( f->returnType==Type::float_type ) t+='#'; else if( f->returnType==Type::string_type ) t+='$'; t+=" "; if( f->returnType!=Type::void_type ) t+="( "; for( int k=0;kparams->size();++k ){ string s; if( k ) s+=','; Decl *p=f->params->decls[k];s+=p->name; if( p->type==Type::float_type ) s+='#'; else if( p->type==Type::string_type ) s+='$'; else if( p->type==Type::void_type ) s+='*'; if( p->defType ) s='['+s+']'; t+=s; } if( f->returnType!=Type::void_type ){ t+=f->params->size() ? " )" : ")"; } return t; } static void dumpKeys( bool lang,bool mod,bool help ){ if( lang ){ map::iterator it; map &keywords=Toker::getKeywords(); for( it=keywords.begin();it!=keywords.end();++it ){ if( it->first.find(' ')!=string::npos ) continue; cout<first<semant( runtimeEnviron ); //translate if( !veryquiet ) cout<<"Translating..."<translate( &codegen,userFuncs ); if( dumpasm ){ cout<createModule(); Assem_x86 assem( asmcode,module ); assem.assemble(); }catch( Ex &x ){ string file='\"'+x.file+'\"'; int row=((x.pos>>16)&65535)+1,col=(x.pos&65535)+1; cout<createExe( out_file.c_str(),(home+"/bin/runtime.dll").c_str() ) ){ err( "Error creating executable" ); } }else if( !compileonly ){ void *entry=module->link( runtimeModule ); if( !entry ) return 0; HMODULE dbgHandle=0; Debugger *debugger=0; if( debug ){ dbgHandle=LoadLibrary( (home+"/bin/debugger.dll").c_str() ); if( dbgHandle ){ typedef Debugger *(_cdecl*GetDebugger)( Module*,Environ* ); GetDebugger gd=(GetDebugger)GetProcAddress( dbgHandle,"debuggerGetDebugger" ); if( gd ) debugger=gd( module,environ ); } if( !debugger ) err( "Error launching debugger" ); } if( !veryquiet ) cout<<"Executing..."<execute( (void(*)())entry,args.c_str(),debugger ); if( dbgHandle ) FreeLibrary( dbgHandle ); } delete module; delete environ; closeLibs(); return 0; }