// // CreateGLMarker // lump_t *CreateGLMarker(void) { lump_t *level = wad.current_level; lump_t *cur; char name_buf[32]; if (strlen(level->name) <= 5) { sprintf(name_buf, "HO_%s", level->name); } else { FatalError("Level name too long: '%s'", level->name); } cur = NewLump(UtilStrDup(name_buf)); cur->lev_info = NewLevel(LEVEL_IS_GL); // link it in cur->next = level->next; cur->prev = level; if (cur->next) cur->next->prev = cur; level->next = cur; level->lev_info->buddy = cur; return cur; }
const char *GlbspStrDup(const char *str) { if (! str) return NULL; return UtilStrDup(str); }
// // Level name helper // static INLINE_G void AddLevelName(const char *name) { if ((wad.num_level_names % LEVNAME_BUNCH) == 0) { wad.level_names = (const char **) UtilRealloc((void *)wad.level_names, (wad.num_level_names + LEVNAME_BUNCH) * sizeof(const char *)); } wad.level_names[wad.num_level_names] = UtilStrDup(name); wad.num_level_names++; }
/* ** int EmvSelectAppMenu(char **pcMenuItems, int iMenuItemsTotal) ** ** ** This function provides an implementation of the Verix-V EMV Library ** inMenuFunc() callback function using our "pMenuFunc" callback function. ** ** ** This function is used to display a list of available options ** on the screen in the form of a menu, prompt the user to enter a ** selection from the menu and return the user's selection. ** ** pcMenuItems Buffer containing a list of menu-items to be ** displayed. Each menu-item is formatted as a ** NULL-terminated string. ** ** iMenuItemsTotal Total number of menu-items supplied. ** ** retval >= 1 Operation completed successfully. The ** value returned is the index of the ** menu item selected by the user (where ** 1 corresponds to the first item shown ** on the menu). ** retval TRANS_CANCELLED Transaction has been cancelled by the ** user */ int EmvCallbackFnSelectAppMenu(char **pcMenuItems, int iMenuItemsTotal) { int selected = 0; int i = 0; int last_item = 0; char jsontag[30] = ""; char *jsonvalue=NULL; unsigned int objlength; static char *data = NULL; char cardname_upper[60]=""; int itemtotal = iMenuItemsTotal; char namearr[20][30]; if(data == NULL) data =(char*)IRIS_GetObjectData( "CARD_NAME", &objlength); for(i=0;i<iMenuItemsTotal;i++) { jsonvalue = NULL; memset(cardname_upper,0,sizeof(cardname_upper)); strnupr (cardname_upper, pcMenuItems[i], strlen(pcMenuItems[i])); if(data) jsonvalue = (char*)IRIS_GetObjectTagValue( (const char *)data, cardname_upper ); if(jsonvalue && strncmp(jsonvalue,"DISABLE",7)==0) { strcpy( pcMenuItems[i],""); itemtotal -= 1; } else { last_item = i+1; } } UtilStrDup(&jsonvalue , NULL); //if(itemtotal == 1) return(last_item); if(itemtotal != iMenuItemsTotal ) { int j = 0; memset(namearr,0,sizeof(namearr)); for(i=0;i<iMenuItemsTotal;i++) { if(strlen(pcMenuItems[i])>0) { strcpy( namearr[j] , pcMenuItems[i]); j++; } } selected = DispArray(30000, (char **)namearr,j); } else { int iTo = 30000; if(itemtotal == 1) iTo = 5000; //gEmv.appsTotal = iMenuItemsTotal; selected = DispArray(iTo, pcMenuItems,iMenuItemsTotal); } if(selected > 0) return(selected); else if(itemtotal == 1 && (selected == -1 * EVT_TIMEOUT)) return(1); return(0); }
// // CreateGLLump // lump_t *CreateGLLump(const char *name) { lump_t *cur; lump_t *gl_level; # if DEBUG_DIR PrintDebug("Create GL Lump... %s\n", name); # endif // create GL level marker if necessary if (! wad.current_level->lev_info->buddy) CreateGLMarker(); gl_level = wad.current_level->lev_info->buddy; // check if already exists for (cur=gl_level->lev_info->children; cur; cur=cur->next) { if (strcmp(name, cur->name) == 0) break; } if (cur) { if (cur->data) UtilFree(cur->data); cur->data = NULL; cur->length = 0; cur->space = 0; return cur; } // nope, allocate new one cur = NewLump(UtilStrDup(name)); // link it in cur->next = gl_level->lev_info->children; cur->prev = NULL; if (cur->next) cur->next->prev = cur; gl_level->lev_info->children = cur; return cur; }
// // ReplaceExtension // char *ReplaceExtension(const char *filename, const char *ext) { char *dot_pos; char buffer[512]; strcpy(buffer, filename); dot_pos = strrchr(buffer, '.'); if (dot_pos) dot_pos[1] = 0; else strcat(buffer, "."); strcat(buffer, ext); return UtilStrDup(buffer); }
// // CreateLevelLump // lump_t *CreateLevelLump(const char *name) { lump_t *cur; # if DEBUG_DIR PrintDebug("Create Lump... %s\n", name); # endif // already exists ? for (cur=wad.current_level->lev_info->children; cur; cur=cur->next) { if (strcmp(name, cur->name) == 0) break; } if (cur) { if (cur->data) UtilFree(cur->data); cur->data = NULL; cur->length = 0; cur->space = 0; return cur; } // nope, allocate new one cur = NewLump(UtilStrDup(name)); // link it in cur->next = wad.current_level->lev_info->children; cur->prev = NULL; if (cur->next) cur->next->prev = cur; wad.current_level->lev_info->children = cur; return cur; }