annotate shell/shdc/shdc.c @ 38:9943c30ee2aa

- typo fix
author Tassilo Philipp
date Mon, 13 Apr 2020 21:41:59 +0200
parents 681db37a300c
children b6114d9a9a98
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 Package: dyncall
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 File: bindings/shell.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 Description: printf(1) style function call mechanism
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 License:
1
5e159be89d73 - ruby and sh binding updates for dc r0.9
cslag
parents: 0
diff changeset
6 Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 Tassilo Philipp <tphilipp@potion-studios.com>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 Permission to use, copy, modify, and distribute this software for any
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 purpose with or without fee is hereby granted, provided that the above
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 copyright notice and this permission notice appear in all copies.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 #include "../../dyncall/dyncall/dyncall.h"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 #include "../../dyncall/dynload/dynload.h"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 #include "../../dyncall/dyncall/dyncall_signature.h"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 #include <stdio.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 #include <stdlib.h> /* needed on some platforms to make atof work _at_runtime_ */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28
24
681db37a300c - prep 1.0 release
Tassilo Philipp
parents: 1
diff changeset
29 #define SHDC_VERSION "1.0"
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 void usage(const char* s)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 printf(
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 "Usage: %s -l SO\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 " %s -c SO SYM SIG [ARGS]\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 " %s -v\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 " where SO is the name of the shared object.\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 "\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 " -l lists all symbol names in the shared object\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 " -c calls function in the shared object, where SYM is the symbol name,\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 " SIG the symbol's type signature, and ARGS the arguments.\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 " -v displays the binding's version\n",
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 s, s, s
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 );
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 int main(int argc, char* argv[])
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 const char* libPath;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 const char* symName;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 const DCsigchar* sig;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 const DCsigchar* i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 void* sym;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 DCCallVM* vm;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 DLLib* dlLib;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 DLSyms* dlSyms;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 int c, l;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 if(argc == 2 && strcmp(argv[1], "-v") == 0) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 printf(SHDC_VERSION"\n");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 return 0;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 /* Parse arguments and check validity. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 /* Need at least shared object name and action, and symbol name and signature string for call. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 if(argc < 2) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 c = strcmp(argv[1], "-c");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 l = strcmp(argv[1], "-l");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 if((c != 0 && l != 0) || (c == 0 && argc < 4)) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 libPath = argv[2];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 /* List symbols, if 'ls', else it must be 'call', so proceed to call. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 if(l == 0) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 dlSyms = dlSymsInit(libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 if(!dlSyms) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 printf("Can't load \"%s\".\n", libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 /* hacky: reuse c and l */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 for(c=dlSymsCount(dlSyms), l=0; l<c; ++l)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 printf("%s\n", dlSymsName(dlSyms, l));
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 dlSymsCleanup(dlSyms);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 else {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 /* Check if number of arguments matches sigstring spec. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100 /*if(n != argc-4)@@@*/ /* 0 is prog, 1 is flag, 2 is lib, 3 is symbol name, 4 is sig */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 /* Load library and get a pointer to the symbol to call. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 dlLib = dlLoadLibrary(libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 if(!dlLib) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 printf("Can't load \"%s\".\n", libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 symName = argv[3];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 sig = i = argv[4];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
113 sym = dlFindSymbol(dlLib, symName);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 if(!sym) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 printf("Can't find symbol \"%s\".\n", symName);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
116 dlFreeLibrary(dlLib);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
117 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
118 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
119 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
120
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
121
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122 vm = dcNewCallVM(4096/*@@@*/);/*@@@ error checking */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
123 dcReset(vm);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
124
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 while(*i != '\0' && *i != DC_SIGCHAR_ENDARG) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
126 switch(*i) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
127 case DC_SIGCHAR_CC_PREFIX:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 switch(*++i) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
129 case DC_SIGCHAR_CC_ELLIPSIS: dcMode(vm, DC_CALL_C_ELLIPSIS); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
130 case DC_SIGCHAR_CC_STDCALL: dcMode(vm, DC_CALL_C_X86_WIN32_STD); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
131 case DC_SIGCHAR_CC_FASTCALL_GNU: dcMode(vm, DC_CALL_C_X86_WIN32_FAST_GNU); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
132 case DC_SIGCHAR_CC_FASTCALL_MS: dcMode(vm, DC_CALL_C_X86_WIN32_FAST_MS); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
133 case DC_SIGCHAR_CC_THISCALL_MS: dcMode(vm, DC_CALL_C_X86_WIN32_THIS_MS); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
134 /* @@@ extend with other modes when they become available */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
135 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
136 sig += 2;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
137 break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
138
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
139 case DC_SIGCHAR_BOOL: dcArgBool (vm, (DCbool) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
140 case DC_SIGCHAR_CHAR: dcArgChar (vm, (DCchar) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
141 case DC_SIGCHAR_UCHAR: dcArgChar (vm, (DCchar)(DCuchar) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
142 case DC_SIGCHAR_SHORT: dcArgShort (vm, (DCshort) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
143 case DC_SIGCHAR_USHORT: dcArgShort (vm, (DCshort)(DCushort)atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
144 case DC_SIGCHAR_INT: dcArgInt (vm, (DCint) strtol (argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
145 case DC_SIGCHAR_UINT: dcArgInt (vm, (DCint)(DCuint) strtoul (argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
146 case DC_SIGCHAR_LONG: dcArgLong (vm, (DClong) strtol (argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
147 case DC_SIGCHAR_ULONG: dcArgLong (vm, (DCulong) strtoul (argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
148 case DC_SIGCHAR_LONGLONG: dcArgLongLong(vm, (DClonglong) strtoll (argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
149 case DC_SIGCHAR_ULONGLONG: dcArgLongLong(vm, (DCulonglong) strtoull(argv[5+i-sig],NULL,10)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
150 case DC_SIGCHAR_FLOAT: dcArgFloat (vm, (DCfloat) atof (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
151 case DC_SIGCHAR_DOUBLE: dcArgDouble (vm, (DCdouble) atof (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
152 case DC_SIGCHAR_POINTER: dcArgPointer (vm, (DCpointer) argv[5+i-sig] ); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
153 case DC_SIGCHAR_STRING: dcArgPointer (vm, (DCpointer) argv[5+i-sig] ); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
154 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155 ++i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
157
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
158 if(*i == DC_SIGCHAR_ENDARG)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
159 ++i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
160
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
161 switch(*i) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
162 case '\0':
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
163 case DC_SIGCHAR_VOID: dcCallVoid (vm,sym) ; break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164 case DC_SIGCHAR_BOOL: printf("%d\n", dcCallBool (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 case DC_SIGCHAR_CHAR: printf("%d\n", dcCallChar (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
166 case DC_SIGCHAR_UCHAR: printf("%d\n", dcCallChar (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167 case DC_SIGCHAR_SHORT: printf("%d\n", dcCallShort (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 case DC_SIGCHAR_USHORT: printf("%d\n", dcCallShort (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169 case DC_SIGCHAR_INT: printf("%d\n", dcCallInt (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
170 case DC_SIGCHAR_UINT: printf("%d\n", dcCallInt (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171 case DC_SIGCHAR_LONG: printf("%d\n", dcCallLong (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
172 case DC_SIGCHAR_ULONG: printf("%d\n", dcCallLong (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173 case DC_SIGCHAR_LONGLONG: printf("%lld\n", dcCallLongLong(vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
174 case DC_SIGCHAR_ULONGLONG: printf("%lld\n", dcCallLongLong(vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
175 case DC_SIGCHAR_FLOAT: printf("%g\n", dcCallFloat (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
176 case DC_SIGCHAR_DOUBLE: printf("%g\n", dcCallDouble (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177 case DC_SIGCHAR_POINTER: printf("%x\n", dcCallPointer (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178 case DC_SIGCHAR_STRING: printf( dcCallPointer (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
179 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
180
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
181 dlFreeLibrary(dlLib);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
182 dcFree(vm);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
183 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
184
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
185 return 0;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187