Example #1
0
static void SetValues(
  char*			base,		/* Base address to write values to   */
  XrmResourceList*	res,		/* The current resource values.      */
  register Cardinal	num_resources,	/* number of items in resources      */
  ArgList 		args,		/* The resource values to set        */
  Cardinal		num_args)	/* number of items in arg list       */
{
    register ArgList		arg;
    register Cardinal 	        i;
    register XrmName		argName;
    register XrmResourceList*   xrmres;

    /* Resource lists are assumed to be in compiled form already via the
       initial XtGetResources, XtGetSubresources calls */

    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) {
		_XtCopyFromArg(arg->value,
		    base - (*xrmres)->xrm_offset - 1,
		    (*xrmres)->xrm_size);
		break;
	    }
	}
    }
} /* SetValues */
Example #2
0
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 */
Example #3
0
Any
cToPceName_nA(const char *text, size_t len)
{ if ( text )
  { string s;

    str_set_n_ascii(&s, len, (char *)text);

    return StringToName(&s);
  } else
    fail;
}
Example #4
0
Any
cToPceName(const char *text)
{ if ( text )
  { string s;

    str_set_n_ascii(&s, strlen(text), (char *)text);

    return StringToName(&s);
  } else
    fail;
}
Example #5
0
/* Like _XtCompileResourceList, but strings are not permanent */
static void  XrmCompileResourceListEphem(
    register XtResourceList resources,
    	     Cardinal       num_resources)
{
    register Cardinal count;

#define xrmres  ((XrmResourceList) resources)

    for (count = 0; count < num_resources; resources++, count++) {
    	xrmres->xrm_name	 = StringToName(resources->resource_name);
    	xrmres->xrm_class	 = StringToClass(resources->resource_class);
    	xrmres->xrm_type	 = StringToQuark(resources->resource_type);
        xrmres->xrm_offset	 = (Cardinal)
		(-(int)resources->resource_offset - 1);
    	xrmres->xrm_default_type = StringToQuark(resources->default_type);
    }
#undef xrmres
} /* XrmCompileResourceListEphem */