1.5. Naming and Argument Conventions within Xlib
Xlib follows a number of conventions for the naming and syntax of the functions.
Given that you remember what information the function requires,
these conventions are intended to make the syntax of the functions more
predictable.
The major naming conventions are:
-
To differentiate the X symbols from the other symbols,
the library uses mixed case for external symbols.
It leaves lowercase for variables and all uppercase for user macros,
as per existing convention.
-
All Xlib functions begin with a capital X.
-
The beginnings of all function names and symbols are capitalized.
-
All user-visible data structures begin with a capital X.
More generally,
anything that a user might dereference begins with a capital X.
-
Macros and other symbols do not begin with a capital X.
To distinguish them from all user symbols,
each word in the macro is capitalized.
-
All elements of or variables in a data structure are in lowercase.
Compound words, where needed, are constructed with underscores (_).
-
The display argument, where used, is always first in the argument list.
-
All resource objects, where used, occur at the beginning of the argument list
immediately after the display argument.
-
When a graphics context is present together with
another type of resource (most commonly, a drawable), the
graphics context occurs in the argument list after the other
resource.
Drawables outrank all other resources.
-
Source arguments always precede the destination arguments in the argument list.
-
The x argument always precedes the y argument in the argument list.
-
The width argument always precedes the height argument in the argument list.
-
Where the x, y, width, and height arguments are used together,
the x and y arguments always precede the width and height arguments.
-
Where a mask is accompanied with a structure,
the mask always precedes the pointer to the structure in the argument list.
Christophe Tronche, ch@tronche.com