home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a070 / 3.ddi / FOXPRO / TEMPLGEN / AP1B.GEN < prev    next >
Encoding:
Text File  |  1988-02-09  |  3.7 KB  |  140 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. <<*---OPEN vars---*>>
  11. integer SCREENWIDTH
  12.  
  13. <<*---GENVARS vars---*>>
  14. string  fldprefix
  15.  
  16. <<*---FEATURE vars---*>>
  17. integer features
  18. integer featals,featlabel
  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 'GENSAY.INC'#>>   <<*To generate @row,col SAY,etc.*>>
  31. <<#include 'GENSTR.INC'#>>   <<*General string functions*>>
  32. <<#include 'GENVARS.INC'#>>  <<*Contains fixfldnam,GenMemVars,etc.*>>
  33. <<#include 'GENFILE.INC'#>>  <<*Contains GenHeader,GenFooter,etc.*>>
  34. <<#include 'GENCOLOR.INC'#>> <<*Contains GenColor,etc.*>>
  35. <<*---Application---*>>
  36. <<#include 'Ap1FILE.INC'#>>  <<*General routines used by others*>>
  37. <<#include 'Ap1PRIV.INC'#>>  <<*Special routines for APPE/EDIT*>>
  38. <<#include 'Ap1MAIN.INC'#>>
  39. <<#include 'Ap1OPEN.INC'#>>
  40. <<#include 'Ap1EDONE.INC'#>>
  41. <<#include 'Ap1EDIT.INC'#>>
  42. <<#include 'Ap1APPE.INC'#>>
  43. <<#include 'Ap1LAB1.INC'#>>
  44. <<#include 'REPUTIL.INC'#>>
  45. <<#include 'Ap1RPT1.INC'#>>
  46. <<#pragma
  47.  
  48.  
  49. procedure GenMainPrg
  50. begin
  51.   <<* 'prgname' includes PATHNAME *>>
  52.   if OpenFile( prgname,'MAIN program for ' + datafile + '.DBF' )
  53.     GenMainBody
  54.     GenFooter( prgname )
  55.   end
  56. end <<*GenMainPrg*>>
  57.  
  58.  
  59. procedure GenPrograms
  60. string  fspec,filename
  61. begin
  62.   filename := datafile + '.DBF'
  63.   fspec := pathfileprefix + '_OPEN.PRG'
  64.   if OpenFile( fspec,'OPEN program for ' + filename )
  65.     GenOpenBody
  66.     GenFooter( fspec )
  67.   end
  68.   fspec := pathfileprefix + '_EDIT.PRG'
  69.   if OpenFile( fspec,'EDIT program for ' + filename )
  70.     GenEditBody
  71.     GenFooter( fspec )
  72.   end
  73.   fspec := pathfileprefix + '_APPE.PRG'
  74.   if OpenFile( fspec,'APPEND program for ' + filename )
  75.     GenAppendBody
  76.     GenFooter( fspec )
  77.   end
  78.   select all
  79.   select database 1
  80.   if feat(featlabel)
  81.     fspec := pathfileprefix + '_1LAB.PRG'
  82.     if OpenFile( fspec,'Print ONE LABEL program for ' + filename )
  83.       GenOneLabel
  84.       GenFooter( fspec )
  85.     endif
  86.     fspec := pathfileprefix + '_1RPT.PRG'
  87.     if OpenFile( fspec,'Print SINGLE RECORD program for ' + filename )
  88.       GenOneReport
  89.       GenFooter( fspec )
  90.     endif
  91.   endif
  92. end <<*GenPrograms*>>
  93.  
  94.  
  95. procedure InitVariables
  96. begin
  97.   SCREENWIDTH := 0
  98.   fldprefix := 'm'   <<*FIELD_NAME prefix when using memvars*>>
  99.   select all
  100.   ismultipage := (pagtotal > 1)
  101.   ismultials := (dbftotal > 1)
  102.   ismultindx := false
  103.   forall databases
  104.     if ndxtotal > 1
  105.       ismultindx := true
  106.     endif
  107.   endfor
  108.   <<*---Select Menu Type---*>>
  109.   Bracketed := (menutype = 0)  <<*Default, if they press ESC*>>
  110.   Simple    := (menutype = 1)
  111.   Bracketed := (menutype = 2)
  112.   LiteBar   := (menutype = 3)
  113.   featlabel := 2
  114.   pathfileprefix := prgpath + fileprefix
  115. end <<*InitVariables*>>
  116.  
  117.  
  118. procedure InitFromStack
  119. begin
  120.   <<*---Restore stack variables in REVERSE order---*>>
  121.   pop( prgpath )       <<*Pathname of main program to generate*>>
  122.   pop( prgname )       <<*Filename of main program to generate*>>
  123.   pop( fileprefix )    <<*Three letter file prefix*>>
  124.   pop( datafile )      <<*filename of PRIMARY database file*>>
  125.   pop( menutype )      <<*Menu/Submenu prompt type*>>
  126.   pop( features )      <<*feature combinations*>>
  127. end <<*InitFromStack*>>
  128.  
  129.  
  130. begin <<*MAIN*>>
  131.   InitFromStack
  132.   InitVariables
  133.   select all
  134.   GenMainPrg
  135.   GenPrograms
  136. end
  137.  
  138. <<*EOF: APPS.GEN*>>
  139. #>>
  140.