#ifndef __cxLattice_API_H_ #define __cxLattice_API_H_ #ifdef __cplusplus "C" { #endif #include <stdio.h> #if defined(__sun) || defined(WIN32)
cxCoord* cxCoordAlloc( signed long CnDim, signed long * CDims, cxCoordType CoordType, signed long PerimCoordArrayLength, signed long NumCoordDimensions );
signed long* cxCoordCDimsGet( cxCoord *src, cxErrorCode *ec );
long cxCoordCDimsLen( cxCoord *src, cxErrorCode *ec );
long cxCoordCDimsProd( cxCoord *src, cxErrorCode *ec );
void cxCoordCDimsRem( cxCoord *src, signed long* *val, cxErrorCode *ec );
void cxCoordCDimsSet( cxCoord *src, signed long* val, cxErrorCode *ec );
signed long cxCoordCnDimGet( cxCoord *src, cxErrorCode *ec );
void cxCoordCnDimSet( cxCoord *src, signed long val, cxErrorCode *ec );
cxCoordType cxCoordCoordTypeGet( cxCoord *src, cxErrorCode *ec );
void cxCoordCoordTypeSet( cxCoord *src, cxCoordType val, cxErrorCode *ec );
void* cxCoordCoordinatesArrayAlloc( cxCoord *src );
void* cxCoordCoordinatesArrayGet( cxCoord *src, cxErrorCode *ec );
long cxCoordCoordinatesArrayLen( cxCoord *src, cxErrorCode *ec );
void cxCoordCoordinatesArrayRem( cxCoord *src, void *val, cxErrorCode *ec );
void cxCoordCoordinatesArraySet( cxCoord *src, void *member, cxErrorCode *ec );
cxPrimType cxCoordCoordinatesArrayType( cxCoord *src, cxErrorCode *ec );
cxCoord* cxCoordCopy( cxCoord *src );
cxCoord* cxCoordDup( cxCoord *src );
signed long cxCoordNumCoordDimensionsGet( cxCoord *src, cxErrorCode *ec );
void cxCoordNumCoordDimensionsSet( cxCoord *src, signed long val, cxErrorCode *ec );
void* cxCoordNumCoordDimsGet( cxCoord *src );
void cxCoordNumCoordDimsSet( cxCoord *src, void *member );
signed long cxCoordPerimCoordArrayLengthGet( cxCoord *src, cxErrorCode *ec );
void cxCoordPerimCoordArrayLengthSet( cxCoord *src, signed long val, cxErrorCode *ec );
cxCoord* cxCoordRead( FILE *fd );
void cxCoordWrite( FILE *fd, int mode, cxCoord *src );
cxData* cxDataAlloc( signed long DnDim, signed long * DDims, signed long NumDataVariables, cxPrimType PrimitiveDataType );
cxData* cxDataCopy( cxData *src );
signed long* cxDataDDimsGet( cxData *src, cxErrorCode *ec );
long cxDataDDimsLen( cxData *src, cxErrorCode *ec );
long cxDataDDimsProd( cxData *src, cxErrorCode *ec );
void cxDataDDimsRem( cxData *src, signed long* *val, cxErrorCode *ec );
void cxDataDDimsSet( cxData *src, signed long* val, cxErrorCode *ec );
void* cxDataDataArrayAlloc( cxData *src );
void* cxDataDataArrayGet( cxData *src, cxErrorCode *ec );
long cxDataDataArrayLen( cxData *src, cxErrorCode *ec );
void cxDataDataArrayRem( cxData *src, void *val, cxErrorCode *ec );
void cxDataDataArraySet( cxData *src, void *member, cxErrorCode *ec );
cxPrimType cxDataDataArrayType( cxData *src, cxErrorCode *ec );
signed long cxDataDnDimGet( cxData *src, cxErrorCode *ec );
void cxDataDnDimSet( cxData *src, signed long val, cxErrorCode *ec );
cxData* cxDataDup( cxData *src );
signed long cxDataNumDataVariablesGet( cxData *src, cxErrorCode *ec );
void cxDataNumDataVariablesSet( cxData *src, signed long val, cxErrorCode *ec );
cxPrimType cxDataPrimitiveDataTypeGet( cxData *src, cxErrorCode *ec );
void cxDataPrimitiveDataTypeSet( cxData *src, cxPrimType val, cxErrorCode *ec );
cxData* cxDataRead( FILE *fd );
void cxDataWrite( FILE *fd, int mode, cxData *src );
cxLattice* cxLatticeAlloc( signed long NumDimensions, signed long * DimensionsArray );
cxCoord* cxLatticeCoordStructureGet( cxLattice *src, cxErrorCode *ec );
void cxLatticeCoordStructureSet( cxLattice *src, cxCoord* val, cxErrorCode *ec );
cxLattice* cxLatticeCopy( cxLattice *src );
cxData* cxLatticeDataStructureGet( cxLattice *src, cxErrorCode *ec );
void cxLatticeDataStructureSet( cxLattice *src, cxData* val, cxErrorCode *ec );
signed long* cxLatticeDimensionsArrayGet( cxLattice *src, cxErrorCode *ec );
long cxLatticeDimensionsArrayLen( cxLattice *src, cxErrorCode *ec );
void cxLatticeDimensionsArrayRem( cxLattice *src, signed long* *val, cxErrorCode *ec );
void cxLatticeDimensionsArraySet( cxLattice *src, signed long* val, cxErrorCode *ec );
cxLattice* cxLatticeDup( cxLattice *src );
signed long cxLatticeNumDimensionsGet( cxLattice *src, cxErrorCode *ec );
void cxLatticeNumDimensionsSet( cxLattice *src, signed long val, cxErrorCode *ec );
cxLattice* cxLatticeRead( FILE *fd );
void cxLatticeWrite( FILE *fd, int mode, cxLattice *src );
#ifndef __cxLattice_API_H_ #define __cxLattice_API_H_ #ifdef __cplusplus "C" { #endif #include <stdio.h> #if defined(__sun) || defined(WIN32)
integer function cxCoordAlloc( CnDim, CDims, CoordType, PerimCoordArrayLength, NumCoordDimensions )
integer function cxCoordCDimsGet( src, ec )
integer function cxCoordCDimsLen( src, ec )
integer function cxCoordCDimsProd( src, ec )
subroutine cxCoordCDimsRem( src, val, ec )
subroutine cxCoordCDimsSet( src, val, ec )
integer function cxCoordCnDimGet( src, ec )
subroutine cxCoordCnDimSet( src, val, ec )
integer function cxCoordCoordTypeGet( src, ec )
subroutine cxCoordCoordTypeSet( src, val, ec )
integer function cxCoordCoordinatesArrayAlloc( src )
integer function cxCoordCoordinatesArrayGet( src, ec )
integer function cxCoordCoordinatesArrayLen( src, ec )
subroutine cxCoordCoordinatesArrayRem( src, val, ec )
subroutine cxCoordCoordinatesArraySet( src, member, ec )
integer function cxCoordCoordinatesArrayType( src, ec )
integer function cxCoordCopy( src )
integer function cxCoordDup( src )
integer function cxCoordNumCoordDimensionsGet( src, ec )
subroutine cxCoordNumCoordDimensionsSet( src, val, ec )
integer function cxCoordNumCoordDimsGet( src )
subroutine cxCoordNumCoordDimsSet( src, member )
integer function cxCoordPerimCoordArrayLengthGet( src, ec )
subroutine cxCoordPerimCoordArrayLengthSet( src, val, ec )
integer function cxCoordRead( fd )
subroutine cxCoordWrite( fd, mode, src )
integer function cxDataAlloc( DnDim, DDims, NumDataVariables, PrimitiveDataType )
integer function cxDataCopy( src )
integer function cxDataDDimsGet( src, ec )
integer function cxDataDDimsLen( src, ec )
integer function cxDataDDimsProd( src, ec )
subroutine cxDataDDimsRem( src, val, ec )
subroutine cxDataDDimsSet( src, val, ec )
integer function cxDataDataArrayAlloc( src )
integer function cxDataDataArrayGet( src, ec )
integer function cxDataDataArrayLen( src, ec )
subroutine cxDataDataArrayRem( src, val, ec )
subroutine cxDataDataArraySet( src, member, ec )
integer function cxDataDataArrayType( src, ec )
integer function cxDataDnDimGet( src, ec )
subroutine cxDataDnDimSet( src, val, ec )
integer function cxDataDup( src )
integer function cxDataNumDataVariablesGet( src, ec )
subroutine cxDataNumDataVariablesSet( src, val, ec )
integer function cxDataPrimitiveDataTypeGet( src, ec )
subroutine cxDataPrimitiveDataTypeSet( src, val, ec )
integer function cxDataRead( fd )
subroutine cxDataWrite( fd, mode, src )
integer function cxLatticeAlloc( NumDimensions, DimensionsArray )
integer function cxLatticeCoordStructureGet( src, ec )
subroutine cxLatticeCoordStructureSet( src, val, ec )
integer function cxLatticeCopy( src )
integer function cxLatticeDataStructureGet( src, ec )
subroutine cxLatticeDataStructureSet( src, val, ec )
integer function cxLatticeDimensionsArrayGet( src, ec )
integer function cxLatticeDimensionsArrayLen( src, ec )
subroutine cxLatticeDimensionsArrayRem( src, val, ec )
subroutine cxLatticeDimensionsArraySet( src, val, ec )
integer function cxLatticeDup( src )
integer function cxLatticeNumDimensionsGet( src, ec )
subroutine cxLatticeNumDimensionsSet( src, val, ec )
integer function cxLatticeRead( fd )
subroutine cxLatticeWrite( fd, mode, src )
For example, assuming that the cxLattice.t file exists, you would take the following steps:
echo cxLattice > TYPES
cxmkmf
make
Now your automatically generated code will reside in
cxLattice.api.c.
Note that this process will create several files in the local directory, so it is often helpful to use a separate directory for types, just as modules are developed in their own directories.
signed long* cxCoordCDimsGet( cxCoord *src, cxErrorCode *ec ); signed long cxCoordCnDimGet( cxCoord *src, cxErrorCode *ec ); cxCoordType cxCoordCoordTypeGet( cxCoord *src, cxErrorCode *ec ); void* cxCoordCoordinatesArrayGet( cxCoord *src, cxErrorCode *ec ); signed long cxCoordNumCoordDimensionsGet( cxCoord *src, cxErrorCode *ec ); void* cxCoordNumCoordDimsGet( cxCoord *src ); signed long cxCoordPerimCoordArrayLengthGet( cxCoord *src, cxErrorCode *ec ); signed long* cxDataDDimsGet( cxData *src, cxErrorCode *ec ); void* cxDataDataArrayGet( cxData *src, cxErrorCode *ec ); signed long cxDataDnDimGet( cxData *src, cxErrorCode *ec ); signed long cxDataNumDataVariablesGet( cxData *src, cxErrorCode *ec ); cxPrimType cxDataPrimitiveDataTypeGet( cxData *src, cxErrorCode *ec ); cxCoord* cxLatticeCoordStructureGet( cxLattice *src, cxErrorCode *ec ); cxData* cxLatticeDataStructureGet( cxLattice *src, cxErrorCode *ec ); signed long* cxLatticeDimensionsArrayGet( cxLattice *src, cxErrorCode *ec ); signed long cxLatticeNumDimensionsGet( cxLattice *src, cxErrorCode *ec );
integer function cxCoordCDimsGet( src, ec ) integer function cxCoordCnDimGet( src, ec ) integer function cxCoordCoordTypeGet( src, ec ) integer function cxCoordCoordinatesArrayGet( src, ec ) integer function cxCoordNumCoordDimensionsGet( src, ec ) integer function cxCoordNumCoordDimsGet( src ) integer function cxCoordPerimCoordArrayLengthGet( src, ec ) integer function cxDataDDimsGet( src, ec ) integer function cxDataDataArrayGet( src, ec ) integer function cxDataDnDimGet( src, ec ) integer function cxDataNumDataVariablesGet( src, ec ) integer function cxDataPrimitiveDataTypeGet( src, ec ) integer function cxLatticeCoordStructureGet( src, ec ) integer function cxLatticeDataStructureGet( src, ec ) integer function cxLatticeDimensionsArrayGet( src, ec ) integer function cxLatticeNumDimensionsGet( src, ec )
void cxCoordCDimsSet( cxCoord *src, signed long* val, cxErrorCode *ec ); void cxCoordCnDimSet( cxCoord *src, signed long val, cxErrorCode *ec ); void cxCoordCoordTypeSet( cxCoord *src, cxCoordType val, cxErrorCode *ec ); void cxCoordCoordinatesArraySet( cxCoord *src, void *member, cxErrorCode *ec ); void cxCoordNumCoordDimensionsSet( cxCoord *src, signed long val, cxErrorCode *ec ); void cxCoordNumCoordDimsSet( cxCoord *src, void *member ); void cxCoordPerimCoordArrayLengthSet( cxCoord *src, signed long val, cxErrorCode *ec ); void cxDataDDimsSet( cxData *src, signed long* val, cxErrorCode *ec ); void cxDataDataArraySet( cxData *src, void *member, cxErrorCode *ec ); void cxDataDnDimSet( cxData *src, signed long val, cxErrorCode *ec ); void cxDataNumDataVariablesSet( cxData *src, signed long val, cxErrorCode *ec ); void cxDataPrimitiveDataTypeSet( cxData *src, cxPrimType val, cxErrorCode *ec ); void cxLatticeCoordStructureSet( cxLattice *src, cxCoord* val, cxErrorCode *ec ); void cxLatticeDataStructureSet( cxLattice *src, cxData* val, cxErrorCode *ec ); void cxLatticeDimensionsArraySet( cxLattice *src, signed long* val, cxErrorCode *ec ); void cxLatticeNumDimensionsSet( cxLattice *src, signed long val, cxErrorCode *ec );
subroutine cxCoordCDimsSet( src, val, ec ) subroutine cxCoordCnDimSet( src, val, ec ) subroutine cxCoordCoordTypeSet( src, val, ec ) subroutine cxCoordCoordinatesArraySet( src, member, ec ) subroutine cxCoordNumCoordDimensionsSet( src, val, ec ) subroutine cxCoordNumCoordDimsSet( src, member ) subroutine cxCoordPerimCoordArrayLengthSet( src, val, ec ) subroutine cxDataDDimsSet( src, val, ec ) subroutine cxDataDataArraySet( src, member, ec ) subroutine cxDataDnDimSet( src, val, ec ) subroutine cxDataNumDataVariablesSet( src, val, ec ) subroutine cxDataPrimitiveDataTypeSet( src, val, ec ) subroutine cxLatticeCoordStructureSet( src, val, ec ) subroutine cxLatticeDataStructureSet( src, val, ec ) subroutine cxLatticeDimensionsArraySet( src, val, ec ) subroutine cxLatticeNumDimensionsSet( src, val, ec )
cxPrimType cxCoordCoordinatesArrayType( cxCoord *src, cxErrorCode *ec ); cxPrimType cxDataDataArrayType( cxData *src, cxErrorCode *ec );
integer function cxCoordCoordinatesArrayType( src, ec ) integer function cxDataDataArrayType( src, ec )
long cxCoordCDimsLen( cxCoord *src, cxErrorCode *ec ); long cxCoordCoordinatesArrayLen( cxCoord *src, cxErrorCode *ec ); long cxDataDDimsLen( cxData *src, cxErrorCode *ec ); long cxDataDataArrayLen( cxData *src, cxErrorCode *ec ); long cxLatticeDimensionsArrayLen( cxLattice *src, cxErrorCode *ec );
integer function cxCoordCDimsLen( src, ec ) integer function cxCoordCoordinatesArrayLen( src, ec ) integer function cxDataDDimsLen( src, ec ) integer function cxDataDataArrayLen( src, ec ) integer function cxLatticeDimensionsArrayLen( src, ec )
long cxCoordCDimsProd( cxCoord *src, cxErrorCode *ec ); long cxDataDDimsProd( cxData *src, cxErrorCode *ec );
integer function cxCoordCDimsProd( src, ec ) integer function cxDataDDimsProd( src, ec )
cxCoord* cxCoordDup( cxCoord *src ); cxData* cxDataDup( cxData *src ); cxLattice* cxLatticeDup( cxLattice *src );
integer function cxCoordDup( src ) integer function cxDataDup( src ) integer function cxLatticeDup( src )
cxCoord* cxCoordCopy( cxCoord *src ); cxData* cxDataCopy( cxData *src ); cxLattice* cxLatticeCopy( cxLattice *src );
integer function cxCoordCopy( src ) integer function cxDataCopy( src ) integer function cxLatticeCopy( src )
cxCoord* cxCoordAlloc( signed long CnDim, signed long * CDims, cxCoordType CoordType, signed long PerimCoordArrayLength, signed long NumCoordDimensions ); void* cxCoordCoordinatesArrayAlloc( cxCoord *src ); cxData* cxDataAlloc( signed long DnDim, signed long * DDims, signed long NumDataVariables, cxPrimType PrimitiveDataType ); void* cxDataDataArrayAlloc( cxData *src ); cxLattice* cxLatticeAlloc( signed long NumDimensions, signed long * DimensionsArray );
integer function cxCoordAlloc( CnDim, CDims, CoordType, PerimCoordArrayLength, NumCoordDimensions ) integer function cxCoordCoordinatesArrayAlloc( src ) integer function cxDataAlloc( DnDim, DDims, NumDataVariables, PrimitiveDataType ) integer function cxDataDataArrayAlloc( src ) integer function cxLatticeAlloc( NumDimensions, DimensionsArray )There are two types of allocation routines, those that allocate an array and those that allocate a reference-counted structure.
void cxCoordCDimsRem( cxCoord *src, signed long* *val, cxErrorCode *ec ); void cxCoordCoordinatesArrayRem( cxCoord *src, void *val, cxErrorCode *ec ); void cxDataDDimsRem( cxData *src, signed long* *val, cxErrorCode *ec ); void cxDataDataArrayRem( cxData *src, void *val, cxErrorCode *ec ); void cxLatticeDimensionsArrayRem( cxLattice *src, signed long* *val, cxErrorCode *ec );
cxCoord* cxCoordRead( FILE *fd ); cxData* cxDataRead( FILE *fd ); cxLattice* cxLatticeRead( FILE *fd );
integer function cxCoordRead( fd ) integer function cxDataRead( fd ) integer function cxLatticeRead( fd )
void cxCoordWrite( FILE *fd, int mode, cxCoord *src ); void cxDataWrite( FILE *fd, int mode, cxData *src ); void cxLatticeWrite( FILE *fd, int mode, cxLattice *src );
subroutine cxCoordWrite( fd, mode, src ) subroutine cxDataWrite( fd, mode, src ) subroutine cxLatticeWrite( fd, mode, src )
#include <cx/Typedefs.t>
shared root typedef struct {
long nDim "Num Dimensions";
long dims[nDim] "Dimensions Array";
cxData(nDim, dims) data "Data Structure";
cxCoord(nDim, dims) coord "Coord Structure";
} cxLattice;
shared typedef struct {
long nDim "C nDim";
long dims[nDim] "C Dims";
cxCoordType coordType "Coord Type";
switch (coordType) {
case cx_coord_uniform:
float bBox[2, nDim] "Coordinates Array";
case cx_coord_perimeter:
long sumCoord "Perim Coord Array Length";
float perimCoord[sumCoord] "Coordinates Array";
case cx_coord_curvilinear:
long nCoordVar "Num Coord Dimensions";
float values[nCoordVar, dims] "Coordinates Array";
} c;
} cxCoord(nDim, dims);
shared typedef struct {
long nDim "D nDim";
long dims[nDim] "D Dims";
long nDataVar "Num Data Variables";
cxPrimType primType "Primitive Data Type";
switch (primType) {
case cx_prim_byte:
char values[nDataVar, dims] "Data Array";
case cx_prim_short:
short values[nDataVar, dims] "Data Array";
case cx_prim_int:
int values[nDataVar, dims] "Data Array";
case cx_prim_long:
long values[nDataVar, dims] "Data Array";
case cx_prim_float:
float values[nDataVar, dims] "Data Array";
case cx_prim_double:
double values[nDataVar, dims] "Data Array";
} d;
} cxData(nDim, dims);
typedef enum {
cx_coord_uniform,
cx_coord_perimeter,
cx_coord_curvilinear
} cxCoordType;