home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / os20 / util / ssl / sslib.doc < prev    next >
Encoding:
Text File  |  1993-12-21  |  42.5 KB  |  1,655 lines

  1.  
  2.  
  3.                             Special Support Library
  4.  
  5.                                   Version 3.0
  6.  
  7.                  (c) 1993 Martin Mares, MJSoft System Software
  8.  
  9. ================================================================================
  10.  
  11. STARTUP, EXIT & ERROR HANDLING:
  12.  
  13. StartupInit
  14. ExitCleanup
  15. ExitError
  16. DisplayError
  17. DosError
  18. ReportError
  19. TestBreak
  20.  
  21. MISCELLANEOUS ROUTINES:
  22.  
  23. ParseArgs
  24. Printf
  25. Puts
  26. PutsNL
  27. FormatStr
  28. StrCat
  29. StrToL
  30. SimpleRequest
  31.  
  32. GENERAL TRACKING ROUTINES:
  33.  
  34. CreateResList
  35. GetResList
  36. FreeResList
  37. FreeAllResLists
  38. TrackObject
  39. FreeObject
  40. TrackRoutine
  41. TrackExtd
  42. TrackSlave
  43.  
  44. SPECIAL TRACKING ROUTINES:
  45.  
  46. TrackAllocMem
  47. TrackAlloc
  48. TrackOpen
  49. TrackLock
  50. TrackPort
  51. TrackIoRq
  52. TrackSignal
  53. TrackDevice
  54. TrackLibrary
  55. TrackDosObject
  56.  
  57. I/O FUNCTIONS:
  58.  
  59. LoadFile
  60. ChkRead
  61. ChkWrite
  62. ChkDoIO
  63.  
  64. HASHING FUNCTIONS:
  65.  
  66. InitHashTree
  67. AddHashItem
  68. FindHashItem
  69.  
  70. FILENAME FUNCTIONS:
  71.  
  72. AddExtension
  73. SetExtension
  74. GetExtension
  75. RemExtension
  76.  
  77. POOLED ALLOCATION: (similar to pool management in exec V39, but faster and V37)
  78.  
  79. TrackPool
  80. PoolAlloc
  81. PoolFree
  82.  
  83. LINEAR POOLED ALLOCATION:
  84.  
  85. LinearAlloc
  86. LinearAllocN
  87. TrackLinPool
  88.  
  89. ================================================================================
  90.  
  91. SYNOPSIS
  92.  
  93.    AddExtension(A0=Name,A1=Buffer,A2=Extension,D0=BufSize)
  94.  
  95. FUNCTION
  96.  
  97.    Append filename extension if there isn't any.
  98.  
  99. INPUTS
  100.  
  101.    Name = original file name
  102.    Buffer = buffer to copy the name to (may be equal to Name)
  103.    Extension = extension to be added
  104.    BufSize = size of Buffer
  105.  
  106. RESULT
  107.  
  108.    TRUE if successful, FALSE if buffer overflow.
  109.  
  110. SEE ALSO
  111.  
  112.    SetExtension, GetExtension, RemExtension
  113.  
  114. --------------------------------------------------------------------------------
  115.  
  116. SYNOPSIS
  117.  
  118.    AddHashItem(A0=Tree,A1=ItemName,D0=DataSize)
  119.  
  120. FUNCTION
  121.  
  122.    Add an item to hashed tree performing no checking of duplicity (if you make
  123. duplicated entries, some of them will be lost = cannot be found by any method,
  124. but are correctly freed if you free the tree).
  125.  
  126.    The item contains your own data area of specified size.
  127.  
  128. INPUTS
  129.  
  130.    Tree = hashed tree represented by its tracker
  131.    ItemName = text key representing the item
  132.    DataSize = the size of your data area for the item (0-32766, must be even!)
  133.  
  134. RESULT
  135.  
  136.    Pointer to user data area of the item. This data area is preceeded by one word
  137. containing size of the area. The area is succeeded by key string.
  138.  
  139. SEE ALSO
  140.  
  141.    InitHashTree, FindHashItem, FreeObject
  142.  
  143. --------------------------------------------------------------------------------
  144.  
  145. SYNOPSIS
  146.  
  147.    ChkDoIO(A0=Message,A1=DeviceTracker)
  148.  
  149. FUNCTION
  150.  
  151.    This function acts like DoIO in exec.library, but is a bit different (these
  152. differences make it easier-to-use in programs, which use simple I/O):
  153.  
  154.      - IO_FLAGS are NOT set to $01 (DoIO does it, but ChkDoIO sets only the
  155.            IOB_QUICK bit). It makes ChkDoIO capable of handling I/O commands
  156.            requiring special information in flags.
  157.      - While waiting for finish of the operation, the user may hit CTRL-C
  158.        and try to abort it.
  159.      - If err_iofail and err_iofail2 bits are set, ChkDoIO does automatic
  160.        processing of I/O errors. In this case, it uses the error table stored
  161.        in DeviceTracker (see TrackDevice) and the custom error string:
  162.           (1) If error string has been found - "<Message> - <error string>"
  163.               err_iofail2 is used
  164.           (2) In other cases - "<Message> - <xxx.device> error <errcode>"
  165.               err_iofail is used
  166.  
  167. INPUTS
  168.  
  169.    Message - optional error message (if NULL => "I/O error" will be used)
  170.                !! it must contain reference to the error table (may be NULL) !!
  171.    DeviceTracker - tracker of device the I/O operation is being done with
  172.                (created by TrackDevice)
  173.  
  174. RESULT
  175.  
  176.    Error code or 0 if successful.
  177.  
  178. SEE ALSO
  179.  
  180.    TrackDevice, exec/DoIO
  181.  
  182. --------------------------------------------------------------------------------
  183.  
  184. SYNOPSIS
  185.  
  186.    ChkRead(A0=Tracker,A1=Buffer,D0=Size)
  187.  
  188. FUNCTION
  189.  
  190.    Read from file and report any errors. The file tracker is used instead of file
  191. handle, because it contains file name used for error report. The report is
  192. generated whenever the size of read data is not equal to the size specified
  193. as a parameter, therefore ChkRead cannot be used for reading from interactive
  194. files.
  195.  
  196.    Warning: file name specified by call to TrackFile must be still on its
  197.             place and mustn't be changed in any way.
  198.  
  199. INPUTS
  200.  
  201.    Tracker - tracker of source file
  202.  
  203. RESULT
  204.  
  205.    Boolean value indicating success.
  206.  
  207. SEE ALSO
  208.  
  209.    ChkWrite, TrackOpen, LoadFile
  210.  
  211. --------------------------------------------------------------------------------
  212.  
  213. SYNOPSIS
  214.  
  215.    ChkWrite(A0=Tracker,A1=Buffer,D0=Size)
  216.  
  217. FUNCTION
  218.  
  219.    Write to file and report any errors. The file tracker is used instead of file
  220. handle, because it contains file name used for error reports.
  221.  
  222.    Warning: file name specified by call to TrackFile must be still on its
  223.             place and mustn't be changed in any way.
  224.  
  225. INPUTS
  226.  
  227.    Tracker - tracker of destination file
  228.    Buffer - buffer containing data block to be written
  229.    Size - number of bytes (block size)
  230.  
  231. RESULT
  232.  
  233.    Boolean value indicating success.
  234.  
  235. SEE ALSO
  236.  
  237.    ChkRead, TrackOpen
  238.  
  239. --------------------------------------------------------------------------------
  240.  
  241. SYNOPSIS
  242.  
  243.    CreateResList()
  244.  
  245. FUNCTION
  246.  
  247.    Create local resource list.  It can be useful if you need to have local
  248. resources allocated in some part of program and freed after leaving it and if
  249. you don't want to free them separately using FreeObject().
  250.  
  251. RESULT
  252.  
  253.    Pointer to created ResourceList structure.
  254.  
  255. SEE ALSO
  256.  
  257.    FreeResList, FreeAllResLists
  258.  
  259. --------------------------------------------------------------------------------
  260.  
  261. SYNOPSIS
  262.  
  263.    DisplayError(A0=Text,A1=Params)
  264.  
  265. FUNCTION
  266.  
  267.    Display an error message using standard or user-supplied error displaying
  268. mechanism (it defaults to writing the message into standard output if it exists
  269. or to displaying a requester with it if started from WB with no console window).
  270. Using of requesters (equivalent to SimpleRequest(A0,A1,"Exit")) for the default
  271. error routine can be forced by the ssf_errorreq flag or the sst_errorreq tag.
  272.  
  273.    This function automatically adds an exclamation mark ('!') to the message
  274. and is able to process printf-style arguments.
  275.  
  276.    It's better if the error message isn't longer than one line.
  277.  
  278. INPUTS
  279.  
  280.    Text - pointer to message you want to display (MUSTN'T EXCEED 200 BYTES!!!)
  281.    Params - pointer to optional parameters used for printf-style formatting
  282.  
  283. SEE ALSO
  284.  
  285.    ExitError, DosError, ReportError, SimpleRequest
  286.  
  287. --------------------------------------------------------------------------------
  288.  
  289. SYNOPSIS
  290.  
  291.    DosError(A0=optional text,A1=Params)
  292.  
  293. FUNCTION
  294.  
  295.    Display an error message followed by DOS fault string explaining why the error
  296. has happened. The DOS error number is determined using the dos/IoErr() function,
  297. therefore you must call it directly after the function, which caused the error,
  298. without calling any other DOS functions (directly or indirectly).
  299.  
  300.    The program is terminated via standard exit mechanism with return code
  301. according to sv_errrc.
  302.  
  303.    If IoErr()=0 and Text<>0, ExitError(Text,Params) is called.
  304.    If IoErr()=0 and Text==0, ExitError("Unknown DOS Error") is called.
  305.  
  306. INPUTS
  307.  
  308.    Text - message text, can be empty (in this case, only the fault string is
  309.           shown)
  310.    Params - pointer to optional parameters used for printf-style formatting
  311.  
  312. NOTE
  313.  
  314.    A5 may contain incorrect value on entry. SSLib is able to find the correct
  315. pointer automatically.
  316.  
  317. SEE ALSO
  318.  
  319.    ExitCleanup, ExitError
  320.  
  321. --------------------------------------------------------------------------------
  322.  
  323. SYNOPSIS
  324.  
  325.    ExitCleanup()
  326.  
  327. FUNCTION
  328.  
  329.    This function performs standard cleanup actions and exit:
  330.  
  331.      - it tests, if A5 contains correct value. If it doesn't, the current task
  332.        is searched in the caller table. If it isn't found, the alert AN_ExitCrash
  333.        is displayed and the system is reset (this very fatal situation shouldn't
  334.        occur).
  335.      - the user's exit routine (sv_exitrout) is called.
  336.      - all tracked resources are freed using FreeAllResLists().
  337.      - all arguments supplied by DOS are freed.
  338.      - the A5-variables block is freed.
  339.      - ...
  340.      - program is terminated with return code sv_rc.
  341.  
  342. RESULT
  343.  
  344.    Completely clean environment (all objects can be recycled now...)
  345.  
  346. NOTE
  347.  
  348.    A5 may contain incorrect value on entry. SSLib is able to find the correct
  349. pointer automatically.
  350.  
  351. SEE ALSO
  352.  
  353.    StartupInit, ExitError
  354.  
  355. --------------------------------------------------------------------------------
  356.  
  357. SYNOPSIS
  358.  
  359.    ExitError(A0=Text,A1=Params)
  360.  
  361. FUNCTION
  362.  
  363.    Display an error message using DisplayError and exit the program with return
  364. code sv_errrc.
  365.  
  366.    It's better if the error message isn't longer than one line.
  367.  
  368. INPUTS
  369.  
  370.    Text - pointer to error message (MUSTN'T EXCEED 200 BYTES!!!)
  371.    Params - optional pointer for parameters used for printf-style formatting
  372.  
  373. RESULT
  374.  
  375.    Horrified user.
  376.  
  377. NOTE
  378.  
  379.    A5 may contain incorrect value on entry. SSLib is able to find the correct
  380. pointer automatically.
  381.  
  382. SEE ALSO
  383.  
  384.   DisplayError, ExitCleanup
  385.  
  386. --------------------------------------------------------------------------------
  387.  
  388. SYNOPSIS
  389.  
  390.    FindHashItem(A0=Tree,A1=ItemName)
  391.  
  392. FUNCTION
  393.  
  394.    Find an item in hashed tree. It's able to find only one occurence of given
  395. string.
  396.  
  397. INPUTS
  398.  
  399.    Tree = hashed tree represented by its tracker
  400.    ItemName = text key to find
  401.  
  402. RESULT
  403.  
  404.    Pointer to user data area of the item. (Additional fields reachable from
  405. this point are listed in AddHashItem doc).
  406.  
  407. SEE ALSO
  408.  
  409.    InitHashTree, AddHashItem, FreeObject
  410.  
  411. --------------------------------------------------------------------------------
  412.  
  413. SYNOPSIS
  414.  
  415.    FormatStr(A0=Format,A1=Data,A2=DestBuf)
  416.  
  417. FUNCTION
  418.  
  419.    This function performs something like sprintf() in C.  Calls exec/RawDoFmt
  420. with simple PutC routine, which stores all characters into supplied destination
  421. buffer.
  422.  
  423. INPUTS
  424.  
  425.    Format - pointer to format string
  426.    Data - pointer to parameters
  427.    DestBuf - pointer to destination buffer
  428.  
  429. --------------------------------------------------------------------------------
  430.  
  431. SYNOPSIS
  432.  
  433.    FreeAllResLists()
  434.  
  435. FUNCTION
  436.  
  437.    Free all tracked resources in all resource lists. Used by ExitCleanup().
  438.  
  439. --------------------------------------------------------------------------------
  440.  
  441. SYNOPSIS
  442.  
  443.    FreeObject(A0=tracker)
  444.  
  445. FUNCTION
  446.  
  447.    Free tracked object and remove the tracker. For master trackers, free all
  448. slave trackers.
  449.  
  450.    All trackers, which are not freed by calling of this service, will be
  451. freed during the ExitCleanup process. It will be done in reverse order that
  452. they have been tracked. Trackers connected as slaves will be handled as
  453. usually (see below).
  454.  
  455.    The freeing routines may fail. In this case, the resource freeing process
  456. will be started again and the tracker will be freed without calling the routine,
  457. which failed.
  458.  
  459.    The freeing routine for given tracker type is called only if the trk_data
  460. field is not 0. But the tracker itself is freed anyway.
  461.  
  462.    If you free a tracker, which is a slave of some other tracker, the
  463. tracked resource is correctly freed, but the tracker node remains in memory
  464. until freeing of master tracker.
  465.  
  466. INPUTS
  467.  
  468.    Tracker - pointer to object tracker (may be zero -> nothing happens)
  469.  
  470. SEE ALSO
  471.  
  472.    FreeResList, Track#?, FreeAllResLists, ExitCleanup
  473.  
  474. --------------------------------------------------------------------------------
  475.  
  476. SYNOPSIS
  477.  
  478.    FreeResList()
  479.  
  480. FUNCTION
  481.  
  482.    Free all tracked objects in the top-level resource list and remove the list.
  483. Used to free local resource lists.
  484.  
  485. SEE ALSO
  486.  
  487.    CreateResList, FreeAllResLists, FreeObject, Track#?, ExitCleanup
  488.  
  489. --------------------------------------------------------------------------------
  490.  
  491. SYNOPSIS
  492.  
  493.    GetExtension(A0=Name)
  494.  
  495. FUNCTION
  496.  
  497.    Get filename extension.
  498.  
  499. INPUTS
  500.  
  501.    Name = file name to get extension of
  502.  
  503. RESULT
  504.  
  505.    Pointer to extension of given filename. If there's no extension in the name,
  506. the result will point to the trailing NULL character.
  507.  
  508. NOTES
  509.  
  510.    A0=D0 on exit
  511.  
  512. SEE ALSO
  513.  
  514.    AddExtension, GetExtension, RemExtension
  515.  
  516. --------------------------------------------------------------------------------
  517.  
  518. SYNOPSIS
  519.  
  520.    GetResList()
  521.  
  522. FUNCTION
  523.  
  524.    Get current top-level resource list. If there isn't any resource list,
  525. one is created.
  526.  
  527. RESULT
  528.  
  529.    Pointer to the resl_list item of the top-level resource list.
  530.  
  531. NOTE
  532.  
  533.    A0=D0 on exit
  534.  
  535. SEE ALSO
  536.  
  537.    CreateResList, FreeResList, Track#?
  538.  
  539. --------------------------------------------------------------------------------
  540.  
  541. SYNOPSIS
  542.  
  543.    InitHashTree(D0=TableSize,D1=Flags)
  544.  
  545. FUNCTION
  546.  
  547.    Initialize a hashed tree. The hashed tree is a simple structure containing
  548. data items accessed using text key. SS Library allows to simply manage these
  549. trees with both case-dependent and case-independent key searching.
  550.  
  551. INPUTS
  552.  
  553.    TableSize = number of entries in the hash table. Each entry occupies 4 bytes.
  554.       Must be a power of 2 between 8 and 32768.
  555.    Flags = some chacteristics of the tree
  556.       htf_nocase = peform all comparisons in case-insensitive manner. It is
  557.                    significantly slower.
  558.  
  559. RESULT
  560.  
  561.    Hashed tree tracker. (The tree is always referenced by this tracker)
  562.  
  563. SEE ALSO
  564.  
  565.    AddHashItem, FindHashItem, FreeObject
  566.  
  567. --------------------------------------------------------------------------------
  568.  
  569. SYNOPSIS
  570.  
  571.    LinearAlloc(A0=Pool,D1=Size)
  572.  
  573. FUNCTION
  574.  
  575.    Allocates memory in given linear memory pool (created by TrackLinPool).
  576.  
  577.    If Size is less or equal to free space in current memory chunk,
  578. the memory is taken from it. In all other cases, new memory chunk is created.
  579. If Size>Quantum, the new chunk is expanded to satisfy the request.
  580.  
  581.    Allocation of 0 bytes is allowed.
  582.  
  583. INPUTS
  584.  
  585.    Pool - tracker of linear memory pool you want to allocate the block in
  586.    Size - requested size (!!! in D1 !!!)
  587.  
  588. RESULT
  589.  
  590.    Pointer to allocated memory block. This result is always even.
  591.  
  592.    0 if insufficient memory and err_memory disabled.
  593.  
  594. SEE ALSO
  595.  
  596.    TrackLinPool, LinearAllocN
  597.  
  598. --------------------------------------------------------------------------------
  599.  
  600. SYNOPSIS
  601.  
  602.    LinearAllocN(A0=Pool,D1=Size)
  603.  
  604. FUNCTION
  605.  
  606.    Allocates memory in given linear memory pool (created by TrackLinPool).
  607. Doesn't word-align the allocation, therefore is usually used for allocation
  608. of strings. Slightly faster than LinearAlloc.
  609.  
  610.    If Size is less or equal to free space in current memory chunk,
  611. the memory is taken from it. In all other cases, new memory chunk is created.
  612. If Size>Quantum, the new chunk is expanded to satisfy the request.
  613.  
  614.    Allocation of 0 bytes is allowed.
  615.  
  616. INPUTS
  617.  
  618.    Pool - tracker of linear memory pool you want to allocate the block in
  619.    Size - requested size (!!! in D1 !!!)
  620.  
  621. RESULT
  622.  
  623.    Pointer to allocated memory block.
  624.  
  625.    0 if insufficient memory and err_memory disabled.
  626.  
  627. SEE ALSO
  628.  
  629.    TrackLinPool, LinearAlloc
  630.  
  631. --------------------------------------------------------------------------------
  632.  
  633. SYNOPSIS
  634.  
  635.    LoadFile(A0=FileName)
  636.  
  637. FUNCTION
  638.  
  639.    Read file from disk to memory. Uses TrackOpen, TrackMem and ChkRead and
  640. reports their errors if enabled.
  641.  
  642.    This function is able to decrunch powerpacked files using powerpacker
  643. library. Encrypted files are not supported yet.
  644.  
  645.    Error processing mechanism is dependent on err_openread and err_read bits.
  646.  
  647. RESULT
  648.  
  649.    Pointer to file in memory. The file is preceeded by one longword containing
  650. file size in bytes and is null-terminated (useful mostly for text files).
  651. Zero if unsuccessful.
  652.  
  653.    D1=tracker of memory area containing the file or 0 if unsuccessful
  654.  
  655. BUGS
  656.  
  657.    Cannot load from interactive file handles, because it isn't possible.
  658.  
  659. SEE ALSO
  660.  
  661.    ChkRead, TrackOpen
  662.  
  663. --------------------------------------------------------------------------------
  664.  
  665. SYNOPSIS
  666.  
  667.    ParseArgs(A0=Source,A1=Template,A2=ExtraHelp,A3=Destination,D0=Flags)
  668.  
  669. FUNCTION
  670.  
  671.    Parse arguments. This function does something similar to dos/ReadArgs,
  672. but there are some little enhancements:
  673.  
  674.      - Automatic processing of errors (the program is automatically halted
  675.        after error if it isn't disabled by corresponding flag bit).
  676.  
  677.      - Ability to process non-decimal numbers in /N arguments (see StrToL).
  678.  
  679.      - Tracking functions are used for allocation of additional memory.
  680.  
  681.      - Provides mechanism for processing of default settings of non-/A arguments.
  682.  
  683.      - Arguments specified in default settings may be overriden or disabled
  684.        by placing the minus ("-") sign before their keywords. For example:
  685.           Let's have the template "NAME/K,SWITCH/S,ANOTHER/S"
  686.           Default is "NAME Something ANOTHER"
  687.           Parameters are "NAME Suspicious -ANOTHER SWITCH"
  688.           Result is: NAME="Suspicious", ANOTHER=FALSE, SWITCH=TRUE
  689.  
  690.          The typical example of using ParseArgs with defaults is:
  691.             if (! ParseArgs(Defaults,Template,&Vars,pafm_nofail | pafm_ignorea))
  692.                Report_Bad_Defaults;
  693.             ParseArgs(Arguments,Template,&Vars,pafm_noclear);
  694.  
  695.          !! The /A arguments aren't taken from the defaults.
  696.  
  697. INPUTS
  698.  
  699.    Source - string to parse (NULL means: fetch it from standard buffered input)
  700.    Template - template
  701.    ExtraHelp - string to be displayed after second "?" entered by the user
  702.    Destination - array to store the arguments to
  703.    Flags - some flags (see below)
  704.  
  705. FLAGS
  706.  
  707.   pafb_nofail - disable automatic processing of errors
  708.   pafb_noclear - don't clear the array
  709.   pafb_ignorea - don't check presence of /A arguments
  710.  
  711. RESULT
  712.  
  713.    Boolean value indicating success (always true if the automatic error
  714. processing is turned on.
  715.  
  716.    D1=object tracker
  717.  
  718. SEE ALSO
  719.  
  720.    StartupInit, StrToL, dos/ReadArgs
  721.  
  722. --------------------------------------------------------------------------------
  723.  
  724. SYNOPSIS
  725.  
  726.    PoolAlloc(A0=Pool,D0=Size)
  727.  
  728. FUNCTION
  729.  
  730.    Allocates memory in given memory pool (created by TrackPool).
  731.  
  732.    If Size is less or equal to Threshold of memory pool, it's allocated inside
  733. some chunk. If there is no free chunk, new one is created. Large memory blocks
  734. are allocated separately and linked to the pool
  735.  
  736.    Attempt to allocate 0 bytes of memory results in alert AN_AllocZero and
  737. termination of your program.
  738.  
  739. INPUTS
  740.  
  741.    Pool - tracker of memory pool you want to allocate the block in
  742.    Size - requested size
  743.  
  744. RESULT
  745.  
  746.    Pointer to allocated memory block.
  747.  
  748. SEE ALSO
  749.  
  750.    TrackPool, PoolFree
  751.  
  752. --------------------------------------------------------------------------------
  753.  
  754. SYNOPSIS
  755.  
  756.    PoolFree(A0=Pool,A1=Address,D0=Size)
  757.  
  758. FUNCTION
  759.  
  760.    Frees memory allocated by PoolAlloc.
  761.  
  762.    Partial freeing is not allowed.
  763.  
  764. INPUTS
  765.  
  766.    Pool - tracker of memory pool you have allocated the block in
  767.    Address - address of memory block to be freed
  768.    Size - size of memory block
  769.  
  770. SEE ALSO
  771.  
  772.    TrackPool, PoolAlloc
  773.  
  774. --------------------------------------------------------------------------------
  775.  
  776. SYNOPSIS
  777.  
  778.    Printf(A0=Text,A1=Params)
  779.  
  780. FUNCTION
  781.  
  782.    This function sends a formatted text to standard output.  Similar to C
  783. printf() with one exception: the size of INT defaults to 16 bits.
  784.  
  785. INPUTS
  786.  
  787.    Text - pointer to message to be printed
  788.    Params - pointer to optional parameters
  789.  
  790. SEE ALSO
  791.  
  792.    Puts, PutsNL, FormatString
  793.  
  794. --------------------------------------------------------------------------------
  795.  
  796. SYNOPSIS
  797.  
  798.    Puts(A0=Text)
  799.  
  800. FUNCTION
  801.  
  802.    This function sends a non-formatted text to standard output.
  803.  
  804. INPUTS
  805.  
  806.    Text - pointer to text to be printed
  807.  
  808. SEE ALSO
  809.  
  810.    PutsNL, Printf, FormatString
  811.  
  812. --------------------------------------------------------------------------------
  813.  
  814. SYNOPSIS
  815.  
  816.    PutsNL(A0=Text)
  817.  
  818. FUNCTION
  819.  
  820.    This function sends a non-formatted text followed by the NL (new line) chara-
  821. cter to standard output.
  822.  
  823. INPUTS
  824.  
  825.    Text - pointer to text to be printed
  826.  
  827. SEE ALSO
  828.  
  829.    Puts, Printf, FormatString
  830.  
  831. --------------------------------------------------------------------------------
  832.  
  833. SYNOPSIS
  834.  
  835.    RemExtension(A0=Name)
  836.  
  837. FUNCTION
  838.  
  839.    Remove filename extension if there's any.
  840.  
  841. INPUTS
  842.  
  843.    Name = filename to remove extension from.
  844.  
  845. RESULT
  846.  
  847.    None
  848.  
  849. SEE ALSO
  850.  
  851.    AddExtension, SetExtension, GetExtension
  852.  
  853. --------------------------------------------------------------------------------
  854.  
  855. SYNOPSIS
  856.  
  857.    ReportError(D0=ErrCode,A1=Arg1,D2=Arg2,D3=Arg3)
  858.  
  859. FUNCTION
  860.  
  861.    Write standard error message and terminate or simply return without any
  862. message (if the corresponding error bit is clear).
  863.  
  864. INPUTS
  865.  
  866.    ErrCode = error code (see SS.i)
  867.    Arg1,Arg2,Arg3 = optional arguments to be substituted in the message
  868.  
  869. RESULT
  870.  
  871.     0 in both D0 and D1
  872.  
  873. SEE ALSO
  874.  
  875.    ExitError, DisplayError
  876.  
  877. --------------------------------------------------------------------------------
  878.  
  879. SYNOPSIS
  880.  
  881.    SetExtension(A0=Name,A1=Buffer,A2=Extension,D0=BufSize)
  882.  
  883. FUNCTION
  884.  
  885.    Set filename extension or add it if there isn't any.
  886.  
  887. INPUTS
  888.  
  889.    Name = original file name
  890.    Buffer = buffer to copy the name to (may be equal to Name)
  891.    Extension = extension to be used
  892.    BufSize = size of Buffer
  893.  
  894. RESULT
  895.  
  896.    TRUE if successful, FALSE if buffer overflow.
  897.  
  898. SEE ALSO
  899.  
  900.    AddExtension, GetExtension, RemExtension
  901.  
  902. --------------------------------------------------------------------------------
  903.  
  904. SYNOPSIS
  905.  
  906.    SimpleRequest(A0=Text,A1=Params,A2=Gadgets)
  907.  
  908. FUNCTION
  909.  
  910.    Display a message using intuition/EasyRequest, but with significantly
  911. simpler arguments. For additional informations see EasyRequest.
  912.  
  913. INPUTS
  914.  
  915.    Text - pointer to message you want to display
  916.    Params - pointer to optional parameters used for printf-style formatting
  917.    Gadgets - pointer to string containing texts to be used for requester gadgets
  918.  
  919. RESULT
  920.  
  921.    See EasyRequest
  922.  
  923. SEE ALSO
  924.  
  925.    DisplayError, intuition/EasyRequest
  926.  
  927. --------------------------------------------------------------------------------
  928.  
  929. SYNOPSIS
  930.  
  931.    StartupInit(A0=StartupStruct,D7=WBMsg)
  932.  
  933. FUNCTION
  934.  
  935.    Perform standard startup initialization which includes:
  936.  
  937.      - Checks ss.library version requested by your program.
  938.      - Allocate space for system variables and your own variables. The A5
  939.        register points to this memory region directly on the ssbase item
  940.        allowing simple determination of the library base using MOVE.L (A5),A6.
  941.        The system variables are stored below A5 (as described in SS.i) and
  942.        may grow in future releases. Your own variables are stored above A5.
  943.        The amount of user's variables is stored in the StartupStruct.
  944.      - All system variables are initialized to their proper values.
  945.      - All of your own variables are initialized to zeroes.
  946.      - Automatically opens some libraries (dos,intuition,gfx,gadtools,utility)
  947.      - Program name is determined and stored in system variable.
  948.      - Current task is added to the CallerList, which allows to recover from
  949.        a soft crash (see ExitCleanup for an explaination).
  950.      - All actions requested by the tags are done (see below).
  951.      - The arguments are parsed in both CLI and WB modes. If the WB has called
  952.        us, the tool types are parsed using supplied template and converted to
  953.        CLI arguments. If there's a multi-selected icon, it will be used as the
  954.        first argument (if the first argument is /M, all multiselected icons will
  955.        be parsed). If the program has been called as a default tool of some
  956.        project, the project's name is used as the 1st argument. If there is some
  957.        icon used as the first argument, its tool types override the program's
  958.        ones.
  959.      - If the program is started from Workbench, its current directory is set
  960.        to its home directory or to directory containing the first argument.
  961.      - Task's exception handler is replaced by custom one. It shows all address
  962.        and data registers, the program counter and the status register (SR).
  963.        The user may suspend the program, try to abort it (in this case, all
  964.        resources tracked by SS functions are freed) or reboot the machine.
  965.         [The exception code is NOT replaced if there is already another
  966.          exception handler stored in RAM -> you can use breakpoints in your
  967.          favourite debugger etc.] [The algorithm used for detection of custom
  968.          exception handler might have some problems with future kickstarts
  969.          larger than 1/2 Meg.]
  970.      - All other system variables are set to their correct values (see SS.i)
  971.      - Address of ExitCleanup function is pushed onto stack allowing simple exit
  972.        by usual RTS instruction
  973.  
  974. INPUTS
  975.  
  976.    StartupStruct - pointer to startup structure. This structure is
  977.      the following format:
  978.  
  979.         DC.W  VarSize    ; requested size of user's variables
  980.         DC.W  ReqSSVer   ; required version of SS.library
  981.         -- here are stored the tags --
  982.  
  983.    WbMsg - pointer to WorkBench startup message (you must get it manually).
  984.            Can have any value when started from CLI. Must be 0 when started
  985.            from process created by CreateProc, which is NOT started by the
  986.            WorkBench.
  987.  
  988. TAG SYSTEM
  989.  
  990.    The tags are stored in special (read: non-standard) format. This format
  991. uses variable-length tagitems:
  992.  
  993.    a) Special SSLib trackers (codes 0000-3FFF).  These trackers have
  994. absolutely non-systematic arguments, therefore if SSLib encounters any
  995. unknown tag of this type (e.g.  generated by newer version of the macros),
  996. it can't be simply ignored => the "Unknown Tracker" alert is shown and the
  997. program is terminated.  If you use these trackers, make sure that your
  998. "required version number" value matches all these tag types you're using.
  999. This is usually done automatically by ssmac.h.
  1000.  
  1001.    b) Longword trackers.  These are utility.library compatible with one
  1002. small exception:  TAG_IGNORE, TAG_MORE and TAG_SKIP are not supported and
  1003. act as TAG_END.  The implementation is simple:  TAG_END ($00000000) and is
  1004. understood as special SSLib tracker $0000 with the same meaning.  All other
  1005. longword trackers start with $8000, which says that StartupInit has to
  1006. fetch next word as tag ID and next longword as tag parameters (in case of
  1007. string args, it's a pointer to the string).  The tag ID must be in range
  1008. 8000-FFFF.
  1009.  
  1010.    c) Optional trackers (C000-FFFF).  These trackers have variable size of
  1011. argument, but there's a simple mechanism to determine this size:  it's
  1012. encoded in bits #12 and #13 of tag ID:  00 means no parameters, 01=one
  1013. word, 10=one longword, 11=string (null-terminated and padded by zeroes to
  1014. even length).  If one of these optional trackers is encountered and cannot
  1015. be interpreted, it's simply skipped.
  1016.  
  1017.    d) Extended trackers (4000-7FFF). Similar to Optional trackers, but can't
  1018. be ignored (see notes in "Special trackers" paragraph).
  1019.  
  1020.    This mechanism is relatively good, but there are currently no tags of types
  1021. b,c,d. These types will be used in later versions.
  1022.  
  1023. TAGS
  1024.  
  1025.    You usually needn't to specify the tags directly, because the there exist
  1026. simple generation macros for most of them.
  1027.  
  1028.    Many pointers are relative (marked as RelPtr). They can be generated by the
  1029. following macro:
  1030.  
  1031. RelPtr    macro
  1032. \@a    dc.w    \1-\@a
  1033.     endm
  1034.  
  1035.  
  1036.    Tag       Parameters    Meaning
  1037.  
  1038.    sst_finish      none         End of TagList
  1039.    sst_wbconsole        Create console window if started from WB.
  1040.                 This window is used as standard input and output.
  1041.    sst_template       string,word    Specify argument template and offset from A5
  1042.                 to store the arguments on (see ParseArgs).
  1043.    sst_usertrk       RelPtr    Define user tracker types. You pass a relative
  1044.                 pointer to UserTrkTypes structure:
  1045.                 DC.B  NumberOfTrackers,0
  1046.                 followed by RelPtrs to freeing routines
  1047.                 (see FreeObject)
  1048.    sst_extrahelp   string    Define extra help string for argument parsing.
  1049.    sst_exitrout    RelPtr    Define exit routine, which will be called by
  1050.                 ExitCleanup (or any error exit routine)
  1051.                 before any cleanup will be done. This mechanism
  1052.                 can be used for closing of windows and other
  1053.                 similar actions. The exit routine may call
  1054.                 ExitCleanup and the error exit routines, in
  1055.                 which case it won't be called again.
  1056.    sst_usererr       RelPtr    Define user's error routine. This routine will
  1057.                 be called by DisplayError and all error routines
  1058.                 which display errors. The routine will have
  1059.                 the same parameters as DisplayError (A0=Message,
  1060.                 A1=FormatData). If this routine calls any of
  1061.                 the error functions, it will be called again.
  1062.    sst_nowbstart        Exit with error message when called from WB.
  1063.    sst_library     string,WV,W    Open library of specified name and version (WV),
  1064.                 store its base to variable specified by its
  1065.                 offset from A5 (W). Exit with error message
  1066.                 if can't be opened.
  1067.    sst_trylib      string,WV,W    Try to open library (same function as previous
  1068.                 tag, but if failed, it will simply continue
  1069.                 with base=0).
  1070.    sst_nowbargs            Don't parse WB arguments.
  1071.    sst_noprogname        Don't print program's name in error messages.
  1072.    sst_cputype       Min,Max    Fail if CPU type isn't in specified range.
  1073.                 0=68000...4=68040, -1=no upper limit
  1074.    sst_fputype       Min,-1    Fail if FPU type isn't in specified range
  1075.                 0=none,1=68881,2=68882,3=68040
  1076.    sst_sysver       Min,Max    Fail if kickstart version isn't in specified
  1077.                 range.
  1078.    sst_errorreq            Forces using of requesters for error messages.
  1079.    sst_errors       BitMap.L    Disable automatic processing of specified
  1080.                 errors (see SS.i for constants (err_xxx)).
  1081.    sst_wbconname   string    Use WB Console specified by name
  1082.    sst_envvar       string    Try to fetch default values of parameters.
  1083.                 These values are overriden by user-selected
  1084.                 parameters.
  1085.    sst_poolsize    PoolSize.L    Specify size of task's private memory pool.
  1086.                 This pool is used for allocation of all
  1087.                 trackers. Default size = 512 bytes. Specify
  1088.                 higher values when using tracking very
  1089.                 frequently. This tag MUST be specified before
  1090.                 all other tags. The value must be an integer
  1091.                 multiple of 8.
  1092.    sst_poolthresh  PoolThr.L    Specify threshold of task's private memory
  1093.                 pool (see TrackPool, PoolAlloc). Default
  1094.                 threshold=373. Usage: rare. This tag MUST
  1095.                 be specified directly after sst_poolsize.
  1096.  
  1097. NOTES
  1098.  
  1099.    Argument parsing could be problematic when running from several debuggers
  1100. (for example MonAm older than 3.04), because SSLib uses standard V37 way to
  1101. pass them using buffered standard input.  See also ssmac.h for some work-
  1102. around.
  1103.  
  1104. SEE ALSO
  1105.  
  1106.    ExitCleanup
  1107.  
  1108. RESULT
  1109.  
  1110.    A5=pointer to the variable zone. This value is required by all the routines
  1111.       in this library excluding where this doc says something other. If you
  1112.       call SSLib with different value in A5, weird things can occur.
  1113.  
  1114. --------------------------------------------------------------------------------
  1115.  
  1116. SYNOPSIS
  1117.  
  1118.    StrCat(A0=Dest,A1=Source) -> A0=AfterPtr
  1119.  
  1120. FUNCTION
  1121.  
  1122.    This function performs string concatenation. It concatenates the second
  1123. string to the first one.
  1124.  
  1125. INPUTS
  1126.  
  1127.    Dest,Source = strings to work with.
  1128.  
  1129. RESULT
  1130.  
  1131.    A0 contains address of the null character at the end of the destination
  1132. string. It allows to concatenate multiple strings without touching contents
  1133. of A0.
  1134.  
  1135. --------------------------------------------------------------------------------
  1136.  
  1137. SYNOPSIS
  1138.  
  1139.    StrToL(A0=String)
  1140.  
  1141. FUNCTION
  1142.  
  1143.    Convert string containing a number in ASCII form to binary form.
  1144.  
  1145.    It supports decimal, octal (prefixed by 0) and hexadecimal (prefixed by 0x
  1146. or $) numbers. All spaces before the number are skipped.
  1147.  
  1148.    If there're any invalid characters, the standard error mechanism is used.
  1149. If the user hasn't disabled it, the error message err_number is displayed
  1150. and the program is terminated.
  1151.  
  1152.    This function isn't slow, but it isn't recommended to use it for processing
  1153. of long sequences of numbers, because it uses the longword multiply function
  1154. of the utility.library, which is relatively slow on 68000 and 68010.
  1155.  
  1156. INPUTS
  1157.  
  1158.    String - pointer to string to be converted.
  1159.  
  1160. RESULT
  1161.  
  1162.    Value of the number.
  1163.  
  1164.    D1 contains address of illegal character if failed or 0 if input string
  1165. contains valid number.
  1166.  
  1167. --------------------------------------------------------------------------------
  1168.  
  1169. SYNOPSIS
  1170.  
  1171.    TestBreak()
  1172.  
  1173. FUNCTION
  1174.  
  1175.    Test the CTRL-C signal and abort the program if active.
  1176.  
  1177. NOTES
  1178.  
  1179.    Doesn't modify contents of D0,D1,A0,A1.
  1180.  
  1181. SEE ALSO
  1182.  
  1183.    exec/SetSignal, arp/CheckAbort, arp/CheckBreak, dos/dos.i
  1184.  
  1185. --------------------------------------------------------------------------------
  1186.  
  1187. SYNOPSIS
  1188.  
  1189.    TrackAlloc(D0=size)
  1190.  
  1191. FUNCTION
  1192.  
  1193.    Allocate, clear and track public memory of specified size.  If the
  1194. memory is not available, exit with error message if its's enabled by
  1195. corresponding error bit.
  1196.  
  1197.    If you want to allocate large block of memory and you don't need it to be
  1198. cleared, use TrackAllocMem(Size,1) instead.
  1199.  
  1200. INPUTS
  1201.  
  1202.    Size = how large (in bytes) chunk of memory you want to allocate
  1203.  
  1204. RESULT
  1205.  
  1206.    Pointer to memory chunk or 0 if not enough memory.
  1207.  
  1208.    D1=object tracker
  1209.  
  1210. SEE ALSO
  1211.  
  1212.    TrackAllocMem, FreeObject, exec/AllocMem
  1213.  
  1214. --------------------------------------------------------------------------------
  1215.  
  1216. SYNOPSIS
  1217.  
  1218.    TrackAllocMem(D0=size,D1=requirements)
  1219.  
  1220. FUNCTION
  1221.  
  1222.    Allocate memory with specified attributes. This function is very similar
  1223. to TrackAlloc.
  1224.  
  1225. INPUTS
  1226.  
  1227.    Size = how large chunk you want to allocate
  1228.    Requirements = memory requirements (see exec/memory.h)
  1229.  
  1230. RESULT
  1231.  
  1232.    Pointer to allocated memory chunk or 0 if out of memory of required type.
  1233.  
  1234.    D1=object tracker
  1235.  
  1236. SEE ALSO
  1237.  
  1238.    TrackAlloc, FreeObject, exec/AllocMem
  1239.  
  1240. --------------------------------------------------------------------------------
  1241.  
  1242. SYNOPSIS
  1243.  
  1244.    TrackDevice(A0=DevName,A1=IORQ,D0=unit,D1=flags,[A2=ErrTable])
  1245.  
  1246. FUNCTION
  1247.  
  1248.    Open device and track it. In case of difficulty, write an error message and
  1249. abort the program if requested by corresponding error bit.
  1250.  
  1251. INPUTS
  1252.  
  1253.    DevName = device name, case-sensitive
  1254.    IORQ = IORequest to use with this device
  1255.       (if IORQ<256, TrackIoRq(0,IORQ) will be called to create new IORequest,
  1256.        which will be linked by TrackSlave to device's tracker)
  1257.    Unit = device unit number
  1258.    Flags = OpenDevice flags
  1259.    ErrTable = optional pointer to error message table (this pointer MUST be
  1260.       specified if you want to use ChkDoIO, but it may be NULL).
  1261.       The table is a sequence of error definition blocks terminated by a
  1262.       block of 0 errors (both Min and NumErr fields are zero). Each block
  1263.       has the following format:
  1264.            DC.W  Min            ; Number of first error message
  1265.            DC.W  NumErr            ; Number of error messages in this block
  1266.            DC.L  ErrPointer[NumErr]    ; Pointers to error strings
  1267.  
  1268. RESULT
  1269.  
  1270.    Error code or 0 if successful.
  1271.    trk_data of the tracker contains pointer to IORequest used by this device.
  1272.  
  1273.    D1=object tracker
  1274.  
  1275.    A1=copy of trk_data (pointer to associated IORequest)
  1276.  
  1277. SEE ALSO
  1278.  
  1279.    ChkDoIO, TrackIORQ, TrackPort, FreeObject, exec/OpenDevice
  1280.  
  1281. --------------------------------------------------------------------------------
  1282.  
  1283. SYNOPSIS
  1284.  
  1285.    TrackDosObject(D0=Type,A0=TagList)
  1286.  
  1287. FUNCTION
  1288.  
  1289.    Allocate dos object and track it. Does usual error handling and reporting
  1290. (err_memory).
  1291.  
  1292. INPUTS
  1293.  
  1294.    Type = dos object type
  1295.    TagList = dos object tag list
  1296.  
  1297. RESULT
  1298.  
  1299.    Pointer to allocated dos object or 0 if not successful.
  1300.  
  1301.    D1=object tracker
  1302.  
  1303. SEE ALSO
  1304.  
  1305.    dos/AllocDosObject, FreeObject
  1306.  
  1307. --------------------------------------------------------------------------------
  1308.  
  1309. SYNOPSIS
  1310.  
  1311.    TrackExtd(D0.B=type,D1=extsize)
  1312.  
  1313. FUNCTION
  1314.  
  1315.    Create an extended tracker structure and connect it to active resource list
  1316. (if there's no resource list, one will be created).
  1317.  
  1318.    The extended tracker is a standard resource tracker, which has additional
  1319. data behind trk_sizeof. These bytes are for your own use.
  1320.  
  1321. INPUTS
  1322.  
  1323.    Type = tracker type ID (see SS.i)
  1324.    ExtSize = size of tracker extension
  1325.  
  1326. RESULT
  1327.  
  1328.    Pointer to created object tracker.
  1329.  
  1330.    A0=tracker, A1=pointer to trk_ext
  1331.  
  1332. SEE ALSO
  1333.  
  1334.    TrackObject
  1335.  
  1336. --------------------------------------------------------------------------------
  1337.  
  1338. SYNOPSIS
  1339.  
  1340.    TrackIoRq(A0=OptionalPort,D0=size or 0)
  1341.  
  1342. FUNCTION
  1343.  
  1344.    Create an IO Request and track it. This function can use user-supplied
  1345. message port or create special message port for this IORQ. In case of difficulty,
  1346. writes error message and aborts the program if requested by corresponding error
  1347. bit.
  1348.  
  1349. INPUTS
  1350.  
  1351.    OptionalPort = pointer to user-supplied message port or 0 if nothing supplied
  1352.    Size = requested IoRequest size or 0 for IOStdReq structure
  1353.  
  1354. RESULT
  1355.  
  1356.    Pointer to created IORequest.
  1357.  
  1358.    D1=object tracker
  1359.  
  1360. SEE ALSO
  1361.  
  1362.    TrackPort, TrackDevice, FreeObject
  1363.  
  1364. --------------------------------------------------------------------------------
  1365.  
  1366. SYNOPSIS
  1367.  
  1368.    TrackLibrary(A0=LibName,D0=version)
  1369.  
  1370. FUNCTION
  1371.  
  1372.    Open library and track it. If the library isn't available and you hadn't
  1373. disabled it using the error bits, the error message will be displayed and the
  1374. program will be aborted.
  1375.  
  1376. INPUTS
  1377.  
  1378.    LibName = name of library, is case-sensitive
  1379.    Version = required minimal version of library
  1380.  
  1381. RESULT
  1382.  
  1383.    Pointer to library node or 0 if unsuccessful
  1384.  
  1385.    D1=object tracker
  1386.  
  1387. SEE ALSO
  1388.  
  1389.    FreeObject, exec/OpenLibrary, StartupInit
  1390.  
  1391. --------------------------------------------------------------------------------
  1392.  
  1393. SYNOPSIS
  1394.  
  1395.    TrackLock(A0=name,D0=lockmode)
  1396.  
  1397. FUNCTION
  1398.  
  1399.    Lock dos object and track it. Error handling as usually.
  1400.  
  1401. INPUTS
  1402.  
  1403.    Name = name of object you wish to lock
  1404.    LockMode = lock mode (see dos/dos.i)
  1405.  
  1406. RESULT
  1407.  
  1408.    Dos lock or 0 if not possible.
  1409.  
  1410.    D1=object tracker
  1411.  
  1412. SEE ALSO
  1413.  
  1414.    dos/Lock, FreeObject
  1415.  
  1416. --------------------------------------------------------------------------------
  1417.  
  1418. SYNOPSIS
  1419.  
  1420.    TrackObject(D0.B=type)
  1421.  
  1422. FUNCTION
  1423.  
  1424.    Create a standard tracker and connect it to active resource list (if there's
  1425. no resource list, one will be created).
  1426.  
  1427.    This function is used to track objects of your own types defined using the
  1428. UserTrkTypes structure (tracker types in range $80 to $FF) or to track objects
  1429. defined by ss.library extensions (not implemented yet).
  1430.  
  1431.    Your object freeing function will be called ONLY if the trk_data field
  1432. contains non-null value. This suspiciously-looking rule allows you to track
  1433. your objects simply with respect to all possible failures:
  1434.  
  1435.      - call TrackObject (if there isn't enough memory to do it -> aborted)
  1436.      - store A1
  1437.      - allocate your object
  1438.      - restore A1
  1439.      - store optional data at A1 if you need
  1440.      - store pointer to your object to -(A1)
  1441.  
  1442.    If allocation of your object fails and you abort the program, you don't
  1443. have to free the tracker, because it will be done automatically by ExitCleanup
  1444. (or other exit routine, which calls ExitCleanup) and your object-freeing routine
  1445. won't be called. If you don't abort the program, you have simply to free the
  1446. tracker using FreeObject and your object-freeing routine won't be called, too.
  1447.  
  1448. INPUTS
  1449.  
  1450.    Type = tracker type ID (see SS.i)
  1451.  
  1452. RESULT
  1453.  
  1454.    Pointer to created object tracker.
  1455.  
  1456.    A0=tracker, A1=pointer to trk_ext
  1457.  
  1458. SEE ALSO
  1459.  
  1460.    CreateResList, FreeObject, FreeResList, GetResList, sv_usertrk,
  1461.    TrackRoutine, TrackExtd
  1462.  
  1463. --------------------------------------------------------------------------------
  1464.  
  1465. SYNOPSIS
  1466.  
  1467.    TrackOpen(A0=Name,D0=Openmode)
  1468.  
  1469. FUNCTION
  1470.  
  1471.    Open a file and track it. Does usual error checking and handling (see some
  1472. other tracking function).
  1473.  
  1474. INPUTS
  1475.  
  1476.    Name = name of the file you want to open
  1477.    OpenMode = Open() mode - see dos/dos.i - MODE_*
  1478.               also can be a SS open mode:
  1479.                 OPEN_OLD - identical to MODE_OLDFILE (but shorter value)
  1480.                 OPEN_NEW - identical to MODE_NEWFILE (but shorter value)
  1481.              OPEN_APPEND - open using MODE_OLDFILE and Seek to end
  1482.  
  1483. RESULT
  1484.  
  1485.    File handle of opened file or 0 if Open() has failed.
  1486.  
  1487.    D1=object tracker
  1488.  
  1489. SEE ALSO
  1490.  
  1491.    dos/Open, dos/dos.i, FreeObject
  1492.  
  1493. --------------------------------------------------------------------------------
  1494.  
  1495. SYNOPSIS
  1496.  
  1497.    TrackPool(Quantum,Threshold,Attributes)
  1498.              D0      D1        D2
  1499.  
  1500. FUNCTION
  1501.  
  1502.    Create a memory pool and track it. Error checking is performed according
  1503. to common rules (see elsewhere what does it mean).
  1504.  
  1505.    Pooled allocation is a relatively fast memory allocation strategy
  1506. designed for manipulating small blocks of memory. It's based on memory
  1507. chunks, each of them has given size (Quantum). Any memory
  1508. block requested by PoolAlloc, which size is less or equal to Threshold,
  1509. is allocated inside one of memory chunks. Blocks greater than Threshold
  1510. are allocated using standard AllocMem and linked to the pool.
  1511.  
  1512.    All memory blocks in the pool can be freed separately or simultaneously
  1513. by FreeObject.
  1514.  
  1515. INPUTS
  1516.  
  1517.    Quantum - allocation quantum
  1518.    Threshold - size of largest block allocated inside chunks
  1519.    Attributes - requested memory attributes (MEMF_#? - see AllocMem)
  1520.  
  1521. RESULT
  1522.  
  1523.    Pointer to memory pool tracker.
  1524.  
  1525. SEE ALSO
  1526.  
  1527.    FreeObject, PoolAlloc, PoolFree, exec/AllocMem
  1528.  
  1529. --------------------------------------------------------------------------------
  1530.  
  1531. SYNOPSIS
  1532.  
  1533.    TrackLinPool(Quantum,Attributes)
  1534.                 D0      D1
  1535.  
  1536. FUNCTION
  1537.  
  1538.    Create a linear memory pool and track it.
  1539.  
  1540.    Linear pooled allocation is an extremely fast memory allocation strategy
  1541. designed for allocating of small blocks of memory, which are freed together.
  1542. The pool manager allocates memory in large blocks of given size (Quantum).
  1543. It tries to use currently active block for each allocation request. If it
  1544. fails, new block is created.
  1545.  
  1546. INPUTS
  1547.  
  1548.    Quantum - allocation quantum
  1549.    Attributes - requested memory attributes (MEMF_#? - see AllocMem)
  1550.  
  1551. RESULT
  1552.  
  1553.    Pointer to linear memory pool tracker.
  1554.  
  1555. SEE ALSO
  1556.  
  1557.    FreeObject, LinearAlloc, LinearAllocN
  1558.  
  1559. --------------------------------------------------------------------------------
  1560.  
  1561. SYNOPSIS
  1562.  
  1563.    TrackPort()
  1564.  
  1565. FUNCTION
  1566.  
  1567.    Create a message port and track it. Does usual error checking and handling.
  1568.  
  1569. RESULT
  1570.  
  1571.    Pointer to properly initialized message port.
  1572.  
  1573.    D1=object tracker
  1574.  
  1575. SEE ALSO
  1576.  
  1577.    exec/CreateMsgPort, FreeObject, CreateIORQ
  1578.  
  1579. --------------------------------------------------------------------------------
  1580.  
  1581. SYNOPSIS
  1582.  
  1583.    TrackRoutine(A0=routine,A1=args)
  1584.  
  1585. FUNCTION
  1586.  
  1587.    Define a tracker, which will call your routine in time of freeing. The Args
  1588. you supply will be passed in A0 to your routine.
  1589.  
  1590.    If A1=0, no routine will be called. For the reason of this suspicious action,
  1591. see TrackObject (there are applied the same rules).
  1592.  
  1593. INPUTS
  1594.  
  1595.    Routine = pointer to routine You wish to call
  1596.    Args = user data passed to the routine in time of resource freeing
  1597.  
  1598. RESULT
  1599.  
  1600.    Tracker
  1601.  
  1602.    A1 points to Args and can be used in similar way as in TrackObject, but you
  1603. needn't to use -(A1).
  1604.  
  1605. SEE ALSO
  1606.  
  1607.    TrackObject, FreeObject
  1608.  
  1609. --------------------------------------------------------------------------------
  1610.  
  1611. SYNOPSIS
  1612.  
  1613.    TrackSignal()
  1614.  
  1615. FUNCTION
  1616.  
  1617.    Allocate a signal and track it. Does usual error checking and handling.
  1618.  
  1619. RESULT
  1620.  
  1621.    Number of signal or -1 if there are no free signals.
  1622.  
  1623. SEE ALSO
  1624.  
  1625.    exec/AllocSignal, FreeObject
  1626.  
  1627. NOTE
  1628.  
  1629.    D1=object tracker
  1630.  
  1631. --------------------------------------------------------------------------------
  1632.  
  1633. SYNOPSIS
  1634.  
  1635.    TrackSlave(A0=Master,A1=Slave)
  1636.  
  1637. FUNCTION
  1638.  
  1639.    Connect Slave to a list of Master's slaves and re-connect the Master
  1640. to the front of current resource list, therefore it will be freed before
  1641. the slaves.
  1642.  
  1643.    The linkage mechanism uses the Tracker.trk_ext field as pointer to the
  1644. first slave.  It causes that standard trackers (excluding trt_null) cannot
  1645. be used as masters.  The routine tracker (obtained via TrackRoutine) can be
  1646. used, but its entry data (passed in A0 to user's resource freeing routine)
  1647. will be destroyed (but it won't be 0 in any case -> the routine is called
  1648. everytime).
  1649.  
  1650. SEE ALSO
  1651.  
  1652.    TrackObject, FreeObject
  1653.  
  1654. --------------------------------------------------------------------------------
  1655.