home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-188.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  45.0 KB  |  1,186 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Tue, 20 Oct 92       Volume 1 : Issue 188
  2.  
  3. Today's Topics:
  4.  
  5.     PGP - public key encryption for the Mac!!
  6.     updating window text / getting text lines from buffer
  7.     dereferencing Handles( was Re: incrementation differences/THINK C 4.0 vs. 5.0)
  8.     Advice requested: keyboard programming
  9.     Shareware legality question
  10.     JPEG <-> JFIF with QT.
  11.     handles and MoveHHi
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  (This means you can't post questions to the
  22. digest.)
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  35. file /pub/mac/csmp-digest/README before downloading any files.  The most
  36. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  37. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  38. archive has a mail server; send a message with the text '$MACarch help' (no
  39. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  40.  
  41. The digest is also available via email.  Just send a note saying that you
  42. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  43. automatically receive each new issue as it is created.  Sorry, back issues
  44. are not available through the mailing list.
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48.  
  49. -------------------------------------------------------
  50.  
  51. From: bwilliam@iat.holonet.net (Bill Williams)
  52. Subject: PGP - public key encryption for the Mac!!
  53. Date: 12 Sep 92 05:58:50 GMT
  54. Organization: HoloNet (BBS: 510-704-1058)
  55.  
  56. "David Meyers at Georgia Institute of Technology" observed that several
  57. people are using a VERY GOOD mail encryption technology called PGP (Pretty
  58. Good Privacy) and asked for the following info...
  59.  
  60. PGP 2.0 is discussed in detail in Sept 1992 "BoardWatch" BBS magazine.
  61.  
  62. PGP uses some RSA-ish stuff and other cryptographic technologies. And is
  63. IMPORTED from abroad and therefore in theory can be exported from this
  64. fascist sick country controlled by the NSA.
  65.  
  66. PGP  2.0 uses IDEA (International Data Encryption Algorithm" from the
  67. Univ. of Switzerland (ETH Zurich) and thus is not controlled or crippled
  68. by NSA "plants" or NSA restrictions.
  69.  
  70. PGP SOURCE can be obtained from locations directed from its original
  71. author at address "prz@sage.cgd.ucar.edu" but if you bother Philip
  72. Zimmerman unless you are a researcher with important issues, it would be
  73. tacky. Instead FTP the MSDOS source directly from outside the country!
  74.  
  75. just ftp kauri.vuw.ac.nz  and   cd to /pub/ms-dos/Encryption to get the
  76. source files "PGP20SRC.ZIP"
  77.  
  78. If you are not a programmer this knowledge will do you no good for the Mac.
  79.  
  80. BWilliams
  81.  
  82.  
  83.  
  84. +++++++++++++++++++++++++++
  85.  
  86. From: hp48sx@wupost.wustl.edu (HP48SX Archive Maintainer)
  87. Date: 12 Sep 1992 11:06:12 -0500
  88. Organization: Washington University in Saint Louis, MO USA
  89.  
  90. Please do not download pgp from the site in New Zealand.
  91. As the site mentions: No everseas ftp, it costs them money.
  92. I suggest you check with archie for a closer site or download it from:
  93. nic.funet.fi   /pub/msdos/utilities/sysutl     (Europe)
  94. urth.acsu.buffalo.edu   /pub 
  95. gatekeeper.dec.com   /.2/micro/msdos/pgp 
  96. pc.usl.edu   /pub/msdos/crypto
  97.  
  98. just to mention a f. Use archie if you want more addresses.
  99. - -- 
  100. Povl H. Pedersen             hp48sx@wuarchive.wustl.edu
  101. HP48sx archive maintainer
  102.  
  103. All Opinions (C) Copyright the Intergalactic Thought Association
  104.  
  105. ---------------------------
  106.  
  107. From: peter@sysnext.library.upenn.edu (Peter C. Gorman)
  108. Subject: updating window text / getting text lines from buffer
  109. Date: 25 Aug 92 15:14:09 GMT
  110.  
  111. Hello -
  112.  
  113. I have a couple of basic text-handling questions (using Think C):
  114.  
  115. 1. What's the standard way to update text in a window?  For instance, if I  
  116. display a value that needs to be changed periodically, do I DrawString(),  
  117. then at update time draw a white rectangle over it and DrawString with the  
  118. new value?
  119.  
  120. 2. If I load a text file into a buffer, what's the best way to get it out  
  121. a line at a time?  Do I write a version of fgets that gets it from the  
  122. buffer, or is this a standard Mac function that's posted somewhere?
  123.  
  124. Sorry if these are idiot questions; I'm new to both Mac and C programming.   
  125. Thanks for your help.
  126.  
  127. - --
  128. Peter Gorman
  129. University of Pennsylvania
  130. Library Systems Office
  131. peter@sysnext.library.upenn.edu
  132.  
  133. +++++++++++++++++++++++++++
  134.  
  135. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  136. Date: 25 Aug 92 23:24:49 GMT
  137. Organization: NASA/ARC Information Sciences Division
  138.  
  139. In article <86967@netnews.upenn.edu> peter@sysnext.library.upenn.edu (Peter C. Gorman) writes:
  140. >I have a couple of basic text-handling questions (using Think C):
  141. >1. What's the standard way to update text in a window?  For instance, if I  
  142. >display a value that needs to be changed periodically, do I DrawString(),  
  143. >then at update time draw a white rectangle over it and DrawString with the  
  144. >new value?
  145.  
  146. This is a good, quick way.
  147.  
  148. >
  149. >2. If I load a text file into a buffer, what's the best way to get it out  
  150. >a line at a time?  Do I write a version of fgets that gets it from the  
  151. >buffer, or is this a standard Mac function that's posted somewhere?
  152.  
  153. Sure, write the fgets-type function.  there is a method of reading from 
  154. a file documented somewhere in IM for getting the filemanager to
  155. parse files into lines delimited by any desired char ('\n' in this case)
  156. using PBRead (I believe).
  157.  
  158. If anyone has written a code snippet that does this, pls. inform me
  159. as to how this is done.  Posting here is okay, but mailing me a code snippet
  160. would be godly.
  161.  
  162. Thanks
  163.  
  164. >Peter Gorman
  165. >University of Pennsylvania
  166. >Library Systems Office
  167. >peter@sysnext.library.upenn.edu
  168.  
  169.  
  170. - -- 
  171. - ----------------------------------
  172. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  173. joshr@kronos.arc.nasa.gov
  174. "Send a salami to your boy in the army" - Katz's delicatessen, NYC
  175.  
  176. +++++++++++++++++++++++++++
  177.  
  178. From: zben@ni.umd.edu (Charles B. Cranston)
  179. Date: 28 Aug 92 19:08:26 GMT
  180. Organization: UM Home for the Terminally Analytical
  181.  
  182. In article <1992Aug25.232449.12720@kronos.arc.nasa.gov>,
  183. joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91) wrote:
  184.  
  185. > ...  there is a method of reading from 
  186. > a file documented somewhere in IM for getting the filemanager to
  187. > parse files into lines delimited by any desired char ('\n' in this case)
  188.  
  189. > If anyone has written a code snippet that does this, pls. inform me
  190. > as to how this is done.  Posting here is okay, but mailing me a code snippet
  191. > would be godly.
  192.  
  193. var
  194.     junk:    Integer;
  195.     Buff:    Packed Array[0..255] of SignedByte;
  196.     PBRec:    ParamBlockRec;
  197. begin        
  198.     PBRec.ioRefNum := theFile;
  199.     PBRec.ioBuffer := @Buff;
  200.     PBRec.ioPosMode := $0D80;  <<----80 is read till EOL bit, 0D is CR!
  201.     PBRec.ioPosOffset := 0;
  202.     PBRec.ioReqCount := 256;
  203.     junk := PBReadASync(@PBRec);
  204.     UseText(PBRec.ioActCount,@Buff);
  205.  
  206. Yipe, I figured this out so long ago I was still doing Pascal...
  207. Bear skins and stone knives...
  208.  
  209. zben@ni.umd.edu     -KA3ZDF
  210.  
  211. +++++++++++++++++++++++++++
  212.  
  213. From: zben@ni.umd.edu (Charles B. Cranston)
  214. Date: 28 Aug 92 23:48:55 GMT
  215. Organization: UM Home for the Terminally Analytical
  216.  
  217. In article <zben-280892150237@zben-mac-ii.umd.edu>,
  218. zben@ni.umd.edu (Charles B. Cranston) wrote:
  219.  
  220. > var
  221. >     junk:    Integer;
  222. >     Buff:    Packed Array[0..255] of SignedByte;
  223. >     PBRec:    ParamBlockRec;
  224. > begin        
  225. >     PBRec.ioRefNum := theFile;
  226. >     PBRec.ioBuffer := @Buff;
  227. >     PBRec.ioPosMode := $0D80;  <<----80 is read till EOL bit, 0D is CR!
  228. >     PBRec.ioPosOffset := 0;
  229. >     PBRec.ioReqCount := 256;
  230. >     junk := PBReadASync(@PBRec);
  231.                  ^ urp!
  232. >     UseText(PBRec.ioActCount,@Buff);
  233.  
  234. Yeah, I tried to get funky and replace PBRead(@PBRec,False) on
  235. the fly and got it wrong.  It should be PBReadSync not ASync.
  236.  
  237. zben@ni.umd.edu     -KA3ZDF
  238.  
  239. +++++++++++++++++++++++++++
  240.  
  241. From: urlichs@smurf.sub.org (Matthias Urlichs)
  242. Date: 10 Sep 92 15:38:30 GMT
  243. Organization: University of Karlsruhe, FRG
  244.  
  245. In comp.sys.mac.programmer, article <zben-280892150237@zben-mac-ii.umd.edu>,
  246.   zben@ni.umd.edu (Charles B. Cranston) writes:
  247. > In article <1992Aug25.232449.12720@kronos.arc.nasa.gov>,
  248. > joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91) wrote:
  249. > > a file documented somewhere in IM for getting the filemanager to
  250. > > parse files into lines delimited by any desired char ('\n' in this case)
  251. >  
  252. [ PBRead{A}Sync example deleted ]
  253.  
  254. Depending on what you're doing, though, it may be a lot faster if you
  255. allocate a largish buffer and just read your lines out of it.
  256. PBRead is _slow_ if used unbuffered. I once wrote a TIFF reader and dropping
  257. my own stupid buffer into the read procedure made the file reader five times
  258. faster.
  259.  
  260. - -- 
  261. Why does the porridge bird lay her egg in the air?
  262. - -- 
  263. Matthias Urlichs  --  urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de   /(o\
  264. Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany  --  +49-721-9612521     \o)/
  265.  
  266. ---------------------------
  267.  
  268. From: gcote@crchh74f.BNR.CA (Gary Cote)
  269. Subject: dereferencing Handles( was Re: incrementation differences/THINK C 4.0 vs. 5.0)
  270. Organization: Bell-Northern Research Ltd.
  271. Date: Tue, 25 Aug 1992 15:09:11 GMT
  272.  
  273. In article <1992Aug24.221630.4730@Csli.Stanford.EDU>,
  274. mmarx@csli.stanford.edu (Matthew Marx) writes:
  275.     < stuff about how he's maintaining someone else's code deleted >
  276. |>Boolean
  277. |>nxtWrd(char **theDataPtr, char *lab, int  tabs)
  278. |>{
  279. |>    char *temp;
  280. |>    int i=0;
  281. |>    
  282. |>    temp = *theDataPtr;
  283. |>    
  284. |>    while(*temp == '\t') 
  285. |>    {
  286. |>        temp++; i++;
  287. |>    }
  288.     < more stuff regarding ThinkC's order of operator evaluation >
  289.  
  290.     Does this snippet violate the rule of safe handle conventions? It seems
  291. to me that 
  292. once theDataPtr is dereferenced and copied into temp, this leaves him
  293. open to the great 
  294. disappearing memory trick. Assuming that the block theDataPtr is
  295. relocatable and 
  296. not locked, temp has the potential for becoming obsolete if the block is moved.
  297.  
  298.     If I am incorrect, I apologize. I haven't been programming the Mac very long.
  299.  
  300.     Would someone please post a clarification ( my access to e-mail is
  301. restricted ).
  302.  
  303.  
  304. |>-- 
  305. |>Matt Marx       mmarx@csli.stanford.edu           
  306. |>"Too much time on my hands..." -- Styx  
  307. |>"Too many hands on my time..." -- Rush  
  308. |>
  309.  
  310.  
  311. Gary B. Cote
  312. gcote@crchh74f.bnr.ca      -for one more week, but I'm not confident that
  313. e-mail will reach me
  314. gcote@hamp.hampshire.edu  -starting September 7                         
  315.  
  316.  
  317.  
  318. +++++++++++++++++++++++++++
  319.  
  320. From: stepan@natinst.com (Stepan Riha)
  321. Organization: National Instruments, Austin, TX
  322. Date: Tue, 25 Aug 1992 17:42:28 GMT
  323.  
  324. In article <1992Aug25.150911.19008@bnr.ca> gcote@crchh74f.BNR.CA (Gary Cote) writes:
  325.  
  326. Gary asks whether the following snippet violates "safe hadnle conventions"
  327.  
  328. >|>nxtWrd(char **theDataPtr, char *lab, int  tabs)
  329. >|>{
  330. >|>    char *temp;
  331. >|>    int i=0;
  332. >|>    
  333. >|>    temp = *theDataPtr;
  334. >|>    
  335. >|>    while(*temp == '\t') 
  336. >|>    {
  337. >|>        temp++; i++;
  338. >|>    }
  339.  
  340. >[It seems that]
  341. >once theDataPtr is dereferenced and copied into temp, this leaves him
  342. >open to the great disappearing memory trick...
  343.  
  344. The answer is NO!  temp is going to be fine as long as no functions is
  345. called that might relocate memory.  Thus, if you were to call NewPtr or
  346. NewHandle (for example) *after*  temp = *theDataPtr;  then you would be in
  347. trouble.  Since the only things that are being done are assignment, comparisons
  348. and some arithmetics temp is quite safe.
  349.  
  350. However a thing to be carefull about is code of the form:
  351.  
  352.     Handle    h;
  353.  
  354.     *h = foo();
  355.  
  356. where foo() causes memory to be relocated.  If the LHS is evaluated first, it
  357. might be incorrect once foo is called.  The correct way to write this would be
  358.  
  359.     Handle    h;
  360.     char    c;
  361.  
  362.     c = foo();
  363.     *h = c;
  364.  
  365.     - Stepan
  366. - -- 
  367.    Stepan Riha -- stepan@natinst.com
  368.  
  369.  
  370. +++++++++++++++++++++++++++
  371.  
  372. From: keith@taligent.com (Keith Rollin)
  373. Organization: Taligent
  374. Date: Tue, 25 Aug 1992 19:22:51 GMT
  375.  
  376. In article <1992Aug25.150911.19008@bnr.ca>, gcote@crchh74f.BNR.CA (Gary Cote)
  377. writes:
  378. > In article <1992Aug24.221630.4730@Csli.Stanford.EDU>,
  379. > mmarx@csli.stanford.edu (Matthew Marx) writes:
  380. >     < stuff about how he's maintaining someone else's code deleted >
  381. > |>Boolean
  382. > |>nxtWrd(char **theDataPtr, char *lab, int  tabs)
  383. > |>{
  384. > |>    char *temp;
  385. > |>    int i=0;
  386. > |>    
  387. > |>    temp = *theDataPtr;
  388. > |>    
  389. > |>    while(*temp == '\t') 
  390. > |>    {
  391. > |>        temp++; i++;
  392. > |>    }
  393. >     < more stuff regarding ThinkC's order of operator evaluation >
  394. >     Does this snippet violate the rule of safe handle conventions? It seems
  395. > to me that 
  396. > once theDataPtr is dereferenced and copied into temp, this leaves him
  397. > open to the great 
  398. > disappearing memory trick. Assuming that the block theDataPtr is
  399. > relocatable and 
  400. > not locked, temp has the potential for becoming obsolete if the block is
  401. moved.
  402. >     If I am incorrect, I apologize. I haven't been programming the Mac very long.
  403. >     Would someone please post a clarification ( my access to e-mail is
  404. > restricted ).
  405.  
  406.  
  407. Fortunately for the entire world, the Mac Memory Manager moves blocks only at
  408. very well defined times. One very gross rule that you could follow is that if
  409. you don't call any Memory Manager traps (either explicitly or implicitly by
  410. calling subroutines or other traps that in turn call the Memory Manager), then
  411. memory blocks won't move. Using our WayBack machine and resurrecting the
  412. original code:
  413.  
  414. Boolean nxtWrd(char **theDataPtr, char *lab, int  tabs)
  415. {
  416.     char *temp;
  417.     int i=0;
  418.     
  419.     temp = *theDataPtr;
  420.     
  421.     while(*temp == '\t') 
  422.         temp++; i++;
  423.  
  424.     if (i == tabs) {
  425.         i = 0;
  426.         while (temp[i] && (i<(WORDMAX-1)) && (temp[i] != '\n')) {
  427.             lab[i] = temp[i++];  //****THIS IS THE PROBLEM
  428.         }
  429.         lab[i] = '\0';
  430.         while (temp[i] && temp[i]!= '\n') i++;
  431.         if (temp[i] == '\n') i++;
  432.         *theDataPtr = temp+i;
  433.         return TRUE;
  434.     }
  435.     else return FALSE;
  436. }
  437.  
  438.  
  439. You'll see a complete lack of calls to the Toolbox or OS. Therefore, memory will
  440. not move, and his pointers will be safe.
  441.  
  442. OK, OK, before some hotshot jumps down my throat, there _is_ a case you have to
  443. look out for with the above code. I mentioned earlier that even implicit calls
  444. to the Memory Manager could get you into trouble. Sometimes these implicit calls
  445. are very subtle. For instance, assume that the above code is compiled on a
  446. system where ints are 32-bits long (like they are under MPW). Also assume that,
  447. instead of pointing to chars, "temp" points to something larger. In order to
  448. create the offset to the appropriate entry when working with 32-bit indexes, the
  449. compiler will call a standard library routine to perform the long
  450. multiplication. IF THE CODE SEGMENT HOLDING THE LIBRARY MULTIPLICATION ROUTINE
  451. IS NOT LOADED, it will automatically be loaded, which will cause memory blocks
  452. to move around, possibly invalidating "temp". Normally, this won't happen,
  453. because people usually put those library routines in their Main segment, which
  454. is always loaded. But it's something to keep in mind.
  455.  
  456. - --
  457. Keith Rollin
  458. Phantom Programmer
  459. Taligent, Inc.
  460.  
  461.  
  462. +++++++++++++++++++++++++++
  463.  
  464. From: lsr@taligent.com (Larry Rosenstein)
  465. Date: 26 Aug 92 18:24:47 GMT
  466. Organization: Taligent, Inc.
  467.  
  468. In article <1992Aug25.174228.17601@natinst.com>, stepan@natinst.com (Stepan
  469. Riha) wrote:
  470. > However a thing to be carefull about is code of the form:
  471. >     Handle    h;
  472. >     *h = foo();
  473. > where foo() causes memory to be relocated.  If the LHS is evaluated first, it
  474. > might be incorrect once foo is called.  The correct way to write this would be
  475.  
  476. And you not only have to consider whether the code in foo() can relocate
  477. memory, but whether the call to foo() itself might relocate memory.  This
  478. can happen if foo() is in a different segment from the caller, and that
  479. segment has to be brought into memory or moved.  (That implies that some
  480. calls to foo() might not move memory, but others could.)
  481.  
  482. Larry Rosenstein
  483. Taligent, Inc.
  484.  
  485. lsr@taligent.com
  486.  
  487. +++++++++++++++++++++++++++
  488.  
  489. From: bayes@hplvec.LVLD.HP.COM (Scott Bayes)
  490. Date: 9 Sep 92 19:48:18 GMT
  491. Organization: Hewlett-Packard Co., Loveland, CO
  492.  
  493. > Your remaining choices are semi-colon, comma and =. In this case,
  494. > semi-colon and comma are semantically identical, so that's not much of a
  495. > problem. Deciding between = and the others is slightly tricky. You can
  496. > resolve this, in part, by seeing which variables have been initialized.
  497. > If only one of the five variables has been initialized, the answer is
  498. > almost certainly = (otherwise, you'd be assigning something to an
  499. > uninitialized variable). Similarly, if both c and e (for example) have
  500. > just been initialized, you're almost certainly missing a semi-colon.
  501.  
  502. How do I tell which ones are initialized?
  503.  
  504. I might do this:
  505.  
  506. extern void dosomething;
  507.  
  508. dosomething(&c);
  509.  
  510. Is c now initialized or not? How can the compiler tell?
  511.  
  512. Lots of library routines do this kind of stuff.
  513.  
  514. The problem I see is that we expect a compiler to be RIGHT. If it's
  515. not RIGHT, then development of my application and its stability are
  516. both at great risk. It's tough enough to get a compiler to produce
  517. rock-solid code, without having it guess.
  518.  
  519. ScottB
  520.  
  521. ---------------------------
  522.  
  523. From: cuong@haydn.Stanford.EDU (Cuong T. Nguyen)
  524. Subject: Advice requested: keyboard programming
  525. Date: 26 Aug 92 19:41:49 GMT
  526. Organization: Center for Integrated Systems, Stanford University
  527.  
  528.  
  529. I want to implement a Vietnamese keyboard for the Mac.
  530. Vietnamese has diacritical marks, like European languages,
  531. except more complex in that a letter may have up to two
  532. diacritics.  The dead-key mechanism is not acceptable
  533. behavior.  The required, non-negotiable (standardized) behavior
  534. is as follows.  Let's say the user needs to type in the single
  535. Vietnamese letter <a^'>.  She will first type "a", and the
  536. system echoes "a".  Then she types "^", the system echoes BS
  537. to clear the "a", then echoes <a^>.  Similarly, when she types "'",
  538. the system echoes Bs, then <a^'>.  Don't worry about the logic
  539. states, character codes, or glyphs involved.  I would just like
  540. to learn how this keyboard behavior can be implemented on a
  541. system-wide basis, that is, when this keyboard mechanism is turned
  542. on, all input windows will behave as described (something like
  543. a specialized keyboard driver or desk accessory, perhaps).
  544.  
  545. I have scanned through Inside Mac vols at a bookstore and found
  546. KCHR to be in the right neighborhood, but it's still very fuzzy.
  547. I would greatly appreciate a knowledgeable pointer into the right
  548. direction, but not off to a wild goose chase as I am a Mac neophyte.
  549. You don't need to tell me exactly what to do step-by-step
  550. (although that wouldn't hurt :-), but the idea for me is
  551. to try and save re-discovery time.  I am thinking that
  552. a Mac wizard would be able to name in 5 minutes what
  553. the system components are that I need to mess with.
  554.  
  555. An estimate of task difficulty will also be appreciated.
  556. As a reference, it took me two days to implement this
  557. on Unix (I already knew X), and two weeks on MS-Windows
  558. (had to learn Windows, which fortunately provides for
  559. message hooks which allow you to filter keyboard messages
  560. as well as to generate fake keyboard events for those
  561. BS's I mentioned above).  Does the Mac provide a similar
  562. mechanism?
  563.  
  564. Thanks in advance,
  565.  
  566. Cuong
  567.  
  568. +++++++++++++++++++++++++++
  569.  
  570. From: urlichs@smurf.sub.org (Matthias Urlichs)
  571. Date: 10 Sep 92 16:46:55 GMT
  572. Organization: University of Karlsruhe, FRG
  573.  
  574. In comp.sys.mac.programmer, article <1992Aug26.194149.10299@leland.Stanford.EDU>,
  575.   cuong@haydn.Stanford.EDU (Cuong T. Nguyen) writes:
  576. > I want to implement a Vietnamese keyboard for the Mac.
  577.  
  578. No you don't. You want to implement a Vietnamese script for the Mac.
  579. The difference is that the Mac's Script Manager already supports most of what
  580. you're trying to do, without ugly hacks like backspace-and-replace.
  581. You'll have to implement the Vietnamese-specific parts and (of course) create
  582. one or two Vietnamese fonts.
  583.  
  584. There already are a few versions of 7.0.1 which do this sort of thing, for
  585. Thai and Korean; I don't know if any of these are sufficiently close to
  586. Vietnamese but the mechanics should be similar. 
  587.  
  588. Support for scripts is supposed to be better in System 7.1, currently in
  589. beta. I haven't been able to try it because I need MacTCP for my "real" work,
  590. and it's severely incompatible with 7.1.  :-(
  591.  
  592. > An estimate of task difficulty will also be appreciated.
  593.  
  594. Not that easy. You won't be able to get away with the BS hack; the Mac's not
  595. Unix, nor is it Windows.
  596.  
  597. - -- 
  598. Kirk:  "Did you find the Engine Room ?"
  599. Scott: "Right where I left it, sir."
  600.  
  601. [James T. Kirk, Montgomery Scott --- Star Trek VI: "The Undiscovered Country"]
  602. - -- 
  603. Matthias Urlichs  --  urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de   /(o\
  604. Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany  --  +49-721-9612521     \o)/
  605.  
  606. ---------------------------
  607.  
  608. From: mhall@occs.cs.oberlin.edu (Matthew Hall)
  609. Subject: Shareware legality question
  610. Date: 31 Aug 92 20:43:47 GMT
  611. Organization: Oberlin College Computer Science
  612.  
  613. Hello-
  614.  
  615. I submitted a shareware copyrighted program to sumex-aim.  In the
  616. README file I included a line that read <Public domain houses, such as
  617. Educorp, must contact me before distributing this program>.  I guess I
  618. aint no legal wizard, and I should have worded that more carefully.
  619.  
  620. A few months later, I recieved a letter and a complimentary CD-ROM
  621. from NAUTILUS saying that they had published my program on the disc.
  622. Now there are several reasons I would like to have been asked
  623. beforehand.
  624. First, the program is going commercial, and I would like to have put a
  625. demo version of the new program on instead.
  626. Second, I would like to have made the shareware fee plea a little
  627. stronger, since people who buy disks from these places think that they
  628. do not need to pay my fee.
  629. Third, I feel I have the right to ask for a fee from them.  A CD-ROM
  630. is actually pretty hefty, but since I do not have a drive, To me, its
  631. utterly useless.
  632. And last, I just plain asked to know beforehand, and they should have
  633. asked.
  634.  
  635. Do I have any rights here, or did I goof with my language.  Or should
  636. I just write a kind/nasty letter explaining to them how I feel.  It
  637. disturbs me a little that these people are using my program to make a
  638. profit (not, of course, that people are buying the NAUTILUS CD in
  639. droves because of it, but still) Does anybody have a similar
  640. experience?
  641.  
  642. - -matt hall
  643.  
  644. - --
  645.  
  646.  
  647. - -------------------------------------------------------------------------------
  648. Matt Hall.    mhall@occs.cs.edu  OR  SMH9666@OBERLIN.BITNET
  649.               (216)-775-5805 (That's a Cleveland Area code. Lucky Me)
  650.  
  651. "If a man comes up to you and says:
  652.     'A dog just carried away your ear.'
  653. Do you run after the dog, or search first for your ear?" - Moon over Morocco
  654.   
  655.  
  656. +++++++++++++++++++++++++++
  657.  
  658. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  659. Organization: University of Illinois at Urbana
  660. Date: Mon, 31 Aug 1992 23:29:29 GMT
  661.  
  662. mhall@occs.cs.oberlin.edu (Matthew Hall) writes:
  663.  
  664. >I submitted a shareware copyrighted program to sumex-aim.  In the
  665. >README file I included a line that read <Public domain houses, such as
  666. >Educorp, must contact me before distributing this program>.  I guess I
  667. >aint no legal wizard, and I should have worded that more carefully.
  668.  
  669. >Do I have any rights here, or did I goof with my language.  Or should
  670. >I just write a kind/nasty letter explaining to them how I feel.  It
  671. >disturbs me a little that these people are using my program to make a
  672. >profit (not, of course, that people are buying the NAUTILUS CD in
  673. >droves because of it, but still) Does anybody have a similar
  674. >experience?
  675.  
  676. Does the program or documentation say "Copyright Matthew Hall"
  677. anywhere? If so, I think you have a case. The lawyer folks I spoke to
  678. before sending out my shareware program said that so long as it says
  679. "Copyright Me" on it, you have the only right to copy it and grant
  680. only rights to copy as enumerated. I think your line from the README
  681. file is enough to cover you in court. If you want to push it, I think
  682. you can do something here. Check with a lawyer.
  683.  
  684. pr
  685. - -- 
  686. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  687. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  688. System manager - Cognitive Science Group, Beckman Institute, UIUC
  689. Internet: resnick@cogsci.uiuc.edu
  690.  
  691. +++++++++++++++++++++++++++
  692.  
  693. From: joseph@joebloe.maple-shade.nj.us (Joseph Nathan Hall)
  694. Date: Tue, 1 Sep 92 01:36:13 EDT
  695. Organization: 5 Sigma Software
  696.  
  697.  
  698. In article <BtvFx6.L9x@news.cso.uiuc.edu> (comp.sys.mac.programmer), resnick@cogsci.uiuc.edu (Pete Resnick) writes:
  699. ) >I submitted a shareware copyrighted program to sumex-aim.  In the
  700. ) >README file I included a line that read <Public domain houses, such as
  701. ) >Educorp, must contact me before distributing this program>.  I guess I
  702. ) >aint no legal wizard, and I should have worded that more carefully.
  703. ) >Do I have any rights here, or did I goof with my language.
  704.  
  705. You can certainly make them stop.  Alas, you have no other remedy
  706. if your work is not registered with the Library of Congress.
  707.  
  708. As I understand the law:
  709.  
  710. If you work is unpublished (which in this case, it is not), you need
  711. not include any copyright notice in order to prevent its unauthorized
  712. distribution and/or reproduction.  In fact, you must explicitly waive
  713. your rights.  Since US copyright law reform you automatically have copyright
  714. of any work (excepting work-for-hire, etc.), even if there is no copyright
  715. notice.
  716.  
  717. If you distribute your work in a way that looks like publication,
  718. you must have a copyright notice to protect your rights.  However,
  719. this does not allow you to seek any remedy other than to force someone
  720. who is distributing/reproducing/etc. your work without authorization
  721. to stop.  This is the criminal portion of the law, more or less.
  722. I think that the method for sending people to jail if they persist
  723. is contempt of court, but I'm not sure.
  724.  
  725. If you want civil damages, you must 1) register with LOC, and 2) take
  726. the offender to court.  In that order.  You can't register after the
  727. offense was committed and get post facto damages, alas.
  728.  
  729. A stiffly worded letter to the offender, either from you or from a
  730. lawyer, should bring results.  Do not be afraid to threaten, even
  731. if your threats are idle!  This is what lawyers do, and you can do
  732. it too.
  733.  
  734. I'd suggest registering your work with LOC in the future.  That alone
  735. wouldn't save you the trouble of hiring a lawyer ($$$), but you could
  736. possibly recover some $ from the offender.
  737.  
  738. uunet!joebloe!joseph   (609) 273-8200 day   joseph%joebloe@uunet.uu.net
  739. v   v  sssss | Certified Guru: all-grain brewing,| 2102 Ryan's Run East
  740.  v v  s   s  | C, synthesizer comp & arranging,  | Rt 38 & 41
  741.   v    sss   | photography. Also not a bad cook. | Maple Shade NJ 08052
  742. - -----My employer isn't paying for this, and my opinions are my own-----
  743.  
  744. +++++++++++++++++++++++++++
  745.  
  746. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  747. Date: 1 Sep 92 01:01:16 GMT
  748. Organization: Peirce Software
  749.  
  750.  
  751. In article <MHALL.92Aug31154347@occs.cs.oberlin.edu> (comp.sys.mac.programmer), mhall@occs.cs.oberlin.edu (Matthew Hall) writes:
  752. > Hello-
  753. > I submitted a shareware copyrighted program to sumex-aim.  In the
  754. > README file I included a line that read <Public domain houses, such as
  755. > Educorp, must contact me before distributing this program>.  I guess I
  756. > aint no legal wizard, and I should have worded that more carefully.
  757. > A few months later, I recieved a letter and a complimentary CD-ROM
  758. > from NAUTILUS saying that they had published my program on the disc.
  759. > Now there are several reasons I would like to have been asked
  760. > beforehand.
  761. > First, the program is going commercial, and I would like to have put a
  762. > demo version of the new program on instead.
  763. > Second, I would like to have made the shareware fee plea a little
  764. > stronger, since people who buy disks from these places think that they
  765. > do not need to pay my fee.
  766. > Third, I feel I have the right to ask for a fee from them.  A CD-ROM
  767. > is actually pretty hefty, but since I do not have a drive, To me, its
  768. > utterly useless.
  769. > And last, I just plain asked to know beforehand, and they should have
  770. > asked.
  771. > Do I have any rights here, or did I goof with my language.  Or should
  772. > I just write a kind/nasty letter explaining to them how I feel.  It
  773. > disturbs me a little that these people are using my program to make a
  774. > profit (not, of course, that people are buying the NAUTILUS CD in
  775. > droves because of it, but still) Does anybody have a similar
  776. > experience?
  777.  
  778. I don't really understand this reasoning.  I love it when these places
  779. put my shareware on their disks.  Their customers *do* pay for shareware
  780. - - though at about the same rate as people who get it off the online
  781. services or BBSes (single digit percentage if that).
  782.  
  783. How is Nautilus any different than America Online or Compuserve?
  784. They each make money from their subscribers and they each make shareware
  785. available.
  786.  
  787. As to your question, is it really worth money to you to try to bring
  788. legal action against them.  I imagine this would burn up any profits
  789. you have made from your shareware very quickly!
  790.  
  791. If you really feel bad, write them that nasty letter and get it off
  792. your chest.
  793.  
  794. P.S.  AppSizer was just on the Nautilus CD last month - and I'm happy
  795. about it.
  796.  
  797. - --  Michael Peirce      --   peirce@outpost.SF-Bay.org
  798. - --  Peirce Software     --   Suite 301, 719 Hibiscus Place
  799. - --                      --   San Jose, California USA 95117
  800. - --  Makers of...        --   voice: (408) 244-6554 fax: (408) 244-6882
  801. - --            SMOOTHIE  --   AppleLink: peirce & America Online: AFC Peirce
  802.  
  803. +++++++++++++++++++++++++++
  804.  
  805. From: timm@void.ncsa.uiuc.edu (Tim McClarren)
  806. Organization: University of Illinois at Urbana
  807. Date: Tue, 1 Sep 1992 18:20:14 GMT
  808.  
  809. joseph@joebloe.maple-shade.nj.us (Joseph Nathan Hall) writes:
  810.  
  811.  
  812. >In article <BtvFx6.L9x@news.cso.uiuc.edu> (comp.sys.mac.programmer), resnick@cogsci.uiuc.edu (Pete Resnick) writes:
  813. >) >I submitted a shareware copyrighted program to sumex-aim.  In the
  814. >) >README file I included a line that read <Public domain houses, such as
  815. >) >Educorp, must contact me before distributing this program>.  I guess I
  816. >) >aint no legal wizard, and I should have worded that more carefully.
  817. >) 
  818. >) >Do I have any rights here, or did I goof with my language.
  819.  
  820. >You can certainly make them stop.  Alas, you have no other remedy
  821. >if your work is not registered with the Library of Congress.
  822.  
  823. >As I understand the law:
  824.  
  825. >If you work is unpublished (which in this case, it is not), you need
  826. >not include any copyright notice in order to prevent its unauthorized
  827. >distribution and/or reproduction.  In fact, you must explicitly waive
  828. >your rights.  Since US copyright law reform you automatically have copyright
  829. >of any work (excepting work-for-hire, etc.), even if there is no copyright
  830. >notice.
  831.  
  832. Yes, this is exactly right and is known as implicit copyright.  It protects
  833. authors from stolen work.  Anyways, a letter from your lawyer would probably
  834. be most effective, and some lawyers charge a nominal fee (last time I did
  835. it it cost me $50) for the service.  Is it worth the $50 to you?
  836.  
  837. - -- 
  838. Tim McClarren     | "...a bajillion brilliant Jobsian lithium licks."
  839. timm@ncsa.uiuc.edu|
  840. (217)244-0015     |
  841.  
  842. +++++++++++++++++++++++++++
  843.  
  844. From: kurisuto@chopin.udel.edu (Sean J. Crist)
  845. Date: 12 Sep 92 02:55:34 GMT
  846. Organization: University of Delaware
  847.  
  848. In article <01050166.cgucc7@joebloe.maple-shade.nj.us> joseph@joebloe.maple-shade.nj.us writes:
  849. >In article <BtvFx6.L9x@news.cso.uiuc.edu> (comp.sys.mac.programmer), resnick@cogsci.uiuc.edu (Pete Resnick) writes:
  850. >) >I submitted a shareware copyrighted program to sumex-aim.  In the
  851. >) >README file I included a line that read <Public domain houses, such as
  852. >) >Educorp, must contact me before distributing this program>.  I guess I
  853. >) >aint no legal wizard, and I should have worded that more carefully.
  854. >) 
  855. >) >Do I have any rights here, or did I goof with my language.
  856. >
  857. >You can certainly make them stop.  Alas, you have no other remedy
  858. >if your work is not registered with the Library of Congress.
  859.  
  860. I am almost certain that this is not correct.  A few years ago, I was
  861. in the middle of a very annoying and complicated legal snarl involving
  862. some copyrighted material, and I requested some free literature from
  863. (I believe) the U.S. Copyright Office in Washington (I may be wrong
  864. about the department name).  
  865.  
  866. I remember reading that you don't have to register your work with the
  867. Library of Congress for your work to be copyrighted; all you have to
  868. do is include a copyright notice in the form (c) 1992 by Joe Smith.
  869. It seems to me that the literature specifically dismissed the need
  870. to register with the Library of Congress as a common myth.
  871. What registry with the Library of Congress does accomplish is to
  872. make it much easier for you to establish yourself as the rightful
  873. holder of the copyright, should the issue ever go to court.
  874.  
  875. I recommend that you call information in Washington, obtain the number
  876. for the U.S. Copyright Office, and request literature on copyrighting
  877. your work.  I hope you did include a copyright notice with your
  878. material, since you give up your copyright once your work is released
  879. without one.
  880.  
  881. - --Kurisuto
  882. kurisuto@bach.udel.edu
  883.  
  884. +++++++++++++++++++++++++++
  885.  
  886. From: mxmora@unix.sri.com (Matthew Xavier Mora)
  887. Date: 14 Sep 92 20:21:12 GMT
  888. Organization: SRI International
  889.  
  890. In article <BuG2sM.E5I@news.udel.edu>, kurisuto@chopin.udel.edu (Sean J.
  891. Crist) wrote:
  892. > I remember reading that you don't have to register your work with the
  893. > Library of Congress for your work to be copyrighted; all you have to
  894. > do is include a copyright notice in the form (c) 1992 by Joe Smith.
  895.                                                ^^^
  896.  
  897. Won't do. It has to be the real copyright symbol or the word Copyright.
  898. "(c)" is not covered.
  899.  
  900.  
  901. Matt
  902.  
  903. ---------------------------
  904.  
  905. From: mackid@engin.umich.edu (Mike Neil)
  906. Subject: JPEG <-> JFIF with QT.
  907. Date: Fri, 28 Aug 92 21:20:47 EDT
  908. Organization: CAEN (UofM)
  909.  
  910.   Just thought I'd pass this tidbit of info on to you folks.
  911.   I was working on converting JFIF (JPEG File Interchange Format) files
  912. to QT JPEG files.  I looked at porting the PD JPEG code (available on
  913. think.com) to the Mac.  But I noticed that the Pict Viewer App that
  914. comes on the QT CD was able to read and write JFIFs.  So I looked at
  915. it a bit more, and fould that the data portion that is returned from a
  916. CompressImage call is in the JFIF format (Someone give the QT guys another
  917. cookie).  So basically you can read a JFIF file into memory pass it into
  918. the DecompressImage call (You will need to make a Info block by hand).
  919. and you will get a decompressed image out.  Very Cool.
  920.  
  921. - -Mike Neil
  922. P.S.  Couldn't find any mention of this in the QT docs so my guess is
  923. it is an unsupported feature.
  924.  
  925. +++++++++++++++++++++++++++
  926.  
  927. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  928. Date: 5 Sep 92 05:31:21 GMT
  929. Organization: University of Waikato, Hamilton, New Zealand
  930.  
  931. In article <mackid-280892211810@toysrus.engin.umich.edu.>, mackid@engin.umich.edu (Mike Neil) writes:
  932. >
  933. >   I noticed that the Pict Viewer App that
  934. > comes on the QT CD was able to read and write JFIFs.  So I looked at
  935. > it a bit more, and fould that the data portion that is returned from a
  936. > CompressImage call is in the JFIF format (Someone give the QT guys another
  937. > cookie).  So basically you can read a JFIF file into memory pass it into
  938. > the DecompressImage call (You will need to make a Info block by hand).
  939. > and you will get a decompressed image out.  Very Cool.
  940. >
  941. > P.S.  Couldn't find any mention of this in the QT docs so my guess is
  942. > it is an unsupported feature.
  943.  
  944. I had a read of the JFIF specs. The main thing it offers you over vanilla
  945. JPEG is the X and Y resolution information, which gives you some idea of what
  946. scale to view the image at. It is true, though, that the QuickTime JPEG
  947. compressor reads and writes a standard JPEG data stream (well, it would have
  948. to, wouldn't it?). Thus it's very easy to read and write JPEG files on a
  949. QuickTime-equipped Mac.
  950.  
  951. Things get a little harder, though, if the image is too big to fit in memory
  952. all at once. Then you have to figure out how to use data loading and unloading
  953. routines with the Image Compression Manager...
  954.  
  955. Here's one useful piece of information about the JPEG data stream, for those
  956. (like me) who have never seen a copy of the JPEG spec: if you want to determine
  957. the size of the image, look for a hex FF byte followed by a hex C0 byte. Skip
  958. the next three bytes, and you will find a 2-byte integer containing the number
  959. of lines, followed by a 2-byte integer containing the number of columns. Both
  960. are in big-endian format (ie on a Mac, you don't have to worry about it).
  961.  
  962. Thanks to Dolf Starreveld at Storm Technology for telling me this, along with
  963. several other interesting things, a long time ago...
  964.  
  965. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  966. Computer Services Dept                     fax: +64-7-838-4066
  967. University of Waikato            electric mail: ldo@waikato.ac.nz
  968. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  969. Ask not for whom the phone rings; it rings for you.
  970.  
  971. +++++++++++++++++++++++++++
  972.  
  973. From: tgl+@cs.cmu.edu (Tom Lane)
  974. Date: 13 Sep 92 04:48:56 GMT
  975. Organization: School of Computer Science, Carnegie Mellon
  976.  
  977. (Sorry for the slow response ... don't read this group often.)
  978.  
  979. mackid@engin.umich.edu (Mike Neil) says:
  980. > the data portion that is returned from a
  981. > CompressImage call is in the JFIF format (Someone give the QT guys another
  982. > cookie).  So basically you can read a JFIF file into memory pass it into
  983. > the DecompressImage call (You will need to make a Info block by hand).
  984. > and you will get a decompressed image out.  Very Cool.
  985.  
  986. I don't recall offhand whether QT makes a true JFIF file (complete with JFIF
  987. marker) or just a "raw JPEG" file.  Either way, though, the information is
  988. compatible with non-Mac JFIF/JPEG programs.  The JFIF marker is considered
  989. optional by most non-Mac decoders; it really just certifies that the file
  990. adheres to the JFIF conventions about colorspace.
  991.  
  992. > Couldn't find any mention of this in the QT docs so my guess is
  993. > it is an unsupported feature.
  994.  
  995. I think it's reasonably safe to rely on it --- Apple's chief JPEG engineer
  996. has spent a good deal of time making sure QT is compatible with JFIF-based
  997. decoders :-)
  998.  
  999. And ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  1000. > Here's one useful piece of information about the JPEG data stream, for those
  1001. > (like me) who have never seen a copy of the JPEG spec: if you want to
  1002. > determine the size of the image, look for a hex FF byte followed by a hex C0
  1003. > byte. Skip the next three bytes, and you will find a 2-byte integer
  1004. > containing the number of lines, followed by a 2-byte integer containing the
  1005. > number of columns.
  1006.  
  1007. Bzzt.  Sorry, but that method is guaranteed to break sooner or later.  If
  1008. you want reliable info, you have to parse the JPEG marker sequence, at least
  1009. well enough to skip over the arbitrary data that may be inside marker bodies
  1010. preceding the SOF marker.
  1011.  
  1012. If you don't want to buy a copy of the JPEG standard, at least go read the
  1013. free JPEG code available from ftp.uu.net: graphics/jpeg/ ... in particular,
  1014. jrdjfif.c will show you how to do this right.  It only takes a few more
  1015. lines of code.
  1016.  
  1017.                 regards, tom lane
  1018.  
  1019. +++++++++++++++++++++++++++
  1020.  
  1021. From: a-giles@uchicago.edu (Aaron Giles)
  1022. Organization: University of Chicago High Energy Physics
  1023. Date: Sun, 13 Sep 1992 23:50:34 GMT
  1024.  
  1025. In article <BuI2pL.92z.2@cs.cmu.edu> tgl+@cs.cmu.edu (Tom Lane) writes:
  1026.  
  1027. > mackid@engin.umich.edu (Mike Neil) says:
  1028. > > the data portion that is returned from a
  1029. > > CompressImage call is in the JFIF format (Someone give the QT guys another
  1030. > > cookie).  So basically you can read a JFIF file into memory pass it into
  1031. > > the DecompressImage call (You will need to make a Info block by hand).
  1032. > > and you will get a decompressed image out.  Very Cool.
  1033.  
  1034. > I don't recall offhand whether QT makes a true JFIF file (complete with JFIF
  1035. > marker) or just a "raw JPEG" file.  Either way, though, the information is
  1036. > compatible with non-Mac JFIF/JPEG programs.  The JFIF marker is considered
  1037. > optional by most non-Mac decoders; it really just certifies that the file
  1038. > adheres to the JFIF conventions about colorspace.
  1039.  
  1040. Actually, QT *does* include the JFIF marker and in fact produces a
  1041. perfectly acceptable JFIF output, not simply a JFIF-compatible output.
  1042.  
  1043. Aaron Giles
  1044. a-giles@uchicago.edu
  1045.  
  1046. ---------------------------
  1047.  
  1048. From: francois@welchgate.welch.jhu.edu (Francois Schiettecatte)
  1049. Subject: handles and MoveHHi
  1050. Organization: Johns Hopkins Univ. Welch Medical Library
  1051. Date: Sun, 13 Sep 1992 16:12:38 GMT
  1052.  
  1053. Hi, sorry if these questions are a FAQ but here goes:
  1054.  
  1055. - - is there a real advantage to using MoveHHi before locking your
  1056. handles, I have not really seen much on that except that Think Reference
  1057. suggests that is *may* help in reducing heap fragmentation. Are there
  1058. any definite rules for using MoveHHi and caveat.
  1059.  
  1060. - - Also when passing parameters in C is it better to use pointers or
  1061. handles. I guess the answer is really along the lines of it depends
  1062. on what you do with them afterwards, ie do you lock them, do you need to 
  1063. allocate new memory, etc. Does anyone have any guidelines for this.
  1064.  
  1065. If there is interest, I wil post back a summary.
  1066.  
  1067. thansk
  1068.  
  1069. francois
  1070.  
  1071.  
  1072. francois@welchgate.welch.jhu.edu
  1073.  
  1074.  
  1075. +++++++++++++++++++++++++++
  1076.  
  1077. From: d88-jwa@cyklop.nada.kth.se (Jon W{tte)
  1078. Organization: Royal Institute of Technology, Stockholm, Sweden
  1079. Date: Sun, 13 Sep 1992 18:37:11 GMT
  1080.  
  1081. > francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  1082.  
  1083.    Hi, sorry if these questions are a FAQ but here goes:
  1084.  
  1085.    - is there a real advantage to using MoveHHi before locking your
  1086.    handles, I have not really seen much on that except that Think Reference
  1087.    suggests that is *may* help in reducing heap fragmentation. Are there
  1088.    any definite rules for using MoveHHi and caveat.
  1089.  
  1090. MoveHHi is, uh, somewhat expensive since the toolbox
  1091. goes to a fair amount of trouble to move stuff out of
  1092. the way and move the handle HIGH up in the heap.
  1093.  
  1094. If you're going to keep the handle locked for a long
  1095. time (i.e. a minute or more...) it's a very good idea,
  1096. but if you only lock the handle to pass it to a toolbox
  1097. routine, it's no idea. (Or rather, a bad idea)
  1098.  
  1099.    - Also when passing parameters in C is it better to use pointers or
  1100.    handles. I guess the answer is really along the lines of it depends
  1101.    on what you do with them afterwards, ie do you lock them, do you need to 
  1102.    allocate new memory, etc. Does anyone have any guidelines for this.
  1103.  
  1104. Well, if it's a handle from the start, pass it as a handle
  1105. as far as possible, because you get more constrained when
  1106. you can't "do" anything with a handle. Also, if your function
  1107. takes a pointer, never assume that's a dereferenced handle.
  1108. RecoverHandle is EXPENSIVE! The reverse is also true; don't
  1109. pass the address of a pointer to something that wants a handle.
  1110.  
  1111. - -- 
  1112. Jon W{tte, h+@nada.kth.se, Sweden, Phone +46-8-107069
  1113.  
  1114. Help eradicate FIDO-Net <-> Usenet gateways in our time!
  1115.  
  1116. +++++++++++++++++++++++++++
  1117.  
  1118. From: nerm@apple.com (Dean Yu)
  1119. Date: 14 Sep 92 17:36:44 GMT
  1120. Organization: Apple Computer, Inc.
  1121.  
  1122. In article <D88-JWA.92Sep13193711@cyklop.nada.kth.se>,
  1123. d88-jwa@cyklop.nada.kth.se (Jon W{tte) wrote:
  1124. > > francois@welchgate.welch.jhu.edu (Francois Schiettecatte) writes:
  1125. >    - is there a real advantage to using MoveHHi before locking your
  1126. >    handles, I have not really seen much on that except that Think Reference
  1127. >    suggests that is *may* help in reducing heap fragmentation. Are there
  1128. >    any definite rules for using MoveHHi and caveat.
  1129. > MoveHHi is, uh, somewhat expensive since the toolbox
  1130. > goes to a fair amount of trouble to move stuff out of
  1131. > the way and move the handle HIGH up in the heap.
  1132. > If you're going to keep the handle locked for a long
  1133. > time (i.e. a minute or more...) it's a very good idea,
  1134. > but if you only lock the handle to pass it to a toolbox
  1135. > routine, it's no idea. (Or rather, a bad idea)
  1136. >    - Also when passing parameters in C is it better to use pointers or
  1137. >    handles. I guess the answer is really along the lines of it depends
  1138. >    on what you do with them afterwards, ie do you lock them, do you need to 
  1139. >    allocate new memory, etc. Does anyone have any guidelines for this.
  1140. > Well, if it's a handle from the start, pass it as a handle
  1141. > as far as possible, because you get more constrained when
  1142. > you can't "do" anything with a handle. Also, if your function
  1143. > takes a pointer, never assume that's a dereferenced handle.
  1144. > RecoverHandle is EXPENSIVE! The reverse is also true; don't
  1145. > pass the address of a pointer to something that wants a handle.
  1146.  
  1147.   In addition to what Jon said, if you're using a handle for the sake of
  1148. using a handle, and you keep it locked for the duration of your program's
  1149. life, you might as well use a pointer and save yourself a dererference.
  1150. This won't cost you much in terms of fragmentation, since pointers are
  1151. created as low in the heap as possible.  If you create all the pointers you
  1152. need early in your program, your non-relocatable blocks should be neatly
  1153. organized at the bottom of your heap.
  1154.  
  1155. - -- Dean Yu
  1156.    Blue Meanie, Negative Ethnic Role Model, etc.
  1157.    Apple Computer, Inc.
  1158.  
  1159. ---------------------------
  1160.  
  1161. End of C.S.M.P. Digest
  1162. **********************
  1163.