home *** CD-ROM | disk | FTP | other *** search
- * Program ...: Wraptest.PRG
- * Author ....: Kenneth N. Getz
- * Date ......: 21 September 1986
- * Modified: 7 October 1986
- * Version ...: dBASE III PLUS, (Developer's Release)
- * Note(s) ...: This is a program to used to demonstrate Wrap.BIN, an assembly language module that
- * takes in a wrap length, a buffer area, and a string to be wrapped. It passes back
- * the string truncated to the wraplength with the extra text in the buffer area.
- *
- USE Wraptest
- SET TALK OFF
- LOAD WRAP && Binary procedure that controls wrapping.
- SET PROCEDURE TO Empty && Clears out buffer before going to next record.
- *
- * Get wrap width and offset from the left from the user, checking to make sure that the width plus
- * the offset is less than the output width. If not, the offset is adjusted to make sure all columns
- * fit on the output.
- *
- STORE 80 TO OutWidth
- STORE 0 TO WidthNum
- STORE 0 TO Offset
- CLEAR
- INPUT 'Wrap to how many columns: ' TO WidthNum
- INPUT 'To what Offset: ' TO Offset
- Offset = IIF( WidthNum + Offset > OutWidth, OutWidth-WidthNum, Offset )
- CLEAR
- *
- * Now initialize the important variables. All programs using Wrap.BIN must initialize three variables
- * just like these. Though the names are unimportant, the sizes and the order are VERY important. They
- * must also be declared consecutively for the program to work.
- *
- STORE CHR(WidthNum) TO Width
- STORE SPACE(254) TO Buffer
- STORE SPACE(254) TO WrapString
- **
- ** If the buffer is empty, copy the next record to the WrapString.
- ** If not, copy trimmed Buffer, a space, and the trimmed record to WrapString.
- **
- DO WHILE .NOT. EOF()
- IF LEN(TRIM(Line)) = 0
- DO Empty WITH 0
- ?
- SKIP
- LOOP
- ENDIF
- STORE IIF(LEN(TRIM(Buffer))<>0,TRIM(Buffer) + ' ' + TRIM(LINE),TRIM(LINE)) TO WrapString
- CALL WRAP WITH WrapString
- ? SPACE(Offset) + WrapString
- DO Empty WITH Widthnum
- SKIP
- ENDDO
- **
- ** Now that we're at the end of the file, we have to make sure and finish up the current buffer. As long as
- ** the Buffer isn't empty we need to copy the Buffer to the WrapString and call Wrap.
- **
- DO Empty WITH 0
- CLEAR ALL
- RETURN
- * EOP Wraptest.PRG