greyelf@wpi.wpi.edu (Michael J Pender) (03/15/90)
Well by this point I've spent a LOT of time playing with hyperc, and still have some questions. How do I fetch a random number for making games? How do we create a system file that can be executed independent of the shell? Is there a nice clean way to scan the keyboard or a string for decimal numbers, hex numbers, etc.? like sscanf("%d %c", a,b); How do I access the printer? I haven't got my computer set up right now, but when I do I'll upload a few commands I wrote for the c system. Oh, and how is memory allocated under C? If I patched Daemon into C, we might really have something... --- Michael J Pender Jr Box 1942 c/o W.P.I. W.O.S. is not dead. greyelf@wpi.bitnet 100 Institute Rd. ...its time to get started, greyelf@wpi.wpi.edu Worcester, Ma 01609 there is much to be done. If my next computer isn't a IIgs, it won't be an apple... Me.
toth@tellab5.tellabs.com (Joseph G. Toth Jr.) (03/21/90)
In article <9678@wpi.wpi.edu>, greyelf@wpi.wpi.edu (Michael J Pender) writes: > Well by this point I've spent a LOT of time playing with hyperc, and still > have some questions. So, have I; on bothe points. > How do I fetch a random number for making games? Write your own.. I have. However there is a problem with HyperC in regards to generating random numbers; most good algorithms(sp) for integer random number generation require more than 16 bit accuracy and HyperC's treatment of 'long' is not twice the size of 'int' - they made 'long' (2 bytes) equal to 'int' (2 bytes). I have had problems with this since I have yet to figure out how to pass a parameter of the type 'LONG' (from the 'fp' definitions) through a procedural call. (ie. LONG *proc_name(parm) LONG parm; { code(); } errors occur on either use of LONG ) I always get some kind of error, of course this might be due to the method used to create a 4 byte integer '#typedef char LONG[4]'. Maybe the documentation provides some description of how this could be accomplished. NOTE: While most advanced C compliers implement 'long' as twice the size of the 'int' variable, the K&R standard does not require it, from 'A Book on C' by Al Kelley and Ira Pohl. > How do we create a system file that can be executed independent of the > shell? There is an object file 's.o' that is the first file to be included into the links when performing a compile to netive code. Somebody would have to write a new one fo these that sets up all initial values for variables used by the HyperC compiled/linked executable. Also the 'exit()' code would have to be re-coded to perform a ProDOS 'bye' operationi (there might be better operations to avoid having a program started from the basic environment exiting all the way to the crummy ProDOS selector - not as important if you use one of the many shells/program launchers).. > Is there a nice clean way to scan the keyboard or a string for > decimal numbers, hex numbers, etc.? like sscanf("%d %c", a,b); There is an '<int_var> = atoi(<string_ptr>);' operation. but a good scan function would have to be written by somebody. > How do I access the printer? I haven't figured out how to do this from the code yet (No Docs again). But i did write a small program that reads a file and prints it to the screen (called it 'cat', like unix), and then do 'print #1 cat <filename>' where the '1' is the slot number ( type the '#' or the system hangs ). > I haven't got my computer set up right now, but when I do I'll > upload a few commands I wrote for the c system. Maybe there ought to be a new newsgroup for HyperC under apple2 so that interest in 'C' on a ][ c/e (excuse the nomenclature) could grow. > Oh, and how is memory allocated under C? If I patched Daemon into C, > we might really have something... If you are refering to the use of the alloc(<byte_count>) or free(<mem_ptr>), but it probably takes all memory between the top address of the program and the value in HIMEM and uses that as the free space. > --- > Michael J Pender Jr Box 1942 c/o W.P.I. W.O.S. is not dead. > greyelf@wpi.bitnet 100 Institute Rd. ...its time to get started, > greyelf@wpi.wpi.edu Worcester, Ma 01609 there is much to be done. > If my next computer isn't a IIgs, it won't be an apple... Me. -- ------------------------------------------------+--------------------- Maybe I shouldn't have done it, sarcasm is so | Joseph G. Toth Jr. seldom understood. Don't FLAME on me, please. | uunet!tellab5!toth
gwyn@smoke.BRL.MIL (Doug Gwyn) (03/23/90)
In article <2274@tellab5.tellabs.com> toth@tellab5.tellabs.com (Joseph G. Toth Jr.) writes: >NOTE: While most advanced C compliers implement 'long' as twice the > size of the 'int' variable, the K&R standard does not require it, > from 'A Book on C' by Al Kelley and Ira Pohl. The American National Standard for C requires in effect 32 or more bits in the representation of a long int. This is one of several reasons why I recommend not trying to use Hyper C for serious program development.