Changeset 263
- Timestamp:
- 06/26/08 01:57:21 (4 months ago)
- Files:
-
- GtkRadiant/trunk/libs/synapse/synapse.cpp (modified) (36 diffs)
- GtkRadiant/trunk/plugins/config.mk (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
GtkRadiant/trunk/libs/synapse/synapse.cpp
r185 r263 40 40 { 41 41 42 static PFN_SYN_PRINTF_VA g_pPrintf = NULL; 43 42 static PFN_SYN_PRINTF_VA g_pPrintf = NULL; 43 44 44 void Set_Syn_Printf(PFN_SYN_PRINTF_VA pf) 45 45 { … … 53 53 char buf[BUFFER_SIZE]; 54 54 va_list args; 55 55 56 56 if (!text) 57 57 return; 58 58 59 59 if (g_pPrintf) 60 60 { … … 117 117 { 118 118 // browse the paths to locate all potential modules 119 119 120 120 Set_Syn_Printf(pf); 121 121 122 122 if (conf_file) 123 123 { … … 129 129 Syn_Printf("'%s' invalid/not found\n", conf_file); 130 130 return false; 131 } 131 } 132 132 } 133 133 … … 160 160 Str newModule; 161 161 newModule.Format("%s%s", path, name); 162 Syn_Printf("Found '%s'\n", newModule.GetBuffer()); 162 Syn_Printf("Found '%s'\n", newModule.GetBuffer()); 163 163 EnumerateInterfaces(newModule); 164 164 } … … 170 170 } 171 171 172 #if defined(_WIN32) 172 #if defined(_WIN32) 173 173 #define FORMAT_BUFSIZE 2048 174 174 const char* CSynapseServer::FormatGetLastError() … … 176 176 static char buf[FORMAT_BUFSIZE]; 177 177 FormatMessage( 178 FORMAT_MESSAGE_FROM_SYSTEM | 178 FORMAT_MESSAGE_FROM_SYSTEM | 179 179 FORMAT_MESSAGE_IGNORE_INSERTS, 180 180 NULL, … … 183 183 buf, 184 184 FORMAT_BUFSIZE, 185 NULL 185 NULL 186 186 ); 187 187 return buf; … … 240 240 CSynapseClientSlot slot; 241 241 slot.mpDLL = dlopen (soname.GetBuffer(), RTLD_NOW); 242 PFN_SYNAPSE_ENUMERATEINTERFACES *pEnumerate;243 242 if (!slot.mpDLL) 244 243 { 245 c har* error;244 const char* error; 246 245 if ((error = (char *)dlerror()) == NULL) 247 246 error = "Unknown"; … … 252 251 if (!slot.mpEnumerate) 253 252 { 254 c har* error;253 const char* error; 255 254 if ((error = (char *)dlerror()) == NULL) 256 255 error = "Unknown"; … … 265 264 if (dlclose(slot.mpDLL)) 266 265 { 267 c har* error;266 const char* error; 268 267 if ((error = (char *)dlerror()) == NULL) 269 268 error = "Unknown"; … … 286 285 if (dlclose(mpDLL)) 287 286 { 288 c har* error;287 const char* error; 289 288 if ((error = (char *)dlerror()) == NULL) 290 289 error = "Unknown"; … … 320 319 } 321 320 } 322 mStack.push_front(pAPI); 323 mbStackChanged = true; 321 mStack.push_front(pAPI); 322 mbStackChanged = true; 324 323 } 325 324 … … 374 373 } 375 374 } 376 } 375 } 377 376 else if (pAPI->mType == SYN_PROVIDE) 378 377 { … … 390 389 { 391 390 pClientSlot->ReleaseSO(); 392 } 391 } 393 392 return mClients.erase(iSlot); 394 393 } … … 397 396 { 398 397 /* walk through the standard APIs and push them in */ 399 int i,max = pClient->GetAPICount(); 398 int i,max = pClient->GetAPICount(); 400 399 for(i=0; i<max; i++) 401 400 { … … 406 405 } 407 406 } 408 407 409 408 /* if this client has 'List' API Manager types, walk through them for addition too */ 410 409 max = pClient->GetManagerListCount(); … … 420 419 } 421 420 } 422 421 423 422 /* if there are loose match managers, prompt them against the current list of SYN_PROVIDE interfaces 424 423 * and let them decide which ones they might want 425 424 */ 426 425 427 426 max = pClient->GetManagerMatchCount(); 428 427 … … 481 480 bool CSynapseServer::ResolveAPI(APIDescriptor_t* pAPI) 482 481 { 483 //Syn_Printf("In ResolveAPI %s %p '%s' '%s'\n", APITypeName[pAPI->mType], pAPI, pAPI->major_name, pAPI->minor_name); 482 //Syn_Printf("In ResolveAPI %s %p '%s' '%s'\n", APITypeName[pAPI->mType], pAPI, pAPI->major_name, pAPI->minor_name); 484 483 // loop through active clients, search for a client providing what we are looking for 485 484 list<CSynapseClientSlot>::iterator iClient; … … 532 531 } 533 532 } 534 } 533 } 535 534 } 536 535 return false; … … 561 560 } 562 561 563 // push the interfaces that need to be resolved for this client 562 // push the interfaces that need to be resolved for this client 564 563 // NOTE: this doesn't take care of the SYN_REQUIRE_ANY interfaces 565 564 PushRequired(pClient); … … 574 573 if (!mbStackChanged) 575 574 { 576 // the stack didn't change last loop 575 // the stack didn't change last loop 577 576 iCurrent++; 578 577 if (iCurrent==mStack.end()) … … 606 605 { 607 606 bool ret = DoResolve(pClient); 608 list<CSynapseClientSlot>::iterator iClient; 607 list<CSynapseClientSlot>::iterator iClient; 609 608 iClient = mClients.begin(); 610 609 while(iClient != mClients.end()) … … 627 626 // do a first pass to shutdown the clients nicely (i.e. decref, release memory and drop everything) 628 627 // we seperate the client shutdown calls from the dlclose cause that part is a clean decref / free situation whereas dlclose will break links without advice 629 list<CSynapseClientSlot>::iterator iClient; 628 list<CSynapseClientSlot>::iterator iClient; 630 629 iClient = mClients.begin(); 631 630 for(iClient = mClients.begin(); iClient != mClients.end(); iClient++) 632 631 { 633 632 (*iClient).mpClient->Shutdown(); 634 } 633 } 635 634 // now release them from the server's point of view 636 635 iClient = mClients.begin(); … … 638 637 { 639 638 iClient = ShutdownClient(iClient); 640 } 639 } 641 640 } 642 641 … … 653 652 void CSynapseServer::DumpActiveClients() 654 653 { 655 list<CSynapseClientSlot>::iterator iClient; 654 list<CSynapseClientSlot>::iterator iClient; 656 655 for(iClient=mClients.begin(); iClient!=mClients.end(); iClient++) 657 656 { … … 714 713 return true; 715 714 } 716 mpFocusedNode = mpFocusedNode->next; 715 mpFocusedNode = mpFocusedNode->next; 717 716 } 718 717 return false; … … 875 874 } 876 875 else if (type == SYN_REQUIRE) 877 { 876 { 878 877 if (size != 0) 879 878 { … … 898 897 return false; 899 898 } 900 mAPIDescriptors.push_back(pAPI); 899 mAPIDescriptors.push_back(pAPI); 901 900 #ifdef SYNAPSE_VERBOSE 902 901 Syn_Printf("AddAPI: %s %p '%s' '%s' from '%s', size %d\n", APITypeName[pAPI->mType], pAPI, major, minor, GetInfo(), pAPI->mSize); … … 942 941 943 942 bool CSynapseClient::ConfigXML( CSynapseServer *pServer, const char *client_name, const XMLConfigEntry_t entries[] ) { 944 943 945 944 if ( !client_name ) { 946 945 client_name = GetName(); 947 946 } 948 947 949 948 Syn_Printf("Dynamic APIs for client '%s'\n", GetInfo()); 950 949 if ( !pServer->SelectClientConfig( client_name ) ) … … 953 952 return false; 954 953 } 955 954 956 955 int i = 0; 957 956 while ( entries[i].type != SYN_UNKNOWN ) { // don't test pTable, for a SYN_PROVIDE it will be empty … … 1029 1028 { 1030 1029 assert(mType == API_MATCH); 1031 1030 1032 1031 /*! 1033 1032 if this interface has been allocated already, avoid requesting it again.. … … 1039 1038 return false; 1040 1039 } 1041 1040 1042 1041 if (!strcmp(major, major_pattern)) 1043 1042 return true; … … 1063 1062 char minor_tok[MAX_PATTERN_STRING]; 1064 1063 char *token; 1065 1064 1066 1065 if (mAPIs.size()) 1067 1066 { … … 1069 1068 return; 1070 1069 } 1071 1070 1072 1071 strncpy(minor_tok, minor_pattern, MAX_PATTERN_STRING); 1073 1072 token = strtok(minor_tok, " "); … … 1085 1084 } 1086 1085 } 1087 1086 1088 1087 int CSynapseAPIManager::GetAPICount() 1089 1088 {
