/* * Function: * XawAsciiSrcClassInitialize() * * Description: * Initializes the asciiSrcObjectClass and install the converters for * AsciiType <-> String. */ static void XawAsciiSrcClassInitialize(void) { XawInitializeWidgetSet(); Qstring = XrmPermStringToQuark(XtEstring); Qfile = XrmPermStringToQuark(XtEfile); XtAddConverter(XtRString, XtRAsciiType, CvtStringToAsciiType, NULL, 0); XtSetTypeConverter(XtRAsciiType, XtRString, CvtAsciiTypeToString, NULL, 0, XtCacheNone, NULL); }
/* * Implementation */ static void InitializeQuarks(void) { if (!haveQuarks) { Qhorizontal = XrmPermStringToQuark(XtEhorizontal); Qvertical = XrmPermStringToQuark(XtEvertical); haveQuarks = True; } }
static int GetValues( char* base, /* Base address to fetch values from */ XrmResourceList* res, /* The current resource values. */ register Cardinal num_resources, /* number of items in resources */ ArgList args, /* The resource values requested */ Cardinal num_args) /* number of items in arg list */ { register ArgList arg; register Cardinal i; register XrmName argName; register XrmResourceList* xrmres; int translation_arg_num = -1; static XrmQuark QCallback = NULLQUARK; static XrmQuark QTranslationTable = NULLQUARK; LOCK_PROCESS; if (QCallback == NULLQUARK) { QCallback = XrmPermStringToQuark(XtRCallback); QTranslationTable = XrmPermStringToQuark(XtRTranslationTable); } UNLOCK_PROCESS; /* Resource lists should be in compiled form already */ for (arg = args ; num_args != 0; num_args--, arg++) { argName = StringToName(arg->name); for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) { if (argName == (*xrmres)->xrm_name) { /* hack; do special cases here instead of a get_values_hook * because get_values_hook looses info as to * whether arg->value == NULL for ancient compatibility * mode in _XtCopyToArg. It helps performance, too... */ if ((*xrmres)->xrm_type == QCallback) { XtCallbackList callback = _XtGetCallbackList( (InternalCallbackList *) (base - (*xrmres)->xrm_offset - 1)); _XtCopyToArg( (char*)&callback, &arg->value, (*xrmres)->xrm_size); } else if ((*xrmres)->xrm_type == QTranslationTable) translation_arg_num = (int) (arg - args); else { _XtCopyToArg( base - (*xrmres)->xrm_offset - 1, &arg->value, (*xrmres)->xrm_size); } break; } } } return translation_arg_num; } /* GetValues */
/* * Implementation */ static void InitializeQuarks(void) { if (!haveQuarks) { Qleft = XrmPermStringToQuark(XtEleft); Qcenter = XrmPermStringToQuark(XtEcenter); Qright = XrmPermStringToQuark(XtEright); haveQuarks = True; } }
static void init_icon_quarks() { filleddiamondq = XrmPermStringToQuark("filleddiamond"); emptydiamondq = XrmPermStringToQuark("emptydiamond"); filledsquareq = XrmPermStringToQuark("filledsquare"); emptysquareq = XrmPermStringToQuark("emptysquare"); QUESTIONq = XrmPermStringToQuark("QUESTION"); FATALq = XrmPermStringToQuark("FATAL"); ERRORq = XrmPermStringToQuark("ERROR"); WARNINGq = XrmPermStringToQuark("WARNING"); INFOq = XrmPermStringToQuark("INFO"); noneq = XrmPermStringToQuark("none"); initialized = True; }
static void CompileResourceList(XtResourceList res, unsigned int num_res) { unsigned int count; #define xrmres ((XrmResourceList) res) for (count = 0; count < num_res; res++, count++) { xrmres->xrm_name = XrmPermStringToQuark(res->resource_name); xrmres->xrm_class = XrmPermStringToQuark(res->resource_class); xrmres->xrm_type = XrmPermStringToQuark(res->resource_type); xrmres->xrm_offset = -res->resource_offset - 1; xrmres->xrm_default_type = XrmPermStringToQuark(res->default_type); } #undef xrmres }
/* * This function is deprecated as of the addition of * XtCvtStringToGravity in R6 */ void XmuCvtStringToGravity(XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal) { static Boolean haveQuarks = False; char name[10]; XrmQuark q; struct _namepair *np; if (*num_args != 0) XtWarningMsg("wrongParameters","cvtStringToGravity","XtToolkitError", "String to Gravity conversion needs no extra arguments", (String *)NULL, (Cardinal *)NULL); if (!haveQuarks) { for (np = names; np->name; np++) np->quark = XrmPermStringToQuark(np->name); haveQuarks = True; } XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name)); q = XrmStringToQuark(name); for (np = names; np->name; np++) { if (np->quark == q) { done(&np->gravity, XtGravity); return; } } XtStringConversionWarning((char *)fromVal->addr, XtRGravity); }
int main (int argc, char *argv[]) { Widget toplevel; char *iname = NONAME, *cname = NONAME; XtAppContext xtcontext; XrmName names[101]; XrmClass classes[101]; int i; int mode = XrmEnumAllLevels; ProgramName = argv[0]; if (argc > 1 && argv[1][0] != '-') { cname = argv[1]; if (argc > 2 && argv[2][0] != '-') iname = argv[2]; } XrmStringToClassList(cname, classes); XrmStringToNameList(iname, names); for (i = 0; names[i]; i++) ; if (!i || classes[i] || !classes[i-1]) usage (); argv[0] = XrmNameToString(names[0]); toplevel = XtAppInitialize(&xtcontext, XrmClassToString(classes[0]), NULL, 0, &argc, argv, NULL, NULL, 0); iname = NULL; cname = NULL; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-1")) mode = XrmEnumOneLevel; else if (!strcmp(argv[i], "-V")) { printf("%s\n", PACKAGE_STRING); exit(0); } else if (argv[i][0] == '-') usage(); else if (!cname) cname = argv[i]; else if (!iname) iname = argv[i]; else usage(); } if (!iname) { XtGetApplicationNameAndClass(XtDisplay(toplevel), &iname, &cname); names[0] = XrmStringToName(iname); } XrmQString = XrmPermStringToQuark("String"); XrmEnumerateDatabase(XtDatabase(XtDisplay(toplevel)), names, classes, mode, DumpEntry, (XPointer)stdout); return (0); }
char * _XlcSetValues( XPointer base, XlcResourceList resources, int num_resources, XlcArgList args, int num_args, unsigned long mask) { XlcResourceList res; XrmQuark xrm_name; int count; for ( ; num_args-- > 0; args++) { res = resources; count = num_resources; xrm_name = XrmPermStringToQuark(args->name); for ( ; count-- > 0; res++) { if (xrm_name == res->xrm_name && (mask & res->mask)) { _XlcCopyFromArg(args->value, base + res->offset, res->size); break; } } if (count < 0) return args->name; } return NULL; }
void _XlcCompileResourceList( XlcResourceList resources, int num_resources) { for ( ; num_resources-- > 0; resources++) resources->xrm_name = XrmPermStringToQuark(resources->name); }
static void GetResourcePixmapPath(Display *display) { XrmName xrm_name[2]; XrmClass xrm_class[2]; XrmRepresentation rep_type; XrmValue value; static char *default_path = "%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; xrm_name[0] = XrmPermStringToQuark("pixmapFilePath"); xrm_name[1] = NULLQUARK; xrm_class[0] = XrmPermStringToQuark("PixmapFilePath"); xrm_class[1] = NULLQUARK; if (!XrmGetDatabase(display)) (void) XGetDefault(display, "", ""); if (XrmQGetResource(XrmGetDatabase(display), xrm_name, xrm_class, &rep_type, &value) && rep_type == XrmPermStringToQuark("String")) { int length = 0; char *tok, *buffer = XtNewString(value.addr); for (tok = strtok(buffer, ":"); tok; tok = strtok(NULL, ":")) { int toklen = strlen(tok); if (toklen) { pixmap_path = XtRealloc(pixmap_path, length + toklen + 5); strcpy(pixmap_path + length, tok); if (length) pixmap_path[length++] = ':'; sprintf(pixmap_path + length, "%s/%%N", tok); length += strlen(tok) + 3; } } pixmap_path = XtRealloc(pixmap_path, length + strlen(default_path) + 2); if (length) pixmap_path[length++] = ':'; strcpy(pixmap_path + length, default_path); } else pixmap_path = default_path; }
/* * Implementation */ static void XawTextSinkClassPartInitialize(WidgetClass wc) { TextSinkObjectClass t_src, superC; #ifndef OLDXAW static XtConvertArgRec CvtArgs[] = { {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.self), sizeof(Widget)}, }; #endif t_src = (TextSinkObjectClass) wc; superC = (TextSinkObjectClass) t_src->object_class.superclass; #ifndef OLDXAW extension_rec.record_type = XrmPermStringToQuark("TextSink"); extension_rec.next_extension = (XtPointer)t_src->text_sink_class.extension; t_src->text_sink_class.extension = &extension_rec; Qdefault = XrmPermStringToQuark("default"); #endif /* * We don't need to check for null super since we'll get to TextSink * eventually. */ if (t_src->text_sink_class.DisplayText == XtInheritDisplayText) t_src->text_sink_class.DisplayText = superC->text_sink_class.DisplayText; if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor) t_src->text_sink_class.InsertCursor = superC->text_sink_class.InsertCursor; if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground) t_src->text_sink_class.ClearToBackground = superC->text_sink_class.ClearToBackground; if (t_src->text_sink_class.FindPosition == XtInheritFindPosition) t_src->text_sink_class.FindPosition = superC->text_sink_class.FindPosition; if (t_src->text_sink_class.FindDistance == XtInheritFindDistance) t_src->text_sink_class.FindDistance = superC->text_sink_class.FindDistance; if (t_src->text_sink_class.Resolve == XtInheritResolve) t_src->text_sink_class.Resolve = superC->text_sink_class.Resolve; if (t_src->text_sink_class.MaxLines == XtInheritMaxLines) t_src->text_sink_class.MaxLines = superC->text_sink_class.MaxLines; if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight) t_src->text_sink_class.MaxHeight = superC->text_sink_class.MaxHeight; if (t_src->text_sink_class.SetTabs == XtInheritSetTabs) t_src->text_sink_class.SetTabs = superC->text_sink_class.SetTabs; if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds) t_src->text_sink_class.GetCursorBounds = superC->text_sink_class.GetCursorBounds; #ifndef OLDXAW XtSetTypeConverter(XtRString, XawRTextProperties, CvtStringToPropertyList, &CvtArgs[0], XtNumber(CvtArgs), XtCacheNone, NULL); XtSetTypeConverter(XawRTextProperties, XtRString, CvtPropertyListToString, NULL, 0, XtCacheNone, NULL); #endif }
*num_dst = dst_len; } /* NOTE: name, class, and type must be permanent strings */ static Boolean _GetResource( Display *dpy, XrmSearchList list, String name, String class, String type, XrmValue* value) { XrmRepresentation db_type; XrmValue db_value; XrmName Qname = XrmPermStringToQuark(name); XrmClass Qclass = XrmPermStringToQuark(class); XrmRepresentation Qtype = XrmPermStringToQuark(type); if (XrmQGetSearchResource(list, Qname, Qclass, &db_type, &db_value)) { if (db_type == Qtype) { if (Qtype == _XtQString) *(String*)value->addr = db_value.addr; else (void) memmove(value->addr, db_value.addr, value->size ); return True; } else { WidgetRec widget; /* hack, hack */ bzero( &widget, sizeof(widget) ); widget.core.self = &widget; widget.core.widget_class = coreWidgetClass;
void _XmInitializeTraits() { /* avoid initializing more than once */ if(TraitTable != NULL) return; /* Create Hash Table */ TraitTable = _XmAllocHashTable(200, TraitCompare, TraitHash); XmQTmotifTrait = XrmPermStringToQuark("XmQTmotifTrait"); /* Menu system manipulation and status */ XmQTmenuSystem = XrmPermStringToQuark("XmTmenuSystem"); XmQTmenuSavvy = XrmPermStringToQuark("XmTmenuSavvy"); /* Transfer Trait */ XmQTtransfer = XrmPermStringToQuark("XmTtransfer"); /* String get/set */ XmQTaccessTextual = XrmPermStringToQuark("XmTaccessTextual"); /* Navigator/Scrolling trait */ XmQTnavigator = XrmPermStringToQuark("XmTnavigator"); XmQTscrollFrame = XrmPermStringToQuark("XmTscrollFrame"); _XmQTclipWindow= XrmPermStringToQuark("_XmTclipWindow"); /* Activatable trait */ XmQTactivatable = XrmPermStringToQuark("XmTactivatable"); /* JoinSide trait */ XmQTjoinSide = XrmPermStringToQuark("XmTjoinSide"); /* DialogShellSavvy trait */ XmQTdialogShellSavvy = XrmPermStringToQuark("XmTdialogShellSavvy"); /* Care about Parent Visual trait */ XmQTcareParentVisual = XrmPermStringToQuark("XmTcareParentVisual"); /* SpecifyRenderTable trait */ XmQTspecifyRenderTable = XrmPermStringToQuark("XmTspecifyRenderTable"); /* TakesDefault trait */ XmQTtakesDefault = XrmPermStringToQuark("XmTtakesDefault"); /* Container/Item trait */ XmQTcontainerItem = XrmPermStringToQuark("XmTcontainerItem"); XmQTcontainer = XrmPermStringToQuark("XmTcontainer"); /* LayoutDirection trait */ XmQTspecifyLayoutDirection = XrmPermStringToQuark("XmTspecifyLayoutDirection"); /* get colors */ XmQTaccessColors = XrmPermStringToQuark("XmTaccessColors"); /* Unit type */ XmQTspecifyUnitType = XrmPermStringToQuark("XmTspecifyUnitType"); /* Traversal control. */ XmQTtraversalControl = XrmPermStringToQuark("XmTtraversalControl"); /* Specify UnHighlight GC trait */ XmQTspecifyUnhighlight = XrmPermStringToQuark("XmTspecifyUnhighlight"); /* PointIn trait */ XmQTpointIn = XrmPermStringToQuark("XmTpointIn"); /* ToolTip traits */ XmQTtoolTipConfig = XrmPermStringToQuark("XmTtoolTipConfig"); XmQTtoolTip = XrmPermStringToQuark("XmTtoolTip"); }
/*ARGSUSED*/ Widget _XmCreateTab(Widget parent, String name, /* unused */ ArgList arglist, Cardinal argcount) { static XrmQuark quarks[] = {0, 0, 0, 0, 0}; XmTabList tl = (XmTabList)parent; XrmQuark qarg; float value = 0.0; unsigned char units = XmPIXELS; XmOffsetModel model = XmABSOLUTE; unsigned char alignment = XmALIGNMENT_BEGINNING; char *decimal = "."; XmTab tab, start; int i; /* Init quark list */ if (quarks[0] == 0) { quarks[0] = XrmPermStringToQuark(XmNtabValue); quarks[1] = XrmPermStringToQuark(XmNunitType); quarks[2] = XrmPermStringToQuark(XmNoffsetModel); quarks[3] = XrmPermStringToQuark(XmNalignment); quarks[4] = XrmPermStringToQuark(XmNdecimal); } /* Get arguments from arglist */ for (i = 0; i < argcount; i++) { qarg = XrmStringToQuark(arglist[i].name); if (qarg == quarks[0]) value = (float)arglist[i].value; else if (qarg == quarks[1]) units = (unsigned char)arglist[i].value; else if (qarg == quarks[2]) model = (XmOffsetModel)arglist[i].value; else if (qarg == quarks[3]) alignment = (unsigned char)arglist[i].value; else if (qarg == quarks[4]) decimal = (char *)arglist[i].value; } tab = XmTabCreate(value, units, model, alignment, decimal); if (_XmTabLCount(tl) == 0) { _XmTabLStart(tl) = tab; _XmTabPrev(tab) = tab; _XmTabNext(tab) = tab; } else { start = _XmTabLStart(tl); _XmTabNext(tab) = start; _XmTabPrev(tab) = _XmTabPrev(start); _XmTabNext(_XmTabPrev(start)) = tab; _XmTabPrev(start) = tab; } _XmTabLCount(tl)++; return((Widget)NULL); }
/* * version that reads pixmap data as well as bitmap data */ Pixmap XmuLocatePixmapFile(Screen *screen, _Xconst char *name, unsigned long fore, unsigned long back, unsigned int depth, char *srcname, int srcnamelen, int *widthp, int *heightp, int *xhotp, int *yhotp) { #ifndef BITMAPDIR #define BITMAPDIR "/usr/include/X11/bitmaps" #endif Display *dpy = DisplayOfScreen (screen); Window root = RootWindowOfScreen (screen); Bool try_plain_name = True; XmuCvtCache *cache = _XmuCCLookupDisplay (dpy); char **file_paths = (char **) NULL; char filename[PATH_MAX]; #if 0 char* bitmapdir = BITMAPDIR; #endif unsigned int width, height; int xhot, yhot; int i; /* * look in cache for bitmap path */ if (cache) { if (!cache->string_to_bitmap.bitmapFilePath) { XrmName xrm_name[2]; XrmClass xrm_class[2]; XrmRepresentation rep_type; XrmValue value; xrm_name[0] = XrmPermStringToQuark ("bitmapFilePath"); xrm_name[1] = NULLQUARK; xrm_class[0] = XrmPermStringToQuark ("BitmapFilePath"); xrm_class[1] = NULLQUARK; if (!XrmGetDatabase(dpy)) { /* what a hack; need to initialize it */ (void) XGetDefault (dpy, "", ""); } if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class, &rep_type, &value) && rep_type == XrmPermStringToQuark("String")) { cache->string_to_bitmap.bitmapFilePath = split_path_string (value.addr); } } file_paths = cache->string_to_bitmap.bitmapFilePath; } /* * Search order: * 1. name if it begins with / or ./ * 2. "each prefix in file_paths"/name * 3. BITMAPDIR/name * 4. name if didn't begin with / or . */ for (i = 1; i <= 4; i++) { char *fn = filename; Pixmap pixmap; unsigned char *data; switch (i) { case 1: #ifndef __UNIXOS2__ if (!(name[0] == '/' || ((name[0] == '.') && name[1] == '/'))) #else if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') || (isalpha(name[0]) && name[1] == ':'))) #endif continue; fn = (char *) name; try_plain_name = False; break; case 2: if (file_paths && *file_paths) { XmuSnprintf(filename, sizeof(filename), "%s/%s", *file_paths, name); file_paths++; i--; break; } continue; case 3: XmuSnprintf(filename, sizeof(filename), "%s/%s", BITMAPDIR, name); break; case 4: if (!try_plain_name) continue; fn = (char *) name; break; } data = NULL; pixmap = None; #ifdef __UNIXOS2__ fn = (char*)__XOS2RedirRoot(fn); #endif if (XmuReadBitmapDataFromFile (fn, &width, &height, &data, &xhot, &yhot) == BitmapSuccess) { pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data, width, height, fore, back, depth); XFree ((char *)data); } if (pixmap) { if (widthp) *widthp = (int)width; if (heightp) *heightp = (int)height; if (xhotp) *xhotp = xhot; if (yhotp) *yhotp = yhot; if (srcname && srcnamelen > 0) { strncpy (srcname, fn, srcnamelen - 1); srcname[srcnamelen - 1] = '\0'; } return pixmap; } } return None; }
Bool LoaderInitializeOptions(void) { static int first = 1; static char *modules = "lib/modules"; volatile Bool options_ok = False; char *ptr, query[256]; char *ptr2, query2[256]; char *type; XrmValue value; XrmQuark names[2]; XrmQuark classes[2]; volatile int i; static ModuleType module_types[] = { GenericModule, FontRendererModule, InputModule, VideoModule, NullModule }; /* The offset in this vector must match loader.h:enum ModuleType values */ static char *module_strs[] = { "Null Module", "Video Module", "Input Module", "Generic Module", "Font Module" }; if (first) { checkerLegend = (char**) XtCalloc(1, sizeof(char*) * (CHECKER_LAST_MESSAGE + 1)); checkerErrors = (int*) XtCalloc(1, sizeof(int) * (CHECKER_LAST_MESSAGE + 1)); xf86cfgLoaderInit(); first = 0; checkerLegend[CHECKER_OPTIONS_FILE_MISSING] = "The Options file, normally /usr/X11R6/lib/X11/Options was not found.\n"; checkerLegend[CHECKER_OPTION_DESCRIPTION_MISSING] = "No description for the module option. The description should be in\n" "in the Options file, and using the sintax:\n" "Module.Option: any text describing the option"; checkerLegend[CHECKER_LOAD_FAILED] = "Failed to load the module. Usually the loader will print a complete\n" "description for the reason the module was not loaded. Use the -verbose\n" "command line option if it is not printing any messages."; checkerLegend[CHECKER_RECOGNIZED_AS] = "This message means the module code did not follow what was expected\n" "by the checker. For video drivers, it did not call xf86AddDriver,\n" "a input module did not call xf86AddInputDriver and a font renderer\n" "module did not call LoadFont. This message can also be printed if\n" "the module is in the incorrect directory."; checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] = "The driver does not have an AvailableOptions function, or that\n" "function is returning NULL. If the driver is returning NULL, and\n" "really does not need any options from "__XCONFIGFILE__", than the message\n" "can be ignored."; checkerLegend[CHECKER_NO_VENDOR_CHIPSET] = "The checker could not fetch the PCI chipset/vendor information from\n" "the module. The checker currently wraps xf86PrintChipsets and\n" "xf86MatchPciInstances to read the information from the module."; checkerLegend[CHECKER_CANNOT_VERIFY_CHIPSET] = "The vendor id was not found, so it is not possible to search the list\n" "of chipsets."; checkerLegend[CHECKER_OPTION_UNUSED] = "The option description is defined in the Options file, but the option\n" "was name not retrieved when calling the module AvailableOptions."; checkerLegend[CHECKER_NOMATCH_CHIPSET_STRINGS] = "The string specified in the module does not match the one in\n" "common/xf86PciInfo.h"; checkerLegend[CHECKER_CHIPSET_NOT_LISTED] = "This means that common/xf86PciInfo.h does not have an entry for the\n" "given vendor and id."; checkerLegend[CHECKER_CHIPSET_NOT_SUPPORTED] = "The chipset is listed in common/xf86PciInfo.h, but the driver does\n" "not support it, or does not list it in the chipsets fetched by the checker."; checkerLegend[CHECKER_CHIPSET_NO_VENDOR] = "The vendor id specified to xf86MatchPciInstances is not defined in\n" "common/xf86PciInfo.h"; checkerLegend[CHECKER_NO_CHIPSETS] = "No chipsets were passed to xf86MatchPciIntances."; checkerLegend[CHECKER_FILE_MODULE_NAME_MISMATCH] = "The module name string does not match the the modname field of the\n" "XF86ModuleVersionInfo structure. This generally is not an error, but\n" "to may be a good idea to use the same string to avoid confusion."; } if (XF86Module_path == NULL) { XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2); sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); } if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath)) loaderPath = strdup(XF86Module_path); else /* nothing new */ return (True); if (!noverify) { options_ok = InitializeOptionsDatabase(); InitializePciInfo(); } for (i = 0; module_types[i] != NullModule; i++) { xf86cfgLoaderInitList(module_types[i]); if (!noverify) ErrorF("================= Checking modules of type \"%s\" =================\n", module_strs[module_types[i]]); if (loaderList) { for (ploaderList = loaderList; *ploaderList; ploaderList++) { signal_caught = 0; signal(SIGTRAP, sig_handler); signal(SIGBUS, sig_handler); signal(SIGSEGV, sig_handler); signal(SIGILL, sig_handler); signal(SIGFPE, sig_handler); if (sigsetjmp(jmp, 1) == 0) { if (!noverify) { int ok, nfont_modules; nfont_modules = numFontModules; error_level = 0; ErrorF("CHECK MODULE %s\n", *ploaderList); if ((ok = xf86cfgCheckModule()) == 0) { CheckMsg(CHECKER_LOAD_FAILED, "ERROR Failed to load module.\n"); error_level += 50; } else if (module_type != module_types[i]) { CheckMsg(CHECKER_RECOGNIZED_AS, "WARNING %s recognized as a \"%s\"\n", *ploaderList, module_strs[module_type]); ++error_level; } if (ok) { if (options_ok) { if ((module_options == NULL || module_options->option == NULL) && module_type != GenericModule) { CheckMsg(CHECKER_NO_OPTIONS_AVAILABLE, "WARNING Not a generic module, but no options available.\n"); ++error_level; } else if (module_options && strcmp(module_options->name, *ploaderList) == 0) { ErrorF(" CHECK OPTIONS\n"); option = module_options->option; while (option->name) { XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name); for (ptr = query, ptr2 = query2; *ptr; ptr++) { if (*ptr != '_' && *ptr != ' ' && *ptr != '\t') *ptr2 = tolower(*ptr); } *ptr2 = '\0'; /* all resources are in lowercase */ if (!XrmGetResource(options_xrm, query2, "Module.Option", &type, &value) || value.addr == NULL) { CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING, "WARNING no description for %s\n", query); ++error_level; } ++option; } /* now do a linear search for Options file entries that are not * in the driver. */ names[0] = XrmPermStringToQuark(module_options->name); classes[0] = XrmPermStringToQuark("Option"); names[1] = classes[1] = NULLQUARK; (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, (XrmClassList)&classes, XrmEnumOneLevel, EnumDatabase, NULL); } } else { CheckMsg(CHECKER_OPTIONS_FILE_MISSING, "ERROR Options file missing.\n"); error_level += 10; } if (module_type == VideoModule && (module_options == NULL || module_options->vendor < 0 || module_options->chipsets == NULL)) { CheckMsg(CHECKER_NO_VENDOR_CHIPSET, "WARNING No vendor/chipset information available.\n"); ++error_level; } else if (module_type == VideoModule) { if (module_options == NULL) { /* No description for this, if this happen, * something really strange happened. */ ErrorF(" ERROR No module_options!?!\n"); error_level += 50; } else { ErrorF(" CHECK CHIPSETS\n"); CheckChipsets(module_options, &error_level); } } /* font modules check */ if (module_type == FontRendererModule) { if (strcmp(*ploaderList, font_module->name)) { /* not an error */ ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n", *ploaderList, font_module->name); } if (nfont_modules + 1 != numFontModules) { /* not an error */ ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n", *ploaderList); } } else if (nfont_modules != numFontModules) { ErrorF(" WARNING number of font modules changed from %d to %d.\n", nfont_modules, numFontModules); ++error_level; } } ErrorF(" SUMMARY error_level set to %d.\n\n", error_level); } else (void)xf86cfgCheckModule(); } signal(SIGTRAP, SIG_DFL); signal(SIGBUS, SIG_DFL); signal(SIGSEGV, SIG_DFL); signal(SIGILL, SIG_DFL); signal(SIGFPE, SIG_DFL); } xf86cfgLoaderFreeList(); } else ErrorF(" ERROR Failed to initialize module list.\n"); } if (!noverify) { ErrorF("===================================== LEGEND ===============================\n"); ErrorF("NOTICE lines are just informative.\n"); ErrorF("WARNING lines add 1 to error_level.\n"); ErrorF("ERROR lines add 2 or more (based on the severity of the error) to error_level.\n\n"); for (i = 0; i <= CHECKER_LAST_MESSAGE; i++) if (checkerErrors[i]) { ErrorF("%3d\n%s\n\n", i, checkerLegend[i]); } } return (True); }