2 ; int sscanf (const char* str, const char* format, ...);
4 ; Ullrich von Bassewitz, 2004-11-28
8 .import addysp, decsp4, _vsscanf
13 ; ----------------------------------------------------------------------------
18 ParamSize: .res 1 ; Number of parameter bytes
20 ; ----------------------------------------------------------------------------
22 ; int sscanf (const char* str, const char* format, ...)
23 ; /* Standard C function */
27 ; /* Setup for variable arguments */
28 ; va_start (ap, format);
30 ; /* Call vsscanf(). Since we know that va_end won't do anything, we will
31 ; * save the call and return the value directly.
33 ; return vsscanf (str, format, ap);
40 sty ParamSize ; Number of param bytes passed in Y
42 ; We have to push buf and format, both in the order they already have on stack.
43 ; To make this somewhat more efficient, we will create space on the stack and
44 ; then do a copy of the complete block instead of pushing each parameter
45 ; separately. Since the size of the arguments passed is the same as the size
46 ; of the fixed arguments, this will allow us to calculate the pointer to the
47 ; fixed size arguments easier (they're just ParamSize bytes away).
51 ; Calculate a pointer to the fixed parameters
61 ; Now copy both, str and format
69 ; Load va_list (last and __fastcall__ parameter to vsscanf)
78 ; Cleanup the stack. We will return what we got from vsscanf