NAME
tools/dev/ncidef2pir.pl - Turn an NCI library definition file into PIR
SYNOPSIS
perl tools/dev/ncidef2pir.pl path/to/from_file [ path/to/to_file ]
DESCRIPTION
This program takes an NCI library definition file and creates a PIR file which loads the described library.
An NCI library definition file provides the information needed to generate a parrot wrapper for the named library (or libraries). Its format is simple, and looks like:
[package] ncurses [lib] libform.so [defs] p new_field i i i i i i [lib] libncurses.so [defs] i is_term_resized i i
Note that the assembly file is generated in the order you specify, so if there are library dependencies, make sure you have them in the correct order.
package
Declares the package that all subsequent sub PMCs will be put into. Double colon is used to to delimit namespaces.
lib
The name of the library to be loaded. Should be as qualified as necessary for your platform--generally the full filename is required, though the directory generally isn't.
You may load multiple libraries here, but only the last one loaded will be exposed to subsequent defs.
defs
This section holds the definitions of functions. Each function is assumed to be in the immediate preceding library. The definition of the function is:
return_type name [param [param [param ...]]]
The param and return_type parameters use the NCI standard, which for reference is:
- p Parameter is a void pointer, taken from the PMC's data pointer. PMC is assumed to be an unmanagedstruct or child class.Taken from a P register
- c Parameter is a character.Taken from an I register
- s Parameter is a shortTaken from an I register
- i Parameter is an intTaken from an I register
- l Parameter is a longTaken from an I register
- f Parameter is a floatTaken from an N register.
- d Parameter is a double.Taken from an N register.
- t Parameter is a char *, presumably a C stringTaken from an S register
- v Void. Only valid as a return type, noting that the function returns no data.
- I Interpreter pointer. The current interpreter pointer is passed in
- P PMC.
- 2 Pointer to short.Taken from an I register.
- 3 Pointer to int.Taken from an I register
- 4 Pointer to longTaken from an I register