11ab64890Smrg 21ab64890Smrg/*********************************************************** 31ab64890Smrg 41ab64890SmrgCopyright 1987, 1988, 1998 The Open Group 51ab64890Smrg 61ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its 71ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that 81ab64890Smrgthe above copyright notice appear in all copies and that both that 91ab64890Smrgcopyright notice and this permission notice appear in supporting 101ab64890Smrgdocumentation. 111ab64890Smrg 121ab64890SmrgThe above copyright notice and this permission notice shall be included in 131ab64890Smrgall copies or substantial portions of the Software. 141ab64890Smrg 151ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 161ab64890SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 171ab64890SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 181ab64890SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 191ab64890SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 201ab64890SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 211ab64890Smrg 221ab64890SmrgExcept as contained in this notice, the name of The Open Group shall not be 231ab64890Smrgused in advertising or otherwise to promote the sale, use or other dealings 241ab64890Smrgin this Software without prior written authorization from The Open Group. 251ab64890Smrg 261ab64890Smrg 271ab64890SmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 281ab64890Smrg 291ab64890Smrg All Rights Reserved 301ab64890Smrg 3161b2299dSmrgPermission to use, copy, modify, and distribute this software and its 3261b2299dSmrgdocumentation for any purpose and without fee is hereby granted, 331ab64890Smrgprovided that the above copyright notice appear in all copies and that 3461b2299dSmrgboth that copyright notice and this permission notice appear in 351ab64890Smrgsupporting documentation, and that the name of Digital not be 361ab64890Smrgused in advertising or publicity pertaining to distribution of the 3761b2299dSmrgsoftware without specific, written prior permission. 381ab64890Smrg 391ab64890SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 401ab64890SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 411ab64890SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 421ab64890SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 431ab64890SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 441ab64890SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 451ab64890SmrgSOFTWARE. 461ab64890Smrg 471ab64890Smrg******************************************************************/ 481ab64890Smrg 49e9fcaa8aSmrg#ifndef _X11_XRESOURCE_H_ 50e9fcaa8aSmrg#define _X11_XRESOURCE_H_ 511ab64890Smrg 521ab64890Smrg#ifndef _XP_PRINT_SERVER_ 531ab64890Smrg#include <X11/Xlib.h> 541ab64890Smrg#endif 551ab64890Smrg 561ab64890Smrg/**************************************************************** 571ab64890Smrg **************************************************************** 581ab64890Smrg *** *** 591ab64890Smrg *** *** 601ab64890Smrg *** X Resource Manager Intrinsics *** 611ab64890Smrg *** *** 621ab64890Smrg *** *** 631ab64890Smrg **************************************************************** 641ab64890Smrg ****************************************************************/ 651ab64890Smrg 661ab64890Smrg_XFUNCPROTOBEGIN 671ab64890Smrg 681ab64890Smrg/**************************************************************** 691ab64890Smrg * 701ab64890Smrg * Memory Management 711ab64890Smrg * 721ab64890Smrg ****************************************************************/ 731ab64890Smrg 741ab64890Smrgextern char *Xpermalloc( 751ab64890Smrg unsigned int /* size */ 761ab64890Smrg); 771ab64890Smrg 781ab64890Smrg/**************************************************************** 791ab64890Smrg * 801ab64890Smrg * Quark Management 811ab64890Smrg * 821ab64890Smrg ****************************************************************/ 831ab64890Smrg 841ab64890Smrgtypedef int XrmQuark, *XrmQuarkList; 851ab64890Smrg#define NULLQUARK ((XrmQuark) 0) 861ab64890Smrg 871ab64890Smrgtypedef char *XrmString; 881ab64890Smrg#define NULLSTRING ((XrmString) 0) 891ab64890Smrg 901ab64890Smrg/* find quark for string, create new quark if none already exists */ 911ab64890Smrgextern XrmQuark XrmStringToQuark( 921ab64890Smrg _Xconst char* /* string */ 931ab64890Smrg); 941ab64890Smrg 951ab64890Smrgextern XrmQuark XrmPermStringToQuark( 961ab64890Smrg _Xconst char* /* string */ 971ab64890Smrg); 981ab64890Smrg 991ab64890Smrg/* find string for quark */ 1001ab64890Smrgextern XrmString XrmQuarkToString( 1011ab64890Smrg XrmQuark /* quark */ 1021ab64890Smrg); 1031ab64890Smrg 1041ab64890Smrgextern XrmQuark XrmUniqueQuark( 1051ab64890Smrg void 1061ab64890Smrg); 1071ab64890Smrg 1081ab64890Smrg#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) 1091ab64890Smrg 1101ab64890Smrg 1111ab64890Smrg/**************************************************************** 1121ab64890Smrg * 1131ab64890Smrg * Conversion of Strings to Lists 1141ab64890Smrg * 1151ab64890Smrg ****************************************************************/ 1161ab64890Smrg 1171ab64890Smrgtypedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; 1181ab64890Smrg 1191ab64890Smrgextern void XrmStringToQuarkList( 1201ab64890Smrg _Xconst char* /* string */, 1211ab64890Smrg XrmQuarkList /* quarks_return */ 1221ab64890Smrg); 1231ab64890Smrg 1241ab64890Smrgextern void XrmStringToBindingQuarkList( 1251ab64890Smrg _Xconst char* /* string */, 1261ab64890Smrg XrmBindingList /* bindings_return */, 1271ab64890Smrg XrmQuarkList /* quarks_return */ 1281ab64890Smrg); 1291ab64890Smrg 1301ab64890Smrg/**************************************************************** 1311ab64890Smrg * 1321ab64890Smrg * Name and Class lists. 1331ab64890Smrg * 1341ab64890Smrg ****************************************************************/ 1351ab64890Smrg 1361ab64890Smrgtypedef XrmQuark XrmName; 1371ab64890Smrgtypedef XrmQuarkList XrmNameList; 1381ab64890Smrg#define XrmNameToString(name) XrmQuarkToString(name) 1391ab64890Smrg#define XrmStringToName(string) XrmStringToQuark(string) 1401ab64890Smrg#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) 1411ab64890Smrg 1421ab64890Smrgtypedef XrmQuark XrmClass; 1431ab64890Smrgtypedef XrmQuarkList XrmClassList; 1441ab64890Smrg#define XrmClassToString(c_class) XrmQuarkToString(c_class) 1451ab64890Smrg#define XrmStringToClass(c_class) XrmStringToQuark(c_class) 1461ab64890Smrg#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) 1471ab64890Smrg 1481ab64890Smrg 1491ab64890Smrg 1501ab64890Smrg/**************************************************************** 1511ab64890Smrg * 1521ab64890Smrg * Resource Representation Types and Values 1531ab64890Smrg * 1541ab64890Smrg ****************************************************************/ 1551ab64890Smrg 1561ab64890Smrgtypedef XrmQuark XrmRepresentation; 1571ab64890Smrg#define XrmStringToRepresentation(string) XrmStringToQuark(string) 1581ab64890Smrg#define XrmRepresentationToString(type) XrmQuarkToString(type) 1591ab64890Smrg 1601ab64890Smrgtypedef struct { 1611ab64890Smrg unsigned int size; 1621ab64890Smrg XPointer addr; 1631ab64890Smrg} XrmValue, *XrmValuePtr; 1641ab64890Smrg 1651ab64890Smrg 1661ab64890Smrg/**************************************************************** 1671ab64890Smrg * 1681ab64890Smrg * Resource Manager Functions 1691ab64890Smrg * 1701ab64890Smrg ****************************************************************/ 1711ab64890Smrg 1721ab64890Smrgtypedef struct _XrmHashBucketRec *XrmHashBucket; 1731ab64890Smrgtypedef XrmHashBucket *XrmHashTable; 1741ab64890Smrgtypedef XrmHashTable XrmSearchList[]; 1751ab64890Smrgtypedef struct _XrmHashBucketRec *XrmDatabase; 1761ab64890Smrg 1771ab64890Smrg 1781ab64890Smrgextern void XrmDestroyDatabase( 17961b2299dSmrg XrmDatabase /* database */ 1801ab64890Smrg); 1811ab64890Smrg 1821ab64890Smrgextern void XrmQPutResource( 1831ab64890Smrg XrmDatabase* /* database */, 1841ab64890Smrg XrmBindingList /* bindings */, 1851ab64890Smrg XrmQuarkList /* quarks */, 1861ab64890Smrg XrmRepresentation /* type */, 1871ab64890Smrg XrmValue* /* value */ 1881ab64890Smrg); 1891ab64890Smrg 1901ab64890Smrgextern void XrmPutResource( 1911ab64890Smrg XrmDatabase* /* database */, 1921ab64890Smrg _Xconst char* /* specifier */, 1931ab64890Smrg _Xconst char* /* type */, 1941ab64890Smrg XrmValue* /* value */ 1951ab64890Smrg); 1961ab64890Smrg 1971ab64890Smrgextern void XrmQPutStringResource( 1981ab64890Smrg XrmDatabase* /* database */, 1991ab64890Smrg XrmBindingList /* bindings */, 2001ab64890Smrg XrmQuarkList /* quarks */, 2011ab64890Smrg _Xconst char* /* value */ 2021ab64890Smrg); 2031ab64890Smrg 2041ab64890Smrgextern void XrmPutStringResource( 2051ab64890Smrg XrmDatabase* /* database */, 2061ab64890Smrg _Xconst char* /* specifier */, 2071ab64890Smrg _Xconst char* /* value */ 2081ab64890Smrg); 2091ab64890Smrg 2101ab64890Smrgextern void XrmPutLineResource( 2111ab64890Smrg XrmDatabase* /* database */, 2121ab64890Smrg _Xconst char* /* line */ 2131ab64890Smrg); 2141ab64890Smrg 2151ab64890Smrgextern Bool XrmQGetResource( 2161ab64890Smrg XrmDatabase /* database */, 2171ab64890Smrg XrmNameList /* quark_name */, 2181ab64890Smrg XrmClassList /* quark_class */, 2191ab64890Smrg XrmRepresentation* /* quark_type_return */, 2201ab64890Smrg XrmValue* /* value_return */ 2211ab64890Smrg); 2221ab64890Smrg 2231ab64890Smrgextern Bool XrmGetResource( 2241ab64890Smrg XrmDatabase /* database */, 2251ab64890Smrg _Xconst char* /* str_name */, 2261ab64890Smrg _Xconst char* /* str_class */, 2271ab64890Smrg char** /* str_type_return */, 2281ab64890Smrg XrmValue* /* value_return */ 2291ab64890Smrg); 2301ab64890Smrg 2311ab64890Smrgextern Bool XrmQGetSearchList( 2321ab64890Smrg XrmDatabase /* database */, 2331ab64890Smrg XrmNameList /* names */, 2341ab64890Smrg XrmClassList /* classes */, 2351ab64890Smrg XrmSearchList /* list_return */, 2361ab64890Smrg int /* list_length */ 2371ab64890Smrg); 2381ab64890Smrg 2391ab64890Smrgextern Bool XrmQGetSearchResource( 2401ab64890Smrg XrmSearchList /* list */, 2411ab64890Smrg XrmName /* name */, 2421ab64890Smrg XrmClass /* class */, 2431ab64890Smrg XrmRepresentation* /* type_return */, 2441ab64890Smrg XrmValue* /* value_return */ 2451ab64890Smrg); 2461ab64890Smrg 2471ab64890Smrg/**************************************************************** 2481ab64890Smrg * 2491ab64890Smrg * Resource Database Management 2501ab64890Smrg * 2511ab64890Smrg ****************************************************************/ 2521ab64890Smrg 2531ab64890Smrg#ifndef _XP_PRINT_SERVER_ 2541ab64890Smrg 2551ab64890Smrgextern void XrmSetDatabase( 2561ab64890Smrg Display* /* display */, 2571ab64890Smrg XrmDatabase /* database */ 2581ab64890Smrg); 2591ab64890Smrg 2601ab64890Smrgextern XrmDatabase XrmGetDatabase( 2611ab64890Smrg Display* /* display */ 2621ab64890Smrg); 2631ab64890Smrg 2641ab64890Smrg#endif /* !_XP_PRINT_SERVER_ */ 2651ab64890Smrg 2661ab64890Smrgextern XrmDatabase XrmGetFileDatabase( 2671ab64890Smrg _Xconst char* /* filename */ 2681ab64890Smrg); 2691ab64890Smrg 2701ab64890Smrgextern Status XrmCombineFileDatabase( 2711ab64890Smrg _Xconst char* /* filename */, 2721ab64890Smrg XrmDatabase* /* target */, 2731ab64890Smrg Bool /* override */ 2741ab64890Smrg); 2751ab64890Smrg 2761ab64890Smrgextern XrmDatabase XrmGetStringDatabase( 2771ab64890Smrg _Xconst char* /* data */ /* null terminated string */ 2781ab64890Smrg); 2791ab64890Smrg 2801ab64890Smrgextern void XrmPutFileDatabase( 2811ab64890Smrg XrmDatabase /* database */, 2821ab64890Smrg _Xconst char* /* filename */ 2831ab64890Smrg); 2841ab64890Smrg 2851ab64890Smrgextern void XrmMergeDatabases( 2861ab64890Smrg XrmDatabase /* source_db */, 2871ab64890Smrg XrmDatabase* /* target_db */ 2881ab64890Smrg); 2891ab64890Smrg 2901ab64890Smrgextern void XrmCombineDatabase( 2911ab64890Smrg XrmDatabase /* source_db */, 2921ab64890Smrg XrmDatabase* /* target_db */, 2931ab64890Smrg Bool /* override */ 2941ab64890Smrg); 2951ab64890Smrg 2961ab64890Smrg#define XrmEnumAllLevels 0 2971ab64890Smrg#define XrmEnumOneLevel 1 2981ab64890Smrg 2991ab64890Smrgextern Bool XrmEnumerateDatabase( 3001ab64890Smrg XrmDatabase /* db */, 3011ab64890Smrg XrmNameList /* name_prefix */, 3021ab64890Smrg XrmClassList /* class_prefix */, 3031ab64890Smrg int /* mode */, 3041ab64890Smrg Bool (*)( 3051ab64890Smrg XrmDatabase* /* db */, 3061ab64890Smrg XrmBindingList /* bindings */, 3071ab64890Smrg XrmQuarkList /* quarks */, 3081ab64890Smrg XrmRepresentation* /* type */, 3091ab64890Smrg XrmValue* /* value */, 3101ab64890Smrg XPointer /* closure */ 3111ab64890Smrg ) /* proc */, 3121ab64890Smrg XPointer /* closure */ 3131ab64890Smrg); 3141ab64890Smrg 3151ab64890Smrgextern const char *XrmLocaleOfDatabase( 3161ab64890Smrg XrmDatabase /* database */ 3171ab64890Smrg); 3181ab64890Smrg 3191ab64890Smrg 3201ab64890Smrg/**************************************************************** 3211ab64890Smrg * 3221ab64890Smrg * Command line option mapping to resource entries 3231ab64890Smrg * 3241ab64890Smrg ****************************************************************/ 3251ab64890Smrg 3261ab64890Smrgtypedef enum { 3271ab64890Smrg XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ 3281ab64890Smrg XrmoptionIsArg, /* Value is the option string itself */ 3291ab64890Smrg XrmoptionStickyArg, /* Value is characters immediately following option */ 3301ab64890Smrg XrmoptionSepArg, /* Value is next argument in argv */ 3311ab64890Smrg XrmoptionResArg, /* Resource and value in next argument in argv */ 3321ab64890Smrg XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ 3331ab64890Smrg XrmoptionSkipLine, /* Ignore this option and the rest of argv */ 33461b2299dSmrg XrmoptionSkipNArgs /* Ignore this option and the next 3351ab64890Smrg OptionDescRes.value arguments in argv */ 3361ab64890Smrg} XrmOptionKind; 3371ab64890Smrg 3381ab64890Smrgtypedef struct { 3391ab64890Smrg char *option; /* Option abbreviation in argv */ 3401ab64890Smrg char *specifier; /* Resource specifier */ 3411ab64890Smrg XrmOptionKind argKind; /* Which style of option it is */ 3421ab64890Smrg XPointer value; /* Value to provide if XrmoptionNoArg */ 3431ab64890Smrg} XrmOptionDescRec, *XrmOptionDescList; 3441ab64890Smrg 3451ab64890Smrg 3461ab64890Smrgextern void XrmParseCommand( 3471ab64890Smrg XrmDatabase* /* database */, 3481ab64890Smrg XrmOptionDescList /* table */, 3491ab64890Smrg int /* table_count */, 3501ab64890Smrg _Xconst char* /* name */, 3511ab64890Smrg int* /* argc_in_out */, 35261b2299dSmrg char** /* argv_in_out */ 3531ab64890Smrg); 3541ab64890Smrg 3551ab64890Smrg_XFUNCPROTOEND 3561ab64890Smrg 357e9fcaa8aSmrg#endif /* _X11_XRESOURCE_H_ */ 3581ab64890Smrg/* DON'T ADD STUFF AFTER THIS #endif */ 359