static bool ParseFontFamily(const char* s, size_t len, FontID& v) { bool onFont = false; char buf[64]; size_t bufPos = 0; for (size_t i = 0; true; i++) { if (onFont) { if (s[i] == ',' || i == len) { buf[bufPos] = 0; v = Global()->FontStore->InsertByFacename(buf); if (v != FontIDNull) return true; onFont = false; bufPos = 0; } else { buf[bufPos++] = s[i]; } if (i == len) break; } else { if (i == len) break; if (IsWhitespace(s[i])) continue; onFont = true; buf[bufPos++] = s[i]; } if (bufPos >= arraysize(buf)) { ParseFail("Parse failed, font name too long (>63): '%*.s'\n", (int) len, s); return false; } } // not sure whether we should do this. One might want no font to be set instead. v = Global()->FontStore->GetFallbackFontID(); return true; }
int main (int argc, char* argv[]) { std::vector<std::string> params(argv, argv + argc); //pause in windoze for debuggin' #ifdef _WIN32 #ifdef _DEBUG atexit(pause); #endif #endif GlobalData::create(); llvm::llvm_shutdown_obj shutdown/*(multithreaded = false)*/; //clean up llvm upon exit try { #ifdef _WIN32 char fileName[MAX_PATH] = ""; openDlg(fileName); Global().ParseMainFile(fileName); #else Global().ParseMainFile(params[1].c_str()); #endif } catch (err::FatalError) { err::Error(err::fatal, tok::Location()) << "could not recover from previous errors, aborting"; } return 0; }
// Consrutor AllKeyer::AllKeyer( GlobalFunc *_global, void *_local, void *_serverData, int &_retval ) : Global(*_global), local(_local), server_data(_serverData), retval(_retval) { // Get some function pointers from LW item_info = CLWItemInfo::New( (LWItemInfo *) Global("LW Item Info 2", GFUSE_TRANSIENT) ); scene_info = CLWSceneInfo::New( (LWSceneInfo *) Global("LW Scene Info", GFUSE_TRANSIENT) ); message = CMessage::New( (MessageFuncs *) Global("Info Messages", GFUSE_TRANSIENT) ); dir_info = (DirInfoFunc *) Global("Directory Info", GFUSE_TRANSIENT); // Make sure the function pointers are non-NULL if( !item_info || !scene_info || !message || !item_info ) { message->Error( "ERROR: Your version of LW is too old. Upgrade!", NULL ); retval = AFUNC_BADGLOBAL; return; } ak = this; // Set a global variable for the AllKeyerPanel // Create the AllKeyerPanel int panel_retval; panel = new AllKeyerPanel( _global, message, panel_retval ); if( panel_retval != AFUNC_OK ) { retval = panel_retval; return; } // Create the OS-specific Directory Class os_dir = new DirInfo(); if( !os_dir ) { message->Error( "ERROR: Unable to initialize directory class!", NULL ); retval = AFUNC_OK; return; } // Open the Main Panel while( panel->OpenMain() == MPS_PROCESS ) { if( TestOptions() ) { // Process the Scenes if( os_dir->HasHeader( "LWSC" ) ) { // Handle LW Scenes ProcessScene(); } else { // Not a scene; assume it's a file list ParseAKB(); } panel->message->Info("Everything's cool!"); } } // retval = DoProcess(); }
ISymbol::ISymbol() { Parsed()=0; Visited()=0; Type()=(SymbolType) -1; ListType()=unknown_; Dimension()=0; SimpleType()=true; Required()=false; Abstract()=false; Compositor()=0; DerivedType() = XercesAdditions::DERIVATION_NONE; XercesType() = XercesAdditions::NO_DECLARATION; Global()=false; SqlCount()=0; SubstitutionGroupAffiliation().clear(); symbols.push_back(this); Variable()=NULL; SimpleContent()=false; List()=false; Atomic()=false; Level()=0; ListSize()=0; intrusive_ptr_add_ref((IExpress *) symbols.back().get()); }
HandleProxy* V8EngineProxy::SetGlobalObjectTemplate(ObjectTemplateProxy* proxy) { if (!_Context.IsEmpty()) _Context.Reset(); if (_GlobalObjectTemplateProxy != nullptr) delete _GlobalObjectTemplateProxy; _GlobalObjectTemplateProxy = proxy; auto context = v8::Context::New(_Isolate, nullptr, Local<ObjectTemplate>::New(_Isolate, _GlobalObjectTemplateProxy->_ObjectTemplate)); _Context = context; // ... the context auto creates the global object from the given template, BUT, we still need to update the internal fields with proper values expected // for callback into managed code ... auto globalObject = context->Global()->GetPrototype()->ToObject(); globalObject->SetAlignedPointerInInternalField(0, _GlobalObjectTemplateProxy); // (proxy object reference) globalObject->SetInternalField(1, External::New(_Isolate, (void*)-1)); // (manage object ID, which is only applicable when tracking many created objects [and not a single engine or global scope]) _GlobalObject = globalObject; // (keep a reference to the global object for faster reference) return GetHandleProxy(globalObject); // (the native side will own this, and is responsible to free it when done) }
void CGLRenderTechnique::Apply() { CGLVertexShader* vs = GetShader<CGLVertexShader>(Renderer::SHA_VERTEX_SHADER); if(vs) { Global().Renderer().SetVertexInputLayout(vs->InputLayout()); glUseProgram(m_TechniqueHandle); } else { glUseProgram(0); } }
void ISymbol::MergeTypeInfo(ISymbolPtr c) { c->TypeName() = Name(); // Ignore, Name(), Namespace(), and Type() c->Abstract() = Abstract(); c->Atomic() = Atomic(); c->Attributes() = Attributes(); c->BaseTypeName() = BaseTypeName(); c->Compositor() = Compositor(); c->DerivedType() = DerivedType(); c->Enumerations() = Enumerations(); c->FacetKinds() = FacetKinds(); c->Facets() = Facets(); c->Global() = Global(); c->Level() = Level(); c->List() = List(); c->ListSize() = ListSize(); c->ListType() = ListType(); c->Optional() = Optional(); c->Parent() = Parent(); c->Parsed() = Parsed(); c->PrimitiveType() = PrimitiveType(); c->Required() = Required(); c->SimpleContent() = SimpleContent(); c->SimpleType() = SimpleType(); c->SqlCount() = SqlCount(); c->SqlType() = SqlType(); c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation(); c->SubstitutionList() = SubstitutionList(); c->SubTypes() = SubTypes(); c->SuperTypes() = SuperTypes(); c->Variable() = Variable(); c->Visited() = Visited(); c->XercesType() = XercesType(); // These are element particle definitions // c->Dimension() = Dimension(); // always 1 //c->LowerBounds() = LowerBounds(); //c->UpperBounds() = UpperBounds(); //c->OuterElementName() = OuterElementName(); // c->OuterElementTypeName() = OuterElementTypeName(); }
void ISymbol::DeepCopy(ISymbolPtr c) { c->Name()=Name(); c->Abstract() = Abstract(); c->Atomic() = Atomic(); c->Attributes() = Attributes(); c->BaseTypeName() = BaseTypeName(); c->Compositor() = Compositor(); c->DerivedType() = DerivedType(); c->Dimension() = Dimension(); c->Enumerations() = Enumerations(); c->FacetKinds() = FacetKinds(); c->Facets() = Facets(); c->Global() = Global(); c->Level() = Level(); c->List() = List(); c->ListSize() = ListSize(); c->ListType() = ListType(); c->LowerBounds() = LowerBounds(); c->Namespace() = Namespace(); c->Optional() = Optional(); c->OuterElementName() = OuterElementName(); c->OuterElementTypeName() = OuterElementTypeName(); c->Parent() = Parent(); c->Parsed() = Parsed(); c->PrimitiveType() = PrimitiveType(); c->Required() = Required(); c->SimpleContent() = SimpleContent(); c->SimpleType() = SimpleType(); c->SqlCount() = SqlCount(); c->SqlType() = SqlType(); c->SubstitutionGroupAffiliation() = SubstitutionGroupAffiliation(); c->SubstitutionList() = SubstitutionList(); c->SubTypes() = SubTypes(); c->SuperTypes() = SuperTypes(); c->Type() = Type(); c->TypeName() = TypeName(); c->UpperBounds() = UpperBounds(); c->Variable() = Variable(); c->Visited() = Visited(); c->XercesType() = XercesType(); }
//Generate inline std::string generate_arguments(std::string const &, driver::Device const & device, mapping_type const & mappings, expression_tree const & expressions) { std::string kwglobal = Global(device.backend()).get(); std::string _size_t = size_type(device); kernel_generation_stream stream; process(stream, PARENT_NODE_TYPE, { {"array11", kwglobal + " #scalartype* #pointer, " + _size_t + " #start,"}, {"array1", kwglobal + " #scalartype* #pointer, " + _size_t + " #start,"}, {"host_scalar", "#scalartype #name,"}, {"arrayn", kwglobal + " #scalartype* #pointer, " + _size_t + " #start, " + _size_t + " #stride,"}, {"array1n", kwglobal + " #scalartype* #pointer, " + _size_t + " #start, " + _size_t + " #stride,"}, {"arrayn1", kwglobal + " #scalartype* #pointer, " + _size_t + " #start, " + _size_t + " #stride,"}, {"arraynn", kwglobal + " #scalartype* #pointer, " + _size_t + " #start, " + _size_t + " #stride," + _size_t + " #ld,"}, {"tuple4", "#scalartype #name0, #scalartype #name1, #scalartype #name2, #scalartype #name3,"}} , expressions, mappings); std::string res = stream.str(); res.erase(res.rfind(',')); return res; }
Bool YSE::INTERNAL::soundFile::create(Bool stream) { if (_audioBuffer != nullptr) { // don't load anything when using an existing buffer _streaming = false; _endReached = false; _needsReset = false; state = READY; return true; } _streaming = stream; _endReached = false; // load sound into memory _needsReset = false; if (state == NEW) { state = LOADING; Global().addSlowJob(this); } return true; }
public func Hit(a,b,c,d,e,f,g,h) { if(GetID()==1145851719 && !Global(11)) if(Var()=FindObject2(Find_ID(CastC4ID(1145851719)), Find_Distance(5), Find_Exclude(this()))){for(var x=83;x<486;x++)for(var y=189;y<388;y++)if(GetMaterial(x-GetX(),y-GetY())==Material("Acid"))DrawMaterialQuad ("Water",x,y,x,y+1,x+1,y+1,x+1,y,1);return(RemoveObject(Var()),CastParticles("MSpark",20,40,0,0,30,45,GetPlrColorDw(GetController())), Sound("Magic*"), RemoveObject(), Global(11)++); } return(_inherited(a,b,c,d,e,f,g,h)); }
// Constructor SimplifyGlobalInterface::SimplifyGlobalInterface( GlobalFunc *_global, void *local, int &retval ) : main_panel(NULL), about_panel(NULL), Global(*_global), message(NULL), panel_funcs(NULL) { // Set the global UberNullInterface pointer so the draw functions and controls can use it simpg_int = this; // Get the Panel Functions and Scene Info from Lightwave message = CMessage::New( (MessageFuncs *) Global( "Info Messages", GFUSE_TRANSIENT) ); panel_funcs = CLWPanelFuncs::New( (LWPanelFuncs *) Global( PANEL_SERVICES_NAME, GFUSE_TRANSIENT ), _global ); scene_info = CLWSceneInfo::New( (LWSceneInfo *) Global( "LW Scene Info", GFUSE_TRANSIENT ) ); if( !message ) { retval = AFUNC_BADGLOBAL; return; } if( !panel_funcs ) { message->Error( "ERROR: Unable to find lwpanels.p to create the GUI", "Add it and try again." ); retval = AFUNC_BADGLOBAL; return; } // Get the Dir Info Function so we can get the Content Dir DirInfoFunc *DirInfo = *( (DirInfoFunc *) Global( "Directory Info", GFUSE_TRANSIENT ) ); if( DirInfo == NULL ) { message->Error( "ERROR: Unable to obtain Directory Info from Lightwave; aborting" ); retval = AFUNC_BADGLOBAL; return; } content_dir = (*DirInfo)( "Content" ); // Get/Generate the default source/output filenames source_filename[0] = '\0'; if( DirStrings::HasDrive( scene_info->filename ) ) strcpy( source_filename, content_dir ); DirStrings::AddPathPart( source_filename, scene_info->filename ); strcpy( output_filename, source_filename ); char *ext = DirStrings::HasExtension( output_filename ); if( ext != NULL ) ext[0] = '\0'; strcat( output_filename, "-Simplified.lws" ); // Create the panels if( MakeMainPanel() ) { // Create the main panel if( MakeAboutPanel() ) { // Create the about panel if( OpenMainPanel() ) { retval = AFUNC_OK; } else { retval = AFUNC_BADLOCAL; } } else { retval = AFUNC_BADLOCAL; } } else { retval = AFUNC_BADLOCAL; } }
/* %%Function:DefProcedure %%Owner:bradch */ DefProcedure() /* Reads a SUB or FUNCTION definition line. If we are seeing this code for * the first time, defines the SUB or FUNCTION. * * On exit, Global(eltCur) is terminator of the SUB/FUNCTION line. */ { long libProc; ELT eltProc, eltCur; int carg; struct SY *psyProc; struct PROC *pproc, huge *hpproc; struct ARG rgarg[cargMaxProc]; Assert(Global(eltCur) == eltSub || Global(eltCur) == eltFunction); eltProc = Global(eltCur); if ((eltCur = EltGetCur()) != eltIdent) { /*HpeliFirst()->lib = LibCur();*/ /* Error: Illegal procedure definition/1 */ RtError(rerrSyntaxError); } psyProc = Global(psyCur); libProc = LibCur(); switch (EltGetCur()) { default: /* Error: Illegal procedure definition/2 */ RtError(rerrSyntaxError); case eltColon: case eltLineIdent: case eltLineNolabel: case eltLineInt: /* NYI: If label definition, define the label properly ... */ /* Procedure name not followed by parentheses, so there are * no arguments. */ carg = 0; break; case eltLParen: /* Read the argument list. */ carg = 0; while (1) { int elvArg; int fArray = FALSE; if ((eltCur = EltGetCur()) != eltIdent) { /* Error: Illegal procedure definition/3 */ RtError(rerrSyntaxError); } if (carg >= cargMaxProc) { /* Error: Only cargMaxProc arguments allowed */ RtError(rerrArgCountMismatch); } rgarg[carg].psy = Global(psyCur); elvArg = HpsyOfPsy(Global(psyCur))->elv; if ((eltCur = EltGetCur()) == eltLParen) { if (EltGetCur() != eltRParen) ElSyntaxError(0); rgarg[carg].fArray = TRUE; eltCur = EltGetCur(); } else rgarg[carg].fArray = FALSE; if (eltCur == eltAs) { if (EltGetCur() != eltElx) { /* Error: Invalid use of AS */ RtError(rerrSyntaxError); } elvArg = ElvFromIeldi(IeldiFromElx(PelcrCur()->elx)); eltCur = EltGetCur(); } rgarg[carg++].elv = elvArg; if (eltCur == eltRParen) break; if (eltCur != eltComma) { /* Error: Illegal dummy argument */ RtError(rerrTypeMismatch); } } libProc = LibCur(); break; /* end switch (EltGetCur()) */ } hpproc = HpOfSbIb(Global(sbNtab), pproc = PprocFromPsy(psyProc, carg)); if (hpproc->lib != libNil) /* already defined? */ { /* Error: SUB or FUNCTION defined twice */ RtError(rerrDuplicateLabel); } hpproc->lib = libProc; /* PROC is now defined */ /* Copy the arg list to the new PROC, and set the return value. */ BLTBX(LpOfHp(HpOfSbIb(1, &rgarg)), LpOfHp(hpproc->rgarg), carg * sizeof(struct ARG)); hpproc->elv = (eltProc == eltFunction ? HpsyOfPsy(psyProc)->elv : elvNil); *HpNtab(pprocScan) = pproc; /* remember what PROC we're in */ *(LIB huge *)HpNtab(libScan) = libProc; EltGetCur(); /* pre-fetch (defining any labels in new proc) */ }
/* * RunCommandLine - run a command line command */ vi_rc RunCommandLine( const char *cmdl ) { int i, x, y, x2, y2; bool n1f, n2f; int tkn, flag; bool test1; linenum n1, n2; char st[FILENAME_MAX]; info *cinfo; long val; jmp_buf jmpaddr; vi_rc rc; const char *data; /* * parse command string */ tkn = TOK_INVALID; rc = ParseCommandLine( cmdl, &n1, &n1f, &n2, &n2f, &tkn, &data ); if( rc != ERR_NO_ERR ) { return( rc ); } if( !n2f ) { if( !n1f ) { n1 = n2 = CurrentPos.line; } else { n2 = n1; } } /* * process tokens */ rc = ERR_INVALID_COMMAND; test1 = n1f || n2f; switch( tkn ) { case PCL_T_ABOUT: rc = DoAboutBox(); break; case PCL_T_PUSH: rc = PushFileStackAndMsg(); break; case PCL_T_POP: rc = PopFileStack(); break; case PCL_T_EXECUTE: data = SkipLeadingSpaces( data ); if( *data != '\0' ) { key_map scr; rc = AddKeyMap( &scr, data ); if( rc != ERR_NO_ERR ) { break; } rc = RunKeyMap( &scr, 1L ); MemFree( scr.data ); } break; case PCL_T_DELETEMENU: rc = DoMenuDelete( data ); break; case PCL_T_DELETEMENUITEM: rc = DoItemDelete( data ); break; case PCL_T_ADDMENUITEM: rc = AddMenuItem( data ); break; case PCL_T_MAXIMIZE: rc = MaximizeCurrentWindow(); break; case PCL_T_MINIMIZE: rc = MinimizeCurrentWindow(); break; case PCL_T_EXITFILESONLY: if( !ExitWithPrompt( false, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_EXITALL: if( !ExitWithPrompt( true, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_QUITALL: ExitWithVerify(); rc = ERR_NO_ERR; break; case PCL_T_KEYADD: data = SkipLeadingSpaces( data ); KeyAddString( data ); rc = ERR_NO_ERR; break; case PCL_T_UNALIAS: rc = UnAlias( data ); break; case PCL_T_UNABBREV: rc = UnAbbrev( data ); break; case PCL_T_UNMAP: case PCL_T_UNMAP_DMT: flag = MAPFLAG_MESSAGE + MAPFLAG_UNMAP; if( tkn == PCL_T_UNMAP_DMT ) { flag |= MAPFLAG_DAMMIT; } rc = MapKey( flag, data ); break; case PCL_T_EVAL: data = Expand( dataBuff, data, NULL ); i = setjmp( jmpaddr ); if( i != 0 ) { rc = (vi_rc)i; } else { StartExprParse( data, jmpaddr ); val = GetConstExpr(); ltoa( val, st, EditVars.Radix ); Message1( "%s", st ); rc = ERR_NO_ERR; } break; case PCL_T_COMPILE: case PCL_T_SOURCE: case PCL_T_LOAD: { char *tstr; srcline sline; data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } if( tkn == PCL_T_COMPILE ) { EditFlags.CompileScript = true; if( st[0] == '-' ) { if( st[1] == 'a' || st[1] == 'A' ) { EditFlags.CompileAssignments = true; if( st[1] == 'A' ) { EditFlags.CompileAssignmentsDammit = true; } data = GetNextWord1( data, st); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } } } } if( tkn == PCL_T_LOAD ) { EditFlags.LoadResidentScript = true; } sline = 0; rc = Source( st, data, &sline ); EditFlags.LoadResidentScript = false; EditFlags.CompileScript = false; EditFlags.CompileAssignments = false; EditFlags.CompileAssignmentsDammit = false; if( EditFlags.SourceScriptActive ) { LastError = rc; } if( rc > ERR_NO_ERR ) { Error( "%s on line %u of \"%s\"", GetErrorMsg( rc ), sline, st ); } else { if( rc != DO_NOT_CLEAR_MESSAGE_WINDOW ) { if( tkn != PCL_T_SOURCE ) { if( tkn == PCL_T_LOAD ) { tstr = strLoad; } else { tstr = strCompile; } Message1( "Script \"%s\" %s, %u lines generated, %d errors", st, tstr, sline, SourceErrCount ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } } } break; } case PCL_T_GENCONFIG: #ifndef __WIN__ data = GetNextWord1( data,st ); if( *st != '\0' ) { rc = GenerateConfiguration( st, true ); } else { rc = GenerateConfiguration( NULL, true ); } #else { bool temp = EditFlags.SaveConfig; EditFlags.SaveConfig = true; WriteProfile(); EditFlags.SaveConfig = temp; rc = ERR_NO_ERR; } #endif break; case PCL_T_COMPRESS: rc = CompressWhiteSpace(); break; case PCL_T_EXPAND: rc = ExpandWhiteSpace(); break; case PCL_T_SHOVE: rc = Shift( n1, n2, '>', true ); break; case PCL_T_SUCK: rc = Shift( n1, n2, '<', true ); break; case PCL_T_FILES: if( EditFlags.LineDisplay ) { rc = DisplayFileStatus(); } else { rc = EditFileFromList(); } break; case PCL_T_NEXT: rc = RotateFileForward(); break; case PCL_T_PREV: rc = RotateFileBackwards(); break; case PCL_T_HELP: rc = DoHelp( data ); break; case PCL_T_VIEW: case PCL_T_VIEW_DMT: EditFlags.ViewOnly = true; case PCL_T_EDIT: case PCL_T_EDIT_DMT: rc = EditFile( data, ( tkn == PCL_T_VIEW_DMT || tkn == PCL_T_EDIT_DMT ) ); EditFlags.ViewOnly = false; break; case PCL_T_OPEN: rc = OpenWindowOnFile( data ); break; case PCL_T_HIDE: case PCL_T_HIDE_DMT: rc = HideLineRange( n1, n2, ( tkn == PCL_T_HIDE_DMT ) ); break; case PCL_T_DELETE: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { AddSelRgnToSavebufAndDelete(); rc = ERR_NO_ERR; // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = DeleteLineRange( n1, n2, SAVEBUF_FLAG ); } if( rc == ERR_NO_ERR ) { DCDisplayAllLines(); LineDeleteMessage( n1, n2 ); } break; case PCL_T_SAVEANDEXIT: data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } break; case PCL_T_PUT: case PCL_T_PUT_DMT: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } rc = SaveAndResetFilePos( n1 ); if( rc == ERR_NO_ERR ) { if( tkn == PCL_T_PUT ) { rc = InsertSavebufAfter(); } else { rc = InsertSavebufBefore(); } RestoreCurrentFilePos(); } break; case PCL_T_YANK: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { rc = YankSelectedRegion(); // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = YankLineRange( n1, n2 ); } break; case PCL_T_SUBSTITUTE: rc = Substitute( n1, n2, data ); break; case PCL_T_GLOBAL: case PCL_T_GLOBAL_DMT: if( !test1 ) { n1 = 1; rc = CFindLastLine( &n2 ); if( rc != ERR_NO_ERR ) { break; } } rc = Global( n1,n2, data, ( tkn == PCL_T_GLOBAL_DMT ) ); break; case PCL_T_WRITEQUIT: if( CurrentFile == NULL ) { rc = NextFile(); } else { CurrentFile->modified = true; data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } } break; case PCL_T_WRITE: case PCL_T_WRITE_DMT: data = GetNextWord1( data, st ); if( test1 ) { if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; } else { rc = SaveFile( st, n1, n2, ( tkn == PCL_T_WRITE_DMT ) ); } } else { if( st[0] != '\0' ) { #ifdef __WIN__ if( st[0] == '?' && st[1] == '\0' ) { rc = SaveFileAs(); break; } else { rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); } #else rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); #endif } else { rc = SaveFile( NULL, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); if( rc == ERR_NO_ERR ) { Modified( false ); } } } break; case PCL_T_READ: rc = ReadAFile( n1, data ); break; case PCL_T_QUIT: #ifdef __WIN__ rc = CurFileExitOptionSaveChanges(); #else rc = NextFile(); #endif break; case PCL_T_QUIT_DMT: rc = NextFileDammit(); break; case PCL_T_DATE: GetDateTimeString( st ); Message1( st ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; break; case PCL_T_CD: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SetCWD( st ); } else { rc = ERR_NO_ERR; } if( rc == ERR_NO_ERR ) { Message1( "Current directory is %s",CurrentDirectory ); } break; case PCL_T_SHELL: EVIL_SHELL: { #if defined( __NT__ ) && !defined( __WIN__ ) ExecCmd( NULL, NULL, NULL ); #else char foo[FILENAME_MAX]; strcpy( foo, Comspec ); ExecCmd( NULL, NULL, foo ); #endif DoVersion(); rc = ERR_NO_ERR; } break; case PCL_T_SYSTEM: if( n1f && n2f ) { rc = DoGenericFilter( n1, n2, data ); } else { data = SkipLeadingSpaces( data ); if( *data == '\0' ) { goto EVIL_SHELL; } ExecCmd( NULL, NULL, data ); rc = ERR_NO_ERR; } break; case PCL_T_RESIZE: rc = ResizeCurrentWindowWithKeys(); break; case PCL_T_TILE: data = GetNextWord1( data, st ); if( st[0] != '\0' ) { if( st[0] == 'v' ) { y = 1; for( x = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { x++; } } else if( st[0] == 'h' ) { x = 1; for( y = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { y++; } } else { x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } else { y = atoi( st ); } } } else { x = EditVars.MaxWindowTileX; y = EditVars.MaxWindowTileY; } if( x > 0 && y > 0) { rc = WindowTile( x, y ); } break; case PCL_T_CASCADE: rc = WindowCascade(); break; case PCL_T_MOVEWIN: rc = MoveCurrentWindowWithKeys(); break; case PCL_T_TAG: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = TagHunt( st ); } break; case PCL_T_FGREP: { bool ci; data = SkipLeadingSpaces( data ); ci = EditFlags.CaseIgnore; if( data[0] == '-' ) { if( data[1] == 'c' ) { ci = false; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'i' ) { ci = true; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'f' ) { data += 2; data = SkipLeadingSpaces( data ); #ifdef __WIN__ // call fancy grep window { fancy_find *ff; /* ff will be set to point at a static fancy find struct * in the snoop module */ char snoopbuf[FILENAME_MAX]; if( !GetSnoopStringDialog( &ff ) ) { return( ERR_NO_ERR ); } strcpy( snoopbuf, ff->path ); /* assume no string means current directory */ if( strlen( snoopbuf ) && snoopbuf[strlen( snoopbuf ) - 1] != '\\' ){ strcat( snoopbuf, "\\" ); } MySprintf( st, "%s", ff->find ); strcat( snoopbuf, ff->ext ); ci = ff->case_ignore; if( !ff->use_regexp ) { //MakeExpressionNonRegular( st ); rc = DoFGREP( snoopbuf, st, ci ); } else { rc = DoEGREP( snoopbuf, st ); } break; } #endif } } else { rc = GetStringWithPossibleQuote( &data, st ); } if( rc != ERR_NO_STRING ) { rc = DoFGREP( data, st, ci ); } } break; case PCL_T_EGREP: rc = GetStringWithPossibleQuote( &data, st ); if( rc != ERR_NO_STRING ) { rc = DoEGREP( data, st ); } break; case PCL_T_SIZE: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x2 = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y2 = atoi( st ); rc = CurrentWindowResize( x, y, x2, y2 ); break; case PCL_T_ECHO: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } rc = ERR_NO_ERR; if( !stricmp( st, "on" ) ) { EditFlags.EchoOn = true; break; } else if( !stricmp( st, "off" ) ) { EditFlags.EchoOn = false; break; } x = atoi( st ); data = SkipLeadingSpaces( data ); /* * FIXME: This is not good - I will definately have to * fix this code up. But right now I have to get the * editor ready for tomorrow. Brad. */ if( data[0] == '"' || data[0] == '/' ) { GetStringWithPossibleQuote( &data, st ); if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( st ); } else if( x == 2 ) { Message2( st ); } // DisplayLineInWindow( MessageWindow, x, st ); } else { if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( data ); } else if( x == 2 ) { Message2( data ); } // DisplayLineInWindow( MessageWindow, x, data ); } break; #ifdef VI_RCS case PCL_T_CHECKOUT: rc = ERR_NO_ERR; #ifdef __WINDOWS__ if( isOS2() ) break; // OS/2 shell returns before checkout finishes #endif if( CurrentFile != NULL ) { rc = ViRCSCheckout( rc ); } break; case PCL_T_CHECKIN: if( CurrentFile != NULL ) { rc = ViRCSCheckin( rc ); } break; #endif default: if( tkn >= 1000 ) { rc = ProcessEx( n1, n2, n2f, tkn - 1000, data ); break; } rc = TryCompileableToken( tkn, data, true ); if( rc != NOT_COMPILEABLE_TOKEN ) { break; } rc = ProcessWindow( tkn, data ); if( rc >= ERR_NO_ERR ) { break; } case TOK_INVALID: if( n1f && !n2f ) { if( !n1 ) { n1 = 1; } MemorizeCurrentContext(); rc = GoToLineNoRelCurs( n1 ); if( rc == ERR_NO_ERR ) { GoToColumnOnCurrentLine( 1 ); if( EditFlags.LineDisplay ) { MyPrintf( "%s\n", CurrentLine->data ); } } return( rc ); } rc = ERR_INVALID_COMMAND; break; } if( rc == ERR_NO_ERR ) { rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } return( rc ); } /* RunCommandLine */
void ProjectScene::init() { vehicle=Vehicle(); for (unsigned int i = 0; i < 8; i++) lights[i] = NULL; globals=Global(); XMLSceneMod temp = XMLSceneMod("wall-e.xml", &sceneGraph, lights ,textures,appearances,animations,&cameras, activeCamera, &globals, flagShaders); glEnable(GL_LIGHTING); glEnable (GL_NORMALIZE); //mode //Defines Drawing computations if(strcmp(globals.getMode(), "fill") == 0) glPolygonMode(GL_FILL,GL_TRUE); else if(strcmp(globals.getMode(), "point") == 0) glPolygonMode(GL_POINT,GL_TRUE); else if(strcmp(globals.getMode(), "line") == 0) glPolygonMode(GL_LINE,GL_TRUE); //shading if(strcmp(globals.getShading(),"flat")==0) glShadeModel(GL_FLAT); else if (strcmp(globals.getShading(),"gouraud")==0) { glShadeModel(GL_SMOOTH); } glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //background glClearColor(globals.getBackground()[0],globals.getBackground()[1],globals.getBackground()[2],globals.getBackground()[3]); //culling if(strcmp(globals.getFace(), "none") == 0) glDisable(GL_CULL_FACE); else if (strcmp(globals.getFace(), "front") == 0){ glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); } else if (strcmp(globals.getFace(), "back") == 0){ glEnable(GL_CULL_FACE); glCullFace(GL_BACK); } else if (strcmp(globals.getFace(), "both") == 0){ glEnable(GL_CULL_FACE); glCullFace(GL_FRONT_AND_BACK); } //order if (strcmp(globals.getFace(), "ccw") == 0) glFrontFace(GL_CCW); else if (strcmp(globals.getFace(), "cw") == 0) glFrontFace(GL_CW); //doublesided if(globals.getDoublesided()) glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); else glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); //local if(globals.getLocal()) glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); else glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE); //enabled if(globals.getEnabled()) glEnable(GL_LIGHTING); // Sets up some lighting parameters // Computes lighting only using the front face normals and materials glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); // Define ambient light (do not confuse with ambient component of individual lights) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globals.getAmbient()); /* for (unsigned int i = 0; i < 8; i++){ if (lights[i] == NULL) break; cout << lights[i]->showLight(); }*/ this->processDisplayLists(this->sceneGraph.getRoot(), this->sceneGraph.getRoot()); // Animation-related code unsigned long updatePeriod=50; setUpdatePeriod(updatePeriod); }