home *** CD-ROM | disk | FTP | other *** search
- SSBUF(3C) Last changed: 10-20-98
-
-
- NNAAMMEE
- ssttrrssttrreeaammbbuuff - ssttrreeaammbbuuff specialized to arrays
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<iioossttrreeaamm..hh>>
- ##iinncclluuddee <<ssttrrssttrreeaamm..hh>>
-
- ccllaassss ssttrrssttrreeaammbbuuff :: ppuubblliicc ssttrreeaammbbuuff {{
- ppuubblliicc::
- ssttrrssttrreeaammbbuuff(()) ;;
- ssttrrssttrreeaammbbuuff((cchhaarr**,, iinntt,, cchhaarr**));;
- ssttrrssttrreeaammbbuuff((iinntt));;
- ssttrrssttrreeaammbbuuff((uunnssiiggnneedd cchhaarr**,, iinntt,, uunnssiiggnneedd cchhaarr**));;
- ssttrrssttrreeaammbbuuff((vvooiidd** ((**aa))((lloonngg)),, vvooiidd((**ff))((vvooiidd**))));;
-
- vvooiidd ffrreeeezzee((iinntt nn==11)) ;;
- cchhaarr** ssttrr(());;
- vviirrttuuaall ssttrreeaammbbuuff** sseettbbuuff((cchhaarr**,, iinntt))
- }};;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- A ssttrrssttrreeaammbbuuff is a ssttrreeaammbbuuff that uses an array of bytes (a string)
- to hold the sequence of characters. Given the convention that a cchhaarr**
- should be interpreted as pointing just before the cchhaarr it really
- points at, the mapping between the abstract get/put pointers (see
- ssbbuuff..ppuubb(3C)) and cchhaarr** pointers is direct. Moving the pointers
- corresponds exactly to incrementing and decrementing the cchhaarr** values.
-
- To accommodate the need for arbitrary length strings, ssttrrssttrreeaammbbuuff
- supports a dynamic mode. When a ssttrrssttrreeaammbbuuff is in dynamic mode,
- space for the character sequence is allocated as needed. When the
- sequence is extended too far, it will be copied to a new array.
-
- The following descriptions make the following assumptions:
-
- * _s_s_b is a ssttrrssttrreeaammbbuuff**.
-
- * _n is an iinntt.
-
- * _p_t_r and _p_s_t_a_r_t are cchhaarr**s or uunnssiiggnneedd cchhaarr**s.
-
- * _a is a vvooiidd** ((**))((lloonngg)).
-
- * _f is a vvooiidd** ((**))((vvooiidd**)).
-
- CCoonnssttrruuccttoorrss
- ssttrrssttrreeaammbbuuff(())
- Constructs an empty ssttrrssttrreeaammbbuuff in dynamic mode. This means
- that space will be automatically allocated to accommodate the
- characters that are put into the ssttrrssttrreeaammbbuuff (using operators
- nneeww and ddeelleettee). Because this may require copying the original
- characters, it is recommended that when many characters are to be
- inserted, the program should use sseettbbuuff(()) (described on this man
- page) to inform the ssttrrssttrreeaammbbuuff.
-
- ssttrrssttrreeaammbbuuff((_a,, _f))
- Constructs an empty ssttrrssttrreeaammbbuuff in dynamic mode. _a is used as
- the allocator function in dynamic mode. The argument passed to _a
- will be a lloonngg denoting the number of bytes to be allocated. If
- _a is null, ooppeerraattoorr nneeww will be used. _f is used to free (or
- delete) areas returned by _a. The argument to _f will be a pointer
- to the array allocated by _a. If _f is null, ooppeerraattoorr ddeelleettee is
- used.
-
- ssttrrssttrreeaammbbuuff((_n))
- Constructs an empty ssttrrssttrreeaammbbuuff in dynamic mode. The initial
- allocation of space will be at least _n bytes.
-
- ssttrrssttrreeaammbbuuff((_p_t_r,, _n,, _p_s_t_a_r_t))
- Constructs a ssttrrssttrreeaammbbuuff to use the bytes starting at _p_t_r. The
- ssttrrssttrreeaammbbuuff will be in static mode; it will not grow
- dynamically. If _n is positive, then the _n bytes starting at _p_t_r
- are used as the ssttrrssttrreeaammbbuuff. If _n is zero, _p_t_r is assumed to
- point to the beginning of a null terminated string and the bytes
- of that string (not including the terminating null character)
- will constitute the ssttrrssttrreeaammbbuuff. If _n is negative, the
- ssttrrssttrreeaammbbuuff is assumed to continue indefinitely. The get
- pointer is initialized to _p_t_r. The put pointer is initialized to
- _p_s_t_a_r_t. If _p_s_t_a_r_t is null, then stores will be treated as
- errors. If _p_s_t_a_r_t is non-null, then the initial sequence for
- fetching (the get area) consists of the bytes between _p_t_r and
- _p_s_t_a_r_t. If _p_s_t_a_r_t is null, then the initial get area consists of
- the entire array.
-
- MMeemmbbeerr FFuunnccttiioonnss
- _s_s_b-->>ffrreeeezzee((_n))
- Inhibits (when _n is nonzero) or permits (when _n is zero)
- automatic deletion of the current array. Deletion normally
- occurs when more space is needed or when _s_s_b is being destroyed.
- Only space obtained via dynamic allocation is ever freed. It is
- an error (and the effect is undefined) to store characters into a
- ssttrrssttrreeaammbbuuff that was in dynamic allocation mode and is now
- frozen. It is possible, however, to thaw (unfreeze) such a
- ssttrrssttrreeaammbbuuff and resume storing characters.
-
- _p_t_r==_s_s_b-->>ssttrr(())
- Returns a pointer to the first cchhaarr of the current array and
- freezes _s_s_b. If _s_s_b was constructed with an explicit array, _p_t_r
- will point to that array. If _s_s_b is in dynamic allocation mode,
- but nothing has yet been stored, _p_t_r may be null.
-
- _s_s_b-->>sseettbbuuff((00,,_n))
- _s_s_b remembers _n and the next time it does a dynamic mode
- allocation, it makes sure that at least _n bytes are allocated.
-
- SSEEEE AALLSSOO
- ssbbuuff..ppuubb(3C), ssttrrssttrreeaamm(3C)
-
- This man page is available only online.
-
-