1 /***************************************************************************
5 * Purpose: Test functions in C for UFFI library
6 * Programer: Kevin M. Rosenberg
7 * Date Started: Mar 2002
11 * This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
13 * UFFI users are granted the rights to distribute and use this software
14 * as governed by the terms of the Lisp Lesser GNU Public License
15 * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 * These variables are correct for GCC
18 * you'll need to modify these for other compilers
19 ***************************************************************************/
24 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll,
31 #define DLLEXPORT __declspec(dllexport)
42 DLLEXPORT unsigned char uchar_13 = 13;
43 DLLEXPORT signed char schar_neg_120 = -120;
44 DLLEXPORT unsigned short uword_257 = 257;
45 DLLEXPORT signed short sword_neg_321 = -321;
46 DLLEXPORT unsigned int uint_1234567 = 1234567;
47 DLLEXPORT signed int sint_neg_123456 = -123456;
48 DLLEXPORT double double_3_1 = 3.1;
49 DLLEXPORT float float_neg_4_5 = -4.5;
51 /* Test of constant input string */
54 cs_count_upper (char* psz)
69 /* Test of input and output of a string */
72 cs_to_upper (char* psz)
76 *psz = toupper (*psz);
82 /* Test of an output only string */
85 cs_make_random (int size, char* buffer)
88 for (i = 0; i < size; i++)
89 buffer[i] = 'A' + (rand() % 26);
93 /* Test of input/output vector */
96 half_double_vector (int size, double* vec)
99 for (i = 0; i < size; i++)
108 int *x = (int *) malloc(sizeof(int));
117 double *y = (double *) malloc(sizeof(double));
124 return_long_negative_one ()
131 return_int_negative_one ()
138 return_short_negative_one ()
143 DLLEXPORT int fvar_addend = 3;
150 fvar_struct_type fvar_struct = {42, 3.2};
153 int fvar_struct_int () {
154 return (fvar_addend + fvar_struct.i);
158 double fvar_struct_double () {
159 return fvar_struct.d;