PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #import - T2H[Next]: #include

#import - WRAP

This is a specialised #import facility.

WRAP DEFINITIONS/OPTIONS

These definitions are specific to the "WRAP" import mode. If you can't understand how they work then I suggest you try using /debug or #debug to watch what variables the import uses etc.

Example of WRAP Import

Assume "PEOPLE.TXT" contains people data of the following form (each record spans 3 lines with blank lines being ignored and little validation of data):

   Harry
   18
   male


   Lisa
   20
   female

Then we could create a simple HTML table as follows:

   ;--- Define some macros to handle the imported data ----------------------
   #define InitMultiLineFieldImport             \
           #RexxVar RxFieldCount = 0
   #define TermMultiLineFieldImport                                                     \
           #if [RxFieldCount <> 0]                                                      \
               #error "Incorrectly specified record, have <??RxFieldCount> of 3 fields" \
           #endif
   #define EachLine                                                                     \
           ;--- "read" the line (no blank lines) -------                                \
           #evaluate+ ''  ^ThisLine = strip({$Line})^                                   \
                                                                                        \
           ;--- Save information -----------------------                                \
           #RexxVar RxFieldCount + 1                                                    \
           #RexxVar RxField_<??RxFieldCount> = ThisLine                                 \
                                                                                        \
           ;--- If end of record then output it --------                                \
           #if [RxFieldCount = 3]                                                       \
               <TR><TD><??RxField_1> is <??RxField_3> and <??RxField_2> years old       \
               #RexxVar RxFieldCount = 0                                                \
           #endif


   ;--- Start the table -----------------------------------------------------
   <$InitMultiLineFieldImport>
   <BR>
   <CENTER>
   <TABLE COLS=3 BORDER=1>

   ;--- Import the data (leaving default at dropping blank lines) -----------
   #import "PEOPLE.TXT" WRAP EachLine

   ;--- End The table -------------------------------------------------------
   </TABLE>
   </CENTER>
   <$TermMultiLineFieldImport>


[Top][Contents][Search][Prev]: #import - T2H[Next]: #include

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Thursday January 17 2002 at 6:27pm