| 1055 | } |
| 1056 | |
| 1057 | txID fxFindModule(txMachine* the, txSlot* realm, txID moduleID, txSlot* slot) |
| 1058 | { |
| 1059 | char name[C_PATH_MAX]; |
| 1060 | char path[C_PATH_MAX]; |
| 1061 | txInteger dot = 0; |
| 1062 | txString slash; |
| 1063 | fxToStringBuffer(the, slot, name, sizeof(name)); |
| 1064 | if (name[0] == '.') { |
| 1065 | if (name[1] == '/') { |
| 1066 | dot = 1; |
| 1067 | } |
| 1068 | else if ((name[1] == '.') && (name[2] == '/')) { |
| 1069 | dot = 2; |
| 1070 | } |
| 1071 | } |
| 1072 | if (dot) { |
| 1073 | if (moduleID == XS_NO_ID) |
| 1074 | return XS_NO_ID; |
| 1075 | c_strncpy(path, fxGetKeyName(the, moduleID), C_PATH_MAX - 1); |
| 1076 | path[C_PATH_MAX - 1] = 0; |
| 1077 | slash = c_strrchr(path, mxSeparator); |
| 1078 | if (!slash) |
| 1079 | return XS_NO_ID; |
| 1080 | if (dot == 2) { |
| 1081 | *slash = 0; |
| 1082 | slash = c_strrchr(path, mxSeparator); |
| 1083 | if (!slash) |
| 1084 | return XS_NO_ID; |
| 1085 | } |
| 1086 | #if mxWindows |
| 1087 | { |
| 1088 | char c; |
| 1089 | char* s = name; |
| 1090 | while ((c = *s)) { |
| 1091 | if (c == '/') |
| 1092 | *s = '\\'; |
| 1093 | s++; |
| 1094 | } |
| 1095 | } |
| 1096 | #endif |
| 1097 | } |
| 1098 | else |
| 1099 | slash = path; |
| 1100 | *slash = 0; |
| 1101 | if ((c_strlen(path) + c_strlen(name + dot)) >= sizeof(path)) |
| 1102 | xsRangeError("path too long"); |
| 1103 | c_strcat(path, name + dot); |
| 1104 | return fxNewNameC(the, path); |
| 1105 | } |
| 1106 | |
| 1107 | void fxLoadModule(txMachine* the, txSlot* module, txID moduleID) |
| 1108 | { |
nothing calls this directly
no test coverage detected