00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <alloca.h>
00004 #include <math.h>
00005
00006 #include "cinterf.h"
00007
00008
00009
00010
00011
00012
00013 DllExport int call_conv change_char(CTXTdecl)
00014 {
00015 char *str_in;
00016 int pos;
00017 char *c, *str_out;
00018
00019 str_in = (char *) extern_ptoc_string(1);
00020 str_out = (char *) alloca(strlen(str_in)+1);
00021 strcpy(str_out, str_in);
00022 pos = extern_ptoc_int(2);
00023 c = (char *) extern_ptoc_string(3);
00024 str_out[pos-1] = c[0];
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 extern_ctop_string(CTXTc 4, str_out);
00036
00037 return TRUE;
00038 }
00039
00040 int my_sqrt(CTXTdecl)
00041 {
00042 int i = ptoc_int(1);
00043
00044 extern_ctop_float(2, (float) pow((double)i, 0.5));
00045 return TRUE;
00046 }
00047
00048 DllExport int call_conv minus_one(CTXTdecl)
00049 {
00050 int i = extern_ptoc_int(1);
00051 extern_ctop_int(2,i-1);
00052 return TRUE;
00053 }
00054