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

  1. C.S.M.P. Digest             Sun, 14 Jun 92       Volume 1 : Issue 113
  2.  
  3. Today's Topics:
  4.  
  5.     Fortran callable graphing library wanted for Mac
  6.     Delete menu items?
  7.     Where can I find Oberon?
  8.     Format of a mac Disk?
  9.     Getting a Files full Pathname
  10.     C (C++) Prettyprinter
  11.     MacTutor version 2.0
  12.     New Developer Tool from Apple & AT&T?
  13.     HELP! *BIGGER* Handle woes
  14.  
  15.  
  16. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  17.  
  18. These digests are available (by using FTP, account anonymous, your email
  19. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  20. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  21. Questions list.  The last several issues of the digest are available from
  22. sumex-aim.stanford.edu as well.
  23.  
  24. These digests are also available via email.  Just send a note saying that you
  25. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  26. automatically receive each new digest as it is created.
  27.  
  28. The digest is a collection of articles from the internet newsgroup comp.sys.
  29. mac.programmer.  It is designed for people who read c.s.m.p. semi-regularly
  30. and want an archive of the discussions.  If you don't know what a newsgroup
  31. is, you probably don't have access to it.  Ask your systems administrator(s)
  32. for details.  (This means you can't post questions to the digest.)
  33.  
  34. The articles in these digests are taken directly from comp.sys.mac.programmer.
  35. They are not edited; all articles included in this digest are in their original
  36. posted form.  The only articles that are -not- included in these digests are
  37. those which didn't receive any replies (except those that give information
  38. rather than ask a question).  All replies to each article are concatenated
  39. onto the original article in the order in which they were received.  Article
  40. threads are not added to the digests until the last article added to the
  41. thread is at least one month old (this is to ensure that the thread is dead
  42. before adding it to the digests).
  43.  
  44. Send administrative mail to mkelly@cs.uoregon.edu.
  45.  
  46. -------------------------------------------------------
  47.  
  48. Subject: Fortran callable graphing library wanted for Mac
  49. From: visser@n6batws1.itwol.bhp.com.au (Martin Visser)
  50. Date: 12 May 92 17:01:01 +1000
  51. Organization: BHP Steel - Slab and Plate Products Division - Port Kembla AUSTRALIA
  52.  
  53. G'day,
  54.  
  55. Our Industrial Engineering group are in the business of analysing our plant
  56. processes and systems, interpreting information for management. Having recently
  57. acquired some Quadra's they are setting up a development environment. The 
  58. application requires custom data analysis; to this end Fortran is the preferred
  59. tool.
  60. We currently use Absoft's Mac Fortran /020 soon to upped to Mac Fortran II. What
  61. we want is good quality package that is Fortran-callable that will provide good
  62. graphical presentation of data. This library should be able to all the 
  63. formatting, axis annotation, point plotting etc. Currently only 2-D line graphs
  64. and histograms are necessary, but 3-D styles, contours etc. are likely to be a 
  65. future requirement. It must be able to be linked into the fortran program into a
  66. stand-alone package. Also previewing on the screen, LaserWriter and HP ColorInkjet output is required.
  67.  
  68. We require information on package availabilit, performance, etc. fairly urgently
  69. . I will summarise to the net on results.
  70.  
  71. Thanks in advance, Martin.
  72.  
  73.  
  74. - -- 
  75.    /\/\     :  Martin Visser - Electrical / Software Engineer 
  76.   / / /\    :  Engineering Technology Department
  77.  / / /  \   :  BHP Steel - Slab and Plate Products Division
  78. / / / /\ \  :  P.O. Box 1854 Wollongong NSW 2500 AUSTRALIA
  79. \ \/ / / /  :  Phone    +61-42-75-3852
  80.  \  / / /   :  E-mail   visser@n6batws1.itwol.bhp.com.au
  81.   \/\/\/
  82.  
  83. ---------------------------
  84.  
  85. From: hardin@dino.cad.mcc.com (John Hardin)
  86. Subject: Delete menu items?
  87. Date: 11 May 92 18:11:49 GMT
  88. Organization: MCC CAD Program, Austin, Texas
  89.  
  90. I'm dynamically computing the items that need to be displayed in a
  91. popup menu.  When the list needs to be changed, I need to delete the
  92. existing list before creating the new one.  I've been using AppendMenu
  93. to add items, but don't see any analog for deleting menu items.  Am I
  94. missing something?  Perhaps I need to throw the entire menu away and
  95. recreate it?  (This seems a little heavy-handed.)
  96.  
  97. Thanks in advance for any help.
  98.  
  99. - -jwh
  100.  
  101. - --
  102. John W. Hardin            phone:  (512)338-3535
  103. MCC                email:  hardin@mcc.com
  104. 3500 W. Balcones Center Dr  fax:    (512)338-3897
  105. Austin, TX  78759-6509        uucp:   ...!cs.utexas.edu!milano!cadillac!hardin
  106.  
  107. +++++++++++++++++++++++++++
  108.  
  109. From: zobkiw@world.std.com (Joe Zobkiw)
  110. Date: 12 May 92 23:53:18 GMT
  111. Organization: The World Public Access UNIX, Brookline, MA
  112.  
  113. To delete an item from a menu you should use:
  114.  
  115. DelMenuItem(theMenu, itemID);
  116.  
  117. - -- 
  118. - -- joe zobkiw                             Internet: zobkiw@world.std.com
  119. - --                                             AOL: AFL Zobkiw  
  120. - -- mac.synthesis.MIDI.THINK C.OOP.asm          CI$: 70712,515 
  121. - -- communications.networks.cool tunes...
  122.  
  123. ---------------------------
  124.  
  125. Subject: Where can I find Oberon?
  126. From: peppy@desire.wright.edu
  127. Date: 12 May 92 12:44:28 EST
  128. Organization: Wright State University 
  129.  
  130.  
  131.     What is the FTP address where I can find Oberon?
  132.  
  133.     thanks in advance.
  134.  
  135.  
  136. ---------------------------
  137.  
  138. Subject: Format of a mac Disk?
  139. From: harvey_a@kosmos.wcc.govt.nz
  140. Date: 13 May 92 22:59:37 GMT
  141. Organization: Wellington City Council, Wellington, NZ
  142.  
  143. I am trying to get some detailed information on the format of a macintosh disk
  144. (ie sector gap length, steprate of the drives, etc, NOT the layout info, (ie
  145. data layout, which is in inside mac.)
  146.  
  147. Please could someone either mail me with the info, or post it here, or tell me
  148. whereabouts I can get hold of it. (preferably not book refs, as they can be
  149. difficult to get hold of).
  150.  
  151. I hope I am asking in the right group, if not tell me where I should ask.
  152.  
  153. Thanks in advance...
  154.  
  155. ---------------------------
  156.  
  157. From: ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group)
  158. Subject: Getting a Files full Pathname
  159. Organization: The Sapphire Group
  160. Date: Fri, 1 May 1992 03:37:52 GMT
  161.  
  162. This is probably a stupid question but I can't seem to figure it out.
  163. I need the full pathname of a file returned by lets say SFGetFile.  
  164. SFGetFile will give me the file name and the volume reference but i need
  165. the ':' separated full pathname of the file selected.
  166.  
  167. I am working with System 7 under A/UX and I need to convert the file name
  168. to an A/UX file name(changing ':' to '/').
  169.  
  170. Thanks in advance.
  171.  
  172.                                 ________________________________
  173.                                 Kristopher L. Tyra
  174.                                 The Sapphire Group
  175.                                 (919) 481-9052
  176.                                 ktyra%saphire@concert.net
  177.                                 Consultants - A/UX, OSF, AIX/ESA,
  178.                                               Sun, X-Windows, MacOS
  179.  
  180.  
  181. +++++++++++++++++++++++++++
  182.  
  183. From: keith@taligent.com (Keith Rollin)
  184. Date: 1 May 92 18:50:27 GMT
  185. Organization: Taligent
  186.  
  187. In article <1992May1.033752.15622@rock.concert.net>, ktyra@rock.concert.net
  188. (Kristopher L Tyra -- The Sapphire Group) writes:
  189. > This is probably a stupid question but I can't seem to figure it out.
  190. > I need the full pathname of a file returned by lets say SFGetFile.  
  191. > SFGetFile will give me the file name and the volume reference but i need
  192. > the ':' separated full pathname of the file selected.
  193. > I am working with System 7 under A/UX and I need to convert the file name
  194. > to an A/UX file name(changing ':' to '/').
  195.  
  196. I don't want to be rude, but I do want to put this firmly: No, you _don't_ need
  197. "the full pathname of a file returned by lets say SFGetFile." There are many
  198. reasons why getting a full pathname is bad, including:
  199.  
  200. - - it makes your program inefficient copying around that string.
  201. - - it's possible to generate a string longer than the File Manager can handle.
  202. - - it's inefficient for the File Manager, because it will just have to reconvert
  203. the pathname back into the vRefNum/dirID/filename that it handed you in the
  204. first place.
  205. - - there are compatibility issues like with A/UX.
  206. - - there are issues with trying to save the pathname to a file.
  207.  
  208. If you think you need to get a full pathname, post your reason here; it's likely
  209. that we can show you a better way. Additionally, take a look at Technote #238.
  210. It shows how to generate a full pathname, and also tells you why you shouldn't
  211. do it.
  212.  
  213. - --
  214. Keith Rollin
  215. Phantom Programmer
  216. Taligent, Inc.
  217.  
  218. +++++++++++++++++++++++++++
  219.  
  220. From: Joe.Francis@dartmouth.edu (Joe Francis)
  221. Date: 1 May 92 20:36:08 GMT
  222. Organization: Dartmouth College, Hanover, NH
  223.  
  224. In article <66425@apple.Apple.COM>
  225. keith@taligent.com (Keith Rollin) writes:
  226.  
  227. > I don't want to be rude, but I do want to put this firmly: No, you _don't_ need
  228. > "the full pathname of a file returned by lets say SFGetFile." There are many
  229. > reasons why getting a full pathname is bad, including:
  230.  
  231. Then don't be rude!  :-)  Yes, you _may_ need the full pathname.
  232.  
  233. There is an excellent reason why a program would need to get the full
  234. pathname: to display (or print) it for the user!  Nowhere did
  235. Kristopher Tyra say that it would be used as input for the hapless File
  236. Manager.
  237.  
  238. +++++++++++++++++++++++++++
  239.  
  240. From: jhl@naif.jpl.nasa.gov (Jay H. Lieske)
  241. Date: 1 May 92 21:59:25 GMT
  242. Organization: Jet Propulsion Laboratory
  243.  
  244. In article <66425@apple.Apple.COM> keith@taligent.com (Keith Rollin) writes:
  245. >
  246. >I don't want to be rude, but I do want to put this firmly: No, you _don't_
  247. need
  248. >"the full pathname of a file returned by lets say SFGetFile." 
  249. >[..]
  250. >
  251. >If you think you need to get a full pathname, post your reason here; it's
  252. likely
  253. >that we can show you a better way.
  254. >
  255. >--
  256. >Keith Rollin
  257. >Phantom Programmer
  258. >Taligent, Inc.
  259. >
  260. >
  261.     Sounds a bit judgmental to me, Keith.  Hope your new book isn't that way.  One
  262. reason I extract full path names is for archival purposes.  I execute programs
  263. and let the user select the input file.  Then in the output file I give the
  264. full path name to the input file.  If I didn't do that I wouldn't know what
  265. data file was processed etc.
  266.  
  267. Jay H. Lieske                                            jhl@naif.jpl.nasa.gov
  268. Jet Propulsion Laboratory
  269. Pasadena, CA 91109
  270.  
  271. +++++++++++++++++++++++++++
  272.  
  273. From: keith@taligent.com (Keith Rollin)
  274. Date: 2 May 92 21:44:31 GMT
  275. Organization: Taligent
  276.  
  277. In article <1992May1.215925.9833@elroy.jpl.nasa.gov>, jhl@naif.jpl.nasa.gov (Jay
  278. H. Lieske) writes:
  279. > In article <66425@apple.Apple.COM> keith@taligent.com (Keith Rollin) writes:
  280. > >
  281. > >I don't want to be rude, but I do want to put this firmly: No, you _don't
  282. > _need
  283. > >"the full pathname of a file returned by lets say SFGetFile." 
  284. > >[..]
  285. > >
  286. > >If you think you need to get a full pathname, post your reason here; it's
  287. > likely
  288. > >that we can show you a better way.
  289. > >
  290. > >
  291. >     Sounds a bit judgmental to me, Keith.  Hope your new book isn't that way. 
  292. One
  293. > reason I extract full path names is for archival purposes.  I execute programs
  294. > and let the user select the input file.  Then in the output file I give the
  295. > full path name to the input file.  If I didn't do that I wouldn't know what
  296. > data file was processed etc.
  297.  
  298. Perhaps it is judgemental. There was no way for me to know what your purpose
  299. was, and there's no way I can think of every reason why someone would want to
  300. generate a full pathname and categorically say "You're wrong." However, years of
  301. professional experience in supporting developers have shown me that the majority
  302. of people asking this question are asking it for the wrong reason. That's why I
  303. said it was "likely" we can show you a better way.
  304.  
  305. I'm still not sure if you need to generate a full pathname for your task. If you
  306. need to create output for human eyes, then generating a full pathname is OK. For
  307. instance, MPW puts full pathnames in window titles and its Window menu, which is
  308. OK. However, if you need to generate output for a computer's eyes, then you
  309. should take a different approach. Instead, save the volume name, directory ID,
  310. and file name. When running under System 7.0, save an alias to the file.
  311.  
  312. My philosophy on tech support is to tell people the dangers of what they want to
  313. do, and then tell them how to do it. That's why I pointed you toward Technote
  314. #238. I leave the final determination up to you.
  315.  
  316. - --
  317. Keith Rollin
  318. Phantom Programmer
  319. Taligent, Inc.
  320.  
  321.  
  322. +++++++++++++++++++++++++++
  323.  
  324. From: ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group)
  325. Date: 4 May 92 13:18:18 GMT
  326. Organization: The Sapphire Group
  327.  
  328. In article <1992May1.203608.10901@dartvax.dartmouth.edu> Joe.Francis@dartmouth.edu (Joe Francis) writes:
  329. >In article <66425@apple.Apple.COM>
  330. >keith@taligent.com (Keith Rollin) writes:
  331. >
  332. >> I don't want to be rude, but I do want to put this firmly: No, you _don't_ need
  333. >> "the full pathname of a file returned by lets say SFGetFile." There are many
  334. >> reasons why getting a full pathname is bad, including:
  335. >
  336. >Then don't be rude!  :-)  Yes, you _may_ need the full pathname.
  337. >
  338. >There is an excellent reason why a program would need to get the full
  339. >pathname: to display (or print) it for the user!  Nowhere did
  340. >Kristopher Tyra say that it would be used as input for the hapless File
  341. >Manager.
  342.  
  343. Thank you.  I couldn't have said it better.  The full path is being used for
  344. an A/UX backup/restore software package.  It does not use the MacOS File
  345. manager but rather the A/UX Filesystem.  SFGetFile does not actually change
  346. the A/UX process current working directory; therefore, a file selected by
  347. SFGetFile would not have been stat'd correctly by the A/UX filesystem. 
  348. And yes I must use A/UX to get permission information NOT MacOS.
  349.  
  350. Sorry, that the question was so simple.  I didn't look at SC18 as it was 
  351. pointed out to me.  I am Unix developer not MacOS so the mac file system
  352. was a bit strange to me.  Thanks for those who responded and especially to
  353. Mats Wichmann who sent me the code - I only had to change the memory 
  354. management and the directory seperator at it worked great.
  355.  
  356. To keith@taligent: I had high hopes for the taligent project.  I believe that
  357. those hopes have been dashed.  Nugh said.
  358.  
  359.                                 ________________________________
  360.                                 Kristopher L. Tyra
  361.                                 The Sapphire Group
  362.                                 (919) 481-9052
  363.                                 ktyra%saphire@concert.net
  364.                                 Consultants - A/UX, OSF, AIX/ESA,
  365.                                               Sun, X-Windows, MacOS
  366.  
  367. +++++++++++++++++++++++++++
  368.  
  369. From: ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group)
  370. Date: 4 May 92 18:29:11 GMT
  371. Organization: The Sapphire Group
  372.  
  373.  
  374. Appoligies to Charles Cranston:  I reported that Mats Wichmann sent me
  375. the correct stuff but it was Charles.  Thanks again.
  376.  
  377.                                 ________________________________
  378.                                 Kristopher L. Tyra
  379.                                 The Sapphire Group
  380.                                 (919) 481-9052
  381.                                 ktyra%saphire@concert.net
  382.                                 Consultants - A/UX, OSF, AIX/ESA,
  383.                                               Sun, X-Windows, MacOS
  384.  
  385. +++++++++++++++++++++++++++
  386.  
  387. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  388. Date: 4 May 92 18:44:29 GMT
  389. Organization: Kalamazoo College
  390.  
  391. ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group) writes:
  392. >Joe.Francis@dartmouth.edu (Joe Francis) writes:
  393. >>keith@taligent.com (Keith Rollin) writes:
  394. >>
  395. >>> I don't want to be rude, but I do want to put this firmly:
  396. >>> No, you _don't_ need
  397. >>> "the full pathname of a file returned by lets say SFGetFile."
  398. >>
  399. >>Then don't be rude!  :-)  Yes, you _may_ need the full pathname.
  400. >
  401. >Thank you.  I couldn't have said it better.  The full path is being used for
  402. >an A/UX backup/restore software package.
  403. >And yes I must use A/UX to get permission information NOT MacOS.
  404.  
  405. Excuse my ignorance with A/UX (never used it), but the 7.0 File Manager
  406. "introduces a number of special-purpose functions that you can use
  407. to...manipulate access-control privileges in foreign file systems."
  408. Now that A/UX 3.0 is out, can you use the MacOS to get Unix's permission
  409. information?  Read up on PBGetForeignPrivs().
  410.  
  411. Can you use the Alias Manager to keep track of these files?  It will do
  412. a very good job, and with very little coding.  Read the description of
  413. the algorithm used for the "fast search"--it sounds like it's right up
  414. your alley.  If you _can_ use the Toolbox's built-in file tracking,
  415. instead of clutching to a full path and hoping the user never changes
  416. folders' names, you should.
  417.  
  418. >To keith@taligent: I had high hopes for the taligent project.  I believe that
  419. >those hopes have been dashed.  Nugh said.
  420.  
  421. Speaking of _rude_!
  422.  
  423. Keith, I believe I speak for (nearly) everyone on csmp when I say:  we
  424. appreciate the time you take to answer questions in this newsgroup, and
  425. we hope Kristopher's comments don't discourage you from continuing to
  426. do so.
  427. - -- 
  428.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  429.  "Son, I am able," she said, "though you scare me." "Watch," said I,
  430.  "beloved," I said, "watch me scare you though." Said she, "able am I, son."
  431.  
  432. +++++++++++++++++++++++++++
  433.  
  434. From: ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group)
  435. Date: 4 May 92 21:05:39 GMT
  436. Organization: The Sapphire Group
  437.  
  438. In article <1992May4.184429.19862@hobbes.kzoo.edu> k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  439.  
  440. >
  441. >Excuse my ignorance with A/UX (never used it), but the 7.0 File Manager
  442. >"introduces a number of special-purpose functions that you can use
  443. >to...manipulate access-control privileges in foreign file systems."
  444. >Now that A/UX 3.0 is out, can you use the MacOS to get Unix's permission
  445. >information?  Read up on PBGetForeignPrivs().
  446. >
  447. >Can you use the Alias Manager to keep track of these files?  It will do
  448. >a very good job, and with very little coding.  Read the description of
  449. >the algorithm used for the "fast search"--it sounds like it's right up
  450. >your alley.  If you _can_ use the Toolbox's built-in file tracking,
  451. >instead of clutching to a full path and hoping the user never changes
  452. >folders' names, you should.
  453.  
  454. Interesting, I will look into this for some future work with mixing
  455. A/UX and Mac.  Thanks for the info.  I'm afraid that it won't help much with
  456. the current project.  The application is a MacOS UI for an
  457. already existing Unix application using an Object Class that requires 
  458. Unix filenames and filesystems.  It is not designed to run under 
  459. standalone MacOS only A/UX.  Clients wishes not mine.  Thanks again for 
  460. the info.
  461.  
  462. >
  463. >>To keith@taligent: I had high hopes for the taligent project.  I believe that
  464. >>those hopes have been dashed.  Nugh said.
  465. >
  466. >Speaking of _rude_!
  467. >
  468. >Keith, I believe I speak for (nearly) everyone on csmp when I say:  we
  469. >appreciate the time you take to answer questions in this newsgroup, and
  470. >we hope Kristopher's comments don't discourage you from continuing to
  471. >do so.
  472. >-- 
  473. As a _hopefully_ last comment on this situation, my appoligies to Kieth are 
  474. in order - that was a bit of a harsh statement.  I was trying to drive at
  475. a point of _assumptions_.  By assuming that what Keith says represents what
  476. Taligent is or isn't is as _wrong_ as to assume that a question asked on the
  477. net is made by someone who doesn't know anything about what they are 
  478. asking.
  479.  
  480. With I believe the success of A/UX, this group will find more questions
  481. of mixed environments asked.  I hope that Keith and others of this group
  482. will continue to answer these questions with some understanding.  My 
  483. sincere appoligies to Kieth and anyone who may have been insulted by my 
  484. rash statement.
  485.  
  486.             ______________________________________
  487.             Kristopher L. Tyra
  488.             ktyra%saphire@concert.net
  489.  
  490. +++++++++++++++++++++++++++
  491.  
  492. From: mxmora@unix.sri.com (Matthew Xavier Mora)
  493. Date: 4 May 92 23:31:23 GMT
  494. Organization: SRI International
  495.  
  496.  
  497.  
  498. In article  Keith Rollin, keith@taligent.com writes:
  499.  
  500.  
  501. >If you think you need to get a full pathname, post your reason here;
  502. it's likely
  503. >that we can show you a better way. Additionally, take a look at Technote
  504. #238.
  505. >It shows how to generate a full pathname, and also tells you why you
  506. shouldn't
  507. >do it.
  508.  
  509. What if you are writing a backup application? Don't you need to know the
  510. full pathname to be able to restore an erased volume? Or does just
  511. knowing the
  512. DirId magically recreate the folder hiearchy? 
  513. - -- 
  514.  
  515. - ---------------------------------------------------------------------
  516. - ------
  517. |Matthew Mora                                          
  518. Matt_Mora@QM.sri.com |
  519. |SRI International                                      
  520. mxmora@unix.sri.com |
  521.  
  522. - ---------------------------------------------------------------------
  523. - ------
  524.  
  525. +++++++++++++++++++++++++++
  526.  
  527. From: mxmora@unix.sri.com (Matthew Xavier Mora)
  528. Date: 4 May 92 23:50:40 GMT
  529. Organization: SRI International
  530.  
  531.  
  532. In article  Jamie R. McCarthy, k044477@hobbes.kzoo.edu writes:
  533.  
  534. >ktyra@rock.concert.net (Kristopher L Tyra -- The Sapphire Group) writes:
  535. >
  536. >>To keith@taligent: I had high hopes for the taligent project.  I
  537. believe that
  538. >>those hopes have been dashed.  Nugh said.
  539. >
  540. >Speaking of _rude_!
  541. >
  542. >Keith, I believe I speak for (nearly) everyone on csmp when I say:  we
  543. >appreciate the time you take to answer questions in this newsgroup, and
  544. >we hope Kristopher's comments don't discourage you from continuing to
  545. >do so.
  546.  
  547. Wow! What is this? Bash on Keith week? First it was Tim, now its
  548. Kristopher.
  549. Keith, I would like to ditto the remarks of Jamie. 
  550.  
  551. Oh by the way, didn't you just write a book? Please tell me ALL about it.
  552. (That should eat up some more of Tim's precious bandwidth) :-)
  553.  
  554.  
  555. - -- 
  556.  
  557. - ---------------------------------------------------------------------
  558. - ------
  559. |Matthew Mora                                          
  560. Matt_Mora@QM.sri.com |
  561. |SRI International                                      
  562. mxmora@unix.sri.com |
  563. |"Selling skin, selling god, the numbers look the same on their credit
  564. card."|
  565. |                                        "Queensryche - Operation
  566. Mindcrime" |
  567.  
  568. - ---------------------------------------------------------------------
  569. - ------
  570.  
  571. +++++++++++++++++++++++++++
  572.  
  573. From: Christopher Tate <CXT105@psuvm.psu.edu>
  574. Date: Monday, 4 May 1992 23:57:02 EDT
  575. Organization: Penn State University
  576.  
  577. In article <34806@unix.SRI.COM>, mxmora@unix.sri.com (Matthew Xavier Mora) says:
  578. >
  579. >What if you are writing a backup application? Don't you need to know the
  580. >full pathname to be able to restore an erased volume? Or does just
  581. >knowing the
  582. >DirId magically recreate the folder hiearchy?
  583.  
  584. I don't imagine the DirID gives you any heirarchy information, but you
  585. could simply store the name of each file's parent folder.  Or, your could
  586. structure your backup image in such a way that you know how to descend/
  587. ascend through the directory structure as you rebuild from the image.
  588. This has the added advantage of requiring very little additional info
  589. beyond each file's name and contents.
  590.  
  591. [For example, if you topsort your hierarchy in some way (depth-before-
  592. breadth, for example) you can reconstruct the hierarchy directly from
  593. the ordering of files/folders in the sorted list, given only the valences
  594. of each folder.]
  595.  
  596. - -------
  597. Christopher Tate     | Cryptogram #24:
  598. cxt105@psuvm.psu.edu |
  599. CXT105@PSUVM.BITNET  | LPL UTE ZCTX FYGF XYDC UTE SDGSSGCRD FYD BDFFDSO
  600. - ---------------------| PC 'RDTSRD YDSNDSF XGBZDS NEOY' UTE RDF 'YERD
  601. Send me the answer!  | NDSODSZ SDNDB XGSFYTR?'
  602.  
  603. +++++++++++++++++++++++++++
  604.  
  605. From: aep@world.std.com (Andrew E Page)
  606. Date: 13 May 92 15:14:41 GMT
  607. Organization: The World Public Access UNIX, Brookline, MA
  608.  
  609. /*
  610. * The Follwing will generate full pathname for you
  611. * let me know if you have problems with this.  excuse
  612. * the netnews unfriendly formatting.  
  613. */
  614.  
  615.  
  616. #include <Types.h>
  617. #include <Files.h>
  618. #include <Memory.h>
  619. #include <ToolUtils.h>
  620.  
  621. /*
  622. 91/07/11    FullPathname by Andrew E. Page.  Function returns a handle to a string
  623. ode resource */
  624.  
  625.     /*
  626.     * Initialize the PB fields
  627.     */
  628.  
  629.     F.hFileInfo.ioNamePtr = fName ;    /* pascal string for the name, and also subsequent storage on calls */
  630.     F.hFileInfo.ioVRefNum = vRef ;    /* volume reference (Gotten from SFGetFile perhaps */
  631.     F.hFileInfo.ioCompletion = 0L ;    /* initialize this field or get a Serious BOMB */
  632.     F.hFileInfo.ioFDirIndex = 0 ;        /* for the first call only.  Get CatInfo based on ioNamePtr and ioVRefNum */
  633.     F.hFileInfo.ioDirID = 0 ;                /* clear this field to ensure PBGetCatInfo will not use it */
  634.     
  635.     for( ;; )
  636.         {
  637.         err = PBGetCatInfo(&F,0) ;
  638.         if( err )
  639.             break ;
  640.         
  641.         /*
  642.         * Insert the directory level into the front of the string
  643.         */
  644.         
  645.         Munger(theString, 0, 0L, 0, &fName[1], fName[0]) ;
  646.  
  647.         /*
  648.         * Insert a colon in front of the Directory Entry
  649.         */
  650.  
  651.         Munger(theString, 0, 0L, 0, &colon, 1) ;
  652.  
  653.         F.dirInfo.ioDrDirID = F.dirInfo.ioDrParID ; /* get the ioDrDirID of the PARENT directory (the next level up) */
  654.         F.hFileInfo.ioFDirIndex = -1 ;    /* for all subsequent calls.  GetCatInfo based on ioDrDirID */
  655.         }
  656.         
  657.     /*
  658.     * The last entry will be the Volume name which should not have a colon in front of it
  659.     */
  660.         
  661.     Munger(theString, 0, 0L, 1, fName, 0) ;
  662.  
  663.     return theString ;
  664.     
  665. } /* end of FullPathName */
  666.  
  667.  
  668. - -- 
  669. Andrew E. Page CTO(Warrior Poet)|   Decision and Effort The Archer and Arrow
  670. DSP Ironworks                   |     The difference between what we are
  671. Macintosh and DSP Technology    |           and what we want to be.
  672.  
  673. ---------------------------
  674.  
  675. From: hull@ibmb0.cs.uiuc.edu (David Hull)
  676. Subject: C (C++) Prettyprinter
  677. Organization: University of Illinois at Urbana-Champaign
  678. Date: Mon, 4 May 1992 21:47:29 GMT
  679.  
  680. OK, what do YOU use to print out YOUR C code?
  681.  
  682. I've written some C++ code that I need to turn in to my advisor in a
  683. few days and I think I would earn extra brownie points if it were
  684. formatted really nicely, with bold keywords, italicized comments, etc.
  685.  
  686. I've tried PrettyC 1.51, but it keeps crashing on me.  If I could
  687. get it to work it would be almost perfect.  Is there a later version?
  688.  
  689. - -David Hull
  690.  
  691. +++++++++++++++++++++++++++
  692.  
  693. From: hp48sx@wuarchive.wustl.edu (HP48SX Archive Maintainer)
  694. Organization: Washington University in Saint Louis, Missouri USA
  695. Date: Mon, 4 May 1992 23:17:43 GMT
  696.  
  697. hull@ibmb0.cs.uiuc.edu (David Hull) writes:
  698.  
  699. >OK, what do YOU use to print out YOUR C code?
  700.  
  701. >I've written some C++ code that I need to turn in to my advisor in a
  702. >few days and I think I would earn extra brownie points if it were
  703. >formatted really nicely, with bold keywords, italicized comments, etc.
  704.  
  705. >I've tried PrettyC 1.51, but it keeps crashing on me.  If I could
  706. >get it to work it would be almost perfect.  Is there a later version?
  707.  
  708. >-David Hull
  709.  
  710. There are some C macros for your favourite word processor (read Nisus).
  711. I am not sure if they are on the Nisus site, or if you have to get them
  712. from jon@weber.ucsd.edu   They do quite a nice job.
  713.  
  714. The ultimate solution would still be to write code so good that the
  715. layout doesn't matter :-)
  716. - --
  717. Povl H. Pedersen             hp48sx@wuarchive.wustl.edu
  718. HP48sx archive maintainer
  719.  
  720. All Opinions (C) Copyright the Integalactic Thought Association
  721.  
  722. +++++++++++++++++++++++++++
  723.  
  724. From: ksand@apple.com (Kent Sandvik)
  725. Date: 7 May 92 19:30:38 GMT
  726. Organization: MacDTS Mongols
  727.  
  728. In article <1992May4.214729.13127@sunb10.cs.uiuc.edu>, hull@ibmb0.cs.uiuc.edu
  729. (David Hull) writes:
  730. > OK, what do YOU use to print out YOUR C code?
  731. > I've written some C++ code that I need to turn in to my advisor in a
  732. > few days and I think I would earn extra brownie points if it were
  733. > formatted really nicely, with bold keywords, italicized comments, etc.
  734. > I've tried PrettyC 1.51, but it keeps crashing on me.  If I could
  735. > get it to work it would be almost perfect.  Is there a later version?
  736.  
  737. Pretty C nearly works with C++, it does not like Quadras (place the application
  738. as part of a possible compability CDEV listing), it does not like parsing
  739. function prototypes with references ( foo(var&)), it is cranky about too
  740. many keywords added to its list. Otherwise I could get it working somehow
  741. with pure C++ code.
  742.  
  743. After printing out C++ code with Pretty C for two days I realized that it
  744. looked far too 'flashy', and bold/italics does not always make source 
  745. code look good. Actually I use SaveATree 1.5 nowadays with two-column
  746. formatting and Palatino-6pt as a font, that's nice and simple.
  747.  
  748. As for good formatters, when I was a UNIX hacker I used indent a lot,
  749. printed out whole BSD source code listings in postscript using it. That 
  750. tool was really nice, has anyone ported it to MPW?
  751.  
  752. Cheers,
  753. Kent
  754.  
  755. +++++++++++++++++++++++++++
  756.  
  757. From: tom@dtint.uucp (Thomas R. Kimpton)
  758. Date: 12 May 92 22:41:18 GMT
  759. Organization: Digital Technology, International
  760.  
  761.  
  762. I haven't done much printing of program listings since I went to
  763. work here, they have 21" monitors for the Mac's allowing two full
  764. pages side by side.  But when I was working for a unix company
  765. we used a program called "vgrind".  Just looking on our Sun I see
  766. that it is available there and supports C and Pascal (among others).
  767. The man page seems to indicate that it is "customizable" in the
  768. form of definition files, so you could probably make it work with
  769. C++.  I remember it printing files out in a really nice manner, and
  770. even being able to rotate the pages and put two pages on a single
  771. sheet of paper.
  772.  
  773. Tom.
  774.  
  775. - -- 
  776. - ---
  777. Tom Kimpton                            tom@dtint.dtint.com
  778. Digital Technology Int.                (801)226-2984    
  779. 500 W. 1200 South, Orem UT, 84057      FAX (801) 226-8438
  780.  
  781. ---------------------------
  782.  
  783. From: morgan@duncan.cs.utk.edu (R. Withers Morgan)
  784. Subject: MacTutor version 2.0
  785. Date: 8 May 92 13:02:34 GMT
  786. Organization: Computer Science Dept, University of Tennesee, Knoxville
  787.  
  788. I just picked up the April/May issue (vol 8, no 1) of MacTutor 2.0
  789.  
  790. A company by the name of XPlain has purchased the rights to the
  791. magazine, and has just released their first issue.  The last issue
  792. was (I think) the Nov '92.
  793.  
  794. Subscribers should be receiving their copies, with adjustments to 
  795. their expiration dates to reflect the missing issues.
  796.  
  797. MacTutor 2.0 is, of course, new and improved (aren't they all), but
  798. it still looks much the same to me.  The layout is cleaner, and there's
  799. some use of color, but still the same basic content.  It sounds like
  800. (from reading the editorial) that these guys have some big plans for
  801. MacTutor.
  802.  
  803. So now you know...
  804.  
  805. Unfortunately, I forgot to bring the phone number to work with me.
  806. If someone else has it, please post, otherwise I'll do it myself
  807. tonight.
  808.  
  809. Withers
  810.  
  811. +++++++++++++++++++++++++++
  812.  
  813. From: /home/imperial/mes (Mark Stockwell)
  814. Organization: Shell Development Co., Bellaire Research Center, Houston TX
  815. Date: Sun, 10 May 92 19:28:39 GMT
  816.  
  817. MacTutor can be reached at (310)575-4343. According to the first issue which 
  818. is now on newstands in Houston, at least, they can also be reached on the 
  819. Internet at: MacTutor@applelink.apple.com.
  820.  
  821. Mark Stockwell
  822.  
  823.  
  824.  
  825.  
  826. +++++++++++++++++++++++++++
  827.  
  828. From: jpb@umbio.med.miami.edu (Joe Block)
  829. Date: 12 May 92 13:50:19 GMT
  830. Organization: Gene Police - Interstellar Enforcement Division, Sol III Office
  831.  
  832. Does anyone know the details of how Xplain acquired MacTutor?
  833. - -- 
  834. Joe Block (jpb@umbio.med.miami.edu)
  835. "They that can give up essential liberty to obtain a little temporary safety
  836.  deserve neither liberty nor safety." - Benjamin Franklin
  837.                                         Historical Review of Pennsylvania, 1759
  838.  
  839. ---------------------------
  840.  
  841. From: ccb@wam.umd.edu (Chrome Cboy)
  842. Subject: New Developer Tool from Apple & AT&T?
  843. Organization: University of Maryland at College Park
  844. Date: Wed, 6 May 1992 16:01:11 GMT
  845.  
  846. Howdy all!
  847.     I was reading through the Washington Post yesterday and ran across this
  848. in the Business Digest section:
  849.  
  850. "Apple will use technology developed by AT&T's Bell Labs that could radically
  851. speed up a time-consuming step in developing computer programs, the companies
  852. said."
  853.  
  854. Real informative, eh? :-) Anyway, I haven't seen a press release from Apple, so
  855. I was wondering if anyone out there could enlighten me as to what the
  856. technology is. Gotta try and eliminate those "time-consuming step[s]," don'cha
  857. know? TIA...
  858. - -- 
  859. "Seeing much, suffering much            -Blake Sobiloff (ccb@wam.umd.edu)
  860. and studying much, are the               Human-Computer Interaction Lab
  861. three pillars of learning."              Department of Psychology
  862.          -Disraeli                       University of Maryland
  863.  
  864. +++++++++++++++++++++++++++
  865.  
  866. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  867. Date: 6 May 92 17:24:09 GMT
  868. Organization: University of Illinois at Urbana
  869.  
  870. ccb@wam.umd.edu (Chrome Cboy) writes:
  871.  
  872. >Howdy all!
  873. >    I was reading through the Washington Post yesterday and ran across this
  874. >in the Business Digest section:
  875.  
  876. >"Apple will use technology developed by AT&T's Bell Labs that could radically
  877. >speed up a time-consuming step in developing computer programs, the companies
  878. >said."
  879.  
  880. You expecting them to announce a new incremental compiler/dynamic linker? 
  881. Given typical newspaper computer illiteracy, I wouldn't be surprised if they
  882. are just referring to CFront (which has sped up my time-consuming steps a
  883. whole lot, I tell you - NOT).
  884.  
  885. >Real informative, eh? :-) Anyway, I haven't seen a press release from Apple, so
  886. >I was wondering if anyone out there could enlighten me as to what the
  887. >technology is. Gotta try and eliminate those "time-consuming step[s]," don'cha
  888. >know? TIA...
  889. - -- 
  890. Mark Lanett, NCSA Software Development - mlanett@uiuc.edu
  891.  
  892. +++++++++++++++++++++++++++
  893.  
  894. From: ccb@wam.umd.edu (Chrome Cboy)
  895. Organization: University of Maryland at College Park
  896. Date: Wed, 6 May 1992 23:16:46 GMT
  897.  
  898. In article <mlanett.705173049@void> mlanett@void.ncsa.uiuc.edu (Mark Lanett) writes:
  899. >ccb@wam.umd.edu (Chrome Cboy) writes:
  900. >>Howdy all!
  901. >>    I was reading through the Washington Post yesterday and ran across this
  902. >>in the Business Digest section:
  903. >>"Apple will use technology developed by AT&T's Bell Labs that could radically
  904. >>speed up a time-consuming step in developing computer programs, the companies
  905. >>said."
  906. >You expecting them to announce a new incremental compiler/dynamic linker? 
  907. >Given typical newspaper computer illiteracy, I wouldn't be surprised if they
  908. >are just referring to CFront (which has sped up my time-consuming steps a
  909. >whole lot, I tell you - NOT).
  910.  
  911. Well, it wouldn't have been to hard to say "...radically speed up compiling, a
  912. time-consuming step...," but your point about computer illiteracy is well-
  913. taken. <sigh> :-)
  914. - -- 
  915. "Seeing much, suffering much            -Blake Sobiloff (ccb@wam.umd.edu)
  916. and studying much, are the               Human-Computer Interaction Lab
  917. three pillars of learning."              Department of Psychology
  918.          -Disraeli                       University of Maryland
  919.  
  920. +++++++++++++++++++++++++++
  921.  
  922. From: lsr@taligent.com (Larry Rosenstein)
  923. Date: 12 May 92 17:47:55 GMT
  924. Organization: Taligent, Inc.
  925.  
  926. In article <mlanett.705173049@void>, mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  927. wrote:
  928. > You expecting them to announce a new incremental compiler/dynamic linker? 
  929. > Given typical newspaper computer illiteracy, I wouldn't be surprised if they
  930. > are just referring to CFront (which has sped up my time-consuming steps a
  931.  
  932. >From what I've read, the announcement refers to some way of converting object
  933. code from one processor to another.  (In this case 68000 binaries to PowerPC
  934. binaries.)
  935.  
  936. Larry
  937.  
  938. ---------------------------
  939.  
  940. From: pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger)
  941. Subject: HELP! *BIGGER* Handle woes
  942. Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158
  943. Date: Mon, 11 May 1992 02:55:13 GMT
  944.  
  945.  
  946. Thanks to folks for their suggestions on how to make sure a
  947. bomb-generating value is not passed to a handle routine.
  948.  
  949. Unfortunately, the situation I have is a little more tricky.  In
  950. windows I own, I set the refCon to a Handle to one of my data
  951. structures.  When an event comes through, I find out if it pertains to
  952. one of my windows by seeing if the (Handle) casted refCon of the
  953. window points to a block of the correct size.
  954.  
  955. Thus when, for example, my application's windows aren't being
  956. displayed (or for any other reason I get a window which isn't mine),
  957. the refCon is an unpredictable value.
  958.  
  959. So what I need is some way of asking "Is this a valid Handle?" before
  960. I try to use it as such (and thus potentially bomb out).
  961.  
  962. Any thoughts anyone?
  963.  
  964. Hmmmmm.
  965. LP
  966. - -- 
  967.  
  968. Laurence A. Pittenger
  969. CSNET  : pittenger-laurence@cs.yale.edu
  970. BITNET : pitlaua@yalevm ,  pittenger-laurence@yalecs
  971.  
  972. +++++++++++++++++++++++++++
  973.  
  974. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  975. Organization: Kalamazoo College
  976. Date: Mon, 11 May 1992 04:34:44 GMT
  977.  
  978. (Why the "usa" distribution?)
  979.  
  980. pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger) writes:
  981. >
  982. >Unfortunately, the situation I have is a little more tricky.  In
  983. >windows I own, I set the refCon to a Handle to one of my data
  984. >structures.  When an event comes through, I find out if it pertains to
  985. >one of my windows by seeing if the (Handle) casted refCon of the
  986. >window points to a block of the correct size.
  987. >
  988. >Thus when, for example, my application's windows aren't being
  989. >displayed (or for any other reason I get a window which isn't mine),
  990. >the refCon is an unpredictable value.
  991.  
  992. This isn't a real great idea, for a number of reasons.  The first is the
  993. problem you've been having.  The second is, what if the app that owns
  994. the window set its refCon to a handle that just happens to be the same
  995. size as the one you would have set?
  996.  
  997. If you want to keep track of which windows are yours, the best and
  998. surest way to do it is...keep track of your windows!  Make a linked list
  999. of the WindowPtr's for each window you allocate.  (You can be sure they
  1000. won't move around, because they have to be nonrelocateable or they won't
  1001. work.)  You can still keep storing that handle in that refCon, as long
  1002. as you check to be sure the WindowPtr's in your linked list before you
  1003. try using it...
  1004. - -- 
  1005.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  1006.  Ceci n'est pas une .signature.
  1007.  
  1008. +++++++++++++++++++++++++++
  1009.  
  1010. From: jcav@quads.uchicago.edu (JohnC)
  1011. Date: 11 May 92 17:01:45 GMT
  1012. Organization: The Royal Society for Putting Things on Top of Other Things
  1013.  
  1014. In article <1992May11.043444.9463@hobbes.kzoo.edu> k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  1015. >(Why the "usa" distribution?)
  1016.  
  1017. Why not just change it?
  1018.  
  1019. >pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger) writes:
  1020. >>
  1021. >>Unfortunately, the situation I have is a little more tricky.  In
  1022. >>windows I own, I set the refCon to a Handle to one of my data
  1023. >>structures.  When an event comes through, I find out if it pertains to
  1024. >>one of my windows by seeing if the (Handle) casted refCon of the
  1025. >>window points to a block of the correct size.
  1026. >>
  1027. >>Thus when, for example, my application's windows aren't being
  1028. >>displayed (or for any other reason I get a window which isn't mine),
  1029. >>the refCon is an unpredictable value.
  1030. >
  1031. >This isn't a real great idea, for a number of reasons.  The first is the
  1032. >problem you've been having.  The second is, what if the app that owns
  1033. >the window set its refCon to a handle that just happens to be the same
  1034. >size as the one you would have set?
  1035. >
  1036. >If you want to keep track of which windows are yours, the best and
  1037. >surest way to do it is...keep track of your windows!  Make a linked list
  1038. >of the WindowPtr's for each window you allocate.  (You can be sure they
  1039. >won't move around, because they have to be nonrelocateable or they won't
  1040. >work.)  You can still keep storing that handle in that refCon, as long
  1041. >as you check to be sure the WindowPtr's in your linked list before you
  1042. >try using it...
  1043.  
  1044. Here's the way I usually keep track of which windows my program owns:
  1045.  
  1046. 1) Define a new record data type which is a superset of DialogRecord. For
  1047. example:
  1048.  
  1049.     TYPE    MyWindowRecord = RECORD
  1050.             window:DialogRecord;
  1051.             data:Handle;
  1052.         END;
  1053.  
  1054. 2) When the window is created, pass a memory block of SIZEOF(MyWindowRecord)
  1055. bytes, not SIZEOF(DialogRecord) bytes, and specify only a 4-byte ID value for
  1056. the refCon.  It makes sense to use the application signature for this value.
  1057.  
  1058. Under these circumstances, all one needs to do to determine ownership of a
  1059. window is to check if the refCon matches the signature.  If it does, you know
  1060. that you have an extended window record, and can access the extra field
  1061. containing the data handle.  You don't have to worry about bus errors when
  1062. testing the refCon, because it's a straight 4-byte quantity,not an OS
  1063. structure.
  1064.  
  1065.  
  1066. - -- 
  1067. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  1068. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  1069. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  1070. B0 f++ c+ g+ k s++ e+ h- pv     |         Chicago, IL  60637
  1071.  
  1072. +++++++++++++++++++++++++++
  1073.  
  1074. From: neeri@iis.ethz.ch (Matthias Neeracher)
  1075. Organization: Integrated Systems Laboratory, ETH, Zurich
  1076. Date: Tue, 12 May 1992 11:44:17 GMT
  1077.  
  1078. In article <1992May11.025513.21065@cs.yale.edu> pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger) writes:
  1079. >Thanks to folks for their suggestions on how to make sure a
  1080. >bomb-generating value is not passed to a handle routine.
  1081. >
  1082. >Unfortunately, the situation I have is a little more tricky.  In
  1083. >windows I own, I set the refCon to a Handle to one of my data
  1084. >structures.  When an event comes through, I find out if it pertains to
  1085. >one of my windows by seeing if the (Handle) casted refCon of the
  1086. >window points to a block of the correct size.
  1087. >
  1088. >Thus when, for example, my application's windows aren't being
  1089. >displayed (or for any other reason I get a window which isn't mine),
  1090. >the refCon is an unpredictable value.
  1091. >
  1092. >So what I need is some way of asking "Is this a valid Handle?" before
  1093. >I try to use it as such (and thus potentially bomb out).
  1094.  
  1095. John C. in another posting  has already pointed out a clean solution.
  1096. Nontheless, here is my attempt at providing a dirty solution to the original
  1097. question. There are a few weaknesses in this code, but I doubt you will
  1098. get it to produce an address error for any normal memory setup (One exception I
  1099. can think of are macs with a memory upgrade that makes the ROM appear in the
  1100. middle of the application heap).
  1101.  
  1102. /* Heuristic to determine whether a given address is a Handle            */
  1103. /* Based on the articles of Lloyd Lim and Matthew T Russotto in the UMPG */
  1104. /* This code may be redistributed without any restrictions               */
  1105.  
  1106. Boolean RealHandle(void * addr)
  1107. {
  1108.    THz   sysZone;
  1109.    THz   applZone;
  1110.    THz   heapZone;
  1111.    
  1112.    addr  =  StripAddress(addr);
  1113.    if (addr && !((long) addr & 1))  {
  1114.       sysZone  =  SystemZone();
  1115.       applZone =  ApplicZone();
  1116.       if (addr >= (Ptr) &sysZone->heapData   && 
  1117.           addr <  (Ptr) sysZone->bkLim          ||
  1118.           addr >= (Ptr) &applZone->heapData  && 
  1119.           addr <  (Ptr) applZone->bkLim
  1120.          )
  1121.          if (*(long *)addr && !(*(long *)addr & 1)) {
  1122.             heapZone =  HandleZone(addr);
  1123.             if (!MemError())
  1124.                if (heapZone == sysZone || heapZone == applZone)
  1125.                   return true;
  1126.          }
  1127.    }
  1128.    
  1129.    return false;
  1130. }
  1131.  
  1132. Matthias
  1133.  
  1134. - -----
  1135. Matthias Neeracher                                      neeri@iis.ethz.ch
  1136.  `We say "gestalt" when things combine to act in ways we can't explain'
  1137.                              -- Marvin Minsky, _The Society Of Mind_
  1138.  
  1139. +++++++++++++++++++++++++++
  1140.  
  1141. From: rae@alias.com (Reid Ellis)
  1142. Organization: Alias Research, Inc., Toronto ON Canada
  1143. Date: Tue, 12 May 1992 14:22:09 GMT
  1144.  
  1145. Jamie R McCarthy <k044477@hobbes.kzoo.edu> writes:
  1146. |If you want to keep track of which windows are yours, the best and
  1147. |surest way to do it is...keep track of your windows!
  1148.  
  1149. Or, use the windowKind field to identify it as (a) an application
  1150. window, and hopefully (b) your window.  I quote from IM 1, p 276:
  1151.  
  1152. >WindowKind identifies the window class.  If negative, it means the
  1153. >window is a system window. [...] It may also be one of the following
  1154. >predefined constants:
  1155. >
  1156. >    CONST dialogKind    = 2;     {dialog or alert window}
  1157. >    CONST userKind      = 8;    {window created directly by the application}
  1158. >
  1159. >[...] UserKind represents a window created directly by application
  1160. >calls to the Window Manager; for such windows the application can in
  1161. >fact set the window class to any value greater than 8 if desired.
  1162.                               ^^^^^^^^^^^^^^^^^^^^^^^^
  1163. And that's the key.  You can pick some [hopefully unique] 16-bit value
  1164. greater than 8 and, if you find a window with this value in its
  1165. windowKind field, AND its refCon is a handle to data of the correct
  1166. size, then chances are really really good that it's one of yours.
  1167.  
  1168. Actually, unless you are writing an INIT or something, [i.e. if you
  1169. are writing a normal application] any window with a windowKind >= 8
  1170. MUST be one of your windows, so you can dispense with the check for a
  1171. handle to a valid size.  You just have to be careful that ALL CREATED
  1172. WINDOWS have a refCon that is either zero [NULL] or a valid handle.
  1173.  
  1174. Reid
  1175. - --
  1176. Reid Ellis                                            
  1177. rae@utcs.utoronto.ca        ||           rae@Alias.com
  1178. CDA0610@applelink.apple.com ||  +1 416 362 9181 [work]
  1179.  
  1180. +++++++++++++++++++++++++++
  1181.  
  1182. From: piovanel@ghost.dsi.unimi.it (marco piovanelli)
  1183. Organization: Computer Science Dep. - Milan University
  1184. Date: Wed, 13 May 1992 13:00:10 GMT
  1185.  
  1186. rae@alias.com (Reid Ellis) writes:
  1187.  
  1188. >Jamie R McCarthy <k044477@hobbes.kzoo.edu> writes:
  1189. >>If you want to keep track of which windows are yours, the best and
  1190. >>surest way to do it is...keep track of your windows!
  1191.  
  1192. >Or, use the windowKind field to identify it as (a) an application
  1193. >window, and hopefully (b) your window.  I quote from IM 1, p 276:
  1194.  
  1195. >>WindowKind identifies the window class.  If negative, it means the
  1196. >>window is a system window. [...] It may also be one of the following
  1197. >>predefined constants:
  1198. >>
  1199. >>    CONST dialogKind    = 2;     {dialog or alert window}
  1200. >>    CONST userKind      = 8;    {window created directly by the application}
  1201. >>
  1202. >>[...] UserKind represents a window created directly by application
  1203. >>calls to the Window Manager; for such windows the application can in
  1204. >>fact set the window class to any value greater than 8 if desired.
  1205. >                              ^^^^^^^^^^^^^^^^^^^^^^^^
  1206. >And that's the key.  You can pick some [hopefully unique] 16-bit value
  1207. >greater than 8 and, if you find a window with this value in its
  1208. >windowKind field, AND its refCon is a handle to data of the correct
  1209. >size, then chances are really really good that it's one of yours.
  1210.  
  1211. >Actually, unless you are writing an INIT or something, [i.e. if you
  1212. >are writing a normal application] any window with a windowKind >= 8
  1213. >MUST be one of your windows, so you can dispense with the check for a
  1214. >handle to a valid size.  You just have to be careful that ALL CREATED
  1215. >WINDOWS have a refCon that is either zero [NULL] or a valid handle.
  1216.  
  1217. Using the windowKind field of the WindowRecord to identify your windows
  1218. looks like a much better method than doing a GetHandleSize on the refCon,
  1219. for sure.  In normal applications, I simply set all my windows' windowKind
  1220. to 8 (userKind) and that never caused any problems.
  1221. There are some subtle problems, however, with the userKind field:
  1222.  
  1223. 1.  If you develop using a THINK environment (I use THINK Pascal), you
  1224.     must keep in mind that your application's windowList also contains
  1225.     the development environment's windows.  So you may occasionaly get
  1226.     update/activate events for windows that aren't really yours.
  1227.     As for THINK Pascal, all THINK Pascal windows have a windowKind >=
  1228.     1000 (if I remember well; people at Symantec may confirm or deny),
  1229.     so it's a good idea to use a windowKind below 1000, at least when
  1230.     you run your application in the THINK environment.
  1231.  
  1232. 2.  It appears that some Dialog Manager routines, notably DialogSelect,
  1233.     behave correctly only when your window has a windowKind of 2 (dialogKind).
  1234.     If you find useful to call DialogSelect on one of your application's
  1235.     windows (typically a modeless dialog), you should bracket the call
  1236.     with assignments to windowKind.
  1237.  
  1238. +------------------------------------------------------------+
  1239. |  EATING TOO MUCH IS CRIMINAL  -  Jenny Holzer "Truisms"    |
  1240. +------------------------------------------------------------+
  1241.  
  1242. ---------------------------
  1243.  
  1244. End of C.S.M.P. Digest
  1245. **********************
  1246.