home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Text_Autodocs / amiga.lib.doc next >
Encoding:
Text File  |  1992-09-12  |  19.4 KB  |  660 lines

  1.  
  2.  
  3. TABLE OF CONTENTS
  4.  
  5. amiga.lib/AddTOF
  6. amiga.lib/BeginIO
  7. amiga.lib/CreateExtIO
  8. amiga.lib/CreatePort
  9. amiga.lib/CreateTask
  10. amiga.lib/DeleteExtIO
  11. amiga.lib/DeletePort
  12. amiga.lib/DeleteTask
  13. amiga.lib/FastRand
  14. amiga.lib/math/afp
  15. amiga.lib/math/arnd
  16. amiga.lib/math/dbf
  17. amiga.lib/math/fpa
  18. amiga.lib/math/fpbcd
  19. amiga.lib/NewList
  20. amiga.lib/printf
  21. amiga.lib/RangeRand
  22. amiga.lib/RemTOF
  23. amiga.lib/sprintf
  24. amiga.lib/stdio
  25.  
  26.  
  27. amiga.lib/AddTOF                                               amiga.lib/AddTOF
  28.  
  29.    NAME
  30.        AddTOF - add a task to the TopOfFrame Interrupt server chain.
  31.  
  32.    SYNOPSIS
  33.        AddTOF(i,p,a);
  34.     void AddTOF(struct Isrvstr *, APTR, APTR);
  35.  
  36.    FUNCTION
  37.        Adds a task to the vertical-blanking interval interrupt server
  38.        chain.  This prevents C programmers from needing to write an
  39.        assembly language stub to do this function.
  40.  
  41.    INPUTS
  42.        i - pointer to structure Isrvstr.
  43.        p - pointer to the C-code routine that this server is to call each
  44.            time TOF happens.
  45.        a - pointer to the first longword in an array of longwords that
  46.            is to be used as the arguments passed to your routine
  47.            pointed to by p.
  48.  
  49.    SEE ALSO
  50.        RemTOF, graphics/graphint.h
  51.  
  52. amiga.lib/BeginIO                                             amiga.lib/BeginIO
  53.  
  54.    NAME
  55.     BeginIO -- initiate asynchronous I/O
  56.  
  57.    SYNOPSIS
  58.     BeginIO(iORequest)
  59.     void BeginIO(struct IORequest *);
  60.  
  61.    FUNCTION
  62.     This function takes an IORequest, and passes it directly to the
  63.     BEGINIO vector of the proper device.  This works exactly like
  64.     SendIO, but does not clear the io_Flags field first.
  65.  
  66.     This function does not wait for the I/O to complete.
  67.  
  68.    INPUTS
  69.     iORequest - Pointer to an initialized, open IORequest structure
  70.             with the io_Flags field set to a reasonable value
  71.             (use zero if you do not require io_Flags).
  72.  
  73.    SEE ALSO
  74.     exec/DoIO, exec/SendIO, exec/WaitIO  
  75.  
  76.  
  77. amiga.lib/CreateExtIO                                     amiga.lib/CreateExtIO
  78.  
  79.    NAME    
  80.     CreateExtIO() -- create an IORequest structure
  81.  
  82.    SYNOPSIS
  83.     ioReq = CreateExtIO( ioReplyPort, size );
  84.     struct IORequest *CreateExtIO(struct MsgPort *, ULONG);
  85.  
  86.    FUNCTION
  87.     Allocates memory for and initializes a new IO request block
  88.     of a user-specified number of bytes.  The number of bytes
  89.     MUST be the size of a legal IORequest (or extended IORequest)
  90.     or very nasty things will happen.
  91.  
  92.    INPUTS
  93.     ioReplyPort - a pointer to an already initialized
  94.         message port to be used for this IO request's reply port.
  95.         (usually created by CreatePort()).
  96.     size - the size of the IO request to be created.
  97.  
  98.    RESULT
  99.     Returns a pointer to the new IO Request block, or NULL if
  100.         the request failed.
  101.  
  102.    SEE ALSO
  103.     CreatePort, DeleteExtIO
  104.     CreateIORequest
  105.  
  106.  
  107. amiga.lib/CreatePort                                       amiga.lib/CreatePort
  108.  
  109.    NAME
  110.     CreatePort - Allocate and initialize a new message port
  111.  
  112.    SYNOPSIS
  113.     CreatePort(name,pri)
  114.     struct MsgPort *CreatePort(char *,LONG);
  115.  
  116.    FUNCTION
  117.     Allocates and initializes a new message port.  The message list
  118.     of the new port will be prepared for use (via NewList).  The port
  119.     will be set to signal your task when a message arrives (PA_SIGNAL).
  120.  
  121.    INPUTS
  122.     name - NULL if other tasks will not search for this port
  123.         via the FindPort() call.  If non-null, this must be
  124.         a null-terminated string; the port will be added to
  125.         the system public port list.  The name is not copied.
  126.     pri  - Priority used for insertion into the public port list. 
  127.  
  128.    RESULT
  129.     A new MsgPort structure ready for use.
  130.  
  131.    SEE ALSO
  132.     DeletePort, exec/FindPort, exec/ports.h
  133.  
  134.  
  135. amiga.lib/CreateTask                                       amiga.lib/CreateTask
  136.  
  137.    NAME
  138.     CreateTask -- Create task with given name, priority, stacksize
  139.  
  140.    SYNOPSIS
  141.     CreateTask( name, pri, initPC, stackSize)
  142.     task=(struct Task *)CreateTask(char *, LONG, funcEntry, ULONG);
  143.  
  144.    FUNCTION
  145.     This function simplifies program creation of subtasks by
  146.     dynamically allocating and initializing required structures
  147.     and stack space, and adding the task to Exec's task list
  148.     with the given name and priority.  A tc_MemEntry list is provided
  149.     so that all stack and structure memory allocated by CreateTask
  150.     is automatically deallocated when the task is removed.
  151.  
  152.     An Exec task may not call dos.library functions or any function
  153.     which might cause the loading of a disk-resident library, device,
  154.     or file (since such functions are indirectly calls to dos.library).
  155.     Only AmigaDOS Processes may call AmigaDOS; see the DOS CreateProc()
  156.     call for more information.
  157.  
  158.     If other tasks or processes will need to find this task by name,
  159.     provide a complex and unique name to avoid conflicts.
  160.  
  161.     If your compiler provides automatic insertion of stack-checking
  162.     code, you may need to disable this feature when compiling subtask 
  163.     code since the stack for the subtask is at a dynamically allocated
  164.     location.  If your compiler requires 68000 registers to contain 
  165.     particular values for base relative addressing, you may need to
  166.     save these registers from your main process, and restore them
  167.     in your initial subtask code.
  168.  
  169.     The function entry initPC is generally provided as follows:
  170.  
  171.     In C:
  172.     extern void functionName();
  173.     char *tname = "unique name";
  174.     task = CreateTask(tname, 0L, functionName, 4000L);
  175.  
  176.     In assembler:
  177.         PEA    startLabel
  178.     
  179.    INPUTS
  180.  
  181.     name - a null terminated string.
  182.     pri - an Exec task priority between -128 and 127 (commonly 0)
  183.     funcEntry - the address of the first executable instruction
  184.                 of the subtask code.
  185.     stackSize - size in bytes of stack for the subtask.  Don't cut it
  186.             too close - system function stack usage may change.
  187.  
  188.    SEE ALSO
  189.     DeleteTask, exec/FindTask
  190.  
  191.  
  192. amiga.lib/DeleteExtIO                                     amiga.lib/DeleteExtIO
  193.  
  194.    NAME
  195.     DeleteExtIO() - return memory allocated for extended IO request
  196.  
  197.    SYNOPSIS
  198.     DeleteExtIO( ioReq );
  199.     void DeleteExtIO(struct IORequest *);
  200.  
  201.    FUNCTION
  202.     Frees up an IO request as allocated by CreateExtIO().  By
  203.     looking at the mn_Length field, it knows how much memory
  204.     to deallocate.
  205.  
  206.    INPUTS
  207.     ioReq - A pointer to the IORequest block to be freed.
  208.  
  209.    SEE ALSO
  210.     CreateExtIO
  211.  
  212.  
  213. amiga.lib/DeletePort                                       amiga.lib/DeletePort
  214.  
  215.    NAME
  216.     DeletePort - Free a message port created by CreatePort
  217.  
  218.    SYNOPSIS
  219.     DeletePort(msgPort)
  220.     void DeletePort(struct MsgPort *);
  221.  
  222.    FUNCTION
  223.     Frees a message port created by CreatePort.  All messages that
  224.     may have been attached to this port must have already been
  225.     replied to.
  226.  
  227.    INPUTS
  228.     msgPort - A message port
  229.  
  230.    SEE ALSO
  231.     CreatePort
  232.  
  233.  
  234. amiga.lib/DeleteTask                                       amiga.lib/DeleteTask
  235.  
  236.    NAME
  237.     DeleteTask -- Delete a task created with CreateTask
  238.  
  239.    SYNOPSIS
  240.     DeleteTask( task )
  241.     void DeleteTask(struct Task *);
  242.  
  243.    FUNCTION
  244.     This function simply calls exec/RemTask, deleting a task from the
  245.     Exec task lists and automatically freeing any stack and
  246.     structure memory allocated for it by CreateTask.
  247.  
  248.     Before deleting a task, you must first make sure that the task is
  249.     not currently executing any system code which might try to signal
  250.     the task after it is gone.
  251.  
  252.     This can be accomplished by stopping all sources that might reference
  253.     the doomed task, then causing the subtask execute a Wait(0L).  Another
  254.     option is to have have the task DeleteTask()/RemTask() itself.
  255.  
  256.    INPUTS
  257.     task - pointer to a Task
  258.  
  259.    SEE ALSO
  260.     CreateTask, exec/RemTask
  261.  
  262. amiga.lib/FastRand                                           amiga.lib/FastRand
  263.  
  264.    NAME
  265.        FastRand - quickly generate a somewhat random integer
  266.  
  267.    SYNOPSIS
  268.        number = FastRand(seed);
  269.     ULONG FastRand(ULONG);
  270.  
  271.    FUNCTION
  272.        C-implementation only.   Seed value is taken from stack, shifted
  273.        left one position, exclusive-or'ed with hex value $1D872B41 and
  274.        returned (D0).
  275.  
  276.    INPUTS
  277.        seed - a 32-bit integer
  278.  
  279.    RESULT
  280.        number - new random seed, a 32-bit value
  281.  
  282.    SEE ALSO
  283.        RangeRand
  284.  
  285.  
  286. amiga.lib/math/afp                                           amiga.lib/math/afp
  287.  
  288.    NAME
  289.     afp - Convert ASCII string variable into fast floating point
  290.  
  291.    USAGE
  292.        ffp_value = afp(string);
  293.  
  294.     FUNCTION
  295.     Accepts the address of the ASCII string in C format that is
  296.     converted into an FFP floating point number.
  297.     
  298.     The string is expected in this Format:
  299.     {S}{digits}{'.'}{digits}{'E'}{S}{digits}
  300.     <*******MANTISSA*******><***EXPONENT***>
  301.     
  302.     
  303.     Syntax rules:
  304.     Both signs are optional and are '+' or '-'. The mantissa must be
  305.     present. The exponent need not be present. The mantissa may lead
  306.     with a decimal point. The mantissa need not have a decimal point.
  307.     Examples: All of these values represent the number fourty-two.
  308.                  42            .042e3
  309.                  42.          +.042e+03
  310.                 +42.          0.000042e6
  311.             0000042.00       420000e-4
  312.                          420000.00e-0004
  313.     
  314.     Floating point range:
  315.     Fast floating point supports the value zero and non-zero values
  316.     within the following bounds -
  317.                     18                             20
  318.      9.22337177 x 10   > +number >  5.42101070 x 10
  319.                     18                             -20
  320.     -9.22337177 x 10   > -number > -2.71050535 x 10
  321.      
  322.     Precision:
  323.     This conversion results in a 24 bit precision with guaranteed
  324.     error less than or equal to one-half least significant bit.
  325.      
  326.     INPUTS
  327.     string - Pointer to the ASCII string to be converted.
  328.      
  329.      
  330.     OUTPUTS
  331.     string - points to the character which terminated the scan
  332.     equ - fast floating point equivalent
  333.  
  334. amiga.lib/math/arnd                                         amiga.lib/math/arnd
  335.  
  336.   NAME
  337.     arnd - ASCII round of the provided floating point string
  338.  
  339.    USAGE
  340.     arnd(place, exp, &string[0]);
  341.  
  342.    FUNCTION
  343.     Accepts an ASCII string representing an FFP floating point
  344.     number, the binary representation of the exponent of said
  345.     floating point number and the number of places to round to.
  346.     A rounding process is initiated, either to the left or right
  347.     of the decimal place and the result placed back at the
  348.     input address defined by &string[0].
  349.  
  350.    INPUTS
  351.     place - integer representing number of decimal places to round to
  352.     exp - integer representing exponent value of the ASCII string
  353.     &string[0] - address where rounded ASCII string is to be placed
  354.              (16 bytes)
  355.  
  356.    RESULT
  357.     &string[0] - rounded ASCII string
  358.  
  359.    BUGS
  360.     None
  361.  
  362. amiga.lib/math/dbf                                           amiga.lib/math/dbf
  363.  
  364.    NAME
  365.     dbf - convert FFP dual-binary number to FFP format
  366.  
  367.    USAGE
  368.     fnum = dbf(exp, mant);
  369.  
  370.    FUNCTION
  371.     Accepts a dual-binary format (described below) floating point
  372.     number and converts it to an FFP format floating point number.
  373.     The dual-binary format is defined as:
  374.  
  375.         exp bit  16     = sign (0=>positive, 1=>negative)
  376.         exp bits 15-0   = binary integer representing the base
  377.                       ten (10) exponent
  378.         man             = binary integer mantissa
  379.  
  380.    INPUTS
  381.     exp - binary integer representing sign and exponent
  382.     mant - binary integer representing the mantissa
  383.  
  384.    RESULT
  385.     fnum - converted FFP floating point format number
  386.  
  387.    BUGS
  388.     None
  389.  
  390. amiga.lib/math/fpa                                           amiga.lib/math/fpa
  391.  
  392.    NAME
  393.     fpa - convert fast floating point into ASCII string equivalent
  394.  
  395.    USAGE
  396.     exp = fpa(fnum, &string[0]);
  397.  
  398.    FUNCTION
  399.     Accepts an FFP number and the address of the ASCII string where it's
  400.     onverted output is to be stored.  The number is converted to a NULL
  401.     terminated ASCII string in and stored at the address provided.
  402.     Additionally, the base ten (10) exponent in binary form is returned.
  403.  
  404.    INPUTS
  405.     fnum       - Motorola Fast Floating Point number
  406.     &string[0] - address for output of converted ASCII character string
  407.              (16 bytes)
  408.  
  409.    RESULT
  410.     &string[0] - converted ASCII character string
  411.     exp        - integer exponent value in binary form
  412.  
  413.    BUGS
  414.     None
  415.  
  416. amiga.lib/math/fpbcd                                       amiga.lib/math/fpbcd
  417.  
  418.    NAME
  419.     fpbcd - convert FFP floating point number to BCD format
  420.  
  421.    USAGE
  422.     fpbcd(fnum, &string[0]);
  423.  
  424.    FUNCTION
  425.     Accepts a floating point number and the address where the
  426.     converted BCD data is to be stored.  The FFP number is
  427.     converted and stored at the specified address in an ASCII
  428.     form in accordance with the following format:
  429.  
  430.         MMMM S E S B
  431.  
  432.     Where:    M = Four bytes of BCD, each with two (2) digits of
  433.             the mantissa (8 digits)
  434.         S = Sign of mantissa (0x00 = positive, 0xFF = negative)
  435.         E = BCD byte for two (2) digit exponent
  436.         S = Sign of exponent (0x00 = positive, 0xFF = negative)
  437.         B = One (1) byte binary two's compliment representation
  438.             of the exponent
  439.  
  440.    INPUTS
  441.     fnum - floating point number
  442.     &string[0] - address where converted BCD data is to be placed
  443.  
  444.    RESULT
  445.     &string[0] - converted BCD data
  446.  
  447. amiga.lib/NewList                                             amiga.lib/NewList
  448.  
  449.    NAME
  450.     NewList -- prepare a list structure for use
  451.  
  452.    SYNOPSIS
  453.     NewList(list*)
  454.     void NewList(struct List *);
  455.  
  456.    FUNCTION
  457.     Prepare a List structure for use; the list will be empty and
  458.     ready to use.
  459.  
  460.     This function prepares the lh_Head, lh_Tail and lh_TailPred fields.
  461.     You are responsible for initializing lh_Type.  Assembly programmers
  462.     will want to use the NEWLIST macro instead.
  463.  
  464.    INPUTS
  465.     list - Pointer to a List
  466.  
  467.    SEE ALSO
  468.     exec/lists.h
  469.  
  470.  
  471. amiga.lib/printf                                               amiga.lib/printf
  472.  
  473.    NAME
  474.     printf - print a formatted output line to the standard output.
  475.  
  476.    SYNOPSIS
  477.     printf( formatstring [,value [,values] ] );
  478.  
  479.    FUNCTION
  480.     Format the output in accordance with specifications in the format
  481.     string:
  482.  
  483.    INPUTS
  484.     formatstring - a pointer to a null-terminated string describing the
  485.                       output data, and locations for parameter substitutions.
  486.     value(s) - numeric variables or addresses of null-terminated strings
  487.                   to be added to the format information.
  488.  
  489.     The function printf can handle the following format conversions, in
  490.     common with the normal C language call to printf:
  491.  
  492.         %c  - the next long word in the array is to be formatted
  493.               as a character (8-bit) value
  494.         %d  - the next long word in the array is to be formatted
  495.               as a decimal number
  496.         %x  - the next long word in the array is to be formatted
  497.               as a hexadecimal number
  498.         %s  - the next long word is the starting address of a
  499.               null-terminated string of characters
  500.  
  501.     And "l" (small-L) character must be added between the % and the letter
  502.     if the value is a long (32 bits) or if the compiler in use forces
  503.     passed paramters to 32 bits.
  504.  
  505.     Floating point output is not supported.
  506.  
  507.     Following the %, you may also specify:
  508.  
  509.     o       an optional minus (-) sign that tells the formatter
  510.             to left-justify the formatted item within the field
  511.             width
  512.  
  513.     o       an optional field-width specifier... that is, how
  514.             many spaces to allot for the full width of this
  515.             item.  If the field width specifier begins with
  516.             a zero (0), it means that leading spaces, ahead of
  517.             the formatted item (usually a number) are to be
  518.             zero-filled instead of blank-filled
  519.  
  520.     o       an optional period (.) that separates the width
  521.             specifier from a maximum number of characters
  522.             specifier
  523.  
  524.     o       an optional digit string (for %ls specifications
  525.             only) that specifies the maximum number of characters
  526.             to print from a string.
  527.  
  528.     See other books on C language programming for examples of the use
  529.     of these formatting options (see "printf" in other books).
  530.  
  531.    NOTE
  532.     The global "_stdout" must be defined, and contain a pointer to
  533.     a legal AmigaDOS file handle.  Using the standard Amiga startup
  534.     module sets this up.  In other cases you will need to define
  535.     stdout, and assign it to some reasonable value (like what the
  536.     AmigaDOS Output() call returns).  This code would set it up:
  537.  
  538.     ULONG stdout;
  539.         stdout=Output();
  540.  
  541. amiga.lib/RangeRand                                         amiga.lib/RangeRand
  542.  
  543.    NAME
  544.        RangeRand - To obtain a random number within a specific integer range
  545.                    of 0 to value.
  546.  
  547.    SYNOPSIS
  548.        number = RangeRand(value);
  549.  
  550.    FUNCTION
  551.        RangeRand accepts a value from 1 to 65535, and returns a value
  552.        within that range. (16-bit integer).  Note:  C-language implementation.
  553.  
  554.        Value is passed on stack as a 32-bit integer but used as though
  555.        it is only a 16-bit integer.  Variable named RangeSeed is available
  556.        beginning with V1.2 that contains the global seed value passed from
  557.        call to call and thus can be changed by a program by declaring::
  558.  
  559.                extern ULONG RangeSeed;
  560.  
  561.    INPUTS
  562.        value - integer in the range of 1 to 65535.
  563.  
  564.    RESULT
  565.        number - pseudo random integer in the range of 1 to <value>.
  566.  
  567.    SEE ALSO
  568.        FastRand
  569.  
  570. amiga.lib/RemTOF                                               amiga.lib/RemTOF
  571.  
  572.    NAME
  573.        RemTOF - Remove a task from the TopOfFrame interrupt server chain.
  574.  
  575.    SYNOPSIS
  576.        RemTOF(i);
  577.        void RemTOF(struct Isrvstr *);
  578.  
  579.    FUNCTION
  580.        To remove a task from the vertical-blanking interval interrupt server
  581.        chain.
  582.  
  583.    INPUTS
  584.        i - pointer to structure Isrvstr.
  585.  
  586.    SEE ALSO
  587.        AddTOF,graphics/graphinit.h
  588.  
  589.  
  590. amiga.lib/sprintf                                             amiga.lib/sprintf
  591.  
  592.    NAME
  593.        sprintf - format a C-like string into a string buffer
  594.  
  595.    SYNOPSIS
  596.        sprintf( destination, formatstring [,value [, values] ] );
  597.  
  598.    FUNCTION
  599.        perform string formatting identical to printf, but direct the output
  600.        into a specific destination in memory.  This uses the ROM version
  601.     of printf, so it is very small.
  602.  
  603.     Assembly programmers can call this by placing values on the
  604.     stack, followed by a pointer to the formatstring, followed
  605.     by a pointer to the destination string.
  606.  
  607.    INPUTS
  608.        destination - the address of an area in memory into which the
  609.                      formatted output is to be placed.
  610.        formatstring - pointer to a null terminated string describing the
  611.                       desired output formatting.
  612.        value(s) - numeric information to be formatted into the output
  613.                   stream.
  614.  
  615.    SEE ALSO
  616.        printf, exec/RawDoFmt
  617.  
  618.  
  619. amiga.lib/stdio                                                 amiga.lib/stdio
  620.  
  621.    NAMES
  622.     fclose    - close file
  623.     fgetc    - get a character from a file
  624.     fprintf    - format data to file (see exec.library/RawDoFmt)
  625.     fputc    - put character to file
  626.     fputs    - write string to file
  627.     getchar    - get a character from stdin
  628.     printf    - put format data to stdout (see exec.library/RawDoFmt)
  629.     putchar    - put character to stdout
  630.     puts    - put string to stdout, followed by newline
  631.     sprintf    - format data into string (see exec.library/RawDoFmt)
  632.  
  633.    FUNCTION
  634.     These functions work much like the standard C functions of the same
  635.     names.  The file I/O functions all use non-buffered AmigaDOS
  636.     filehandles, and must not be mixed with the file I/O of any C
  637.     compiler.  The names of these function match those found in many
  638.     standard C libraries, when a name conflict occurs, the function is
  639.     generally taken from the FIRST library that was specified on the
  640.     linker's command line.  Thus to use these functions, specify
  641.     the amiga.lib library first.
  642.  
  643.     To get a suitable AmigaDOS filehandle, the AmigaDOS Open()
  644.     function must be used.
  645.  
  646.     All of the functions that write to stdout expect an appropriate
  647.     filehandle to have been set up ahead of time.  Depending on
  648.     your C compiler and options, this may have been done by the
  649.     startup code.  Or it can be done manually:
  650.  
  651.    FROM C:
  652.     extern ULONG stdout;
  653.     /* Remove the extern if startup code did not define stdout */
  654.         stdout=Output();
  655.  
  656.    FROM ASSEMBLY:
  657.         XDEF    _stdout
  658.         DC.L    _stdout    ;<- Place result of dos.library Output() here.
  659.  
  660.