home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- FUNCTION O_asize && Sst341.prg
-
- PARAMETERS _ofile, _array, _bytes
-
- PRIVATE _cnt, _fh, _bytes
-
- IF EMPTY(PCOUNT())
- RETURN(0)
- ELSEIF PCOUNT() = 1
- IF !FILE(_ofile)
- RETURN(0)
- ENDIF
- ELSEIF PCOUNT() = 2
- IF !FILE(_ofile)
- RETURN(0)
- ENDIF
- IF TYPE("_array") != "A"
- RETURN(0)
- ENDIF
- ENDIF
-
- _bytes = IF( (TYPE("_bytes") != "N"), 1024, _bytes)
- _bytes = IF( (_bytes < 0), _1024, _bytes)
-
- _fh = FOPEN(_ofile)
- _end = FSEEK(_fh, 0, 2)
- _line = ""
- _count = 0
- FSEEK(_fh, 0, 0)
- DO WHILE .T.
- _char = SPACE(_bytes)
- _exit = FREAD(_fh, @_char, _bytes ) != _bytes
- _char = _line + _char
- DO WHILE !EMPTY(_char)
- _line = Parsing(@_char, CHR(13)+CHR(10) )
- IF LEFT(LTRIM(TRIM(_line)), 1) = "*"
- _line = ""
-
- ELSEIF "NOTE" = SUBSTR(UPPER(LTRIM(_line)),1,4)
- _line = ""
-
- ELSEIF "&&" = SUBSTR(LTRIM(_line), 2, 4)
- _line = ""
-
- ELSEIF EMPTY(_line)
- _line = ""
-
- ELSE
- IF !EMPTY(_char)
- _count = _count + 1
- IF PCOUNT() = 2
- _array[_count] = _line
- ENDIF
- ENDIF
- ENDIF
- ENDDO
- *
- * if _char is empty and _line is NOT, then _line
- * must be added to char at the top of the loop
- *
- IF _exit
- * replace EOF marker with null byte
- _line = STRTRAN(_line, CHR(26), "")
- * if there are still characters, write it out.
- IF !EMPTY(_line)
- _count = _count + 1
- IF PCOUNT() = 2
- _array[_count] = _line
- ENDIF
- ENDIF
- EXIT
- ENDIF
- ENDDO
- FCLOSE(_fh)
- RETURN(_count)
-
- * End of File