void attribute_hidden InitDynload() { DllInfo *dll; int which = addDLL(strdup("base"), "base", NULL); dll = &LoadedDLL[which]; R_init_base(dll); InitFunctionHashing(); }
/* returns DllInfo used by the embedding application. the underlying "(embedding)" entry is created if not present */ DllInfo *R_getEmbeddingDllInfo() { DllInfo *dll = R_getDllInfo("(embedding)"); if (dll == NULL) { int which = addDLL(strdup("(embedding)"), "(embedding)", NULL); dll = &LoadedDLL[which]; /* make sure we don't attempt dynamic lookup */ R_useDynamicSymbols(dll, FALSE); } return dll; }
static DllInfo *R_RegisterDLL(HINSTANCE handle, const char *path) { char *dpath, DLLname[PATH_MAX], *p; DllInfo *info; info = &LoadedDLL[CountDLL]; /* default is to use old-style dynamic lookup. The object's initialization routine can limit access by setting this to FALSE. */ info->useDynamicLookup = TRUE; info->forceSymbols = FALSE; dpath = (char *) malloc(strlen(path)+1); if(dpath == NULL) { strcpy(DLLerror, _("could not allocate space for 'path'")); R_osDynSymbol->closeLibrary(handle); return 0; } strcpy(dpath, path); if(R_osDynSymbol->fixPath) R_osDynSymbol->fixPath(dpath); /* keep only basename from path */ p = Rf_strrchr(dpath, FILESEP[0]); if(!p) p = dpath; else p++; if(strlen(p) < PATH_MAX) strcpy(DLLname, p); else error(_("DLLname '%s' is too long"), p); /* remove SHLIB_EXT if present */ p = DLLname + strlen(DLLname) - strlen(SHLIB_EXT); #ifdef Win32 /* case-insensitive file system */ if(p > DLLname && stricmp(p, SHLIB_EXT) == 0) *p = '\0'; #else if(p > DLLname && strcmp(p, SHLIB_EXT) == 0) *p = '\0'; #endif addDLL(dpath, DLLname, handle); return(info); }
void startDijkstra(char *startStation, char *destStation) // startNode ~ destNode까지의 최단거리 { mysubway *temp; int shortestNode = -1; int prevNode = -1; int sum = 0; int cnt = 0; char change[10]; char cname[30]; // ** 시작노드 ** Dijkstra *temper = Dlist; Dijkstra *show = NULL; Dijkstra *startNode = NULL; while (temper != NULL) { if (strcmp(temper->name, startStation) == 0) { startNode = temper; //printf("\ntemper->name: %s\n", startNode->name); break; } temper = temper->next; } startNode->found = 1; // 최단 경로를 찾았다. startNode->dist = 0; startNode->prev = NULL; // 자기 이전 녀석은 없다. // printf("시작역 : %s\n", startNode->name); // ** startNode에 직접적으로 연결되 있는 노드 탐색 ** temper = Dlist; while (temper != NULL) { temper->dist = findDist(startStation, temper->name, temper->kind); if (temper->dist < 999999 && temper->dist > 0) { temper->prev = startNode; } temper = temper->next; } // -------------여기까지 점검 완료 ---------------// while (1) { temper = findShortestNotFound(); if (temper == NULL) { return; } temper->found = 1; temp = map; // ----------- Original 을 불러옴 ------------- // while (temp != NULL) { if (strcmp(temper->name, temp->name) == 0 && strcmp(temper->kind, temp->kind) == 0) { // printf("%s 환승 %s\n", temp->name, temp->kind); break; } temp = temp->next; } while (temp->connect != NULL) { show = Dlist; while (show != NULL) { if (strcmp(show->name, temp->connect->name) == 0 && strcmp(show->kind, temp->connect->kind) == 0) { // printf("%s 환승2 %s\n", temp->name, temp->kind); break; } show = show->next; } if (show->dist > temper->dist + temp->connect->weight) // 더 짧은걸 발견 햇을때 { show->dist = temper->dist + temp->connect->weight; show->prev = temper; show->real = temp->connect->weight; } temp = temp->connect; } if (strcmp(temper->name, destStation) == 0) { Dijkstra *find = temper; // startNode부터 destNode까지의 최단거리를 찾았으니 // // destNode부터 prev해서 startNode로 길을 찾아감 // do { addDLL(find->name, find->real); if (find->real == 5 && strcmp(find->name, find->prev->name) == 0) { addFor(find->name); transflag = 1; } find = find->prev; } while (find != NULL); if (transflag == 1) { printFor(); } printRDLL(); if (startrans == 1) { temper->dist = temper->dist - 5; } printf("\n"); printf(">> 소요 거리: %d distance \n", temper->dist); printf("\n"); return; } } }s