home *** CD-ROM | disk | FTP | other *** search
- <<* Advanced.gen *>>
- <<#
- title "FoxPro Advanced Application"
-
- <<* Declare global variables *>>
-
- string fmain,fproc,fpath,fname,fext
- string fmtmain,fmtpath,fmtname,fmtext
- string prgpath,fileprefix,datafile,fldprefix
- logical ismultials
- integer errnum,errfmt
- logical safetywason
-
-
- #>>
-
- <<* General modules *>>
-
- <<#include 'Profle.inc'#>> <<* Contains
-
- <<* Format Screen modules *>>
-
- <<#include 'Profrm.inc'#>>
-
- <<* Specific modules *>>
-
- <<#include 'Proproc.inc'#>>
-
- <<* Contains main MENU(s) *>>
-
- <<*<<#include 'Catmenu.inc'#>>*>>
-
- <<#include 'Promain.inc'#>>
- <<#include 'Proopen.inc'#>>
- <<#include 'Proedit.inc'#>>
- <<#include 'Prorepo.inc'#>>
- <<#include 'Prolabe.inc'#>>
- <<#
-
- <<* Function to get program name *>>
-
- function GetPrgName( prompt : string ) : string
- string fspec,fpath,fname,fext
- begin
- input prompt to fspec
- if fspec
- filespec( fspec,fpath,fname,fext )
- fspec := fname + '.PRG' <<* Force a '.PRG' extension *>>
- endif
-
- RETURN fspec
- end <<* GetPrgName *>>
-
- <<* Function to get format file name *>>
-
- function GetFmtName( prompt : string ) : string
- string fmtspec,fmtpath,fmtname,fmtext
- begin
- input prompt to fmtspec
- if fmtspec
- filespec( fmtspec,fmtpath,fmtname,fmtext )
- fmtspec := fmtname + '.FMT' <<* Force a '.FMT' extension *>>
- endif
-
- RETURN fmtspec
- end <<* GetFmtName *>>
-
- <<* Intialize environment *>>
-
- procedure initGlobals
- begin
- <<* set tabs to true *>>
- select database 1
- filespec( dbfnam,fpath,datafile,fext ) <<* Init 'datafile' *>>
- select all <<* Reset all scoping *>>
- ismultials :=(dbftotal >1) <<* Using more than 1 Database? *>>
- set lmargin to 0 <<* No left margin offset *>>
- end <<* InitGlobals *>>
-
- <<* Generate the main body of the procedure file *>>
-
- Procedure GenMainPrg
- begin
- <<* fmain includes pathname *>>
- IF OpenFile(fmain,'MAIN program for ' +datafile + '.DBF'
- GenMainBody
- end
- end <<* GenMainPrg *>>
-
- Procedure GenPrograms
- begin
- GenOpenBody
- GenEditBody
- GenReportBody
- GenLabelBody
- end <<* genPrograms *>>
-
- Procedure GenProcedures
- string fspec,filename
- integer ptype
- begin
- GenProcStandard
- GenProcSecond
- end<<* GenProcedures *>>
-
- begin <<* MAIN *>>
- if table
- fmain := GetPrgName( "Enter FILENAME of program to Generate" )
- fmtname := GetFmtName( "Enter FILENAME of format file to GENERATE" )
- if substr(Fmain,3,1) <> '.'
- fileprefix := lower(substr(Fmain,1,3)) <<* 1st three letters as prefix *>>
- endif
- if substr(Fmain,2,1) <> '.'
- fileprefix := lower(substr(Fmain,1,2))
- else
- fileprefix := lower(substr(Fmain,1,1))
- endif
- if fmain <> ''
- if safety
- set safety to false
- safetywason := true
- endif
- errnum := rewrite( fmain )
- if errnum = 0
- InitGlobals
- GenMainPrg
- GenPrograms
- GenProcedures
- if fmtname
- errfmt := rewrite( fmtname )
- if errfmt = 0
- GenBrowseFormat
- endif
- endif
- elseif errnum = 4096
- wait 'Cannot generate an active program'
- else
- wait 'Cannot open file'
- endif
-
-
- if safetywason
- set safety to true
- endif
- endif
- wait 'Foxpro Advanced Application completed.'
- else
- wait "No FoxView Table is available "
- endif
- end <<* MAIN *>>
- #>>
-
- <<* EOF: Foxpro Advanced Application *>>