home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST216.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  1.9 KB  |  64 lines

  1. ********************
  2.  
  3. FUNCTION Arrayrest
  4.  
  5.    * Contributed by Joe Booth / Modified by Steve Straley
  6.  
  7.    PARAMETER _warray, _fname
  8.  
  9.    IF PCOUNT() != 2
  10.       RETURN(.F.)
  11.    ELSEIF TYPE("_warray") + TYPE("_fname") != "AC"
  12.       RETURN(.F.)
  13.    ENDIF
  14.  
  15.    PRIVATE _retval,_fn,_hw,_fid,_t1,_t2,_tmp1,_tmp2,_k,_tmp3,_t0, _wtype, _wsize
  16.  
  17.    _retval = .F.
  18.    IF FILE(_fname)
  19.       _fn = FOPEN(_fname,0)
  20.       IF _fn >=0
  21.          _fid = SPACE(33)
  22.          _hw = FREAD(_fn,@_fid,33)
  23.          IF _hw = 33
  24.             * read rest of file
  25.             IF LEFT(_fid,3) = "SJS"
  26.                _t0 = VAL(SUBSTR(_fid,4,10))
  27.                _t1 = VAL(SUBSTR(_fid,14,10))
  28.                _t2 = VAL(SUBSTR(_fid,24,10))
  29.                _tmp1 = SPACE(_t1)
  30.                _tmp2 = SPACE(_t2)
  31.                _hw = FREAD(_fn,@_tmp1,_t1)
  32.                IF _hw = _t1
  33.                   _hw = FREAD(_fn,@_tmp2,_t2)
  34.                   IF _t2 = _hw
  35.                      _retval = .T.
  36.                      _hw = LEN(_tmp1)/6
  37.                      FOR _k = 1 TO MIN( _hw,LEN(_warray) )
  38.                         _wtype = LEFT(_tmp1,1)
  39.                         _wsize = VAL( SUBSTR(_tmp1,2,5) )
  40.                         _tmp1 = SUBSTR(_tmp1,7)
  41.                         _tmp3 = LEFT(_tmp2,_wsize)
  42.                         _tmp2 = SUBSTR(_tmp2,_wsize+1)
  43.                         DO CASE
  44.                         CASE _wtype = "C"
  45.                            _warray[_k]=_tmp3
  46.                         CASE _wtype = "N"
  47.                            _warray[_k]=VAL(_tmp3)
  48.                         CASE _wtype = "D"
  49.                            _warray[_k]=CTOD(_tmp3)
  50.                         CASE _wtype = "L"
  51.                            _warray[_k]=IF(_tmp3="T",.T.,.F.)
  52.                         ENDCASE
  53.                      NEXT
  54.                   ENDIF
  55.                ENDIF
  56.             ENDIF
  57.          ENDIF
  58.          FCLOSE(_fn)
  59.       ENDIF
  60.    ENDIF
  61.    RETURN(_retval)
  62.  
  63. * End of File
  64.