Re: a propose for a suppose far better sscanf in assembly



On Fri, 26 Jan 2007 21:48:26 +0100, "¬a\\/b" <al@xxx> wrote:
StrToUns:
push ebx
push ecx
push edx
push esi
%define @string [esp+20]
%define @pos [esp+24]
%define @base [esp+28]
.in:
mov esi, @string
cmp esi, 0
je .ce
xor ebx, ebx
mov ecx, @base

.ca:
stc
.cf:
%undef @string
%undef @pos

here should be
%undef @base

pop esi
pop edx
pop ecx
pop ebx
ret 12


StrToInt:
push ebx
push ecx
push edx
push esi
push ebp
%define @string [esp+24]
%define @pos [esp+28]
%define @base [esp+32]
.in:
mov esi, @string
cmp esi, 0
je .ce
xor ebx, ebx
mov ecx, @base

stc
.cf:
%undef @string
%undef @pos

here should be
%undef @base

pop ebp
pop esi
pop edx
pop ecx
pop ebx
ret 12

; int _sscan_m<(char** ove, char* input, char* fmt, ...)

so interest no one of you to do a safe sscanf?

i until now not have use it much so it will be full of errors...

but if the name of one string is the string itself i can write
somethig like

a1 dd 0, 0
int1 dd 0, 0
int2 dd 0, 0
"%d %d" db "%d %d", 0

_sscan<(a1, input_string, "%d %d", int1, int2); a<0#.error;

is it not easy?
.



Relevant Pages