Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sdcsvax.UUCP Path: utzoo!linus!philabs!prls!amdimage!amdcad!amd!pesnta!hplabs!sdcrdcf!sdcsvax!jww From: jww@sdcsvax.UUCP (Joel West) Newsgroups: net.micro.mac,net.sources.mac Subject: Misinformation on C strings??? Message-ID: <1016@sdcsvax.UUCP> Date: Sun, 28-Jul-85 23:24:09 EDT Article-I.D.: sdcsvax.1016 Posted: Sun Jul 28 23:24:09 1985 Date-Received: Thu, 1-Aug-85 21:10:57 EDT References: <385@utastro.UUCP> Distribution: net Organization: CACI, Inc - Federal, La Jolla Lines: 80 Keywords: C strings not broken? Xref: linus net.micro.mac:2182 net.sources.mac:461 With regards to making C programs work (particularly under Megamax C), the claim has been made that it is not possible to use RMaker to produce a C string. (For those who'v been in a cave, Lisa Pascal begins its strings with a 1-byte length, and standard C ends its with a 0 byte). I don't know if this is a question or an observation, but I don't think this is really true. (OOPS). As I had something to do with this belief, I'm not sure what to say. :-( For example, the recently posted SKEL goes to great length to get around this supposed "bug": > v2.2.1C April 1,1985 whj:Added in-place conversion of Pascal strings > to C strings for the string resources. Uses > new procedure "initStrRes", included in > this file. This is a kludge required because > the RMaker program supplied does not > support C-Style strings. v. 2.0 of Megamax C > is different in its handling of string > resources than v. 1.2, which necessitated this > change. Strings resources must not be > purgeable for this to work. Also modified the > header file "qdvars.h" which was supplied with > Megamax C v. 2.0. Use the new version in place > of the Megamax version; the interface will be > similar to the Lisa Pascal interface. > > /* > ############################ initStrRes ############################## > Changes strings in Resource Fork to NULL-terminated C formatted strings. > All strings in Resource Fork must be unpurgeable for this to work. Sorry. > Perhaps this can go away when Apple provides an RMaker program that supports > C strings. > */ > > initstrres() > { > int i, numstrres; > stringhandle str; > numstrres = CountResources ("STR "); /* Count the strings */ > for (i=1; i<=numstrres; i++) > { > str = GetIndResource ("STR ", i); /* Get Handle to string */ > ptocstr(*str); /* Convert in place to C string */ > } > } However, with all the nifty resource editors shipped on the "May" supplement, I thought I'd try one last time. My "RMaker" has a fancy icon and the "Get Info" says version 2.2, 10/18/84. I fed it this program: text.exe type TEXT = GNRL ,257 .S Hello, world\00 type TEXT = GNRL ,258 .S This is a simple string!\00 Nothing terribly exciting about that. What I ended up with, according to Redit, was two strings of resource type "TEXT", each beginning with a capital letter and ending with $00. Now, unless I miss my guess, Rmaker will handle C strings, albeit manually. Joel West CACI, Inc. - Federal (c/o Gould CSD) {decvax!sdcsvax,ihnp4!bonnie}!gould9!joel gould9!joel@NOSC.ARPA (also joel@NOSC) PS: Does anyone know a way (without writing a program) to convert to/from the Lisa RMAKER format (which REDIT, Dialog Creator use) and the MDS (Megamax) Format? The differences seem primarily in the ordering of DLOG and WIND parameters.