the C language lack for keyboard input functions

¬

¬a\\/b

Careful thought library functions are important
i think that for tame (domare) the input stream are useful
function like these i use.
i don't know if they are right

Note: when ask input: is need a range for validate that
(for at last integers, float and double)

; int cf(void);
_cf:
mov eax, 0
adc eax, 0
ret

/* int __stdcall getl_m(void* buf, int sz, FILE_m* file);
/* legge da "file" una linea di al massimo sz-1 chars
/* (ove sz è la size di buf)
/* e la mette nel buffer buf la termina con '\0'
/* se errori di parametro ritorna 0 CF=0
/* se i caratteri della linea
/* eccedono i sz-1 chars ritorna -(lunghezza
/* della stringa) e continua a leggere dal file fino a che trova '\n'
/* altrimenti ritorna la lunghezza della stringa
/* se incontra EOF CF=1 altrimenti CF=0
/* s= 0k, 4k, 8j, 12r, 16c, 20b, 24ra, 28P_buf, 32P_siz, 36P_file
getl_m:
push ebx
push ecx
push edx
push edi
push ebp
push ebp
%define @buf [esp+28]
%define @sz [esp+32]
%define @file [esp+36]
mov ebx, @file
mov ebp, @sz
mov edi, @buf
xor eax, eax
cmp ebp, 0
jle .c0
mov [esp], ebx
cmp edi, 0
je .c0
cmp ebp, 1
je .c4
mov byte[edi], 0 ;/ k=2; --k=1
cmp ebx, 0
je .c0
jmp short .c3
..c0:
clc
jmp .c7
..c2:
mov eax, edi
mov byte[edi], 0
sub eax, @buf
stc
jmp .c7
..b0:
inc edi
..c3:
dec dword[ebx]
jl .a0
mov edx, [ebx+4]
mov al, [edx]
inc edx
mov [ebx+4], edx
jmp short .a1
..a0:
call __fillbuf_m
cmp eax, -1
je .c2
..a1:
mov [edi], al
dec ebp
jz .c4
cmp al, 10
jne .b0

inc edi
mov eax, edi
mov byte[edi], 0
sub eax, @buf
clc
jmp short .c7
..c4:
mov byte[edi], 0
..c5:
dec dword[ebx]
jl .a2
mov edx, [ebx+4]
mov al, [edx]
inc edx
mov [ebx+4], edx
jmp short .a3
..a2:
call __fillbuf_m
cmp eax, -1
je .c6
..a3: ;/ arriva fino a '\n'
cmp al, 10
jne .c5

mov eax, @buf ;/ risposta negativa
sub eax, edi
clc
jmp short .c7
..c6:
mov eax, @buf
sub eax, edi
stc
..c7:
%undef @buf
%undef @sz
%undef @file
pop ebp
pop ebp
pop edi
pop edx
pop ecx
pop ebx
ret 12


/* int cf(void);
_cf: a=0; a++=0; ret


getl_m:
< b, c, r, j, k, k
<< @buf=[s+28], @sz=[s+32], @file=[s+36]
b=@file; k=@sz; j=@buf; a^=a;
k<=0?#.c0; *s=b; j==0#.c0; k==1#.c4;
B*j=0; b==0#.c0; #.c3; // k=2; --k=1
..c0: clc; ##.c7;
..c2: a=j; B*j=0; a-=@buf; stc; ##.c7;
..b0: { ++j;
..c3: --D; !>=?#.a0| r=[b+4]; al=*r; ++r; [b+4]=r;#.a1;
..a0: __fillbuf_m(); a==-1#.c2;
..a1: *j=al; --k!#.c4; al!=10#.b0;
}
++j; a=j; B*j=0; a-=@buf; clc; #.c7;
..c4: B*j=0;
..c5: {--D; !>=?#.a2| r=[b+4]; al=*r; ++r; [b+4]=r;#.a3;
..a2: __fillbuf_m(); a==-1#.c6;
..a3: al!=10#.c5; // arriva fino a '\n'
}
a=@buf; a-=j; clc; #.c7; // risposta negativa
..c6: a=@buf; a-=j; stc;
..c7:
b, c, r, j, k, k
ret 12


// se ritorna 1=> valore preso in val
// altrimenti valore non preso
int
get_double(double* val, double min, double max, FILE_m* pf)
{char a[512];
int k, i=0, cf1;
la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga"); goto la2;
}
if( (k=sscanf_m(a, "%f", val))!= 1 )
if(cf1==1) goto laa;
if(k!=1||*val<min||*val>max)
{la1:;
printf("Errore o importo fuori range");
la2:;
if(++i>=3) goto laa;
printf(": Riprova > ");
goto la0;
}
return 1;
}

int
get_int(int* val, int min, int max, FILE_m* pf)
{char a[512];
int k, i=0, cf1;

la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga"); goto la2;
}
if( (k=sscanf_m(a, "%i", val))!=1 )
if(cf1==1) goto laa;
if( k!=1 || *val<min || *val>max)
{la1:;
printf("Errore o importo fuori range");
la2:;
if(++i>=3) goto laa;
printf(": Riprova > ");
goto la0;
}
return 1;
}

int
get_uns(uns* val, uns min, uns max, FILE_m* pf)
{char a[512];
int k, i=0, cf1;

la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga"); goto la2;
}
if( (k=sscanf_m(a, "%u", val))!=1 )
if(cf1==1) goto laa;
if( k!=1 || *val<min || *val>max)
{la1:;
printf("Errore o importo fuori range");
la2:;
if(++i>=3) goto laa;
printf(": Riprova > ");
goto la0;
}
return 1;
}


int get_char(char* val, FILE_m* pf)
{char a[512];
int k, i=0, cf1;

la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga"); goto la2;
}
if( (k=sscanf_m(a, "%c", val))!=1 )
if(cf1==1) goto laa;
if( k!=1 )
{la1:;
printf("Errore ");
la2:;
if(++i>=3) goto laa;
printf(": Riprova > ");
goto la0;
}
return 1;
}






// se ritorna 1=> valore preso in val
// altrimenti valore non preso
// non mette in fail lo stream al massimo
// ERR oppure EOF
// se il sistema esterno ha lo stream in FAIL
// non continua
int get(num* val, istream& istr)
{int i=0, c;
num r;

if(istr.f->flag & ( _ERR | _EOF | _FAIL )) return 0;
nuova:;
istr >> r;
if( istr.f->flag & _FAIL )
{ if(istr.f->flag & ( _ERR | _EOF) ) return 0;
do{c=fgetc_m(istr.f);}while(c!=EOF && c!='\n');
if(c==EOF) return 0;
printf("Errore ");
if(++i>=3)
{istr.f->flag &= ~ _FAIL; return 0;}
istr.f->flag &= ~ _FAIL;
printf(": Riprova > "); goto nuova;
}
*val=r;
do{c=fgetc_m(istr.f);}while(c!=EOF && c!='\n');
return 1;
}
 
K

Keith Thompson

¬a\\/b said:
Careful thought library functions are important
i think that for tame (domare) the input stream are useful
function like these i use.
i don't know if they are right

Note: when ask input: is need a range for validate that
(for at last integers, float and double)

; int cf(void);
_cf:
mov eax, 0
adc eax, 0
ret
[274 lines deleted]

You're the same person as "av <[email protected]>", also known as
"RoSsIaCrIiLoIA", aren't you?

If you're going to insist on posting this crap here, please at least
have the simple courtesy to use a consistent name so those who don't
want to read it can killfile you properly.

Or better yet, stop posting assembly language in comp.lang.c.
 
¬

¬a\\/b

int
get_double(double* val, double min, double max, FILE_m* pf)
{char a[512];
int k, i=0, cf1;
la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)

perhaps better
if(k<=0)
the same for others
 
¬

¬a\\/b

¬a\\/b said:
Careful thought library functions are important
i think that for tame (domare) the input stream are useful
function like these i use.
i don't know if they are right

Note: when ask input: is need a range for validate that
(for at last integers, float and double)

; int cf(void);
_cf:
mov eax, 0
adc eax, 0
ret
[274 lines deleted]

You're the same person as "av <[email protected]>", also known as
"RoSsIaCrIiLoIA", aren't you?

If you're going to insist on posting this crap here,

it is not "crap"
please at least
have the simple courtesy to use a consistent name so those who don't
want to read it can killfile you properly.

if you don't like to read: don't read ...
 
K

Keith Thompson

¬a\\/b said:
if you don't like to read: don't read ...

You could make that easier for a lot of people by posting under a
consistent name.

Are you trying to force people who've chosen not to read your articles
to read them anyway, or to do more work to avoid it? Why?
 
C

Christopher Benson-Manica

You could make that easier for a lot of people by posting under a
consistent name.

Keith, I know you take civility seriously, but I don't think this is
anything other than feeding a known troll.
 
K

Keith Thompson

Christopher Benson-Manica said:
Keith, I know you take civility seriously, but I don't think this is
anything other than feeding a known troll.

Perhaps, but I had some vague hope that he might at least be willing
to continue his trolling under a consistent name. I thought it was
worth a shot, but I'll give up now.
 
J

Jim Showalter

¬a\/b wrote:

Well, this is the first time I've tried to add someone to my 'killfile'. But
I can't find a 'kill' function in KNode. Closest thing I find is a
'Scoring' menu where I set this jerk to -100, but I still can see the
article.

Suggestions?
 
G

Guest

Jim said:
a\/b wrote:

Well, this is the first time I've tried to add someone to my 'killfile'. But
I can't find a 'kill' function in KNode. Closest thing I find is a
'Scoring' menu where I set this jerk to -100, but I still can see the
article.

Suggestions?

Adjust your filters to only show posts with nonnegative scores. See
also http://bugs.kde.org/show_bug.cgi?id=59246

(Sorry for the OT.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top