home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a040 / 2.ddi / SHRWARE4.ARC / MSA_1.GEN < prev    next >
Encoding:
Text File  |  1988-06-06  |  4.3 KB  |  134 lines

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