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

  1. <<* FMTDRIV.INC *>>
  2.  
  3. <<procedure GenDriverPrg( fspec : string )>>
  4. <<begin>>
  5. SET TALK OFF
  6. SET BELL OFF
  7. SET STATUS OFF
  8. SET SCOREBOARD OFF
  9. * ---Open PROCEDURE file.
  10. SET PROCEDURE TO {fileprefix}_PROC
  11. * ---OPEN database file.
  12. SELECT A
  13. <<filespec( dbfnam,fpath,fname,fext )>>
  14. USE {fname}
  15. <<if ndxnam>>
  16.   <<filespec( ndxnam,fpath,fname,fext )>>
  17. SET INDEX TO {fname}
  18. <<endif>>
  19. * ---Initialize memory variables.
  20. PRIVATE;
  21.    ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
  22.    pageno,PageMax,isedited,IsBlank,IsUnique,;
  23.    choice,expr,Returnkey,PromptRow,PromptBar
  24. STORE .F. TO;
  25.    ScreenAtr,StatusAtr,WindowAtr,PromptAtr,HiliteAtr,;
  26.    pageno,PageMax,isedited,IsBlank,IsUnique,;
  27.    choice,expr,Returnkey,PromptRow,PromptBar
  28. <<if ismultipage>>
  29. STORE 1 TO pageno
  30. STORE {pagtotal} TO PageMax
  31. <<endif>>
  32. STORE .F. TO isedited,IsBlank,IsUnique
  33. STORE " " TO choice,expr,Returnkey
  34. PromptRow = 23
  35. PromptBar = REPLICATE( CHR(196),80 )
  36. * ---SET COLOR TO values.
  37. ScreenAtr = {"}{ScreenColor}"
  38. StatusAtr = {"}{StatusColor}"
  39. WindowAtr = {"}{WindowColor}"
  40. PromptAtr = {"}{PromptColor}"
  41. HiliteAtr = {"}{HiliteColor}"
  42. <<#
  43.   select all fields
  44.   select fields on (fldtyp $ 'CDLN') and (fldals <> 'M') and fldget
  45.   genln( '* ---Declare field memory variables.' )
  46.   GenFldList( 'PRIVATE;' )
  47.   GenFldList( 'STORE .F. TO;' )
  48. #>>
  49. * ---Process one record.
  50. * ---In this example, we process the TOP record.
  51. * ---(Assuming there is at least one record in the file!)
  52. GOTO TOP
  53. * ---Initialize memvars and display record.
  54. DO {fileprefix}_STOR
  55. DO {fileprefix}_FORM
  56. DO {fileprefix}_SAYS
  57. * ---Process record loop.
  58. DO WHILE .T.
  59.    STORE "*" TO choice
  60.    DO WHILE .NOT. (choice $ "EN"+Returnkey)
  61.       choice = " "
  62.       SET COLOR TO {PromptColor}
  63. <<if ismultipage>>
  64.       @ 23,0 SAY "COMMAND:  {E}dit  {N}ext-page  {Return}";
  65. <<else>>
  66.       @ 23,0 SAY "COMMAND:  {E}dit  {Return}";
  67. <<endif>>
  68.              GET choice PICTURE "!"
  69.       READ
  70.    ENDDO
  71.    @ 23,0 CLEAR
  72.    DO CASE
  73.    CASE choice = Returnkey
  74.       EXIT
  75. <<if ismultipage>>
  76.    CASE choice = "N"
  77.       STORE pageno + 1 TO pageno
  78.       IF pageno > PageMax
  79.          * ---Circular paging.
  80.          STORE 1 TO pageno
  81.       ENDIF
  82.       DO {fileprefix}_FORM
  83.       DO {fileprefix}_SAYS
  84. <<endif>>
  85.    CASE choice = "E"
  86.       isedited = .T.
  87.       DO {fileprefix}_KEYS WITH expr,IsBlank,IsUnique
  88.       DO {fileprefix}_GETS
  89.    ENDCASE
  90. ENDDO
  91. IF isedited
  92.    DO {fileprefix}_REPL
  93. ENDIF
  94. * ---Closing operations.
  95. SET COLOR TO {WindowColor}
  96. CLOSE DATABASE
  97. SET SCOREBOARD ON
  98. SET STATUS ON
  99. SET BELL ON
  100. SET TALK ON
  101. <<end>> <<*GenDriverPrg*>>
  102.  
  103. <<* EOF: FMTDRIV.INC *>>
  104.