Table of Contents

5.0.2 Programs of Gambas - Syntax

If you only want to test a Gambas project, or if you want to run a Gambas script, then start all required Gambas programs (e. g. compiler, archiver and interpreter) in one console. The following sections provide an overview of the syntax and semantics of the individual program calls. The following chapters describe how to use the programs in a sample project.

5.0.2.1 Component Informer

The program' gbi3' gives you an overview of the components in the installation directory or generates files with a description of selected components in relation to the used classes as well as their properties, methods and events.

Syntax:	[sudo] gbi3 [options] [components]
OptionDescription
-r or –root <gb-install-index>path to the Gambas installation directory
-V or –versionDisplay the program version
-L or –licensedisplay of the program license
-h or –helpDisplay of the program help

Table 5.0.2.1.1.1: informer

So you use the program' gbi3' to display all components in the Gambas installation directory. If you don't have Gambas installed in the default installation directory, you have to specify the path; otherwise you can omit it and start it with $ sudo gbi3/:

hans@linux:~$ sudo gbi3 -r /usr/local # Default path for the Gambas version 3.3.4
gb
gb.cairo
gb.chart
gb.complex
…
gb.xml.xslt
hans@linux:~$

The following call generates 2 files that contain a class overview of the selected component as well as an overview of the properties, methods and events of the classes:

hans@linux:~$ sudo gbi3 -v gb.media
Running myself for component gb.media
LD_PRELOAD=/usr/local/lib/gambas3/gb.media.so
Analyzing component gb.media
Loading native component: /usr/local/lib/gambas3/gb.media.so
wrote /usr/local/share/gambas3/info/gb.media.info
wrote /usr/local/share/gambas3/info/gb.media.list
hans@linux:~$

Displaying the contents of the 2 text files: The file component. list contains a class overview, you can use reads (end with q) or gedit under Gnome instead of cat.

hans@linux:~$ cat /usr/local/share/gambas3/info/gb.media.list

The file componenten. info contains an overview of the properties, methods and events of the classes in a specific format.

hans@linux:~$ cat /usr/local/share/gambas3/info/gb.media.info

5.0.2.2 Compiler

Syntax:	gbc3 [options] [<project directory>]
OptionDescription
-gDebugging information will be added
-v or –verboseThe program documents internal processes
-aRe-compile everything again
-wDisplay warnings
-t or –translateOutput of translation files
-p or –public-controlSet all components to 'public'
-m or –public-moduleSet module symbols to 'public' (default)
-s or –swapexchanges the endianess of the compilation.
-r or –root <directory>Gambas installation directory
-e or –translate-errors Display of the error messages at the time of translating
-x or –execDefines the preprocessor constant 'Exec'; http://gambasdoc.org/help/lang/.if?v3
-V or –versionDisplay the program version
-L or –licenseAdvertisement of program license
-h or –helpDisplay of the program help

Table 5.0.2.2.2.1: Compiler

Note:The Endianess or Byte order specifies how the individual bytes of a multibyte data type are arranged. In Little-Endian, the least significant byte is at the smallest memory location, in Big-Endian, the least significant byte is at the highest.

Original:' A compiled file is a binary representation of a class, that contains every information useful to the interpreter: functions transformed to byte code, constants, variable definition, debugging information, etc'.

5.0.2.3 Archiver

The Archiver' gba3' generates an executable file from a Gambas project or extracts a special file from an executable Gambas file if the -x option is set. The created archive contains all files, i. e. the executable program and all data files.

The archive is marked as a script in the magic header (“Shebang”) #! /usr/bin/ gbx3, so Linux calls it as such in the background with the interpreter to run it. Of course, the interpreter and all necessary components must be installed to run a Gambas program.

Syntax:	gba3 [options] [<project directory>]
	gba3 -x <archive-path> <file>
OptionDescription
-o -output=ARCHIVArchive path[<project directory>/<project name>. gambas]
-v or –verboseThe program documents internal processes
-s or –swapSwapping the Endiness
-V or –versionDisplay the program version
-L or –licensedisplay of the program license
-h or –helpDisplay of the program help
-x or –extract=ARCHIVArchive path

Table 5.0.2.3.3.1: Archiver

5.0.2.4 Interpreter

The program' gbx3' executes a Gambas program or evaluates a Gambas expression if the -e option is used.

Syntax:	gbx3 [options] [<project-file>] [-- <list of arguments: arg_1 arg_2 … arg_k>]
OptionDescription
-gThe debugging mode is executed
-p <path>Profiling and debugging mode are activated
-V or –versionDisplay the program version
-L or –licensedisplay of the program license
-h or –helpDisplay of the program help
-H od –httpd(since revision 5209) Execute through an embedded HTTP server. The program interprets it as a CGI script and loads the gb. httpd component.
-eEvaluation of a Gambas expression

5.0.2.5 Scripter

The program' gbs3' first compiles a Gambas script and then executes it.

Syntax:	gbs3 [options] [<path_to_the_script-file>]
OptionDescription
-c or –nocacheforce recompilation of the script and ignore cached compilations.
-v or –verboseThe program documents internal processes
-V or –versionDisplay the program version
-L or –licensedisplay of the program license
-h or –helpDisplay of the program help

Table 5.0.2.5.5.1: Scripter

5.0.2.6 Webpage scripter

The program' gbw3' compiles a Gambas server page script and executes it on the web server.

Syntax:	gbx3 [options] [<url: server-page-file>]
OptionDescription
-c or –nocacheforce recompilation of the script and ignore the cache.
-v or –verboseThe program documents internal processes
-V or –versionDisplay the program version
-L or –licensedisplay of the program license
-h or –helpDisplay of the program help

Table 5.0.2.6.6.1: Web Page Scripter