home *** CD-ROM | disk | FTP | other *** search
- <<* GENPRINT.INC *>>
- <<* (C) 1991 SHEN YANG WHITE HORSE SOFTWART COMPANY *>>
- <<#
- function GetIndexNames( indexchoice : integer ) : string
- string ndxnames
- begin
- <<*--Start with selected index--*>>
- select index indexchoice
- filespec( ndxnam,fpath,fname,fext )
- ndxnames := fname + '.IDX'
- forall indexes
- if ndxcount <> indexchoice
- filespec( ndxnam,fpath,fname,fext )
- ndxnames := ndxnames + ',' + fname + '.IDX'
- endif
- endfor
- RETURN ndxnames
- end GetIndexNames
-
-
- function GenCtrlSeq( seq : string; cp,seqlen : integer ) : integer
- string ch
- logical isprevctrl
- integer chcount
- begin
- chcount := 0
- isprevctrl := false
- while (cp <= seqlen) and (chcount < 50)
- chcount := chcount + 1
- ch := seq[cp]
- if (ch < ' ') or (ch = '"') <<*Control char or '"'*>>
- if not isprevctrl
- gen( '"' )
- isprevctrl := true
- endif
- gen( '+CHR(',ord(ch),')' )
- else
- if isprevctrl
- gen( '+"' )
- isprevctrl := false
- endif
- gen( ch )
- endif
- cp := cp + 1
- endwhile
- if isprevctrl
- gen( '+"' )
- endif
- RETURN cp
- end <<*GenCtrlSeq*>>
-
- procedure PrintSay( Prow : string; col : integer; strg : string )
- integer nextcol,cp,strglen
- begin
- if ( fldtyp = 'T' )
- if isctrl( strg )
- cp := 1
- strglen := len( strg )
- nextcol := col
- while cp <= strglen
- gen( '@ ',Prow,',',str(nextcol,3),' SAY "' )
- cp := GenCtrlSeq( strg,cp,strglen )
- genln( '"' )
- nextcol := col + cp - 1
- endwhile
- else
- genln( '@ ',Prow,',',str(col,3),' SAY "',strg,'"' )
- endif
- else
- genln( '@ ',Prow,',',str(col,3),' SAY ',strg )
- endif
- end <<* PrintSay *>>
-
- procedure ssbprintfmt
- string Prow,strg,picstrg
- integer row,cp,wid,recline
- integer headobject,booyobject,tailobject
- integer precol,bascol,col
-
- begin
- #>>
- PRIVATE recnumb,TABPAGE
- set talk off
- create view intfile from environment all
- <<forall databases>>
- * ---Open database file.
- <<filespec( dbfnam,fpath,fname,fext )>>
- <<strg := chr( dbfcount + 64 )>>
- SELECT {strg}
- IF .NOT. FILE( {"}{fname}.DBF{"} )
- ? [{"}{fname}.DBF{"} not found]
- WAIT
- QUIT
- ENDIF
- <<if dbfals = ''>>
- USE {fname}
- <<else>>
- USE {fname} ALIAS {dbfals}
- <<endif>>
- <<if ndxtotal > 0>>
- *
- * ---Open INDEX file(s).
- <<forall indexes>>
- <<filespec( ndxnam,fpath,fname,fext )>>
- <<fname := fname + '.IDX'>>
- IF .NOT. FILE( {"}{fname}{"} )
- ? [Creating index {"}{fname}{"}...]
- INDEX ON {ndxkey} TO {fname}
- ENDIF
- <<endfor>>
- <<genln( 'SET INDEX TO ',GetIndexNames(1) )>>
- <<endif>>
- <<endfor>>
- <<select all>>
- <<if reltotal > 0>> <<*Any relations in entire system?*>>
- *
- * ---SET RELATION(s).
- <<#
- forall databases
- if reltotal > 0
- genln( 'SELECT ',chr( dbfcount+64 ) )
- endif
- forall relations
- if forcount = 1
- genln( 'SET RELATION TO ',relkey,' INTO ',relals )
- else
- genln( 'SET RELATION TO ',relkey,' INTO ',relals,' ADDITIVE' )
- endif
- endfor
- endfor
- endif
- #>>
- CLEAR
- @5,32 SAY "╫╝▒╕║├┤≥╙í╗·"
- @9,32 SAY "░┤╚╬╥╗╝ⁿ╝╠╨°..."
- WAIT " "
- CLEAR
- @5,32 SAY "╒²╘┌┤≥╙í..."
- SET DEVICE TO PRINT
- SET PRINT ON
- TABPAGE = 0
- DO WHILE .NOT. EOF()
- TABPAGE=TABPAGE+1
- recnumb = 0
- <<#
- select all
- forall fields
- if ( fldtyp = '1' )
- headobject := fldwid
- elsif ( fldtyp = '2' )
- booyobject := fldwid
- elsif ( fldtyp = '3' )
- tailobject := fldwid
- endif
- end
- recline := ( 60 - headobject - tailobject ) / booyobject
- select all fields
- row := fldrow
- col := fldcol
- bascol := 0
- precol := 0
- while not eof()
- if ( row < fldrow )
- Prow := 'PROW()+1'
- else
- Prow := 'PROW()'
- endif
- if ( row = fldrow )
- if ( fldcol < precol ) or ( fldwid > 80 )
- if ( fldwid < 80 )
- bascol := bascol + 80
- else
- bascol := bascol + 160
- endif
- endif
- col := fldcol + bascol
- else
- col := fldcol
- bascol := 0
- endif
- precol := fldcol
- pushmargin(1)
- if ( fldtyp = 'T' )
- PrintSay( Prow,col,fldlab )
- elsif ( fldtyp $ 'CDLN' )
- if ( fldtyp $ 'CDLN' ) and fldini
- strg := fldini
- elsif ( fldtyp $ 'CDLN' ) and ( fldals $ 'AM' )
- strg := fldnam
- elsif ( fldtyp $ 'CDLN' )
- strg := fldals + '->' + fldnam
- endif
- if fldpic
- strg := strg + ' PICTURE "' + fldpic + '"'
- elsif fldtyp = 'N'
- picstrg := replicate('9',fldwid)
- if flddec
- picstrg[ fldwid - flddec ] := '.'
- endif
- strg := strg + ' PICTURE "' + picstrg + '"'
- endif
- PrintSay( Prow,col,strg )
- endif
- popmargin
- if ( fldtyp = '1' )
- Prow := 'PROW()+1,'
- pushmargin(1)
- genln( 'DO WHILE .NOT.EOF() .AND. recnumb < ', recline )
- endif
- if ( fldtyp = '2' )
- skip
- Prow := 'PROW()+1'
- pushmargin(1)
- genln( 'SKIP' )
- genln( 'recnumb = recnumb + 1' )
- genln( 'IF .NOT.EOF() .AND. recnumb < ', recline )
- pushmargin(1)
- PrintSay( Prow,fldcol,fldlab )
- popmargin
- genln( 'ELSE' )
- endif
- row := fldrow
- skip
- end
- genln( ' EJECT' )
- genln( 'ENDIF' )
- popmargin
- genln( 'ENDDO' )
- popmargin
- genln( 'ENDDO' )
- #>>
- @ PROW()+1, 1 SAY " "
- CLOSE DATABASES
- set view to intfile
- erase infile
- SET DEVICE TO SCREEN
- SET PRINT OFF
- << end >><<*ssbprintfmt*>>
-
- <<* EOF: GENPRINT.INC *>>
-