home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / csmpdigest / csmp-digest-v3-081 < prev   
Text File  |  2010-09-21  |  49KB  |  1,351 lines

  1. Received-Date: Wed, 1 Feb 1995 10:55:59 +0100
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-081
  4. To: csmp-digest@ens.fr
  5. Date: Wed, 1 Feb 1995 10:55:54 +0100 (MET)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 87
  13.  
  14. C.S.M.P. Digest             Wed, 01 Feb 95       Volume 3 : Issue 81
  15.  
  16. Today's Topics:
  17.  
  18.         Apple events & non-applications (was Re: AppleScript and the Chooser... NOT...)
  19.         Can I '#include <foo-bar.h>' in C++ with Symantec or CodeWarrior?
  20.         Cool MacsBug Tricks
  21.         Globals with Quickdraw GX?
  22.         PPC glue for 68K library?
  23.         PowerPC Globals
  24.         Q: Is file on AppleShare volume?
  25.         Registering an NBP name?
  26.         What key code is Command-.  (One for the FAQ)
  27.         dynamic-shared libs on MacOS ???
  28.  
  29.  
  30.  
  31. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  32. (pottier@clipper.ens.fr).
  33.  
  34. The digest is a collection of article threads from the internet newsgroup
  35. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  36. regularly and want an archive of the discussions.  If you don't know what a
  37. newsgroup is, you probably don't have access to it.  Ask your systems
  38. administrator(s) for details.  If you don't have access to news, you may
  39. still be able to post messages to the group by using a mail server like
  40. anon.penet.fi (mail help@anon.penet.fi for more information).
  41.  
  42. Each issue of the digest contains one or more sets of articles (called
  43. threads), with each set corresponding to a 'discussion' of a particular
  44. subject.  The articles are not edited; all articles included in this digest
  45. are in their original posted form (as received by our news server at
  46. nef.ens.fr).  Article threads are not added to the digest until the last
  47. article added to the thread is at least two weeks old (this is to ensure that
  48. the thread is dead before adding it to the digest).  Article threads that
  49. consist of only one message are generally not included in the digest.
  50.  
  51. The digest is officially distributed by two means, by email and ftp.
  52.  
  53. If you want to receive the digest by mail, send email to listserv@ens.fr
  54. with no subject and one of the following commands as body:
  55.     help                        Sends you a summary of commands
  56.     subscribe csmp-digest Your Name    Adds you to the mailing list
  57.     signoff csmp-digest            Removes you from the list
  58. Once you have subscribed, you will automatically receive each new
  59. issue as it is created.
  60.  
  61. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  62. Questions related to the ftp site should be directed to
  63. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  64. digest are available there.
  65.  
  66. Also, the digests are available to WAIS users.  To search back issues
  67. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  68. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  69.  
  70.  
  71. -------------------------------------------------------
  72.  
  73. >From leonardr@netcom.com (Leonard Rosenthol)
  74. Subject: Apple events & non-applications (was Re: AppleScript and the Chooser... NOT...)
  75. Date: Tue, 17 Jan 1995 22:53:25 GMT
  76. Organization: Aladdin Systems, Inc.
  77.  
  78. In article <mxmora-1701950834580001@xavier.sri.com>, mxmora@unix.sri.com
  79. (Matthew Xavier Mora) wrote:
  80.  
  81. > In article <jens_alfke-1301951153550001@jensothermac.apple.com>,
  82. > jens_alfke@powertalk.apple.com (Jens Alfke) wrote:
  83. > > JLEWIS@HYRAX.IUPUI.EDU (Jeff Lewis) wrote:
  84. > > > I'm wanting to write a script to pull of the chooser and logonto a
  85. netware 
  86. > > > server.  I can do this manually but cannot get a script to do this.
  87. > > 
  88. > > It's impossible to script (or just send Apple events to) the Chooser,
  89. > > because the Chooser is a desk accessory, not an application. Only
  90. > > applications can be sent Apple events. For the same reason, you can't
  91. > > script control panels.
  92. > What? I have an fkey that sends AppleEvents. Why can't da's send apple events?
  93.    It is possiblie for any type of code to send Apple events, PROVIDED
  94. that they live in an ae-aware process.  So your FKEY will run fine IF you
  95. use it in an application that has the 'high-level event aware' bit set,
  96. however if you try it from one which does not, then you FKEY will fail. 
  97. The reason is that the process & AE manager collaborate to create the PPC
  98. port for the process (AE's use PPC for transport) and w/o one you can't
  99. send to anything other than yourself.
  100.  
  101.    Recieving AE's in a non-application is also a logical problem, since an
  102. AE target has to be a processID (or at least a PPC port) and things like
  103. INIT's, FKEYs and DA's don't have such :(.  HOWEVER, there if you think
  104. about it, there is a trick.  There are two types of event handlers,
  105. application and system.  Since system handlers are available anywhere, you
  106. can install one from anywhere!  So just have your code install a system
  107. handler and the event can be sent to any process since the AEM will
  108. forward unhandled events up to the system handlers.
  109.  
  110.  
  111. Leonard
  112. - ------------------------------------------------------------------------
  113. Leonard Rosenthol                      Internet:       leonardr@netcom.com
  114. Director of Engineering                AppleLink:      MACgician
  115. Aladdin Systems, Inc.                  GEnie:          MACgician
  116.  
  117. ---------------------------
  118.  
  119. >From denis@konishiki.Stanford.EDU (Denis Bohm)
  120. Subject: Can I '#include <foo-bar.h>' in C++ with Symantec or CodeWarrior?
  121. Date: 5 Jan 1995 11:04:21 -0800
  122. Organization: Stanford University, CA 94305, USA
  123.  
  124. I am working on a large application which uses a number of
  125. subsystems that are in different directories.  This application
  126. is intended to run on Mac, Windows, and Unix systems.
  127.  
  128. On Unix and Windows I can include a header "c_file.h" from directory
  129. "b_dir" using:
  130.  
  131.   #include <b_dir/c_file.h>
  132.  
  133. and tell the preprocessor which directories to search to find
  134. the "b" directory when processing includes with something like
  135.  
  136.   CC -I/a_dir
  137.  
  138. The Windows compiler I am using seems to interpret the "/" as a
  139. directory seperator in the same way that Unix compilers do.
  140.  
  141. Looking at the Symantec C++ 7.0 documentation I don't see any
  142. way to make this work.  It seems that you can put source files
  143. in directories, but you can't use the directory name in the
  144. include directive.  Is there some way to make this work in
  145. Symantec C++, short of adding something like:
  146.  
  147.   #ifdef Mac
  148.   #include "c_file.h"
  149.   #else
  150.   #include <b_dir/c_file.h>
  151.   #endif
  152.  
  153. to every file?
  154.  
  155. How about Code Warrior?
  156.  
  157. +++++++++++++++++++++++++++
  158.  
  159. >From Jaeger@fquest.com (Brian Stern)
  160. Date: 5 Jan 1995 23:51:42 GMT
  161. Organization: The University of Texas at Austin, Austin, Texas
  162.  
  163. In article <3ehfrl$cgt@konishiki.Stanford.EDU>,
  164. denis@konishiki.Stanford.EDU (Denis Bohm) wrote:
  165.  
  166. < I am working on a large application which uses a number of
  167. < subsystems that are in different directories.  This application
  168. < is intended to run on Mac, Windows, and Unix systems.
  169. < On Unix and Windows I can include a header "c_file.h" from directory
  170. < "b_dir" using:
  171. <   #include <b_dir/c_file.h>
  172. < and tell the preprocessor which directories to search to find
  173. < the "b" directory when processing includes with something like
  174. <   CC -I/a_dir
  175. < The Windows compiler I am using seems to interpret the "/" as a
  176. < directory seperator in the same way that Unix compilers do.
  177. < Looking at the Symantec C++ 7.0 documentation I don't see any
  178. < way to make this work.  It seems that you can put source files
  179. < in directories, but you can't use the directory name in the
  180. < include directive.  Is there some way to make this work in
  181. < Symantec C++, short of adding something like:
  182. <   #ifdef Mac
  183. <   #include "c_file.h"
  184. <   #else
  185. <   #include <b_dir/c_file.h>
  186. <   #endif
  187. < to every file?
  188. < How about Code Warrior?
  189.  
  190. On the Mac the separator to indicate a subdirectory is ':'.  A slash '/'
  191. is a valid character in a filename.  So 'b_dir/c_file.h' is a valid Mac
  192. filename.  You are probably stuck with using some ugly preprocessor hack. 
  193. Perhaps this might work:
  194.  
  195. #ifdef Mac
  196. #define b_dir/
  197. #endif
  198.  
  199. Both SC++ and CW will search through all the directories in your project
  200. tree for the headers, and they both have ways to search any arbitrary
  201. directory as well.
  202.  
  203. -- 
  204. Brian  Stern  :-{)}
  205. Toolbox commando and Menu bard
  206. Jaeger@fquest.com
  207.  
  208. +++++++++++++++++++++++++++
  209.  
  210. >From lalonde@metrowerks.ca (Paul Lalonde)
  211. Date: Thu, 05 Jan 1995 20:54:56 -0500
  212. Organization: Metrowerks Inc
  213.  
  214. In article <3ehfrl$cgt@konishiki.Stanford.EDU>,
  215. denis@konishiki.Stanford.EDU (Denis Bohm) wrote:
  216.  
  217. [snip]
  218. > On Unix and Windows I can include a header "c_file.h" from directory
  219. > "b_dir" using:
  220. >   #include <b_dir/c_file.h>
  221. [snip]
  222. > Looking at the Symantec C++ 7.0 documentation I don't see any
  223. > way to make this work.  It seems that you can put source files
  224. > in directories, but you can't use the directory name in the
  225. > include directive.  Is there some way to make this work in
  226. > Symantec C++, short of adding something like:
  227. >   #ifdef Mac
  228. >   #include "c_file.h"
  229. >   #else
  230. >   #include <b_dir/c_file.h>
  231. >   #endif
  232.  
  233. The contents of the #include filename are completely implementation-
  234. dependent.  You can't write code like this and expect it to work on all 
  235. platforms.  For example, the Mac uses colons (:) instead of slashes (/) 
  236. to delimit directories in pathnames.  None of the current Mac compilers 
  237. interpret slashes as pathname separators.
  238.  
  239. A clever workaround I've seen often is to rename your header to 
  240. "b_dir/c_file.h", which is a perfectly legal filename on the Mac.
  241.  
  242. Paul Lalonde
  243. lalonde@metrowerks.ca
  244.  
  245. +++++++++++++++++++++++++++
  246.  
  247. >From pcastine@prz.tu-berlin.de (Peter Castine)
  248. Date: Tue, 17 Jan 1995 11:32:00 GMT
  249. Organization: PRZ TU-Berlin
  250.  
  251. In article <3ff20o$pmp@lll-winken.llnl.gov>,
  252. Patrick C. Beard  <beard@cs.ucdavis.edu> wrote:
  253. >
  254. >Sometimes you want to share code (#includes) between projects
  255. >that aren't in the same folder. In both environments (THINK
  256. >7.0.X & MW 5) you can use #include directives such as:
  257. >
  258. >#include "::common:shared.h"
  259. >
  260. >which would tell the compiler to look up in a sibling folder
  261. >called common.
  262.  
  263. For this case it would be more to the point to use aliases.
  264.  
  265. Keep shared files inside a folder, make an alias to this folder and
  266. put the alias in the "Aliases" folder in your project folder. 
  267.  
  268. The ins and outs of this is all documented. Read the fabulous manual ;-)
  269.  
  270.  
  271. -- 
  272. Peter Castine               | Oh, wenn jene alten, musikkundigen Gelehrten die
  273. pcastine@prz.tu-berlin.de   | Modernen hoerten, was wuerden sie tun, was
  274. Process Control Center      | wuerden sie sagen!
  275. Technical University Berlin |               -- Jacobus von Luettich (ca. 1330)
  276.  
  277. +++++++++++++++++++++++++++
  278.  
  279. >From jlgriswo@ingr.com (John Griswold)
  280. Date: Tue, 17 Jan 1995 18:45:10 -0600
  281. Organization: Intergraph (Core Drafting S/W)
  282.  
  283. In article <jens_alfke-1601951124010001@jensothermac.apple.com>,
  284. jens_alfke@powertalk.apple.com (Jens Alfke) wrote:
  285.  
  286. > In article <3ehfrl$cgt@konishiki.Stanford.EDU>,
  287. > denis@konishiki.Stanford.EDU (Denis Bohm) wrote:
  288. > > Looking at the Symantec C++ 7.0 documentation I don't see any
  289. > > way to make this work.  It seems that you can put source files
  290. > > in directories, but you can't use the directory name in the
  291. > > include directive.
  292. > You don't need to. Both the Symantec and Metrowerks compilers
  293. > automatically search subdirectories. It doesn't matter where the files
  294. > live as long as they are somewhere inside the folders you specify for your
  295. > include paths. (I'm talking about the integrated environments here, not
  296. > the MPW tools.)
  297. > --Jens Alfke
  298.  
  299. Here's a simple little trick that I did to handle a mess of unix code that
  300. I had to port a while back, where they used #include "sys/xxxx.h" in a
  301. bunch of files.  I created a folder under my project folder called
  302. "unix/sys".  In that folder I created files named "sys/tools.h",
  303. "sys/uhdr.h", "sys/whatever.h", and so on.  In those files they included
  304. the needed "real" header files.  Then these "glue" header files got me
  305. past editing hundreds of source files.  Of course I found lots of other
  306. problems in the port but this worked for a bunch of files.
  307.  
  308.   _~\\|///-_     John Griswold
  309.   //       \\    Intergraph Corp.
  310.   / ==   == \    Huntsville, AL
  311.    -(o)^(o)-     (205) 730-2000
  312.   /    L    \
  313.   // /|!|\ \\    jlgriswo@ingr.com
  314.   ///`---'\\~    CompuServe: 74133,714
  315.    ///|||\\\     AOL: JohnGRIZ
  316.     ~?|||\\
  317.  
  318. ---------------------------
  319.  
  320. >From kenlong@netcom.com (Ken Long)
  321. Subject: Cool MacsBug Tricks
  322. Date: Sat, 14 Jan 1995 03:45:15 GMT
  323. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  324.  
  325. This file was posted on AOL by Macneil Shonle (wrote BendImageFast, 
  326. worked on clut_fade 1.2, and wrote pict2pict-fader).  It shows some 
  327. things that can be done with MacsBug, and requests input for more.
  328.  
  329. Enjoy!
  330.  
  331. -Ken-
  332.  
  333. p.s:  I see the quotemarks came through as 'R' and 'S'.  0L!
  334. >----------------------->
  335.  
  336. Cool MacsBug Tricks
  337.  
  338. This guide is to help you in using MacsBug. It is a list of
  339. tricks, but it is just the tip of the iceberg of the cool stuff
  340. you can do. This will start off with some relatively easy stuff
  341. aimed towards beginners, then it will go into some more advanced
  342. stuff. All of them are cool. When this says “Drop into MacsBug,”
  343. it means that you should hit the programmers button (which is on
  344. your computer, or on your keyboard, depending), if MacsBug is
  345. installed, you should see the debugger screen ready to serve you.
  346. You can “drop out” of MacsBug by typing “G” and then return, or by
  347. holding down Command-G. Without further ado, lets begin!
  348.  
  349. Number Conversion MacsBug can be used as a quick hexadecimal to
  350. decimal converter (and vise versa). I used to use PCalc (a great
  351. application by the way) or some other conversion application, but
  352. now I drop into MacsBug and type in the number I want to convert
  353. and hit return. Example: You want to find out what “0x3E” is in
  354. decimal, when in MacsBug type “$3E” and hit return. MacsBug will
  355. then say:
  356.  
  357. $3E = $0000003E  #62  #62  '•••>'
  358.  
  359. The first number ($0000003E) is the value in hexadecimal that you
  360. just typed in. The second number is what the value is as an
  361. unsigned decimal, the third is the signed version. The last one
  362. ('•••>') is the ASCII equivalent of the number (like: $41 is “A”,
  363. $42 is “B”, $43 is “C”, and $3E is “>”), zeros (like the first
  364. three bytes) are represented with the bullet (“•”).
  365.  
  366. You can also find out the decimal/hexadecimal equivalent of any
  367. ASCII character by typing the letter balanced between two single
  368. quotes. Example: Type in: 'A', you should get #65 as your answer.
  369. By the way: the dollar sign means that the number is in
  370. hexadecimal. Much like C’s “0xXX” notation, “$XX” is what assembly
  371. people use. Numbers in MacsBug will default to hexadecimal, except
  372. for when the hexadecimal number is a command or a regster
  373. (example: “ea” is the command to restart the current application,
  374. when you type in ea it will try this command, you must type in $ea
  375. in order to avoid this conflict. I would try to get into the habit
  376. of typing in a $ for every hexadecimal number anyway, it’s not too
  377. hard to get used to.
  378.  
  379. Similarly, you have to type a # in order to express decimal
  380. numbers, and you can use the conversion method just described
  381. (type in the number, hit return) to find out its equivalent
  382. hexadecimal number and ASCII  character.
  383.  
  384. What Was My Monitor Size? Here’s an impresive way to show a friend
  385. how many pixels horizontally and vertically they have on thier
  386. monitor. Drop into MacsBug and type in: dm @@MainDevice GDevice.
  387. This will show you the struct members of the MainDevice (which
  388. happens to be a GDevice), you should see indented the gdPMap and
  389. three lines below it will be bounds, with four numbers to the
  390. right of it. These four numbers are the top, left, bottom and
  391. right coordinates of the monitor, respectively.
  392.  
  393. The dm command is short for “display memory,” after you say “dm”
  394. you type in the address of the memory you want to display.
  395. MainDevice is a system global that is a handle (a pointer to a
  396. pointer) to the main graphics device (the one with the menu bar).
  397. The two @@ symbols are how you express double-indirection, in C
  398. you use “*” to express indirection (dereferencing), which is in
  399. put in prefix notation like “@” is. (People who program in Pascal
  400. can use the postfix indirection notation by saying “dm
  401. MainDevice^^ GDevice”.)
  402.  
  403. After you give the dm command the pointer, you give it the format
  404. you want to see it diplayed as. You can say any number for the
  405. number of bytes you want displayed, or you can say Rect to see the
  406. first eight bytes of the memory in the form of a rectangle. You
  407. can also use: Byte, Word, Long, SignedByte, SignedWord,
  408. SignedLong, UnsignedByte, UnsignedWord, UnsignedLong, PString,
  409. CString, and PixMap, GDevice, RGBColor, CGrafPort and any number
  410. of other templates you may have installed.
  411.  
  412. Example: you know a rectangle is at address $00058EA6 and you want
  413. to see what it is. All you have to do is type in “dm $00058EA6
  414. Rect” and MacsBug will display it for you.
  415.  
  416. By the way: a template is a C struct (or a Pascal record) or some
  417. other layout of memory that MacsBug knows about, you can type
  418. “tmp” to find out all of the templates your version of MacsBug
  419. has. But let’s say you want to find all of the templates that
  420. begin with the word “color,” all you would have to say is “tmp
  421. color”, which will give you ColorSpec and ColorTable (if those
  422. templates were installed).
  423.  
  424. Error Lookup Don’t you hate it when you are working in an
  425. application, minding your own business, when all-of-a-sudden the
  426. program quits and the system tells you an error of type X occured?
  427. (Where “X” is the error number, like 1, 10 or -42.) There are many
  428. applications made (like MacErrors) where you can look up these
  429. numbers and find out what went wrong. MacsBug can also do this,
  430. all you have to do is type “error” and then the error number. Keep
  431. in mind that the error numbers the system gives you are decimal
  432. (not hexadecimal), so you should put a “#” in front of it.
  433.  
  434. Example: The sytem tells you: “An error of type 4 has occured.”
  435. All you have to do is drop into MacsBug and type “error #4”,
  436. MacsBug will then say “$0004  #4  zero divide error”, which is
  437. just what an error of type four is.
  438.  
  439. Note: This error feature is not in earlier versions of MacsBug, so
  440. you may not have it.
  441.  
  442. The Simple Calculator You can use MacsBug as a simple calucator.
  443. Let’s say you need to know what 7 times 17 is, type in “#7 * #17”,
  444. and hit return. That’s all! The number 119 should now be on your
  445. screen. It will be hidden in the line:
  446.  
  447. #7 * #17 = $00000077  #119  #119  '•••w'
  448.  
  449. The lower case letter “w” is the 119th ASCII character, as the
  450. previous line shows us. Let’s try another example, how about 5
  451. plus 6? You would type in “#5 + #6”, and hit return. You should
  452. then see:
  453.  
  454. #5 + #6 = $0000000B  #11  #11  '••••'
  455.  
  456. MacsBug can also handle multiple operations at a time, like 5 plus
  457. 6 plus 10. If you want to say something even more advanced, like 5
  458. plus 6 times 4, remember to put parentheses around the apropiate
  459. numbers. MacsBug has no concept of orders of operations (like what
  460. we humans use), it’s quite possible for it to add before it
  461. multiplies. So say this: “#5 + (#6 * #4)”, which gives us #29,
  462. instead of “#5 + #6 * #4”, which gives us #44.
  463.  
  464. You can use: +, -, *, /, MOD for arithmetic; AND (or &), OR (or
  465. |), NOT (or !), XOR for boolean operations; and = (or ==), <> (or
  466. !=), <, >, <=, >= for equality. So you can type in “#5 + #4 = #9”,
  467. and MacsBug will give you a one, meaning that the equality you
  468. just said was true. If you said “#5 + #4 = #10”, Macsbug will give
  469. you a zero, meaning that the equality “5 plus 4 equals ten” is
  470. false.
  471.  
  472. Moving The Mouse Here is a cool trick to move the mouse. It done
  473. by setting memory, the mouse tracking variables specifically. So
  474. I’d like to talk about setting memory beforehand. There are four
  475. commands in MacsBug to set memory: SB (Set Byte), SW (Set Word),
  476. SL (Set Long), and SM (Set Memory). You give each of these
  477. commands an address first, and then the values of what you want to
  478. set the memory to. Example: There is a byte that you have the
  479. address of that you want to set to ten, you say “SB $XXXXXXXX
  480. #10”, where $XXXXXXXX is the address of the byte. Another example:
  481. There is a long that you have the address of that you want to set
  482. to “$4D616320”, you say “SL $XXXXXXXX $4D616320”, again where
  483. $XXXXXXXX is the address of the long. (You can use the SM command
  484. the same way in the case that the length you want to set is not 1,
  485. 2 or 4 bytes long. You use SW when you want to set a word (2
  486. bytes) ).
  487.  
  488. If you are familiar with Points (the vertical and horizontal
  489. coordinates of a point on the graf plane), you should know that
  490. they take up four bytes in memory. The high two bytes (the high
  491. word) is the vertical coordinate, and the low two bytes (the low
  492. word) is the horizontal coordinate. There are two global variables
  493. that are both Points, one called MTemp, the other called RawMouse,
  494. these variables are the information the Macintosh uses for the
  495. cursor. You can set these points by using SL. There is also a byte
  496. called CrsrNew, set this byte to 1 when you want to notify the
  497. Macintosh that the cursor posistions have changed. This is how you
  498. move the mouse to point (5, 6), near the upper-left corner of the
  499. screen, by typing in these three commands (hit return after each
  500. line):
  501.  
  502. SL MTemp $00060005 SL RawMouse $00060005 SB CrsrNew #1
  503.  
  504. Make sure MTemp and RawMouse have the same value. Now type
  505. Command-G to see your newly moved cursor.
  506.  
  507. Recovering From a Hung Serial Port Sometimes when you’re
  508. AppleTalking or modeming and something goes wrong (like you switch
  509. the modem off while data is being sent to it), the comptuer will
  510. hang. The mouse will still move, but clicking will have no effect.
  511. Here’s the solution:
  512.  
  513. Drop into MacsBug. You should see the routine name “_vSyncWait”
  514. plus something as the current location. If you don’t, you probably
  515. hit the system while it was doing something else. Hit Command-G to
  516. get back out of MacsBug, and try again. After a few tries you
  517. should find _vSyncWait.
  518.  
  519. _vSyncWait is the routine that the system uses to wait for some
  520. input from a serial port. If you can read assembly code, you’ll
  521. see that it’s pretty simple. Here’s the dump of the significant
  522. part:
  523.  
  524.      +0000  4080BB8C   MOVE.W     $0010(A0),D0                    
  525.        | 3028 0010      +0004  4080BB90   BGT.S      _vSyncWait   
  526.              ; 4080BB8C   | 6EFA
  527.  
  528. Register A0 is pointing to a system data structure, in which a
  529. word will be cleared when the awaited input arrives. The MOVE.W
  530. instruction grabs this word and puts it into register D0. The
  531. BGT.S instruction then Branches back to the MOVE.W if the byte it
  532. just fetched is Greater Than zero (hence BGT). So it happens that
  533. this byte is never going to arrive for whatever reason, but the
  534. computer is going to wait for eternity. The secret to fixing this
  535. is to use Command-T to go step along until the MOVE.W instruction
  536. is displayed as the current instruction. Now use the “sw” command
  537. to set “@(a0+10)” to zero:
  538.  
  539. sw @(a0+10) 0
  540.  
  541. Then hit Command-T twice more. The MOVE.W instruction will take
  542. the zero you just set into memory and put it in D0, so the D0
  543. display on the right of the screen should have its right four
  544. digits all zeros. Then when you execute the BGT.S instruction, it
  545. should not go back to the MOVE.W since zero is not greater than
  546. zero.
  547.  
  548. Hit Command-G to go. If this was the only byte the software was
  549. waiting for, then it should continue running, although it may go a
  550. little crazy because it’s been suddenly disconnected from whatever
  551. peripheral it was talking to. Quit the program, fix your hardware,
  552. and try again.
  553.  
  554. Credits As the saying goes: “give credit where credit is due.” The
  555. authors of this are Macneil Shonle and Dustin Mitchell. Email
  556. “MacneilS@aol.com” if you got a trick or two up your sleeve, I’ll
  557. put it in the next CMT so everyone else can know about it. (We
  558. want the really wacky tricks in particular.) 
  559.  
  560. Thanks for reading!
  561.  
  562.  
  563. ---------------------------
  564.  
  565. >From N.r.h. Black <nrhblack@delphi.com>
  566. Subject: Globals with Quickdraw GX?
  567. Date: Fri, 13 Jan 95 12:22:10 -0500
  568. Organization: Delphi (info@delphi.com email, 800-695-4005 voice)
  569.  
  570. Posted for a friend called Debbie Dittmer on 408 986 0115 X 3642
  571. (1) Where in cyberspace do people discuss problems with writing and
  572. using printer drivers and GX?
  573.  
  574. (2) What are the GX "instances" that replace globals, what messages are
  575. included in such "instances", and what message is best for global init
  576. and destroy in each "instance"?  i.e. when can a developer be sure the
  577. globals inited are the globals being accessed?
  578.  
  579. thanks  Henry
  580.  
  581. +++++++++++++++++++++++++++
  582.  
  583. >From mclow@san_marcos.csusm.edu (Marshall Clow)
  584. Date: Fri, 13 Jan 1995 21:15:58 -0800
  585. Organization: Aladdin Systems
  586.  
  587. In article <Bcw6RYy.nrhblack@delphi.com>, N.r.h. Black
  588. <nrhblack@delphi.com> wrote:
  589.  
  590. > Posted for a friend called Debbie Dittmer on 408 986 0115 X 3642
  591. She can mail me her questions, if you like (or you can).
  592.  
  593. > (1) Where in cyberspace do people discuss problems with writing and
  594. > using printer drivers and GX?
  595. >
  596.    I don't think that there are that many people writing GX printer
  597. drivers. I could be wrong, tho. [ There certainly are more GX driver
  598. developers than QuickDraw driver developers. ]
  599.  
  600. > (2) What are the GX "instances" that replace globals, what messages are
  601. > included in such "instances", and what message is best for global init
  602. > and destroy in each "instance"?  i.e. when can a developer be sure the
  603. > globals inited are the globals being accessed?
  604. >  
  605.     A GX printer driver, during the course of a print job, gets
  606. "instantiated" several times. Once is "in" the application doing the
  607. printing, for the print dialogs and spooling. Once is "in" the Finder, to
  608. handle the desktop printer window and menus. Once is "in" PrinterShare GX,
  609. which is where the spool file is processed, and the printer commands are
  610. generated, and the data is sent to the printer (usually).
  611.  
  612.     Each "instantiation" of the driver is begun by the sending of the
  613. message "Initialize", and ended by the sending of the message "Shutdown".
  614. If you need global state (that is always around), then you should allocate
  615. it in Initialize, and free it in Shutdown. OTOH, if you have global state
  616. that is important only while you are talking to the printer, you might
  617. want to consider allocating it in OpenConnection, and freeing it in
  618. CloseConnection. Whatever works for you.
  619.  
  620.    APDA has (finally) started selling the Developer University's
  621. self-paced course in how to write drivers. Six lessons in this course are
  622. about GX printer drivers. Plug. :-) [ I wrote that part, and no, I don't
  623. get royalties. ]
  624.  
  625. -- Marshall
  626.  
  627. -- 
  628. Marshall Clow
  629. Aladdin Systems
  630. mclow@san_marcos.csusm.edu
  631.  
  632. ---------------------------
  633.  
  634. >From drabe@MCS.COM (Daniel Rabe)
  635. Subject: PPC glue for 68K library?
  636. Date: 12 Jan 1995 17:47:51 -0600
  637. Organization: Another MCSNet Subscriber, Chicago's First Public-Access Internet!
  638.  
  639.  
  640. I'm having some problems trying to write glue code so that my PPC app
  641. can call a 68K library.
  642.  
  643. I have an MPW 68K library (.o) that contains about 20 functions that
  644. my PowerPC program wants to link against.  I know how to get a routine
  645. descriptor with the appropriate proc info, but how do I get the address
  646. of one of the 68K functions to pass to NewRoutineDescriptor?  I can't
  647. imagine that any of the PPC linkers can read the 68K .o files, can they?
  648. I've considered creating a 68K CODE resource for each function, but then 
  649. I'd have over 20 CODE resources floating around (one for each function);
  650. plus, this library requires the C Runtime library, and if I linked it into
  651. each CODE resource, strange things might happen (or, at the very least,
  652. each resource would be BIG).  I couldn't find any documentation that says
  653. how this should be done.  Any suggestions?
  654.  
  655. Thanks!
  656. Daniel Rabe
  657.  
  658.  
  659. +++++++++++++++++++++++++++
  660.  
  661. >From Jaeger@fquest.com (Brian Stern)
  662. Date: 13 Jan 1995 06:13:40 GMT
  663. Organization: The University of Texas at Austin, Austin, Texas
  664.  
  665. In article <3f4f37$97m@Mercury.mcs.com>, drabe@MCS.COM (Daniel Rabe) wrote:
  666.  
  667. < I'm having some problems trying to write glue code so that my PPC app
  668. < can call a 68K library.
  669. < I have an MPW 68K library (.o) that contains about 20 functions that
  670. < my PowerPC program wants to link against.  I know how to get a routine
  671. < descriptor with the appropriate proc info, but how do I get the address
  672. < of one of the 68K functions to pass to NewRoutineDescriptor?  I can't
  673. < imagine that any of the PPC linkers can read the 68K .o files, can they?
  674. < I've considered creating a 68K CODE resource for each function, but then 
  675. < I'd have over 20 CODE resources floating around (one for each function);
  676. < plus, this library requires the C Runtime library, and if I linked it into
  677. < each CODE resource, strange things might happen (or, at the very least,
  678. < each resource would be BIG).  I couldn't find any documentation that says
  679. < how this should be done.  Any suggestions?
  680. < Thanks!
  681. < Daniel Rabe
  682.  
  683. I recently did this with an MPW .o lib.  You make a code resource that has
  684. one function, main.  You include your 68K library in the project.  You
  685. pass into main a pointer to a struct that holds the addresses of all of
  686. the routines in the library and your main routine simply fills out this
  687. struct.  When you want to call one of the routines in the library you
  688. simply use CallUniversalProc and pass in the address of that routine and
  689. the appropriate upppProcInfo.  Don't bother actually making upps.  This
  690. all works neatly.  You can write appropriate defines so that your 68K app
  691. and PPC app use the appropriate calling conventions.  In the project that
  692. I'm working on I include the .o lib in the 68K version and the code
  693. resource in the PPC version.  Both use the same header file.
  694.  
  695. Good luck,
  696.  
  697. -- 
  698. Brian  Stern  :-{)}
  699. Toolbox commando and Menu bard
  700. Jaeger@fquest.com
  701.  
  702. +++++++++++++++++++++++++++
  703.  
  704. >From isis@netcom.com (Mike Cohen)
  705. Date: Fri, 13 Jan 1995 19:47:13 GMT
  706. Organization: ISIS International
  707.  
  708. drabe@MCS.COM (Daniel Rabe) writes:
  709.  
  710.  
  711. >I'm having some problems trying to write glue code so that my PPC app
  712. >can call a 68K library.
  713.  
  714. >I have an MPW 68K library (.o) that contains about 20 functions that
  715. >my PowerPC program wants to link against.  I know how to get a routine
  716. >descriptor with the appropriate proc info, but how do I get the address
  717. >of one of the 68K functions to pass to NewRoutineDescriptor?  I can't
  718. >imagine that any of the PPC linkers can read the 68K .o files, can they?
  719. >I've considered creating a 68K CODE resource for each function, but then 
  720. >I'd have over 20 CODE resources floating around (one for each function);
  721. >plus, this library requires the C Runtime library, and if I linked it into
  722. >each CODE resource, strange things might happen (or, at the very least,
  723. >each resource would be BIG).  I couldn't find any documentation that says
  724. >how this should be done.  Any suggestions?
  725.  
  726. >Thanks!
  727. >Daniel Rabe
  728.  
  729. How about ONE code resource, which either has a jump table at the beginning
  730. or takes a selector to dispatch to the correct function?
  731. -- 
  732. Mike Cohen - isis@netcom.com
  733. NewtonMail, eWorld: MikeC / ALink: D6734 / AOL: MikeC20
  734. Home Page: ftp://ftp.netcom.com/pub/is/isis/home.html
  735. PUSH THE BUTTON, FRANK... OR SOMEONE?
  736.  
  737. +++++++++++++++++++++++++++
  738.  
  739. >From sw@network-analysis-ltd.co.uk (Sak Wathanasin)
  740. Date: Sat, 14 Jan 95 00:52:39 GMT
  741. Organization: Network Analysis Ltd
  742.  
  743.  
  744. In article <3f4f37$97m@Mercury.mcs.com> (comp.sys.mac.programmer), 
  745. drabe@MCS.COM (Daniel Rabe) writes:
  746.  
  747. > imagine that any of the PPC linkers can read the 68K .o files, can they?
  748. > I've considered creating a 68K CODE resource for each function, but then 
  749. > I'd have over 20 CODE resources floating around (one for each function);
  750.  
  751. No, create one code resource that dispatches to each of the 20 lib funcs that 
  752. you want to call. Look in the PPC examples folder on ETO, or the PPC-68K 
  753. example on the CodeWarrior CD.
  754.  
  755. Sak Wathanasin
  756. Network Analysis Limited
  757. 178 Wainbody Ave South, Coventry CV3 6BX, UK
  758.  
  759. Internet: sw@network-analysis-ltd.co.uk 
  760. uucp:     ...!uknet!nan!sw                       AppleLink: NAN.LTD
  761. Phone: (+44) 203 419996 Mobile:(+44) 850 587411  Fax: (+44) 203 690690
  762.  
  763. ---------------------------
  764.  
  765. >From mauerj@aol.com (MauerJ)
  766. Subject: PowerPC Globals
  767. Date: 13 Jan 1995 01:42:14 -0500
  768. Organization: America Online, Inc. (1-800-827-6364)
  769.  
  770. I need to access my application's global variables from a Time Manager
  771. task. How can I do this running in native PowerPC mode? 
  772.  
  773. The way the Inside Mac lists to do it with 68K code is to set up a new
  774. tmInfo structure containing tmTask and a tmRefCon on the end of it. That
  775. way,you can store your app's A5 world in the refcon and access it through
  776. the A1 register in the Time Manager task.
  777.  
  778. Herein lies my problem-how am I supposed to get at the refcon without an
  779. A1 register? Should I try to use this type of method with the native code?
  780. Or is there some really easy solution to this that I just can't see?
  781.  
  782. I hope someone out there knows the answer to this one,because I haven't
  783. found it yet.
  784.  
  785. Thanks,
  786. MauerJ
  787.  
  788. +++++++++++++++++++++++++++
  789.  
  790. >From rudolph@unixg.ubc.ca (Chris Rudolph)
  791. Date: Thu, 12 Jan 1995 23:58:23 -0800
  792. Organization: Motion Works International
  793.  
  794. In article <3f57c6$2ju@newsbf02.news.aol.com>, mauerj@aol.com (MauerJ) wrote:
  795.  
  796. > I need to access my application's global variables from a Time Manager
  797. > task. How can I do this running in native PowerPC mode? 
  798. > The way the Inside Mac lists to do it with 68K code is to set up a new
  799. > tmInfo structure containing tmTask and a tmRefCon on the end of it. That
  800. > way,you can store your app's A5 world in the refcon and access it through
  801. > the A1 register in the Time Manager task.
  802. > Herein lies my problem-how am I supposed to get at the refcon without an
  803. > A1 register? Should I try to use this type of method with the native code?
  804. > Or is there some really easy solution to this that I just can't see?
  805. > I hope someone out there knows the answer to this one,because I haven't
  806. > found it yet.
  807. > Thanks,
  808. > MauerJ
  809.  
  810. Mauer,
  811.  
  812. Your in luck.  One of the nicetys of the Time Manager on the PowerPC is
  813. that pointer to your structure is passed in as a parameter:
  814.  
  815. example:
  816.  
  817. #ifndef powerc
  818.  
  819. typedef struct 
  820. {
  821.    VBLTask  theTask;
  822.    long     A5;
  823.    // Anything else you want to add
  824.  
  825. } MyVBLTask, *MyVBLTaskPtr;
  826.  
  827. // Function prototype
  828.  
  829. pascal void MyVBLProc( VBLTaskPtr inVBLTask );
  830.  
  831. // Inline function to get at your globals
  832.  
  833. pascal MyVBLTaskPtr GetVBLTaskPtr() = 0x2E88;      // MOVE.L A0,A7;
  834.  
  835. #else
  836.  
  837. typedef struct 
  838. {
  839.    VBLTask  theTask;
  840.    // Anything else you want to add
  841.  
  842. } MyVBLTask, *MyVBLTaskPtr;
  843.  
  844. pascal void MyVBLProc( void );
  845.  
  846. #endif
  847.  
  848.  
  849. // ===========================================================================
  850. //    MyVBLProc
  851. //
  852.  
  853. #ifndef powerc
  854.  
  855. pascal void MyVBLProc( void );
  856. {
  857.    long           oldA5;
  858.    MyVBLTaskPtr   theTask =   GetVBLTaskPtr();
  859.  
  860.    // Save and setup your A5 globals
  861.  
  862.    oldA5 = SetA5( theTask->A5 );
  863.  
  864.    ... Do some stuff here for you VBL Task
  865.  
  866.    // Restore the saved A5
  867.  
  868.    (void) SetA5( oldA5 );
  869. }
  870.  
  871. #else
  872.  
  873. pascal void MyVBLProc( VBLTaskPtr inVBLTask )
  874. {
  875.    // Don't need to setup or restore anything, plus
  876.    // Your structure is within easy grasp
  877.  
  878.    ... Do some stuff here for you VBL Task
  879. }
  880.  
  881. #endif
  882.  
  883. - -------------------------------------------------------------------
  884. Chris Rudolph, Senior Engineer,
  885. Technology Works.
  886. Motion Works International.
  887.  
  888. Internet:  rudolph@unixg.ubc.ca
  889. AppleLink: D2276 ( Subject: Attn: Chris Rudolph )
  890. - -------------------------------------------------------------------
  891.  
  892.  
  893. ---------------------------
  894.  
  895. >From mhl@icf.hrb.com (mark)
  896. Subject: Q: Is file on AppleShare volume?
  897. Date: 12 Jan 95 11:16:57 EST
  898. Organization: HRB Systems, Inc.
  899.  
  900. Dear c.s.m.p.h
  901.  
  902. This is kind of a fill in the blank question...
  903.  
  904. #include <Types.h>
  905.  
  906. OSErr FileIsOnAnAppleShareVolume(
  907.    short aFileReferenceNumber, /* refNum of file in question */
  908.    Boolean *onAppleShare /* returned as 'true' if the referenced 
  909.                           * file is on an AppleShare volume, or
  910.                           * 'false' otherwise. */
  911. ) {
  912.    OSErr theError = noErr;
  913.  
  914.    ...
  915.    if ((theError == noErr) && (...)) {
  916.       *onAppleShare = true;
  917.    } else {
  918.       *onAppleShare = false;
  919.    }
  920.    return theError;
  921. }
  922.  
  923. In searching throught NIM:Files I _did_ find a structure that tells
  924. whether a volume is AppleShare or not. Unfortunately, I could not find a
  925. routine which returned that data structure.
  926.  
  927. Any takers on how to flesh out this routine?
  928.  
  929. -- 
  930. Mark H. Linton
  931.  
  932. PS: Bring me the blue pages.
  933.  
  934. +++++++++++++++++++++++++++
  935.  
  936. >From jumplong@aol.com (Jump Long)
  937. Date: 18 Jan 1995 00:01:10 -0500
  938. Organization: America Online, Inc. (1-800-827-6364)
  939.  
  940. >In searching throught NIM:Files I _did_ find a structure that tells
  941. >whether a volume is AppleShare or not. Unfortunately, I could not find a
  942. >routine which returned that data structure.
  943. >
  944. >Any takers on how to flesh out this routine?
  945.  
  946. Using routines GetFileLocation and HGetVolParms, and macro isNetworkVolume
  947. from Apple's MoreFiles sample code makes this easy:
  948.  
  949. OSErr FileIsOnNetworkVolume(short refNum,  Boolean *onNetworkVolume)
  950. {
  951.  OSErr     result;
  952.  short     vRefNum;
  953.  long     dirID;
  954.  GetVolParmsInfoBuffer volParmsInfo;
  955.  long     infoSize;
  956.  
  957.  result = GetFileLocation(refNum, &vRefNum, &dirID, NULL);
  958.  if ( result == noErr )
  959.  {
  960.   infoSize = sizeof(GetVolParmsInfoBuffer);
  961.   if ( HGetVolParms(NULL, vRefNum, &volParmsInfo, &infoSize) == noErr )
  962.   {
  963.    *onNetworkVolume = isNetworkVolume(volParmsInfo);
  964.   }
  965.   else
  966.   {
  967.    /* Volume must support GetVolParms to be a netowrk volume */
  968.    *onNetworkVolume = false;
  969.   }
  970.  }
  971.  return ( result );
  972. }
  973.  
  974. Note that this routine simply identifies network volumes.
  975.  
  976. If you want to specifically check for AppleShare network volumes, you
  977. should call PBHGetVInfo to get the volume's drive number, search the drive
  978. queue to find the drvQEl for the drive and get the driver reference number
  979. from the drvQEl, and then compare that driver reference number to the
  980. driver reference number of the .AFPTranslator driver (the driver that owns
  981. all AppleShare volumes).
  982.  
  983. - Jim Luther
  984.  
  985. ---------------------------
  986.  
  987. >From patrickd@sandstone.WPI.EDU (Patrick D.)
  988. Subject: Registering an NBP name?
  989. Date: 15 Jan 1995 04:02:50 GMT
  990. Organization: Satellite of Love - Satellite.res.wpi.edu
  991.  
  992. How do I go about registering an NBP name on an AppleTalk network?  I'd like
  993. some sample source code that works with Think C 5.0 or 6.0 or Think Pascal.
  994. ...and I kinda need the source code to work.  I've asked in the past and the
  995. code I got wouldn't compile.
  996.  
  997. -- 
  998. -Patrick Delahanty            | BEWARE!: MST3K, the TICK, TMBG, Phish, and
  999. PatrickD@Satellite.res.wpi.edu| Star Trek fan!  Macintosh Evangelist & Guru
  1000. - ----------------------------+--------------------------------------------
  1001. http://www.wpi.edu/~patrickd/ |    Veteran MST3K Fan - Info Club # 6563
  1002.  
  1003. +++++++++++++++++++++++++++
  1004.  
  1005. >From jumplong@aol.com (Jump Long)
  1006. Date: 18 Jan 1995 00:17:45 -0500
  1007. Organization: America Online, Inc. (1-800-827-6364)
  1008.  
  1009. >How do I go about registering an NBP name on an AppleTalk network?  I'd
  1010. >like some sample source code that works with Think C 5.0 or 6.0 or Think
  1011. >Pascal. ...and I kinda need the source code to work.  I've asked in the
  1012. >past and the code I got wouldn't compile.
  1013.  
  1014. Here's a C port of the code I wrote for IM: Networking.
  1015.  
  1016. - Jim Luther
  1017.  
  1018. /*
  1019. ** Registers a entity with the specified object and type on the
  1020. ** specified socket.  The pointer to the NamesTableEntry is returned in
  1021. ** ntePtr if the function returns noErr.
  1022. */
  1023. OSErr MyRegisterName(ConstStr32Param entityObject, ConstStr32Param
  1024. entityType,
  1025.       short socket, NamesTableEntry **ntePtr)
  1026. {
  1027.  MPPParamBlock mppPB;
  1028.  OSErr   result;
  1029.  Str32   entityZone = "\p*";
  1030.  
  1031.  /* Allocate non-relocatable memory in the system heap for the names table
  1032. entity */
  1033.  *ntePtr = (NamesTableEntry *) NewPtrSys((Size) sizeof(NamesTableEntry));
  1034.  
  1035.  if ( ntePtr == NULL )
  1036.  {
  1037.   result = MemError(); /* Return memory error */
  1038.  }
  1039.  else
  1040.  {
  1041.   /* Build the names table entity */
  1042.   NBPSetNTE((Ptr) *ntePtr, (Ptr) entityObject, (Ptr) entityType, (Ptr)
  1043. entityZone, socket);
  1044.   
  1045.   /* ioRefNum and csCode are filled in by PRegisterName's glue */
  1046.   mppPB.NBPinterval = 0x0f;   /* Reasonable values for the interval and */
  1047.   mppPB.NBPcount = 0x03;    /* retry count */
  1048.   mppPB.NBPentityPtr = (Ptr) *ntePtr; /* Pointer to NamesTableEntry */
  1049.   mppPB.NBPverifyFlag = (char) true; /* Make sure name is unique */
  1050.   
  1051.   result = PRegisterName(&mppPB, false); /* Register the name */
  1052.  
  1053.   if ( result != noErr )
  1054.    DisposePtr((Ptr) *ntePtr); /* If error, give space back */
  1055.  }
  1056.  
  1057.  return ( result );
  1058. }
  1059.  
  1060. ---------------------------
  1061.  
  1062. >From rjohnson@ (Ray Johnson)
  1063. Subject: What key code is Command-.  (One for the FAQ)
  1064. Date: 16 Jan 1995 23:17:34 GMT
  1065. Organization: Sun Microsystems, Inc.  Mt. View, Ca.
  1066.  
  1067. In the book Inside Mac "Macintosh Toolbox Essentials" concerning the
  1068. Event Manager, they have a section about looking for Command-. event.
  1069. They show sample code that implies that the period key may change
  1070. if the user changes the script.  However, it really doesn't show the
  1071. best way to look for the Command-. event.
  1072.  
  1073. What is the best way to look for Command-. ??? 
  1074.  
  1075. This seems like a good question to be in the FAQ.  (Even if it isn't
  1076. asked alot - it should be!)
  1077.  
  1078. Ray
  1079.  
  1080.  
  1081.  
  1082.  
  1083. +++++++++++++++++++++++++++
  1084.  
  1085. >From Anders.Wahlin@hum.gu.se (Anders Wahlin)
  1086. Date: Tue, 17 Jan 1995 07:38:43 GMT
  1087. Organization: Hum Fak:s Dataservice
  1088.  
  1089. In article <3feuqe$baa@engnews2.Eng.Sun.COM>, rjohnson@ (Ray Johnson) wrote:
  1090.  
  1091. > In the book Inside Mac "Macintosh Toolbox Essentials" concerning the
  1092. > Event Manager, they have a section about looking for Command-. event.
  1093. > They show sample code that implies that the period key may change
  1094. > if the user changes the script.  However, it really doesn't show the
  1095. > best way to look for the Command-. event.
  1096. > What is the best way to look for Command-. ??? 
  1097. > This seems like a good question to be in the FAQ.  (Even if it isn't
  1098. > asked alot - it should be!)
  1099. > Ray
  1100.  
  1101.  
  1102. When I'm looking for a Command-. in a dialog, I call this function in the
  1103. dialog filter:
  1104.  
  1105. Boolean Cmd_Period(short theModifier, char theKey) {
  1106.    if (((theModifier & cmdKey) != 0) && (theKey == '.')) return (TRUE);
  1107.    return (FALSE);
  1108. }
  1109.  
  1110. Like this:
  1111.  
  1112.    if (Cmd_Period(theEvent->modifiers, theChar)) {
  1113.       /* Cancel */
  1114.    }
  1115.  
  1116.  
  1117.  
  1118. When I'm looking for a Command-. in an application that isn't using events
  1119. I call this function:
  1120.  
  1121. Boolean KeyPressed(unsigned short theCharCode) {
  1122.       unsigned char keyMap[16];
  1123.  
  1124.    GetKeys((long *)keyMap);
  1125.    return ((keyMap[theCharCode>>3] >> (theCharCode& 7)) & 1);
  1126. }
  1127.  
  1128. Like this:
  1129.  
  1130.    if ( (KeyPressed(55)) && (KeyPressed(47)) ) {
  1131.       /* Cancel */
  1132.    }
  1133.  
  1134. -- 
  1135. Anders Wahlin
  1136. Anders.Wahlin@hum.gu.se
  1137.  
  1138. +++++++++++++++++++++++++++
  1139.  
  1140. >From stk@DoBag.IN-Berlin.DE (Stefan Kurth)
  1141. Date: Wed, 18 Jan 1995 00:51:26 +0100
  1142. Organization: none
  1143.  
  1144. Anders Wahlin <Anders.Wahlin@hum.gu.se> wrote:
  1145.  
  1146. > When I'm looking for a Command-. in a dialog, I call this function in the
  1147. > dialog filter:
  1148. >
  1149. > Boolean Cmd_Period(short theModifier, char theKey) {
  1150. >    if (((theModifier & cmdKey) != 0) && (theKey == '.')) return (TRUE);
  1151. >    return (FALSE);
  1152. > }
  1153.  
  1154. Now this is of course exactly what you should -not- be doing, because it
  1155. doesn't work on keyboards where the '.' character is shifted.
  1156.  
  1157. Go read NIM:Text (appendix C, pages C-23 and C-24), it explains how to
  1158. handle it correctly.
  1159.  
  1160.  
  1161. > Boolean KeyPressed(unsigned short theCharCode) {
  1162. >       unsigned char keyMap[16];
  1163. >
  1164. >    GetKeys((long *)keyMap);
  1165. >    return ((keyMap[theCharCode>>3] >> (theCharCode& 7)) & 1);
  1166. > }
  1167. ...
  1168. >    if ( (KeyPressed(55)) && (KeyPressed(47)) ) {
  1169. >       /* Cancel */
  1170. >    }
  1171.  
  1172. Huuh, even worse.  Don't make assumptions on the virtual key codes of
  1173. characters.
  1174.  
  1175. ________________________________________________________________________
  1176. Stefan Kurth             Berlin, Germany          stk@dobag.in-berlin.de
  1177.  
  1178. +++++++++++++++++++++++++++
  1179.  
  1180. >From jens_alfke@powertalk.apple.com (Jens Alfke)
  1181. Date: Wed, 18 Jan 1995 20:41:20 GMT
  1182. Organization: Apple Computer, Inc.
  1183.  
  1184. Anders.Wahlin@hum.gu.se (Anders Wahlin) wrote:
  1185. > When I'm looking for a Command-. in a dialog, I call this function in the
  1186. > dialog filter:
  1187.  
  1188. The trouble with that function is that it assumes that no shift (or other)
  1189. modifier is needed to get a period. On non-English keyboards where you do
  1190. need a modifier, the code you gave won't work.
  1191. There is an Apple tech note on "International Canceling" that gives sample
  1192. code that will work on any Macintosh worldwide.
  1193.  
  1194.  
  1195. Jens Alfke_________OpenDoc Geometer_________jens_alfke@powertalk.apple.com
  1196.                                               OpenDoc info: FTP to cil.org
  1197.  
  1198.          Visit Scenic Flood Control Dam No. 3.      
  1199.  
  1200. ---------------------------
  1201.  
  1202. >From steph@bebop.frcl.bull.fr (StÇphane Kînigsdîrfer)
  1203. Subject: dynamic-shared libs on MacOS ???
  1204. Date: 9 Jan 1995 09:21:56 GMT
  1205. Organization: BULL S.A.
  1206.  
  1207.  
  1208. -- 
  1209. Hi NetWorkers !
  1210.  
  1211. Could anybody tell me if MacOS (and from which version) supports
  1212. dynamic/shared libraries ?
  1213.  
  1214. Thanx, Steph.
  1215.  
  1216. ===============================================================================
  1217.    Stephane Konigsdorfer                 
  1218.    (Poste courrier A5/146)               Tel.: +33 (1) 30 80 70 70
  1219.    BULL S.A.                             Fax.: +33 (1) 30 80 77 99
  1220.    Rue Jean Jaures
  1221.    78340 Les Clayes-sous-Bois            E-mail: S.Konigsdorfer@frcl.bull.fr
  1222.    FRANCE                                
  1223. ===============================================================================
  1224.  
  1225. +++++++++++++++++++++++++++
  1226.  
  1227. >From Joern Loviscach <jl@lovia.teuto.de>
  1228. Date: 9 Jan 1995 21:08:57 GMT
  1229. Organization: POP Contrib.Net Netzdienste GmbH, Bielefeld, Germany
  1230.  
  1231. steph@bebop.frcl.bull.fr (StÇphane Kînigsdîrfer) wrote:
  1232.  
  1233. > Could anybody tell me if MacOS (and from which version) supports
  1234. > dynamic/shared libraries ?
  1235.  
  1236. Yes. On PPC via code fragment manager, on 68K via shared library
  1237. manager (quite new). Concerning the code fragment manager, take
  1238. a look into "Inside Macintosh: PowerPC System Software".
  1239. It's available on ftp://ftp.info.apple.com/.
  1240.  
  1241. - -Joern Loviscach
  1242.  
  1243. +++++++++++++++++++++++++++
  1244.  
  1245. >From jwbaxter@olympus.net (John W. Baxter)
  1246. Date: Mon, 09 Jan 1995 19:08:50 -0800
  1247. Organization: Internet for the Olympic Peninsula
  1248.  
  1249. In article <3es8l9$vp7@linteuto.teuto.de>, Joern Loviscach
  1250. <jl@lovia.teuto.de> wrote:
  1251.  
  1252. > steph@bebop.frcl.bull.fr (StÇphane Kînigsdîrfer) wrote:
  1253. >  
  1254. > > Could anybody tell me if MacOS (and from which version) supports
  1255. > > dynamic/shared libraries ?
  1256. > Yes. On PPC via code fragment manager, on 68K via shared library
  1257. > manager (quite new). Concerning the code fragment manager, take
  1258. > a look into "Inside Macintosh: PowerPC System Software".
  1259. > It's available on ftp://ftp.info.apple.com/.
  1260.  
  1261. Apple Shared Library Manager isn't all *that* new...it goes back (in
  1262. released form) at least to day 1 of FoxPro 2.5 (the current FoxPro is
  1263. 2.6).  [FoxPro 2.5 used Microsoft's "Shared Code Manager" which in turn
  1264. used Apple Shared Library Manager.]
  1265.  
  1266. And Code Fragment Manager is coming to the 68K world (public knowledge,
  1267. thanks to the OpenDoc CD available to all), probably this year (common
  1268. guess).
  1269.  
  1270. Apple Shared Library Manager is happiest with C++ (it can work in a
  1271. limited way with C or Pascal).  And it's only happy when the client code
  1272. is built with the same C++ which built the library.  But it does allow
  1273. client code to compile a subclass of a class defined in the shared
  1274. library.
  1275.  
  1276. SOM (IBM's acronym and product) comes with OpenDoc, and relieves the
  1277. requirement that the library and client come from the same compiler.
  1278.  
  1279.    --John
  1280.  
  1281. -- 
  1282. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1283.        Isn't C fun?
  1284.    jwbaxter@pt.olympus.net
  1285.  
  1286. +++++++++++++++++++++++++++
  1287.  
  1288. >From caleb@delbruck.pharm.sunysb.edu (Caleb Strockbine)
  1289. Date: 12 Jan 1995 19:25:11 GMT
  1290. Organization: SUNY Stony Brook
  1291.  
  1292. In article <3es8l9$vp7@linteuto.teuto.de> Joern Loviscach <jl@lovia.teuto.de> writes:
  1293. >steph@bebop.frcl.bull.fr (StÇphane Kînigsdîrfer) wrote:
  1294. >> Could anybody tell me if MacOS (and from which version) supports
  1295. >> dynamic/shared libraries ?
  1296. >
  1297. >Yes. On PPC via code fragment manager, on 68K via shared library
  1298. >manager (quite new). Concerning the code fragment manager, take
  1299. >a look into "Inside Macintosh: PowerPC System Software".
  1300. >It's available on ftp://ftp.info.apple.com/.
  1301.  
  1302.  
  1303. I spoke with someone from Apple at the San Fransisco MacWorld Expo
  1304. who told me that the Code Fragment Manager is now available for
  1305. 68K as well as PPC. He recommended CFM for all my shared library 
  1306. needs.
  1307.  
  1308. Caleb Strockbine
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318. ---------------------------
  1319.  
  1320. End of C.S.M.P. Digest
  1321. **********************
  1322.  
  1323.  
  1324.