comparison python/pydc/pydcext.c @ 35:75fe1dec0eb4

- added support for signature-based calling convention switch
author Tassilo Philipp
date Mon, 13 Apr 2020 16:07:56 +0200
parents 2682a627168c
children b84064293541
comparison
equal deleted inserted replaced
34:2682a627168c 35:75fe1dec0eb4
205 205
206 ++pos; // incr here, code below uses it as 1-based argument index for error strings 206 ++pos; // incr here, code below uses it as 1-based argument index for error strings
207 207
208 switch(ch) 208 switch(ch)
209 { 209 {
210 case DC_SIGCHAR_CC_PREFIX:
211 {
212 if(*(ptr+1) != '\0')
213 {
214 // @@@ this is easily going out of sync with dyncall, abstract this sigchar->mode lookup somewhere inside dyncall
215 switch(*++ptr) {
216 case DC_SIGCHAR_CC_DEFAULT: dcMode(gpCall, DC_CALL_C_DEFAULT ); break;
217 case DC_SIGCHAR_CC_ELLIPSIS: dcMode(gpCall, DC_CALL_C_ELLIPSIS ); break;
218 case DC_SIGCHAR_CC_ELLIPSIS_VARARGS: dcMode(gpCall, DC_CALL_C_ELLIPSIS_VARARGS ); break;
219 case DC_SIGCHAR_CC_CDECL: dcMode(gpCall, DC_CALL_C_X86_CDECL ); break;
220 case DC_SIGCHAR_CC_STDCALL: dcMode(gpCall, DC_CALL_C_X86_WIN32_STD ); break;
221 case DC_SIGCHAR_CC_FASTCALL_MS: dcMode(gpCall, DC_CALL_C_X86_WIN32_FAST_MS ); break;
222 case DC_SIGCHAR_CC_FASTCALL_GNU: dcMode(gpCall, DC_CALL_C_X86_WIN32_FAST_GNU); break;
223 case DC_SIGCHAR_CC_THISCALL_MS: dcMode(gpCall, DC_CALL_C_X86_WIN32_THIS_MS ); break;
224 case DC_SIGCHAR_CC_THISCALL_GNU: dcMode(gpCall, DC_CALL_C_X86_WIN32_THIS_GNU); break;
225 case DC_SIGCHAR_CC_ARM_ARM: dcMode(gpCall, DC_CALL_C_ARM_ARM ); break;
226 case DC_SIGCHAR_CC_ARM_THUMB: dcMode(gpCall, DC_CALL_C_ARM_THUMB ); break;
227 case DC_SIGCHAR_CC_SYSCALL: dcMode(gpCall, DC_CALL_SYS_DEFAULT ); break;
228 }
229 }
230 }
231 break;
232
210 case DC_SIGCHAR_BOOL: 233 case DC_SIGCHAR_BOOL:
211 if ( !PyBool_Check(po) ) 234 if ( !PyBool_Check(po) )
212 return PyErr_Format( PyExc_RuntimeError, "arg %d - expecting a bool", pos ); 235 return PyErr_Format( PyExc_RuntimeError, "arg %d - expecting a bool", pos );
213 dcArgBool(gpCall, (Py_True == po) ? DC_TRUE : DC_FALSE); 236 dcArgBool(gpCall, (Py_True == po) ? DC_TRUE : DC_FALSE);
214 break; 237 break;