void checkOpenGLHook() { static bool bCheckHookActive = false; if (bCheckHookActive) { ods("OpenGL: Recursion in checkOpenGLHook"); return; } bCheckHookActive = true; if (!bHooked) { HMODULE hGL = GetModuleHandle("OpenGL32.DLL"); if (lookupSymbols(hGL)) { char procname[1024]; GetModuleFileName(NULL, procname, 1024); ods("OpenGL: Hooking into OpenGL App %s", procname); // Add a ref to ourselves; we do NOT want to get unloaded directly from this process. HMODULE hTempSelf = NULL; GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<LPCTSTR>(&checkOpenGLHook), &hTempSelf); #define INJECT(handle, name) {\ o##name = reinterpret_cast<t##name>(GetProcAddress(handle, #name));\ if (o##name) {\ hh##name.setup(reinterpret_cast<voidFunc>(o##name), reinterpret_cast<voidFunc>(my##name));\ o##name = (t##name) hh##name.call;\ } else {\ ods("OpenGL: Could not resolve symbol %s in %s", #name, #handle);\ }\ } INJECT(hGL, wglSwapBuffers); } } else { hhwglSwapBuffers.check(); } bCheckHookActive = false; }
int main(int argc,char **argv) { char cmd[256]; if (argc<2) { printf("Usage: %s [source_file | source_dir]\n",argv[0]); exit(1); } // initialize data structures initDoxygen(); // setup the non-default configuration options // we need a place to put intermediate files Config_getString("OUTPUT_DIRECTORY")="/tmp/doxygen"; // disable html output Config_getBool("GENERATE_HTML")=FALSE; // disable latex output Config_getBool("GENERATE_LATEX")=FALSE; // be quiet Config_getBool("QUIET")=TRUE; // turn off warnings Config_getBool("WARNINGS")=FALSE; Config_getBool("WARN_IF_UNDOCUMENTED")=FALSE; Config_getBool("WARN_IF_DOC_ERROR")=FALSE; // Extract as much as possible Config_getBool("EXTRACT_ALL")=TRUE; Config_getBool("EXTRACT_STATIC")=TRUE; Config_getBool("EXTRACT_PRIVATE")=TRUE; Config_getBool("EXTRACT_LOCAL_METHODS")=TRUE; // Extract source browse information, needed // to make doxygen gather the cross reference info Config_getBool("SOURCE_BROWSER")=TRUE; // set the input Config_getList("INPUT").append(argv[1]); // check and finialize the configuration checkConfiguration(); adjustConfiguration(); // parse the files parseInput(); // iterate over the input files FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; // foreach file with a certain name for (fnli.toFirst();(fn=fnli.current());++fnli) { FileNameIterator fni(*fn); FileDef *fd; // for each file definition for (;(fd=fni.current());++fni) { // get the references (linked and unlinked) found in this file findXRefSymbols(fd); } } // remove temporary files if (!Doxygen::objDBFileName.isEmpty()) unlink(Doxygen::objDBFileName); if (!Doxygen::entryDBFileName.isEmpty()) unlink(Doxygen::entryDBFileName); // clean up after us rmdir("/tmp/doxygen"); while (1) { printf("> Type a symbol name or\n> .list for a list of symbols or\n> .quit to exit\n> "); fgets(cmd,256,stdin); QCString s(cmd); if (s.at(s.length()-1)=='\n') s=s.left(s.length()-1); // strip trailing \n if (s==".list") listSymbols(); else if (s==".quit") exit(0); else lookupSymbols(s); } }