XtCacheRef *_XtGetResources( register Widget w, ArgList args, Cardinal num_args, XtTypedArgList typed_args, Cardinal* num_typed_args) { XrmName *names, names_s[50]; XrmClass *classes, classes_s[50]; XrmQuark quark_cache[100]; XrmQuarkList quark_args; WidgetClass wc; ConstraintWidgetClass cwc; XtCacheRef *cache_refs, *cache_refs_core; Cardinal count; wc = XtClass(w); count = CountTreeDepth(w); names = (XrmName*) XtStackAlloc (count * sizeof(XrmName), names_s); classes = (XrmClass*) XtStackAlloc (count * sizeof(XrmClass), classes_s); if (names == NULL || classes == NULL) _XtAllocError(NULL); /* Get names, classes for widget and ancestors */ GetNamesAndClasses(w, names, classes); /* Compile arg list into quarks */ CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache, XtNumber(quark_cache), &quark_args); /* Get normal resources */ LOCK_PROCESS; cache_refs = GetResources(w, (char*)w, names, classes, (XrmResourceList *) wc->core_class.resources, wc->core_class.num_resources, quark_args, args, num_args, typed_args, num_typed_args, XtIsWidget(w)); if (w->core.constraints != NULL) { cwc = (ConstraintWidgetClass) XtClass(w->core.parent); cache_refs_core = GetResources(w, (char*)w->core.constraints, names, classes, (XrmResourceList *) cwc->constraint_class.resources, cwc->constraint_class.num_resources, quark_args, args, num_args, typed_args, num_typed_args, False); if (cache_refs_core) { XtFree((char *)cache_refs_core); } } FreeCache(quark_cache, quark_args); UNLOCK_PROCESS; XtStackFree((XtPointer)names, names_s); XtStackFree((XtPointer)classes, classes_s); return cache_refs; } /* _XtGetResources */
static int AccessFile ( char* path, char* pathbuf, int len_pathbuf, char** pathret) { unsigned long drives; int i, len; char* drive; char buf[MAX_PATH]; char* bufp; /* just try the "raw" name first and see if it works */ if (access_file (path, pathbuf, len_pathbuf, pathret)) return 1; #if defined(WIN32) && defined(__MINGW32__) /* don't try others */ return 0; #endif /* try the places set in the environment */ drive = getenv ("_XBASEDRIVE"); #ifdef __UNIXOS2__ if (!drive) drive = getenv ("X11ROOT"); #endif if (!drive) drive = "C:"; len = strlen (drive) + strlen (path); bufp = XtStackAlloc (len + 1, buf); strcpy (bufp, drive); strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { XtStackFree (bufp, buf); return 1; } #ifndef __UNIXOS2__ /* one last place to look */ drive = getenv ("HOMEDRIVE"); if (drive) { len = strlen (drive) + strlen (path); bufp = XtStackAlloc (len + 1, buf); strcpy (bufp, drive); strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { XtStackFree (bufp, buf); return 1; } } /* does OS/2 (with or with gcc-emx) have getdrives()? */ /* tried everywhere else, go fishing */ drives = _getdrives (); #define C_DRIVE ('C' - 'A') #define Z_DRIVE ('Z' - 'A') for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */ if ((1 << i) & drives) { len = 2 + strlen (path); bufp = XtStackAlloc (len + 1, buf); *bufp = 'A' + i; *(bufp + 1) = ':'; *(bufp + 2) = '\0'; strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { XtStackFree (bufp, buf); return 1; } } } #endif return 0; }