* cleanup, removed warnings

* external decls moved from implementation to interface
This commit is contained in:
peter 2000-02-27 13:11:31 +00:00
parent 3a5a62b567
commit febb7a0d06
6 changed files with 1155 additions and 1720 deletions

View File

@ -1,5 +1,5 @@
#
# Makefile generated by fpcmake v0.99.13 [2000/02/09]
# Makefile generated by fpcmake v0.99.13 [2000/02/24]
#
defaultrule: all
@ -184,7 +184,7 @@ endif
# Targets
override UNITOBJECTS+=x xresource xlib xutil
override UNITOBJECTS+=x xlib xutil xresource
# Clean

View File

@ -3,7 +3,7 @@
#
[targets]
units=x xresource xlib xutil
units=x xlib xutil xresource
[dirs]
fpcdir=../..

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +1,68 @@
{
$Id$
}
unit xresource;
interface
uses xlib;
uses
xlib;
{***************************************************************
*
* Quark Management
*
***************************************************************}
type
TXrmQuark = Integer;
TXrmQuark = Longint;
PXrmQuark = ^TXrmQuark;
TXrmQuarkList = PXrmQuark;
TXrmString = Pchar;
Const NULLQUARK = 0 ;
type TXrmString = Pchar;
const NULLSTRING = 0;
Const
NULLQUARK = 0 ;
NULLSTRING = 0;
{ find quark for string, create new quark if none already exists }
Function XrmStringToQuark( p1 : pchar ) : TXrmQuark;cdecl;
Function XrmPermStringToQuark( p1 : pchar ) : TXrmQuark;cdecl;
Function XrmStringToQuark( p1 : pchar ) : TXrmQuark;cdecl;external;
Function XrmPermStringToQuark( p1 : pchar ) : TXrmQuark;cdecl;external;
{ find string for quark }
Function XrmQuarkToString( p1 : TXrmQuark) : TXrmString;cdecl;
Function XrmUniqueQuark : TXrmQuark;cdecl;
Function XrmQuarkToString( p1 : TXrmQuark) : TXrmString;cdecl;external;
Function XrmUniqueQuark : TXrmQuark;cdecl;external;
{
#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0)
}
{***************************************************************
*
* Conversion of Strings to Lists
*
***************************************************************}
type
TXrmBinding = integer;
TXrmBindingList = ^Integer;
Const XrmBindTightly = 0;
TXrmBinding = longint;
TXrmBindingList = ^longint;
Const
XrmBindTightly = 0;
XrmBindLoosely = 1;
procedure XrmStringToQuarkList(
p1 : pchar { string };
p2 : TXrmQuarkList { quarks_return }
);cdecl;
);cdecl;external;
procedure XrmStringToBindingQuarkList(
p1 : pchar { string };
p2 : TXrmBindingList { bindings_return };
p3 : TXrmQuarkList { quarks_return }
);cdecl;
);cdecl;external;
{***************************************************************
*
* Name and Class lists.
*
***************************************************************}
type TXrmName = TXrmQuark;
type
TXrmName = TXrmQuark;
TXrmNameList = TXrmQuarkList ;
{
#define XrmNameToString(name) XrmQuarkToString(name)
@ -84,19 +79,19 @@ type TXrmName = TXrmQuark;
{***************************************************************
*
* Resource Representation Types and Values
*
***************************************************************}
type TXrmRepresentation = TXrmQuark ;
type
TXrmRepresentation = TXrmQuark ;
PXrmRepresentation = ^TXrmRepresentation;
{
#define XrmStringToRepresentation(string) XrmStringToQuark(string)
#define XrmRepresentationToString(type) XrmQuarkToString(type)
}
type TXrmValue = record
type
TXrmValue = record
size : word;
theaddr : TXPointer;
end;
@ -105,9 +100,7 @@ end;
{***************************************************************
*
* Resource Manager Functions
*
***************************************************************}
{
typedef struct _XrmHashBucketRec *XrmHashBucket;
@ -115,7 +108,8 @@ typedef XrmHashBucket *XrmHashTable;
typedef XrmHashTable XrmSearchList[];
typedef struct _XrmHashBucketRec *XrmDatabase;
}
Type TXrmHashBucket = pointer;
Type
TXrmHashBucket = pointer;
TXrmHashTable = ^TXrmHashBucket;
TXrmSearchList = ^TXrmHashTable;
TXrmDatabase = pointer;
@ -123,7 +117,7 @@ Type TXrmHashBucket = pointer;
procedure XrmDestroyDatabase(
p1 : TXrmDatabase { database }
);cdecl;
);cdecl;external;
Procedure XrmQPutResource(
p1 : PXrmDatabase { database };
@ -131,219 +125,25 @@ Procedure XrmQPutResource(
p3 : TXrmQuarkList { quarks };
p4 : TXrmRepresentation { type };
p5 : PXrmValue { value }
);cdecl;
);cdecl;external;
Procedure XrmPutResource(
p1 : PXrmDatabase { database };
p2 : pchar { specifier };
p3 : pchar { type };
p4 : PXrmValue { value }
);cdecl;
);cdecl;external;
Procedure XrmQPutStringResource(
p1 : PXrmDatabase { database };
p2 : TXrmBindingList { bindings };
p3 : TXrmQuarkList { quarks };
p4 : Pchar { value }
);cdecl;
);cdecl;external;
Procedure XrmPutStringResource(
P1 : PXrmDatabase { database };
p2,p3 : pchar
);cdecl;
Procedure XrmPutLineResource(
p1 : PXrmDatabase { database };
p2 : pchar { line }
);cdecl;
Function XrmQGetResource(
p1 : PXrmDatabase { database };
p2 : TXrmNameList { quark_name };
p3 : TXrmClassList { quark_class };
p4 : PXrmRepresentation { quark_type_return };
p5 : PXrmValue { value_return }
) : Integer;cdecl;
Function XrmGetResource(
p1 : TXrmDatabase { database };
p2 : pchar { str_name };
p3 : pchar { str_class };
p4 : ppchar { str_type_return };
p5 : PXrmValue { value_return }
) : Tbool;cdecl;
Function XrmQGetSearchList(
p1 : TXrmDatabase { database };
p2 : TXrmNameList { names };
p3 : TXrmClassList { classes };
p4 : TXrmSearchList { list_return };
p5 : integer { list_length }
) : Tbool;cdecl;
Function XrmQGetSearchResource(
P1 : TXrmSearchList { list };
p2 : TXrmName { name };
p3 : TXrmClass { class };
p4 : PXrmRepresentation { type_return };
p5 : PXrmValue { value_return }
) : TBool;cdecl;
{***************************************************************
*
* Resource Database Management
*
***************************************************************}
procedure XrmSetDatabase(
p1 : PDisplay { display };
p2 : TXrmDatabase { database }
);cdecl;
Function XrmGetDatabase(
p1 : PDisplay { display }
) : TXrmDatabase;cdecl;
Function XrmGetFileDatabase(
p1 : pchar { filename }
) : TXrmDatabase ;cdecl;
Function XrmCombineFileDatabase(
p1 : pchar { filename };
p2 : PXrmDatabase { target };
p3 : TBool { override }
) : TStatus ;cdecl;
function XrmGetStringDatabase(
p1 : pchar { data } { null terminated string }
) : TXrmDatabase ;cdecl;
Procedure XrmPutFileDatabase(
p1 : TXrmDatabase { database };
p2: pchar { filename }
);cdecl;
Procedure XrmMergeDatabases(
p1 : TXrmDatabase { source_db };
p2 : PXrmDatabase { target_db }
);cdecl;
procedure XrmCombineDatabase(
p1 : TXrmDatabase { source_db };
p2 : PXrmDatabase { target_db };
p3 : TBool { override }
);cdecl;
const
XrmEnumAllLevels = 0;
XrmEnumOneLevel = 1;
{
Function XrmEnumerateDatabase(
XrmDatabase { db };
XrmNameList { name_prefix };
XrmClassList { class_prefix };
int { mode };
Bool (*)(#if NeedNestedPrototypes
XrmDatabase* { db };
XrmBindingList { bindings };
XrmQuarkList { quarks };
XrmRepresentation* { type };
XrmValue* { value };
XPointer { closure }
) { proc };
XPointer { closure }
) : TBool;
}
Function XrmLocaleOfDatabase(
P1 : TXrmDatabase { database }
) : Pchar;cdecl;
{***************************************************************
*
* Command line option mapping to resource entries
*
***************************************************************}
Const
XrmoptionNoArg = 0; { Value is specified in OptionDescRec.value }
XrmoptionIsArg = 1; { Value is the option string itself }
XrmoptionStickyArg = 2; { Value is characters immediately following option }
XrmoptionSepArg = 3; { Value is next argument in argv }
XrmoptionResArg = 4; { Resource and value in next argument in argv }
XrmoptionSkipArg = 5; { Ignore this option and the next argument in argv }
XrmoptionSkipLine = 6; { Ignore this option and the rest of argv }
XrmoptionSkipNArgs = 7; { Ignore this option and the next
OptionDescRes.value arguments in argv }
Type TXrmOptionKind = Integer;
TXrmOptionDescRec = record
option : pchar; { Option abbreviation in argv }
specifier : pchar; { Resource specifier }
argKind : TXrmOptionKind; { Which style of option it is }
value : TXpointer; { Value to provide if XrmoptionNoArg }
end;
PXrmOptionDescRec= ^TXrmOptionDescRec;
TXrmOptionDescList = PXrmOptionDescRec;
Procedure XrmParseCommand(
p1 : TXrmDatabase { database };
p2 : TXrmOptionDescList { table };
p3 : integer { table_count };
p4 : pchar { name };
p5 : Pointer { argc_in_out };
p6 : ppchar { argv_in_out }
);cdecl;
Implementation
Function XrmStringToQuark( p1 : pchar ) : TXrmQuark; cdecl; external;
Function XrmPermStringToQuark( p1 : pchar ) : TXrmQuark; cdecl; external;
Function XrmQuarkToString( p1 : TXrmQuark) : TXrmString; cdecl; external;
Function XrmUniqueQuark : TXrmQuark; cdecl; external;
procedure XrmStringToQuarkList(
p1 : pchar { string };
p2 : TXrmQuarkList { quarks_return }
); cdecl; external;
procedure XrmStringToBindingQuarkList(
p1 : pchar { string };
p2 : TXrmBindingList { bindings_return };
p3 : TXrmQuarkList { quarks_return }
); cdecl; external;
procedure XrmDestroyDatabase(
p1 : TXrmDatabase { database }
); cdecl; external;
Procedure XrmQPutResource(
p1 : PXrmDatabase { database };
p2 : TXrmBindingList { bindings };
p3 : TXrmQuarkList { quarks };
p4 : TXrmRepresentation { type };
p5 : PXrmValue { value }
); cdecl; external;
Procedure XrmPutResource(
p1 : PXrmDatabase { database };
p2 : pchar { specifier };
p3 : pchar { type };
p4 : PXrmValue { value }
); cdecl; external;
Procedure XrmQPutStringResource(
p1 : PXrmDatabase { database };
p2 : TXrmBindingList { bindings };
p3 : TXrmQuarkList { quarks };
p4 : Pchar { value }
); cdecl; external;
procedure XrmPutStringResource(
P1 : PXrmDatabase { database };
p2,p3 : pchar
);cdecl;external;
Procedure XrmPutLineResource(
@ -383,6 +183,12 @@ Function XrmQGetSearchResource(
p5 : PXrmValue { value_return }
) : TBool;cdecl;external;
{***************************************************************
*
* Resource Database Management
*
***************************************************************}
procedure XrmSetDatabase(
p1 : PDisplay { display };
p2 : TXrmDatabase { database }
@ -422,13 +228,16 @@ procedure XrmCombineDatabase(
p3 : TBool { override }
);cdecl;external;
{
const
XrmEnumAllLevels = 0;
XrmEnumOneLevel = 1;
(*
Function XrmEnumerateDatabase(
XrmDatabase { db };
XrmNameList { name_prefix };
XrmClassList { class_prefix };
int { mode };
Bool (*)(#if NeedNestedPrototypes
Bool *(#if NeedNestedPrototypes
XrmDatabase* { db };
XrmBindingList { bindings };
XrmQuarkList { quarks };
@ -438,13 +247,42 @@ Function XrmEnumerateDatabase(
) { proc };
XPointer { closure }
) : TBool; cdecl; external;
}
) : TBool;
*)
Function XrmLocaleOfDatabase(
P1 : TXrmDatabase { database }
) : Pchar;cdecl;external;
{***************************************************************
*
* Command line option mapping to resource entries
*
***************************************************************}
Const
XrmoptionNoArg = 0; { Value is specified in OptionDescRec.value }
XrmoptionIsArg = 1; { Value is the option string itself }
XrmoptionStickyArg = 2; { Value is characters immediately following option }
XrmoptionSepArg = 3; { Value is next argument in argv }
XrmoptionResArg = 4; { Resource and value in next argument in argv }
XrmoptionSkipArg = 5; { Ignore this option and the next argument in argv }
XrmoptionSkipLine = 6; { Ignore this option and the rest of argv }
XrmoptionSkipNArgs = 7; { Ignore this option and the next
OptionDescRes.value arguments in argv }
Type TXrmOptionKind = Integer;
TXrmOptionDescRec = record
option : pchar; { Option abbreviation in argv }
specifier : pchar; { Resource specifier }
argKind : TXrmOptionKind; { Which style of option it is }
value : TXpointer; { Value to provide if XrmoptionNoArg }
end;
PXrmOptionDescRec= ^TXrmOptionDescRec;
TXrmOptionDescList = PXrmOptionDescRec;
Procedure XrmParseCommand(
p1 : TXrmDatabase { database };
p2 : TXrmOptionDescList { table };
@ -454,4 +292,13 @@ Procedure XrmParseCommand(
p6 : ppchar { argv_in_out }
);cdecl;external;
Implementation
end.
{
$Log$
Revision 1.2 2000-02-27 13:11:31 peter
* cleanup, removed warnings
* external decls moved from implementation to interface
}

View File

@ -1,16 +1,16 @@
{$MODE objfpc} // get integer sizes right
{
$Id$
}
Unit XUtil;
interface
uses
x,xlib;
uses x,xlib;
{ You must include <X11/Xlib.h> before including this file }
{$linklib x11}
{
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
value (x, y, width, height) was found in the parsed string.
}
Const
NoValue = $0000;
@ -23,33 +23,33 @@ Const
YNegative = $0020;
{
* new version containing base_width, base_height, and win_gravity fields;
* used with WM_NORMAL_HINTS.
new version containing base_width, base_height, and win_gravity fields;
used with WM_NORMAL_HINTS.
}
Type
long = Cardinal; { Untill we know better. M.}
Type
TAspectRecord = record
x,y : integer;
x,y : longint;
end;
TXSizeHints = record
flags : Long; { marks which fields in this structure are defined }
x, y : Integer ; { obsolete for new window mgrs, but clients }
width, height: Integer ; { should set so old wm's don't mess up }
min_width, min_height : Integer ;
max_width, max_height : Integer ;
width_inc, height_inc : Integer ;
x, y : longint ; { obsolete for new window mgrs, but clients }
width, height: longint ; { should set so old wm's don't mess up }
min_width, min_height : longint ;
max_width, max_height : longint ;
width_inc, height_inc : longint ;
min_aspect, max_aspect : TAspectRecord;
base_width, base_height : Integer ; { added by ICCCM version 1 }
win_gravity : Integer ; { added by ICCCM version 1 }
base_width, base_height : longint ; { added by ICCCM version 1 }
win_gravity : longint ; { added by ICCCM version 1 }
end;
PXSizeHints=^TXSizeHints;
{
* The next block of definitions are for window manager properties that
* clients and applications use for communication.
The next block of definitions are for window manager properties that
clients and applications use for communication.
}
{ flags argument in size hints }
@ -65,26 +65,24 @@ Const
PAspect = 1 shl 7; { program specified min and max aspect ratios }
PBaseSize = 1 shl 8; { program specified base for incrementing }
PWinGravity = 1 shl 9; { program specified window gravity }
{ obsolete }
PAllHints = PPosition or PSize or PMinSize or PMaxSize or PResizeInc or PAspect;
Type
TXWMHints = record
flags : long; { marks which fields in this structure are defined }
input : TBool ; { does this application rely on the window manager to
get keyboard input? }
initial_state : Integer ; { see below }
initial_state : longint ; { see below }
icon_pixmap : TPixmap ; { pixmap to be used as icon }
icon_window : TWindow ; { window to be used as icon }
icon_x, icon_y : Integer ; { initial position of icon }
icon_x, icon_y : longint ; { initial position of icon }
icon_mask : TPixmap ; { icon mask bitmap }
window_group : TXID ; { id of related window group }
{ this structure may be extended in the future }
end;
{ definition for flags of XWMHints }
{ definition for flags of XWMHints }
Const
InputHint = 1 shl 0;
StateHint = 1 shl 1;
@ -95,42 +93,36 @@ Const
AllHints = InputHint or StateHint or IconPixmapHint or IconWindowHint or
IconPositionHint or IconMaskHint {or WindowGroupHint};
XUrgencyHint = 1 shl 8;
{ definitions for initial window state }
WithdrawnState = 0; { for windows that are not mapped }
NormalState = 1; { most applications want to start this way }
IconicState = 3; { application wants to start as an icon }
{
* Obsolete states no longer defined by ICCCM
}
{ Obsolete states no longer defined by ICCCM }
DontCareState = 0; { don't know or care }
ZoomState = 2; { application wants to start zoomed }
InactiveState = 4; { application believes it is seldom used; }
{ some wm's may put it on inactive menu }
{
* new structure for manipulating TEXT properties; used with WM_NAME,
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
new structure for manipulating TEXT properties; used with WM_NAME,
WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
}
type
TXTextProperty = record
value : pchar; { same as Property routines }
encoding : TAtom; { prop type }
format : Integer ; { prop data format: 8, 16, or 32 }
format : longint ; { prop data format: 8, 16, or 32 }
nitems : Cardinal; { number of data items in value }
end;
PXTextProperty = ^TXTextProperty;
Const
XNoMemory =-1;
XLocaleNotSupported =-2;
XConverterNotFound =-3;
Type
TXICCEncodingStyle = Integer;
TXICCEncodingStyle = longint;
Const
XStringStyle = 0; { STRING }
@ -142,7 +134,7 @@ Type
TXIconSize = record
min_width, min_height,
max_width, max_height,
width_inc, height_inc : Integer;
width_inc, height_inc : longint;
end;
PXIconSize = ^TXIconSize;
@ -176,7 +168,7 @@ PXClassHint = ^TXClassHint;
TXComposeStatus = record
compose_ptr : TXPointer ; { state table pointer }
chars_matched : Integer ; { match state }
chars_matched : longint ; { match state }
end;
PTXComposeStatus = ^TXComposeStatus;
@ -230,14 +222,14 @@ Type
TXVisualInfo = record
visual : PVisual;
visualid : TVisualID ;
screen : Integer;
depth : Integer;
c_class : Integer;
screen : longint;
depth : longint;
c_class : longint;
red_mask : cardinal;
green_mask : cardinal;
blue_mask : Cardinal;
colormap_size : Integer;
bits_per_rgb : Integer;
colormap_size : longint;
bits_per_rgb : longint;
end;
PXVisualInfo = ^TXVisualInfo;
@ -275,52 +267,39 @@ PXStandardColormap= ^TXStandardColormap;
Const
ReleaseByFreeingColormap = 1; { for killid field above }
{
* return codes for XReadBitmapFile and XWriteBitmapFile
}
{ return codes for XReadBitmapFile and XWriteBitmapFile }
BitmapSuccess =0;
BitmapOpenFailed =1;
BitmapFileInvalid =2;
BitmapNoMemory =3;
{***************************************************************
*
* Context Management
*
***************************************************************}
const
{ Associative lookup table return codes }
XCSUCCESS =0; { No error. }
XCNOMEM =1; { Out of memory }
XCNOENT =2; { No entry in table }
type TXContext = Integer;
type
TXContext = longint;
{
XUniqueContext() ((XContext) XrmUniqueQuark())
XStringToContext(string) ((XContext) XrmStringToQuark(string))
}
const _xlib = 'X11';
function XGetVisualInfo(display: PDisplay; vinfo_mask: LongInt;
vinfo_template: PXVisualInfo; var nitems_return: Integer): PXVisualInfo;
cdecl; external _xlib;
vinfo_template: PXVisualInfo; var nitems_return: longint): PXVisualInfo;
cdecl; external;
Implementation
end.
{
(*
_XFUNCPROTOBEGIN
{ The following declarations are alphabetized. }
extern XClassHInteger *XAllocClassHInteger (
extern XClassHlongint *XAllocClassHlongint (
#if NeedFunctionPrototypes
void
#endif
@ -369,7 +348,7 @@ extern char *XDefaultString(
#endif
);
extern Integer XDeleteContext(
extern longint XDeleteContext(
#if NeedFunctionPrototypes
Display* { display },
XID { rid },
@ -396,7 +375,7 @@ extern XEqualRegion(
#endif
);
extern Integer XFindContext(
extern longint XFindContext(
#if NeedFunctionPrototypes
Display* { display },
XID { rid },
@ -550,7 +529,7 @@ extern void XConvertCase(
#endif
);
extern Integer XLookupString(
extern longint XLookupString(
#if NeedFunctionPrototypes
XKeyEvent* { event_struct },
char* { buffer_return },
@ -594,7 +573,7 @@ extern Region XPolygonRegion(
#endif
);
extern Integer XRectInRegion(
extern longint XRectInRegion(
#if NeedFunctionPrototypes
Region { r },
int { x },
@ -604,7 +583,7 @@ extern Integer XRectInRegion(
#endif
);
extern Integer XSaveContext(
extern longint XSaveContext(
#if NeedFunctionPrototypes
Display* { display },
XID { rid },
@ -805,7 +784,7 @@ extern XSubtractRegion(
#endif
);
extern Integer XmbTextListToTextProperty(
extern longint XmbTextListToTextProperty(
#if NeedFunctionPrototypes
Display* { display },
char** { list },
@ -815,7 +794,7 @@ extern Integer XmbTextListToTextProperty(
#endif
);
extern Integer XwcTextListToTextProperty(
extern longint XwcTextListToTextProperty(
#if NeedFunctionPrototypes
Display* { display },
wchar_t** { list },
@ -839,7 +818,7 @@ extern Status XTextPropertyToStringList(
#endif
);
extern Integer XmbTextPropertyToTextList(
extern longint XmbTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* { display },
XTextProperty* { text_prop },
@ -848,7 +827,7 @@ extern Integer XmbTextPropertyToTextList(
#endif
);
extern Integer XwcTextPropertyToTextList(
extern longint XwcTextPropertyToTextList(
#if NeedFunctionPrototypes
Display* { display },
XTextProperty* { text_prop },
@ -873,7 +852,7 @@ extern XUnionRegion(
#endif
);
extern Integer XWMGeometry(
extern longint XWMGeometry(
#if NeedFunctionPrototypes
Display* { display },
int { screen_number },
@ -900,4 +879,15 @@ extern XXorRegion(
_XFUNCPROTOEND
#endif { _XUTIL_H_ }
*)
Implementation
end.
{
$Log$
Revision 1.3 2000-02-27 13:11:31 peter
* cleanup, removed warnings
* external decls moved from implementation to interface
}