jpenne@ee.ualberta.ca (Jerry Penner) (01/13/91)
Can anyone tell me how to properly put GS/OS class 1 strings into Orca/C programs? I have the GS/OS Ref, which says next to nothing about using C with GS/OS, and the Orca/C manual says something to the effect that since C provides file access functions using the stdio.h library, it shouldn't be necessary to use GS/OS. Hah. Well I want to anyways. Also, when writing desktop programs in Orca/C, has anyone managed to get a simple desktop program running without using Orca's startdesk() and enddesk() functions. Mine just hangs. Basically, all I do is start up the Tool locator, Memory Mgr, Misc tools, Quickdraw, draw a message on the screen, and shut down the tools in the opposite order. After all the calls have been made (I verified this with a little asm{} routine that stuffs a char into the top left text screen corner) the system hangs. Thanks. -- ------------- Jerry Penner alberta!bode!jpenne Edmonton, Alberta, Canada
toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (01/13/91)
jpenne@ee.ualberta.ca (Jerry Penner) writes: >Can anyone tell me how to properly put GS/OS class 1 strings into Orca/C >programs? I have the GS/OS Ref, which says next to nothing about using C >with GS/OS, and the Orca/C manual says something to the effect that since >C provides file access functions using the stdio.h library, it shouldn't be >necessary to use GS/OS. Hah. Well I want to anyways. So do I. I needed to device functions for DiskCopy. Print out the gsos.h file and spend a little time looking at it. I'm mailing you some source code; it should point you in the right direction. >Also, when writing desktop programs in Orca/C, has anyone managed to get >a simple desktop program running without using Orca's startdesk() and >enddesk() functions. Mine just hangs. Basically, all I do is start up It hangs AFTER everything is finished? Are you using 1.1 or 1.0? With 1.0 (or 1.1 with stack repair off) passing an int to a function that needs a long will create exactly that sort of behavior. When I still had 1.0 I gave up on fread() and fwrite() because I thought they were screwed. Well they are (they are declared as returning int and they should return size_t which is long) but I had other problems because of the same effect. If you are passing constants to functions make sure they have L's when needed. Todd Whitesel toddpw @ tybalt.caltech.edu
ericmcg@pnet91.cts.com (Eric Mcgillicuddy) (01/14/91)
>Can anyone tell me how to properly put GS/OS class 1 strings into Orca/C >programs? I have the GS/OS Ref, which says next to nothing about using C >with GS/OS, and the Orca/C manual says something to the effect that since >C provides file access functions using the stdio.h library, it shouldn't be >necessary to use GS/OS. Hah. Well I want to anyways. > Jerry Penner alberta!bode!jpenne Edmonton, Alberta, Canada Create a structure called GSstring and put the length word in the length. struct GSstring { int length; char string[255]; /* or whatever buffer size you need */ }; Use Orca/C's strpos( string, "/0") to return the length and plunk that into the length element and use strcpy (string1, string2) to copy the string into the structure. (This is off the top of my head,so I do not have the correct syntax to copy to a structure with strcpy. I leave this as an excersize for the class to complete at home. :) Orca/C has a function called c2pstr that converts a C string to a Pascal string, but the length is only 1 byte long, GSOS requires 2 bytes. Perhaps when you have it working you could post it here under the name "c2GSstr". UUCP: bkj386!pnet91!ericmcg INET: ericmcg@pnet91.cts.com
gwyn@smoke.brl.mil (Doug Gwyn) (01/16/91)
In article <379@generic.UUCP> ericmcg@pnet91.cts.com (Eric Mcgillicuddy) writes: >Use Orca/C's strpos( string, "/0") to return the length ... I don't know about strpos(), but surely that can't be right. In any event, use strlen(string); it's standard and probably more efficient.
bazyar@chip (Jawaid Bazyar) (01/16/91)
In article <379@generic.UUCP> ericmcg@pnet91.cts.com (Eric Mcgillicuddy) writes: >Create a structure called GSstring and put the length word in the length. > >struct GSstring { > int length; > char string[255]; /* or whatever buffer size you need */ >}; I would recommend using the predefined GSString255 type in the 2/orcacdefs/gsos.h file. That way other people reading your code will know exactly what it is. -- Jawaid Bazyar | Being is Mathematics Senior/Computer Engineering | Love is Chemistry bazyar@cs.uiuc.edu | Sex is Physics Apple II Forever! | Babies are engineering