/* * Handle one line. Returns 0 if at EOF, and a positive value if there's * more data to handle. */ static int do_line( FILE *infile, FILE *miffile, char *outdir ) /*************************************************************/ { static int curline; char line[1024]; char * p; int numwords; char ** words; struct Alias alias; int count; /*** Prepare the next line ***/ p = fgets( line, 1024, infile ); if( p == NULL ) { if( ferror( infile ) ) { FatalError( "Error reading line %d", curline ); } else if( feof( infile ) ) { return( 0 ); } else { Zoinks(); } } if( line[0] == '#' ) { curline++; return( 2 ); /* skip comment lines */ } /*** Extract the individual words ***/ numwords = parse_words( line, NULL ); if( numwords == -1 ) { FatalError( "Error on line %d", curline ); return( -1 ); } if( numwords == 0 ) { /* skip blank lines */ curline++; return( 2 ); } words = (char **)AllocMem( (numwords+1) * sizeof(char*) ); numwords = parse_words( line, words ); if( numwords < 4 ) { FatalError( "Error on line %d", curline ); return( -1 ); } /*** Construct an Alias structure and create the alias ***/ alias.filename = words[0]; alias.realname = words[1]; alias.aliasname = words[2]; alias.systems = NULL; for( count=3; words[count]!=NULL; count++ ) { /* build system list */ add_system( &alias, words[count] ); } do_alias( miffile, &alias, outdir ); curline++; return( 1 ); }
void on_push(std::shared_ptr<Game> game) { auto scene = std::make_shared<Scene>(); auto player = std::make_shared<Entity>(); player->attach_component<PositionComponent>(); player->attach_component<VelocityComponent>(); player->attach_component<PlayerDrawableComponent>(); scene->add_entity(player); auto circle_drawable = std::make_shared<CircleDrawableSystem>(); scene->add_system(circle_drawable); game->make_active_scene(scene); }
/* * Create an alias. */ static void do_alias( FILE *miffile, struct Alias *alias, char *outdir ) /**********************************************************************/ { struct Alias aliasaxp; struct Alias aliasix86; struct Alias aliasppc; struct Alias aliasmips; struct SysElem * syselem; /*** Initialize the CPU specific aliases ***/ aliasix86.filename = alias->filename; aliasix86.realname = alias->realname; aliasix86.aliasname = alias->aliasname; aliasix86.systems = NULL; aliasaxp.filename = alias->filename; aliasaxp.realname = alias->realname; aliasaxp.aliasname = alias->aliasname; aliasaxp.systems = NULL; aliasppc.filename = alias->filename; aliasppc.realname = alias->realname; aliasppc.aliasname = alias->aliasname; aliasppc.systems = NULL; aliasmips.filename = alias->filename; aliasmips.realname = alias->realname; aliasmips.aliasname = alias->aliasname; aliasmips.systems = NULL; /*** Separate into groups by CPU type ***/ syselem = alias->systems; while( syselem != NULL ) { if( !strcmp( syselem->system, "nta" ) ) { /* AXP */ add_system( &aliasaxp, syselem->system ); } else if( !strcmp( syselem->system, "axp" ) ) { /* AXP */ add_system( &aliasaxp, syselem->system ); } else if( !strcmp( syselem->system, "ntp" ) ) { /* PPC */ add_system( &aliasppc, syselem->system ); } else if( !strcmp( syselem->system, "op" ) ) { /* PPC */ add_system( &aliasppc, syselem->system ); } else if( !strcmp( syselem->system, "lpc" ) ) { /* PPC */ add_system( &aliasppc, syselem->system ); } else if( !strcmp( syselem->system, "ppc" ) ) { /* PPC */ add_system( &aliasppc, syselem->system ); } else if( !strcmp( syselem->system, "lmp" ) ) { /* MIPS */ add_system( &aliasmips, syselem->system ); } else if( !strcmp( syselem->system, "mps" ) ) { /* MIPS */ add_system( &aliasmips, syselem->system ); } else { /* x86 */ add_system( &aliasix86, syselem->system ); } syselem = syselem->next; } /*** Build any necessary assembler files ***/ if( aliasix86.systems != NULL ) { make_asm_ix86( miffile, &aliasix86, outdir ); } if( aliasaxp.systems != NULL ) { make_asm_axp( miffile, &aliasaxp, outdir ); } if( aliasppc.systems != NULL ) { make_asm_ppc( miffile, &aliasppc, outdir ); } if( aliasppc.systems != NULL ) { make_asm_mips( miffile, &aliasmips, outdir ); } }