globle void GetFunctionListFunction( void *theEnv, DATA_OBJECT *returnValue) { struct FunctionDefinition *theFunction; struct multifield *theList; unsigned long functionCount = 0; if (EnvArgCountCheck(theEnv,"get-function-list",EXACTLY,0) == -1) { EnvSetMultifieldErrorValue(theEnv,returnValue); return; } for (theFunction = GetFunctionList(theEnv); theFunction != NULL; theFunction = theFunction->next) { functionCount++; } SetpType(returnValue,MULTIFIELD); SetpDOBegin(returnValue,1); SetpDOEnd(returnValue,functionCount); theList = (struct multifield *) EnvCreateMultifield(theEnv,functionCount); SetpValue(returnValue,(void *) theList); for (theFunction = GetFunctionList(theEnv), functionCount = 1; theFunction != NULL; theFunction = theFunction->next, functionCount++) { SetMFType(theList,functionCount,SYMBOL); SetMFValue(theList,functionCount,theFunction->callFunctionName); } }
static void WriteNeededFunctions( void *theEnv, FILE *fp) { unsigned long int count = 0; size_t space, length; struct FunctionDefinition *functionList; /*================================================*/ /* Assign each function an index if it is needed. */ /*================================================*/ for (functionList = GetFunctionList(theEnv); functionList != NULL; functionList = functionList->next) { if (functionList->bsaveIndex) { functionList->bsaveIndex = (short int) count++; } else { functionList->bsaveIndex = -1; } } /*===================================================*/ /* Write the number of function names to be written. */ /*===================================================*/ GenWrite(&count,(unsigned long) sizeof(unsigned long int),fp); if (count == 0) { GenWrite(&count,(unsigned long) sizeof(unsigned long int),fp); return; } /*================================*/ /* Determine the amount of space */ /* needed for the function names. */ /*================================*/ space = FunctionBinarySize(theEnv); GenWrite(&space,(unsigned long) sizeof(unsigned long int),fp); /*===============================*/ /* Write out the function names. */ /*===============================*/ for (functionList = GetFunctionList(theEnv); functionList != NULL; functionList = functionList->next) { if (functionList->bsaveIndex >= 0) { length = strlen(ValueToString(functionList->callFunctionName)) + 1; GenWrite(ValueToString(functionList->callFunctionName),(unsigned long) length,fp); } } }
static void OutputUserFunctionsInfo( void *theEnv) { struct FunctionDefinition *theFunction; int i; for (theFunction = GetFunctionList(theEnv); theFunction != NULL; theFunction = theFunction->next) { OutputProfileInfo(theEnv,ValueToString(theFunction->callFunctionName), (struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID, theFunction->usrData), NULL,NULL,NULL,NULL); } for (i = 0; i < MAXIMUM_PRIMITIVES; i++) { if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL) { OutputProfileInfo(theEnv,EvaluationData(theEnv)->PrimitivesArray[i]->name, (struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID, EvaluationData(theEnv)->PrimitivesArray[i]->usrData), NULL,NULL,NULL,NULL); } } }
void dispHelp() { std::vector<UtilFunction*> list; GetFunctionList(list); std::sort(list.begin(), list.end(), SortFunctionList); printf("----------------------------------------------------------------------------\n"); printf(" MCF Utility\n"); printf("----------------------------------------------------------------------------\n"); printf("\n"); printf("Usage:\n"); for (size_t x=0; x<list.size(); x++) { printf(" -%c, --%s ", list[x]->getShortArg(), list[x]->getFullArg()); for (size_t y=0; y<list[x]->getNumArgs(); y++) { printf(" [%s] ", list[x]->getArgDesc(y)); } printf("\n\t%s\n\n", list[x]->getDescription()); } printf("\n"); printf("Copyright Linden Labs 2013 (http://github.com/desura/Desurium)\n"); printf("----------------------------------------------------------------------------\n"); }
globle int DefineFunction2( char *name, int returnType, int (*pointer)(void), char *actualName, char *restrictions) { struct FunctionDefinition *newFunction; if ( (returnType != 'a') && (returnType != 'b') && (returnType != 'c') && (returnType != 'd') && (returnType != 'f') && (returnType != 'i') && (returnType != 'j') && (returnType != 'k') && (returnType != 'l') && (returnType != 'm') && (returnType != 'n') && #if OBJECT_SYSTEM (returnType != 'o') && #endif (returnType != 's') && (returnType != 'u') && (returnType != 'v') && #if OBJECT_SYSTEM (returnType != 'x') && #endif (returnType != 'w') ) { return(0); } newFunction = get_struct(FunctionDefinition); newFunction->callFunctionName = (SYMBOL_HN *) AddSymbol(name); newFunction->returnValueType = (char) returnType; newFunction->functionPointer = pointer; newFunction->next = GetFunctionList(); newFunction->actualFunctionName = actualName; if (restrictions != NULL) { if (((int) (strlen(restrictions)) < 2) ? TRUE : ((! isdigit(restrictions[0]) && (restrictions[0] != '*')) || (! isdigit(restrictions[1]) && (restrictions[1] != '*')))) restrictions = NULL; } newFunction->restrictions = restrictions; newFunction->parser = NULL; newFunction->overloadable = TRUE; newFunction->sequenceuseok = TRUE; newFunction->usrData = NULL; IncrementSymbolCount(newFunction->callFunctionName); ListOfFunctions = newFunction; AddHashFunction(newFunction); return(1); }
static void InitializeFunctionNeededFlags( void *theEnv) { struct FunctionDefinition *functionList; for (functionList = GetFunctionList(theEnv); functionList != NULL; functionList = functionList->next) { functionList->bsaveIndex = 0; } }
void functionbp(void) { char *name = (char *)DialogBox(hInstance, "FUNCTIONBPDIALOG", hwndFrame, (DLGPROC) FunctionBPProc); if (name) { char buf[2048]; GetQualifiedName(buf, &name, FALSE, TRUE); // we aren't handling cast operators for now... if (*name) { name = NULL; } else { int count = 0; FUNCTIONLIST *list, *selected = NULL; DEBUG_INFO *dbg = findDebug(activeScope->address); list = GetFunctionList(dbg, activeScope, buf); if (list && list->next) { selected = (FUNCTIONLIST *)DialogBoxParam(hInstance, "FUNCTIONBPSELECTDIALOG", hwndFrame, (DLGPROC) FunctionBPSelectProc, (LPARAM)list); } else { selected = list; } if (selected) { int line; char module[MAX_PATH]; if (GetBreakpointLine(selected->address, module, &line, FALSE)) { Tag(TAG_BP, module, line, 0,0,0,0); } } if (list) { while (list) { FUNCTIONLIST *l = list; list = list->next; free(l); } } } } }
static size_t FunctionBinarySize( void *theEnv) { size_t size = 0; struct FunctionDefinition *functionList; for (functionList = GetFunctionList(theEnv); functionList != NULL; functionList = functionList->next) { if (functionList->bsaveIndex >= 0) { size += strlen(ValueToString(functionList->callFunctionName)) + 1; } } return(size); }
static struct FunctionDefinition *FastFindFunction( void *theEnv, char *functionName, struct FunctionDefinition *lastFunction) { struct FunctionDefinition *theList, *theFunction; /*========================*/ /* Get the function list. */ /*========================*/ theList = GetFunctionList(theEnv); if (theList == NULL) { return(NULL); } /*=======================================*/ /* If we completed a previous function */ /* search, start where we last left off. */ /*=======================================*/ if (lastFunction != NULL) { theFunction = lastFunction->next; } else { theFunction = theList; } /*======================================================*/ /* Traverse the rest of the function list searching for */ /* the named function wrapping around if necessary. */ /*======================================================*/ while (strcmp(functionName,ValueToString(theFunction->callFunctionName)) != 0) { theFunction = theFunction->next; if (theFunction == lastFunction) return(NULL); if (theFunction == NULL) theFunction = theList; } /*=======================*/ /* Return the pointer to */ /* the found function. */ /*=======================*/ return(theFunction); }
static void ProfileClearFunction( void *theEnv) { struct FunctionDefinition *theFunction; int i; for (theFunction = GetFunctionList(theEnv); theFunction != NULL; theFunction = theFunction->next) { theFunction->usrData = DeleteUserData(theEnv,ProfileFunctionData(theEnv)->ProfileDataID,theFunction->usrData); } for (i = 0; i < MAXIMUM_PRIMITIVES; i++) { if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL) { EvaluationData(theEnv)->PrimitivesArray[i]->usrData = DeleteUserData(theEnv,ProfileFunctionData(theEnv)->ProfileDataID,EvaluationData(theEnv)->PrimitivesArray[i]->usrData); } } }
globle void ProfileResetCommand( void *theEnv) { struct FunctionDefinition *theFunction; int i; #if DEFFUNCTION_CONSTRUCT DEFFUNCTION *theDeffunction; #endif #if DEFRULE_CONSTRUCT struct defrule *theDefrule; #endif #if DEFGENERIC_CONSTRUCT DEFGENERIC *theDefgeneric; unsigned int methodIndex; DEFMETHOD *theMethod; #endif #if OBJECT_SYSTEM DEFCLASS *theDefclass; HANDLER *theHandler; unsigned handlerIndex; #endif ProfileFunctionData(theEnv)->ProfileStartTime = 0.0; ProfileFunctionData(theEnv)->ProfileEndTime = 0.0; ProfileFunctionData(theEnv)->ProfileTotalTime = 0.0; ProfileFunctionData(theEnv)->LastProfileInfo = NO_PROFILE; for (theFunction = GetFunctionList(theEnv); theFunction != NULL; theFunction = theFunction->next) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theFunction->usrData)); } for (i = 0; i < MAXIMUM_PRIMITIVES; i++) { if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,EvaluationData(theEnv)->PrimitivesArray[i]->usrData)); } } #if DEFFUNCTION_CONSTRUCT for (theDeffunction = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,NULL); theDeffunction != NULL; theDeffunction = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,theDeffunction)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDeffunction->header.usrData)); } #endif #if DEFRULE_CONSTRUCT for (theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,NULL); theDefrule != NULL; theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,theDefrule)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefrule->header.usrData)); } #endif #if DEFGENERIC_CONSTRUCT for (theDefgeneric = (DEFGENERIC *) EnvGetNextDefgeneric(theEnv,NULL); theDefgeneric != NULL; theDefgeneric = (DEFGENERIC *) EnvGetNextDefgeneric(theEnv,theDefgeneric)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefgeneric->header.usrData)); for (methodIndex = EnvGetNextDefmethod(theEnv,theDefgeneric,0); methodIndex != 0; methodIndex = EnvGetNextDefmethod(theEnv,theDefgeneric,methodIndex)) { theMethod = GetDefmethodPointer(theDefgeneric,methodIndex); ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theMethod->usrData)); } } #endif #if OBJECT_SYSTEM for (theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,NULL); theDefclass != NULL; theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,theDefclass)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefclass->header.usrData)); for (handlerIndex = EnvGetNextDefmessageHandler(theEnv,theDefclass,0); handlerIndex != 0; handlerIndex = EnvGetNextDefmessageHandler(theEnv,theDefclass,handlerIndex)) { theHandler = GetDefmessageHandlerPointer(theDefclass,handlerIndex); ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theHandler->usrData)); } } #endif }
globle int DefineFunction3( void *theEnv, const char *name, int returnType, int (*pointer)(void *), const char *actualName, const char *restrictions, intBool environmentAware, void *context) { struct FunctionDefinition *newFunction; if ( (returnType != 'a') && (returnType != 'b') && (returnType != 'c') && (returnType != 'd') && (returnType != 'f') && (returnType != 'g') && (returnType != 'i') && (returnType != 'j') && (returnType != 'k') && (returnType != 'l') && (returnType != 'm') && (returnType != 'n') && #if OBJECT_SYSTEM (returnType != 'o') && #endif (returnType != 's') && (returnType != 'u') && (returnType != 'v') && #if OBJECT_SYSTEM (returnType != 'x') && #endif (returnType != 'w') ) { return(0); } newFunction = FindFunction(theEnv,name); if (newFunction == NULL) { newFunction = get_struct(theEnv,FunctionDefinition); newFunction->callFunctionName = (SYMBOL_HN *) EnvAddSymbol(theEnv,name); IncrementSymbolCount(newFunction->callFunctionName); newFunction->next = GetFunctionList(theEnv); ExternalFunctionData(theEnv)->ListOfFunctions = newFunction; AddHashFunction(theEnv,newFunction); } newFunction->returnValueType = (char) returnType; newFunction->functionPointer = (int (*)(void)) pointer; newFunction->actualFunctionName = actualName; if (restrictions != NULL) { if (((int) (strlen(restrictions)) < 2) ? TRUE : ((! isdigit(restrictions[0]) && (restrictions[0] != '*')) || (! isdigit(restrictions[1]) && (restrictions[1] != '*')))) restrictions = NULL; } newFunction->restrictions = restrictions; newFunction->parser = NULL; newFunction->overloadable = TRUE; newFunction->sequenceuseok = TRUE; newFunction->environmentAware = (short) environmentAware; newFunction->usrData = NULL; newFunction->context = context; return(1); }
bool DefineFunction3( void *theEnv, const char *name, int returnType, unsigned returnTypeBits, void (*pointer)(UDFContext *,CLIPSValue *), const char *actualName, int minArgs, int maxArgs, const char *restrictions, void *context) { struct FunctionDefinition *newFunction; if ( (returnType != 'a') && (returnType != 'b') && (returnType != 'c') && (returnType != 'd') && (returnType != 'f') && (returnType != 'g') && (returnType != 'i') && (returnType != 'j') && (returnType != 'k') && (returnType != 'l') && (returnType != 'm') && (returnType != 'n') && #if OBJECT_SYSTEM (returnType != 'o') && #endif (returnType != 's') && (returnType != 'u') && (returnType != 'v') && #if OBJECT_SYSTEM (returnType != 'x') && #endif #if DEFTEMPLATE_CONSTRUCT (returnType != 'y') && #endif (returnType != 'w') && (returnType != 'z')) { return(false); } newFunction = FindFunction(theEnv,name); if (newFunction != NULL) return(0); newFunction = get_struct(theEnv,FunctionDefinition); newFunction->callFunctionName = (SYMBOL_HN *) EnvAddSymbol(theEnv,name); IncrementSymbolCount(newFunction->callFunctionName); newFunction->next = GetFunctionList(theEnv); ExternalFunctionData(theEnv)->ListOfFunctions = newFunction; AddHashFunction(theEnv,newFunction); newFunction->returnValueType = (char) returnType; newFunction->unknownReturnValueType = returnTypeBits; newFunction->functionPointer = pointer; newFunction->actualFunctionName = actualName; newFunction->minArgs = minArgs; newFunction->maxArgs = maxArgs; if ((restrictions != NULL) && (returnType != 'z')) { if (((int) (strlen(restrictions)) < 2) ? true : ((! isdigit(restrictions[0]) && (restrictions[0] != '*')) || (! isdigit(restrictions[1]) && (restrictions[1] != '*')))) restrictions = NULL; } if (restrictions == NULL) { newFunction->restrictions = NULL; } else { newFunction->restrictions = EnvAddSymbol(theEnv,restrictions); IncrementSymbolCount(newFunction->restrictions); } newFunction->parser = NULL; newFunction->overloadable = true; newFunction->sequenceuseok = true; newFunction->usrData = NULL; newFunction->context = context; return(true); }
static void WriteFunctionExternDeclarations( FILE *fp) { struct FunctionDefinition *theFunction; fprintf(fp,"\n"); fprintf(fp,"/************************************/\n"); fprintf(fp,"/* EXTERNAL FUNCTION DEFINITIONS */\n"); fprintf(fp,"/************************************/\n\n"); for (theFunction = GetFunctionList(); theFunction != NULL; theFunction = theFunction->next) { fprintf(fp,"extern "); switch(theFunction->returnValueType) { case 'i': case 'b': fprintf(fp,"int "); break; case 'l': fprintf(fp,"long "); break; case 'f': fprintf(fp,"float "); break; case 'd': fprintf(fp,"double "); break; case 'w': case 's': case 'o': fprintf(fp,"SYMBOL_HN *"); break; case 'c': fprintf(fp,"char "); break; case 'a': case 'x': fprintf(fp,"void * "); break; case 'v': case 'm': case 'u': case 'n': case 'j': case 'k': fprintf(fp,"void "); break; default: SystemError("CONSCOMP",1); break; } fprintf(fp,"%s(",theFunction->actualFunctionName); switch(theFunction->returnValueType) { case 'i': case 'b': case 'l': case 'f': case 'd': case 'w': case 's': case 'o': case 'c': case 'a': case 'x': case 'v': fprintf(fp,"void"); break; case 'm': case 'u': case 'n': case 'j': case 'k': fprintf(fp,"DATA_OBJECT_PTR_ARG"); break; } fprintf(fp,");\n"); } }
void ProfileResetCommand( Environment *theEnv, UDFContext *context, UDFValue *returnValue) { struct functionDefinition *theFunction; int i; #if DEFFUNCTION_CONSTRUCT Deffunction *theDeffunction; #endif #if DEFRULE_CONSTRUCT Defrule *theDefrule; #endif #if DEFGENERIC_CONSTRUCT Defgeneric *theDefgeneric; unsigned short methodIndex; Defmethod *theMethod; #endif #if OBJECT_SYSTEM Defclass *theDefclass; DefmessageHandler *theHandler; unsigned handlerIndex; #endif ProfileFunctionData(theEnv)->ProfileStartTime = 0.0; ProfileFunctionData(theEnv)->ProfileEndTime = 0.0; ProfileFunctionData(theEnv)->ProfileTotalTime = 0.0; ProfileFunctionData(theEnv)->LastProfileInfo = NO_PROFILE; for (theFunction = GetFunctionList(theEnv); theFunction != NULL; theFunction = theFunction->next) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theFunction->usrData)); } for (i = 0; i < MAXIMUM_PRIMITIVES; i++) { if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,EvaluationData(theEnv)->PrimitivesArray[i]->usrData)); } } #if DEFFUNCTION_CONSTRUCT for (theDeffunction = GetNextDeffunction(theEnv,NULL); theDeffunction != NULL; theDeffunction = GetNextDeffunction(theEnv,theDeffunction)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDeffunction->header.usrData)); } #endif #if DEFRULE_CONSTRUCT for (theDefrule = GetNextDefrule(theEnv,NULL); theDefrule != NULL; theDefrule = GetNextDefrule(theEnv,theDefrule)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefrule->header.usrData)); } #endif #if DEFGENERIC_CONSTRUCT for (theDefgeneric = GetNextDefgeneric(theEnv,NULL); theDefgeneric != NULL; theDefgeneric = GetNextDefgeneric(theEnv,theDefgeneric)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefgeneric->header.usrData)); for (methodIndex = GetNextDefmethod(theDefgeneric,0); methodIndex != 0; methodIndex = GetNextDefmethod(theDefgeneric,methodIndex)) { theMethod = GetDefmethodPointer(theDefgeneric,methodIndex); ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theMethod->header.usrData)); } } #endif #if OBJECT_SYSTEM for (theDefclass = GetNextDefclass(theEnv,NULL); theDefclass != NULL; theDefclass = GetNextDefclass(theEnv,theDefclass)) { ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefclass->header.usrData)); for (handlerIndex = GetNextDefmessageHandler(theDefclass,0); handlerIndex != 0; handlerIndex = GetNextDefmessageHandler(theDefclass,handlerIndex)) { theHandler = GetDefmessageHandlerPointer(theDefclass,handlerIndex); ResetProfileInfo((struct constructProfileInfo *) TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theHandler->header.usrData)); } } #endif }
int main(int argc, char** argv) { int res = 0; if (argc < 2) { dispHelp(); return 1; } #ifdef WIN32 if (UTIL::FS::isValidFolder("bin")) SetDllDir(".\\bin"); #endif InitFactory(); std::vector<UtilFunction*> list; GetFunctionList(list); std::vector<std::string> args; UtilFunction* funct = NULL; for (size_t x=2; x<(size_t)argc; x++) { if (argv[x]) args.push_back(argv[x]); else break; } size_t len = strlen(argv[1]); if (len == 2 && argv[1][0] == '-') { for (size_t x=0; x<list.size(); x++) { if (list[x]->getShortArg() == argv[1][1]) { funct = list[x]; break; } } } if (len > 2 && argv[1][0] == '-' && argv[1][1] == '-') { std::string arg(argv[1]+2, len-2); for (size_t x=0; x<list.size(); x++) { if (arg == list[x]->getFullArg()) { funct = list[x]; break; } } } if (funct) { if (funct->getNumArgs() > args.size()) { printf("Not enought arguments. Expected:"); for (size_t y=0; y<funct->getNumArgs(); y++) { printf(" [%s] ", funct->getArgDesc(y)); } printf("\n"); res = -1; } else { printf("Running %s...\n", funct->getFullArg()); try { res = funct->performAction(args); funct->checkException(); } catch (gcException &e) { printf("%s Failed %s [%d.%d]\n", funct->getFullArg(), e.getErrMsg(), e.getErrId(), e.getSecErrId()); res = (e.getErrId()&0x0000FFFF) + (e.getSecErrId()<<16); } catch (std::exception &e) { printf("%s Failed %s\n", funct->getFullArg(), e.what()); res = -1; } catch (...) { printf("%s Failed: Failed to catch exception. :(\n", funct->getFullArg()); res = -1; } } } else { printf("Unknown Command Line Arg: %s. (no args for help)\n", argv[1]); } printf("--- Done ---\n"); return res; }
static int FunctionsToCode( char *fileName) { short i = 0; FILE *fp; int version = 1; int newHeader = TRUE; struct FunctionDefinition *fctnPtr; /*=============================*/ /* Assign a reference index to */ /* each of the functions. */ /*=============================*/ for (fctnPtr = GetFunctionList(); fctnPtr != NULL; fctnPtr = fctnPtr->next) { fctnPtr->bsaveIndex = i++; } /*=======================================*/ /* Create the file in which to store the */ /* function definition data structures. */ /*=======================================*/ if ((fp = NewCFile(fileName,2,version,FALSE)) == NULL) { return(0); } /*===============================================*/ /* Construct the definition of the function list */ /* from the definitions of the functions. */ /*===============================================*/ fprintf(fp,"\n\n"); fprintf(fp,"/************************************/\n"); fprintf(fp,"/* FUNCTION LIST DEFINITION */\n"); fprintf(fp,"/************************************/\n\n"); i = 1; fctnPtr = GetFunctionList(); while (fctnPtr != NULL) { if (newHeader) { fprintf(fp,"struct FunctionDefinition P%d_%d[] = {\n",ImageID,version); fprintf(HeaderFP,"extern struct FunctionDefinition P%d_%d[];\n",ImageID,version); newHeader = FALSE; } fprintf(fp,"{"); PrintSymbolReference(fp,fctnPtr->callFunctionName); fprintf(fp,",\"%s\",",fctnPtr->actualFunctionName); fprintf(fp,"'%c',",fctnPtr->returnValueType); fprintf(fp,"PTIF %s,",fctnPtr->actualFunctionName); fprintf(fp,"NULL,"); if (fctnPtr->restrictions != NULL) fprintf(fp,"\"%s\",",fctnPtr->restrictions); else fprintf(fp,"NULL,"); fprintf(fp,"0,0,0,"); PrintFunctionReference(fp,fctnPtr->next); i++; fctnPtr = fctnPtr->next; if ((i > MaxIndices) || (fctnPtr == NULL)) { fprintf(fp,"}};\n"); fclose(fp); i = 1; version++; if (fctnPtr != NULL) { if ((fp = NewCFile(fileName,2,version,FALSE)) == NULL) return(0); newHeader = TRUE; } } else { fprintf(fp,"},\n"); } } return(TRUE); }