>>* Program: SEGMENT.H >>* Description: VFP Language Extension - Segment Blocks >>* Created: 05/19/2019 08:07:03 EST >>* Developer: Gregory Lynn Reichert (GregReichert70@GMail.com) - UT #046387 >>* Compiler: Visual FoxPro 09.00.0000.7423 for Windows >>* Abstract: >>* Copyright: Copyright (c) 2019 GLR Software >>*============================================================ >>*--- Description -------------------------------------------- >>* FOR BETTER CODE READABILITY ONLY. >>* Creates a looping structures using a plain DO WHILE .T. / ENDDO. >>* >>*--- Maintenance -------------------------------------------- >>* Id Date By Description >>* 1 05/19/2019 GLR Initial Creation >>* 2 11/20/2019 GLR Added Tokens to fdkeywrd.dbf, and distibuted to all folder locations. >>* 3 07/07/2021 GLR Corrected the updating the Beautify utility use indent the SEGMENT blocks. >>* >>*--- Rules -------------------------------------------------- >>* - Follows the basic rules that apply to the DO WHILE / ENDDO commands. >>* - BEGIN_SEGMENT must have a END_SEGMENT. >>* - Any text following a SEGMENT command are ignored. The only exception is the BEGIN_SEGMENT; An .AND.<condition> can be added to extend the loop condition. >>* ( I use quote a string to help identify the Segment block. ) >>* >>*--- History ------------------------------------------------ >>*--- ToDo --------------------------------------------------- >>*------------------------------------------------------------ >>* Granting permission to write to the VFP folder. >>* 1. I selected the "C:\Program Files (x86)\Microsoft Visual FoxPro 9\" folder in the File Manager. >>* 2. Right-clicked the folder, and selected the "Properties". >>* 3. Selected the "Security" tab at the top. >>* 4. Clicked the "Edit..." button to open the "Security" dialog. >>* 5. In the "Group or user names:" listbox, selected the "users (SNOOPY\Users)" item. (computer name may vary on your machine.) >>* 6. In the "Permission for Users" listbox, checked the "Full Control" checkbox. >>* 7. Clicked the "Apply" button. A moment later... >>* 8. Clicked the "Ok" button to exit the "Security" dialog. >>* 9. Clicked the "Ok" button to close the "Properties" dialog. >>* 10. Now the VFP folder has the permission to be writen to. >>* >>*------------------------------------------------------------ >>*** Update the tables used by the Beautify.app and Documentation Wizard. >>* >>* Original Copies of the DBF are located in: >>* HOME() >>* HOME()\Tools\Analyzer >>* HOME()\Tools\xsource\VFPSource\Wizards\wzfoxdoc >>* HOME()\Wizards >>#IF .F. >> * After establishing write permission to the VFP folder. Run this code. >> CLOSE ALL >> SELECT * FROM (HOME()+"tools\analyzer\fdKeywrd.dbf") WHERE Token="Begin_Segment" INTO ARRAY aSegement >> IF _TALLY=0 >> INSERT INTO (HOME()+"tools\analyzer\fdKeywrd.dbf") (Token, CODE) VALUES ("Begin_Segment","I") >> INSERT INTO (HOME()+"tools\analyzer\fdKeywrd.dbf") (Token, CODE) VALUES ("End_Segment","U") >> ENDIF >> SELECT * FROM (HOME()+"wizards\fdKeywrd.dbf") WHERE Token="Begin_Segment" INTO ARRAY aSegement >> IF _TALLY=0 >> INSERT INTO (HOME()+"wizards\fdKeywrd.dbf") (Token, CODE) VALUES ("Begin_Segment","I") >> INSERT INTO (HOME()+"wizards\fdKeywrd.dbf") (Token, CODE) VALUES ("End_Segment","U") >> ENDIF >> >> SELECT * FROM (HOME()+"Tools\xsource\VFPSource\Wizards\wzfoxdoc\fdindent.dbf") WHERE Token="Begin_Segment" INTO ARRAY aSegement >> IF _TALLY=0 >> INSERT INTO (HOME()+"Tools\xsource\VFPSource\Wizards\wzfoxdoc\fdindent.dbf") (Token, CODE) VALUES ("BEGIN_SEGMENT","I") >> INSERT INTO (HOME()+"Tools\xsource\VFPSource\Wizards\wzfoxdoc\fdindent.dbf") (Token, CODE) VALUES ("END_SEGMENT","U") >> ENDIF >> CLOSE ALL >>#ENDIF >> >>*--- Examples ----------------------------------------------- >>#IF .F. >> ASSERT .F. >> opt = 1 >> BEGIN_SEGMENT "Test" >> DO CASE >> CASE opt=1 >> opt = 3 >> CONTINUE_SEGMENT "Test" && jump to '* do something' line. >> CASE opt=2 >> EXIT_SEGMENT "Test" && exit segment block >> CASE opt=3 >> opt = 2 >> REPEAT_SEGMENT "Test" && jump to start of segment >> ENDCASE >> * do something >> BEGIN_SEGMENT "something" >> * do more >> EXIT_SEGMENT "something" >> END_SEGMENT "something" >> END_SEGMENT "Test" >>#ENDIF >>*------------------------------------------------------------ >>* Directives Code Keywords. >> >>#DEFINE BEGIN_SEGMENT DO WHILE .T. >>#DEFINE CONTINUE_SEGMENT * CONTINUE Segment >>#DEFINE EXIT_SEGMENT EXIT >>#DEFINE REPEAT_SEGMENT LOOP >>#DEFINE END_SEGMENT ENDDO >> >>* >>* EOF SEGMENT.H >>* >>>>
>BEGIN_SEGMENT "Test" >#define Test AND >BEGIN_SEGMENT Test >>
>Do While .T. && Loop1 > ... >ENDDO &&.T. Loop1 >>Where the enddo is created by intelliscript, but this is a matter of taste.
> BEGIN_SEGMENT "something" > * do more > EXIT_SEGMENT "something" > END_SEGMENT "something" >>A bit superfluous code. Needless slowdown.
>#DEFINE Start_SEGMENT * >#DEFINE Stop_SEGMENT * > >Start_SEGMENT "something" > * do more >Stop_SEGMENT "something" >>might do
>? 2; > Start_SEGMENT 3 >>
>*SEGMENT "something" >?"do more" >*/SEGMENT "something" >>or short
>*something
>?"do more"
>*/something
>
>