home *** CD-ROM | disk | FTP | other *** search
- ***************** Flow Chart Design Language Examples *********************
- Cut these examples, load them in your editor and compile them to familiarize
- yourself with the Flow Chart Design Language (FDL)
-
- {* EXAMPLE #1 : PROGRAM BRKSTR *}
-
- ^program BRKSTR.C;
- ^module brkstr();
- ^header Module brkstr();
- ^footer Module brkstr();
- ^date dec 14 1991;
-
- Clear the blank point array, BLNK_PTS;
- While not the end of the input string do
- if input string character = blank then
- store the position of the blank in the BLNK_PTS;
- endif;
- increment the character position counter;
- endwhile;
- Save last character position in BLNK_PTS for the end of string;
-
- Set j = number of stored blanks;
-
- for i = 0 j + 1 do
- If block = UNTIL or WHILE or IF then
- Set the variable MAXLEN = 16;
- endif;
- If block = FOR or PROCESS then
- Set MAXLEN = 18;
- endif;
- If block = CALL then
- Set MAXLEN = 17;
- endif;
- If Any words in the string > MAXLEN then
- Call cg_error and pass it the input string;
- Increment the code generator error count;
- endif;
- endfor;
-
- While All words not processed do
- If Exceeded number of substrings then
- CALL cg_error and pass it the input string;
- Increment the code generator error count;
- endif;
- Clear the temporary string buffer;
- While Substring length <= length allowed do
- Copy next word into temporary buffer;
- Ife All words not processed then
- Set variable FIT = 1;
- else
- Set variable FIT = 0;
- CALL writ_str() to write the string to the output file;
- Break out of while loop;
- endelse;
- endwhile;
- If Fit = 1 then
- Append an EOL to the temporary buffer;
- CALL writ_str() to write the string to the output file;
- endif;
- Increment the number of substrings;
- endwhile;
- ife Error count = 0 then
- Return a successful status to the calling module;
- else
- Return a CANCELED status to the calling module;
- endelse;
- ^endmod Return To Caller;
-
- ^module cg_error();
- ^header Module cg_error();
- ^footer Module cg_error();
- ^date nov 6 1988;
-
- Build the error string to indicate the input string doesn't fit;
- CALL put_msg() to write the error string on the console;
- ^endmod Return To Caller;
-
- ^module writ_str;
- ^header Module writ_str();
- ^footer Module writ_str();
- ^date nov 6 1988;
-
- call center() to get the coords to center the string;
- call put_xy() to write the x,y coords;
- Write the string to the output file;
- ^endmod Return To Caller;
- ^endprg;
-
- ***************** Flow Chart Design Language Examples *********************
-
- {** EXAMPLE #2 **}
- ^program COMPILER.TST;
- ^module One;
- ^date Oct 22 1988;
- ^header MODULE One;
- ^footer MODULE One;
-
- Initialize x;
- While x != 10 do
- Input a number;
- Multiple the number by 12;
- If result > 144 then
- set an error indication;
- for x = maxval 0 - 4 do
- for z = minval maxval + 2 do
- test the for statements;
- clear another array!;
- endfor;
- ife this is working then
- perform this;
- else
- perform that;
- endelse;
- endfor;
- Endif;
- increment x;
- Endwhile;
- If error exists then
- output message to the screen;
- increment the error count;
- clear all variables;
- endif;
- call Module Two to perform more number operations;
- for x = 100 0 -1 do
- y = y * x;
- print y;
- y = y/34;
- endfor;
- ^endmod Exit Program;
-
- ^module Two;
- ^header MODULE Two;
- ^footer MODULE Two;
- ^date Oct 23 1988;
-
- Repeat
- input a number;
- If the number is negative then
- prompt the user, get another input;
- endif;
- Until the number is positive;
- Call module Three for test purposes;
- While the number < 100 do
- multiply the number by 10;
- divide the number by 7;
- Endwhile;
- ^endmod Return to Caller;
-
- {***^program Test;***}
- ^module Three;
- ^date Nov 19 1989;
- ^header Selection Test;
- ^footer Selection Test;
-
- This is a test of;
- the module and page selector;
- Ife this doesn't work then
- I'll have to do some more debugging;
- I'm testing this program now to see if the;
- on-page connectors will go to lower case;
- else
- I'll try to work on the print routine;
- need to fill in more blocks;
- endelse;
- If this exceeds complexity then
- I'll fix it;
- endif;
- While I'm doing that do
- I'll keep trying to create;
- sample modules to test the flow chart compiler on;
- endwhile;
- While x != 10 do
- Input a number;
- Multiple the number by 12;
- If result > 144 then
- set an error indication;
- for x = maxval 0 - 4 do
- for z = minval maxval + 2 do
- test the for statements;
- clear another array!;
- endfor;
- ife this is working then
- perform this;
- else
- perform that;
- endelse;
- endfor;
- Endif;
- increment x;
- Endwhile;
-
- Another test of the FCC; {**}
- this is an attempt to create a page 4;
- I am just typing in any text;
- to create blocks for another page;{**}
- {*** If this doesn't create page 4 then
- I'll have to type in more stuff;
- endif; **}
-
- Move the next block down in field #2;
- Also add more filler in to test the increment of;
- the on and off page connectors;
-
- repeat
- repeat
- Saddam Hussein will not rule;
- the region will be more stable;
- until the ground war is over;
- more fill in to test the flow chart compiler;
- until we win the war with Iraq;
- {***************}
- for a = 5 0 -1 do
- this is a test of the module;
- that adds a WHILPAGRT block to the;
- block stack when the a WHILE block follows ;
- an IFE block and the WHILE block has to be ;
- placed on another page;
- endfor;
-
- Repeat
- 4+4 = 8; 8+8 = 16/1;
- if 8 < 7 then 7 > 6;
- endif;
- until 4+4 > 9;
- While page 4 doesn't exist do
- {**} type more stuff;
- I'm feeling sick today;
- too bad;
- I hope I'll get better by tomorrow;
- me too;
- endwhile;
- {**}this is a test;
- this is only a test;
- if this were a real drill then
- you would be contacted;
- {**} by someone impotent;
- endif;
- ^endmod Return to Caller;
-
- ^endprg;
-