473,770 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

the C language lack for keyboard input functions


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[b]; !>=?#.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[b]; !>=?#.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:
> @buf, @sz, @file
b, c, r, j, k, k
ret 12
// se ritorna 1=valore preso in val
// altrimenti valore non preso
int
get_double(doub le* 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<m in||*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(is tr.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(is tr.f);}while(c! =EOF && c!='\n');
return 1;
}
Sep 13 '06 #1
10 1967
"a\\/b" <al@f.gwrites :
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 <av@ala.a>", 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.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 13 '06 #2
On Wed, 13 Sep 2006 21:06:03 +0200, a\/b wrote:

>int
get_double(dou ble* 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
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga"); goto la2;
}

Sep 13 '06 #3
On Wed, 13 Sep 2006 19:53:13 GMT, Keith Thompson wrote:
>"a\\/b" <al@f.gwrites :
>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 <av@ala.a>", also known as
"RoSsIaCrIiLoI A", 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 ...
>Or better yet, stop posting assembly language in comp.lang.c.
Sep 13 '06 #4
"a\\/b" <al@f.gwrites :
On Wed, 13 Sep 2006 19:53:13 GMT, Keith Thompson wrote:
[...]
>>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 ...
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?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 13 '06 #5
a\/b wrote:
>
On Wed, 13 Sep 2006 19:53:13 GMT, Keith Thompson wrote:
"a\\/b" <al@f.gwrites :
adc eax, 0
ret
[274 lines deleted]

You're the same person as "av <av@ala.a>", also known as
"RoSsIaCrIiLoIA ", aren't you?

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

it is not "crap"
It is crap.
The votes have been tallied.
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 ...
Or better yet, stop posting assembly language in comp.lang.c.
--
pete
Sep 13 '06 #6
"a\\/b" wrote:
On Wed, 13 Sep 2006 19:53:13 GMT, Keith Thompson wrote:
>"a\\/b" <al@f.gwrites :
>>>... snip ...

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

You're the same person as "av <av@ala.a>", also known as
"RoSsIaCrIiLoI A", aren't you?

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

it is not "crap"
PLONK. Never to be seen again.

--
"I have a creative mind. You (singular) are eccentric.
He is insane. We are losing sight of reality.
You (plural) are smoking crack. They are certifiable."
Declension of verbs, per Lewin Edwards

--
Posted via a free Usenet account from http://www.teranews.com

Sep 14 '06 #7
Keith Thompson <ks***@mib.orgw rote:
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.
Keith, I know you take civility seriously, but I don't think this is
anything other than feeding a known troll.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gma il.com | don't, I need to know. Flames welcome.
Sep 14 '06 #8
Christopher Benson-Manica <at***@ukato.fr eeshell.orgwrit es:
Keith Thompson <ks***@mib.orgw rote:
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.

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.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 14 '06 #9
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?

Sep 14 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
5463
by: OrenFlekser | last post by:
Hi I've posted this message couple of days ago, but I can't find it now, so sorry if you see it twice... Anyways - I have a text box, and I want my users to be able to write only in english inside it. I want to prevent the Alt+Shift option of switching to other languages. Thanks alot - Oren
134
8045
by: evolnet.regular | last post by:
I've been utilising C for lots of small and a few medium-sized personal projects over the course of the past decade, and I've realised lately just how little progress it's made since then. I've increasingly been using scripting languages (especially Python and Bourne shell) which offer the same speed and yet are far more simple and safe to use. I can no longer understand why anyone would willingly use C to program anything but the lowest...
7
10691
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it were a keyboard. I need to be able to identify input from the scanner and keyboard independently. I've looked at DirectX.DirectInput, and using user32.dll to hook into the keyboard messages, but neither method seems to allow for identification of...
0
6732
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles. however, everytime I use the readfile function I am getting "object reference not set to an instant...
2
8770
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles. however, everytime I use the readfile function I am getting "object reference not set to an instant...
0
1775
by: Freddy | last post by:
In my Access db (which I have created to help me learn Greek) I am using text box controls on a form. Some of these controls require English input and some require Greek input. Currently I have to keep toggling the keyboard input language bar settings manually from the keyboard whenever I wish to switch languages - this is a real pain. What I would like is for the keyboard language to be changed automatically to the appropriate...
669
26210
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
2
2077
by: pelletier.thomas | last post by:
Hello everybody. I'm trying to code a very little OS. But I have a problem with the keyboard input: It show thechar + "~" :s Can you help me ? The source is there : http://thonix.tuxfamily.org/pub/0.0.1/src/
5
2833
by: =?Utf-8?B?U2llZ2ZyaWVkIEhlaW50emU=?= | last post by:
I need to redundantly write C++ and C# programs to (1) determine the input language (german, french, english...) (2) determine changes in the input language (preferably a delegate rather than polling!) Can anyone guide me to the proper functions to call? Thanks, siegfried
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.