Content-type: text/html Manpage of gtk-server.cfg

gtk-server.cfg

Section: User Commands (1)
Index Return to Main Contents
 

NAME

gtk-server.cfg - Configfile for the gtk-server.  

SYNOPSIS

gtk-server.cfg  

DESCRIPTION

The 'gtk-server.cfg' file is a configfile which is used by the GTK-server. If the 'gtk-server.cfg' file is available in the same directory as your client script, the GTK-server will read this local configfile (preferred). This way each client program can use it's own GTK configuration. If the configfile is not available locally, the GTK-server will follow the next logic: 1) try reading the environment variable GTK_SERVER_CONFIG. This variable should contain the full path and name to the configfile. 2) try finding the (hidden) configfile in the homedir of the user. The name of the configfile should be preceded by a dot, e.g. '.gtk-server.cfg'. 3) try finding the configfile in the /etc directory. 4) try finding the configfile in the /usr/local/etc directory. The 'gtk-server.cfg' file contains the decriptions of the GTK functions which will be used by your client script. The format of the file is <KEYWORD = VALUE>. Lines starting with a hash '#' will be skipped. The keywords must be written using capitals. The following keywords are recognized by the GTK-server:
LIB_NAME = <library name 1, library name 2, ...>
Describes the name of the libraries (.so or .dll) to open. This keyword may occur multiple times in the configfile. At a maximum 32 libraries can be opened simultanously.

Example: LIB_NAME = libgtk-x11-2.0.so, libgdk-x11-2.0.so, libglib-2.0.so, libgobject-2.0.so

INCLUDE = <file>
Define an additional configuration file with additional GTK function descriptions or macros.

Example: INCLUDE = /etc/gtk-extra.cfg

FUNCTION_NAME = <func>, <callback>, <type>, <amount>, <arg1>...<argx>
Every GTK function used by a script must be described here. First the name of the function itself must be mentioned, after that a callback signal if applicable. The real names for the GTK callback signals must be used here. Then the type of the returnvalue must be specified. The type can be one of the following: NONE, WIDGET, BOOL, STRING, LONG, DOUBLE or FLOAT. After that, it must be clear how many arguments the GTK function needs. Finally, the type of each indivdual argument must be declared. The type of the arguments can be one of the following: NULL, WIDGET, BOOL, STRING, LONG, DOUBLE, FLOAT, ADDRESS or BASE64. The ADDRESS type is used to return the address of a function in memory. The BASE64 type is used to send base64 encoded binary data to the GTK-server.

The 'gtk-server.cfg' file may not contain duplicate function definitions. This is verified by the GTK-server during startup.

Example: FUNCTION_NAME = gtk_window_new, delete-event, WIDGET, 1, LONG

LOG_FILE = <directory>
This keyword describes the directory where the GTK-server has to put it's logfile, if logging is turned on. If the directory is described with a dot '.', the logfile will be produced in the same directory where the GTK-server binary resides.

Example: LOG_FILE = /tmp

 

Pointer arguments

Some GTK functions return a result in their pointer arguments. The way to retrieve the value from such arguments is to create a definition for the GTK function with special parameters. For example:

FUNCTION_NAME = gdk_window_get_pointer, NONE, WIDGET, 4, WIDGET, PTR_LONG, PTR_LONG, NULL

In this case, a call to 'gdk_window_get_pointer' will return a widget but also the values stored in the second and third argument. The returned result will be formatted in S-expression syntax, just as the GTK-server also accepts S-expression syntax. Next to the type PTR_LONG the types PTR_FLOAT, PTR_DOUBLE, PTR_STRING, PTR_BOOL and PTR_WIDGET can be used.

 

MACROS

In GTK sometimes more than one function is needed to define a widget. These functions can be grouped into a macro. From a clientscript the name of the macro can be used to invoke the macro. The the general layout of a macro is shown below:

MACRO <name>
$a : GTK_function
GTK_function $1 $2 $3
...
RETURN <value>
ENDMACRO

Each line in the macro may contain only one GTK function. A macro can be invoked with arguments. Within the macro these arguments are denoted with $1, $2, $3 an so on. The $0 points to the macroname itself. It is possible to refer to all arguments at once with $@. A macro can accept up to 9 arguments. If there are more arguments then these are ignored.

Macros may also use variables. Variablenames must start with a dollarsign '$'. After that, only the first letter of the variablename is important, which means that there are at most 26 variables in each macro (lowercase).

Within a macro, it is possible to assign a result of a GTK function to a variable. However, it is important that the colon symbol, which is the assignment operator, is not attached to the variablename or the GTK functionname. For example:

$window : gtk_window_new 0

Also it is possible to assign a string to a variable. To do this, the string should be preceded by the '&' sign. For example:

$var : &Hello world

Variables in macros are initialized to zero automatically, but keep their values after the macro object has been executed. Afterwards the variables can be retrieved in your clientscript by using the call 'gtk_server_macro'. For example:

gtk_server_macro <macroname> var

It is possible to perform a relative jump on the condition of the value of a variable. The command 'VALUE' jumps when a variable is not equal to zero, and the command 'EMPTY' jumps when a variable is zero. The command 'JUMP' always jumps, no matter what condition. For example:

$var EMPTY 3

In this example, the GTK-server will jump three statements forward in case the variable 'var' is equal to zero. The commands 'EMPTY', 'VALUE' and 'JUMP' can jump forward and backward, but only within the macro object. Jumps outside the macro will just go to the end of the macro, or to the beginning if the jump is negative.

It is not allowed to define a macro within a macro. However, macros may invoke other macros. Also, macros may return a value to the client script with the keyword 'RETURN'. For example:

RETURN $window

The Highlevel Universal GUI (HUG) defined in the GTK-server configfile is implemented using macro objects.

 

EXAMPLES

An example of a 'gtk-server.cfg' file can be found in the sourcepackage.

 

LICENSE

GPL license.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.  

SEE ALSO

gtk-server(1), stop-gtk-server(1)  

AUTHORS

Orignal concept, design and implementation by Peter van Eerten, e-mail : peter AT gtk-server DOT org

Current version of the GTK-server was created with help of many others - see the CREDITS file in the sourcepackage for credits.


 

Index

NAME
SYNOPSIS
DESCRIPTION
Pointer arguments
MACROS
EXAMPLES
LICENSE
SEE ALSO
AUTHORS

This document was created by man2html, using the manual pages.
Time: 14:04:18 GMT, May 02, 2008