bool CFunctionManager::CheckPropPageHandlers(VSClass* pClass) { if (FindDefine(pClass, L"_WTL_NEW_PAGE_NOTIFY_HANDLERS", true) != NULL) { return true; } return false; }
void SetAtllDDX(VSClass* pClass, InsDelPoints* pModifications, bool bUseFloat /* = false */) { if (pClass->m_bDDX && !bUseFloat) return; InsertPointDDXSupport* pInsPt = FindInsertPoint(pModifications); EnvDTE::CodeElementPtr pIncludeElem = FindInclude(pClass, L"<atlddx.h>", true); if (pIncludeElem == NULL) { if (!pInsPt) { pInsPt = new InsertPointDDXSupport; pInsPt->bUseFloat = false; pInsPt->pBase = NULL; pInsPt->pElement = NULL; pModifications->InsertPoints.Add(pInsPt); } if (!pInsPt->pElement) { VSInclude* pInclude = new VSInclude; pInclude->Name = _T("<atlddx.h>"); pInsPt->pElement = pInclude; } } if (bUseFloat) { EnvDTE::CodeElementPtr pMacro = FindDefine(pClass, L"_ATL_USE_DDX_FLOAT", true); if (pMacro == NULL) { if (!pInsPt) { pInsPt = new InsertPointDDXSupport; pInsPt->pElement = NULL; pInsPt->pBase = NULL; pInsPt->bUseFloat = true; pModifications->InsertPoints.Add(pInsPt); } else { pInsPt->bUseFloat = true; } } } bool bBase = false; for (size_t i = 0; i < pClass->Parents.GetCount(); i++) { if ((pClass->Parents[i])->Name == _T("CWinDataExchange")) { bBase = true; break; } } if (!bBase) { //нужно добавить в качестве предка класс CWinDataExchange VSBase* pNewBase = new VSBase; pNewBase->Name = _T("CWinDataExchange<") + pClass->Name + _T(">"); pNewBase->pElement = NULL; pNewBase->pParent = (VSElement*)pClass; pClass->Parents.Add(pNewBase); if (!pInsPt) { pInsPt = new InsertPointDDXSupport; pInsPt->bUseFloat = false; pInsPt->pBase = NULL; pInsPt->pElement = NULL; pModifications->InsertPoints.Add(pInsPt); } if (!pInsPt->pBase) { pInsPt->pBase = pNewBase; } } pClass->m_bDDX = true; }
void NextRawTok (void) /* Read the next raw token from the input stream */ { Macro* M; /* If we've a forced end of assembly, don't read further */ if (ForcedEnd) { CurTok.Tok = TOK_EOF; return; } Restart: /* Check if we have tokens from another input source */ if (InputFromStack ()) { if (CurTok.Tok == TOK_IDENT && (M = FindDefine (&CurTok.SVal)) != 0) { /* This is a define style macro - expand it */ MacExpandStart (M); goto Restart; } return; } Again: /* Skip whitespace, remember if we had some */ if ((CurTok.WS = IsBlank (C)) != 0) { do { NextChar (); } while (IsBlank (C)); } /* Mark the file position of the next token */ Source->Func->MarkStart (Source); /* Clear the string attribute */ SB_Clear (&CurTok.SVal); /* Generate line info for the current token */ NewAsmLine (); /* Hex number or PC symbol? */ if (C == '$') { NextChar (); /* Hex digit must follow or DollarIsPC must be enabled */ if (!IsXDigit (C)) { if (DollarIsPC) { CurTok.Tok = TOK_PC; return; } else { Error ("Hexadecimal digit expected"); } } /* Read the number */ CurTok.IVal = 0; while (1) { if (UnderlineInNumbers && C == '_') { while (C == '_') { NextChar (); } if (!IsXDigit (C)) { Error ("Number may not end with underline"); } } if (IsXDigit (C)) { if (CurTok.IVal & 0xF0000000) { Error ("Overflow in hexadecimal number"); CurTok.IVal = 0; } CurTok.IVal = (CurTok.IVal << 4) + DigitVal (C); NextChar (); } else { break; } } /* This is an integer constant */ CurTok.Tok = TOK_INTCON; return; } /* Binary number? */ if (C == '%') { NextChar (); /* 0 or 1 must follow */ if (!IsBDigit (C)) { Error ("Binary digit expected"); } /* Read the number */ CurTok.IVal = 0; while (1) { if (UnderlineInNumbers && C == '_') { while (C == '_') { NextChar (); } if (!IsBDigit (C)) { Error ("Number may not end with underline"); } } if (IsBDigit (C)) { if (CurTok.IVal & 0x80000000) { Error ("Overflow in binary number"); CurTok.IVal = 0; } CurTok.IVal = (CurTok.IVal << 1) + DigitVal (C); NextChar (); } else { break; } } /* This is an integer constant */ CurTok.Tok = TOK_INTCON; return; } /* Number? */ if (IsDigit (C)) { char Buf[16]; unsigned Digits; unsigned Base; unsigned I; long Max; unsigned DVal; /* Ignore leading zeros */ while (C == '0') { NextChar (); } /* Read the number into Buf counting the digits */ Digits = 0; while (1) { if (UnderlineInNumbers && C == '_') { while (C == '_') { NextChar (); } if (!IsXDigit (C)) { Error ("Number may not end with underline"); } } if (IsXDigit (C)) { /* Buf is big enough to allow any decimal and hex number to ** overflow, so ignore excess digits here, they will be detected ** when we convert the value. */ if (Digits < sizeof (Buf)) { Buf[Digits++] = C; } NextChar (); } else { break; } } /* Allow zilog/intel style hex numbers with a 'h' suffix */ if (C == 'h' || C == 'H') { NextChar (); Base = 16; Max = 0xFFFFFFFFUL / 16; } else { Base = 10; Max = 0xFFFFFFFFUL / 10; } /* Convert the number using the given base */ CurTok.IVal = 0; for (I = 0; I < Digits; ++I) { if (CurTok.IVal > Max) { Error ("Number out of range"); CurTok.IVal = 0; break; } DVal = DigitVal (Buf[I]); if (DVal >= Base) { Error ("Invalid digits in number"); CurTok.IVal = 0; break; } CurTok.IVal = (CurTok.IVal * Base) + DVal; } /* This is an integer constant */ CurTok.Tok = TOK_INTCON; return; } /* Control command? */ if (C == '.') { /* Remember and skip the dot */ NextChar (); /* Check if it's just a dot */ if (!IsIdStart (C)) { /* Just a dot */ CurTok.Tok = TOK_DOT; } else { /* Read the remainder of the identifier */ SB_AppendChar (&CurTok.SVal, '.'); ReadIdent (); /* Dot keyword, search for it */ CurTok.Tok = FindDotKeyword (); if (CurTok.Tok == TOK_NONE) { /* Not found */ if (!LeadingDotInIdents) { /* Invalid pseudo instruction */ Error ("'%m%p' is not a recognized control command", &CurTok.SVal); goto Again; } /* An identifier with a dot. Check if it's a define style ** macro. */ if ((M = FindDefine (&CurTok.SVal)) != 0) { /* This is a define style macro - expand it */ MacExpandStart (M); goto Restart; } /* Just an identifier with a dot */ CurTok.Tok = TOK_IDENT; } } return; } /* Indirect op for sweet16 cpu. Must check this before checking for local ** symbols, because these may also use the '@' symbol. */ if (CPU == CPU_SWEET16 && C == '@') { NextChar (); CurTok.Tok = TOK_AT; return; } /* Local symbol? */ if (C == LocalStart) { /* Read the identifier. */ ReadIdent (); /* Start character alone is not enough */ if (SB_GetLen (&CurTok.SVal) == 1) { Error ("Invalid cheap local symbol"); goto Again; } /* A local identifier */ CurTok.Tok = TOK_LOCAL_IDENT; return; } /* Identifier or keyword? */ if (IsIdStart (C)) { /* Read the identifier */ ReadIdent (); /* Check for special names. Bail out if we have identified the type of ** the token. Go on if the token is an identifier. */ switch (SB_GetLen (&CurTok.SVal)) { case 1: switch (toupper (SB_AtUnchecked (&CurTok.SVal, 0))) { case 'A': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_ABS; } else { CurTok.Tok = TOK_A; } return; case 'F': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_FAR; return; } break; case 'S': if ((CPU == CPU_4510) || (CPU == CPU_65816)) { CurTok.Tok = TOK_S; return; } break; case 'X': CurTok.Tok = TOK_X; return; case 'Y': CurTok.Tok = TOK_Y; return; case 'Z': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_ZP; return; } else { if (CPU == CPU_4510) { CurTok.Tok = TOK_Z; return; } } break; default: break; } break; case 2: if ((CPU == CPU_4510) && (toupper (SB_AtUnchecked (&CurTok.SVal, 0)) == 'S') && (toupper (SB_AtUnchecked (&CurTok.SVal, 1)) == 'P')) { CurTok.Tok = TOK_S; return; } /* FALL THROUGH */ default: if (CPU == CPU_SWEET16 && (CurTok.IVal = Sweet16Reg (&CurTok.SVal)) >= 0) { /* A sweet16 register number in sweet16 mode */ CurTok.Tok = TOK_REG; return; } } /* Check for define style macro */ if ((M = FindDefine (&CurTok.SVal)) != 0) { /* Macro - expand it */ MacExpandStart (M); goto Restart; } else { /* An identifier */ CurTok.Tok = TOK_IDENT; } return; } /* Ok, let's do the switch */ CharAgain: switch (C) { case '+': NextChar (); CurTok.Tok = TOK_PLUS; return; case '-': NextChar (); CurTok.Tok = TOK_MINUS; return; case '/': NextChar (); if (C != '*') { CurTok.Tok = TOK_DIV; } else if (CComments) { /* Remember the position, then skip the '*' */ Collection LineInfos = STATIC_COLLECTION_INITIALIZER; GetFullLineInfo (&LineInfos); NextChar (); do { while (C != '*') { if (C == EOF) { LIError (&LineInfos, "Unterminated comment"); ReleaseFullLineInfo (&LineInfos); DoneCollection (&LineInfos); goto CharAgain; } NextChar (); } NextChar (); } while (C != '/'); NextChar (); ReleaseFullLineInfo (&LineInfos); DoneCollection (&LineInfos); goto Again; } return; case '*': NextChar (); CurTok.Tok = TOK_MUL; return; case '^': NextChar (); CurTok.Tok = TOK_XOR; return; case '&': NextChar (); if (C == '&') { NextChar (); CurTok.Tok = TOK_BOOLAND; } else { CurTok.Tok = TOK_AND; } return; case '|': NextChar (); if (C == '|') { NextChar (); CurTok.Tok = TOK_BOOLOR; } else { CurTok.Tok = TOK_OR; } return; case ':': NextChar (); switch (C) { case ':': NextChar (); CurTok.Tok = TOK_NAMESPACE; break; case '-': CurTok.IVal = 0; do { --CurTok.IVal; NextChar (); } while (C == '-'); CurTok.Tok = TOK_ULABEL; break; case '+': CurTok.IVal = 0; do { ++CurTok.IVal; NextChar (); } while (C == '+'); CurTok.Tok = TOK_ULABEL; break; case '=': NextChar (); CurTok.Tok = TOK_ASSIGN; break; default: CurTok.Tok = TOK_COLON; break; } return; case ',': NextChar (); CurTok.Tok = TOK_COMMA; return; case ';': NextChar (); while (C != '\n' && C != EOF) { NextChar (); } goto CharAgain; case '#': NextChar (); CurTok.Tok = TOK_HASH; return; case '(': NextChar (); CurTok.Tok = TOK_LPAREN; return; case ')': NextChar (); CurTok.Tok = TOK_RPAREN; return; case '[': NextChar (); CurTok.Tok = TOK_LBRACK; return; case ']': NextChar (); CurTok.Tok = TOK_RBRACK; return; case '{': NextChar (); CurTok.Tok = TOK_LCURLY; return; case '}': NextChar (); CurTok.Tok = TOK_RCURLY; return; case '<': NextChar (); if (C == '=') { NextChar (); CurTok.Tok = TOK_LE; } else if (C == '<') { NextChar (); CurTok.Tok = TOK_SHL; } else if (C == '>') { NextChar (); CurTok.Tok = TOK_NE; } else { CurTok.Tok = TOK_LT; } return; case '=': NextChar (); CurTok.Tok = TOK_EQ; return; case '!': NextChar (); CurTok.Tok = TOK_BOOLNOT; return; case '>': NextChar (); if (C == '=') { NextChar (); CurTok.Tok = TOK_GE; } else if (C == '>') { NextChar (); CurTok.Tok = TOK_SHR; } else { CurTok.Tok = TOK_GT; } return; case '~': NextChar (); CurTok.Tok = TOK_NOT; return; case '\'': /* Hack: If we allow ' as terminating character for strings, read ** the following stuff as a string, and check for a one character ** string later. */ if (LooseStringTerm) { ReadStringConst ('\''); if (SB_GetLen (&CurTok.SVal) == 1) { CurTok.IVal = SB_AtUnchecked (&CurTok.SVal, 0); CurTok.Tok = TOK_CHARCON; } else { CurTok.Tok = TOK_STRCON; } } else { /* Always a character constant */ NextChar (); if (C == EOF || IsControl (C)) { Error ("Illegal character constant"); goto CharAgain; } CurTok.IVal = C; CurTok.Tok = TOK_CHARCON; NextChar (); if (C != '\'') { if (!MissingCharTerm) { Error ("Illegal character constant"); } } else { NextChar (); } } return; case '\"': ReadStringConst ('\"'); CurTok.Tok = TOK_STRCON; return; case '\\': /* Line continuation? */ if (LineCont) { NextChar (); /* Next char should be a LF, if not, will result in an error later */ if (C == '\n') { /* Ignore the '\n' */ NextChar (); goto Again; } else { /* Make it clear what the problem is: */ Error ("EOL expected."); } } break; case '\n': NextChar (); CurTok.Tok = TOK_SEP; return; case EOF: CheckInputStack (); /* In case of the main file, do not close it, but return EOF. */ if (Source && Source->Next) { DoneCharSource (); goto Again; } else { CurTok.Tok = TOK_EOF; } return; } /* If we go here, we could not identify the current character. Skip it ** and try again. */ Error ("Invalid input character: 0x%02X", C & 0xFF); NextChar (); goto Again; }
// preprocessor directives BOOL FASTCALL comProc_Preprocess(U16 flags, S16 *brackCnt) { BOOL PREP_OK=FALSE; int code; S32 index; char *label,*enumClass; if(*szTemp != '#') { if(!STRCMP(szTemp,"enum")) { if(IsStringLabel(GetNextWord())) { enumClass = strdup(szTemp); GetNextWord(); } else enumClass = NULL; if(szTemp[0]!='{') { ssFree(enumClass); error(ERR_ENUMBRACK); SkipLine(FALSE); return TRUE; } GetNextWord(); index = 0; while(szTemp[0]!='}') { label = strdup(szTemp); if(GetNextWord()[0]=='=') { if(!IsStrNum(GetNextWord())) { error(ERR_INTEXP); } else { index = ConfirmWord(StrToInt(szTemp)); } if(*szTemp!='}' && *szTemp!=',') GetNextWord(); } AddEnum(enumClass,label,index++); ssFree(label); if(szTemp[0]!=',') break; GetNextWord(); } if(szTemp[0]!='}') { error(ERR_ENUMBRACK); SkipLine(FALSE); return TRUE; } ssFree(enumClass); return TRUE; } return FALSE; } switch(code = StrInPrep(GetNextWord(),szPreprocess)) { /**********************************************************************/ case PREPROCESS_SETPAD: if(InFalseIfDef()) break; if(GetNextWord()[0]=='"') { if(!DoString()) { error(ERR_INTEXP); } else { strncpy(szPadding,szString,sizeof(szPadding)-1); szPadding[sizeof(szPadding)-1] = '\0'; } } else if(IsStrNum(szTemp)) { index = StrToInt(szTemp); szPadding[0] = ConfirmChar(index); szPadding[1] = '\0'; PREP_OK = TRUE; } else error(ERR_INTEXP); break; /*--------------------------------------------------------------------*/ case PREPROCESS_ALIGN: if(InFalseIfDef()) break; if(IsStrNum(GetNextWord())) { index = StrToInt(szTemp); AlignCode(ConfirmWord(index)); PREP_OK = TRUE; } else error(ERR_INTEXP); break; /**********************************************************************/ case PREPROCESS_INCLUDE: if(InFalseIfDef()) break; if(GetNextWord()[0]=='"' && DoStringDirect()) { if(CompileScript(szString,NULL,NULL)) PREP_OK = TRUE; break; } error(ERR_STRINGEXP); break; /*--------------------------------------------------------------------*/ case PREPROCESS_INCBIN: // "filename"[,maxsize] if(InFalseIfDef()) break; if(GetNextWord()[0]=='"' && DoStringDirect()) { index = -1; if(PeekNextWord()[0]==',') { GetNextWord(); if(IsStrNum(GetNextWord())) { index = ConfirmWord(StrToInt(szTemp)); } else { error(ERR_INTEXP); PREP_OK = FALSE; } } if(IncBin(szString,index)) PREP_OK = TRUE; break; } error(ERR_STRINGEXP); break; /*--------------------------------------------------------------------*/ case PREPROCESS_USEPATH: // "pathname" if(InFalseIfDef()) break; if(GetNextWord()[0]=='"' && DoStringDirect()) { if(PRECOMPILING && !AddDirList(&includeDirList, szString)) { error(ERR_ADDINGPATH,szString); } PREP_OK = TRUE; break; } error(ERR_STRINGEXP); break; /**********************************************************************/ case PREPROCESS_DEFINE: if(InFalseIfDef()) break; USE_DEFS = FALSE; AddDefine(GetNextWord(),NULL); USE_DEFS = TRUE; PREP_OK = TRUE; break; /*--------------------------------------------------------------------*/ case PREPROCESS_UNDEF: if(InFalseIfDef()) break; USE_DEFS = FALSE; if(!DelDefine(GetNextWord())) error(ERR_UNDEFINE,szTemp); USE_DEFS = TRUE; PREP_OK = TRUE; break; /*--------------------------------------------------------------------*/ case PREPROCESS_IFDEF: if(InFalseIfDef()) break; USE_DEFS = FALSE; EnterIfDef(FindDefine(defList,GetNextWord())!=NULL); USE_DEFS = TRUE; PREP_OK = TRUE; break; /*--------------------------------------------------------------------*/ case PREPROCESS_IFNDEF: if(InFalseIfDef()) break; USE_DEFS = FALSE; EnterIfDef(FindDefine(defList,GetNextWord())==NULL); USE_DEFS = TRUE; PREP_OK = TRUE; break; /*--------------------------------------------------------------------*/ case PREPROCESS_ELSE: if(!curScript->ifdefTrack || curScript->ifdefTrack->ELSE) { error(ERR_PREPELSEUNEXP); } else { curScript->ifdefTrack->RESULT = !curScript->ifdefTrack->RESULT; curScript->ifdefTrack->ELSE = TRUE; } PREP_OK = TRUE; break; /*--------------------------------------------------------------------*/ case PREPROCESS_ENDIF: //TODO fix this ReleaseIfDef(); PREP_OK = TRUE; break; /**********************************************************************/ case PREPROCESS_TODO: case PREPROCESS_WARNING: case PREPROCESS_ERROR: case PREPROCESS_FATAL: if(InFalseIfDef()) break; if(GetNextWord()[0]!='"' || !DoString()) strcpy(szString,"<user message>"); switch(code) { case PREPROCESS_TODO: todo(szString); break; case PREPROCESS_WARNING: warning(WRN_USERPREP,szString); break; case PREPROCESS_ERROR: error(ERR_USERPREP,szString); break; case PREPROCESS_FATAL: fatal(FTL_USERPREP,szString); break; } PREP_OK = TRUE; break; /**********************************************************************/ case PREPROCESS_TELL: if(InFalseIfDef()) break; PREP_OK = TRUE; switch(code=CheckSubList(code)) { case PREPROCESS_TELL_BANK: CheckCurBank(); notice(code,"Current Bank: %s (#%d)", curBank->label, curBank->bank); break; case PREPROCESS_TELL_BANKOFFSET: CheckCurBank(); notice(code,"Current Bank: %s (#%d); Offset: $%04X (%d)", curBank->label, curBank->bank, (BANK_OFFSET(curBank)+curBank->org), (BANK_OFFSET(curBank)+curBank->org)); break; case PREPROCESS_TELL_BANKSIZE: CheckCurBank(); notice(code,"Current Bank: %s (#%d); Current Size: $%04X (%d bytes)", curBank->label, curBank->bank, (BANK_OFFSET(curBank)), (BANK_OFFSET(curBank))); break; case PREPROCESS_TELL_BANKFREE: CheckCurBank(); notice(code,"Current Bank: %s (#%d); Current Bytes Free In Bank: $%04X (%d)", curBank->label, curBank->bank, (BANK_OFFSET(curBank)), (BANK_OFFSET(curBank))); break; case PREPROCESS_TELL_BANKTYPE: CheckCurBank(); notice(code,"Current Bank: %s (#%d); Type: %s", curBank->label, curBank->bank, szBankTypes[curBank->type]); break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ case PREPROCESS_RAM: if(InFalseIfDef()) break; PREP_OK = TRUE; switch(code=CheckSubList(code)) { case PREPROCESS_RAM_ORG: // blockaddress[, maxsize] if(IsStrNum(GetNextWord())) { ramBank.org = 0; ramBank.ptr = ramBank.buffer+ConfirmWord(StrToInt(szTemp)); curBank = &ramBank; PREP_OK = TRUE; } else error(ERR_INTEXP); if(PeekNextWord()[0]==',') { GetNextWord(); if(IsStrNum(GetNextWord())) { ramBank.maxsize = BANK_OFFSET(curBank)+ConfirmWord(StrToInt(szTemp)); } else { error(ERR_INTEXP); PREP_OK = FALSE; } } curBank->end = curBank->buffer+ramBank.maxsize; break; case PREPROCESS_RAM_END: curBank = NULL; break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ case PREPROCESS_ROM: if(InFalseIfDef()) break; PREP_OK = TRUE; switch(code=CheckSubList(code)) { case PREPROCESS_ROM_ORG: // blockaddress[, maxsize] CheckRomBank(); if(IsStrNum(GetNextWord())) { #if 0 curBank->org = ConfirmWord(StrToInt(szTemp)); #else curBank->org = ConfirmWord(StrToInt(szTemp))-BANK_OFFSET(curBank); #endif PREP_OK = TRUE; } else error(ERR_INTEXP); if(PeekNextWord()[0]==',') { GetNextWord(); if(IsStrNum(GetNextWord())) { curBank->maxsize = ConfirmWord(StrToInt(szTemp)); } else { error(ERR_INTEXP); PREP_OK = FALSE; } } break; case PREPROCESS_ROM_END: CheckRomBank(); curBank = NULL; break; case PREPROCESS_ROM_BANKSIZE: // size if(IsStrNum(GetNextWord())) { bankSizes[BANKTYPE_ROM] = StrToInt(szTemp); if(bankSizes[BANKTYPE_ROM] > MAX_BANKSIZE) { error(ERR_BANKSIZE,bankSizes[BANKTYPE_ROM],MAX_BANKSIZE); bankSizes[BANKTYPE_ROM] = MAX_BANKSIZE; } PREP_OK = TRUE; } else error(ERR_INTEXP); if(PeekNextWord()[0]==',') { GetNextWord(); CheckRomBank(); if(IsStrNum(GetNextWord())) { curBank->maxsize = (StrToInt(szTemp)); } else { error(ERR_INTEXP); PREP_OK = FALSE; } } break; case PREPROCESS_ROM_BANK: // label if(!IsStringLabel(GetNextWord())) { error(ERR_BADLABEL,szTemp); strcpy(szTemp,""); } SetBank(BANKTYPE_ROM, szTemp); break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ case PREPROCESS_CHR: if(InFalseIfDef()) break; PREP_OK = TRUE; switch(code=CheckSubList(code)) { case PREPROCESS_CHR_BANKSIZE: // size if(IsStrNum(GetNextWord())) { bankSizes[BANKTYPE_CHR] = (StrToInt(szTemp)); if(bankSizes[BANKTYPE_CHR] > MAX_BANKSIZE) { error(ERR_BANKSIZE,bankSizes[BANKTYPE_CHR],MAX_BANKSIZE); bankSizes[BANKTYPE_CHR] = MAX_BANKSIZE; } PREP_OK = TRUE; } else error(ERR_INTEXP); if(PeekNextWord()[0]==',') { GetNextWord(); if(IsStrNum(GetNextWord())) { curBank->maxsize = (StrToInt(szTemp)); } else { error(ERR_INTEXP); PREP_OK = FALSE; } } break; case PREPROCESS_CHR_BANK: // label if(!IsStringLabel(GetNextWord())) { error(ERR_BADLABEL,szTemp); strcpy(szTemp,""); } SetBank(BANKTYPE_CHR, szTemp); break; case PREPROCESS_CHR_END: CheckChrBank(); curBank = NULL; break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ case PREPROCESS_INES: if(InFalseIfDef()) break; PREP_OK = TRUE; switch(code=CheckSubList(code)) { case PREPROCESS_INES_MAPPER: // (number|"name") if(GetNextWord()[0]=='"') { if(DoString()) { if((index=StrInStrint(szString, siMappers))==-1) error(ERR_UNKMAPPER,szString); else { romHeader.mapper = siMappers[index].index; PREP_OK = TRUE; } } } else if(IsStrNum(szTemp)) { romHeader.mapper = ConfirmChar(StrToInt(szTemp)); PREP_OK = TRUE; } else error(ERR_INTEXP); break; case PREPROCESS_INES_MIRRORING: // (number|"name") if(GetNextWord()[0]=='"') { if(DoString()) { if((index=StrInStrint(szString, siMirroring))==-1) error(ERR_UNKMIRRORING,szString); else { romHeader.mirroring = siMirroring[index].index; PREP_OK = TRUE; } } } else if(IsStrNum(szTemp)) { romHeader.mirroring = ConfirmChar(StrToInt(szTemp)); PREP_OK = TRUE; } else error(ERR_INTEXP); break; case PREPROCESS_INES_BATTERY: romHeader.battery = PreprocessCheckYesNo(&PREP_OK); break; case PREPROCESS_INES_TRAINER: romHeader.trainer = PreprocessCheckYesNo(&PREP_OK); break; case PREPROCESS_INES_FOURSCREEN: romHeader.fourscreen = PreprocessCheckYesNo(&PREP_OK); break; case PREPROCESS_INES_PRGREPEAT: if(IsStrNum(GetNextWord())) { romHeader.prgrepeat = ConfirmChar(StrToInt(szTemp)); PREP_OK = TRUE; } else error(ERR_INTEXP); break; case PREPROCESS_INES_CHRREPEAT: if(IsStrNum(GetNextWord())) { romHeader.chrrepeat = ConfirmChar(StrToInt(szTemp)); PREP_OK = TRUE; } else error(ERR_INTEXP); break; case PREPROCESS_INES_OFF: cfg.output.enableHeader = FALSE; break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ case PREPROCESS_INTERRUPT: if(InFalseIfDef()) break; PREP_OK = TRUE; if(!PRECOMPILING) switch(code=CheckSubList(code)) { case PREPROCESS_INTERRUPT_NMI: case PREPROCESS_INTERRUPT_START: case PREPROCESS_INTERRUPT_IRQ: PREP_OK = PreprocessInterrupt(code); break; default: error(ERR_PREPROCESSORID,szTemp); PREP_OK = FALSE; } break; /**********************************************************************/ default: error(ERR_PREPROCESSORID,szTemp); } if(!PREP_OK) SkipLine(TRUE); // if there was an error, skip to the next line return TRUE; }