/**************************************************************************** This is an example application to test the C "simple.library". Make the glue code with LibTool (-c option). Manx 3.6 cc +p SimpleCApp.c LibTool -cho glue.asm SimpleC.fd as -cd glue.asm ln -o ram:TestProgram SimpleCApp.o glue.o -lcl32 Lattice 5.0 lc -b0 SimpleCApp.c LibTool -cho glue.asm SimpleC.fd assemble glue.asm blink lib:c.o SimpleCApp.o glue.o LIB lib:lcnb.lib TO ram:TestProgram ****************************************************************************/ #ifdef AZTEC_C #define NARGS #define NO_PRAGMAS #endif #ifdef AZTEC_C #include "functions.h" #else #include "proto/all.h" #endif #include "exec/types.h" /* This is the INCLUDE file made by LibTool */ #include "SimpleC.h" ULONG argcount; /* Saves argc from main(). argcount==0, then run from WB. */ #ifdef NARGS VOID exit_program(); #else VOID exit_program( char, ULONG ); long main( long, char ** ); #endif VOID exit_program( error_words, error_code ) /* All exits through here. */ char error_words; ULONG error_code; { if( argcount && error_words ) puts( error_words ); CloseSimpleBase(); /* This is always safe to call */ exit( error_code ); } /************************ MAIN ROUTINE *****************************/ VOID main(argc, argv) LONG argc; char **argv; { register ULONG x, y, result; argcount = argc; /* open simple.library */ if (! (OpenSimpleBase()) ) exit_program("Can't open simple library.\n", 10L); /* add 2 numbers and print result */ x = 4; y = 6; result = Add2Numbers(x, y); printf("%d + %d = %d\n", x, y, result); /* sub 2 numbers and print result */ x = 10; y = 4; result = Sub2Numbers(x, y); printf("%d - %d = %d\n", x, y, result); /* multiply 2 numbers and print result */ x = 8; y = 8; result = Mult2Numbers(x, y); printf("%d * %d = %d\n", x, y, result); exit_program(0L,0L); }