home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / APPS1.GEN < prev    next >
Encoding:
Text File  |  1988-05-10  |  4.1 KB  |  129 lines

  1. <<* APPS.GEN (version 1.00) *>>
  2. <<#
  3. title 'File-Maintenance Application'
  4.  
  5. <<*---Declare global variables---*>>
  6. string  fpath,fname,fext
  7. string  prgpath,prgname,fileprefix,datafile
  8. integer menutype,group,features
  9. logical ismultials
  10. string  response,menutitle
  11.  
  12. <<*---FEATURE vars---*>>
  13. integer features
  14. integer featals,featlabel,featbrowse
  15.  
  16. <<*16-bit feature combinations (1...16)*>>
  17. <<*bits: 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,-32768*>>
  18.  
  19. #>>
  20. <<*---General modules---*>>
  21. <<#include 'GENPRG.INC'#>>    <<*Contains GetPrgName,etc.*>>
  22. <<#include 'GENFILE.INC'#>>   <<*Contains GenHeader,GenFooter,etc.*>>
  23. <<#include 'GENCOLOR.INC'#>>  <<*Contains GenColor*>>
  24. <<*---Application modules---*>>
  25. <<#include 'Ap1MENU.INC'#>>   <<*Contains main MENU(s)*>>
  26. <<#include 'Ap1CALL.INC'#>>   <<*Contains ExecGroup,etc.*>>
  27.  
  28. <<#
  29. procedure InitGlobals
  30. begin
  31.   filespec( prgname,fpath,fname,fext )   <<*split 'prgname' to get filename*>>
  32.   fileprefix := substr( fname+'___',1,3 )  <<*1st three letters as prefix*>>
  33.   select database 1
  34.   filespec( dbfnam,fpath,datafile,fext )  <<*Init 'datafile'*>>
  35.   select all                     <<*Reset all scoping*>>
  36.   ismultials := (dbftotal > 1)   <<*Using more than 1 database?*>>
  37.   set lmargin to 0               <<*No left  margin offset*>>
  38.   set rmargin to 255             <<*No right margin wrap-around*>>
  39.   set AutoMem to true            <<*Gen with memvars*>>
  40. end <<*InitGlobals*>>
  41.  
  42.  
  43. procedure SubProgram( filename : string )
  44. string fspec,response
  45. begin
  46.   filespec( Template,fpath,fname,fext )  <<*Get current path*>>
  47.   fspec := fpath + filename
  48.   if file( fspec )
  49.     <<*---Pass information to subprograms via USER STACK---*>>
  50.     zapstack
  51.     push( features )     <<*feature combinations*>>
  52.     push( menutype )     <<*Submenu prompt type*>>
  53.     push( datafile )     <<*filename of PRIMARY database file*>>
  54.     push( fileprefix )   <<*Three letter file prefix*>>
  55.     push( prgname )      <<*Filename of main program to generate*>>
  56.     push( prgpath )      <<*Pathname of main program to generate*>>
  57.     subprocess( fspec )
  58.   else
  59.     wait "File not found.  Cannot continue..." to response message fspec
  60.     HALT
  61.   endif
  62. end <<*SubProgram*>>
  63.  
  64.  
  65. procedure ExecGroups( group : integer )
  66. integer nextmenutype
  67. logical IsGroupAll,IsAllOthers
  68. logical IsGroup1,IsGroup2,IsGroup3,IsGroup4,IsGroup5
  69. begin
  70.   IsGroupAll := (group and  1) <> 0
  71.   IsGroup1 := (group and  2) <> 0
  72.   IsGroup2 := (group and  4) <> 0
  73.   IsGroup3 := (group and  8) <> 0
  74.   IsGroup4 := (group and 16) <> 0
  75.   IsGroup5 := (group and 32) <> 0
  76.   IsAllOthers := (group and (not 2)) <> 0
  77.   if IsGroupAll or IsGroup1
  78.     menutype := MainMenuType
  79.   endif
  80.   if IsAllOthers
  81.     nextmenutype := SubMenuType   <<*Save submenu selection*>>
  82.   endif
  83.   if IsGroupAll or IsGroup1
  84.     filespec( prgname,fpath,menutitle,fext )  <<*Assign global 'menutitle'*>>
  85.     GenMainMenu( menutype )
  86.   endif
  87.   menutype := nextmenutype  <<*"menutype" is passed onto groups*>>
  88.   if IsAllOthers
  89.     if IsGroupAll or IsGroup2
  90.       SubProgram( 'APPS1.000' )  <<*PROCEDURE file*>>
  91.     endif
  92.     if IsGroupAll or IsGroup3
  93.       SubProgram( 'APPS1.001' )  <<*MAIN/OPEN/APPE/EDIT*>>
  94.     endif
  95.     if IsGroupAll or IsGroup4
  96.       SubProgram( 'APPS1.002' )  <<*BROW/DISP/COND/EXPR/PHRA*>>
  97.     endif
  98.     if IsGroupAll or IsGroup5
  99.       SubProgram( 'APPS1.003' )  <<*HELP/LABE/PACK/REPO*>>
  100.     endif
  101.   endif
  102. end ExecGroups
  103.  
  104.  
  105. begin <<*MAIN*>>
  106.   if Table
  107.     prgname := GetPrgName( "Enter FILENAME of program to GENERATE" )
  108.     filespec( prgname,prgpath,fname,fext )
  109.     if prgname
  110.       InitGlobals
  111.       wait "Do you want Special Features? (y/n) " to response
  112.       if response = 'Y'
  113.         features := SelectFeatures
  114.       endif
  115.       group := 1  <<*all groups*>>
  116.       wait "Generate Specific Modules? (y/n) " to response
  117.       if response = 'Y'
  118.         group := SelectGroup   <<*select groups of programs to generate*>>
  119.       endif
  120.       ExecGroups( group )
  121.     endif
  122.   else
  123.     wait 'No FoxView Table is available '
  124.   endif
  125. end <<*MAIN*>>
  126.  
  127. <<*EOF: APPS.GEN*>>
  128. #>>
  129.