1 /* X Resource Manager Intrinsics */
2 module iv
.x11
.resource
/*is aliced*/;
7 extern (C
) @trusted nothrow @nogc:
9 /* Memory Management */
10 char* Xpermalloc (uint size
);
12 /* Quark Management */
13 //typedef XrmQuark = int;
15 //typedef XrmQuarkList = int*;
16 alias XrmQuarkList
= int*;
17 enum XrmQuark NULLQUARK
= 0;
19 alias XrmString
= char*;
20 immutable XrmString NULLSTRING
= null;
22 /* find quark for string, create new quark if none already exists */
23 XrmQuark
XrmStringToQuark (const(char)* str);
25 XrmQuark
XrmPermStringToQuark (const(char)* str);
27 /* find string for quark */
28 XrmString
XrmQuarkToString (XrmQuark quark
);
30 XrmQuark
XrmUniqueQuark ();
33 bool XrmStringsEqual (XrmString a1
, XrmString a2
) { return (*a1
== *a2
); }
36 /* Conversion of Strings to Lists */
37 //typedef XrmBinding = int;
38 alias XrmBinding
= int;
39 enum { XrmBindTightly
, XrmBindLoosely
}
40 //typedef XrmBindingList = XrmBinding*;
41 alias XrmBindingList
= XrmBinding
*;
43 void XrmStringToQuarkList (const(char)* str, XrmQuarkList quarks_return
);
45 void XrmStringToBindingQuarkList (const char* str, XrmBindingList bindings_return
, XrmQuarkList quarks_return
);
47 /* Name and Class lists. */
48 //typedef XrmName = XrmQuark;
49 alias XrmName
= XrmQuark
;
50 //typedef XrmNameList = XrmQuarkList;
51 alias XrmNameList
= XrmQuarkList
;
53 XrmString
XrmNameToString (XrmName name
) { return XrmQuarkToString(cast(XrmQuark
)name
); }
54 XrmName
XrmStringToName (XrmString
str) { return cast(XrmName
) XrmStringToQuark(str); }
55 void XrmStringToNameList (XrmString
str, XrmNameList name
) { XrmStringToQuarkList(str, name
); }
57 //typedef XrmClass = XrmQuark;
58 alias XrmClass
= XrmQuark
;
59 //typedef XrmClassList = XrmQuarkList;
60 alias XrmClassList
= XrmQuarkList
;
62 XrmString
XrmClassToString (XrmClass c_class
) { return XrmQuarkToString(cast(XrmQuark
)c_class
); }
63 XrmClass
XrmStringToClass (XrmString c_class
) { return cast(XrmClass
)XrmStringToQuark(c_class
); }
64 void XrmStringToClassList (XrmString
str, XrmClassList c_class
) { XrmStringToQuarkList(str, c_class
); }
67 /* Resource Representation Types and Values */
68 //typedef XrmRepresentation = XrmQuark;
69 alias XrmRepresentation
= XrmQuark
;
71 XrmRepresentation
XrmStringToRepresentation (XrmString
str) { return cast(XrmRepresentation
)XrmStringToQuark(str); }
72 XrmString
XrmRepresentationToString( XrmRepresentation type
) { return XrmQuarkToString(type
); }
78 alias XrmValuePtr
= XrmValue
*;
81 /* Resource Manager Functions */
82 struct _XrmHashBucketRec
{}
83 alias XrmHashBucket
= _XrmHashBucketRec
*;
84 alias XrmHashTable
= XrmHashBucket
*;
85 alias XrmSearchList
= XrmHashTable
[];
86 alias XrmDatabase
= _XrmHashBucketRec
*;
88 void XrmDestroyDatabase (XrmDatabase database
);
89 void XrmQPutResource (XrmDatabase
* database
, XrmBindingList bindings
, XrmQuarkList quarks
, XrmRepresentation type
, XrmValue
* value
);
90 void XrmPutResource (XrmDatabase
* database
, const(char)* specifier
, const(char)* type
, XrmValue
* value
);
91 void XrmQPutStringResource (XrmDatabase
* database
, XrmBindingList bindings
, XrmQuarkList quarks
, const(char)* value
);
92 void XrmPutStringResource (XrmDatabase
* database
, const(char)* specifier
, const(char)* value
);
93 void XrmPutLineResource (XrmDatabase
* database
, const(char)* line
);
94 Bool
XrmQGetResource (XrmDatabase database
, XrmNameList quark_name
, XrmClassList quark_class
, XrmRepresentation
* quark_type_return
, XrmValue
* value_return
);
95 Bool
XrmGetResource (XrmDatabase database
, const(char)* str_name
, const(char)* str_class
, char** str_type_return
, XrmValue
* value_return
);
96 Bool
XrmQGetSearchList (XrmDatabase database
, XrmNameList names
, XrmClassList classes
, XrmSearchList list_return
, int list_length
);
97 Bool
XrmQGetSearchResource (XrmSearchList list
, XrmName name
, XrmClass rsclass
, XrmRepresentation
* type_return
, XrmValue
* value_return
);
99 /* Resource Database Management */
100 void XrmSetDatabase (Display
* display
, XrmDatabase database
);
101 XrmDatabase
XrmGetDatabase (Display
* display
);
102 XrmDatabase
XrmGetFileDatabase (const(char)* filename
);
103 Status
XrmCombineFileDatabase (const(char)* filename
, XrmDatabase
* target
, Bool dooverride
);
104 XrmDatabase
XrmGetStringDatabase (const(char)* data
/* null terminated string */);
105 void XrmPutFileDatabase (XrmDatabase database
, const(char)* filename
);
106 void XrmMergeDatabases (XrmDatabase source_db
, XrmDatabase
* target_db
);
107 void XrmCombineDatabase (XrmDatabase source_db
, XrmDatabase
* target_db
, Bool dooverride
);
109 enum uint XrmEnumAllLevels
= 0;
110 enum uint XrmEnumOneLevel
= 1;
112 Bool
XrmEnumerateDatabase (
114 XrmNameList name_prefix
,
115 XrmClassList class_prefix
,
119 XrmBindingList bindings
,
121 XrmRepresentation
* type
,
128 char* XrmLocaleOfDatabase (XrmDatabase database
);
131 /* Command line option mapping to resource entries */
133 alias XrmOptionKind
= int;
135 XrmoptionNoArg
, /* Value is specified in OptionDescRec.value */
136 XrmoptionIsArg
, /* Value is the option string itself */
137 XrmoptionStickyArg
, /* Value is characters immediately following option */
138 XrmoptionSepArg
, /* Value is next argument in argv */
139 XrmoptionResArg
, /* Resource and value in next argument in argv */
140 XrmoptionSkipArg
, /* Ignore this option and the next argument in argv */
141 XrmoptionSkipLine
, /* Ignore this option and the rest of argv */
142 XrmoptionSkipNArgs
, /* Ignore this option and the next OptionDescRes.value arguments in argv */
145 struct XrmOptionDescRec
{
146 char* option
; /* Option abbreviation in argv */
147 char* specifier
; /* Resource specifier */
148 XrmOptionKind argKind
; /* Which style of option it is */
149 XPointer value
; /* Value to provide if XrmoptionNoArg */
151 alias XrmOptionDescList
= XrmOptionDescRec
*;
153 void XrmParseCommand (XrmDatabase
* database
, XrmOptionDescList table
, int table_count
,
154 const(char)* name
, int* argc_in_out
, char** argv_in_out
);