home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17326 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  10.5 KB

  1. Path: sparky!uunet!comp.vuw.ac.nz!actrix!templar!jbickers
  2. From: jbickers@templar.actrix.gen.nz (John Bickers)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Frequently Asked Questions
  5. Message-ID: <jbickers.0l8d@templar.actrix.gen.nz>
  6. Date: 14 Dec 92 21:44:57 PST
  7. Organization: TAP
  8. Lines: 272
  9.  
  10.     Well, it's been about a month since I began trying to keep track
  11.     of various questions, so here's the first installment of the FAQ,
  12.     which I will post fortnightly if no-one complains. :)
  13.  
  14.     Suggestions, flames, etc to jbickers@templar.actrix.gen.nz.
  15.  
  16.     ------------------------------ 8< ------------------------------
  17.  
  18.     Last modified 7th Dec 92. Search for "*** index>" to get to a
  19.     specific topic.
  20.  
  21.  
  22.     TABLE OF CONTENTS
  23.  
  24.  
  25.     Communications
  26.     1   Where can one get information about XPR libraries?
  27.     2   How does one drop DTR?
  28.  
  29.     Compression
  30.     3   Where can one get information about XPK libraries?
  31.  
  32.     DOS
  33.     4   Can an ACTION_READ packet to a console be aborted?
  34.     5   How do I get a pointer to the window I was launched from?
  35.  
  36.     Exec
  37.     6   What do GURU numbers mean?
  38.  
  39.     Graphics
  40.     7   What is DIG/RTG?
  41.  
  42.     Intuition
  43.     8   How do I block a window from user input?
  44.  
  45.     Languages
  46.     9   LISP, Scheme, ML, Gofer, functional programming.
  47.     10  I need a Scheme to use with Abelson & Sussman's "Structure and
  48.         Interpretation of Computer Programs."
  49.     11  Is there an Ada implementation available?
  50.     12  Are there freely distributable C compilers available?
  51.  
  52.     SAS C
  53.     13  Are malloc()/free() much slower under 6.1 than 5.10?
  54.  
  55.     Workbench
  56.     14  How do I get rid of the CON: created when my program starts?
  57.  
  58. *** 1>  Where can one get information about XPR libraries?
  59.  
  60.     There is an XPR mailing list. To join, send a message to
  61.     xpr-request@aldhfn.akron.oh.us, with "subsribe user@site" as the
  62.     body.
  63.  
  64.     Version 2.0 of the XPR spec. can be found on Fish disk #247. The
  65.     mailing list is currently discussing things to go into the 3.0
  66.     XPR spec., and comes with an XPR FAQ.
  67.  
  68. *** 2>  How does one drop DTR?
  69.  
  70.     1.  If you are using a CBM device, eg serial.device, you must call
  71.         CloseDevice() to drop DTR. DTR is asserted when you open the
  72.         device, and no other system mechanism is provided to drop DTR.
  73.  
  74.     2.  Many other devices support an extra command to control the DTR
  75.         and RTS lines. This was originated by ASDG. The following is
  76.         extracted from code originally posted by Russell McOrmond:
  77.  
  78.         #define SIOCMD_SETCTRLLINES 0x10
  79.         #define SIOB_RTSB  0
  80.         #define SIOB_DTRB  1
  81.         #define SIOB_RTSF  (1<<SIOB_RTSB)
  82.         #define SIOB_DTRF  (1<<SIOB_DTRB)
  83.  
  84.         IOSer.io_Command = SIOCMD_SETCTRLLINES;
  85.         IOSer.io_Offset  = SIOB_DTRF;
  86.         if (raising DTR) IOSer.io_Length = SIOB_DTRF;
  87.         else IOSer.io_Length = 0;
  88.  
  89.         The io_Offset is a mask of bits to be affected (RTS and DTR),
  90.         and the io_Length is a value to set each bit to. So to drop
  91.         DTR you set the DTR bit in io_Offset, and clear the DTR bit
  92.         in io_Length. To raise DTR again, you set the DTR bit in both
  93.         io_Offset and io_Length.
  94.  
  95.     3.  If you are using the internal serial port with CBM's
  96.         serial.device, you can drop DTR without calling CloseDevice by
  97.         banging the hardware. Again the following is extracted from
  98.         code originally posted by Russell McOrmond:
  99.  
  100.         struct CIA *Ciab = (struct CIA *)0xbfd000;
  101.  
  102.         Disable();
  103.         Ciab->ciaddra |= CIAF_COMDTR;                   /* Set DTR as output */
  104.         if (raising DTR) Ciab->ciapra &= ~CIAF_COMDTR;  /* Raise */
  105.         else Ciab->ciapra |= CIAF_COMDTR;               /* Drop */
  106.         Enable();
  107.  
  108. *** 3>  Where can one get information about XPK libraries?
  109.  
  110.     The XPK libraries are a collection of run-time libraries that
  111.     implement a variety of compression and encryption methods. The
  112.     user and development archives are available for FTP from
  113.     amiga.physik.unizh.ch.
  114.  
  115. *** 4>  Can an ACTION_READ packet to a console be aborted?
  116.  
  117.     No, with the exception that if you close the console, then all
  118.     pending packets are returned.
  119.  
  120. *** 5>  How do I get a pointer to the window I was launched from?
  121.  
  122.     1.  The following may return a pointer with a value of -1, if the
  123.         console you were launched from has had requesters disabled.
  124.  
  125.         struct Process *pProc;
  126.  
  127.             pProc = (struct Process *)FindTask(NULL);
  128.             pWin = pProc->pr_WindowPtr;
  129.  
  130.     2.  The following code is SAS C specific, but could easily be
  131.         modified to suit other compilers:
  132.  
  133.     /* findwindow.c - utility routine to find window of a CLI.
  134.         From: deven@rpi.edu (Deven T. Corzine)
  135.         Subject: Re: Finding Windows
  136.         Date: 20 Jul 90 16:14:05 GMT
  137.      */
  138.     #include <exec/types.h>
  139.     #include <exec/memory.h>
  140.     #include <proto/exec.h>
  141.     #include <proto/dos.h>
  142.  
  143.     struct Window __regargs *FindWindow()
  144.     {
  145.        register struct DosLibrary *DOSBase;
  146.        register struct Window *win;
  147.        register struct Process *proc;
  148.        register struct CommandLineInterface *cli;
  149.        register struct InfoData *id;
  150.        register struct StandardPacket *pkt;
  151.        register struct FileHandle *fh;
  152.        register BPTR file;
  153.        register long ret1,ret2;
  154.  
  155.        if (DOSBase=(struct DosLibrary *) OpenLibrary(DOSNAME,0)) {
  156.           if (id=(struct InfoData *)
  157.             AllocMem(sizeof(struct InfoData),MEMF_PUBLIC|MEMF_CLEAR)) {
  158.              if (pkt=(struct StandardPacket *)
  159.                AllocMem(sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR)) {
  160.                 proc=(struct Process *) FindTask(NULL);
  161.                 if (cli=(struct CommandLineInterface *) (proc->pr_CLI<<2)) {
  162.                    ret1=cli->cli_ReturnCode;
  163.                    ret2=cli->cli_Result2;
  164.                    if (file=Open("*",MODE_NEWFILE)) {
  165.                       if (IsInteractive(file)) {
  166.                          pkt->sp_Msg.mn_Node.ln_Name=(char *) &(pkt->sp_Pkt);
  167.                          pkt->sp_Pkt.dp_Link=&(pkt->sp_Msg);
  168.                          pkt->sp_Pkt.dp_Port=&(proc->pr_MsgPort);
  169.                          pkt->sp_Pkt.dp_Type=ACTION_DISK_INFO;
  170.                          pkt->sp_Pkt.dp_Arg1=((ULONG) id)>>2;
  171.                          fh=(struct FileHandle *) (file<<2);
  172.                          PutMsg(fh->fh_Type,(struct Message *) pkt);
  173.                          WaitPort(&(proc->pr_MsgPort));
  174.                          GetMsg(&(proc->pr_MsgPort));
  175.                          win=(struct Window *) id->id_VolumeNode;
  176.                       }
  177.                       Close(file);
  178.                    }
  179.                    cli->cli_Result2=ret2;
  180.                    cli->cli_ReturnCode=ret1;
  181.                 }
  182.                 FreeMem(pkt,sizeof(struct StandardPacket));
  183.              }
  184.              FreeMem(id,sizeof(struct InfoData));
  185.           }
  186.           CloseLibrary((struct Library *) DOSBase);
  187.        }
  188.        return(win);
  189.     }
  190.  
  191. *** 6>  What do GURU numbers mean?
  192.  
  193.     Try and find a program called "guru", or another called "alert".
  194.     These programs will decode the GURU value and translate it into
  195.     English.
  196.  
  197. *** 7>  What is DIG/RTG?
  198.  
  199.     DIG is Device Independent Graphics. A set of graphics routines
  200.     that does not require a particular device to work.
  201.  
  202.     RTG is ReTargetable Graphics. A set of graphics routines that
  203.     normally work with a particular device, but can be changed at a
  204.     low level to work with other devices.
  205.  
  206.     They are basically the same thing, though DIG is more often used
  207.     to refer to things like Postscript where the output device can be
  208.     a monitor, a plotter, a printer, etc. RTG is more often used to
  209.     refer to different display hardware, usually meaning a different
  210.     number of colors or a different pixel format, planar vs chunky.
  211.  
  212. *** 8>  How do I block a window from user input?
  213.  
  214.     Normally this is required when you want to open a second window
  215.     that should act like a requester. The solution is to open a real
  216.     requester in the window you want to block, that is 1 pixel by
  217.     1 pixel, and hidden somewhere in your first window. Remove this
  218.     tiny requester when you are ready to close your second window.
  219.  
  220.     You can also change the IDCMP flags on your first window so that
  221.     messages don't pile up.
  222.  
  223. *** 9>  LISP, Scheme, ML, Gofer, functional programming.
  224.  
  225.     A number of Amiga LISP implementations are available by FTP from
  226.     gatekeeper.pa.dec.com, in the directory /pub/micro/amiga/lisp. The
  227.     file LISP.LIST also has a list of such things, though it is a bit
  228.     dated. A modern version of that list can be obtained from
  229.     contessa.palo-alto.ca.us. Either use bms to fetch
  230.     bms:pub/lisp.list, or send mail to:
  231.  
  232.         amigalisp-request@contessa.palo-alto.ca.us
  233.  
  234.     asking for that list. This address can be used to ask to be added
  235.     to the amigalisp mail list.
  236.  
  237.     These references also apply to questions about Scheme, ML, Gofer,
  238.     functional programming, and other such things.
  239.  
  240. *** 10> I need a Scheme to use with Abelson & Sussman's "Structure and
  241.         Interpretation of Computer Programs."
  242.  
  243.     Either SIOD, Ed Turner's Scheme, or XScheme should be suitable for
  244.     this. If you have experience to the contrary, please let the FAQ
  245.     list maintainer and amigalisp@contessa.palo-alto.ca.us know. Those
  246.     systems can all be obtained via anonymous FTP from
  247.     gatekeeper.pa.dec.com, in /pub/micro/amiga/lisp. SIOD is on Fish
  248.     disk #525, and Scheme is on disk #149.
  249.  
  250. *** 11> Is there an Ada implementation available?
  251.  
  252.     AdaEd, via FTP from wuarchive.wustl.edu, in the amiga subdirectory
  253.     programming/programming/ada. The filename is adaed-1.0.11a.lzh.
  254.  
  255. *** 12> Are there freely distributable C compilers available?
  256.  
  257.     GNU C, ported by Markus Wild, is available for FTP from
  258.     amiga.physik.unizh.ch.
  259.  
  260.     Matt Dillon's DICE, the FD version of which does not handle
  261.     floating point, is also available from amiga.physik.unizh.ch.
  262.  
  263. *** 13> Are malloc()/free() much slower under 6.1 than 5.10?
  264.  
  265.     Performance problems in programs with a lot of small malloc()/
  266.     free() calls may be overcome by reducing the page size used by the
  267.     memory management code. This is done by declaring a global
  268.     constant:
  269.  
  270.         unsigned long _MSTEP = <whatever>;
  271.  
  272. *** 14> How do I get rid of the CON: created when my program starts?
  273.  
  274.     This is an SAS C feature. The window is opened by the ___main()
  275.     function. Refer to Appendix 1 of the SAS C User's Guide, Volume 1.
  276.  
  277.     ------------------------------ 8< ------------------------------
  278.  
  279. --
  280. *** John Bickers, TAP.                   jbickers@templar.actrix.gen.nz ***
  281. ***    "Radioactivity - It's in the air, for you and me" - Kraftwerk    ***
  282.