| 1139 | } |
| 1140 | |
| 1141 | bool CPlugin::ForEachExtVar(const ExtVarCallback& callback) |
| 1142 | { |
| 1143 | struct _ext |
| 1144 | { |
| 1145 | cell_t name; |
| 1146 | cell_t file; |
| 1147 | cell_t autoload; |
| 1148 | cell_t required; |
| 1149 | } *ext; |
| 1150 | |
| 1151 | IPluginContext *pBase = GetBaseContext(); |
| 1152 | for (uint32_t i = 0; i < pBase->GetPubVarsNum(); i++) |
| 1153 | { |
| 1154 | sp_pubvar_t *pubvar; |
| 1155 | if (pBase->GetPubvarByIndex(i, &pubvar) != SP_ERROR_NONE) |
| 1156 | continue; |
| 1157 | |
| 1158 | if (strncmp(pubvar->name, "__ext_", 6) != 0) |
| 1159 | continue; |
| 1160 | |
| 1161 | ext = (_ext *)pubvar->offs; |
| 1162 | |
| 1163 | ExtVar var; |
| 1164 | if (pBase->LocalToString(ext->file, &var.file) != SP_ERROR_NONE) |
| 1165 | continue; |
| 1166 | if (pBase->LocalToString(ext->name, &var.name) != SP_ERROR_NONE) |
| 1167 | continue; |
| 1168 | var.autoload = !!ext->autoload; |
| 1169 | var.required = !!ext->required; |
| 1170 | |
| 1171 | if (!callback(pubvar, var)) |
| 1172 | return false; |
| 1173 | } |
| 1174 | return true; |
| 1175 | } |
| 1176 | |
| 1177 | void CPlugin::ForEachLibrary(ke::Function<void(const char *)> callback) |
| 1178 | { |
no outgoing calls
no test coverage detected