--------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200028 Date: 03/18/98 From: NAVIN PAI Time: 02:00am \/To: ALL (Read 2 times) Subj: Cryptic Programming hello everyone, has anybody heard of cryptic programming in C????????? let me know. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * Shouldn't C++ have been called D?! --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200029 Date: 03/18/98 From: NAVIN PAI Time: 02:41am \/To: ANTHONY TIBBS (Read 2 times) Subj: Soln: Pascal <-> C/C++ On 03-14-98 12:30, Anthony Tibbs & All were talking about Pascal <-> C/C++ hello Anthony, AT>Is there any easy way to combine C/C++ .OBJ files with TP7 .TPU files AT>to produce an executable? yes. it is possible. this style of programming is called as mixed language programming. AT>If so, which language has to have the "main" program in it, etc.? Can AT>they share variables? following code will satisfy ur needs. program 1: the file conatining the functions to be called from pascal rogram. compile this program in C to generate shared.obj. NOTE: before compilation take care that the Standard stack frame and Test stack overflow, options should be turned Off. u can access them from the main menu, Option/Compiler/Code generation. /* filename: shared.c * * author : navin pai */ int sharedFunc(int i) { return i - 10; } /* eof: shared.c */ program 2: the calling program in pascal. (* filename: shared.pas * * author : navin pai *) {$L shared.obj} (* give full path name if the file is not in current dir *) program shared; function _sharedFunc(ii:integer):integer; external; (* add '_'. necessary. since C adds an '_' by default *) var i: integer; begin write('Enter a number: '); readln(i); i := _sharedFunc(i); writeln('Number minus ten equals: ',i ); end. { eof: shared.pas } this should solve ur problem. if u have any doubt regarding it, u can always count on me. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * This tagline stolen by Silly Little Mail Reader! --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200030 Date: 03/18/98 From: NAVIN PAI Time: 08:27am \/To: ALL (Read 2 times) Subj: The obfuscated C code hello everybody, have u heard of The Obfuscated C code contest. here is one of the entry from this contest. this code in C is a piglatin generator. Selected notes from the author: Istha ogrampra akesta Englishwa extta aswa inputwa andwa anslatestra itwa intowa Igpa Atinla. The obfuscation is on several levels. Most obviously, the shape of the program. Underneath that, the variable names are in pig latin, as are the names of the standard C functions, such as putchar. Even main is written as ainma. The program construction is also very obfuscated, with all of the code being inside the ()'s of one of the 6 "orfa" loops. the code........ /* start of program */ #define X #define XX #define XXX #define XXXX #define XXXXX #define XXXXXX #define XXXXXXX #define orfa for #define XXXXXXXXX #define archa char #define ainma main #define etcharga getchar #define utcharpa putchar X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XX X X XX X X XXX X XXXXXXXXX X XXX X X XXX X XXXX XXXX X XXX X X XXXX X XX ainma(){ archa XX X XXXX X X XXXX X oink[9],*igpa, X XXXX X X XXXXXX atinla=etcharga(),iocccwa XXXXXX X X XXXX ,apca='A',owla='a',umna=26 XXXX X X XXX ; orfa(; (atinla+1)&&(!((( XXX X X XX atinla-apca)*(apca+umna-atinla) XX X X X >=0)+((atinla-owla)*(owla+umna- X X X atinla)>=0))); utcharpa(atinla), X X X atinla=etcharga()); orfa(; atinla+1; X X X X ){ orfa( igpa=oink ,iocccwa=( X X X X (atinla- XXX apca)*( XXX apca+umna- X X X atinla)>=0) XXX XXX ; (((( X X atinla-apca XXXXX XXXXXXX XXXXX )*(apca+ X X umna-atinla XXXXXX )>=0) XXXXXX +((atinla- X X owla)*(owla+ XXXX umna- XXXX atinla)>=0)) X X &&"-Pig-" XX "Lat-in" XX "COb-fus" X X "ca-tion!!"[ X (((atinla- X apca)*(apca+ X X umna-atinla) X >=0)?atinla- X apca+owla: X X atinla)-owla X ]-'-')||((igpa== X oink)&&!(*( X X igpa++)='w') X )||! X (*( X igpa X ++)=owla); * X X (igpa++)=(( X ( XXX XXX X atinla-apca X X )*(apca+ X umna XXX - XXX X atinla)>=0) X X ?atinla- X apca XXX + XXX owla X :atinla), X X atinla= X X X X etcharga()) X X ; orfa( X atinla=iocccwa?(( X (atinla- X X owla)*(owla+ X umna-atinla)>=0 X )?atinla- X X owla+apca: X atinla): X atinla; ((( X X atinla-apca)* X (apca+umna- X atinla)>=0)+( X X (atinla-owla)* X (owla+ X umna-atinla)>= X X 0)); utcharpa( XX XX atinla),atinla X X =etcharga()); XXXXXXX orfa(*igpa=0, X X igpa=oink; * igpa; utcharpa( X X *(igpa++))); orfa(; (atinla+1)&&(!((( X X atinla-apca )*(apca+ X X umna- XXXXX XXXXX atinla)>=0 X X )+(( XXXXX atinla- X XX owla)*( owla+umna- XX XX atinla)>=0))); utcharpa XX XX (atinla),atinla= XX XX etcharga()); } XX XXXX } XXXX XXXXXXXXX /* end of program */ so enjoy obfuscating . . . .. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India ___ * PW * Virus check complete. All viruses functioning normally. --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200031 Date: 03/18/98 From: NAVIN PAI Time: 11:25pm \/To: JOHN RICHARDSON (Read 2 times) Subj: what's happening On 03-14-98 11:52, John Richardson & Navin Pai were talking about what's happening JR>Hi Navin, hi john, > to represent a binary no in c there is no other way than to convert > into a hexadecimal no and then represent it using hexadecimal > notation. JR>Something then that they should reconsider in the new standard. no need to... > even if ur representation is considered to be hypothetically correct > the contents of var1 and var2 would be same i.e. 4095. to get the > values of -32767 and 65535 u should add four more one's, to get, in > 16bits. now it's just 12 bits. JR>I'll learn to count one day. Honest mistake guv. :) that'll help others.u see. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India e-mail: painn@bom4.vsnl.net.in ___ * PW * Nothing is so smiple that it can't get screwed up. --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200032 Date: 03/18/98 From: NAVIN PAI Time: 11:43pm \/To: SIMON LAW (Read 2 times) Subj: Re: Has anyone? Simon Law & Navin Pai were gossiping about Re: Has anyone? hi Simon, SL> What happens there, as opposed to any other language, such SL>as C, is that Java takes your Java code, and then compresses it into SL>a "shorthand" Java. Then, when you want to run it on the other side, SL>the computer takes the code and interprets or pre-compiles it. rather pseudo-compiles it... am i right. SL> So you see, it's just like taking C code in pure text and SL>taking it to another compiler, only it's automated it for you. is there any pseudo compiler for C. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India e-mail: painn@bom4.vsnl.net.in ___ * PW * Windows not found. Use Real Operating System (Y/y)? _ --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200033 Date: 03/22/98 From: NAVIN PAI Time: 04:12am \/To: JOHN HAMLIN (Read 2 times) Subj: Has anyone? John Hamlin & Navin Pai were gossiping about Has anyone? JH>Hi Navin! hi john, WG>> Would you like to share the 'how to' part with the rest of us? NP> sure. i'd be glad to. JH> hmmm that sounds cool. May I have a copy too? yup. i kin share the code. but u'll have to wait for some time. NP> after that i wrote a seperate prog in c to transfer the binary ima NP> on to a 1.2mb diskette and the diskette was ready to be used. NP> obviously the diskette has to be changed every three months. JH> why? don't understand that bit? it's very simple. if not changed every three month, there would be no space in diskette to store any further records. 3 mon was just a rough estimate. infact the prog itself notifies when 80pc of the disk space get used up. NP> too confusing isn't it. well it took me almost 3 week to write su NP> prog. if there's anything more u want to know i'd be glad to help JH> wow. I have fiddled with bootsector code before, but never tried real JH> I will be using any code ya send me, to write a dos, lilo equivilant. JH> lilo, if ya dont know is a GNU C Linux boot manager. Ya can select whi JH> os to boot from any Hd on ya system. It can also boot images of hd's JH> I think these eed to be on a linux partion. I could just steel the or JH> code, and recomplie it, but thats cheating.! i had linux installed on my system a few months ago. but then i uninstalled it, since i couldn't manage to get enough s/w for my needs. abt linux loader(lilo), it was the best thing avail. using my code u'll have a tough time trying to write a dolo. dolo!!!!!????? a dos loader. since my prog is hard coded to run only on floppy disks and that too on 1.2mb olny , there was no need to store any information in boot sector. the boot sector of my floppy contains only codes, and it's totally incompatible with dos progs. if ur going to try dolo on a hardisk ur risking u info contents in ur disk. be careful. backup the bootsector first before proceeding. also u'll have to fiddle up with partition table to get the bootsectors of other partitions. bye, |\ |_ | \ | | * | \|~|\/||\|, Nagpur, India e-mail: painn@bom4.vsnl.net.in ___ * PW * Windows not found. Use Real Operating System (Y/y)? _ --- Maximus/2 3.01 * Origin: Kalptaru Net India. http://www.kalptaru.com . (6:606/31) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200034 Date: 03/30/98 From: DARIN MCBRIDE Time: 08:57am \/To: DAVID VAN HOOSE (Read 2 times) Subj: Re: -getch() -> -getch() is simply getch with the return value negated. DVH> In this case you might be right, but why would you want to?? To differentiate between normal keys and extended keys. c = getch(); if (0 == c) /* extended key */ c = -getch(); /* get the second byte of the keycode here */ Otherwise, some extended keycodes would look like "normal" keys. DVH> cprintf() is not borland specific. It is in _ALL_ C libraries. DVH> MS-VC++, BC++ 4.0, BC/2 2.0, and the GCC C/C++ compiler. Nope. Not in _my_ gcc compiler. (I use EMX) It is NOT standard C, it is a somewhat common extention. DVH> The only time getch() works with printf() is when you are _using_ DVH> a Borland compiler. I have all the known C compilers for OS/2 and DOS. Try EMX 0.9c -> gcc 2.7.2.1 It isn't there. --- * Origin: Tanktalus' Tower BBS (1:250/102) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200035 Date: 03/30/98 From: ROGER SCUDDER Time: 05:46pm \/To: DAVID VAN HOOSE (Read 2 times) Subj: Re: -getch() Hello David. 29 Mar 98 13:22, David Van Hoose wrote to Roger Scudder: ->> -getch() is simply getch with the return value negated. DVH> In this case you might be right, but why would you want to?? There are some keys that will return the same value depending on how they are read. For instance upper case 'H' and the UP cursor key. This is a problem when the keys are read with getch like this... key = getch( ); /* read a key press directly */ if ( key == 0 ) /* 0 return so read again for value */ key = getch( ); /* gets value but it's not unique */ To correct the problem one needs to mask the scan code value in some way. There are many different ways to do it. Negation is a simple and clear way. key = getch( ); /* read a key press directly */ if ( key == 0 ) /* 0 return so read again for value */ key = -getch( ); /* gets value and apply the mask */ Now I can tell the difference between 'H' and UP cursor... #define KEY_H_UPPER 72 ... ... #define KEY_UP_CURSOR -72 ... DVH> cprintf() is not borland specific. It is in _ALL_ C libraries. DVH> MS-VC++, BC++ 4.0, BC/2 2.0, and the GCC C/C++ compiler. I don't want to argue with you, but that's far from _ALL_ C libraries. I guess I'm wrong about cprintf being Borland specific, but it definitely is not part of the ANSI standard. DVH> The only time getch() works with printf() is when you are _using_ DVH> a Borland compiler. That all depends on how the functions are used. I think you need to be more specific about what you mean by "not work" and "getch()". As I wrote to you: ->> getch() is, or at least originated as, an implementation of DOS ->> service 07h, DIRECT CHARACTER INPUT WITHOUT ECHO. The key word here being "DIRECT". DVH> I have all the known C compilers for OS/2 and DOS. Really? All known, huh? Very impressive, indeed. -Roger -Roger --- Msged/386 4.20 beta 3kl3 * Origin: Box Of Rotting Corpses BBS, Upper Darby, PA, USA (1:273/404@fidonet) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200036 Date: 03/30/98 From: ROGER SCUDDER Time: 06:42pm \/To: RUSS WUERTZ (Read 2 times) Subj: Re: -getch() Hello Russ. 28 Mar 98 06:01, Russ Wuertz wrote to David Van Hoose: RW> How can I use ANSI using getch(). It does not funnel the output RW> through sdout like getchar. Look at the stuff in Snippets. Tom Torfs has a file in there that defines functions that use ansi escape codes. A problem may come in with the direct screen writes. I'm sure that it can be done, though. RW> Problem is that I would like to decode ANSI symbols. cprintf does not RW> do that. Only getchar(x,stdout) does. You're mixing up input with output. Right cprintf uses a pointer to video mem to do direct writes. You also have VidMgr to look at which also uses direct screen writes. VidMgr13 is in Snippets also. RW> Do you think the Borland Power Pack is something that will improve RW> this sort of thing? No. Apples and Oranges. -Roger --- Msged/386 4.20 beta 3kl3 * Origin: Box Of Rotting Corpses BBS, Upper Darby, PA, USA (1:273/404@fidonet) --------------- FIDO MESSAGE AREA==> TOPIC: 239 C LANGUAGE Ref: F4200037 Date: 03/30/98 From: ROGER SCUDDER Time: 06:55pm \/To: RICHARD VETO (Read 2 times) Subj: Programming Hello Richard. 28 Mar 98 09:57, Richard Veto wrote to All: RV> inventory is an array within the player structure. The problem is, the RV> inventory can have armor, weapons, wands, rings; each of which are RV> different structures. How do I link all those structures to reflect in the RV> player inventory? Do I use a union? Structures can be nested... typedef struct armor { /* all data pertaining to armor */ } ARMOR; typedef struct weapons { /* all data pertaining to weapons */ } WEAPONS; /* ETC... */ typedef player_inventory { ARMOR player_armor; WEAPONS player_weapons; /* etc... */ } PLAYER_INVENTORY; -Roger --- Msged/386 4.20 beta 3kl3 * Origin: Box Of Rotting Corpses BBS, Upper Darby, PA, USA (1:273/404@fidonet)