The Syntax of the LIBMAKE command is:
libmake -quiet filenamesThe filenames is the name of one or more source files containing LIBMAKE directives. The command tail -quiet is optional. It suppresses output of the generated C to the screen. It is a good idea to use this command tail.
The complete set of LIBMAKE directives are given below.
You must specify the language you wish LIBMAKE to generate
declarations in. It should be noted that for some languages not all
the other directives are applicable. In particular, for C++,Visual
Basic and Delphi, only the #table and
#index directives are relevant (apart from C++ specifc
directives) - for these languages LIBMAKE does not generate
initialisation code to open the database, or support extract
files.
| Directive | Language | Initialisation Code Generated? |
|---|---|---|
#c |
C | Yes |
#cbasic |
IBM 4680/4690 Basic | Yes |
#cpp |
C++ | No |
#delphi32 |
32 Bit Delphi | No |
#vb32 |
32 Bit Visual Basic | No |
In fact LIBMAKE still supports a number of other languages including various dialects of Cobol and Pascal, and 16 bit versions of Delphi or VB, but we no longer supply programming libraries or header files for these.
You must specify which database that you wish to use. Do this
with the #db directive: #db database where
database is the name of the database that you
wish to use.
(For #cpp only) Stops LIBMAKE from using the MFC CTime
class for accessing date and time fields. Only needed if you do not
use #public
LIBMAKE stops scanning the source file for directives when it
sees the #end directive.
(For #c and #cbasic only) LIBMAKE passes the EXCLUSIVE flag in the generates call to db_open().Your program will only run if no other programs are using the database, and will prevent other programs opening the database while it is running.
(#c only) Use the #external directive to generate a
separate file filename.e containing extern versions of
the declarations in the .h file. This may be useful if your program
has more than one source file.
(#c only) Please refer to the section Extracting and Sorting Records for information about this directive.
The #extract directive is used in conjunction with
the #sorton directive.
(#c only) If you use the #extract directive,
the extract file is given the name EXTRACT by default. To change
the name of the extract file, use the #filename
directive: #filename filename
where filename is the name that you wish the extract file to have.
To generate indexes for use in calls to the function
rec_fetch(), use the #index directive:
#index |
where indexname is the name of an index
table or role to use with rec_fetch().
For example, if you use the directive: #index index_date_time,index_cust_name; You could then call
rec_fetch with the INDEX_DATE_TIME index or INDEX_CUST_NAME indexes
as follows:
rec_fetch(NEXT, &order_header.l, _INDEX_DATE_TIME, 0); |
If an index uses a role name as well as a table name you can can specify the index roles in this directive as well or you can have a #ROLE section using the same syntax (LIBMAKE does not actually care whether a name specified in these sections is an index table name or a role name).
(For #cpp only) Causes LIBMAKE to generate the record area for tables directly inside C++ classes. Without this directive LIBMAKE creates separate include files containing C Structures and C++ classes that use them.
(For #c and #cbasic only) Causes LIBMAKE to set the df_libtype variable. If not specified df_libtype is set to 1. df_libtype affects the behaviour of the DP4 field input functions. See df_libtype in the C/C++ Programmers Reference. The recommended value is 5
To specify the libtype, use the #libtype directive:
#libtype n
where n is the value to be assigned to
df_libtype.
(For #c and #cbasic only) LIBMAKE generates a call to map_load() that loads a mapset with the base name of the source file.
To use a different mapset, use the #mapname directive:
#mapname mapsetname
where mapsetname is the name of the mapset
to use in your program.
(For #c only) LIBMAKE generates two functions called init
and finish. To prevent these functions from being generated in the
header file, use the #noinit directive:
If you use the #noinit directive, no code is
generated to perform the following tasks:
You will then have to write your own code to open and close the database or load maps.
(For #c and #cbasic only) This directive adds the value NO_LOGGING to the flags with which db_open() is called.
(For #cpp only) This directive stops LIBMAKE including dp4class.h in the generated code.
When LIBMAKE generates types, by default it declares padding fields where empty space is left in a record to ensure correct data alignment.
To disable this feature, and rely on compiler generated padding
instead, (not recommended) use the
#nopadding directive.
(For #c only)
This makes LIBMAKE generate table declarations that are pointers to structures rather than actual structures. This is usually used when creating QAB C exits.
(For #c and #cbasic only)
This directive adds the value PRIVATE_DB to the flags with which db_open() is called, and enables the private database facility.
(For #cpp only) If you use this flag the members of your
C++ classes corresponding to fields on the database will be
declared public. If you do not use this flag the members will be
private and only accessible via Get and Set functions. As these
functions do not do any checking you are recommended to use the
#public directive.
This directive adds the value QUIT_ON_FAILURE to the flags with which db_open is called.
Using this directive means your program will always terminate if a commit failure condition is encountered.
(For #c and #cbasic only) This directive adds the value READ_ONLY to the flags with which db_open is called.
(For #c and #cbasic only) This directive adds the value SHARED to the flags with which db_open() is called, enabling multiple programs to open the data simultaneously. In fact SHARED has the value 0 so there is no need to specify this directive explicitly.
Please refer to the section Extracting and Sorting Records for information about this directive.
The #sorton directive is used in conjunction with the #extract directive.
Please refer to Defining the Database Tables to be Used.