void gui_setFileSelectionBoxPseudoResources(Widget widget, Var* dvStruct, Narray* publicResources) { int i, cont; char* name; Var* value; #if DEBUG fprintf(stderr, "DEBUG: gui_setFileSelectionBoxPseudoResources(widget = %ld, " "dvStruct = %ld, publicResources = %ld)\n", widget, dvStruct, publicResources); #endif /* Iterate over the struct, extracting any pseudo-resource items that * we set. Delete the items from the struct, and start iterating at the * beginning again. This is not really efficient, but I'm not sure how * else to do it without mucking about with Davinci's structures more than * I'd like to, or keeping track of what has/hasn't been set. */ cont = 1; while (cont && get_struct_count(dvStruct)) { cont = 0; for (i = 0; i < get_struct_count(dvStruct); i++) { get_struct_element(dvStruct, i, &name, &value); if (!strcmp(name, "dirListItemCount")) { /* Extrapolated from dirListItems. */ parse_error("WARNING: ignoring dirListItemCount"); free_var(Narray_delete(V_STRUCT(dvStruct), "dirListItemCount")); cont = 1; break; } if (!strcmp(name, "fileListItemCount")) { /* Extrapolated from fileListItems. */ parse_error("WARNING: ignoring fileListItemCount"); free_var(Narray_delete(V_STRUCT(dvStruct), "fileListItemCount")); cont = 1; break; } if (!strcmp(name, "dirListItems")) { setItems(widget, name, "dirListItemCount", value); free_var(Narray_delete(V_STRUCT(dvStruct), "dirListItems")); Narray_add(publicResources, name, NULL); cont = 1; break; } if (!strcmp(name, "fileListItems")) { setItems(widget, name, "fileListItemCount", value); free_var(Narray_delete(V_STRUCT(dvStruct), "fileListItems")); Narray_add(publicResources, name, NULL); cont = 1; break; } /* ...new comparisons go here. */ } } }
void remove_from_list_of_loaded_modules(Var* v) { int i; if (loaded_modules == NULL) { if (debug > DEBUG_THRESHOLD) { parse_error( "Cannot remove %s from the list of loaded modules. " "Reason: The list is empty.", v->name); } return; } if (v->name == NULL) { if (debug > DEBUG_THRESHOLD) { parse_error( "Cannot remove a module with (null) name " "from the list of active modules."); } return; } if ((i = Narray_find(loaded_modules, v->name, NULL)) != -1) { /* ** Specified module exists in the list of loaded modules. ** Remove it! */ Narray_delete(loaded_modules, v->name); } else { parse_error( "Cannot remove %s from the list of loaded modules. " "Reason: Module is not loaded.", v->name); } if (debug > DEBUG_THRESHOLD) { parse_error("Removing %s from the list of loaded modules.", v->name); } }