home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ipfcpr21.zip / IPFCPREP.INF (.txt) < prev    next >
OS/2 Help File  |  1994-01-24  |  17KB  |  622 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Changes ΓòÉΓòÉΓòÉ
  3.  
  4.  
  5. ΓòÉΓòÉΓòÉ 1.1. Version 2.1 ΓòÉΓòÉΓòÉ
  6.  
  7. All changes for release 2.0 are marked with a 'B'. 
  8.  
  9.    o  Change documentation and code for external release. 
  10.  
  11.    o  Increased the size of initial symbol text from 120 to 250. 
  12.  
  13.    o  Changed it so that #define values that are a single value do not convert 
  14.       from hex to decimal or from octal to decimal, but rather leave the 
  15.       expression as it is. 
  16.  
  17.  
  18. ΓòÉΓòÉΓòÉ 1.2. Version 2.0 ΓòÉΓòÉΓòÉ
  19.  
  20. All changes for release 2.0 are marked with a 'A'. 
  21.  
  22.    o  Fixed a bug where macros were case sensitive and aliasing did not work. 
  23.       Macro names are now case insensitive. 
  24.  
  25.    o  Fixed a bug in nested config sections. Two nested configuration sections 
  26.       in a row were not working. The second section was being deleted if the 
  27.       first section was deleted. It now works properly. 
  28.  
  29.    o  Added support for #ifdef and #ifndef. #if and #elif are ignored. 
  30.  
  31.    o  Added a message for recursive macro and symbol expansion to eliminate the 
  32.       stack overflow problem. 
  33.  
  34.  
  35. ΓòÉΓòÉΓòÉ 1.3. Version 1.9 ΓòÉΓòÉΓòÉ
  36.  
  37. All changes for release 1.9 are marked with a '9'. 
  38.  
  39.    o  Fixed a bug where periods in symbols strings were considered end of 
  40.       symbol or macro they were imbedded in. 
  41.  
  42.  
  43. ΓòÉΓòÉΓòÉ 1.4. Version 1.8 ΓòÉΓòÉΓòÉ
  44.  
  45. All changes for release 1.8 are marked with a '8'. 
  46.  
  47.    o  Added support for nested include files 
  48.  
  49.    o  Added support for not including system include files (/S) 
  50.  
  51.    o  Added support for strings within string like "The string 'string'" 
  52.  
  53.    o  Fixed a bug where comments on C include files caused errors. 
  54.  
  55.  
  56. ΓòÉΓòÉΓòÉ 1.5. Version 1.7 ΓòÉΓòÉΓòÉ
  57.  
  58. All changes for release 1.7 are marked with a '7'. 
  59.  
  60.    o  Added expression evaluation support for C .H files. 
  61.  
  62.  
  63. ΓòÉΓòÉΓòÉ 1.6. Version 1.6 ΓòÉΓòÉΓòÉ
  64.  
  65. All changes for release 1.6 are marked with a '6'. 
  66.  
  67.    o  Added /N switch to NOT resolve bitmap paths. 
  68.  
  69.    o  Allowed for simple recursive symbols in C files. 
  70.  
  71.  
  72. ΓòÉΓòÉΓòÉ 1.7. Version 1.5 ΓòÉΓòÉΓòÉ
  73.  
  74. All changes for release 1.5 are marked with a '5'. 
  75.  
  76.    o  Partially resolved nested symbols leave partial result instead of 
  77.       original symbol. 
  78.  
  79.    o  All output goes to stdout instead of stderr. 
  80.  
  81.  
  82. ΓòÉΓòÉΓòÉ 1.8. Version 1.4 ΓòÉΓòÉΓòÉ
  83.  
  84. All changes for release 1.4 are marked with a '4'. 
  85.  
  86.    o  Added /V option to display lines as they are read in 
  87.  
  88.    o  Fixed nested symbol infinite loop. 
  89.  
  90.  
  91. ΓòÉΓòÉΓòÉ 1.9. Version 1.3 ΓòÉΓòÉΓòÉ
  92.  
  93. All changes for release 1.3 are marked with a '3'. 
  94.  
  95.    o  Allowed nested symbols (symbols within symbols). 
  96.  
  97.    o  Allowed positional parameters on macros. 
  98.  
  99.    o  Strip double quotes off of C #define symbols so they can be used as 
  100.       normal substitution variables. 
  101.  
  102.    o  Resolve bitmap file paths so that bitmaps can be in a seperate directory 
  103.       pointed to by the INCLUDE environment variable. 
  104.  
  105.  
  106. ΓòÉΓòÉΓòÉ 1.10. Version 1.2 ΓòÉΓòÉΓòÉ
  107.  
  108. All changes for release 1.2 are marked with a '2'. 
  109.  
  110.    o  Allowed script tags for macro definitions so that the IPFCPREP macros 
  111.       will print under Bookie. 
  112.  
  113.  
  114. ΓòÉΓòÉΓòÉ 1.11. Version 1.1 ΓòÉΓòÉΓòÉ
  115.  
  116. All changes for release 1.1 are marked with a '1'. 
  117.  
  118.    o  Added /W & -W to allow warning messages (default is now NO warning msgs) 
  119.  
  120.    o  Added ability to use /D along with -D 
  121.  
  122.    o  Fixed problem with command line definitions. 
  123.  
  124.    o  Fixed a bug with large number of files (I forgot to close files when I 
  125.       was finished with them). 
  126.  
  127.  
  128. ΓòÉΓòÉΓòÉ 2. Overview ΓòÉΓòÉΓòÉ
  129.  
  130.  
  131. ΓòÉΓòÉΓòÉ 2.1. What IPFCPREP does for you. ΓòÉΓòÉΓòÉ
  132.  
  133.    o  Allows you to have IPFC script files in different subdirectories. 
  134.  
  135.       The IPFCPREP program will look at the INCLUDE environment variable as it 
  136.       processes the imbed (.im) tags so that it can search more than the 
  137.       current subdirectory for script files. 
  138.  
  139.    o  Allows you to define symbols. 
  140.  
  141.       The IPFCPREP program allows the use of BookMaster .nameit tags with the 
  142.       symbol= and text= parameters. 
  143.  
  144.    o  Allows you to use C language header files to define symbols. 
  145.  
  146.       The IPFCPREP program will read in C language header files and use the 
  147.       #define statements as BookMaster .nameit tags. 
  148.  
  149.    o  Allows you to have conditional compile sections 
  150.  
  151.       The IPFCPREP program supports BookMaster Vanilla conditional compiles. 
  152.  
  153.    o  Allows you to have simple substitution macros. 
  154.  
  155.       The IPFCPREP will support the .dm tag to define simple macros that are 
  156.       used for text replacement only. Either keyword or positional parameters 
  157.       may be used. 
  158.  
  159.    o  Resolves bitmap file names to fully qualified path name. 
  160.  
  161.       Currently IPF requires the bitmap files be in the current directory. If 
  162.       multiple versions of a file are produced in different subdirectories, the 
  163.       bitmaps must be copied into every subdirectory. IPFCPREP will resolve the 
  164.       bitmap file's position using the INCLUDE environment variable and replace 
  165.       the bitmap file's name with a fully qualified path name in the artwork 
  166.       tag. It will also resolve the artwork linkfile's name. 
  167.  
  168.  
  169. ΓòÉΓòÉΓòÉ 2.2. Running IPFCPREP ΓòÉΓòÉΓòÉ
  170.  
  171. To run the IPFC preprocessor, type on the command line 
  172.  
  173. IPFCPREP input_file_name output_file_name [-V] [-W] [-D symbolname[=symbol_text]]
  174.  
  175.  Name                Definition 
  176.  input_file_name     Input script file 
  177.  output_file_name    Output script file 
  178.  /V, -V, /v, or -v   Flag to indicate you want lines printed out as they are 
  179.                      read in 
  180.  /W, -W, /w, or -w   Flag to indicate you want additional warning messages. 
  181.  /D, -D, /d, or -d   Flag to indicate a symbol definition 
  182.  /N, -N, /n, or -n   Flag to indicate a symbol definition 
  183.  /S, -S, /s, or -s   Flag to indicate not to include system include files, i.e. 
  184.                      files that are enclosed by '<' & '>'. 
  185.  symbolname          Name of symbol to be defined 
  186.  symbol_text         Text of defined symbol. 
  187.  
  188.                      This is optional. If no symbol_text is defined, the symbol 
  189.                      is put in the symbol table with no text (ex: for use on 
  190.                      conditional compiles). If text is defined, it can either 
  191.                      be a single word or multiple words inclosed in single 
  192.                      quotes. 
  193.  
  194.  
  195. ΓòÉΓòÉΓòÉ 2.2.1. Examples ΓòÉΓòÉΓòÉ
  196.  
  197. The following will preprocess the test.scr file into the test.ipf file. 
  198.  
  199. ipfcprep test.scr test.ipf
  200.  
  201. The following will preprocess the test.scr file into the test.ipf file and 
  202. define one symbol called HOST. 
  203.  
  204. ipfcprep test.scr test.ipf -D HOST
  205.  
  206. The following will preprocess the test.scr file into the test.ipf file and 
  207. define one symbol called HOST with the text Mainframe. 
  208.  
  209. ipfcprep test.scr test.ipf -D HOST=MainFrame
  210.  
  211. The following will preprocess the test.scr file into the test.ipf file and 
  212. define one symbol called HOST with the text IBM Mainframe. 
  213.  
  214. ipfcprep test.scr test.ipf -D HOST='IBM MainFrame'
  215.  
  216. The following will preprocess the test.scr file into the test.ipf file, define 
  217. one symbol called HOST with the text IBM Mainframe, and define a symbol called 
  218. PC 
  219.  
  220. ipfcprep test.scr test.ipf -D HOST='IBM MainFrame' -D PC
  221.  
  222. The following will preprocess the test.scr file into the test.ipf file, define 
  223. one symbol called HOST with the text IBM Mainframe, define a symbol called PC 
  224. and turn on those annoying warning messages. 
  225.  
  226. ipfcprep test.scr test.ipf -D HOST='IBM MainFrame' /D PC /W
  227.  
  228.  
  229. ΓòÉΓòÉΓòÉ 3. Reference ΓòÉΓòÉΓòÉ
  230.  
  231.  
  232. ΓòÉΓòÉΓòÉ 3.1. Imbedding Files from Other Subdirectories ΓòÉΓòÉΓòÉ
  233.  
  234. To have the IPFC preprocessor pull in imbedded files from other subdirectories, 
  235. set up the INCLUDE environment variable with the path(s) to search. 
  236.  
  237. IPFCPREP will also resolve the bitmap name or linkfile name in an artwork tag 
  238. using the INCLUDE environment variable. This can be turned off using the /N 
  239. switch on the command line. 
  240.  
  241.  
  242. ΓòÉΓòÉΓòÉ 3.1.1. Example ΓòÉΓòÉΓòÉ
  243.  
  244. After the include environment variable is set as shown by the following 
  245. command, the IPFCPREP will search the C:\HELPDIR1 & C:\HELPDIR2 subdirectories 
  246. after checking the current subdirectory for an imbed file. 
  247.  
  248. SET INCLUDE=C:\HELPDIR1;C:\HELPDIR2;
  249.  
  250. For artwork tags, resolving will make a artwork tag that looks like 
  251.  
  252. :artwork name='IPFCPREP.BMP' linkfile='IPFCPREP.LNK'.
  253.  
  254. into a tag that looks like 
  255.  
  256. :artwork name='C:\HELPDIR1\IPFCPREP.BMP' linkfile='C:\HELPDIR1\IPFCPREP.LNK'.
  257.  
  258.  
  259. ΓòÉΓòÉΓòÉ 3.2. Defining Symbols ΓòÉΓòÉΓòÉ
  260.  
  261. To define symbols, use the same method as in BookMaster with .nameit tags. 
  262. IPFCPREP does not allow the GMLTYPE or SIZE parameters however. If you want 
  263. those, you must create a simple macro described later. 
  264.  
  265. To use the symbol in the file, put an ampersand (&) before the symbol and a 
  266. period (.) after it. The period after the symbol is required. 
  267.  
  268. Symbols may be within symbols (nested symbols). The innermost symbol will be 
  269. resolved first and then the resulting text will be used to search for the 
  270. remaining symbol. 
  271.  
  272. Currently, the maximum symbol size after everything is resolved is about 250 
  273. character bytes. 
  274.  
  275.  
  276. ΓòÉΓòÉΓòÉ 3.2.1. Examples ΓòÉΓòÉΓòÉ
  277.  
  278. The following line will create a symbol called goofy and a symbol called MM 
  279. with the text for the first being 'Goofy' and the second being 'Mickey Mouse'. 
  280.  
  281. .nameit symbol=goofy text='Goofy'
  282. .nameit symbol=MM text='Mickey Mouse'
  283.  
  284. Now if those are used in the following sentences 
  285.  
  286. I went to Disney World and saw &goofy. and &MM..
  287.  
  288. The text will come out like 
  289.  
  290. I went to Disney World and saw Goofy and Mickey Mouse.
  291.  
  292. The following demonstrates the use of nested symbols. 
  293.  
  294. .nameit symbol=mightm text='Mighty Mouse'
  295. .nameit symbol=mickm text='Mickey Mouse'
  296.  
  297. Now if those are used in the following sentence 
  298.  
  299. I went to Disney World and saw  &&mouse_name.m..
  300.  
  301. The text will come out like 
  302.  
  303. I went to Disney World and saw Mickey Mouse.
  304.  
  305. when &mouse_name. is set to 'mick', or it will come out like 
  306.  
  307. I went to Disney World and saw Mighty Mouse.
  308.  
  309. when &mouse_name. is set to 'might'. 
  310.  
  311.  
  312. ΓòÉΓòÉΓòÉ 3.3. Using C Language define files ΓòÉΓòÉΓòÉ
  313.  
  314. To use symbols in a C language header files, you must use the .imd tag to imbed 
  315. the header file. Then all defines of the form 
  316.  
  317. #define symbol_name integer_value
  318. or 
  319.  
  320. #define symbol_name "string"
  321. or 
  322.  
  323. #define symbol_name2 symbol_name1
  324. or 
  325.  
  326. #define symbol_name expression
  327.  
  328. will be put into the symbol table. 
  329.  
  330. The integer version is mainly used in defining the resource id on a :h1. tag so 
  331. that you can have one file define your panel resource IDs. 
  332.  
  333. The string version is used to define text symbols similar to .namemit tags. 
  334. Wherever symbol_name is used the string (without the double quotes) will be 
  335. substituted. This is useful in using the same string that is in a .MRI file in 
  336. the text for a help panel to eliminate differences. 
  337.  
  338. The symbol set to another symbol is a method to assign the same value to two 
  339. different symbol names. If the value after a symbol name matches any previously 
  340. defined symbol name (whether it be C #defines or .nameit tags) the value of the 
  341. previously defined symbol will be used. 
  342.  
  343. The symbol set to an expression is commonly used in C header files to base all 
  344. symbols off of one with an offset such as the following: 
  345.  
  346. #define START   1000
  347. #define PANEL_1 (START + 1)
  348. #define PANEL_2 (START + 2)
  349.  
  350. IPFCPREP will allow the +, -, *, and / operators. It will evaluate expressions 
  351. from left to right without regard to operator precedence. If you want 
  352. precedence, you can use parentheses. 
  353.  
  354. This will also search all subdirectories defined by the INCLUDE environment 
  355. variable after searching the current directory for the specified file. 
  356.  
  357. An include file can include other include files defined by the #include 
  358. compiler directive. You can disable the including of system include files by 
  359. using the /S command line option. This will not include any #include file that 
  360. is enclosed in '< >'. 
  361.  
  362. Currently, the maximum symbol size after everything is resolved is about 120 
  363. character bytes. 
  364.  
  365. IPFCPREP now supports some compiler directives, namely, #ifdef and #ifndef. 
  366. IPFCPREP will determine if the symbol referenced by these lines exists or not 
  367. and process or not process the lines that follow. #else used with #ifdefs or 
  368. #ifndefs is also allowed. 
  369.  
  370. IPFCPREP does not handle the #if or #elif lines currently due to IPFCPREP's 
  371. lack of logical expression evaluation. #else used with #if or #elif is ignored 
  372. also. 
  373.  
  374.  
  375. ΓòÉΓòÉΓòÉ 3.3.1. Example ΓòÉΓòÉΓòÉ
  376.  
  377. To include the 'test.h' C language define file in the document use the 
  378. following line in the script file 
  379.  
  380. .imd test.h
  381.  
  382. Now if the C header file had the statement 
  383.  
  384. #define HELP_PANEL_1 100
  385.  
  386. And the script file contained the line 
  387.  
  388. :h1 res=&HELP_PANEL_1..
  389.  
  390. The preprocessor will resolve it to 
  391.  
  392. :h1 res=100.
  393.  
  394.  
  395. ΓòÉΓòÉΓòÉ 3.4. Using Bookmaster 2.0 Vanilla conditional compiles ΓòÉΓòÉΓòÉ
  396.  
  397. The best reference for this is the BookMaster document, but I will put a short 
  398. exerpt here. 
  399.  
  400. The conditional compiles use two main tags, the .CONFIG & .WHEN tags. .CONFIG 
  401. tags start and end conditional compile sections and the .WHEN tags instruct the 
  402. preprocessor to insert or delete lines based on a conditions. 
  403.  
  404. The .CONFIG tag looks like 
  405.  
  406. .CONFIG config_name ON ! OFF
  407.  
  408. The config_name is used to match the ON and OFF statements. Nested config 
  409. statements are allowed. 
  410.  
  411. The .WHEN tag looks like 
  412.  
  413. .WHEN 'condition-expression' INSERT ! DELETE
  414.  
  415. The condition-expression is a symbol or group of symbols that are defined or 
  416. not defined to determine if the expression is TRUE. This may take the form of 
  417.  
  418. 'symbol1 symbol2 ... symboln'
  419.  
  420. which will AND the symbols together or 
  421.  
  422. 'symbol1 or symbol2 or ... or symboln'
  423.  
  424. which will OR the symbols together. Symbols may also be negated such as 
  425.  
  426. 'not symbol1 or symbol2'
  427.  
  428. When the condition is TRUE, the lines following the .WHEN line are either 
  429. inserted or deleted depending on the INSERT or DELETE following the conditional 
  430. expression. If the conditional-expression is FALSE, the opposite operation is 
  431. performed, i.e. lines will be deleted if INSERT is specified and lines will be 
  432. inserted if DELETE is specified. 
  433.  
  434.  
  435. ΓòÉΓòÉΓòÉ 3.4.1. Example ΓòÉΓòÉΓòÉ
  436.  
  437. For example, the conditional compile 
  438.  
  439. .config section1 on
  440. .when 'PC' insert
  441. This is processed on a PC.
  442. .when 'HOST' insert
  443. This is processed on the big iron.
  444. .config section1 off
  445.  
  446. will produce 'This is processed on a PC.' when IPFCPREP is invoked like 
  447.  
  448. ipfcprep in.scr out.ipf -D PC
  449.  
  450. and will produce 'This is processed on the big iron.' when IPFCPREP is invoked 
  451. like 
  452.  
  453. ipfcprep in.scr out.ipf -D HOST
  454.  
  455.  
  456. ΓòÉΓòÉΓòÉ 3.5. Using Simple Macros ΓòÉΓòÉΓòÉ
  457.  
  458. Macros in the IPFCPREP is a simple way to substitute lines of text for a single 
  459. tag. This does not do any math or fancy macro stuff, just simple text 
  460. substitution. 
  461.  
  462. Macros start with a '.dm macro-name on' tag and end with a '.dm off' tag. All 
  463. text between the those two lines is part of the macro. 
  464.  
  465. The macro is invoked by specifying a colon (:), the macro name, any parameters, 
  466. and finally a period (.). The period at the end of the macro is required. 
  467.  
  468.  
  469. ΓòÉΓòÉΓòÉ 3.5.1. Example ΓòÉΓòÉΓòÉ
  470.  
  471. For example, the macro 
  472.  
  473. .dm testmac on
  474. This macro prints out &text. when invoked
  475. .dm off
  476.  
  477. will produce 
  478.  
  479. This macro prints out garbage when invoked.
  480.  
  481. when it is called like 
  482.  
  483. :testmac text=garbage.
  484.  
  485. It will also produce 
  486.  
  487. This macro prints out tons of garbage when invoked.
  488.  
  489. when it is called like 
  490.  
  491. :testmac text='tons of garbage'.
  492.  
  493. Another example, the macro 
  494.  
  495. .dm user_resp on
  496. :hp1.&resp.:ehp1.
  497. .dm off
  498.  
  499. will produce 
  500.  
  501. The user response is :hp1.Quit:ehp1..
  502.  
  503. when it is called like 
  504.  
  505. The user response is :user_resp resp=Quit..
  506.  
  507.  
  508. ΓòÉΓòÉΓòÉ 3.6. Using Simple Macros that can be used in BookMaster ΓòÉΓòÉΓòÉ
  509.  
  510. To make these macros work under BookMaster, you must structure the macro 
  511. slightly different. You must 
  512.  
  513.    o  Add a '.gs attval parm_keyname_1 parm_keyname2 ...' line after the '.dm 
  514.       macro_name' line so that the values are assigned in BookMaster. 
  515.  
  516.    o  Add a '.aa tag_name start_macro_name end_macro_name' after the '.dm off' 
  517.       line so that you can reference the macros start_macro_name and 
  518.       end_macro_name by :tag_name. & :etag_name. 
  519.  
  520.    o  Make sure all substitution variables on the tag line are used in 
  521.       uppercase. 
  522.  
  523.  
  524. ΓòÉΓòÉΓòÉ 3.6.1. Example ΓòÉΓòÉΓòÉ
  525.  
  526. For example, the macro 
  527.  
  528. .dm testmac on
  529. .gs attval text
  530. This macro prints out &TEXT. when invoked
  531. .dm off
  532. .aa test testmac
  533.  
  534. will produce 
  535.  
  536. This macro prints out garbage when invoked.
  537.  
  538. when it is called like 
  539.  
  540. :test text=garbage.
  541.  
  542. It will also produce 
  543.  
  544. This macro prints out tons of garbage when invoked.
  545.  
  546. when it is called like 
  547.  
  548. :test text='tons of garbage'.
  549.  
  550. Another example, the macro 
  551.  
  552. .dm strtlist on
  553. :ul.
  554. .dm off
  555.  
  556. .dm endlist on
  557. :eul.
  558. .dm off
  559.  
  560. .aa list strtlist endlist
  561.  
  562. .dm listitem on
  563. :li.
  564. .dm off
  565.  
  566. .aa item listitem
  567.  
  568. will produce 
  569.  
  570. :ul.
  571. :li.Text
  572. :eul.
  573.  
  574. when it is called like 
  575.  
  576. :list.
  577. :item.Text
  578. :elist.
  579.  
  580.  
  581. ΓòÉΓòÉΓòÉ 3.7. Using Positional Parameters on Macros ΓòÉΓòÉΓòÉ
  582.  
  583. Positional parameters *, and *1 throught *n may be used in macros instead of 
  584. keyword parameters. 
  585.  
  586.  
  587. ΓòÉΓòÉΓòÉ 3.7.1. Example ΓòÉΓòÉΓòÉ
  588.  
  589. For example, the macro 
  590.  
  591. .dm posmac on
  592. All parms are :*..
  593. This is the first parm = &*1..
  594. This is the second parm = &*2..
  595. This is the third parm = &*3..
  596. This is the fourth parm = &*4..
  597. . off
  598.  
  599. will produce 
  600.  
  601. All parms are Mickey Mouse loves Minnie.
  602. This is the first parm = Mickey.
  603. This is the second parm = Mouse.
  604. This is the third parm = loves.
  605. This is the fourth parm = Minnie.
  606.  
  607. when it is called like 
  608.  
  609. :posmac Mickey Mouse loves Minnie.
  610.  
  611. It will also produce 
  612.  
  613. All parms are Mickey Mouse loves nobody.
  614. This is the first parm = Mickey.
  615. This is the second parm = Mouse.
  616. This is the third parm = loves.
  617. This is the fourth parm = nobody.
  618.  
  619. when it is called like 
  620.  
  621. :posmac Mickey Mouse loves nobody.
  622.