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

  1. <<#pragma
  2.  
  3. <<*---Declare global variables---*>>
  4. string  fpath,fname,fext
  5. string  prgpath,prgname,fileprefix,datafile,pathfileprefix
  6. logical Simple,Bracketed,LiteBar
  7. logical Fox
  8. logical ismultipage,ismultials,ismultindx
  9. integer menutype
  10.  
  11. <<*---BROWSE vars---*>>
  12. integer SCREENWIDTH
  13. integer PageIndent,PageWidth,panmax
  14. logical IsBigWid
  15. integer headlen,datalen
  16.  
  17. <<*---FEATURE vars---*>>
  18. integer features
  19. integer featals,featlabel,featbrowse
  20.  
  21.  
  22. function feat( num : integer ) : logical
  23. <<*16-bit feature combinations (1...16)*>>
  24. <<*bits: 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,-32768*>>
  25. begin
  26.   RETURN (features and num) <> 0
  27. end feat
  28.  
  29. #>>
  30. <<*---General modules---*>>
  31. <<#include 'GENFILE.INC'#>>  <<*Contains GenHeader,GenFooter,etc.*>>
  32. <<#include 'GENCOLOR.INC'#>> <<*Contains GenColor,etc.*>>
  33. <<#include 'SHADE.INC'#>>
  34. <<*---Application---*>>
  35. <<#include 'msaSETB.INC'#>>
  36. <<#include 'msaBROW.INC'#>>
  37. <<#include 'msaDISP.INC'#>>
  38. <<#include 'msaQUERY.INC'#>>
  39. <<#include 'msaEXPR.INC'#>>
  40. <<#include 'msaPHRA.INC'#>>
  41. <<#include 'msaCOND.INC'#>>
  42. <<#include 'msaMISC.INC'#>>
  43. <<#include 'msaINST.INC'#>>
  44. <<#include 'msaBAK.INC'#>>
  45. <<#include 'msaREST.INC'#>>
  46. <<#pragma
  47.  
  48.  
  49. procedure GenCommonPrgs
  50. string fspec,filename
  51. begin
  52.   select all
  53.   select database 1
  54.   filename := datafile + '.DBF'
  55.   fspec := pathfileprefix + '_BROW.PRG'
  56.   InitBrowse
  57.   if OpenFile( fspec,'BROWSE program for ' + filename )
  58.     if (fldtotal > 0) or ismultials
  59.        GenBrowseBody
  60.     else
  61.       GenBrowseSimple
  62.     endif
  63.     GenFooter( fspec )
  64.   endif
  65.   select all
  66.   fspec := pathfileprefix + '_EXPR.PRG'
  67.   if OpenFile( fspec,'EXPRESSION program for ' + filename )
  68.     GenExprBody
  69.     GenFooter( fspec )
  70.   endif
  71.   fspec := pathfileprefix + '_COND.PRG'
  72.   if OpenFile( fspec,'CONDITION program for ' + filename )
  73.     GenCondBody
  74.     GenFooter( fspec )
  75.   endif
  76.   fspec := pathfileprefix + '_MISC.PRG'
  77.   if OpenFile( fspec,'MISCELLANEOUS program for ' + filename )
  78.     GenMisc
  79.     GenFooter( fspec )
  80.   endif
  81.   fspec := pathfileprefix + '_INST.PRG'
  82.   if OpenFile( fspec,'INSTALL program for ' + filename )
  83.     GenInstall
  84.     GenFooter( fspec )
  85.   endif
  86.   fspec := pathfileprefix + '_BAK.PRG'
  87.   if OpenFile( fspec,'BACKUP program for ' + filename )
  88.     GenBak
  89.     GenFooter( fspec )
  90.   endif
  91.   fspec := pathfileprefix + '_REST.PRG'
  92.   if OpenFile( fspec,'RESTORE program for ' + filename )
  93.     GenRest
  94.     GenFooter( fspec )
  95.   endif
  96. end GenCommonPrgs
  97.  
  98.  
  99. procedure GenDisplayPrg
  100. string fspec,filename,alpha
  101. begin
  102.   select all
  103.   filename := datafile + '.DBF'
  104.   forall databases
  105.     InitBrowse
  106.     if ismultials
  107.       fspec := pathfileprefix + '_' + chr( dbfcount + 64 ) + 'DIS.PRG'
  108.     else
  109.       fspec := pathfileprefix + '_DISP.PRG'
  110.     endif
  111.     if fldtotal > 0
  112.       if OpenFile( fspec,'DISPLAY program for ' + filename )
  113.         GenDisplayBody
  114.         GenFooter( fspec )
  115.       endif
  116.     endif
  117.   endfor
  118. end GenDisplayPrg
  119.  
  120.  
  121. procedure GenAllPhrase
  122. string fspec,filename
  123. begin
  124.   select all databases
  125.   filename := datafile + '.DBF'
  126.   if fldtotal > 0
  127.     fspec := pathfileprefix + '_PHRA.PRG'
  128.     if OpenFile( fspec,'PHRASE program for ' + filename )
  129.       GenPhraseBody
  130.       GenFooter( fspec )
  131.     endif
  132.   endif
  133. end GenAllPhrase
  134.  
  135.  
  136. procedure GenMultiPhrase
  137. string fspec,filename,alpha
  138. begin
  139.   select all
  140.   filename := datafile + '.DBF'
  141.   forall databases
  142.     if ismultials
  143.       fspec := pathfileprefix + '_' + chr( dbfcount + 64 ) + 'PHR.PRG'
  144.     else
  145.       fspec := pathfileprefix + '_PHRA.PRG'
  146.     endif
  147.     if fldtotal > 0
  148.       if OpenFile( fspec,'PHRASE program for ' + filename )
  149.         GenPhraseBody
  150.         GenFooter( fspec )
  151.       endif
  152.     endif
  153.   endfor
  154. end GenMultiPhrase
  155.  
  156.  
  157. procedure InitVariables
  158. begin
  159.   featals := 1     <<*fldals in Query Table*>>
  160.   featlabel := 2
  161.   featbrowse := 4
  162.   SCREENWIDTH := 80
  163.   <<*---Init Product logical vars---*>>
  164.   Fox     := (ProductCode = 1)
  165.   select all
  166.   ismultipage := (pagtotal > 1)
  167.   ismultials := (dbftotal > 1)
  168.   ismultindx := false
  169.   forall databases
  170.     if ndxtotal > 1
  171.       ismultindx := true
  172.     endif
  173.   endfor
  174.   <<*---Select Menu Type---*>>
  175.   Bracketed := (menutype = 0)  <<*Default, if they press ESC*>>
  176.   Simple    := (menutype = 1)
  177.   Bracketed := (menutype = 2)
  178.   LiteBar   := (menutype = 3)
  179.   pathfileprefix := prgpath + fileprefix
  180. end <<*InitVariables*>>
  181.  
  182.  
  183. procedure InitFromStack
  184. begin
  185.   <<*---Restore stack variables in REVERSE order---*>>
  186.   pop( prgpath )       <<*Pathname of main program to generate*>>
  187.   pop( prgname )       <<*Filename of main program to generate*>>
  188.   pop( fileprefix )    <<*Three letter file prefix*>>
  189.   pop( datafile )      <<*filename of PRIMARY database file*>>
  190.   pop( menutype )      <<*Menu/Submenu prompt type*>>
  191.   pop( features )      <<*feature combinations*>>
  192.   zapstack
  193. end <<*InitFromStack*>>
  194.  
  195.  
  196. begin <<*MAIN*>>
  197.   InitFromStack
  198.   InitVariables
  199.   GenCommonPrgs
  200.   GenDisplayPrg
  201.   if ismultials and feat(featals)
  202.     GenAllPhrase
  203.   else
  204.     GenMultiPhrase
  205.   endif
  206. end <<*MAIN*>>
  207.  
  208. <<*EOF: MASC.GEN*>>
  209. #>>
  210.