home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / AP1C.GEN < prev    next >
Encoding:
Text File  |  1988-02-11  |  4.3 KB  |  182 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 ismultipage,ismultials,ismultindx
  8. integer menutype
  9.  
  10. <<*---BROWSE vars---*>>
  11. integer SCREENWIDTH
  12. integer PageIndent,PageWidth,panmax
  13. logical IsBigWid
  14. integer headlen,datalen
  15.  
  16. <<*---FEATURE vars---*>>
  17. integer features
  18. integer featals,featlabel,featbrowse
  19.  
  20.  
  21. function feat( num : integer ) : logical
  22. <<*16-bit feature combinations (1...16)*>>
  23. <<*bits: 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,-32768*>>
  24. begin
  25.   RETURN (features and num) <> 0
  26. end feat
  27.  
  28. #>>
  29. <<*---General modules---*>>
  30. <<#include 'GENFILE.INC'#>>  <<*Contains GenHeader,GenFooter,etc.*>>
  31. <<#include 'GENCOLOR.INC'#>> <<*Contains GenColor,etc.*>>
  32. <<*---Application---*>>
  33. <<#include 'Ap1SETB.INC'#>>
  34. <<#include 'Ap1BROW.INC'#>>
  35. <<#include 'Ap1DISP.INC'#>>
  36. <<#include 'Ap1QUERY.INC'#>>
  37. <<#include 'Ap1EXPR.INC'#>>
  38. <<#include 'Ap1PHRA.INC'#>>
  39. <<#include 'Ap1COND.INC'#>>
  40. <<#pragma
  41.  
  42.  
  43. procedure GenCommonPrgs
  44. string fspec,filename
  45. begin
  46.   select all
  47.   select database 1
  48.   filename := datafile + '.DBF'
  49.   fspec := pathfileprefix + '_BROW.PRG'
  50.   InitBrowse
  51.   if OpenFile( fspec,'BROWSE program for ' + filename )
  52.     if (fldtotal > 0) or ismultials
  53.       GenBrowseBody
  54.     else
  55.       GenBrowseSimple
  56.     endif
  57.     GenFooter( fspec )
  58.   endif
  59.   select all
  60.   fspec := pathfileprefix + '_EXPR.PRG'
  61.   if OpenFile( fspec,'EXPRESSION program for ' + filename )
  62.     GenExprBody
  63.     GenFooter( fspec )
  64.   endif
  65.   fspec := pathfileprefix + '_COND.PRG'
  66.   if OpenFile( fspec,'CONDITION program for ' + filename )
  67.     GenCondMain(True)
  68.     GenFooter( fspec )
  69.   endif
  70. end GenCommonPrgs
  71.  
  72.  
  73. procedure GenDisplayPrg
  74. string fspec,filename,alpha
  75. begin
  76.   select all
  77.   filename := datafile + '.DBF'
  78.   forall databases
  79.     InitBrowse
  80.     if ismultials
  81.       fspec := pathfileprefix + '_' + chr( dbfcount + 64 ) + 'DIS.PRG'
  82.     else
  83.       fspec := pathfileprefix + '_DISP.PRG'
  84.     endif
  85.     if fldtotal > 0
  86.       if OpenFile( fspec,'DISPLAY program for ' + filename )
  87.         GenDisplayBody
  88.         GenFooter( fspec )
  89.       endif
  90.     endif
  91.   endfor
  92. end GenDisplayPrg
  93.  
  94.  
  95. procedure GenAllPhrase
  96. string fspec,filename
  97. begin
  98.   select all databases
  99.   filename := datafile + '.DBF'
  100.   if fldtotal > 0
  101.     fspec := pathfileprefix + '_PHRA.PRG'
  102.     if OpenFile( fspec,'PHRASE program for ' + filename )
  103.       GenPhraseBody
  104.       GenFooter( fspec )
  105.     endif
  106.   endif
  107. end GenAllPhrase
  108.  
  109.  
  110. procedure GenMultiPhrase
  111. string fspec,filename,alpha
  112. begin
  113.   select all
  114.   filename := datafile + '.DBF'
  115.   forall databases
  116.     if ismultials
  117.       fspec := pathfileprefix + '_' + chr( dbfcount + 64 ) + 'PHR.PRG'
  118.     else
  119.       fspec := pathfileprefix + '_PHRA.PRG'
  120.     endif
  121.     if fldtotal > 0
  122.       if OpenFile( fspec,'PHRASE program for ' + filename )
  123.         GenPhraseBody
  124.         GenFooter( fspec )
  125.       endif
  126.     endif
  127.   endfor
  128. end GenMultiPhrase
  129.  
  130.  
  131. procedure InitVariables
  132. begin
  133.   featals := 1     <<*fldals in Query Table*>>
  134.   featlabel := 2
  135.   featbrowse := 4
  136.   SCREENWIDTH := 80
  137.   select all
  138.   ismultipage := (pagtotal > 1)
  139.   ismultials := (dbftotal > 1)
  140.   ismultindx := false
  141.   forall databases
  142.     if ndxtotal > 1
  143.       ismultindx := true
  144.     endif
  145.   endfor
  146.   <<*---Select Menu Type---*>>
  147.   Bracketed := (menutype = 0)  <<*Default, if they press ESC*>>
  148.   Simple    := (menutype = 1)
  149.   Bracketed := (menutype = 2)
  150.   LiteBar   := (menutype = 3)
  151.   pathfileprefix := prgpath + fileprefix
  152. end <<*InitVariables*>>
  153.  
  154.  
  155. procedure InitFromStack
  156. begin
  157.   <<*---Restore stack variables in REVERSE order---*>>
  158.   pop( prgpath )       <<*Pathname of main program to generate*>>
  159.   pop( prgname )       <<*Filename of main program to generate*>>
  160.   pop( fileprefix )    <<*Three letter file prefix*>>
  161.   pop( datafile )      <<*filename of PRIMARY database file*>>
  162.   pop( menutype )      <<*Menu/Submenu prompt type*>>
  163.   pop( features )      <<*feature combinations*>>
  164.   zapstack
  165. end <<*InitFromStack*>>
  166.  
  167.  
  168. begin <<*MAIN*>>
  169.   InitFromStack
  170.   InitVariables
  171.   GenCommonPrgs
  172.   GenDisplayPrg
  173.   if ismultials and feat(featals)
  174.     GenAllPhrase
  175.   else
  176.     GenMultiPhrase
  177.   endif
  178. end <<*MAIN*>>
  179.  
  180. <<*EOF: APPS.GEN*>>
  181. #>>
  182.