Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!apple!dlyons From: dlyons@Apple.COM (David Lyons) Newsgroups: comp.sys.apple Subject: Re: ORCA/C question Message-ID: <33740@apple.Apple.COM> Date: 5 Aug 89 00:39:58 GMT References: <10502@boulder.Colorado.EDU> Organization: Apple Computer Inc, Cupertino, CA Lines: 67 In article <10502@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (Jeff Hartkopf) writes: >I'm having a problem in loading/starting Standard File from an NDA with Orca/C. (I can't tell for sure from your code fragments, but be sure you never give control back to the main application with Standard File started if it wasn't already started by the app. That could crash some apps.) >/* in the NDA Open function: */ > toolsZeroPage = NewHandle(256, memID, attrBank + attrPage + > attrFixed + attrLocked); The "256" looks like a problem to me, *unless* you have a function prototype for NewHandle() so that the compiler knows a long (4-byte) integer is required for that parameter rather than a regular 2-byte one. Use "256L" or "(long) 256" instead. >BOOLEAN SFLoaded(void) >/* returns TRUE if Standard File is loaded, otherwise FALSE */ >{ > SFStatus(); > if (toolerror()) /* not loaded */ > return (FALSE); > else /* loaded */ > return (TRUE); >} You ought to be able to do it shorter like this, I think: BOOLEAN SFLoaded(void) { SFStatus(); return(!toolerror()); } >BOOLEAN SFStarted(void) >/* returns TRUE if Standard File is started, otherwise FALSE */ >{ > int started; > > started = SFStatus(); > if (toolerror()) /* not even loaded, so not started */ > return (FALSE); > else if (!started) /* not started */ > return (FALSE); > else > return (TRUE); /* started */ >} Again, that looks fine, but it can be shortened: BOOLEAN SFStarted(void) { int started = SFStatus(); if(toolerror()) return(FALSE); return(started); } --Dave Lyons, Apple Computer, Inc. | DAL Systems AppleLink--Apple Edition: DAVE.LYONS | P.O. Box 875 AppleLink--Personal Edition: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.