home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Text_Autodocs / exec.doc < prev    next >
Encoding:
Text File  |  1992-09-12  |  95.8 KB  |  3,395 lines

  1. TABLE OF CONTENTS
  2.  
  3. exec.library/AbortIO
  4. exec.library/AddDevice
  5. exec.library/AddHead
  6. exec.library/AddIntServer
  7. exec.library/AddLibrary
  8. exec.library/AddMemList
  9. exec.library/AddPort
  10. exec.library/AddResource
  11. exec.library/AddSemaphore
  12. exec.library/AddTail
  13. exec.library/AddTask
  14. exec.library/Alert
  15. exec.library/AllocAbs
  16. exec.library/Allocate
  17. exec.library/AllocEntry
  18. exec.library/AllocMem
  19. exec.library/AllocSignal
  20. exec.library/AllocTrap
  21. exec.library/AttemptSemaphore
  22. exec.library/AvailMem
  23. exec.library/Cause
  24. exec.library/CheckIO
  25. exec.library/CloseDevice
  26. exec.library/CloseLibrary
  27. exec.library/CopyMem
  28. exec.library/CopyMemQuick
  29. exec.library/Deallocate
  30. exec.library/Debug
  31. exec.library/Disable
  32. exec.library/DoIO
  33. exec.library/Enable
  34. exec.library/Enqueue
  35. exec.library/FindName
  36. exec.library/FindPort
  37. exec.library/FindResident
  38. exec.library/FindSemaphore
  39. exec.library/FindTask
  40. exec.library/Forbid
  41. exec.library/FreeEntry
  42. exec.library/FreeMem
  43. exec.library/FreeSignal
  44. exec.library/FreeTrap
  45. exec.library/GetCC
  46. exec.library/GetMsg
  47. exec.library/InitCode
  48. exec.library/InitResident
  49. exec.library/InitSemaphore
  50. exec.library/InitStruct
  51. exec.library/Insert
  52. exec.library/MakeFunctions
  53. exec.library/MakeLibrary
  54. exec.library/ObtainSemaphore
  55. exec.library/ObtainSemaphoreList
  56. exec.library/OldOpenLibrary
  57. exec.library/OpenDevice
  58. exec.library/OpenLibrary
  59. exec.library/OpenResource
  60. exec.library/Permit
  61. exec.library/Procure
  62. exec.library/PutMsg
  63. exec.library/RawDoFmt
  64. exec.library/ReleaseSemaphore
  65. exec.library/ReleaseSemaphoreList
  66. exec.library/RemDevice
  67. exec.library/RemHead
  68. exec.library/RemIntServer
  69. exec.library/RemLibrary
  70. exec.library/Remove
  71. exec.library/RemPort
  72. exec.library/RemResource
  73. exec.library/RemSemaphore
  74. exec.library/RemTail
  75. exec.library/RemTask
  76. exec.library/ReplyMsg
  77. exec.library/SendIO
  78. exec.library/SetExcept
  79. exec.library/SetFunction
  80. exec.library/SetIntVector
  81. exec.library/SetSignal
  82. exec.library/SetSR
  83. exec.library/SetTaskPri
  84. exec.library/Signal
  85. exec.library/SumKickData
  86. exec.library/SumLibrary
  87. exec.library/SuperState
  88. exec.library/TypeOfMem
  89. exec.library/UserState
  90. exec.library/Vacate
  91. exec.library/Wait
  92. exec.library/WaitIO
  93. exec.library/WaitPort
  94.  
  95. exec.library/AbortIO                    exec.library/AbortIO
  96.  
  97.    NAME
  98.     AbortIO - attempt to abort an in-progress I/O request
  99.  
  100.    SYNOPSIS
  101.     error = AbortIO(iORequest)
  102.     D0        A1
  103.     BYTE AbortIO(struct IORequest *);
  104.  
  105.    FUNCTION
  106.     Ask a device to abort a previously started IORequest.  This is done
  107.     by calling the device's ABORTIO vector, with your given IORequest.
  108.  
  109.  
  110.     AbortIO is a request that device that may or may not grant.  If
  111.     successful, the device will stop processing the IORequest, and
  112.     reply to it earlier than it would otherwise have done.
  113.  
  114.    NOTE
  115.     AbortIO() does NOT remove the IORequest from your ReplyPort, OR
  116.     wait for it to complete.  After an AbortIO() you must wait normally
  117.     for the reply message before actually reusing the request [see
  118.     WaitIO()].
  119.  
  120.     If a request has already completed when AbortIO() is called, no
  121.     action is taken.
  122.  
  123.    EXAMPLE
  124.         AbortIO(timer_request);
  125.         WaitIO (timer_request);
  126.         /* Message is free to be reused */
  127.  
  128.    RESULTS
  129.     error - Depending on the device and the state of the request, it
  130.         may not be possible to abort a given I/O request.  If for
  131.         some reason the device cannot abort the request, it should
  132.         return an error code in D0.
  133.  
  134.    INPUTS
  135.     iORequest - pointer to an I/O request block.
  136.  
  137.    RESULTS
  138.     error - zero if successful, else an error is returned
  139.  
  140.    SEE ALSO
  141.     WaitIO, DoIO, SendIO, CheckIO
  142.  
  143.  
  144. exec.library/AddDevice                      exec.library/AddDevice
  145.  
  146.    NAME
  147.     AddDevice -- add a device to the system
  148.  
  149.    SYNOPSIS
  150.     AddDevice(device)
  151.           A1
  152.     void AddDevice(struct Device *);
  153.  
  154.    FUNCTION
  155.     This function adds a new device to the system device list, making
  156.     it available to other programs.  The device must be ready to be
  157.     opened at this time.
  158.  
  159.    INPUTS
  160.     device - pointer to a properly initialized device node
  161.  
  162.    SEE ALSO
  163.     RemDevice, OpenDevice, CloseDevice, MakeLibrary
  164.  
  165.  
  166. exec.library/AddHead                    exec.library/AddHead
  167.  
  168.    NAME
  169.     AddHead -- insert node at the head of a list
  170.  
  171.    SYNOPSIS
  172.     AddHead(list, node)
  173.         A0    A1
  174.     void AddHead(struct List *, struct Node *)
  175.  
  176.    FUNCTION
  177.     Add a node to the head of a doubly linked list. Assembly
  178.     programmers may prefer to use the ADDHEAD macro from
  179.     "exec/lists.i".
  180.  
  181.    WARNING
  182.     This function does not arbitrate for access to the list.  The
  183.     calling task must be the owner of the involved list.
  184.  
  185.    INPUTS
  186.     list - a pointer to the target list header
  187.     node - the node to insert at head
  188.  
  189.    SEE ALSO
  190.     AddTail, Enqueue, Insert, Remove, RemHead, RemTail
  191.  
  192.  
  193. exec.library/AddIntServer               exec.library/AddIntServer
  194.  
  195.    NAME
  196.     AddIntServer -- add an interrupt server to the system
  197.  
  198.    SYNOPSIS
  199.     AddIntServer(intNum, interrupt)
  200.              D0-0:4  A1
  201.     void AddIntServer(ULONG, struct Interrupt *);
  202.  
  203.    FUNCTION
  204.     This function adds a new interrupt server to a given server chain.
  205.     The node is located on the chain in a priority dependent position.
  206.     If this is the first server on a particular chain, interrupts will
  207.     be enabled for that chain.
  208.  
  209.     Each link in the chain will be called in priority order until the
  210.     chain ends or one of the servers returns with the 68000's Z
  211.     condition code clear (indicating non-zero).  Servers on the chain
  212.     should return with the Z bit clear if the interrupt was
  213.     specifically for that server, and no one else.    VERTB servers
  214.     should always return Z set.
  215.  
  216.     Servers are called with the following register conventions:
  217.  
  218.         D0 - scratch
  219.         D1 - scratch
  220.  
  221.         A0 - scratch
  222.         A1 - server is_Data pointer (scratch)
  223.  
  224.         A5 - jump vector register (scratch)
  225.         A6 - scratch
  226.  
  227.         all other registers - must be preserved
  228.  
  229.    INPUTS
  230.     intNum - the Portia interrupt bit number (0 through 14). Processor
  231.          level seven interrupts (NMI) are encoded as intNum 15.
  232.          The PORTS, VERTB, COPER and EXTER and NMI interrupts are
  233.          set up as server chains.
  234.     interrupt - pointer to an interrupt server node
  235.  
  236.    SEE ALSO
  237.     RemIntServer, SetIntVector, hardware/intbits.h
  238.  
  239.    BUGS
  240.     The graphics library's VBLANK server incorrectly assumes that
  241.     address register A0 will contain a pointer to the custom chips.  If
  242.     you add a server at a priority of 10 or greater, you must
  243.     compensate for this by providing the expected value ($DFF000).
  244.  
  245. exec.library/AddLibrary exec.library/AddLibrary
  246.  
  247.    NAME
  248.     AddLibrary -- add a library to the system
  249.  
  250.    SYNOPSIS
  251.     AddLibrary(library)
  252.            A1
  253.     void AddLibrary(struct Library *);
  254.  
  255.    FUNCTION
  256.     This function adds a new library to the system, making it available
  257.     to other programs.  The library should be ready to be opened at
  258.     this time.  It will be added to the system library name list, and
  259.     the checksum on the library entries will be calculated.
  260.  
  261.    INPUTS
  262.     library - pointer to a properly initialized library structure
  263.  
  264.    SEE ALSO
  265.     RemLibrary, CloseLibrary, OpenLibrary, MakeLibrary
  266.  
  267.  
  268. exec.library/AddMemList                  exec.library/AddMemList
  269.  
  270.    NAME
  271.     AddMemList - add memory to the system free pool
  272.  
  273.    SYNOPSIS
  274.     AddMemList( size, attributes, pri, base, name )
  275.                      D0      D1        D2   A0    A1
  276.     void AddMemList(ULONG, ULONG, LONG, APTR, char *);
  277.  
  278.    FUNCTION
  279.     Add a new region of memory to the system free pool.  The first few
  280.     bytes will be used to hold the MemHeader structure.  The remainder
  281.     will be made available to the rest of the world.
  282.  
  283.    INPUTS
  284.     size - the size (in bytes) of the memory area
  285.     attributes - the attributes word that the memory pool will have
  286.     pri  - the priority for this memory.  CHIP memory has a pri of -10,
  287.            16 bit expansion memory has a priority of 0.  The higher the
  288.            priority, the closer to the head of the memory list it will
  289.            be placed.
  290.     base - the base of the new memory area
  291.     name - the name that will be used in the memory header, or NULL
  292.            if no name is to be provided.  This name is not copied, so it
  293.            must remain valid for as long as the memory header is in the
  294.            system.
  295.  
  296.    SEE ALSO
  297.     AllocMem, exec/memory.h
  298.  
  299.  
  300. exec.library/AddPort                    exec.library/AddPort
  301.  
  302.    NAME
  303.     AddPort -- add a public message port to the system
  304.  
  305.    SYNOPSIS
  306.     AddPort(port)
  307.         A1
  308.     void AddPort(struct MsgPort *);
  309.  
  310.    FUNCTION
  311.     This function attaches a message port structure to the system's
  312.     public message port list, where it can be found by the FindPort()
  313.     function.  The name and priority fields of the port structure must
  314.     be initialized prior to calling this function.    If the user does
  315.     not require the priority field, it should be initialized to zero.
  316.  
  317.     Ports that will NOT be searched for by name (with the FindPort()
  318.     function) do not need to be added to the system list, though
  319.     adding the port can be handy for debugging.  If the port WILL be
  320.     searched for, the priority field should be at least 1 (so it will
  321.     be before other less used ports).
  322.  
  323.     Once a port has been added to the naming list, you must be careful
  324.     to remove the port from the list (via RemPort) before deallocating
  325.     its memory.
  326.  
  327.    NOTE
  328.     A point of confusion is that clearing a MsgPort structure to all
  329.     zeros is not enough to prepare it for use.  As mentioned in the
  330.     Exec chapter of the ROM Kernel Manual, the List for the MsgPort
  331.     must be initialized.  This is automatically handled by AddPort(),
  332.     and amiga.lib/CreatePort.  This initialization can be done manually
  333.     with amiga.lib/NewList or the assembly NEWLIST macro.
  334.  
  335.    INPUTS
  336.     port - pointer to a message port
  337.  
  338.    SEE ALSO
  339.     RemPort, FindPort, amiga.lib/CreatePort, amiga.lib/NewList
  340.  
  341.  
  342. exec.library/AddResource                exec.library/AddResource
  343.  
  344.    NAME
  345.     AddResource -- add a resource to the system
  346.  
  347.    SYNOPSIS
  348.     AddResource(resource)
  349.             A1
  350.     void AddResource(APTR);
  351.  
  352.    FUNCTION
  353.     This function adds a new resource to the system and makes it
  354.     available to other users.  The resource must be ready to be called
  355.     at this time.
  356.  
  357.     Resources currently have no system-imposed structure, other than
  358.     starting with a standard Exec node or Library structure.
  359.  
  360.    INPUTS
  361.     resource - pointer an initialized resource node
  362.  
  363.    SEE ALSO
  364.     RemResource, OpenResource
  365.  
  366.  
  367. exec.library/AddSemaphore               exec.library/AddSemaphore
  368.  
  369.    NAME
  370.     AddSemaphore -- add a signal semaphore to the system
  371.  
  372.    SYNOPSIS
  373.     AddSemaphore(signalSemaphore)
  374.              A1
  375.     void AddSemaphore(struct SignalSemaphore *);
  376.  
  377.    FUNCTION
  378.     This function attaches a signal semaphore structure to the system's
  379.     public signal semaphore list.  The name and priority fields of the
  380.     semaphore structure must be initialized prior to calling this
  381.     function.  If you do not want to let others rendezvous with this
  382.     semaphore, use InitSemaphore() instead.
  383.  
  384.     If a semaphore has been added to the naming list, you must be
  385.     careful to remove the semaphore from the list (via RemSemaphore)
  386.     before deallocating its memory.
  387.  
  388.     Semaphores that are linked together in an allocation list (which
  389.     ObtainSemaphoreList() would use) may not be added to the system
  390.     naming list, because the facilities use the link field of the
  391.     signal semaphore in incompatible ways
  392.  
  393.    INPUTS
  394.        signalSemaphore -- an signal semaphore structure
  395.  
  396.    BUGS
  397.     Does not work in Kickstart V33 and V34.  Instead use this code:
  398.  
  399.         #include "exec/execbase.h"
  400.         ...
  401.         void AddSemaphore(s)
  402.         struct SignalSemaphore *s;
  403.         {
  404.         InitSemaphore(s);
  405.         Forbid();
  406.         Enqueue(&SysBase->SemaphoreList,s);
  407.         Permit();
  408.         }
  409.  
  410.    SEE ALSO
  411.     RemSemaphore, FindSemaphore, InitSemaphore
  412.  
  413. exec.library/AddTail                    exec.library/AddTail
  414.  
  415.    NAME
  416.     AddTail -- append node to tail of a list
  417.  
  418.    SYNOPSIS
  419.     AddTail(list, node)
  420.                 A0    A1
  421.     void AddTail(struct List *, struct Node *);
  422.  
  423.    FUNCTION
  424.     Add a node to the tail of a doubly linked list.  Assembly
  425.     programmers may prefer to use the ADDTAIL macro from
  426.     "exec/lists.i".
  427.  
  428.    WARNING
  429.     This function does not arbitrate for access to the list.  The
  430.     calling task must be the owner of the involved list.
  431.  
  432.    INPUTS
  433.     list - a pointer to the target list header
  434.     node - a pointer to the node to insert at tail of the list
  435.  
  436.    SEE ALSO
  437.     AddHead, Enqueue, Insert, Remove, RemHead, RemTail
  438.  
  439.  
  440. exec.library/AddTask                    exec.library/AddTask
  441.  
  442.    NAME
  443.     AddTask -- add a task to the system
  444.  
  445.    SYNOPSIS
  446.     AddTask(task, initialPC, finalPC)
  447.         A1    A2     A3
  448.     void AddTask(struct Task *, APTR, APTR);
  449.  
  450.    FUNCTION
  451.     Add a task to the system.  A reschedule will be run; the task with
  452.     the highest priority in the system will start to execute (this may
  453.     or may not be the new task).
  454.  
  455.     Certain fields of the task control block must be initialized and a
  456.     stack allocated prior to calling this function.  The absolute
  457.     smallest stack that is allowable is something in the range of 100
  458.     bytes, but in general the stack size is dependent on what
  459.     subsystems are called. In general 256 bytes is sufficient if only
  460.     Exec is called, and 4K will do if anything in the system is called.
  461.  
  462.     This function will temporarily use space from the new task's stack
  463.     for the task's initial set of registers.  This space is allocated
  464.     starting at the SPREG location specified in the task control block
  465.     (not from SPUPPER).  This means that a task's stack may contain
  466.     static data put there prior to its execution.  This is useful for
  467.     providing initialized global variables or some tasks may want to
  468.     use this space for passing the task its initial arguments.
  469.  
  470.     A task's initial registers are set to zero (except the PC).
  471.  
  472.     The TC_MEMENTRY field of the task structure may be extended by
  473.     the user to hold additional MemLists (as returned by AllocEntry()).
  474.     These will be automatically be deallocated at RemTask() time.
  475.     If the code you have used to start the task has already added
  476.     something to the MEMENTRY list, simply use AddHead to add your
  477.     new MemLists in.  If no initialization has been done, a NewList will
  478.     need to be performed.
  479.  
  480.    INPUTS
  481.     task - pointer to the task control block
  482.     initialPC - the initial entry point's address
  483.     finalPC - the finalization code entry point's address.  If zero,
  484.           the system will use a general finalizer. This pointer is
  485.           placed on the stack as if it were the outermost return
  486.           address.
  487.  
  488.    WARNING
  489.     Tasks are a low-level building block, and are unable to call
  490.     AmigaDOS, or any system routine that might call AmigaDOS.  See the
  491.     AmigaDOS CreateProc() for information on Processes.
  492.  
  493.    SEE ALSO
  494.     RemTask, FindTask, amiga.lib/CreateTask, dos/CreateProc,
  495.     amiga.lib/NewList
  496.  
  497.  
  498. exec.library/Alert                      exec.library/Alert
  499.  
  500.    NAME
  501.     Alert -- alert the user of an error
  502.  
  503.    SYNOPSIS
  504.     Alert(alertNum, parameters)
  505.           D7    A5
  506.     void Alert(ULONG, APTR);
  507.  
  508.    FUNCTION
  509.     Alerts the user of a serious system problem.  This function will
  510.     bring the system to a grinding halt, and do whatever is necessary
  511.     to present the user with a message stating what happened.
  512.     Interrupts are disabled, and an attempt to post the alert is made.
  513.     If that fails, the system is reset.  When the system comes up
  514.     again, Exec notices the cause of the failure and tries again to
  515.     post the alert.
  516.  
  517.     If the Alert is a recoverable type, this call MAY return.
  518.  
  519.     This call may be made at any time, including interrupts.
  520.  
  521.    INPUT
  522.     alertNum - a number indicating the particular alert
  523.     parameters - currently points to the number that forms the
  524.              second part of a "Guru meditation" message. Typically
  525.              this is a pointer to the task that was active at the
  526.              time of the problem.
  527.  
  528.    NOTE
  529.     Much more needs to be said about this function and its implications.
  530.  
  531.    SEE ALSO
  532.     exec/alerts.h
  533.  
  534. exec.library/AllocAbs                       exec.library/AllocAbs
  535.  
  536.    NAME
  537.     AllocAbs -- allocate at a given location
  538.  
  539.    SYNOPSIS
  540.     memoryBlock = AllocAbs(byteSize, location)
  541.     D0               D0     A1
  542.     void *AllocAbs(ULONG, APTR);
  543.  
  544.    FUNCTION
  545.     This function attempts to allocate memory at a given absolute
  546.     memory location.  Often this is used by boot-surviving entities
  547.     such as recoverable ram-disks.    If the memory is already being
  548.     used, or if there is not enough memory to satisfy the request,
  549.     AllocAbs will return NULL.
  550.  
  551.     This block may not be exactly the same as the requested block
  552.     because of rounding, but if the return value is non-zero, the block
  553.     is guaranteed to contain the requested range.
  554.  
  555.    INPUTS
  556.     byteSize - the size of the desired block in bytes
  557.            This number is rounded up to the next larger
  558.            block size for the actual allocation.
  559.     location - the address where the memory MUST be.
  560.  
  561.  
  562.    RESULT
  563.     memoryBlock - a pointer to the newly allocated memory block, or
  564.               NULL if failed.
  565.  
  566.    NOTE
  567.     If the free list is corrupt, the system will panic with alert
  568.     AN_MemCorrupt, $81000005.
  569.  
  570.    SEE ALSO
  571.     AllocMem, FreeMem
  572.  
  573. exec.library/Allocate                       exec.library/Allocate
  574.  
  575.    NAME
  576.     Allocate - allocate a block of memory
  577.  
  578.    SYNOPSIS
  579.     memoryBlock=Allocate(MemHeader, byteSize)
  580.     D0             A0     D0
  581.     void *Allocate(struct MemHeader *, ULONG);
  582.  
  583.    FUNCTION
  584.     This function is used to allocate blocks of memory from a given
  585.     private free memory pool (as specified by a MemHeader and its
  586.     memory chunk list).  Allocate will return the first free block that
  587.     is greater than or equal to the requested size.
  588.  
  589.     All blocks, whether free or allocated, will be block aligned;
  590.     hence, all allocation sizes are rounded up to the next block even
  591.     value (e.g. the minimum allocation resolution is currently 8
  592.     bytes).
  593.  
  594.     This function can be used to manage an application's internal data
  595.     memory.  Note that no arbitration of the MemHeader and associated
  596.     free chunk list is done.  You must be the owner before calling
  597.     Allocate.
  598.  
  599.    INPUTS
  600.     freeList - points to the memory list header
  601.     byteSize - the size of the desired block in bytes
  602.  
  603.    RESULT
  604.     memoryBlock - a pointer to the just allocated free block.
  605.            If there are no free regions large enough to satisfy the
  606.            request, return zero.
  607.  
  608.    EXAMPLE
  609.     #include "exec/types.h"
  610.     #include "exec/memory.h"
  611.     void *AllocMem();
  612.     #define BLOCKSIZE 4000L /* Or whatever you want */
  613.  
  614.     void main()
  615.     {
  616.     struct MemHeader *mh;
  617.     struct MemChunk  *mc;
  618.     APTR   block1;
  619.     APTR   block2;
  620.  
  621.         /* Get the MemHeader needed to keep track of our new block */
  622.         mh = (struct MemHeader *)
  623.          AllocMem((long)sizeof(struct MemHeader), MEMF_CLEAR );
  624.         if( !mh )
  625.         exit(10);
  626.  
  627.         /* Get the actual block the above MemHeader will manage */
  628.         mc = (struct MemChunk *)AllocMem( BLOCKSIZE, 0L );
  629.         if( !mc )
  630.         {
  631.         FreeMem( mh, (long)sizeof(struct MemHeader) ); exit(10);
  632.         }
  633.  
  634.         mh->mh_Node.ln_Type = NT_MEMORY;
  635.         mh->mh_Node.ln_Name = "myname";
  636.         mh->mh_First = mc;
  637.         mh->mh_Lower = (APTR) mc;
  638.         mh->mh_Upper = (APTR) ( BLOCKSIZE + (ULONG) mc );
  639.         mh->mh_Free  = BLOCKSIZE;
  640.  
  641.         /* Set up first chunk in the freelist */
  642.         mc->mc_Next  = NULL;
  643.         mc->mc_Bytes = BLOCKSIZE;
  644.  
  645.         block1 = (APTR) Allocate( mh, 20L );
  646.         block2 = (APTR) Allocate( mh, 314L );
  647.         printf("mh=$%lx mc=$%lx\n",mh,mc);
  648.         printf("Block1=$%lx, Block2=$%lx\n",block1,block2);
  649.  
  650.         FreeMem( mh, (long)sizeof(struct MemHeader) );
  651.         FreeMem( mc, BLOCKSIZE );
  652.     }
  653.  
  654.    NOTE
  655.     If the free list is corrupt, the system will panic with alert
  656.     AN_MemCorrupt, $81000005.
  657.  
  658.    SEE ALSO
  659.     Deallocate
  660.  
  661. exec.library/AllocEntry                  exec.library/AllocEntry
  662.  
  663.    NAME
  664.     AllocEntry -- allocate many regions of memory
  665.  
  666.    SYNOPSIS
  667.     memList = AllocEntry(memList)
  668.     D0             A0
  669.     struct MemList *AllocEntry(struct MemList *);
  670.  
  671.    FUNCTION
  672.     This routine takes a memList structure and allocates enough memory
  673.     to hold the required memory as well as a MemList structure to keep
  674.     track of it.
  675.  
  676.     These MemList structures may be linked together in a task control
  677.     block to keep track of the total memory usage of this task. (See
  678.     the description of TC_MEMENTRY under RemTask).
  679.  
  680.    INPUTS
  681.     memList -- A MemList structure filled in with MemEntry structures.
  682.  
  683.    RESULTS
  684.     memList -- A different MemList filled in with the actual memory
  685.         allocated in the me_Addr field, and their sizes in me_Length.
  686.         If enough memory cannot be obtained, then the requirements of
  687.         the allocation that failed is returned and bit 31 is set.
  688.  
  689.    EXAMPLES
  690.     The user wants five regions of 2, 4, 8, 16, and 32 bytes in size
  691.     with requirements of MEMF_CLEAR, MEMF_PUBLIC, MEMF_CHIP!MEMF_CLEAR,
  692.     MEMF_FAST!MEMF_CLEAR, and MEMF_PUBLIC!MEMF_CLEAR respectively.    The
  693.     following code fragment would do that:
  694.  
  695.         MemListDecl:
  696.         DS.B    LN_SIZE         * reserve space for list node
  697.         DC.W    5            * number of entries
  698.         DC.L    MEMF_CLEAR            * entry #0
  699.         DC.L    2
  700.         DC.L    MEMF_PUBLIC            * entry #1
  701.         DC.L    4
  702.         DC.L    MEMF_CHIP!MEMF_CLEAR        * entry #2
  703.         DC.L    8
  704.         DC.L    MEMF_FAST!MEMF_CLEAR        * entry #3
  705.         DC.L    16
  706.         DC.L    MEMF_PUBLIC!MEMF_CLEAR        * entry #4
  707.         DC.L    32
  708.  
  709.         start:
  710.         LEA.L    MemListDecl(PC),A0
  711.         JSR    _LVOAllocEntry(a6)
  712.         BCLR.L    #31,D0
  713.         BEQ.S    success
  714.  
  715.         ------- Type of memory that we failed on is in D0
  716.  
  717.    BUGS
  718.     If any one of the allocations fails, this function fails to back
  719.     out fully.  This is fixed by the "SetPatch" program on V1.3
  720.     Workbench disks.
  721.  
  722.    SEE ALSO
  723.     exec/memory.h
  724.  
  725. exec.library/AllocMem                       exec.library/AllocMem
  726.  
  727.    NAME
  728.     AllocMem -- allocate memory given certain requirements
  729.  
  730.    SYNOPSIS
  731.     memoryBlock = AllocMem(byteSize, attributes)
  732.     D0               D0     D1
  733.     void *AllocMem(ULONG, ULONG);
  734.  
  735.    FUNCTION
  736.     This is the memory allocator to be used by system code and
  737.     applications.  It provides a means of specifying that the allocation
  738.     should be made in a memory area accessible to the chips, or
  739.     accessible to shared system code.
  740.  
  741.     Memory is allocated based on requirements and options.    Any
  742.     "requirement" must be met by a memory allocation, any "option" will
  743.     be applied to the block regardless.  AllocMem will try all memory
  744.     spaces until one is found with the proper requirements and room for
  745.     the memory request.
  746.  
  747.    INPUTS
  748.     byteSize - the size of the desired block in bytes.  This number is
  749.         rounded up to the next larger memory chunk size for the
  750.         actual allocation.  The chunk size is guaranteed to be
  751.         at least 8.
  752.  
  753.  
  754.     attributes -
  755.         requirements
  756.  
  757.         MEMF_CHIP:    Only certain parts of memory are reachable
  758.                 by the special chip sets' DMA circuitry.
  759.                 Anything that will use on-chip DMA *MUST*
  760.                 be in memory with this attribute. DMA
  761.                 includes screen memory, things that are
  762.                 blitted, audio blocks, sprites and
  763.                 trackdisk.device buffers.
  764.  
  765.         MEMF_FAST:    This is non-chip memory.  It is possible
  766.                 for the processor to get locked out of chip
  767.                 memory under certain conditions. If one
  768.                 cannot accept these delays, then one should
  769.                 use FAST memory (by default the system will
  770.                 allocate from FAST memory first anyway).
  771.  
  772.                 This is rarely specified, since it would
  773.                 cause incompatibility with non-expanded
  774.                 machines.
  775.  
  776.         MEMF_PUBLIC:    Memory must not be mapped, swapped,
  777.                 or otherwise made non-addressable. ALL
  778.                 MEMORY THAT IS REFERENCED VIA INTERRUPTS
  779.                 AND/OR BY OTHER TASKS MUST BE EITHER PUBLIC
  780.                 OR LOCKED INTO MEMORY! This includes both
  781.                 code and data.
  782.  
  783.         options
  784.  
  785.         MEMF_CLEAR:    The memory will be initialized to all
  786.                 zeros.
  787.  
  788.  
  789.    RESULT
  790.     memoryBlock - a pointer to the newly allocated block. If there are
  791.         no free regions large enough to satisfy the request (or if
  792.         the amount of requested memory is invalid), return zero.
  793.  
  794.    WARNING
  795.     The result of any memory allocate MUST be checked, and a viable
  796.     error handling path taken.  ANY allocation may fail if memory has
  797.     been filled.
  798.  
  799.    EXAMPLES
  800.     AllocMem(321,MEMF_CHIP) - private chip memory
  801.     AllocMem(25,MEMF_PUBLIC|MEMF_CLEAR) - a cleared "public" system
  802.                structure that does not require chip memory.
  803.  
  804.    NOTE
  805.     If the free list is corrupt, the system will panic with alert
  806.     AN_MemCorrupt, $81000005.
  807.  
  808.     This function may not be called from interrupts.
  809.  
  810.    SEE ALSO
  811.     FreeMem
  812.  
  813.  
  814. exec.library/AllocSignal                exec.library/AllocSignal
  815.  
  816.    NAME
  817.     AllocSignal -- allocate a signal bit
  818.  
  819.    SYNOPSIS
  820.     signalNum = AllocSignal(signalNum)
  821.     D0            D0
  822.     BYTE AllocSignal(LONG);
  823.  
  824.    FUNCTION
  825.     Allocate a signal bit from the current tasks' pool.  Either a
  826.     particular bit, or the next free bit may be allocated.    The signal
  827.     associated with the bit will be properly initialized (cleared).  At
  828.     least 16 user signals are available per task.  Signals should be
  829.     deallocated before the task exits.
  830.  
  831.     If the signal is already in use (or no free signals are available)
  832.     a -1 is returned.
  833.  
  834.     This function can only be used by the currently running task.
  835.  
  836.    WARNING
  837.     Signals may not be allocated or freed from exception handling code.
  838.  
  839.    INPUTS
  840.     signalNum - the desired signal number {of 0..31} or -1 for no
  841.             preference.
  842.  
  843.    RESULTS
  844.     signalNum - the signal bit number allocated {0..31}. If no signals
  845.             are available, this function returns -1.
  846.  
  847.    SEE ALSO
  848.     FreeSignal
  849.  
  850.  
  851. exec.library/AllocTrap                      exec.library/AllocTrap
  852.  
  853.    NAME
  854.     AllocTrap -- allocate a processor trap vector
  855.  
  856.    SYNOPSIS
  857.     trapNum = AllocTrap(trapNum)
  858.     D0            D0
  859.     LONG AllocTrap(LONG);
  860.  
  861.    FUNCTION
  862.     Allocate a trap number from the current task's pool.  These trap
  863.     numbers are those associated with the 68000 TRAP type instructions.
  864.     Either a particular number, or the next free number may be
  865.     allocated.
  866.  
  867.     If the trap is already in use (or no free traps are available) a -1
  868.     is returned.
  869.  
  870.     This function only affects the currently running task.
  871.  
  872.     Traps are sent to the trap handler pointed at by tc_TrapCode.
  873.     Unless changed by user code, this points to a standard trap
  874.     handler.  The stack frame of the exception handler will be:
  875.  
  876.         0(SP) = Exception vector number.  This will be in the
  877.             range of 32 to 47 (corresponding to the
  878.             Trap #1...Trap #15 instructions).
  879.         4(SP) = 68000/68010/68020/68030, etc. exception frame
  880.  
  881.     tc_TrapData is not used.
  882.  
  883.  
  884.    WARNING
  885.     Traps may not be allocated or freed from exception handling code.
  886.     You are not allowed to write to the exception table yourself.  In
  887.     fact, on some machines you will have trouble finding it - the VBR
  888.     register may be used to remap its location.
  889.  
  890.    INPUTS
  891.     trapNum - the desired trap number {of 0..15} or -1
  892.           for no preference.
  893.  
  894.    RESULTS
  895.     trapNum - the trap number allocated {of 0..15}.  If no traps are
  896.           available, this function returns -1.    Instructions of the
  897.           form "Trap #trapNum" will be sent to the task's trap
  898.           handler.
  899.  
  900.    SEE ALSO
  901.     FreeTrap
  902.  
  903.  
  904. exec.library/AttemptSemaphore               exec.library/AttemptSemaphore
  905.  
  906.    NAME
  907.     AttemptSemaphore -- try to obtain without blocking
  908.  
  909.    SYNOPSIS
  910.     success = AttemptSemaphore(signalSemaphore)
  911.     D0               A0
  912.     LONG AttemptSemaphore(struct SignalSemaphore *);
  913.  
  914.    FUNCTION
  915.     This call is similar to ObtainSemaphore(), except that it will not
  916.     block if the semaphore could not be locked.
  917.  
  918.    INPUT
  919.        signalSemaphore -- an initialized signal semaphore structure
  920.  
  921.    RESULT
  922.     success -- TRUE if the semaphore was locked, false if some
  923.         other task already possessed the semaphore.
  924.  
  925.    SEE ALSO
  926.     ObtainSemaphore(), ReleaseSemaphore(), exec/semaphores.h
  927.  
  928.  
  929. exec.library/AvailMem                       exec.library/AvailMem
  930.  
  931.    NAME
  932.     AvailMem -- memory available given certain requirements
  933.  
  934.    SYNOPSIS
  935.     size = AvailMem(attributes)
  936.     D0        D1
  937.     ULONG AvailMem(ULONG);
  938.  
  939.    FUNCTION
  940.     This function returns the amount of free memory given certain
  941.     attributes.
  942.  
  943.     To find out what the largest block of a particular type is, add
  944.     MEMF_LARGEST into the requirements argument.
  945.  
  946.    WARNING
  947.     Due to the effect of multitasking, the value returned may not
  948.     actually be the amount of free memory available at that instant.
  949.  
  950.    INPUTS
  951.     requirements - a requirements mask as specified in AllocMem.  Any
  952.                of the AllocMem bits are valid, as is MEMF_LARGEST
  953.                which returns the size of the largest block matching
  954.                the requirements.
  955.  
  956.    RESULT
  957.     size - total free space remaining (or the largest free block).
  958.  
  959.    EXAMPLE
  960.     AvailMem(MEMF_CHIP|MEMF_LARGEST);
  961.     /* return size of largest available chip memory chunk */
  962.  
  963.    SEE ALSO
  964.     exec/memory.h
  965.  
  966.  
  967. exec.library/Cause                      exec.library/Cause
  968.  
  969.    NAME
  970.        Cause -- cause a software interrupt
  971.  
  972.    SYNOPSIS
  973.        Cause(interrupt)
  974.          A1
  975.        void Cause(struct Interrupt *);
  976.  
  977.    FUNCTION
  978.     This function causes a software interrupt to occur.  If it is
  979.     called from user mode (and processor level 0), the software
  980.     interrupt will preempt the current task.  This call is often used
  981.     by high-level hardware interrupts to defer medium-length processing
  982.     down to a lower interrupt level.  Note that a software interrupt is
  983.     still a real interrupt, and must obey the same restrictions on what
  984.     system routines it may call.
  985.  
  986.     Currently only 5 software interrupt priorities are implemented:
  987.     -32, -16, 0, +16, and +32.  Priorities in between are truncated,
  988.     values outside the -32/+32 range are not allowed.
  989.  
  990.    NOTE
  991.     When setting up the Interrupt structure, set the node type to
  992.     NT_INTERRUPT.
  993.  
  994.    IMPLEMENTATION
  995.     1> Checks if the node type is NT_SOFTINT.  If so does nothing since
  996.        the softint is already pending.  No nest count is maintained.
  997.     2> Sets the node type to NT_SOFTINT.
  998.     3> Links into one of the 5 priority queues.
  999.     4> Pokes the hardware interrupt bit used for softints.
  1000.  
  1001.     The node type returns to NT_INTERRUPT after removal from the list.
  1002.  
  1003.    INPUTS
  1004.     interrupt - pointer to a properly initialized interrupt node
  1005.  
  1006. exec.library/CheckIO                    exec.library/CheckIO
  1007.  
  1008.    NAME
  1009.     CheckIO -- get the status of an IORequest
  1010.  
  1011.    SYNOPSIS
  1012.     result = CheckIO(iORequest)
  1013.     D0         A1
  1014.     BOOL CheckIO(struct IORequest *);
  1015.  
  1016.    FUNCTION
  1017.     This function determines the current state of an I/O request and
  1018.     returns FALSE if the I/O has not yet completed.  This function
  1019.     effectively hides the internals of the I/O completion mechanism.
  1020.  
  1021.     CheckIO will NOT remove the returned IORequest from the reply port.
  1022.     This is best performed with WaitIO(). If the request has already
  1023.     completed, WaitIO() will return quickly. Use of the Remove()
  1024.     function is dangerous, since other tasks may still be adding things
  1025.     to your message port; a Disable() would be required.
  1026.  
  1027.     This function should NOT be used to busy loop (looping until IO is
  1028.     complete).  WaitIO() is provided for that purpose.
  1029.  
  1030.    INPUTS
  1031.     iORequest - pointer to an I/O request block
  1032.  
  1033.    RESULTS
  1034.     result - null if I/O is still in progress.  Otherwise
  1035.          D0 points to the IORequest block.
  1036.  
  1037.    SEE ALSO
  1038.     DoIO, SendIO, WaitIO, AbortIO
  1039.  
  1040.  
  1041. exec.library/CloseDevice                exec.library/CloseDevice
  1042.  
  1043.    NAME
  1044.     CloseDevice -- conclude access to a device
  1045.  
  1046.    SYNOPSIS
  1047.     CloseDevice(iORequest)
  1048.             A1
  1049.     void CloseDevice(struct IORequest *);
  1050.  
  1051.    FUNCTION
  1052.     This function informs the device that access to a device/unit
  1053.     previously opened has been concluded.  The device may perform
  1054.     certain house-cleaning operations.
  1055.  
  1056.     The user must ensure that all outstanding IORequests have been
  1057.     returned before closing the device.  The AbortIO function can kill
  1058.     any stragglers.
  1059.  
  1060.     After a close, the I/O request structure is free to be reused.
  1061.  
  1062.    INPUTS
  1063.     iORequest - pointer to an I/O request structure
  1064.  
  1065.    SEE ALSO
  1066.     OpenDevice
  1067.  
  1068. exec.library/CloseLibrary               exec.library/CloseLibrary
  1069.  
  1070.    NAME
  1071.     CloseLibrary -- conclude access to a library
  1072.  
  1073.    SYNOPSIS
  1074.     CloseLibrary(library)
  1075.              A1
  1076.     void CloseLibrary(struct Library *);
  1077.  
  1078.    FUNCTION
  1079.     This function informs the system that access to the given library
  1080.     has been concluded.  The user must not reference the library or any
  1081.     routine in the library after this close.
  1082.  
  1083.    INPUTS
  1084.     library - pointer to a library node
  1085.  
  1086.    SEE ALSO
  1087.     OpenLibrary
  1088.  
  1089.  
  1090. exec.library/CopyMem                    exec.library/CopyMem
  1091.  
  1092.    NAME
  1093.     CopyMem - general purpose memory copy routine
  1094.  
  1095.    SYNOPSIS
  1096.     CopyMem( source, dest, size )
  1097.          A0     A1    D0
  1098.     void CopyMem(APTR,APTR,ULONG);
  1099.  
  1100.    FUNCTION
  1101.     CopyMem is a general purpose, fast memory copy routine.  It can
  1102.     deal with arbitrary lengths, with its pointers on arbitrary
  1103.     alignments.  It attempts to optimize larger copies with more
  1104.     efficient copies, it uses byte copies for small moves, parts of
  1105.     larger copies, or the entire copy if the source and destination are
  1106.     misaligned with respect to each other.
  1107.  
  1108.     Arbitrary overlapping copies are not supported.
  1109.  
  1110.     The internal implementation of this routine will change from
  1111.     system to system, and may be implemented via hardware DMA.
  1112.  
  1113.    INPUTS
  1114.     source - a pointer to the source data region
  1115.     dest - a pointer to the destination data region
  1116.     size - the size (in bytes) of the memory area
  1117.  
  1118.    SEE ALSO
  1119.     CopyMemQuick
  1120.  
  1121. exec.library/CopyMemQuick               exec.library/CopyMemQuick
  1122.  
  1123.    NAME
  1124.     CopyMemQuick - optimized memory copy routine
  1125.  
  1126.    SYNOPSIS
  1127.     CopyMemQuick( source, dest, size )
  1128.               A0      A1    D0
  1129.     void CopyMem(ULONG *,ULONG *,ULONG);
  1130.  
  1131.    FUNCTION
  1132.     CopyMemQuick is a highly optimized memory copy routine, with
  1133.     restrictions on the size and alignment of its arguments. Both the
  1134.     source and destination pointers must be longword aligned.  In
  1135.     addition, the size must be an integral number of longwords (e.g.
  1136.     the size must be evenly divisible by four).
  1137.  
  1138.     Arbitrary overlapping copies are not supported.
  1139.  
  1140.     The internal implementation of this routine will change from system
  1141.     to system, and may be implemented via hardware DMA.
  1142.  
  1143.    INPUTS
  1144.     source - a pointer to the source data region, long aligned
  1145.     dest - a pointer to the destination data region, long aligned
  1146.     size - the size (in bytes) of the memory area
  1147.  
  1148.    SEE ALSO
  1149.     CopyMem
  1150.  
  1151. exec.library/Deallocate                  exec.library/Deallocate
  1152.  
  1153.    NAME
  1154.     Deallocate -- deallocate a block of memory
  1155.  
  1156.    SYNOPSIS
  1157.     Deallocate(MemHeader, memoryBlock, byteSize)
  1158.            A0          A1       D0
  1159.     void Deallocate(struct MemHeader *,APTR,ULONG);
  1160.  
  1161.    FUNCTION
  1162.     This function deallocates memory by returning it to the appropriate
  1163.     private free memory pool.  This function can be used to free an
  1164.     entire block allocated with the above function, or it can be used
  1165.     to free a sub-block of a previously allocated block.  Sub-blocks
  1166.     must be an even multiple of the memory chunk size (currently 8
  1167.     bytes).
  1168.  
  1169.     This function can even be used to add a new free region to an
  1170.     existing MemHeader, however the extent pointers in the MemHeader
  1171.     will no longer be valid.
  1172.  
  1173.     If memoryBlock is not on a block boundary (MEM_BLOCKSIZE) then it
  1174.     will be rounded down in a manner compatible with Allocate().  Note
  1175.     that this will work correctly with all the memory allocation
  1176.     routines, but may cause surprises if one is freeing only part of a
  1177.     region.  The size of the block will be rounded up, so the freed
  1178.     block will fill to an even memory block boundary.
  1179.  
  1180.    INPUTS
  1181.     freeList - points to the free list
  1182.     memoryBlock - memory block to return
  1183.     byteSize - the size of the desired block in bytes. If NULL, nothing
  1184.            happens.
  1185.  
  1186.    SEE ALSO
  1187.     Allocate
  1188.  
  1189.  
  1190. exec.library/Debug                      exec.library/Debug
  1191.  
  1192.    NAME
  1193.     Debug -- run the system debugger
  1194.  
  1195.    SYNOPSIS
  1196.     void Debug(0L);
  1197.            D0
  1198.    FUNCTION
  1199.     This function calls the system debugger.  By default this debugger
  1200.     is "ROM-WACK".  Other debuggers are encouraged to take over this
  1201.     entry point (via SetFunction()) so that when an application calls
  1202.     Debug(), the alternative debugger will get control.  Currently a
  1203.     zero is passed to allow future expansion.
  1204.  
  1205.    NOTE
  1206.     The Debug() call may be made when the system is in a questionable
  1207.     state; if you have a SetFunction() patch, make few assumptions, be
  1208.     prepared for Supervisor mode, and be aware of differences in the
  1209.     Motorola stack frames on the 68000,'10,'20, and '30.
  1210.  
  1211.    SEE ALSO
  1212.     SetFunction
  1213.     your favorite debugger's manual
  1214.     the ROM-WACK chapter of the ROM Kernel Manual
  1215.  
  1216. exec.library/Disable                    exec.library/Disable
  1217.  
  1218.     NAME
  1219.     Disable -- disable interrupt processing.
  1220.  
  1221.     SYNOPSIS
  1222.     Disable();
  1223.  
  1224.     void Disable(void);
  1225.  
  1226.     FUNCTION
  1227.     Prevents interrupts from being handled by the system, until a
  1228.     matching Enable() is executed.  Disable() implies Forbid().
  1229.  
  1230.     RESULTS
  1231.     All interrupt processing is deferred until the task executing makes
  1232.     a call to Enable() or is placed in a wait state.  Normal task
  1233.     rescheduling does not occur while interrupts are disabled.  In order
  1234.     to restore normal interrupt processing, the programmer must execute
  1235.     exactly one call to Enable() for every call to Disable().
  1236.  
  1237.     IMPORTANT REMINDER:
  1238.  
  1239.     It is important to remember that there is a danger in using
  1240.     disabled sections.  Disabling interrupts for more than ~250
  1241.     microseconds will prevent vital system functions (especially serial
  1242.     I/0) from operating in a normal fashion.
  1243.  
  1244.     Think twice before using Disable(), then think once more.
  1245.     After all that, think again.  With enough thought, the need
  1246.     for a Disable() can often be eliminated.
  1247.     Do not use a macro for Disable(), insist on the real thing.
  1248.  
  1249.     This call may be made from interrupts, it will have the effect
  1250.     of locking out all higher-level interrupts (lower-level interrupts
  1251.     are automatically disabled by the CPU).
  1252.  
  1253.     WARNING
  1254.     In the event of a task entering a Wait after disabling interrupts,
  1255.     the system "breaks" the forbidden state and runs normally until the
  1256.     task which called Forbid() is rescheduled.
  1257.  
  1258.     If caution is not taken, this can cause subtle bugs, since any
  1259.     device or DOS call will (in effect) cause your task to wait.
  1260.  
  1261.    SEE ALSO
  1262.     Forbid, Permit, Enable
  1263.  
  1264. exec.library/DoIO                       exec.library/DoIO
  1265.  
  1266.    NAME
  1267.     DoIO -- perform an I/O command and wait for completion
  1268.  
  1269.    SYNOPSIS
  1270.     error = DoIO(iORequest)
  1271.     D0         A1
  1272.     BYTE DoIO(struct IORequest *);
  1273.  
  1274.    FUNCTION
  1275.     This function requests a device driver to perform the I/O command
  1276.     specified in the I/O request.  This function will always wait until
  1277.     the I/O request is fully complete.
  1278.  
  1279.    IMPLEMENTATION
  1280.     This function first tries to complete the IO via the "Quick I/O"
  1281.     mechanism.  The io_Flags field is always set to IOF_QUICK (0x01)
  1282.     before the internal device call.
  1283.  
  1284.    INPUTS
  1285.     iORequest - pointer to an IORequest initialized by OpenDevice()
  1286.  
  1287.    RESULTS
  1288.     error - a sign-extended copy of the io_Error field of the
  1289.         IORequest.  Most device commands require that the error
  1290.         return be checked.
  1291.  
  1292.    SEE ALSO
  1293.     SendIO, CheckIO, WaitIO, AbortIO, amiga.lib/BeginIO
  1294.  
  1295.  
  1296. exec.library/Enable                     exec.library/Enable
  1297.  
  1298.    NAME
  1299.     Enable -- permit system interrupts to resume.
  1300.  
  1301.    SYNOPSIS
  1302.     Enable();
  1303.  
  1304.     void Enable(void);
  1305.  
  1306.    FUNCTION
  1307.     Allow system interrupts to again occur normally, after a matching
  1308.     Disable() has been executed.
  1309.  
  1310.    RESULTS
  1311.     Interrupt processing is restored to normal operation. The
  1312.     programmer must execute exactly one call to Enable() for every call
  1313.     to Disable().
  1314.  
  1315.    SEE ALSO
  1316.     Forbid, Permit, Disable
  1317.  
  1318.  
  1319. exec.library/Enqueue                    exec.library/Enqueue
  1320.  
  1321.    NAME
  1322.     Enqueue -- insert or append node to a system queue
  1323.  
  1324.    SYNOPSIS
  1325.     Enqueue(list, node)
  1326.         A0    A1
  1327.     void Enqueue(struct List *, struct Node *);
  1328.  
  1329.    FUNCTION
  1330.     Insert or append a node into a system queue.  The insert is
  1331.     performed based on the node priority -- it will keep the list
  1332.     properly sorted.  New nodes will be inserted in front of the first
  1333.     node with a lower priority.   Hence a FIFO queue for nodes of equal
  1334.     priority
  1335.  
  1336.    WARNING
  1337.     This function does not arbitrate for access to the list.  The
  1338.     calling task must be the owner of the involved list.
  1339.  
  1340.    INPUTS
  1341.     list - a pointer to the system queue header
  1342.     node - the node to enqueue
  1343.  
  1344.    SEE ALSO
  1345.     AddHead, AddTail, Insert, Remove, RemHead, RemTail
  1346.  
  1347.  
  1348. exec.library/FindName                       exec.library/FindName
  1349.  
  1350.    NAME
  1351.     FindName -- find a system list node with a given name
  1352.  
  1353.    SYNOPSIS
  1354.     node = FindName(start, name)
  1355.     D0        A0     A1
  1356.     struct Node *FindName(struct List *,char *);
  1357.  
  1358.    FUNCTION
  1359.     Traverse a system list until a node with the given name is found.
  1360.     To find multiple occurrences of a string, this function may be
  1361.     called with a node starting point.
  1362.  
  1363.     No arbitration is done for access to the list!    If multiple tasks
  1364.     access the same list, an arbitration mechanism such as
  1365.     SignalSemaphores must be used.
  1366.  
  1367.    INPUTS
  1368.     start - a list header or a list node to start the search
  1369.         (if node, this one is skipped)
  1370.     name - a pointer to a name string terminated with null
  1371.  
  1372.    RESULTS
  1373.     node - a pointer to the node with the same name else
  1374.         zero to indicate that the string was not found.
  1375.  
  1376.  
  1377. exec.library/FindPort                      exec.library/FindPort
  1378.  
  1379.    NAME
  1380.     FindPort -- find a given system message port
  1381.  
  1382.    SYNOPSIS
  1383.     port = FindPort(name)
  1384.     D0        A1
  1385.     struct MsgPort *FindPort(char *);
  1386.  
  1387.    FUNCTION
  1388.     This function will search the system message port list for a port
  1389.     with the given name.  The first port matching this name will be
  1390.     returned.  No arbitration of the port list is done.  This function
  1391.     MUST be protected with A Forbid()/Permit() pair!
  1392.  
  1393.    EXAMPLE
  1394.     #include "exec/types.h"
  1395.     struct MsgPort *FindPort();
  1396.  
  1397.     ULONG SafePutToPort(message, portname)
  1398.     struct Message *message;
  1399.     char           *portname;
  1400.     {
  1401.     struct MsgPort *port;
  1402.  
  1403.         Forbid();
  1404.         port = FindPort(portname);
  1405.         if (port)
  1406.             PutMsg(port,message);
  1407.         Permit();
  1408.         return((ULONG)port); /* If zero, the port has gone away */
  1409.     }
  1410.  
  1411.    INPUT
  1412.     name - name of the port to find
  1413.  
  1414.    RETURN
  1415.     port - a pointer to the message port, or zero if
  1416.         not found.
  1417.  
  1418.  
  1419. exec.library/FindResident               exec.library/FindResident
  1420.  
  1421.    NAME
  1422.     FindResident - find a resident module by name
  1423.  
  1424.    SYNOPSIS
  1425.     resident = FindResident(name)
  1426.     D0            A1
  1427.     struct Resident *FindResident(char *);
  1428.  
  1429.    FUNCTION
  1430.     Find the resident tag with the given name.  If found return a
  1431.     pointer to the resident tag structure, else return zero.
  1432.  
  1433.     Resident modules are used by the system to pull all its parts
  1434.     together at startup.  Resident tags are also found in disk based
  1435.     devices and libraries.
  1436.  
  1437.    INPUTS
  1438.     name - pointer to name string
  1439.  
  1440.     RESULT
  1441.     resident - pointer to the resident tag structure or
  1442.         zero if none found.
  1443.  
  1444.     SEE ALSO
  1445.     exec/resident.h
  1446.  
  1447. exec.library/FindSemaphore              exec.library/FindSemaphore
  1448.  
  1449.    NAME
  1450.     FindSemaphore -- find a given system signal semaphore
  1451.  
  1452.    SYNOPSIS
  1453.     signalSemaphore = FindSemaphore(name)
  1454.     D0                        A1
  1455.     struct SignalSemaphore *FindSemaphore(char *);
  1456.  
  1457.    FUNCTION
  1458.     This function will search the system signal semaphore list for a
  1459.     semaphore with the given name.    The first semaphore matching this
  1460.     name will be returned.
  1461.  
  1462.    INPUT
  1463.     name - name of the semaphore to find
  1464.  
  1465.    BUGS
  1466.     This routine does not arbitrate for access to the semaphore list,
  1467.     surround the call with a Forbid()/Permit() pair.
  1468.  
  1469.    RETURN
  1470.     semaphore - a pointer to the signal semaphore, or zero if not
  1471.             found.
  1472.  
  1473.  
  1474. exec.library/FindTask                       exec.library/FindTask
  1475.  
  1476.    NAME
  1477.     FindTask -- find a task with the given name or find oneself
  1478.  
  1479.    SYNOPSIS
  1480.     task = FindTask(name)
  1481.     D0        A1
  1482.     struct Task *FindTask(char *);
  1483.  
  1484.    FUNCTION
  1485.     This function will check all task queues for a task with the given
  1486.     name, and return a pointer to its task control block.  If a NULL
  1487.     name pointer is given a pointer to the current task will be
  1488.     returned.
  1489.  
  1490.     Finding oneself with a NULL for the name is very quick.  Finding a
  1491.     task by name is very system expensive, and will disable interrupts
  1492.     for a long time.
  1493.  
  1494.    INPUT
  1495.     name - pointer to a name string
  1496.  
  1497.    RESULT
  1498.     task - pointer to the task (or Process)
  1499.  
  1500.  
  1501. exec.library/Forbid                     exec.library/Forbid
  1502.  
  1503.     NAME
  1504.     Forbid -- forbid task rescheduling.
  1505.  
  1506.     SYNOPSIS
  1507.     Forbid()
  1508.  
  1509.     void Forbid(void);
  1510.  
  1511.     FUNCTION
  1512.     Prevents other tasks from being scheduled to run by the dispatcher,
  1513.     until a matching Permit() is executed, or this task is scheduled to
  1514.     Wait.  Interrupts are NOT disabled.
  1515.  
  1516.     RESULTS
  1517.     The current task will not be rescheduled as long as it is ready to
  1518.     run.  In the event that the current task enters a wait state, other
  1519.     tasks may be scheduled.  Upon return from the wait state, the original
  1520.     task will continue to run without disturbing the Forbid().
  1521.  
  1522.     Calls to Forbid() nest. In order to restore normal task rescheduling,
  1523.     the programmer must execute exactly one call to Permit() for every
  1524.     call to Forbid().
  1525.  
  1526.     WARNING
  1527.     In the event of a task entering a Wait after a Forbid(), the system
  1528.     "breaks" the forbidden state and runs normally until the task which
  1529.     called Forbid() is rescheduled.
  1530.     If caution is not taken, this can cause subtle bugs, since any
  1531.     device or DOS call will (in effect) cause your task to wait.
  1532.  
  1533.     Forbid() is not useful or safe from within an interrupt routine
  1534.     (Since interrupts are always higher priority than tasks, and
  1535.     since interrupts are allowed interrupt a Forbid()).
  1536.  
  1537.     SEE ALSO
  1538.     Permit, Disable
  1539.  
  1540.  
  1541. exec.library/FreeEntry                      exec.library/FreeEntry
  1542.  
  1543.    NAME
  1544.     FreeEntry -- free many regions of memory
  1545.  
  1546.    SYNOPSIS
  1547.     FreeEntry(memList)
  1548.           A0
  1549.     void FreeEntry(struct MemList *);
  1550.  
  1551.    FUNCTION
  1552.     This routine takes a memList structure (as returned by AllocEntry)
  1553.     and frees all the entries.
  1554.  
  1555.    INPUTS
  1556.     memList -- pointer to structure filled in with MemEntry
  1557.            structures
  1558.  
  1559.    SEE ALSO
  1560.     AllocEntry
  1561.  
  1562. exec.library/FreeMem                    exec.library/FreeMem
  1563.  
  1564.    NAME
  1565.     FreeMem -- deallocate with knowledge
  1566.  
  1567.    SYNOPSIS
  1568.     FreeMem(memoryBlock, byteSize)
  1569.         A1         D0
  1570.     void FreeMem(void *,ULONG);
  1571.  
  1572.    FUNCTION
  1573.     Free a region of memory, returning it to the system pool from which
  1574.     it came.  Freeing partial blocks back into the system pool is
  1575.     unwise.
  1576.  
  1577.    NOTE
  1578.     If a block of memory is freed twice, the system will GURU. The
  1579.     Alert is AN_FreeTwice ($81000009). Future versions may add more
  1580.     sanity checks to the memory lists.
  1581.  
  1582.    INPUTS
  1583.     memoryBlock - memory block to free
  1584.         If the memoryBlock previously returned by an allocation
  1585.         routine.
  1586.     byteSize - the size of the block in bytes
  1587.  
  1588.    SEE ALSO
  1589.     AllocMem
  1590.  
  1591.  
  1592. exec.library/FreeSignal                  exec.library/FreeSignal
  1593.  
  1594.    NAME
  1595.     FreeSignal -- free a signal bit
  1596.  
  1597.    SYNOPSIS
  1598.     FreeSignal(signalNum)
  1599.            D0
  1600.     FreeSignal(ULONG);
  1601.  
  1602.    FUNCTION
  1603.     This function frees a previously allocated signal bit for reuse.
  1604.     This call must be performed while running in the same task in which
  1605.     the signal was allocated.
  1606.  
  1607.    WARNING
  1608.     Signals may not be allocated or freed from exception handling code.
  1609.  
  1610.    INPUTS
  1611.     signalNum - the signal number to free {0..31}
  1612.  
  1613.  
  1614. exec.library/FreeTrap                       exec.library/FreeTrap
  1615.  
  1616.    NAME
  1617.     FreeTrap -- free a processor trap
  1618.  
  1619.    SYNOPSIS
  1620.     FreeTrap(trapNum)
  1621.          D0
  1622.     void FreeTrap(ULONG);
  1623.  
  1624.    FUNCTION
  1625.     This function frees a previously allocated trap number for reuse.
  1626.     This call must be performed while running in the same task in which
  1627.     the trap was allocated.
  1628.  
  1629.    WARNING
  1630.     Traps may not be allocated or freed from exception handling code.
  1631.  
  1632.    INPUTS
  1633.     trapNum - the trap number to free {of 0..15}
  1634.  
  1635.  
  1636. exec.library/GetCC                      exec.library/GetCC
  1637.  
  1638.    NAME
  1639.     GetCC -- get condition codes in a 68010 compatible way.
  1640.  
  1641.    SYNOPSIS
  1642.     conditions = GetCC()
  1643.       D0
  1644.     UWORD = GetCC(void);
  1645.  
  1646.    FUNCTION
  1647.     The 68000 processor has a "MOVE SR,<ea>" instruction which gets a
  1648.     copy of the processor condition codes.
  1649.  
  1650.     On the 68010,20 and 30 CPUs, "MOVE SR,<ea>" is privileged.  User
  1651.     code will trap if it is attempted.  These processors need to use
  1652.     the "MOVE CCR,<ea>" instruction instead.
  1653.  
  1654.     This function provides a means of obtaining the CPU condition codes
  1655.     in a manner that will make upgrades transparent.  This function is
  1656.     very short and quick.
  1657.  
  1658.    RESULTS
  1659.     conditions - the 680XX condition codes
  1660.  
  1661. exec.library/GetMsg                     exec.library/GetMsg
  1662.  
  1663.    NAME
  1664.     GetMsg -- get next message from a message port
  1665.  
  1666.    SYNOPSIS
  1667.     message = GetMsg(port)
  1668.     D0         A0
  1669.     struct Message *GetMsg(struct MsgPort *);
  1670.  
  1671.    FUNCTION
  1672.     This function receives a message from a given message port. It
  1673.     provides a fast, non-copying message receiving mechanism. The
  1674.     received message is removed from the message port.
  1675.  
  1676.     This function will not wait.  If a message is not present this
  1677.     function will return zero.  If a program must wait for a message,
  1678.     it can Wait() on the signal specified for the port or use the
  1679.     WaitPort() function.  There can only be one task waiting for any
  1680.     given port.
  1681.  
  1682.     Getting a message does not imply to the sender that the message is
  1683.     free to be reused by the sender.  When the receiver is finished
  1684.     with the message, it may ReplyMsg() it back to the sender.
  1685.  
  1686.  
  1687.     Getting a signal does NOT always imply a message is ready.  More
  1688.     than one message may arrive per signal, and signals may show up
  1689.     without messages.  Typically you must loop to GetMsg() until it
  1690.     returns zero, then Wait() or WaitPort().
  1691.  
  1692.    INPUT
  1693.     port - a pointer to the receiver message port
  1694.  
  1695.    RESULT
  1696.     message - a pointer to the first message available.  If
  1697.           there are no messages, return zero.
  1698.           Callers must be prepared for zero at any time.
  1699.  
  1700.    SEE ALSO
  1701.     PutMsg, ReplyMsg, WaitPort, Wait, exec/ports.h
  1702.  
  1703.  
  1704. exec.library/InitCode                       exec.library/InitCode
  1705.  
  1706.    NAME
  1707.     InitCode - initialize resident code modules
  1708.  
  1709.    SYNOPSIS
  1710.     InitCode(startClass, version)
  1711.          D0         D1
  1712.     void InitCode(ULONG,ULONG);
  1713.  
  1714.    FUNCTION
  1715.     Initialize all resident modules with the given startClass and with
  1716.     versions equal or greater than that specified. Modules are
  1717.     initialized in a prioritized order.
  1718.  
  1719.     Resident modules are used by the system to pull all its parts
  1720.     together at startup.  Resident tags are also found in disk based
  1721.     devices and libraries.
  1722.  
  1723.    INPUTS
  1724.     startClass - the class of code to be initialized: coldstart,
  1725.              coolstart, warmstart, ...
  1726.     version    - a major version number
  1727.  
  1728.     SEE ALSO
  1729.     exec/resident.h
  1730.  
  1731.  
  1732. exec.library/InitResident               exec.library/InitResident
  1733.  
  1734.    NAME
  1735.     InitResident - initialize resident module
  1736.  
  1737.    SYNOPSIS
  1738.     InitResident(resident, segList)
  1739.              A1        D1
  1740.     void InitResident(struct Resident *,BPTR);
  1741.  
  1742.    FUNCTION
  1743.     Initialize a module (these are also called "ROM-tags").  This includes
  1744.     interpreting the fields of the ROM-tag, and calling the initialization
  1745.     hooks.
  1746.  
  1747.     An automatic method of library/device base and vector table
  1748.     initialization is also provided through the use of a such a ROM-tag
  1749.     (Resident) structure.  In this case, the initial code hunk of the
  1750.     library or device should contain "MOVEQ #-1,d0; RTS;".  Following
  1751.     that must be an initialized Resident structure including RTF_AUTOINIT
  1752.     in rt_Flags, and an rt_Init pointer which points to four longwords as
  1753.     follows:
  1754.  
  1755.         - Size of your library/device base structure including initial
  1756.           Library or Device structure.
  1757.         - Pointer to a longword table of standard, then library
  1758.           specific function offsets, terminated with -1L.
  1759.         - Pointer to data table in exec/InitStruct format for
  1760.           initialization of Library or Device structure.
  1761.         - Pointer to library initialization routine, which will receive
  1762.           library/device base in d0, segment in a0, and must return
  1763.           non-zero to link the library/device into the device/library
  1764.           list.
  1765.  
  1766.    SEE ALSO
  1767.     exec/resident.h
  1768.  
  1769. exec.library/InitSemaphore              exec.library/InitSemaphore
  1770.  
  1771.    NAME
  1772.     InitSemaphore -- initialize a signal semaphore
  1773.  
  1774.    SYNOPSIS
  1775.     InitSemaphore(signalSemaphore)
  1776.               A0
  1777.     void InitSemaphore(struct SignalSemaphore *);
  1778.  
  1779.    FUNCTION
  1780.     This function initializes a signal semaphore and prepares it for
  1781.     use.  It does not allocate anything, but does initialize list
  1782.     pointers and the semaphore counters.
  1783.  
  1784.     Semaphores are often used to protect critical data structures
  1785.     or hardware that can only be accessed by one task at a time.
  1786.     After initialization, the address of the SignalSemaphore may be
  1787.     made available to any number of tasks.  Typically a task will
  1788.     try to ObtainSemaphore(), passing this address in.  If no other
  1789.     task owns the semaphore, then the call will lock and return
  1790.     quickly.  If more tasks try to ObtainSemaphore(), they will
  1791.     be put to sleep.  When the owner of the semaphore releases
  1792.     it, the next waiter in turn will be woken up.
  1793.  
  1794.     Semaphores are often preferable to the old-style Forbid()/Permit()
  1795.     type arbitration.  With Forbid()/Permit() *all* other tasks are 
  1796.     prevented from running.  With semaphores, only those tasks that
  1797.     need access to whatever the semaphore protects are subject
  1798.     to waiting.
  1799.  
  1800.    INPUT
  1801.     signalSemaphore -- an uninitialized signal semaphore structure
  1802.  
  1803.    SEE ALSO
  1804.     ObtainSemaphore(), AttemptSemaphore(), ReleaseSemaphore()
  1805.     exec/semaphores.h
  1806.  
  1807.  
  1808. exec.library/InitStruct                  exec.library/InitStruct
  1809.  
  1810.    NAME
  1811.     InitStruct - initialize memory from a table
  1812.  
  1813.    SYNOPSIS
  1814.     InitStruct(initTable, memory, size);
  1815.            A1          A2      D0
  1816.     void InitStruct(struct InitStruct *, APTR, ULONG);
  1817.  
  1818.    FUNCTION
  1819.     Clear a memory area except those words whose data and offset values
  1820.     are provided in the initialization table.  Typically only assembly
  1821.     programs take advantage of this, and only with the macros defined
  1822.     in "exec/initializers.i".
  1823.  
  1824.     The initialization table has byte commands to
  1825.  
  1826.          |a    ||byte|    |given||byte|          |once        |
  1827.     load |count||word| into |next ||rptr| offset, |repetitively |
  1828.             |long|
  1829.  
  1830.     Not all combinations are supported.  The offset, when specified, is
  1831.     relative to the memory pointer provided (Memory), and is initially
  1832.     zero.  The initialization data (InitTable) contains byte commands
  1833.     whose 8 bits are interpreted as follows:
  1834.  
  1835.     ddssnnnn
  1836.         dd    the destination type (and size):
  1837.         00  next destination, nnnn is count
  1838.         01  next destination, nnnn is repeat
  1839.         10  destination offset is next byte, nnnn is count
  1840.         11  destination offset is next rptr, nnnn is count
  1841.         ss    the size and location of the source:
  1842.         00  long, from the next two aligned words
  1843.         01  word, from the next aligned word
  1844.         10  byte, from the next byte
  1845.         11  ERROR - will cause an ALERT (see below)
  1846.       nnnn    the count or repeat:
  1847.          count  the (number+1) of source items to copy
  1848.         repeat  the source is copied (number+1) times.
  1849.  
  1850.     initTable commands are always read from the next even byte. Given
  1851.     destination offsets are always relative to memory (A2).
  1852.  
  1853.     The command 00000000 ends the InitTable stream: use 00010001 if you
  1854.     really want to copy one longword.
  1855.  
  1856.     24 bit APTR not supported for 68020 compatibility -- use long.
  1857.  
  1858.    INPUTS
  1859.     initTable - the beginning of the commands and data to init
  1860.         Memory with.  Must be on an even boundary unless only
  1861.         byte initialization is done.
  1862.     memory - the beginning of the memory to initialize.  Must be
  1863.         on an even boundary if size is specified.
  1864.     size - the size of memory, which is used to clear it before
  1865.         initializing it via the initTable.  If Size is zero,
  1866.         memory is not cleared before initializing.  Size is
  1867.         rounded down to the nearest even number before use.
  1868.  
  1869.     SEE ALSO
  1870.     exec/initializers.i
  1871.  
  1872. exec.library/Insert                     exec.library/Insert
  1873.  
  1874.    NAME
  1875.     Insert -- insert a node into a list
  1876.  
  1877.    SYNOPSIS
  1878.     Insert(list, node, listNode)
  1879.            A0    A1    A2
  1880.     void Insert(struct List *, struct Node *, struct Node *);
  1881.  
  1882.    FUNCTION
  1883.     Insert a node into a doubly linked list AFTER a given node
  1884.     position.  Insertion at the head of a list is possible by passing a
  1885.     zero value for listNode, though the AddHead function is slightly
  1886.     faster for that special case.
  1887.  
  1888.    WARNING
  1889.     This function does not arbitrate for access to the list.  The
  1890.     calling task must be the owner of the involved list.
  1891.  
  1892.    INPUTS
  1893.     list - a pointer to the target list header
  1894.     node - the node to insert
  1895.     listNode - the node after which to insert
  1896.  
  1897.     SEE ALSO
  1898.     AddHead, AddTail, Enqueue, RemHead, Remove, RemTail
  1899.  
  1900.  
  1901. exec.library/MakeFunctions              exec.library/MakeFunctions
  1902.  
  1903.    NAME
  1904.     MakeFunctions -- construct a function jump table
  1905.  
  1906.    SYNOPSIS
  1907.     tableSize = MakeFunctions(target, functionArray, funcDispBase)
  1908.     D0              A0      A1         A2
  1909.     ULONG MakeFunctions(APTR,APTR,APTR);
  1910.  
  1911.    FUNCTION
  1912.     This function constructs a function jump table of the type used by
  1913.     resources, libraries, and devices.  It allows the table to be built
  1914.     anywhere in memory, and can be used both for initialization and
  1915.     replacement. This function also supports function pointer
  1916.     compression by expanding relative displacements into absolute
  1917.     pointers.
  1918.  
  1919.    INPUT
  1920.     destination - the target address for the high memory end of the
  1921.         function jump table.  Typically this will be the library
  1922.         base pointer.
  1923.  
  1924.     functionArray - pointer to an array of function pointers or
  1925.         function displacements.  If funcDispBase is zero, the array
  1926.         is assumed to contain absolute pointers to functions. If
  1927.         funcDispBase is not zero, then the array is assumed to
  1928.         contain word displacements to functions.  In both cases,
  1929.         the array is terminated by a -1 (of the same size as the
  1930.         actual entry.
  1931.  
  1932.     funcDispBase - pointer to the base about which all function
  1933.         displacements are relative.  If zero, then the function
  1934.         array contains absolute pointers.
  1935.  
  1936.    RESULT
  1937.     tableSize - size of the new table in bytes.
  1938.  
  1939.    SEE ALSO
  1940.     exec/MakeLibrary
  1941.  
  1942. exec.library/MakeLibrary                exec.library/MakeLibrary
  1943.  
  1944.    NAME
  1945.     MakeLibrary -- construct a library
  1946.  
  1947.    SYNOPSIS
  1948.     library = MakeLibrary(vectors, structure, init, dSize, segList)
  1949.     D0              A0       A1      A2    D0     D1
  1950.     struct Library *MakeLibrary
  1951.                   (APTR,struct InitStruct *,APTR,ULONG,BPTR);
  1952.  
  1953.    FUNCTION
  1954.     This function is used for constructing a library vector and data
  1955.     area.  The same call is used to make devices.  Space for the library
  1956.     is allocated from the system's free memory pool. The size fields of
  1957.     the library are filled.  The data portion of the library is
  1958.     initialized.  init may point to a library specific entry point,
  1959.     or NULL if no call is to be made.
  1960.  
  1961.    INPUTS
  1962.     vectors - pointer to an array of function pointers or function
  1963.         displacements.    If the first word of the array is -1, then
  1964.         the array contains relative word displacements (based off
  1965.         of vectors); otherwise, the array contains absolute
  1966.         function pointers. The vector list is terminated by a -1
  1967.         (of the same size as the pointers).
  1968.  
  1969.     structure - points to an "InitStruct" data region.  If NULL,
  1970.         then it will not be used.
  1971.  
  1972.     init -    an entry point that will be called before adding the
  1973.         library to the system.    If null, it will not be called. When
  1974.         it is called, it will be called with the libAddr in D0 and
  1975.         the segList parameter in A0. The result of the init function
  1976.         will be the result returned by MakeLibrary.
  1977.         A Forbid()/Permit() pair surrounds this call.
  1978.  
  1979.     dSize - the size of the library data area, including the
  1980.         standard library node data.
  1981.  
  1982.        segList - pointer to an AmigaDOS SegList (segment list).
  1983.          This is passed to a library's init code, and is used later
  1984.          for removing the library from memory.
  1985.  
  1986.    RESULT
  1987.     library - the reference address of the library.  This is the
  1988.           address used in references to the library, not the
  1989.           beginning of the memory area allocated.  If the library
  1990.           vector table require more system memory than is
  1991.           available, this function will return NULL.
  1992.  
  1993.    SEE ALSO
  1994.     InitStruct, InitResident, exec/initializers.i
  1995.  
  1996. exec.library/ObtainSemaphore            exec.library/ObtainSemaphore
  1997.  
  1998.    NAME
  1999.     ObtainSemaphore -- gain exclusive access to a semaphore
  2000.  
  2001.    SYNOPSIS
  2002.     ObtainSemaphore(signalSemaphore)
  2003.             A0
  2004.     void ObtainSemaphore(struct SignalSemaphore *);
  2005.  
  2006.    FUNCTION
  2007.     Signal semaphores are used to gain exclusive access to an object.
  2008.     ObtainSemaphore is the call used to gain this access.  If another
  2009.     user currently has the semaphore locked the call will block until
  2010.     the object is available.
  2011.  
  2012.     If the current task already has locked the semaphore and attempts to
  2013.     lock it again the call will still succeed.  A "nesting count" is
  2014.     incremented each time the current owning task of the semaphore calls
  2015.     ObtainSemaphore().  This counter is decremented each time
  2016.     ReleaseSemaphore() is called.  When the counter returns to zero the
  2017.     semaphore is actually released, and the next waiting task is called.
  2018.  
  2019.     A queue of waiting tasks is maintained on the stacks of the waiting
  2020.     tasks.    Each will be called in turn as soon as the current task
  2021.     releases the semaphore.
  2022.  
  2023.     Signal Semaphores are different than Procure()/Vacate() semaphores.
  2024.     The former requires less CPU time, especially if the semaphore is
  2025.     not currently locked.  They require very little set up and user
  2026.     thought.  The latter flavor of semaphore make no assumptions about
  2027.     how they are used -- they are completely general.  Unfortunately
  2028.     they are not as efficient as signal semaphores, and require the
  2029.     locker to have done some setup before doing the call.
  2030.  
  2031.    INPUT
  2032.        signalSemaphore -- an initialized signal semaphore structure
  2033.  
  2034.    SEE ALSO
  2035.     InitSemaphore(), ReleaseSemaphore()
  2036.     AttemptSemaphore(), ObtainSemaphoreList()
  2037.  
  2038.  
  2039. exec.library/ObtainSemaphoreList        exec.library/ObtainSemaphoreList
  2040.  
  2041.    NAME
  2042.     ObtainSemaphoreList -- get a list of semaphores.
  2043.  
  2044.    SYNOPSIS
  2045.     ObtainSemaphoreList(list)
  2046.                 A0
  2047.     void ObtainSemaphoreList(struct List *);
  2048.  
  2049.    FUNCTION
  2050.     Signal semaphores may be linked together into a list. This routine
  2051.     takes a list of these semaphores and attempts to lock all of them at
  2052.     once. This call is preferable to applying ObtainSemaphore() to each
  2053.     element in the list because it attempts to lock all the elements
  2054.     simultaneously, and won't deadlock if someone is attempting to lock
  2055.     in some other order.
  2056.  
  2057.     This routine assumes that only one task at a time will attempt to
  2058.     lock the entire list of semaphores.  In other words, there needs to
  2059.     be a higher level lock (perhaps another signal semaphore...) that is
  2060.     used before someone attempts to lock the semaphore list via
  2061.     ObtainSemaphoreList().
  2062.  
  2063.     Note that deadlocks may result if this call is used AND someone
  2064.     attempts to use ObtainSemaphore() to lock more than one semaphore on
  2065.     the list.  If you wish to lock more than semaphore (but not all of
  2066.     them) then you should obtain the higher level lock (see above)
  2067.  
  2068.    INPUT
  2069.        list -- a list of signal semaphores
  2070.  
  2071.    SEE ALSO
  2072.     ObtainSemaphore(), ReleaseSemaphore(), ReleaseSemaphoreList()
  2073.  
  2074.  
  2075. exec.library/OldOpenLibrary             exec.library/OldOpenLibrary
  2076.  
  2077.    NAME
  2078.     OldOpenLibrary -- obsolete OpenLibrary
  2079.  
  2080.    SYNOPSIS
  2081.     library = OldOpenLibrary(libName)
  2082.     D0             A1
  2083.     struct Library *OldOpenLibrary(APTR);
  2084.  
  2085.    FUNCTION
  2086.     The 1.0 release of the Amiga system had an incorrect version of
  2087.     OpenLibrary that did not check the version number during the
  2088.     library open.  This obsolete function is provided so that object
  2089.     code compiled using a 1.0 system will still run.
  2090.  
  2091.     This exactly the same as "OpenLibrary(libName,0L);"
  2092.  
  2093.    INPUTS
  2094.     libName - the name of the library to open
  2095.  
  2096.    RESULTS
  2097.     library - a library pointer for a successful open, else zero
  2098.  
  2099.    SEE ALSO
  2100.     CloseLibrary
  2101.  
  2102. exec.library/OpenDevice                  exec.library/OpenDevice
  2103.  
  2104.    NAME
  2105.     OpenDevice -- gain access to a device
  2106.  
  2107.    SYNOPSIS
  2108.     error = OpenDevice(devName, unitNumber, iORequest, flags)
  2109.     D0           A0        D0        A1       D1
  2110.     BYTE OpenDevice(char *,ULONG,struct IORequest *,ULONG);
  2111.  
  2112.    FUNCTION
  2113.     This function opens the named device/unit and initializes the given
  2114.     I/O request block.  Specific documentation on opening procedures
  2115.     may come with certain devices.
  2116.  
  2117.     The device may exist in memory, or on disk; this is transparent to
  2118.     the OpenDevice caller.
  2119.  
  2120.     A full path name for the device name is legitimate.  For example
  2121.     "test:devs/fred.device".  This allows the use of custom devices
  2122.     without requiring the user to copy the device into the system's
  2123.     DEVS: directory.
  2124.  
  2125.    NOTE
  2126.     All calls to OpenDevice should have matching calls to CloseDevice!
  2127.  
  2128.    INPUTS
  2129.     devName - requested device name
  2130.  
  2131.     unitNumber - the unit number to open on that device.  The format of
  2132.         the unit number is device specific.  If the device does
  2133.         not have separate units, send a zero.
  2134.  
  2135.     iORequest - the I/O request block to be returned with
  2136.         appropriate fields initialized.
  2137.  
  2138.     flags - additional driver specific information.  This is sometimes
  2139.         used to request opening a device with exclusive access.
  2140.  
  2141.    RESULTS
  2142.     error - Returns a sign-extended copy of the io_Error field
  2143.         of the IORequest.  Zero if successful, else an error code
  2144.         is returned.
  2145.  
  2146.    BUGS
  2147.     AmigaDOS file names are not case sensitive, but Exec lists are.  If
  2148.     the library name is specified in a different case than it exists on
  2149.     disk, unexpected results may occur.
  2150.  
  2151.     Tasks should not be allowed to make OpenDevice calls that will
  2152.     cause the device to be loaded from disk (since tasks are not
  2153.     allowed to make AmigaDOS requests).
  2154.  
  2155.    SEE ALSO
  2156.     CloseDevice, DoIO, SendIO, CheckIO, AbortIO, WaitIO
  2157.  
  2158. exec.library/OpenLibrary                exec.library/OpenLibrary
  2159.  
  2160.    NAME
  2161.     OpenLibrary -- gain access to a library
  2162.  
  2163.    SYNOPSIS
  2164.     library = OpenLibrary(libName, version)
  2165.     D0              A1       D0
  2166.     struct Library *OpenLibrary(char *,ULONG);
  2167.  
  2168.    FUNCTION
  2169.     This function returns a pointer to a library that was previously
  2170.     installed into the system.  If the requested library is exists, and
  2171.     if the library version is greater than or equal to the requested
  2172.     version, then the open will succeed.
  2173.  
  2174.     The device may exist in memory, or on disk; this is transparent to
  2175.     the OpenDevice caller.    Since this call may in turn call AmigaDOS,
  2176.     only Processes are allowed to call it.
  2177.  
  2178.     A full path name for the library name is legitimate.  For example
  2179.     "wp:libs/wp.library".  This allows the use of custom libraries
  2180.     without requiring the user to copy the library into the system's
  2181.     LIBS: directory.
  2182.  
  2183.    NOTE
  2184.     All calls to OpenLibrary should have matching calls to CloseLibrary!
  2185.  
  2186.    INPUTS
  2187.     libName - the name of the library to open
  2188.  
  2189.     version - the version of the library required.
  2190.  
  2191.    RESULTS
  2192.     library - a library pointer for a successful open, else zero
  2193.  
  2194.    BUGS
  2195.     AmigaDOS file names are not case sensitive, but Exec lists are. If
  2196.     the library name is specified in a different case than it exists on
  2197.     disk, unexpected results may occur.
  2198.  
  2199.     Tasks should not be allowed to make OpenLibrary calls that will
  2200.     cause the library to be loaded from disk (since tasks are not
  2201.     allowed to make AmigaDOS requests).
  2202.  
  2203.    SEE ALSO
  2204.     CloseLibrary
  2205.  
  2206. exec.library/OpenResource               exec.library/OpenResource
  2207.  
  2208.    NAME
  2209.     OpenResource -- gain access to a resource
  2210.  
  2211.    SYNOPSIS
  2212.     resource = OpenResource(resName)
  2213.     D0            A1
  2214.     APTR OpenResource(char *);
  2215.  
  2216.    FUNCTION
  2217.     This function returns a pointer to a resource that was previously
  2218.     installed into the system.
  2219.  
  2220.     There is no CloseResource() function.
  2221.  
  2222.    INPUTS
  2223.        resName - the name of the resource requested.
  2224.  
  2225.    RESULTS
  2226.     resource - if successful, a resource pointer, else NULL
  2227.  
  2228. exec.library/Permit                      exec.library/Permit
  2229.  
  2230.     NAME
  2231.     Permit -- permit task rescheduling.
  2232.  
  2233.     SYNOPSIS
  2234.     Permit()
  2235.  
  2236.     void Permit(void);
  2237.  
  2238.     FUNCTION
  2239.     Allow other tasks to be scheduled to run by the dispatcher, after a
  2240.     matching Forbid() has been executed.
  2241.  
  2242.     RESULTS
  2243.     Other tasks will be rescheduled as they are ready to run. In order
  2244.     to restore normal task rescheduling, the programmer must execute
  2245.     exactly one call to Permit() for every call to Forbid().
  2246.  
  2247.     SEE ALSO
  2248.     Forbid, Disable, Enable
  2249.  
  2250.  
  2251. exec.library/Procure                     exec.library/Procure
  2252.  
  2253.    NAME
  2254.     Procure -- bid for a message lock (semaphore)
  2255.  
  2256.    SYNOPSIS
  2257.     result = Procure(semaphore, bidMessage)
  2258.     D0         A0        A1
  2259.     BYTE Procure(struct Semaphore *, struct Message *);
  2260.  
  2261.    FUNCTION
  2262.     This function is used to obtain a message based semaphore lock.  If
  2263.     the lock is immediate, Procure() returns a true result, and the
  2264.     bidMessage is not used.   If the semaphore is already locked,
  2265.     Procure() returns false, and the task must wait for the bidMessage
  2266.     to arrive at its reply port.
  2267.  
  2268.     Straight "Semaphores" use the message system.  They are therefore
  2269.     queueable, and users may wait on several of them at the same time.
  2270.     This makes them more powerful than "Signal Semaphores"
  2271.  
  2272.    INPUT
  2273.     semaphore - a semaphore message port.  This port is used to queue
  2274.     all pending lockers.  This port should be initialized with the
  2275.     PA_IGNORE option, as the MP_SigTask field is used for a pointer to
  2276.     the current locker message (not a task). New semaphore ports must
  2277.     also have the SM_BIDS word initialized to -1.  If the semaphore is
  2278.     public, it should be named, its priority set, and the added with
  2279.     AddPort. Message port priority is often used for anti-deadlock
  2280.     locking conventions.
  2281.  
  2282.    RESULT
  2283.     result - true when the semaphore is free.  In such cases no waiting
  2284.     needs to be done.  If false, then the task should wait at its
  2285.     bidMessage reply port.
  2286.  
  2287.    BUGS
  2288.     Procure() and Vacate() do not have proven reliability.
  2289.  
  2290.    SEE ALSO
  2291.     Vacate()
  2292.  
  2293.  
  2294. exec.library/PutMsg                      exec.library/PutMsg
  2295.  
  2296.    NAME
  2297.     PutMsg -- put a message to a message port
  2298.  
  2299.    SYNOPSIS
  2300.     PutMsg(port, message)
  2301.            A0    A1
  2302.     void PutMsg(struct MsgPort *, struct Message *);
  2303.  
  2304.    FUNCTION
  2305.     This function attaches a message to a given message port. It
  2306.     provides a fast, non-copying message sending mechanism.
  2307.  
  2308.     Messages can be attached to only one port at a time.  The message
  2309.     body can be of any size or form.  Because messages are not copied,
  2310.     cooperating tasks share the same message memory.  The sender task
  2311.     should not recycle the message until it has been replied by the
  2312.     receiver.  Of course this depends on the message handling conventions
  2313.     setup by the involved tasks.  If the ReplyPort field is non-zero,
  2314.     when the message is replied by the receiver, it will be sent back to
  2315.     that port.
  2316.  
  2317.     Any one of the following actions can be set to occur when a message
  2318.     is put:
  2319.  
  2320.         1. no special action
  2321.         2. signal a given task (specified by MP_SIGTASK)
  2322.         3. cause a software interrupt (specified by MP_SIGTASK)
  2323.  
  2324.     The action is selected depending on the value found in the MP_FLAGS
  2325.     of the destination port.
  2326.  
  2327.    IMPLEMENTATION
  2328.     1.  Sets the LN_TYPE field to "NT_MESSAGE".
  2329.     2.  Attaches the message to the destination port.
  2330.     3.  Performs the specified arrival action at the destination.
  2331.  
  2332.    INPUT
  2333.     port - pointer to a message port
  2334.     message - pointer to a message
  2335.  
  2336.    SEE ALSO
  2337.     GetMsg, ReplyMsg, exec/ports.h
  2338.  
  2339. exec.library/RawDoFmt                       exec.library/RawDoFmt
  2340.  
  2341.    NAME
  2342.     RawDoFmt -- format data into a character stream.
  2343.  
  2344.    SYNOPSIS
  2345.     RawDoFmt(FormatString, DataStream, PutChProc, PutChData);
  2346.          A0           A1       A2          A3
  2347.     void(char *,APTR,void (*)(),APTR);
  2348.  
  2349.    FUNCTION
  2350.     perform "C"-language-like formatting of a data stream, outputting
  2351.     the result a character at a time.  Where % formatting commands are
  2352.     found in the FormatString, they will be replaced with the
  2353.     corresponding element in the DataStream.  %% must be used in the
  2354.     string if a % is desired in the output.
  2355.  
  2356.    INPUTS
  2357.     FormatString - a "C"-language-like null terminated format string,
  2358.     with the following supported % options:
  2359.  
  2360.          %[flags][width.limit][length]type
  2361.  
  2362.         flags  - only one allowed. '-' specifies left justification.
  2363.         width  - field width.  If the first character is a '0', the
  2364.              field will be padded with leading 0's.
  2365.           .    - must follow the field width, if specified
  2366.         limit  - maximum number of characters to output from a string.
  2367.              (only valid for %s).
  2368.         length - size of input data defaults to WORD, 'l' changes this
  2369.              to long.
  2370.         type   - supported types are:
  2371.             d - decimal
  2372.             x - hexadecimal
  2373.             s - string
  2374.             c - character
  2375.  
  2376.     DataStream - a stream of data that is interpreted according to
  2377.              the format string.  Often this is a pointer into
  2378.              the task's stack.
  2379.     PutChProc  - the procedure to call with each character to be
  2380.              output, called as:
  2381.  
  2382.         PutChProc(Char,  PutChData);
  2383.               D0-0:8 A3
  2384.  
  2385.         the procedure is called with a null Char at the end of
  2386.         the format string.
  2387.  
  2388.     PutChData - a value that is passed through to the PutChProc
  2389.             procedure.    This is untouched by RawDoFmt, and may be
  2390.             modified by the PutChProc.
  2391.  
  2392.    EXAMPLE
  2393. ;
  2394. ; Simple version of the C "sprintf" function.  Assumes C-style
  2395. ; stack-based function conventions.
  2396. ;
  2397. ;   long eyecount;
  2398. ;   eyecount=2;
  2399. ;   sprintf(string,"%s have %ld eyes.","Fish",eyecount);
  2400. ;
  2401. ; would produce "Fish have 2 eyes." in the string buffer.
  2402. ;
  2403.         XDEF _sprintf
  2404. _sprintf:    ; ( string, format, {values} )
  2405.         movem.l a2/a3/a6,-(sp)
  2406.  
  2407.         move.l    5*4(sp),a3       ;Get the output string pointer
  2408.         move.l    6*4(sp),a0       ;Get the FormatString pointer
  2409.         lea.l    7*4(sp),a1       ;Get the pointer to the DataStream
  2410.         lea.l    stuffChar(pc),a2
  2411.         move.l    _AbsExecBase,a6
  2412.         jsr    _LVORawDoFmt(a6)
  2413.  
  2414.         movem.l (sp)+,a2/a3/a6
  2415.         rts
  2416.  
  2417. ;------ PutChProc function used by RawDoFmt -----------
  2418. stuffChar:    move.b    d0,(a3)+            ;Put data to output string
  2419.         rts
  2420.  
  2421.    WARNING
  2422.     This is the only Amiga ROM function that accepts word inputs. If
  2423.     your compiler defaults to longs, you will need to add a "l" to your
  2424.     % specification.  This can get strange for characters, which must
  2425.     look like "%lc".
  2426.  
  2427.    SEE ALSO
  2428.     Documentation on the C language "printf" call in any C language
  2429.     reference book.
  2430.  
  2431. exec.library/ReleaseSemaphore               exec.library/ReleaseSemaphore
  2432.  
  2433.    NAME
  2434.     ReleaseSemaphore -- make signal semaphore available to others
  2435.  
  2436.    SYNOPSIS
  2437.     ReleaseSemaphore(signalSemaphore)
  2438.              A0
  2439.     void ReleaseSemaphore(struct SignalSemaphore *);
  2440.  
  2441.    FUNCTION
  2442.     ReleaseSemaphore() is the inverse of ObtainSemaphore(). It makes
  2443.     the semaphore lockable to other users.    If tasks are waiting for
  2444.     the semaphore and this this task is done with the semaphore then
  2445.     the next waiting task is signalled.
  2446.  
  2447.     Each ObtainSemaphore() call must be balanced by exactly one
  2448.     ReleaseSemaphore() call.  This is because there is a nesting count
  2449.     maintained in the semaphore of the number of times that the current
  2450.     task has locked the semaphore. The semaphore is not released to
  2451.     other tasks until the number of releases matches the number of
  2452.     obtains.
  2453.  
  2454.     Needless to say, havoc breaks out if the task releases more times
  2455.     than it has obtained.
  2456.  
  2457.    INPUT
  2458.        signalSemaphore -- an initialized signal semaphore structure
  2459.  
  2460.    SEE ALSO
  2461.     ObtainSemaphore(), AttemptSemaphore()
  2462.  
  2463. exec.library/ReleaseSemaphoreList       exec.library/ReleaseSemaphoreList
  2464.  
  2465.    NAME
  2466.     ReleaseSemaphoreList -- make a list of semaphores available
  2467.  
  2468.    SYNOPSIS
  2469.     ReleaseSemaphoreList(list)
  2470.                  A0
  2471.     void ReleaseSemaphoreList(struct List *);
  2472.  
  2473.    FUNCTION
  2474.     ReleaseSemaphoreList() is the inverse of ObtainSemaphoreList(). It
  2475.     releases each element in the semaphore list.
  2476.  
  2477.     Needless to say, havoc breaks out if the task releases more times
  2478.     than it has obtained.
  2479.  
  2480.    INPUT
  2481.        list -- a list of signal semaphores
  2482.  
  2483.    SEE ALSO
  2484.     ObtainSemaphore(), ReleaseSemaphore(), ObtainSemaphoreList()
  2485.     AttemptSemaphore()
  2486.  
  2487.  
  2488. exec.library/RemDevice                      exec.library/RemDevice
  2489.  
  2490.    NAME
  2491.     RemDevice -- remove a device from the system
  2492.  
  2493.    SYNOPSIS
  2494.     void RemDevice(device)
  2495.                A1
  2496.     void RemDevice(struct Device *);
  2497.  
  2498.    FUNCTION
  2499.     This function calls the device's EXPUNGE vector, which requests
  2500.     that a device delete itself.  The device may refuse to do this if
  2501.     it is busy or currently open. This is not typically called by user
  2502.     code.
  2503.  
  2504.     There are certain, limited circumstances where it may be
  2505.     appropriate to attempt to specifically flush a certain device.
  2506.     Example:
  2507.  
  2508.      /* Attempts to flush the named device out of memory. */
  2509.      #include "exec/types.h"
  2510.      #include "exec/execbase.h"
  2511.  
  2512.      void FlushDevice(name)
  2513.      char  *name;
  2514.      {
  2515.      struct Device *result;
  2516.  
  2517.         Forbid();
  2518.         if(result=(struct Device *)FindName(&SysBase->DeviceList,name))
  2519.         RemDevice(result);
  2520.         Permit();
  2521.      }
  2522.  
  2523.    INPUTS
  2524.     device - pointer to a device node
  2525.  
  2526.    SEE ALSO
  2527.     AddLibrary
  2528.  
  2529. exec.library/RemHead                    exec.library/RemHead
  2530.  
  2531.    NAME
  2532.     RemHead -- remove the head node from a list
  2533.  
  2534.    SYNOPSIS
  2535.     node = RemHead(list)
  2536.     D0           A0
  2537.     struct Node *RemHead(struct List *);
  2538.  
  2539.    FUNCTION
  2540.     Get a pointer to the head node and remove it from the list.
  2541.     Assembly programmers may prefer to use the REMHEAD macro from
  2542.     "exec/lists.i".
  2543.  
  2544.    WARNING
  2545.     This function does not arbitrate for access to the list.  The
  2546.     calling task must be the owner of the involved list.
  2547.  
  2548.    INPUTS
  2549.     list - a pointer to the target list header
  2550.  
  2551.    RESULT
  2552.     node - the node removed or zero when empty list
  2553.  
  2554.    SEE ALSO
  2555.     AddHead, AddTail, Enqueue, Insert, Remove, RemTail
  2556.  
  2557. exec.library/RemIntServer               exec.library/RemIntServer
  2558.  
  2559.    NAME
  2560.     RemIntServer -- remove an interrupt server
  2561.  
  2562.    SYNOPSIS
  2563.     RemIntServer(intNum, interrupt)
  2564.              D0      A1
  2565.     void RemIntServer(ULONG,struct Interrupt *);
  2566.  
  2567.    FUNCTION
  2568.     This function removes an interrupt server node from the given
  2569.     server chain.
  2570.  
  2571.     If this server was the last one on this chain, interrupts for this
  2572.     chain are disabled.
  2573.  
  2574.    INPUTS
  2575.     intNum - the Portia interrupt bit (0..14)
  2576.     interrupt - pointer to an interrupt server node
  2577.  
  2578.    SEE ALSO
  2579.     AddIntServer, hardware/intbits.h
  2580.  
  2581.  
  2582. exec.library/RemLibrary                   exec.library/RemLibrary
  2583.  
  2584.    NAME
  2585.     RemLibrary -- remove a library from the system
  2586.  
  2587.    SYNOPSIS
  2588.     void RemLibrary(library)
  2589.            A1
  2590.     void RemLibrary(struct Library *);
  2591.  
  2592.    FUNCTION
  2593.     This function calls the library's EXPUNGE vector, which requests
  2594.     that a library delete itself.  The library may refuse to do this if
  2595.     it is busy or currently open. This is not typically called by user
  2596.     code.
  2597.  
  2598.     There are certain, limited circumstances where it may be
  2599.     appropriate to attempt to specifically flush a certain Library.
  2600.     Example:
  2601.  
  2602.      /* Attempts to flush the named library out of memory. */
  2603.      #include "exec/types.h"
  2604.      #include "exec/execbase.h"
  2605.  
  2606.      void FlushLibrary(name)
  2607.      char  *name;
  2608.      {
  2609.      struct Library *result;
  2610.  
  2611.         Forbid();
  2612.         if(result=(struct Library *)FindName(&SysBase->LibList,name))
  2613.         RemLibrary(result);
  2614.         Permit();
  2615.      }
  2616.  
  2617.    INPUTS
  2618.     library - pointer to a library node structure
  2619.  
  2620. exec.library/Remove                     exec.library/Remove
  2621.  
  2622.    NAME
  2623.     Remove -- remove a node from a list
  2624.  
  2625.    SYNOPSIS
  2626.     Remove(node)
  2627.            A1
  2628.     void Remove(struct Node *);
  2629.  
  2630.    FUNCTION
  2631.     Remove a node from whatever list it is in.  Nodes that are not part
  2632.     of a list must not be Removed!  Assembly programmers may prefer to
  2633.     use the REMOVE macro from "exec/lists.i".
  2634.  
  2635.    WARNING
  2636.     This function does not arbitrate for access to the list.  The
  2637.     calling task must be the owner of the involved list.
  2638.  
  2639.    INPUTS
  2640.     node - the node to remove
  2641.  
  2642.    SEE ALSO
  2643.     AddHead, AddTail, Enqueue, Insert, RemHead, RemTail
  2644.  
  2645. exec.library/RemPort                    exec.library/RemPort
  2646.  
  2647.    NAME
  2648.     RemPort -- remove a message port from the system
  2649.  
  2650.    SYNOPSIS
  2651.     RemPort(port)
  2652.         A1
  2653.     void RemPort(struct MsgPort *);
  2654.  
  2655.    FUNCTION
  2656.     This function removes a message port structure from the system's
  2657.     message port list.  Subsequent attempts to rendezvous by name with
  2658.     this port will fail.
  2659.  
  2660.    INPUTS
  2661.     port - pointer to a message port
  2662.  
  2663.    SEE ALSO
  2664.     AddPort, FindPort
  2665.  
  2666. exec.library/RemResource                exec.library/RemResource
  2667.  
  2668.    NAME
  2669.     RemResource -- remove a resource from the system
  2670.  
  2671.    SYNOPSIS
  2672.     RemResource(resource)
  2673.            A1
  2674.     void RemResource(APTR);
  2675.  
  2676.    FUNCTION
  2677.     This function removes an existing resource from the system resource
  2678.     list.
  2679.  
  2680.    INPUTS
  2681.     resource - pointer to a resource node
  2682.  
  2683.    SEE ALSO
  2684.     AddResource
  2685.  
  2686. exec.library/RemSemaphore               exec.library/RemSemaphore
  2687.  
  2688.    NAME
  2689.     RemSemaphore -- remove a signal semaphore from the system
  2690.  
  2691.    SYNOPSIS
  2692.     RemSemaphore(signalSemaphore)
  2693.              A1
  2694.     void RemSemaphore(struct SignalSemaphore *);
  2695.  
  2696.    FUNCTION
  2697.     This function removes a signal semaphore structure from the
  2698.     system's signal semaphore list.  Subsequent attempts to
  2699.     rendezvous by name with this semaphore will fail.
  2700.  
  2701.    INPUTS
  2702.        signalSemaphore -- an initialized signal semaphore structure
  2703.  
  2704.    SEE ALSO
  2705.     AddSemaphore, FindSemaphore
  2706.  
  2707.  
  2708. exec.library/RemTail                    exec.library/RemTail
  2709.  
  2710.    NAME
  2711.     RemTail -- remove the tail node from a list
  2712.  
  2713.    SYNOPSIS
  2714.     node = RemTail(list)
  2715.     D0           A0
  2716.     struct Node *RemTail(struct List *);
  2717.  
  2718.    FUNCTION
  2719.     Remove the last node from a list, and return a pointer to it. If
  2720.     the list is empty, return zero. Assembly programmers may prefer to
  2721.     use the REMTAIL macro from "exec/lists.i".
  2722.  
  2723.    WARNING
  2724.     This function does not arbitrate for access to the list.  The
  2725.     calling task must be the owner of the involved list.
  2726.  
  2727.    INPUTS
  2728.     list - a pointer to the target list header
  2729.  
  2730.    RESULT
  2731.     node - the node removed or zero when empty list
  2732.  
  2733.    SEE ALSO
  2734.     AddHead, AddTail, Enqueue, Insert, Remove, RemHead, RemTail
  2735.  
  2736. exec.library/RemTask                    exec.library/RemTask
  2737.  
  2738.    NAME
  2739.     RemTask -- remove a task from the system
  2740.  
  2741.    SYNOPSIS
  2742.     RemTask(task)
  2743.         A1
  2744.     void RemTask(struct Task *);
  2745.  
  2746.    FUNCTION
  2747.     This function removes a task from the system.  Deallocation of
  2748.     resources should have been performed prior to calling this
  2749.     function.  Removing some other task is very dangerous.    Generally
  2750.     is is best to arrange for tasks to call RemTask(0L) on themselves.
  2751.  
  2752.     RemTask will automagically free any memory lists attached to the
  2753.     task's TC_MEMENTRY list.
  2754.  
  2755.    INPUTS
  2756.     task - pointer to the task node representing the task to be
  2757.            removed.  A zero value indicates self removal, and will
  2758.            cause the next ready task to begin execution.
  2759.  
  2760.    SEE ALSO
  2761.     AddTask, exec/AllocEntry, amiga.lib/DeleteTask
  2762.  
  2763. exec.library/ReplyMsg                       exec.library/ReplyMsg
  2764.  
  2765.    NAME
  2766.     ReplyMsg -- put a message to its reply port
  2767.  
  2768.    SYNOPSIS
  2769.     ReplyMsg(message)
  2770.          A1
  2771.     void ReplyMsg(struct Message *);
  2772.  
  2773.    FUNCTION
  2774.     This function sends a message to its reply port.  This is usually
  2775.     done when the receiver of a message has finished and wants to
  2776.     return it to the sender (so that it can be re-used or deallocated,
  2777.     whatever).
  2778.  
  2779.     This call may be made from interrupts.
  2780.  
  2781.    INPUT
  2782.     message - a pointer to the message
  2783.  
  2784.    IMPLEMENTATION
  2785.     1> Places "NT_REPLYMSG" into LN_TYPE.
  2786.     2> Puts the message to the port specified by MN_REPLYPORT
  2787.        If there is no replyport, sets LN_TYPE to "NT_FREEMSG".
  2788.  
  2789.    SEE ALSO
  2790.     GetMsg, PutMsg, exec/ports.h
  2791.  
  2792. exec.library/SendIO                     exec.library/SendIO
  2793.  
  2794.    NAME
  2795.     SendIO -- initiate an I/O command
  2796.  
  2797.    SYNOPSIS
  2798.     SendIO(iORequest)
  2799.            A1
  2800.     void SendIO(struct IORequest *);
  2801.  
  2802.    FUNCTION
  2803.     This function requests the device driver start processing the given
  2804.     I/O request.  The device will return control without waiting for
  2805.     the I/O to complete.
  2806.  
  2807.     The io_Flags field of the IORequest will be set to zero before the
  2808.     request is sent.
  2809.  
  2810.    INPUTS
  2811.     iORequest - pointer to an I/O request, or a device specific
  2812.             extended IORequest.
  2813.  
  2814.    SEE ALSO
  2815.     DoIO, CheckIO, WaitIO, AbortIO
  2816.  
  2817. exec.library/SetExcept                      exec.library/SetExcept
  2818.  
  2819.    NAME
  2820.     SetExcept -- define certain signals to cause exceptions
  2821.  
  2822.    SYNOPSIS
  2823.     oldSignals = SetExcept(newSignals, signalMask)
  2824.     D0               D0       D1
  2825.     ULONG SetExcept(ULONG,ULONG);
  2826.  
  2827.    FUNCTION
  2828.     This function defines which of the task's signals will cause a
  2829.     private task exception.  When any of the signals occurs the task's
  2830.     exception handler will be dispatched.  If the signal occurred prior
  2831.     to calling SetExcept, the exception will happen immediately.
  2832.  
  2833.     The user function pointed to by the task's tc_ExceptCode gets
  2834.     called as:
  2835.  
  2836.         newExcptSet = <exceptCode>(signals, exceptData),SysBase
  2837.         D0                   D0    A1        A6
  2838.  
  2839.         signals - The set of signals that caused this exception.  These
  2840.         Signals have been disabled from the current set of signals
  2841.         that can cause an exception.
  2842.  
  2843.         exceptData - A copy of the task structure tc_ExceptData field.
  2844.  
  2845.         newExcptSet - The set of signals in NewExceptSet will be re-
  2846.         enabled for exception generation.  Usually this will be the
  2847.         same as the Signals that caused the exception.
  2848.  
  2849.     All registers are preserved by the system before the call.
  2850.  
  2851.  
  2852.    INPUTS
  2853.     newSignals - the new values for the signals specified in
  2854.         signalMask.
  2855.     signalMask - the set of signals to be effected
  2856.  
  2857.    RESULTS
  2858.     oldSignals - the prior exception signals
  2859.  
  2860.    EXAMPLE
  2861.     Get the current state of all exception signals:
  2862.         SetExcept(0,0)
  2863.     Change a few exception signals:
  2864.         SetExcept($1374,$1074)
  2865.  
  2866.    SEE ALSO
  2867.     Signal, SetSignal
  2868.  
  2869. exec.library/SetFunction                exec.library/SetFunction
  2870.  
  2871.    NAME
  2872.     SetFunction -- change a function vector in a library
  2873.  
  2874.    SYNOPSIS
  2875.     oldFunc = SetFunction(library, funcOffset, funcEntry)
  2876.     D0              A1       A0.W       D0
  2877.     APTR SetFunction(struct Library *,LONG,APTR);
  2878.  
  2879.    FUNCTION
  2880.     SetFunction is a functional way of changing where vectors in a
  2881.     library point.    They are changed in such a way that the
  2882.     checksumming process will never falsely declare a library to be
  2883.     invalid.
  2884.  
  2885.    NOTE
  2886.     SetFunction cannot be used on non-standard libraries like
  2887.     dos.library.  Here you must manually Forbid(), preserve all 6
  2888.     original bytes, set the new vector, SumLibrary(), then Permit().
  2889.  
  2890.    INPUTS
  2891.     library    - a pointer to the library to be changed
  2892.     funcOffset - the offset of the function to be replaced
  2893.     funcEntry  - pointer to new function
  2894.  
  2895.    RESULTS
  2896.     oldFunc    - pointer to the old function that was just replaced
  2897.  
  2898. exec.library/SetIntVector                  exec.library/SetIntVector
  2899.  
  2900.    NAME
  2901.     SetIntVector -- set a system interrupt vector
  2902.  
  2903.    SYNOPSIS
  2904.     oldInterrupt = SetIntVector(intNumber, interrupt)
  2905.     D0                D0-0:4     A1
  2906.     struct Interrupt *SetIntVector(ULONG, struct Interrupt *);
  2907.  
  2908.    FUNCTION
  2909.     This function provides a mechanism for setting the system interrupt
  2910.     vectors.  These are non-sharable, setting something here
  2911.     disconnects the old handler.
  2912.  
  2913.     Both the code and data pointers of the vector are set to the new
  2914.     values.  A pointer to the old interrupt structure is returned. When
  2915.     the system calls the specified interrupt code the registers are
  2916.     setup as follows:
  2917.  
  2918.         D0 - scratch
  2919.         D1 - scratch (on entry: active portia
  2920.               interrupts -> equals INTENA & INTREQ)
  2921.  
  2922.         A0 - scratch (on entry: pointer to base of custom chips
  2923.               for fast indexing)
  2924.         A1 - scratch (on entry: interrupt's is_Data pointer)
  2925.  
  2926.         A5 - jump vector register (scratch on call)
  2927.         A6 - Exec library base pointer (scratch on call)
  2928.  
  2929.         all other registers - must be preserved
  2930.  
  2931.    INPUTS
  2932.     intNum - the Portia interrupt bit number (0..14)
  2933.     interrupt - a pointer to an Interrupt structure containing
  2934.         the handler's entry point and data segment pointer. It is a
  2935.         good idea to give the node a name so that other users may
  2936.         identify who currently has control of the interrupt.
  2937.  
  2938.    RESULT
  2939.     A pointer to the prior interrupt node which had control
  2940.     of this interrupt.
  2941.  
  2942.    SEE ALSO
  2943.     SetIntHandler, exec/interrupts.h, exec/hardware.h
  2944.  
  2945.  
  2946. exec.library/SetSignal                       exec.library/SetSignal
  2947.  
  2948.    NAME
  2949.     SetSignal -- define the state of this task's signals
  2950.  
  2951.    SYNOPSIS
  2952.     oldSignals = SetSignal(newSignals, signalMask)
  2953.     D0               D0       D1
  2954.     ULONG SetSignal(ULONG,ULONG);
  2955.  
  2956.    FUNCTION
  2957.     This function defines the states of the task's signals.
  2958.     Setting the state of signals is considered dangerous.
  2959.     Reading the state of signals is safe.
  2960.  
  2961.    INPUTS
  2962.     newSignals - the new values for the signals specified in
  2963.              signalSet.
  2964.     signalMask - the set of signals to be affected
  2965.  
  2966.    RESULTS
  2967.     oldSignals - the prior values for all signals
  2968.  
  2969.    EXAMPLES
  2970.     Get the current state of all signals:
  2971.         SetSignal(0,0);
  2972.     Clear all signals:
  2973.         SetSignal(0,0xFFFFFFFFL);
  2974.     Clear the CTRL-C signal:
  2975.         SetSignal(0,SIGBREAKF_CTRL_C);
  2976.  
  2977.  
  2978.     Check if the CTRL-C signal was pressed:
  2979.  
  2980.         #include "libraries/dos.h"
  2981.  
  2982.         if(SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  2983.         printf("CTRL-C pressed!\n");
  2984.  
  2985.    SEE ALSO
  2986.     Signal, Wait
  2987.  
  2988.  
  2989. exec.library/SetSR                      exec.library/SetSR
  2990.  
  2991.    NAME
  2992.     SetSR -- get and/or set processor status register
  2993.  
  2994.    SYNOPSIS
  2995.     oldSR = SetSR(newSR, mask)
  2996.     D0          D0     D1
  2997.     ULONG SetSR(ULONG, ULONG);
  2998.  
  2999.    FUNCTION
  3000.     This function provides a means of modifying the CPU status register
  3001.     in a "safe" way (well, how safe can a function like this be
  3002.     anyway?).  This function will only affect the status register bits
  3003.     specified in the mask parameter.  The prior content of the entire
  3004.     status register is returned.
  3005.  
  3006.    INPUTS
  3007.     newSR - new values for bits specified in the mask.
  3008.         All other bits are not effected.
  3009.     mask - bits to be changed
  3010.  
  3011.    RESULTS
  3012.     oldSR - the entire status register before new bits
  3013.  
  3014.    EXAMPLES
  3015.     To get the current SR:
  3016.         currentSR = SetSR(0,0);
  3017.     To change the processor interrupt level to 3:
  3018.         oldSR = SetSR($0300,$0700);
  3019.     Set processor interrupts back to prior level:
  3020.         SetSR(oldSR,$0700);
  3021.  
  3022. exec.library/SetTaskPri                  exec.library/SetTaskPri
  3023.  
  3024.    NAME
  3025.     SetTaskPri -- get and set the priority of a task
  3026.  
  3027.    SYNOPSIS
  3028.     oldPriority = SetTaskPri(task, priority)
  3029.     D0-0:8             A1    D0-0:8
  3030.     BYTE SetTaskPri(struct Task *,LONG);
  3031.  
  3032.    FUNCTION
  3033.     This function changes the priority of a task regardless of its
  3034.     state.    The old priority of the task is returned.  A reschedule is
  3035.     performed, and a context switch may result.
  3036.  
  3037.     To change the priority of the currently running task, pass the
  3038.     result of FindTask(0); as the task pointer.
  3039.  
  3040.    INPUTS
  3041.     task - task to be affected
  3042.     priority - the new priority for the task
  3043.  
  3044.    RESULT
  3045.     oldPriority - the tasks previous priority
  3046.  
  3047.  
  3048. exec.library/Signal                     exec.library/Signal
  3049.  
  3050.    NAME
  3051.     Signal -- signal a task
  3052.  
  3053.    SYNOPSIS
  3054.     Signal(task, signals)
  3055.            A1    D0
  3056.     void Signal(struct Task *,ULONG);
  3057.  
  3058.    FUNCTION
  3059.     This function signals a task with the given signals.  If the task
  3060.     is currently waiting for one or more of these signals, it will be
  3061.     made ready and a reschedule will occur. If the task is not waiting
  3062.     for any of these signals, the signals will be posted to the task
  3063.     for possible later use. A signal may be sent to a task regardless
  3064.     of whether its running, ready, or waiting.
  3065.  
  3066.     This function is considered "low level".  Its main purpose is to
  3067.     support multiple higher level functions like PutMsg.
  3068.  
  3069.     This function is safe to call from interrupts.
  3070.  
  3071.    INPUT
  3072.     task - the task to be signalled
  3073.     signals - the signals to be sent
  3074.  
  3075.    SEE ALSO
  3076.     Wait, SetSignal
  3077.  
  3078. exec.library/SumKickData                exec.library/SumKickData
  3079.  
  3080.    NAME
  3081.     SumKickData -- compute the checksum for the Kickstart delta list
  3082.  
  3083.    SYNOPSIS
  3084.     void SumKickData(void)
  3085.  
  3086.    FUNCTION
  3087.     The Amiga system has some ROM (or Kickstart) resident code that
  3088.     provides the basic functions for the machine.  This code is
  3089.     unchangeable by the system software.  This routine is part of a
  3090.     support system to modify parts of the ROM.
  3091.  
  3092.     The ROM code is linked together at run time via ROM-tags (also known
  3093.     as Resident structures, defined in exec/resident.h).  These tags tell
  3094.     Exec's low level boot code what subsystems exist in which regions of
  3095.     memory.  The current list of ROM-tags is contained in the ResModules
  3096.     field of ExecBase.  By default this list contains any ROM-tags found
  3097.     in the address ranges $FC0000-$FFFFFF and $F00000-$F7FFFF.
  3098.  
  3099.     There is also a facility to selectively add or replace modules to the
  3100.     ROM-tag list.  These modules can exist in RAM, and the memory they
  3101.     occupy will be deleted from the memory free list during the boot
  3102.     process.  SumKickData() plays an important role in this run-time
  3103.     modification of the ROM-tag array.
  3104.  
  3105.     Three variables in ExecBase are used in changing the ROM-tag array:
  3106.     KickMemPtr, KickTagPtr, and KickCheckSum. KickMemPtr points to a
  3107.     linked list of MemEntry structures. The memory that these MemEntry
  3108.     structures reference will be allocated (via AllocAbs) at boot time.
  3109.     The MemEntry structure itself must also be in the list.
  3110.  
  3111.     KickTagPtr points to a long-word array of the same format as the
  3112.     ResModules array.  The array has a series of pointers to ROM-tag
  3113.     structures.  The array is either null terminated, or will have an
  3114.     entry with the most significant bit (bit 31) set.  The most
  3115.     significant bit being set says that this is a link to another
  3116.     long-word array of ROM-tag entries.  This new array's address can be
  3117.     found by clearing bit 31.
  3118.  
  3119.     KickCheckSum has the result of SumKickData().  It is the checksum of
  3120.     both the KickMemPtr structure and the KickTagPtr arrays.  If the
  3121.     checksum does not compute correctly then both KickMemPtr and
  3122.     KickTagPtr will be ignored.
  3123.  
  3124.     If all the memory referenced by KickMemPtr can't be allocated then
  3125.     KickTagPtr will be ignored.
  3126.  
  3127.     There is one more important caveat about adding ROM-tags. All this
  3128.     ROM-tag magic is run very early on in the system -- before expansion
  3129.     memory is added to the system. Therefore any memory in this
  3130.     additional ROM-tag area must be addressable at this time. This means
  3131.     that your ROM-tag code, MemEntry structures, and resident arrays
  3132.     cannot be in expansion memory.  There are two regions of memory that
  3133.     are acceptable:  one is chip memory, and the other is "Ranger" memory
  3134.     (memory in the range between $C00000-$D80000).
  3135.  
  3136.     Remember that changing an existing ROM-tag entry falls into the
  3137.     "heavy magic" category -- be very careful when doing it.  The odd are
  3138.     that you will blow yourself out of the water.
  3139.  
  3140.    NOTE
  3141.     SumKickData was introduced in the 1.2 release
  3142.  
  3143.    SEE ALSO
  3144.     InitResident, FindResident
  3145.  
  3146. exec.library/SumLibrary                  exec.library/SumLibrary
  3147.  
  3148.    NAME
  3149.     SumLibrary -- compute and check the checksum on a library
  3150.  
  3151.    SYNOPSIS
  3152.     SumLibrary(library)
  3153.            A1
  3154.     void SumLibrary(struct Library *);
  3155.  
  3156.    FUNCTION
  3157.     SumLibrary computes a new checksum on a library.  It can also be
  3158.     used to check an old checksum.    If an old checksum does not match,
  3159.     and the library has not been marked as changed, then the system
  3160.     will call Alert().
  3161.  
  3162.     This call could also be periodically made by some future
  3163.     system-checking task.
  3164.  
  3165.    INPUTS
  3166.     library - a pointer to the library to be changed
  3167.  
  3168.    NOTE
  3169.     An alert will occur if the checksum fails.
  3170.  
  3171.    SEE ALSO
  3172.     SetFunction
  3173.  
  3174.  
  3175. exec.library/SuperState                  exec.library/SuperState
  3176.  
  3177.    NAME
  3178.     SuperState -- enter supervisor state with user stack
  3179.  
  3180.    SYNOPSIS
  3181.     oldSysStack = SuperState()
  3182.     D0
  3183.     APTR SuperState(void);
  3184.  
  3185.    FUNCTION
  3186.     Enter supervisor mode while running on the user's stack. The user
  3187.     still has access to user stack variables.  Be careful though, the
  3188.     user stack must be large enough to accommodate space for all
  3189.     interrupt data -- this includes all possible nesting of interrupts.
  3190.     This function does nothing when called from supervisor state.
  3191.  
  3192.    RESULTS
  3193.     oldSysStack - system stack pointer; save this.    It will come in
  3194.               handy when you return to user state.  If the system
  3195.               is already in supervisor mode, oldSysStack is zero.
  3196.  
  3197.    SEE ALSO
  3198.     UserState
  3199.  
  3200.  
  3201. exec.library/TypeOfMem                     exec.library/TypeOfMem
  3202.  
  3203.    NAME
  3204.     TypeOfMem -- determine attributes of a given memory address
  3205.  
  3206.    SYNOPSIS
  3207.     attributes = TypeOfMem(address)
  3208.     D0               A1
  3209.     ULONG TypeOfMem(void *);
  3210.  
  3211.    FUNCTION
  3212.     Given a RAM memory address, search the system memory lists and
  3213.     return its memory attributes.  The memory attributes are similar to
  3214.     those specified when the memory was first allocated: (eg. MEMF_CHIP
  3215.     and MEMF_FAST).
  3216.  
  3217.     This function is usually used to determine if a particular block of
  3218.     memory is within CHIP space.
  3219.  
  3220.     If the address is not in known-space, a zero will be returned.
  3221.     (Anything that is not RAM, like the ROM or expansion area, will
  3222.     return zero.  Also the first few bytes of a memory area are used up
  3223.     by the MemHeader.)
  3224.  
  3225.    INPUT
  3226.     address - a memory address
  3227.  
  3228.    RESULT
  3229.     attributes - a long word of memory attribute flags.
  3230.     If the address is not in known RAM, zero is returned.
  3231.  
  3232.    SEE ALSO
  3233.     AllocMem()
  3234.  
  3235.  
  3236. exec.library/UserState                      exec.library/UserState
  3237.  
  3238.    NAME
  3239.     UserState -- return to user state with user stack
  3240.  
  3241.    SYNOPSIS
  3242.     UserState(sysStack)
  3243.           D0
  3244.     void UserState(APTR);
  3245.  
  3246.    FUNCTION
  3247.     Return to user state with user stack, from supervisor state with
  3248.     user stack.  This function is normally used in conjunction with the
  3249.     SuperState function above.
  3250.  
  3251.     This function must not be called from the user state.
  3252.  
  3253.    INPUT
  3254.     sysStack - supervisor stack pointer
  3255.  
  3256.    BUGS
  3257.     This function is broken in V33 and V34 Kickstart.
  3258.  
  3259.    SEE ALSO
  3260.     SuperState
  3261.  
  3262. exec.library/Vacate                     exec.library/Vacate
  3263.  
  3264.    NAME
  3265.     Vacate -- release a message lock (semaphore)
  3266.  
  3267.    SYNOPSIS
  3268.     Vacate(semaphore)
  3269.            A0
  3270.     void Vacate(struct Semaphore *);
  3271.  
  3272.    FUNCTION
  3273.     This function releases a previously locked semaphore (see
  3274.     the Procure() function).
  3275.     If another task is waiting for the semaphore, its bidMessage
  3276.     will be sent to its reply port.
  3277.  
  3278.    INPUT
  3279.     semaphore - the semaport message port representing the
  3280.     semaphore to be freed.
  3281.  
  3282.    BUGS
  3283.     Procure() and Vacate() do not have proven reliability.
  3284.  
  3285.    SEE ALSO
  3286.     Procure
  3287.  
  3288.  
  3289. exec.library/Wait                       exec.library/Wait
  3290.  
  3291.    NAME
  3292.     Wait -- wait for one or more signals
  3293.  
  3294.    SYNOPSIS
  3295.     signals = Wait(signalSet)
  3296.     D0           D0
  3297.     ULONG Wait(ULONG);
  3298.  
  3299.    FUNCTION
  3300.     This function will cause the current task to suspend waiting for
  3301.     one or more signals.  When one or more of the specified signals
  3302.     occurs, the task will return to the ready state, and those signals
  3303.     will be cleared.
  3304.  
  3305.     If a signal occurred prior to calling Wait, the wait condition will
  3306.     be immediately satisfied, and the task will continue to run without
  3307.     delay.
  3308.  
  3309.    CAUTION
  3310.     This function cannot be called while in supervisor mode or
  3311.     interrupts!  This function will break the action of a Forbid() or
  3312.     Disable() call.
  3313.  
  3314.    INPUT
  3315.     signalSet - The set of signals for which to wait.
  3316.             Each bit represents a particular signal.
  3317.  
  3318.    RESULTS
  3319.     signals - the set of signals that were active
  3320.  
  3321. exec.library/WaitIO                     exec.library/WaitIO
  3322.  
  3323.    NAME
  3324.     WaitIO -- wait for completion of an I/O request
  3325.  
  3326.    SYNOPSIS
  3327.     error = WaitIO(iORequest)
  3328.     D0           A1
  3329.     BYTE WaitIO(struct IORequest *);
  3330.  
  3331.    FUNCTION
  3332.     This function waits for the specified I/O request to complete, then
  3333.     removes it from the replyport.    If the I/O has already completed,
  3334.     this function will return immediately.
  3335.  
  3336.     This function should be used with care, as it does not return until
  3337.     the I/O request completes; if the I/O never completes, this
  3338.     function will never return, and your task will hang.  If this
  3339.     situation is a possibility, it is safer to use the Wait() function.
  3340.     Wait() will return return when any of a specified set of signal is
  3341.     received.  This is how I/O timeouts can be properly handled.
  3342.  
  3343.    WARNING
  3344.     If this IORequest was "Quick" or otherwise finished BEFORE this
  3345.     call, this function drops though immediately, with no call to
  3346.     Wait().  A side effect is that the signal bit related the port may
  3347.     remain set.  Expect this.
  3348.  
  3349.    INPUTS
  3350.     iORequest - pointer to an I/O request block
  3351.  
  3352.    RESULTS
  3353.     error - zero if successful, else an error is returned
  3354.         (a sign extended copy of io_Error).
  3355.  
  3356.    SEE ALSO
  3357.     DoIO, SendIO, CheckIO, AbortIO
  3358.  
  3359. exec.library/WaitPort                       exec.library/WaitPort
  3360.  
  3361.    NAME
  3362.     WaitPort -- wait for a given port to be non-empty
  3363.  
  3364.    SYNOPSIS
  3365.     message = WaitPort(port)
  3366.     D0           A0
  3367.     struct Message *WaitPort(struct MsgPort *);
  3368.  
  3369.    FUNCTION
  3370.     This function waits for the given port to become non-empty.  If
  3371.     necessary, the Wait function will be called to wait for the port
  3372.     signal.  If a message is already present at the port, this function
  3373.     will return immediately.  The return value is always a pointer to
  3374.     the first message queued (but it is not removed from the queue).
  3375.  
  3376.    CAUTION
  3377.     More than one message may be at the port when this returns.  It is
  3378.     proper to call the GetMsg() function in a loop until all messages
  3379.     have been handled, then wait for more to arrive.
  3380.  
  3381.     To wait for more than one port, combine the signal bits from each
  3382.     port into one call to the Wait() function, then use a GetMsg() loop
  3383.     to collect any and all messages.  It is possible to get a signal
  3384.     for a port WITHOUT a message showing up.  Plan for this.
  3385.  
  3386.    INPUT
  3387.     port - a pointer to the message port
  3388.  
  3389.    RETURN
  3390.     message - a pointer to the first available message
  3391.  
  3392.    SEE ALSO
  3393.     GetMsg
  3394.  
  3395.