⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globalparams.cc

📁 swf文件查看工具,能够看flash文件的格式
💻 CC
📖 第 1 页 / 共 5 页
字号:
Plugin *Plugin::load(char *type, char *name) {  GString *path;  Plugin *plugin;  XpdfPluginVecTable *vt;  XpdfBool (*xpdfInitPlugin)(void);#ifdef WIN32  HMODULE libA;#else  void *dlA;#endif  path = globalParams->getBaseDir();  appendToPath(path, "plugins");  appendToPath(path, type);  appendToPath(path, name);#ifdef WIN32  path->append(".dll");  if (!(libA = LoadLibrary(path->getCString()))) {    error(-1, "Failed to load plugin '%s'",	  path->getCString());    goto err1;  }  if (!(vt = (XpdfPluginVecTable *)	         GetProcAddress(libA, "xpdfPluginVecTable"))) {    error(-1, "Failed to find xpdfPluginVecTable in plugin '%s'",	  path->getCString());    goto err2;  }#else  //~ need to deal with other extensions here  path->append(".so");  if (!(dlA = dlopen(path->getCString(), RTLD_NOW))) {    error(-1, "Failed to load plugin '%s': %s",	  path->getCString(), dlerror());    goto err1;  }  if (!(vt = (XpdfPluginVecTable *)dlsym(dlA, "xpdfPluginVecTable"))) {    error(-1, "Failed to find xpdfPluginVecTable in plugin '%s'",	  path->getCString());    goto err2;  }#endif  if (vt->version != xpdfPluginVecTable.version) {    error(-1, "Plugin '%s' is wrong version", path->getCString());    goto err2;  }  memcpy(vt, &xpdfPluginVecTable, sizeof(xpdfPluginVecTable));#ifdef WIN32  if (!(xpdfInitPlugin = (XpdfBool (*)(void))	                     GetProcAddress(libA, "xpdfInitPlugin"))) {    error(-1, "Failed to find xpdfInitPlugin in plugin '%s'",	  path->getCString());    goto err2;  }#else  if (!(xpdfInitPlugin = (XpdfBool (*)(void))dlsym(dlA, "xpdfInitPlugin"))) {    error(-1, "Failed to find xpdfInitPlugin in plugin '%s'",	  path->getCString());    goto err2;  }#endif  if (!(*xpdfInitPlugin)()) {    error(-1, "Initialization of plugin '%s' failed",	  path->getCString());    goto err2;  }#ifdef WIN32  plugin = new Plugin(libA);#else  plugin = new Plugin(dlA);#endif  delete path;  return plugin; err2:#ifdef WIN32  FreeLibrary(libA);#else  dlclose(dlA);#endif err1:  delete path;  return NULL;}#ifdef WIN32Plugin::Plugin(HMODULE libA) {  lib = libA;}#elsePlugin::Plugin(void *dlA) {  dl = dlA;}#endifPlugin::~Plugin() {  void (*xpdfFreePlugin)(void);#ifdef WIN32  if ((xpdfFreePlugin = (void (*)(void))                            GetProcAddress(lib, "xpdfFreePlugin"))) {    (*xpdfFreePlugin)();  }  FreeLibrary(lib);#else  if ((xpdfFreePlugin = (void (*)(void))dlsym(dl, "xpdfFreePlugin"))) {    (*xpdfFreePlugin)();  }  dlclose(dl);#endif}#endif // ENABLE_PLUGINS//------------------------------------------------------------------------// parsing//------------------------------------------------------------------------GlobalParams::GlobalParams(char *cfgFileName) {  UnicodeMap *map;  GString *fileName;  FILE *f;  int i;#if MULTITHREADED  gInitMutex(&mutex);  gInitMutex(&unicodeMapCacheMutex);  gInitMutex(&cMapCacheMutex);#endif  initBuiltinFontTables();  // scan the encoding in reverse because we want the lowest-numbered  // index for each char name ('space' is encoded twice)  macRomanReverseMap = new NameToCharCode();  for (i = 255; i >= 0; --i) {    if (macRomanEncoding[i]) {      macRomanReverseMap->add(macRomanEncoding[i], (CharCode)i);    }  }#ifdef WIN32  // baseDir will be set by a call to setBaseDir  baseDir = new GString();#else  baseDir = appendToPath(getHomeDir(), ".xpdf");#endif  nameToUnicode = new NameToCharCode();  cidToUnicodes = new GHash(gTrue);  unicodeToUnicodes = new GHash(gTrue);  residentUnicodeMaps = new GHash();  unicodeMaps = new GHash(gTrue);  cMapDirs = new GHash(gTrue);  toUnicodeDirs = new GList();  displayFonts = new GHash();  displayCIDFonts = new GHash();  displayNamedCIDFonts = new GHash();#if HAVE_PAPER_H  char *paperName;  const struct paper *paperType;  paperinit();  if ((paperName = systempapername())) {    paperType = paperinfo(paperName);    psPaperWidth = (int)paperpswidth(paperType);    psPaperHeight = (int)paperpsheight(paperType);  } else {    error(-1, "No paper information available - using defaults");    psPaperWidth = defPaperWidth;    psPaperHeight = defPaperHeight;  }  paperdone();#else  psPaperWidth = defPaperWidth;  psPaperHeight = defPaperHeight;#endif  psImageableLLX = psImageableLLY = 0;  psImageableURX = psPaperWidth;  psImageableURY = psPaperHeight;  psCrop = gTrue;  psExpandSmaller = gFalse;  psShrinkLarger = gTrue;  psCenter = gTrue;  psDuplex = gFalse;  psLevel = psLevel2;  psFile = NULL;  psFonts = new GHash();  psNamedFonts16 = new GList();  psFonts16 = new GList();  psEmbedType1 = gTrue;  psEmbedTrueType = gTrue;  psEmbedCIDPostScript = gTrue;  psEmbedCIDTrueType = gTrue;  psPreload = gFalse;  psOPI = gFalse;  psASCIIHex = gFalse;  textEncoding = new GString("Latin1");#if defined(WIN32)  textEOL = eolDOS;#elif defined(MACOS)  textEOL = eolMac;#else  textEOL = eolUnix;#endif  textPageBreaks = gTrue;  textKeepTinyChars = gFalse;  fontDirs = new GList();  initialZoom = new GString("125");  continuousView = gFalse;  enableT1lib = gTrue;  enableFreeType = gTrue;  antialias = gTrue;  vectorAntialias = gTrue;  strokeAdjust = gTrue;  screenType = screenUnset;  screenSize = -1;  screenDotRadius = -1;  screenGamma = 1.0;  screenBlackThreshold = 0.0;  screenWhiteThreshold = 1.0;  urlCommand = NULL;  movieCommand = NULL;  mapNumericCharNames = gTrue;  mapUnknownCharNames = gFalse;  createDefaultKeyBindings();  printCommands = gFalse;  errQuiet = gFalse;  cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);  unicodeToUnicodeCache =      new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize);  unicodeMapCache = new UnicodeMapCache();  cMapCache = new CMapCache();#ifdef WIN32  winFontList = NULL;#endif#ifdef ENABLE_PLUGINS  plugins = new GList();  securityHandlers = new GList();#endif  // set up the initial nameToUnicode table  for (i = 0; nameToUnicodeTab[i].name; ++i) {    nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u);  }  // set up the residentUnicodeMaps table  map = new UnicodeMap("Latin1", gFalse,		       latin1UnicodeMapRanges, latin1UnicodeMapLen);  residentUnicodeMaps->add(map->getEncodingName(), map);  map = new UnicodeMap("ASCII7", gFalse,		       ascii7UnicodeMapRanges, ascii7UnicodeMapLen);  residentUnicodeMaps->add(map->getEncodingName(), map);  map = new UnicodeMap("Symbol", gFalse,		       symbolUnicodeMapRanges, symbolUnicodeMapLen);  residentUnicodeMaps->add(map->getEncodingName(), map);  map = new UnicodeMap("ZapfDingbats", gFalse, zapfDingbatsUnicodeMapRanges,		       zapfDingbatsUnicodeMapLen);  residentUnicodeMaps->add(map->getEncodingName(), map);  map = new UnicodeMap("UTF-8", gTrue, &mapUTF8);  residentUnicodeMaps->add(map->getEncodingName(), map);  map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);  residentUnicodeMaps->add(map->getEncodingName(), map);  // look for a user config file, then a system-wide config file  f = NULL;  fileName = NULL;  if (cfgFileName && cfgFileName[0]) {    fileName = new GString(cfgFileName);    if (!(f = fopen(fileName->getCString(), "r"))) {      delete fileName;    }  }  if (!f) {    fileName = appendToPath(getHomeDir(), xpdfUserConfigFile);    if (!(f = fopen(fileName->getCString(), "r"))) {      delete fileName;    }  }  if (!f) {#if defined(WIN32) && !defined(__CYGWIN32__)    char buf[512];    i = GetModuleFileName(NULL, buf, sizeof(buf));    if (i <= 0 || i >= sizeof(buf)) {      // error or path too long for buffer - just use the current dir      buf[0] = '\0';    }    fileName = grabPath(buf);    appendToPath(fileName, xpdfSysConfigFile);#else    fileName = new GString(xpdfSysConfigFile);#endif    if (!(f = fopen(fileName->getCString(), "r"))) {      delete fileName;    }  }  if (f) {    parseFile(fileName, f);    delete fileName;    fclose(f);  }}void GlobalParams::createDefaultKeyBindings() {  keyBindings = new GList();  //----- mouse buttons  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress1, xpdfKeyModNone,				     xpdfKeyContextAny, "startSelection"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease1, xpdfKeyModNone,				     xpdfKeyContextAny, "endSelection",				     "followLinkNoSel"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress2, xpdfKeyModNone,				     xpdfKeyContextAny, "startPan"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease2, xpdfKeyModNone,				     xpdfKeyContextAny, "endPan"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress3, xpdfKeyModNone,				     xpdfKeyContextAny, "postPopupMenu"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress4, xpdfKeyModNone,				     xpdfKeyContextAny,				     "scrollUpPrevPage(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress5, xpdfKeyModNone,				     xpdfKeyContextAny,				     "scrollDownNextPage(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress6, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollLeft(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress7, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollRight(16)"));  //----- keys  keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModCtrl,				     xpdfKeyContextAny, "gotoPage(1)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollToTopLeft"));  keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModCtrl,				     xpdfKeyContextAny, "gotoLastPage"));  keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModNone,				     xpdfKeyContextAny,				     "scrollToBottomRight"));  keyBindings->append(new KeyBinding(xpdfKeyCodePgUp, xpdfKeyModNone,				     xpdfKeyContextAny, "pageUp"));  keyBindings->append(new KeyBinding(xpdfKeyCodeBackspace, xpdfKeyModNone,				     xpdfKeyContextAny, "pageUp"));  keyBindings->append(new KeyBinding(xpdfKeyCodeDelete, xpdfKeyModNone,				     xpdfKeyContextAny, "pageUp"));  keyBindings->append(new KeyBinding(xpdfKeyCodePgDn, xpdfKeyModNone,				     xpdfKeyContextAny, "pageDown"));  keyBindings->append(new KeyBinding(' ', xpdfKeyModNone,				     xpdfKeyContextAny, "pageDown"));  keyBindings->append(new KeyBinding(xpdfKeyCodeLeft, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollLeft(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeRight, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollRight(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeUp, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollUp(16)"));  keyBindings->append(new KeyBinding(xpdfKeyCodeDown, xpdfKeyModNone,				     xpdfKeyContextAny, "scrollDown(16)"));  keyBindings->append(new KeyBinding('o', xpdfKeyModNone,				     xpdfKeyContextAny, "open"));  keyBindings->append(new KeyBinding('O', xpdfKeyModNone,				     xpdfKeyContextAny, "open"));  keyBindings->append(new KeyBinding('r', xpdfKeyModNone,				     xpdfKeyContextAny, "reload"));  keyBindings->append(new KeyBinding('R', xpdfKeyModNone,				     xpdfKeyContextAny, "reload"));  keyBindings->append(new KeyBinding('f', xpdfKeyModNone,				     xpdfKeyContextAny, "find"));  keyBindings->append(new KeyBinding('F', xpdfKeyModNone,				     xpdfKeyContextAny, "find"));  keyBindings->append(new KeyBinding('f', xpdfKeyModCtrl,				     xpdfKeyContextAny, "find"));  keyBindings->append(new KeyBinding('g', xpdfKeyModCtrl,				     xpdfKeyContextAny, "findNext"));  keyBindings->append(new KeyBinding('p', xpdfKeyModCtrl,				     xpdfKeyContextAny, "print"));  keyBindings->append(new KeyBinding('n', xpdfKeyModNone,				     xpdfKeyContextScrLockOff, "nextPage"));  keyBindings->append(new KeyBinding('N', xpdfKeyModNone,				     xpdfKeyContextScrLockOff, "nextPage"));  keyBindings->append(new KeyBinding('n', xpdfKeyModNone,				     xpdfKeyContextScrLockOn,				     "nextPageNoScroll"));  keyBindings->append(new KeyBinding('N', xpdfKeyModNone,				     xpdfKeyContextScrLockOn,				     "nextPageNoScroll"));  keyBindings->append(new KeyBinding('p', xpdfKeyModNone,				     xpdfKeyContextScrLockOff, "prevPage"));  keyBindings->append(new KeyBinding('P', xpdfKeyModNone,				     xpdfKeyContextScrLockOff, "prevPage"));  keyBindings->append(new KeyBinding('p', xpdfKeyModNone,				     xpdfKeyContextScrLockOn,				     "prevPageNoScroll"));  keyBindings->append(new KeyBinding('P', xpdfKeyModNone,				     xpdfKeyContextScrLockOn,				     "prevPageNoScroll"));  keyBindings->append(new KeyBinding('v', xpdfKeyModNone,				     xpdfKeyContextAny, "goForward"));  keyBindings->append(new KeyBinding('b', xpdfKeyModNone,				     xpdfKeyContextAny, "goBackward"));  keyBindings->append(new KeyBinding('g', xpdfKeyModNone,				     xpdfKeyContextAny, "focusToPageNum"));  keyBindings->append(new KeyBinding('0', xpdfKeyModNone,				     xpdfKeyContextAny, "zoomPercent(125)"));  keyBindings->append(new KeyBinding('+', xpdfKeyModNone,				     xpdfKeyContextAny, "zoomIn"));  keyBindings->append(new KeyBinding('-', xpdfKeyModNone,				     xpdfKeyContextAny, "zoomOut"));  keyBindings->append(new KeyBinding('z', xpdfKeyModNone,				     xpdfKeyContextAny, "zoomFitPage"));  keyBindings->append(new KeyBinding('w', xpdfKeyModNone,				     xpdfKeyContextAny, "zoomFitWidth"));  keyBindings->append(new KeyBinding('f', xpdfKeyModAlt,				     xpdfKeyContextAny,				     "toggleFullScreenMode"));  keyBindings->append(new KeyBinding('l', xpdfKeyModCtrl,				     xpdfKeyContextAny, "redraw"));  keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl,				     xpdfKeyContextAny, "closeWindow"));  keyBindings->append(new KeyBinding('?', xpdfKeyModNone,				     xpdfKeyContextAny, "about"));  keyBindings->append(new KeyBinding('q', xpdfKeyModNone,				     xpdfKeyContextAny, "quit"));  keyBindings->append(new KeyBinding('Q', xpdfKeyModNone,				     xpdfKeyContextAny, "quit"));}void GlobalParams::parseFile(GString *fileName, FILE *f) {  int line;  char buf[512];  /* extract path */  if(fileName) {    char* cfgFileName = fileName->getCString();    char* pos1 = strrchr(cfgFileName, '/');    char* pos2 = strrchr(cfgFileName, '\\');    char* p = pos1>pos2?pos1:pos2;    int pos = p ? p-cfgFileName : -1;    GString*path = new GString(new GString(cfgFileName), 0, (pos < 0 ? strlen(cfgFileName): pos));    if(pos1>=0)	path->append('/');    else if(pos2>=0)	path->append('\\');    else#ifdef WIN32	path->append('\\');#else	path->append('/');#endif    this->path = path;  } else {    this->path = new GString();  }    line = 1;  while (getLine(buf, sizeof(buf) - 1, f)) {    parseLine(buf, fileName, line);    ++line;  }}void GlobalParams::parseLine(char *buf, GString *fileName, int line) {  GList *tokens;  GString *cmd, *incFile;  char *p1, *p2;  FILE *f2;  // break the line into tokens  tokens = new GList();  p1 = buf;  while (*p1) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -