annotate shell/shdc/shdc.c @ 53:6387d39ecce2

- version bumps
author Tassilo Philipp
date Fri, 22 Jan 2021 15:18:56 +0100
parents 1d50532dce12
children
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>
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
27 #include <string.h>
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 #include <stdlib.h> /* needed on some platforms to make atof work _at_runtime_ */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29
53
6387d39ecce2 - version bumps
Tassilo Philipp
parents: 40
diff changeset
30 #define SHDC_VERSION "1.2"
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 void usage(const char* s)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 printf(
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 "Usage: %s -l SO\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 " %s -c SO SYM SIG [ARGS]\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 " %s -v\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 " where SO is the name of the shared object.\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 "\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 " -l lists all symbol names in the shared object\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 " -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
43 " SIG the symbol's type signature, and ARGS the arguments.\n"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 " -v displays the binding's version\n",
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 s, s, s
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
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 int main(int argc, char* argv[])
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 const char* libPath;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 const char* symName;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 const DCsigchar* sig;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 const DCsigchar* i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 void* sym;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 DCCallVM* vm;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 DLLib* dlLib;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 DLSyms* dlSyms;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 int c, l;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 if(argc == 2 && strcmp(argv[1], "-v") == 0) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 printf(SHDC_VERSION"\n");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 return 0;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 /* Parse arguments and check validity. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 /* 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
69 if(argc < 2) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 c = strcmp(argv[1], "-c");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 l = strcmp(argv[1], "-l");
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 if((c != 0 && l != 0) || (c == 0 && argc < 4)) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
81 /* if lib path is empty string, use NULL as reference to own process/exe */
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
82 libPath = argv[2][0] == '\0' ? NULL : argv[2];
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 /* List symbols, if 'ls', else it must be 'call', so proceed to call. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 if(l == 0) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 dlSyms = dlSymsInit(libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 if(!dlSyms) {
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
88 printf("Can't load \"%s\".\n", libPath?libPath:"<NULL>");
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 /* hacky: reuse c and l */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 for(c=dlSymsCount(dlSyms), l=0; l<c; ++l)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 printf("%s\n", dlSymsName(dlSyms, l));
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 dlSymsCleanup(dlSyms);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 else {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100 /* Check if number of arguments matches sigstring spec. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 /*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
102
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 /* Load library and get a pointer to the symbol to call. */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 dlLib = dlLoadLibrary(libPath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 if(!dlLib) {
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
106 printf("Can't load \"%s\".\n", libPath?libPath:"<NULL>");
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 usage(argv[0]);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 return 1;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 symName = argv[3];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112 sig = i = argv[4];
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
113
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 sym = dlFindSymbol(dlLib, symName);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 if(!sym) {
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
116 /* this might be a syscall attempt, check if "symbol" is numeric */
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
117 int n;
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
118 if(sscanf(symName, "%d", &n) == 0) {
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
119 printf("Can't find symbol \"%s\".\n", symName);
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
120 dlFreeLibrary(dlLib);
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
121 usage(argv[0]);
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
122 return 1;
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
123 }
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
124 sym = (void*)(size_t)n;
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
126
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
127
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 vm = dcNewCallVM(4096/*@@@*/);/*@@@ error checking */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
129 dcReset(vm);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
130
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
131 while(*i != '\0' && *i != DC_SIGCHAR_ENDARG) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
132 switch(*i) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
133 case DC_SIGCHAR_CC_PREFIX:
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
134 if(*(i+1) != '\0')
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
135 {
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
136 DCint mode = dcGetModeFromCCSigChar(*++i);
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
137 if(mode != DC_ERROR_UNSUPPORTED_MODE)
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
138 dcMode(vm, mode);
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
139 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
140 sig += 2;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
141 break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
142
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
143 case DC_SIGCHAR_BOOL: dcArgBool (vm, (DCbool) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
144 case DC_SIGCHAR_CHAR: dcArgChar (vm, (DCchar) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
145 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
146 case DC_SIGCHAR_SHORT: dcArgShort (vm, (DCshort) atoi (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 case DC_SIGCHAR_FLOAT: dcArgFloat (vm, (DCfloat) atof (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155 case DC_SIGCHAR_DOUBLE: dcArgDouble (vm, (DCdouble) atof (argv[5+i-sig] )); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 case DC_SIGCHAR_POINTER: dcArgPointer (vm, (DCpointer) argv[5+i-sig] ); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
157 case DC_SIGCHAR_STRING: dcArgPointer (vm, (DCpointer) argv[5+i-sig] ); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
158 }
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
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
162 if(*i == DC_SIGCHAR_ENDARG)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
163 ++i;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 switch(*i) {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
166 case '\0':
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167 case DC_SIGCHAR_VOID: dcCallVoid (vm,sym) ; break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 case DC_SIGCHAR_BOOL: printf("%d\n", dcCallBool (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169 case DC_SIGCHAR_CHAR: printf("%d\n", dcCallChar (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
170 case DC_SIGCHAR_UCHAR: printf("%d\n", dcCallChar (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171 case DC_SIGCHAR_SHORT: printf("%d\n", dcCallShort (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
172 case DC_SIGCHAR_USHORT: printf("%d\n", dcCallShort (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173 case DC_SIGCHAR_INT: printf("%d\n", dcCallInt (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
174 case DC_SIGCHAR_UINT: printf("%d\n", dcCallInt (vm,sym)); break;
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
175 case DC_SIGCHAR_LONG: printf("%ld\n", dcCallLong (vm,sym)); break;
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
176 case DC_SIGCHAR_ULONG: printf("%ld\n", dcCallLong (vm,sym)); break;
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177 case DC_SIGCHAR_LONGLONG: printf("%lld\n", dcCallLongLong(vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178 case DC_SIGCHAR_ULONGLONG: printf("%lld\n", dcCallLongLong(vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
179 case DC_SIGCHAR_FLOAT: printf("%g\n", dcCallFloat (vm,sym)); break;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
180 case DC_SIGCHAR_DOUBLE: printf("%g\n", dcCallDouble (vm,sym)); break;
40
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
181 case DC_SIGCHAR_POINTER: printf("%p\n", dcCallPointer (vm,sym)); break;
1d50532dce12 - added syscall support to shdc
Tassilo Philipp
parents: 39
diff changeset
182 case DC_SIGCHAR_STRING: printf("%s", dcCallPointer (vm,sym)); break;
0
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 dlFreeLibrary(dlLib);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 dcFree(vm);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
188
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
189 return 0;
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
190 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
191