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

  1. C.S.M.P. Digest             Fri, 25 Dec 92       Volume 1 : Issue 227
  2.  
  3. Today's Topics:
  4.  
  5.     Claris Apple Events
  6.     64-bit multiply and divide on 68000
  7.     Time Manager Sample Code...
  8.     How to call FORTRAN subroutines from Excel (Summary)
  9.     best way to pause in app ?
  10.     Simulating odoc event from THINK Pascal?
  11.     Whip me, beat me, what to do with DISCIPLINE?
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  If you don't have access to news, there is
  22. no way that I know of for you to post articles to the group.
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  35. file /pub/mac/csmp-digest/README before downloading any files.  The most
  36. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  37. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  38. archive has a mail server; send a message with the text '$MACarch help' (no
  39. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  40.  
  41. The digest is also available via email.  Just send a note saying that you
  42. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  43. automatically receive each new issue as it is created.  Sorry, back issues
  44. are not available through the mailing list.
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48.  
  49. -------------------------------------------------------
  50.  
  51. From: dawson@cs.cornell.edu (Dawson Dean)
  52. Subject: Claris Apple Events
  53. Date: 19 Nov 92 03:06:57 GMT
  54. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  55.  
  56.  
  57.    I want to send an apple event to several third party programs,
  58. particularly some of Claris' programs (MacWrite, FileMaker, etc.).
  59. I looked through the Apple Events Doirectory on ftp.apple.com,
  60. but all that lists is the core events and the QuickDraw events.
  61.  
  62. Does Claris publicize these things? I`ve seen demos where their
  63. programs work closely together, so there is an extensive set of
  64. Apple Events, but do they tell developers about these?
  65.  
  66. Does anybody at Claris read this group? How about it? Is there
  67. something like a claris ftp site (my local yp has no idea of
  68. claris.com). Is there an 800 number? 
  69.  
  70. How about becoming a registered Claris-cadet-developer-scout?
  71. Is there some contact that tells me about this? I remember when
  72. the MacWrite/Draw TN's went over to Claris (#15 and 16 if I
  73. remember correctly) and there was some note about calling Claris'
  74. own developer support or something. Does this exist?
  75.  
  76. Does Apple release this kind of stuff about 3rd party apps?
  77.  
  78. Any information would be a great help,
  79. Thanks mucho,
  80.  
  81. Dawson Dean
  82. dawson@cs.cornell.edu
  83. - -- 
  84. __________________________________________________________________
  85. Dawson Dean                       Internet: dawson@cs.cornell.edu
  86. Cornell Computer Science          Office:   (607) 255-1068
  87. __________________________________________________________________
  88.  
  89. +++++++++++++++++++++++++++
  90.  
  91. From: lai@Apple.COM (Ed Lai)
  92. Date: 20 Nov 92 17:42:11 GMT
  93. Organization: Apple Computer Inc., Cupertino, CA
  94.  
  95. In article <1992Nov19.030657.9662@cs.cornell.edu> dawson@cs.cornell.edu (Dawson Dean) writes:
  96. >
  97. >   I want to send an apple event to several third party programs,
  98. >particularly some of Claris' programs (MacWrite, FileMaker, etc.).
  99. >I looked through the Apple Events Doirectory on ftp.apple.com,
  100. >but all that lists is the core events and the QuickDraw events.
  101. >
  102. >Does Claris publicize these things? I`ve seen demos where their
  103. >programs work closely together, so there is an extensive set of
  104. >Apple Events, but do they tell developers about these?
  105. >
  106.  
  107. In general applications that supports Apple Events would publish the
  108. event they supported in an aete resource. A number of scripting system
  109. would parse the aete resource to use the information. Look in ftp.apple.com in
  110. /pub/appleevents for ResEdit template for the aete resource (only work
  111. if the resource is small), HyperCard aete editor stack to read the aete
  112. resource, and Apple Event XCMD stack to talk from HyperCard to such
  113. application using the aete information.
  114.  
  115. /* Disclaimer: All statments and opinions expressed are my own */
  116. /* Edmund K. Lai                                               */
  117. /* Apple Computer, MS37-UP                                     */
  118. /* 20525 Mariani Ave,                                          */
  119. /* Cupertino, CA 95014                                         */
  120. /* (408)974-6272                                               */
  121. zW@h9cOi
  122.  
  123.  
  124. +++++++++++++++++++++++++++
  125.  
  126. From: jpugh@apple.com (Jon Pugh)
  127. Date: Sat, 21 Nov 1992 06:30:25 GMT
  128. Organization: Apple Computer, Inc.
  129.  
  130. In article <1992Nov19.030657.9662@cs.cornell.edu>, dawson@cs.cornell.edu
  131. (Dawson Dean) wrote:
  132. >    I want to send an apple event to several third party programs,
  133. > particularly some of Claris' programs (MacWrite, FileMaker, etc.).
  134. > I looked through the Apple Events Doirectory on ftp.apple.com,
  135. > but all that lists is the core events and the QuickDraw events.
  136. > Does Claris publicize these things? I`ve seen demos where their
  137. > programs work closely together, so there is an extensive set of
  138. > Apple Events, but do they tell developers about these?
  139.  
  140. FileMaker Pro is the only Claris app that supports the object model and
  141. Apple Events.  Hypercard supports only a few Apple Events.
  142.  
  143. Jon
  144.  
  145. ---------------------------
  146.  
  147. From: squeegee@world.std.com (Stephen C. Gilardi)
  148. Subject: 64-bit multiply and divide on 68000
  149. Organization: SQ Software via The World Public Access UNIX, Brookline, MA
  150. Date: Sat, 21 Nov 1992 23:51:42 GMT
  151.  
  152. I need to calculate a linear interpolation rapidly.  The equation is
  153.  
  154.   y = x * numer / denom,
  155.  
  156. where y, numer, and denom are 32-bit unsigned longs and x is a 16-bit
  157. unsigned short.
  158.  
  159. On the 68020, I can use the built-in "long" multiply and divide instructions.
  160. However on the 68000 it's more involved.
  161.  
  162. I found 68000 code in a book to do the 64-bit unsigned multiply.  I'd
  163. like to have the divide in assembly language as well.
  164.  
  165. Does anyone have such a routine, or a reference to where I can find one?
  166.  
  167. Thanks,
  168. - --Steve
  169.  
  170. Stephen C. Gilardi
  171. SQ Software
  172. squeegee@world.std.com
  173.  
  174.  
  175. +++++++++++++++++++++++++++
  176.  
  177. From: jmunkki@vipunen.hut.fi (Juri Munkki)
  178. Organization: Helsinki University of Technology
  179. Date: Sun, 22 Nov 1992 10:51:22 GMT
  180.  
  181. In article <By3BM7.InD@world.std.com> squeegee@world.std.com (Stephen C. Gilardi) writes:
  182. >I need to calculate a linear interpolation rapidly.  The equation is
  183. >
  184. >  y = x * numer / denom,
  185. >
  186. >where y, numer, and denom are 32-bit unsigned longs and x is a 16-bit
  187. >unsigned short.
  188. >
  189. >On the 68020, I can use the built-in "long" multiply and divide instructions.
  190. >However on the 68000 it's more involved.
  191. >
  192. >I found 68000 code in a book to do the 64-bit unsigned multiply.  I'd
  193. >like to have the divide in assembly language as well.
  194. >
  195. >Does anyone have such a routine, or a reference to where I can find one?
  196.  
  197. I'm also interested in a good division routine for the 68K. Here's a routine
  198. that does essentially what you wanted to do and a bit more. It uses 32 bit
  199. fixed point numbers. I would very much like to see an improved division
  200. routine. I wasn't able to figure out anything better on my own and since
  201. my main target processor is the 68030, this version is not used all that
  202. often.
  203.  
  204. Since your x is a short, you will save quite a bit of time by using that
  205. knowledge to optimize the code.
  206.  
  207. Fixed    FMulDiv68000(a,b,c)
  208. Fixed    a,b,c;
  209. {
  210. asm    {
  211.         movem.l    D3-D5,-(sp)
  212.         move.l    a,D0
  213.         bpl.s    @positive_a
  214.         neg.l    c
  215.         neg.l    D0
  216. @positive_a
  217.         move.l    b,D1
  218.         bpl.s    @positive_b
  219.         neg.l    D1
  220.         neg.l    c
  221. @positive_b
  222.         move.w    D1,D2
  223.         mulu.w    D0,D2        ;    D2 = Lo * Lo
  224.  
  225.         move.w    D1,D3
  226.         swap    D0
  227.         mulu.w    D0,D3        ;    D3 = Hi * Lo
  228.         
  229.         swap    D1
  230.         move.w    D1,D4
  231.         mulu.w    D0,D4        ;    D4 = Hi * Hi
  232.         
  233.         swap    D0
  234.         mulu.w    D0,D1        ;    D1 = Lo * Hi
  235.         
  236.         clr.l    D5
  237.         move.w    D3,D5        
  238.         swap    D5
  239.         clr.w    D3
  240.         swap    D3
  241.         add.l    D5,D2        ;    64 bit addition Hi*Hi:Lo*Lo += Hi*Lo
  242.         addx.l    D3,D4
  243.         
  244.         clr.l    D5
  245.         move.w    D1,D5
  246.         swap    D5
  247.         clr.w    D1
  248.         swap    D1
  249.         add.l    D5,D2        ;    64 bit addition Hi*Hi:Lo*Lo+Hi*Lo += Lo*Hi
  250.         addx.l    D1,D4        ;    Result is now in D4:D2
  251.         
  252.         add.l    D2,D2
  253.         addx.l    D4,D4
  254.     
  255.         move.l    c,D1
  256.         bpl.s    @positive_c
  257.         neg.l    D1
  258. @positive_c
  259.         moveq.l    #1,D0
  260.         bra.s    @divloop
  261. @divok    
  262.         lsl.l    #1,D0
  263.         bcs.s    @divdone
  264.         add.l    D2,D2
  265.         addx.l    D4,D4
  266. @divloop
  267.         sub.l    D1,D4
  268.         bcc.s    @divok
  269.  
  270.         addx.l    D0,D0
  271.         bcs.s    @divdone
  272.  
  273.         add.l    D1,D4
  274.         add.l    D2,D2
  275.         addx.l    D4,D4
  276.         bra.s    @divloop
  277.  
  278. @divdone
  279.         move.l    c,D1
  280.         bpl.s    @positive_result
  281.         
  282.         addq.l    #1,D0
  283.         bra.s    @done
  284. @positive_result
  285.         eor.l    #-1,D0
  286. @done
  287.         movem.l    (sp)+,D3-D5
  288.     }
  289. }
  290.  
  291.  
  292. - -- 
  293.   Juri Munkki                           Windsurf: fast sailing
  294.  jmunkki@hut.fi                          Macintosh: fast software
  295.  
  296. ---------------------------
  297.  
  298. From: urritche@mcs.drexel.edu (Ralph Paul Ritchey)
  299. Subject: Time Manager Sample Code...
  300. Date: 20 Nov 92 17:21:11 GMT
  301. Organization: Drexel University
  302.  
  303. Netters:
  304.  
  305.     Does anyone know of any code floating around that I can get my
  306. hands on that uses the Time Manager?  I've poked around but haven't turned
  307. anything up yet....   Thanks in advance!
  308.  
  309. Ralph Ritchey
  310. urritche@mcs.drexel.edu
  311.     @king.mcs.drexel.edu
  312.  
  313. +++++++++++++++++++++++++++
  314.  
  315. From: mac@coos.dartmouth.edu (Milton A. Colvin)
  316. Date: 22 Nov 92 22:25:18 GMT
  317. Organization: Dartmouth College, Hanover, NH
  318.  
  319. urritche@mcs.drexel.edu (Ralph Paul Ritchey) writes:
  320.  
  321.  
  322. >    Does anyone know of any code floating around that I can get my
  323. >hands on that uses the Time Manager?  I've poked around but haven't turned
  324. >anything up yet....   Thanks in advance!
  325.  
  326.  
  327.  
  328. Is MPW C++ OK?
  329.  
  330. FILE Ticker.h
  331. //----------------------------------------------------------------------------------------
  332. // Included files:
  333. //----------------------------------------------------------------------------------------
  334. #include    <Types.h>
  335. #include    <Timer.h>            // toolbox timer manager
  336.  
  337. //========================================================================================
  338. // class CTicker
  339. //========================================================================================
  340. // implement a cyclic subroutine called every (usec) 5sec.
  341. // this typically triggers some event or resets something
  342. // the subroutine is called as a timer task
  343. //    it must be memory resident
  344. //    it cannot reference globals
  345. //    it cannot call the OS
  346. //
  347. class CTicker : public TMTask
  348. {
  349. public:
  350.     CTicker(long usec) : fInterval(-usec),fCount(0) { }    // create inactive ticker
  351.     ~CTicker()                        { Off(); }            // inactivate & destroy
  352.     
  353.     void            On();            // start ticking
  354.     void            Off();            // stop
  355.     Boolean            Busy();            // determine whether running
  356.     
  357.     virtual    void    Tick();            // tick went off
  358.     long            Elapsed();        // elapsed time in usec
  359.  
  360.     long            fCount;            // incremented
  361.  
  362. protected:
  363.     QElemPtr        Task();            // timer queue entry
  364.     static pascal void    Ticked();    // handle & forward call
  365.     
  366.     long            fInterval;        // -usec intervals
  367. };
  368.  
  369. //========================================================================================
  370. // class CTicker
  371. //========================================================================================
  372. // run a precise timer
  373. // this timer measures the time from OnIOff
  374. // Once Off the elapsed time is available.
  375. // the timer is reset by reuse
  376.  
  377. class CTimer : public TMTask
  378. {
  379. public:
  380.     CTimer()                        { }        // create inactive timer
  381.     ~CTimer()                        { Off(); }    // inactivate & destroy timer
  382.     
  383.     void            On();            // start running
  384.     void            Off();            // stop
  385.     Boolean            Busy();            // determine whether running
  386.     long            Elapsed();        // elapsed time in usec
  387.  
  388. protected:
  389.     QElemPtr        Task();            // timer queue entry
  390. };
  391.  
  392.  
  393. FILE Ticker.cp
  394.  
  395. // implement various kinds of clock
  396. #include    "Ticker.h"
  397. #include    <Types.h>
  398. #include    <Timer.h>            // toolbox timer manager
  399. #include    <Limits.h>            // big numbers for times
  400.  
  401. #pragma segment Main            // some of this must be memory-resident
  402.  
  403. //========================================================================================
  404. // class CTicker
  405. //========================================================================================
  406.  
  407. // a timer task handler is called with the task pointer in A1
  408.  
  409. static void    *GetA1() = 0x2009;                    // MOVE.L A1,D0
  410.  
  411. //----------------------------------------------------------------------------------------
  412. // pass to OS as timer queue entry
  413. inline QElemPtr    CTicker::Task()    { return (QElemPtr)this; }
  414.  
  415. //----------------------------------------------------------------------------------------
  416. // to enable the ticker fill in the timer task and prime it
  417. void
  418. CTicker::On()
  419. {    qLink = NULL;
  420.     qType = 0;
  421.     tmCount = tmWakeUp = tmReserved = 0;
  422.     tmAddr = Ticked;                // our handler
  423.     InsXTime(Task());
  424.     PrimeTime(Task(),fInterval);
  425. }
  426.  
  427. //----------------------------------------------------------------------------------------
  428. // remove ticker from active timer queue
  429. //
  430. void    CTicker::Off()    { RmvTime(Task()); }
  431.  
  432. // i think this is true
  433. Boolean    CTicker::Busy()    { return qLink!=NULL; }
  434.  
  435. //----------------------------------------------------------------------------------------
  436. // when called we set up the this pointer
  437. // incrment the counter and forward the call
  438. //
  439. pascal void
  440. CTicker::Ticked()
  441. {    CTicker    &me = *(CTicker*)GetA1();    // this in A1
  442.     PrimeTime(me.Task(),me.fInterval);        // reschedule
  443.     me.fCount++;                        // just for good measure
  444.     me.Tick();                            // pass control
  445. }
  446.  
  447. //----------------------------------------------------------------------------------------
  448. //
  449. long    CTicker::Elapsed()    { return fCount*-fInterval; }
  450.  
  451. //----------------------------------------------------------------------------------------
  452. // the default handler does nothing
  453. //
  454. void    CTicker::Tick()    { }
  455.  
  456.  
  457. //========================================================================================
  458. // class CTimer
  459. //========================================================================================
  460.  
  461. // this limits the maximum duration we can measure
  462. // if we really wanted to be good,
  463. // we could handle the expiration and restart the timer
  464.  
  465. const long kMaxTime = INT_MAX;        // set a timer for as long as possible
  466.  
  467. //----------------------------------------------------------------------------------------
  468. // pass to OS as timer queue entry
  469. //
  470. inline QElemPtr    CTimer::Task()    { return (QElemPtr)this; }
  471.  
  472. //----------------------------------------------------------------------------------------
  473. // fill in the timer task and prime it
  474. //
  475. void
  476. CTimer::On()
  477. {    qLink = NULL;
  478.     qType = 0;
  479.     tmCount = tmWakeUp = tmReserved = 0;
  480.     tmAddr = NULL;                // no handler
  481.     InsXTime(Task());
  482.     PrimeTime(Task(),-kMaxTime);
  483. }
  484.  
  485. //----------------------------------------------------------------------------------------
  486. //
  487. void    CTimer::Off()    { RmvTime(Task()); }
  488.  
  489. //----------------------------------------------------------------------------------------
  490. //
  491. long    CTimer::Elapsed()    { return tmCount-kMaxTime; }
  492.  
  493. ---------------------------
  494.  
  495. From: garrett@me.udel.edu (Joel J. Garrett; Office 127 CMSL; Phone 831-2332)
  496. Subject: How to call FORTRAN subroutines from Excel (Summary)
  497. Date: 19 Nov 92 15:14:26 GMT
  498. Organization: University of Delaware
  499.  
  500. First of all, I'd like to thank the following for their replies and
  501. information:
  502.  
  503. Scott D. Stecker <stecker@ecn.purdue.edu>
  504. Michael Alan Roberts <roberts@ucunix.san.uc.EDU>
  505. David M. Palmer <palmer@alumni.cco.caltech.edu>
  506. Brion Sarachan <sarachan@wsqtbf.crd.ge.com>
  507. Andy Ralston <aralston@janus.ece.wisc.edu>
  508. David C. Doherty <doherty@msc.edu>
  509. Joel Spolsky <joelsp@microsoft.com>
  510.  
  511. And now here's the question I asked once again for those who may have
  512. missed my original posting:
  513.  
  514. >How difficult would it be to interface a set of existing FORTRAN
  515. >subroutines to an Excel Spreadsheet?  Is it possible to somehow include
  516. >a compiled set of subroutines and/or functions in an Excel spreadsheet
  517. >or add-in that could be called using the regular
  518. >'=function(arg1,arg2,arg3,...)' convention.  I think that I recall
  519. >reading something about being able to call code in DLLs from the
  520. >Windows version of Excel (and the MS Fortran compiler now can produce
  521. >DLLs, right?), but I mainly need to be able to do this using a
  522. >Macintosh-based FORTRAN compiler and Excel.  The reference section of
  523. >the Excel manuals lists a few hooks that are supposed to be used for
  524. >external functions, but they really don't give any examples or the
  525. >like, at least not as far as I can see.
  526.  
  527. >Suggestions regarding which FORTRAN compiler would work best for this
  528. >(on either platform, Windows or Mac) and how to actually pull it off
  529. >(if it is even possible) would be greatly appreciated.  Examples of how
  530. >to do this in Think C or Borland C++ would be helpful if it would be
  531. >possible to extrapolate these into Fortran solutions.
  532.  
  533. The general consensus seems to be that documentation for being able to do this
  534. kind of thing has been quite scarce in the past.  However, the Microsoft Press
  535. has just recently published a book which goes into this subject in detail. The
  536. "Excel Software Developer's Kit" (ISBN # 1-55615-521-2, $49.95 suggested
  537. retail price) gives examples of how to write external functions for Excel
  538. using the C programming language. (I am assuming that the book covers such
  539. development on _both_ the Mac & PC platforms, but I haven't gotten the book
  540. yet, so "caveat emptor")
  541.  
  542. Ok, so this isn't FORTRAN, but it shouldn't be too much of a stretch to
  543. extrapolate the FORTRAN solution from some C examples, and if push comes to
  544. shove I have access to Think C so we could always code with that if the
  545. FORTRAN solution doesn't work out.
  546.  
  547. So, technically, the jury is still out on how difficult calling FORTRAN
  548. subroutines from Excel will be.  Once I get the book and do some work it
  549. should be pretty clear how well this kind of thing works.  Anyone
  550. interested in the outcome of this experiment should send me email and I'll
  551. let you all know how things turn out in the end.
  552.  
  553. The main consensus on which FORTRAN compiler to use on the Mac was the product
  554. from Language Systems, which wasn't a big surprise - I had already read the
  555. report on Macintosh Fortran compilers in the sumex Info-Mac archives
  556. (/info-mac/reports/fortran-compilers.txt at sumex-aim.stanford.edu)
  557.  
  558. I also learned about the "Excel Developers' Forum" mailing list
  559. (clay=xldev@microsoft.COM), which will also prove to be a useful resource for
  560. information exchange as we get more into Excel software development.  Does
  561. anyone know the registration address for this mailing list so that I can
  562. officially join the list?
  563.  
  564. Thanks again to those who took the time to respond!
  565.  
  566. Joel Garrett
  567. (garrett@me.udel.edu)
  568.  
  569. +++++++++++++++++++++++++++
  570.  
  571. From: (Tim Keitt)
  572. Date: Fri, 20 Nov 92 17:56:53 GMT
  573. Organization: University of New Mexico, Albuquerque NM
  574.  
  575. In article <BxyyC2.41D@news.udel.edu> garrett@me.udel.edu (Joel J. Garrett; Office 127 CMSL; Phone 831-2332) writes:
  576. >First of all, I'd like to thank the following for their replies and
  577. >information:
  578. >
  579. >Scott D. Stecker <stecker@ecn.purdue.edu>
  580. >Michael Alan Roberts <roberts@ucunix.san.uc.EDU>
  581. >David M. Palmer <palmer@alumni.cco.caltech.edu>
  582. >Brion Sarachan <sarachan@wsqtbf.crd.ge.com>
  583. >Andy Ralston <aralston@janus.ece.wisc.edu>
  584. >David C. Doherty <doherty@msc.edu>
  585. >Joel Spolsky <joelsp@microsoft.com>
  586. >
  587. >>How difficult would it be to interface a set of existing FORTRAN
  588. >>subroutines to an Excel Spreadsheet?  Is it possible to somehow include
  589. >
  590. > stuff deleted...
  591. >
  592. >Thanks again to those who took the time to respond!
  593. >
  594. >Joel Garrett
  595. >(garrett@me.udel.edu)
  596.  
  597. I just thought I'd mention that I recently hear that MS is 
  598. building a callable interface to Excel. When that's available, 
  599. you'll be able to call *excel* from within your program (I 
  600. suppose this may be at the DLL level, but I'm not sure). This 
  601. is a great idea, someone could for instance create a full blown 
  602. stats package that used calls to excel for its interface and 
  603. display output. It would be like an excel add-in, only much 
  604. faster and with smoother integration. All of excels built in 
  605. functions would I presume be available as function calls. This 
  606. could save a lot of coding effort.
  607.  
  608. - --
  609. Timothy Keitt
  610. tkeitt@algodones.unm.edu
  611.  
  612.  
  613.  
  614.  
  615. +++++++++++++++++++++++++++
  616.  
  617. From: joelsp@microsoft.com (Joel Spolsky)
  618. Date: 22 Nov 92 05:33:09 GMT
  619. Organization: Microsoft Corporation
  620.  
  621. In article <5mnq6n-@lynx.unm.edu> tkeitt@algodones.unm.edu writes:
  622. >
  623. >I just thought I'd mention that I recently heard that MS is 
  624. >building a callable interface to Excel.
  625. > ...
  626.  
  627. It's done. All you need is the Excel Software Development Kit (ISBN
  628. 1-55615-521-2; Microsoft Press; $49.95; to order call 1-800-MSPRESS)
  629. and Excel 4.0 or later. You can create code resources (on the Mac) or
  630. DLLs (on Windows) that call Excel and use Excel's functionality.
  631.  
  632. - --
  633. Joel Spolsky
  634. Program Manager
  635. Microsoft Excel
  636. joelsp@microsoft.com
  637.  
  638.  
  639.  
  640. ---------------------------
  641.  
  642. From: brownlow@informix.com (Keith Brownlow)
  643. Subject: best way to pause in app ?
  644. Date: 20 Nov 92 00:27:18 GMT
  645. Organization: Informix Software, Inc.
  646.  
  647. Is there a toolbox command to make the application wait x number of seconds
  648. before continuing processing ?  I've tried looping for 1000's of seconds but
  649. without doing anything in the loop, it's more or less instantly coming back.
  650.  
  651. Anyone got a simple solution that I've missed in my manuals ?
  652. - -- 
  653. - -------------------------------------------------------------------------------
  654. |brownlow@informix.com     "Intense !"                                        |
  655. |brownlow@wet.com          "A repo man's always intense !"                    |
  656. - -------------------------------------------------------------------------------
  657.  
  658. +++++++++++++++++++++++++++
  659.  
  660. From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
  661. Organization: Computer Systems Laboratory, DCRT, NIH
  662. Date: Fri, 20 Nov 1992 13:53:48 GMT
  663.  
  664. In article <brownlow.722219238@stmartin>, brownlow@informix.com (Keith Brownlow) writes:
  665. >Is there a toolbox command to make the application wait x number of seconds
  666. >before continuing processing ?  I've tried looping for 1000's of seconds but
  667. >without doing anything in the loop, it's more or less instantly coming back.
  668.  
  669. Several things you can use (code given in C):
  670.  
  671. 1)  You could use Delay(60L * num_of_seconds, &dummy_long);
  672.  
  673.     This is okay, except that it pretty much freezes the machine until the
  674.     delay is over, i.e. no background processing.
  675.  
  676. 2)  You could call WaitNextEvent(0, &dummy_event, 60L * num_of_seconds, 0L);
  677.  
  678.     This would give time to other processes, but would not necessarily give
  679.     them the full time you specify.  If you're the only process running, for
  680.     example, you would return immediately.
  681.  
  682. 3)  Combination approach:
  683.  
  684.     long timeNow;
  685.  
  686.     timeNow = TickCount();
  687.     while (TickCount() - timeNow < 60L * num_of_seconds)
  688.     {
  689.         (void) WaitNextEvent(0, &dummyEvent, 0L, 0L);
  690.     }
  691.  
  692.     This repeatedly gives time to other processes until the specified amount
  693.     of time has elapsed, at which point you drop out of the while loop.
  694.  
  695. Calling Delay() for long periods of time (i.e. seconds) is pretty anti-
  696. social to other processes; I'd probably use approach 3) if I were going to
  697. be pausing for more than about a second.  The one caveat is that you *might*
  698. not get control back for a much longer time, if another process is trying to
  699. hog the machine by not calling WaitNextEvent().
  700.  
  701. - ------------------------------------------------------------------------------
  702. Christopher Tate             | The Leadfoot Collection, Continued:
  703. Management System Designers  |     * Heavy Fuel (Dire Straits)
  704.                              |     * Last Scene in September (Preston Reed)
  705. fixer@faxcsl.dcrt.nih.gov    | Because driving fast is a cathartic experience.
  706.  
  707. +++++++++++++++++++++++++++
  708.  
  709. From: weiser@pogo.den.mmc.com (Matt Weiser)
  710. Organization: Martin Marietta WIS
  711. Date: Fri, 20 Nov 1992 16:42:09 GMT
  712.  
  713. In article <brownlow.722219238@stmartin>, brownlow@informix.com (Keith Brownlow) writes:
  714. > Is there a toolbox command to make the application wait x number of seconds
  715. > before continuing processing ?  I've tried looping for 1000's of seconds but
  716. > without doing anything in the loop, it's more or less instantly coming back.
  717. > Anyone got a simple solution that I've missed in my manuals ?
  718. > -- 
  719. > -------------------------------------------------------------------------------
  720. > |brownlow@informix.com     "Intense !"                                        |
  721. > |brownlow@wet.com          "A repo man's always intense !"                    |
  722. > -------------------------------------------------------------------------------
  723.  
  724. IM Vol II p.384:
  725.  
  726. PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
  727. Trap macro _Delay
  728. On entry   A0: numTicks (long word)
  729. On exit    D0: finalTicks (long word)
  730.  
  731. Delay causes the system to wait for the number of ticks (sixtieths of a sec)
  732. specified by numTicks, and returns in finalTicks the total number of ticks
  733. from system startup to the end of the delay.
  734.  
  735. Warning: Don't rely on the duration of the delay being exact; it will
  736. usually be accurate to within one tick, but may be off by more than that.
  737. <why is deleted because I don't think it matters in your case>
  738.  
  739. Example:
  740. void wait( long numOfSecs )
  741. {
  742.    
  743.    long numTicks = numOfSecs * 60;
  744.    long fianlTicks; 
  745.  
  746.    Delay( numTicks, &finalTicks );
  747. }
  748.  
  749. Matt Weiser
  750. weiser@pogo.den.mmc.com
  751.  
  752. +++++++++++++++++++++++++++
  753.  
  754. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  755. Organization: Kalamazoo College
  756. Date: Fri, 20 Nov 1992 18:56:55 GMT
  757.  
  758. weiser@pogo.den.mmc.com (Matt Weiser) writes:
  759. >brownlow@informix.com (Keith Brownlow) writes:
  760. >> 
  761. >> Is there a toolbox command to make the application wait x number of seconds
  762. >> before continuing processing ?
  763. >
  764. >PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
  765.  
  766. Help stamp out _Delay!
  767.  
  768. Or at least, stamp it out if there's a better way to do things.  _Delay
  769. grabs the CPU and doesn't let any other app have any time.  If you meet
  770. two conditions, you can be much friendlier:  (1) your delay period is
  771. longer than two or three ticks, and (2) it's not absolutely 100%
  772. essential that you make it back right on time.
  773.  
  774. If those conditions apply--and I think they will, because you implied
  775. you'll be waiting at least one second, and you're probably not writing
  776. for a hospital--try code like the following:
  777.  
  778. void betterDelay(short nTicksToDelay)
  779. {
  780.    long lastTick = TickCount();
  781.    while (nTicksToDelay > 3) { // the lower this number, the friendlier
  782.          // give time to other apps
  783.       EventRecord myEventRec;
  784.       Boolean needToHandleEvt;
  785.       needToHandleEvt = WaitNextEvent(0, &myEventRec,
  786.          Max(nTicksToDelay - 5, 0),
  787.          NULL);
  788.       nTicksToDelay -= TickCount() - lastTick;
  789.       lastTick += nTicksToDelay;
  790.    }
  791.    while (TickCount()-lastTick < nTicksToDelay) {
  792.       // wait in a tight, unfriendly loop
  793.    }
  794. }
  795.  
  796. I know some gurus will be able to improve on this.  For example, if your
  797. app is getting update events and you're not responding to them, then
  798. no other app will get time anyway.  Plus, it's not a good idea to lock
  799. out suspend/resume events, because if another process brings itself to
  800. the front, you'll be suspended without your knowledge.  But if you don't
  801. have any update events pending when you call this, you stand a very good
  802. chance of being excellent to your fellow apps.  And a good chance is
  803. better than none.
  804. - -- 
  805.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  806.  My contribution to urban blues...
  807.  
  808. +++++++++++++++++++++++++++
  809.  
  810. From: cklarson@tomatillo.engr.ucdavis.edu (Christopher Klaus Larson)
  811. Date: 23 Nov 92 19:05:59 GMT
  812. Organization: College of Engineering - University of California - Davis
  813.  
  814. In article <brownlow.722219238@stmartin> brownlow@informix.com (Keith Brownlow) writes:
  815. >Is there a toolbox command to make the application wait x number of seconds
  816. >before continuing processing ?  I've tried looping for 1000's of seconds but
  817. >without doing anything in the loop, it's more or less instantly coming back.
  818. >
  819. >Anyone got a simple solution that I've missed in my manuals ?
  820. >-- 
  821.  
  822. Look into using the Delay() function. You need to specify the time to
  823. delay in Ticks (approx. 1/60 sec) but this should be just what the
  824. doctor ordered.
  825.  
  826. - --Chris
  827. cklarson@taco.engr.ucdavis.edu
  828.  
  829. ---------------------------
  830.  
  831. From: goodill_eric@tandem.com (Eric Goodill)
  832. Subject: Simulating odoc event from THINK Pascal?
  833. Organization: Tandem Computers, Inc.
  834. Date: Fri, 20 Nov 1992 16:43:56 GMT
  835.  
  836. Hi,
  837.  
  838. Has anybody come up with a relatively easy way to simulate odoc events from
  839. within THINK Pascal so that I can use the source level debugger while
  840. debugging my Apple event handlers?  As it stands, I've just been using
  841. Macsbug which works just fine but is a bit tedious.
  842.  
  843. Cheers, Eric
  844. Eric Goodill, goodill_eric@tandem.com, Tandem Computers, Cupertino, Calif.
  845.  
  846. +++++++++++++++++++++++++++
  847.  
  848. From: jpugh@apple.com (Jon Pugh)
  849. Date: Sat, 21 Nov 1992 06:41:41 GMT
  850. Organization: Apple Computer, Inc.
  851.  
  852. In article <goodill_eric-201192084213@ericg.cpd.tandem.com>,
  853. goodill_eric@tandem.com (Eric Goodill) wrote:
  854. > Has anybody come up with a relatively easy way to simulate odoc events from
  855. > within THINK Pascal so that I can use the source level debugger while
  856. > debugging my Apple event handlers?  As it stands, I've just been using
  857. > Macsbug which works just fine but is a bit tedious.
  858.  
  859. Add a **** FREF to THINK Pascal's BNDL if it doesn't already have one.  I
  860. forget if I added one myself or if it came with one.  Rebuild your desktop
  861. if you do add it.
  862.  
  863. Now you can drag and drop things onto THINK Pascal.
  864.  
  865. Run your program.  Drag something onto THINK Pascal.  Your program will get
  866. the 'odoc' event.  Debug as usual.
  867.  
  868. Simple enough for you?
  869.  
  870. Jon
  871.  
  872. +++++++++++++++++++++++++++
  873.  
  874. From: siegel@world.std.com (Rich Siegel)
  875. Organization: GCC Technologies
  876. Date: Sat, 21 Nov 1992 23:28:01 GMT
  877.  
  878. In article <goodill_eric-201192084213@ericg.cpd.tandem.com> goodill_eric@tandem.com (Eric Goodill) writes:
  879. >
  880. >Has anybody come up with a relatively easy way to simulate odoc events from
  881. >within THINK Pascal so that I can use the source level debugger while
  882. >debugging my Apple event handlers?  As it stands, I've just been using
  883. >Macsbug which works just fine but is a bit tedious.
  884.  
  885. THINK Pascal will pass Apple Events on to the running program. The catch
  886. is that since THINK Pascal suspends the running program when you switch
  887. out, the Apple Event needs to come from another machine on the network,
  888. a background daemon-like program that sends them once in a while, or
  889. from the running program itself.
  890.  
  891. R.
  892.  
  893.  
  894.  
  895. - -- 
  896. - -----------------------------------------------------------------------
  897. Rich Siegel                              Internet: siegel@world.std.com
  898. Software Engineer & Toolsmith
  899. GCC Technologies
  900.  
  901. +++++++++++++++++++++++++++
  902.  
  903. From: potts@oit.itd.umich.edu (Paul Potts)
  904. Date: 23 Nov 1992 15:24:06 GMT
  905. Organization: Instructional Technology Laboratory, University of Michigan
  906.  
  907. In article <By3AIq.Ht6@world.std.com> siegel@world.std.com (Rich Siegel) writes:
  908. >In article <goodill_eric-201192084213@ericg.cpd.tandem.com> goodill_eric@tandem.com (Eric Goodill) writes:
  909. >>
  910. >>Has anybody come up with a relatively easy way to simulate odoc events from
  911. >>within THINK Pascal so that I can use the source level debugger while
  912. >>debugging my Apple event handlers?  As it stands, I've just been using
  913. >>Macsbug which works just fine but is a bit tedious.
  914. >
  915. >THINK Pascal will pass Apple Events on to the running program. The catch
  916. >is that since THINK Pascal suspends the running program when you switch
  917. >out, the Apple Event needs to come from another machine on the network,
  918. >a background daemon-like program that sends them once in a while, or
  919. >from the running program itself.
  920.  
  921. A related note - when I was working on some AppleEvent code last year, I
  922. would use a Hypercard stack with the AE XCMDs to send events to my program,
  923. and leave my program running under the debugger (THINK C, not Pascal) with
  924. a breakpoint in my AE handlers. Both were running on the same machine - I
  925. would swap from the project running in the debugger to Hypercard, send the
  926. event, and then when it was received the debugger would stop at the breakpoint.
  927. This was a tremendous timesaver. I'm not sure if it is possible to do something
  928. like this in THINK Pascal, though.
  929.  
  930. (Actually I did this on a 4-meg SE/30 with virtual memory set to 16 megs;
  931. performance wasn't really that bad, since the main swapping occurred only when
  932. I switched applications. At the time System 7 was pretty new, and I was
  933. amazed that this scheme actually worked!)
  934.  
  935. - -- 
  936. Politics is crime pursued by other means.              
  937. potts@oit.itd.umich.edu      CI$ 71561,3362 (rarely)
  938.  
  939. ---------------------------
  940.  
  941. From: brunner@crchh447.bnr.ca (James Brunner)
  942. Subject: Whip me, beat me, what to do with DISCIPLINE?
  943. Date: 19 Nov 92 01:13:29 GMT
  944. Organization: Bell-Northern Research, Richardson, Tx
  945.  
  946. Ahh, the title caught your eye!
  947.  
  948. I'm trying to get discipline to work.  I have figured out that macsbugs (which
  949. I've used quite a bit) must be in the system folder.  I've put discipline in
  950. the extensions folder.  And put the discipline startup file in the system
  951. folder.
  952.  
  953. I've tried using the "lenient" settings file and the finder keeps trapping it!
  954. (As soon as I turn it on with macsbugs DSCA ON).  (I'm glad I didn't try strict.)
  955.  
  956. How do you use this?  Is there a way that I can make it only trap on my
  957. program?  Are there any real instructions?  If so, are they on line somewhere
  958. where I can ftp them?
  959.  
  960. Help.  I got a strange bug and I'm hoping that this will help me to find it.
  961. - -- 
  962. - ---------------------------------------------------------------------------
  963. Jim Brunner - (brunner@bnr.ca)
  964. All opinions are my own and have nothing whatsoever to do with BNR, NT,
  965. NTI, Bell Canada, or any of the BCE corporations or affiliates.
  966.  
  967. +++++++++++++++++++++++++++
  968.  
  969. From: danwood@netcom.com (Daniel J Wood)
  970. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  971. Date: Thu, 19 Nov 1992 17:31:57 GMT
  972.  
  973. brunner@crchh447.bnr.ca (James Brunner) writes:
  974.  
  975. >I'm trying to get discipline to work.  
  976.  
  977. Welcome to the club. 
  978. >I've tried using the "lenient" settings file and the finder keeps trapping it!
  979. >(As soon as I turn it on with macsbugs DSCA ON).  
  980.  
  981. Try typing DSCA ON from *within your application* to prevent discipline from
  982. acting on the finder. Yes, Finder violates beaucoup of what discipline catches.
  983. I've managed to use Discipline this way with success!
  984.  
  985.  
  986. +++++++++++++++++++++++++++
  987.  
  988. From: creiman@netcom.com
  989. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  990. Date: Thu, 19 Nov 1992 18:05:31 GMT
  991.  
  992. brunner@crchh447.bnr.ca (James Brunner) writes:
  993.  
  994. >Ahh, the title caught your eye!
  995.  
  996. Yes, it did. Nice work.
  997.  
  998. >I'm trying to get discipline to work.  I have figured out that macsbugs (which
  999. >I've used quite a bit) must be in the system folder.  I've put discipline in
  1000. >the extensions folder.  And put the discipline startup file in the system
  1001. >folder.
  1002.  
  1003. You've already screwed up by assuming Disipline is worth using. In all my
  1004. days, the only thing Disipline has taught me is that the Finder is using
  1005. SetRect wrong. Zippity-do-da. But if you must plow ahead:
  1006.  
  1007. 1) Don't use D. the way they tell you to. Instead, change its type to 'APPL'.
  1008.    Take it out of the system folder, you've probably got enough junk there
  1009.    anyway.
  1010.  
  1011. 2) Reboot, so you don't have it installed. Now, just double click on the
  1012.    D. application. Make sure there is a startup file in the same directory
  1013.    as D. itself. D. will install (but not activate) itself. The nice
  1014.    part about this is you can just quit D. when your done.
  1015.  
  1016. 3) Go into Macsbug at the appropriate time and do the 'DSC ON' stuff. 
  1017.    If you want to get fancy, you can bracket the code you want to test
  1018.    with DebugStr's to activate and deactivate D.
  1019.    
  1020. 4) Realize you've been wasting time. Go buy TMON Pro or Jasik's Debugger,
  1021.    since they both do a better job at discipline than Discipline. Or,
  1022.    try your app under EvenBetterBusErr, Xap handles, Blat, or heap 
  1023.    scrambling. Unlike Discipline, these have all proven their worth.
  1024.    (Leaks is pretty good too).
  1025.  
  1026. 5) Another good technique is to extend the Xap handles concept one
  1027.    step further. Xap handles only stuffs a block with junk after you
  1028.    free it up. This doesn't catch uninitialized data structures. You
  1029.    can modify your program's memory allocator to stuff new blocks with
  1030.    bus error values when first allocated. This usualy catches lots of
  1031.    bugs for me. I think Jasik's will do this for you.
  1032.  
  1033. Sorry for rambling on. Debugging is something I do far too often, and
  1034. simple techniques like EBBE, et al can save much gnashing of teeth in
  1035. the long run.
  1036.  
  1037. Chao,
  1038.  
  1039. Charlie.
  1040. - -- 
  1041. Charlie Reiman
  1042. creiman@netcom.com
  1043.  
  1044. +++++++++++++++++++++++++++
  1045.  
  1046. From: rla20@duts.ccc.amdahl.com (Roger Allen)
  1047. Date: 20 Nov 92 19:43:17 GMT
  1048. Organization: Amdahl Corporation, Sunnyvale CA
  1049.  
  1050. In article <1992Nov19.180531.4442@netcom.com> creiman@netcom.com writes:
  1051. >   try your app under EvenBetterBusErr, Xap handles, Blat, or heap 
  1052. >   scrambling. Unlike Discipline, these have all proven their worth.
  1053. >   (Leaks is pretty good too).
  1054. >
  1055. >Chao,
  1056. >
  1057. >Charlie.
  1058.  
  1059. What are Xap and Blat?  I haven't heard of these before.
  1060.  
  1061. (BTW, I agree 1000% with Charlie on EBBE, hs and leaks)
  1062.  
  1063. Thanks,
  1064.  
  1065. Roger
  1066.  
  1067. - --
  1068. > Roger Allen                   | Opinions expressed by me do not        <
  1069. > Amdahl Computer Development   | represent the opinions of Amdahl.      <
  1070. > rla20@cd.amdahl.com           |                                        <
  1071.  
  1072. +++++++++++++++++++++++++++
  1073.  
  1074. From: creiman@netcom.com
  1075. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  1076. Date: Fri, 20 Nov 1992 22:55:17 GMT
  1077.  
  1078. rla20@duts.ccc.amdahl.com (Roger Allen) writes:
  1079.  
  1080. >In article <1992Nov19.180531.4442@netcom.com> creiman@netcom.com writes:
  1081. >>   try your app under EvenBetterBusErr, Xap handles, Blat, or heap 
  1082. >>   scrambling. Unlike Discipline, these have all proven their worth.
  1083. >>   (Leaks is pretty good too).
  1084. >>
  1085. >>Chao,
  1086. >>
  1087. >>Charlie.
  1088.  
  1089. >What are Xap and Blat?  I haven't heard of these before.
  1090.  
  1091. Xap clears handle and pointer blocks to bus error values when
  1092. disposed.  It's handy for catching references to freed structures.
  1093. Unfortunately, it doesn't pre-clear freshly allocated blocks to bus
  1094. error values; which is handy for catching improperly initialized
  1095. structures. If you use private glue to call the system's memory
  1096. manager, you can write these utilties into your app for development,
  1097. then strip them out when release time comes around.
  1098.  
  1099. Blat uses protected memory mode of the MMU to protect the low level
  1100. vectors.  Basiclly, a fool-proof EBBE. This power has a price: you
  1101. can't use VM with it.
  1102.  
  1103. Have fun,
  1104.  
  1105. Charlie.
  1106.  
  1107. - -- 
  1108. Charlie Reiman
  1109. creiman@netcom.com
  1110.  
  1111. +++++++++++++++++++++++++++
  1112.  
  1113. From: robichau@lambda.msfc.nasa.gov (Paul Robichaux)
  1114. Organization: New Technology, Inc.
  1115. Date: Mon, 23 Nov 1992 17:27:55 GMT
  1116.  
  1117. In <1992Nov20.225517.15649@netcom.com> creiman@netcom.com writes:
  1118. >Blat uses protected memory mode of the MMU to protect the low level
  1119. >vectors.  Basiclly, a fool-proof EBBE. This power has a price: you
  1120. >can't use VM with it.
  1121.  
  1122. Blat also doesn't run on some machines- the IIci and IIsi come to
  1123. mind, but I'm not certain if that's an inclusive list or not. 
  1124. - -- 
  1125. Paul Robichaux, KD4JZG              | May explode if disposed of improperly.
  1126. Mission Software Development Div.   | Printed on recycled phosphors.
  1127. New Technology, Inc.            | ** PGP 2.0 key available on request **
  1128.  
  1129. +++++++++++++++++++++++++++
  1130.  
  1131. From: nagle@netcom.com (John Nagle)
  1132. Date: 23 Nov 92 20:56:48 GMT
  1133. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1134.  
  1135. creiman@netcom.com writes:
  1136. >You've already screwed up by assuming Disipline is worth using. In all my
  1137. >days, the only thing Disipline has taught me is that the Finder is using
  1138. >SetRect wrong. 
  1139.  
  1140.       Yes, the Finder people really should fix that.  Or is there some
  1141. secret thing you can get the Window Manager to do with vacuous rectangles?
  1142.  
  1143.                         John Nagle
  1144.  
  1145. ---------------------------
  1146.  
  1147. End of C.S.M.P. Digest
  1148. **********************
  1149.