Content-type: text/html Manpage of PC2C

PC2C

Section: PUPS build tools (1)
Updated: 16th August 2000
Index Return to Main Contents

 

NAME

PC2C - Preprocessor to convert Dynamic C[D] to PUPS-ANSI C.

 

SYNOPSIS

pc2c < <D language source> > <PUPS-ANSI C language source> >& <log file>

 

DESCRIPTION

pc2c(1) is a pre-processor which convert the Dynamic C [D] programming language into an equivalent ANSI-C source which can be compiled using the GNU compiler tools, see gcc(1) and gdb(1) and then linked against the PUPS libraries.

The D language supports a number of dynamic programming extensions to ANSI-C including dynamic functions (which are have strong dynamic type checking and brokering). Dynamic functions are translated into equivalent PUPS-ANSI C orifice functions which may be dynamically attached to running PUPS/PSRP applications via the psrp(1) client.

In addition to dynamic functions, the D language also provides support for threads. When a D source is converted to PUPS-ANSI C it is automatically made threadsafe as a part of the conversion process. Functions are analysed to see if they are threadsafe. If they are not, pc2c(1) automatically inserts mutexes to make sure that unsafe functions cannot be simultaneously accessed by more than one thread. The D language extensions also provide language level supports for the notion of a root thread (e.g. the thread running when main() is called) and a set of root thread functions which may only be called by the root thread, and threadsafe functions which may be called by any thread without side effects.

 

KEYWORDS

The D language extensions add the following keywords to the ANSI-C programming language:

_DLL_ORIFICE: specifies a function is exportable to running PUPS/PSRP applications via the PUPS orifice protocol.

_ROOTTHREAD: specifies a function is only runnable by the root thread (e.g. the first thread run by a process).

_THREADSAFE: specifies that a function is threadsafe (and can therefore be called from any thread within a process without side effects). Threadsafe functions do not have mutexes automatically inserted by pc2c(1)

_TKEY(keytable) defines the current keytable used with the _TKEY_BIND, and _TKEY_FREE directives.

_TKEY_BIND(key) specifies than the item key is to be bound into the current keytable.

_TKEY_FREE(key) specifies than the item key is to be removed from the current keytable.


  pc2c(1) also checks the syntax of other PUPS-ANSI language extensions (e.g. _PROTOTYPE, _PRIVATE, _PUBLIC etc.). If an error is found during syntax checking, the offending line is printed out with its line number, and conversion is aborted.

 

LIBRARIES

In addition to the usual PUPS libraries, D sources translated to PUPS-ANSI C using pc2c(1) need to be linked to a library tadlib.c which provides functions which maybe #defined'd to the following items inserted by into the D code:

_USE_FMUTEX(mutex): defines the name of the current mutex.

_TKEY(keytable): define current keytable.

_TKEY_BIND(item): inserts item into current keytable.

_TKEY_FREE(item): removes item from current keytable.

_LOCK_THREAD_FMUTEX(mutex): lock mutex.

_UNLOCK_THREAD_FMUTEX(mutex): unlock mutex.

 

OPTIONS

None.

 

ENVIRONMENT VARIABLES

None.

 

COPYRIGHT

(C) Tumbling Dice Ltd.

 

PROGRAMMER

M.A. O'Neill.

 

SEE ALSO

pups(3), gcc(1), gdb(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
KEYWORDS
LIBRARIES
OPTIONS
ENVIRONMENT VARIABLES
COPYRIGHT
PROGRAMMER
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 13:53:35 GMT, January 11, 2008