Module: _frmrun      Library: Clipper 5.3


This module contains the following functions and procedures:



Note: Because this is raw decompiler output, the code is closer
to that seen in a .PPO file, rather than a .PRG file. In other
words, you must allow for the preprocessor conversions normally 
performed based on the contents of STD.CH and other .CH files
 
#include "common.ch"
#include "inkey.ch"

//-----------------------------------------------------------------
//  file-wide static variables
//
static Static1, Static2, Static3, Static4, Static5, Static6, ;
   Static7, Static8

//---------------------------------------------------[top]-
//  EJECTPAGE
//
static procedure EJECTPAGE

   if ( Static7 )
      eject
   endif
   return

//---------------------------------------------------[top]-
//  EXECUTEREP
//
static procedure EXECUTEREP

   local Local1 := {}, Local2:= {}, Local3, Local4, Local5:= .F., ;
      Local6 := .F., Local7, Local8, Local9, Local10, Local11
   for Local3 := 1 to Len(Static1[ 11 ])
      if ( Static1[ 11 ][ Local3 ][ 7 ] )
         Static4[ 1 ][ Local3 ] := Static4[ 1 ][ Local3 ] + ;
            eval(Static1[ 11 ][ Local3 ][ 1 ])
      endif
   next
   if ( !Static6 )
      for Local4 := Len(Static1[ 12 ]) to 1 step -1
         Local11 := .F.
         for Local3 := 1 to Len(Static1[ 11 ])
            if ( Static1[ 11 ][ Local3 ][ 7 ] )
               Local11 := .T.
               exit
            endif
         next
         if ( Local4 == 1 )
            Local6 := Static1[ 12 ][ Local4 ][ 5 ]
         endif
         if ( !Local11 )
            loop
         endif
         if ( makeastr(eval(Static1[ 12 ][ 1 ][ 1 ]), ;
               Static1[ 12 ][ 1 ][ 3 ]) != Static5[ 1 ] )
            Local5 := .T.
         endif
         if ( Local5 .OR. ;
               makeastr(eval(Static1[ 12 ][ Local4 ][ 1 ]), ;
               Static1[ 12 ][ Local4 ][ 3 ]) != Static5[ Local4 ] )
            AAdd(Local1, iif( Local4 == 1, nationmsg(4), ;
               nationmsg(5) ))
            AAdd(Local1, "")
            for Local3 := 1 to Len(Static1[ 11 ])
               if ( Static1[ 11 ][ Local3 ][ 7 ] )
                  Local1[ Len(Local1) ] := Local1[ Len(Local1) ] + ;
                     Transform(Static4[ Local4 + 1 ][ Local3 ], ;
                     Static1[ 11 ][ Local3 ][ 8 ])
                  Static4[ Local4 + 1 ][ Local3 ] := 0
               else
                  Local1[ Len(Local1) ] := Local1[ Len(Local1) ] + ;
                     Space(Static1[ 11 ][ Local3 ][ 5 ])
               endif
               Local1[ Len(Local1) ] := Local1[ Len(Local1) ] + " "
            next
            Local1[ Len(Local1) ] := Left(Local1[ Len(Local1) ], ;
               Len(Local1[ Len(Local1) ]) - 1)
         endif
      next
   endif
   if ( Len(Local1) > 0 .AND. Local6 .AND. Local5 )
      if ( Len(Local1) > Static3 )
         ejectpage()
         if ( Static1[ 9 ] )
            Static3 := 1000
         else
            reporthead()
         endif
      endif
      aeval(Local1, { |_1| printit(Space(Static1[ 3 ]) + _1) })
      Local1 := {}
      ejectpage()
      if ( Static1[ 9 ] )
         Static3 := 1000
      else
         reporthead()
      endif
   endif
   for Local4 := 1 to Len(Static1[ 12 ])
      if ( makeastr(eval(Static1[ 12 ][ Local4 ][ 1 ]), ;
            Static1[ 12 ][ Local4 ][ 3 ]) == Static5[ Local4 ] )
      else
         AAdd(Local1, "")
         if ( Local4 == 1 .AND. !Static6 .AND. !Local11 .AND. ( ;
               Local6 := Static1[ 12 ][ Local4 ][ 5 ] ) )
            Static3 := 0
         endif
         AAdd(Local1, iif( Local4 == 1, "** ", "* " ) + ;
            Static1[ 12 ][ Local4 ][ 4 ] + " " + ;
            makeastr(eval(Static1[ 12 ][ Local4 ][ 1 ]), ;
            Static1[ 12 ][ Local4 ][ 3 ]))
      endif
   next
   Static6 := .F.
   if ( Len(Local1) > 0 )
      if ( Len(Local1) > Static3 )
         ejectpage()
         if ( Static1[ 9 ] )
            Static3 := 1000
         else
            reporthead()
         endif
      endif
      aeval(Local1, { |_1| printit(Space(Static1[ 3 ]) + _1) })
      Static3 := Static3 - Len(Local1)
      if ( Static3 == 0 )
         ejectpage()
         if ( Static1[ 9 ] )
            Static3 := 1000
         else
            reporthead()
         endif
      endif
   endif
   for Local3 := 1 to Len(Static1[ 11 ])
      if ( Static1[ 11 ][ Local3 ][ 7 ] )
         for Local4 := 1 to Len(Static4) - 1
            Static4[ Local4 + 1 ][ Local3 ] := ;
               Static4[ Local4 + 1 ][ Local3 ] + ;
               eval(Static1[ 11 ][ Local3 ][ 1 ])
         next
      endif
   next
   for Local4 := 1 to Len(Static1[ 12 ])
      Static5[ Local4 ] := ;
         makeastr(eval(Static1[ 12 ][ Local4 ][ 1 ]), ;
         Static1[ 12 ][ Local4 ][ 3 ])
   next
   if ( !Static1[ 10 ] )
      Local7 := 1
      for Local3 := 1 to Len(Static1[ 11 ])
         if ( Static1[ 11 ][ Local3 ][ 3 ] $ "M" )
            Local7 := ;
               Max(xmlcount(eval(Static1[ 11 ][ Local3 ][ 1 ]), ;
               Static1[ 11 ][ Local3 ][ 5 ]), Local7)
         elseif ( Static1[ 11 ][ Local3 ][ 3 ] $ "C" )
            Local7 := ;
               Max(xmlcount(strtran(eval(Static1[ 11 ][ Local3 ][ 1 ]), ;
               ";", Chr(13) + Chr(10)), ;
               Static1[ 11 ][ Local3 ][ 5 ]), Local7)
         endif
      next
      asize(Local2, Local7)
      afill(Local2, "")
      for Local3 := 1 to Len(Static1[ 11 ])
         for Local8 := 1 to Local7
            if ( Static1[ 11 ][ Local3 ][ 3 ] $ "CM" )
               if ( Static1[ 11 ][ Local3 ][ 3 ] $ "C" )
                  Local9 := ;
                     xmemoline(Trim(strtran(eval(Static1[ 11 ][ Local3 ][ 1 ]), ;
                     ";", Chr(13) + Chr(10))), ;
                     Static1[ 11 ][ Local3 ][ 5 ], Local8)
               else
                  Local9 := ;
                     xmemoline(Trim(eval(Static1[ 11 ][ Local3 ][ 1 ])), ;
                     Static1[ 11 ][ Local3 ][ 5 ], Local8)
               endif
               Local9 := padr(Local9, Static1[ 11 ][ Local3 ][ 5 ])
            elseif ( Local8 == 1 )
               Local9 := ;
                  Transform(eval(Static1[ 11 ][ Local3 ][ 1 ]), ;
                  Static1[ 11 ][ Local3 ][ 8 ])
               Local9 := padr(Local9, Static1[ 11 ][ Local3 ][ 5 ])
            else
               Local9 := Space(Static1[ 11 ][ Local3 ][ 5 ])
            endif
            if ( Local3 > 1 )
               Local2[ Local8 ] := Local2[ Local8 ] + " "
            endif
            Local2[ Local8 ] := Local2[ Local8 ] + Local9
         next
      next
      if ( Len(Local2) > Static3 )
         if ( Len(Local2) > Static8 )
            Local8 := 1
            do while ( Local8 < Len(Local2) )
               printit(Space(Static1[ 3 ]) + Local2[ Local8 ])
               Local8++
               Static3--
               if ( Static3 == 0 )
                  ejectpage()
                  if ( Static1[ 9 ] )
                     Static3 := 1000
                  else
                     reporthead()
                  endif
               endif
            enddo
         else
            ejectpage()
            if ( Static1[ 9 ] )
               Static3 := 1000
            else
               reporthead()
            endif
            aeval(Local2, { |_1| printit(Space(Static1[ 3 ]) + _1) })
            Static3 := Static3 - Len(Local2)
         endif
      else
         aeval(Local2, { |_1| printit(Space(Static1[ 3 ]) + _1) })
         Static3 := Static3 - Len(Local2)
      endif
      if ( Static1[ 6 ] > 1 .AND. Static3 >= Static1[ 6 ] - 1 )
         for Local8 := 2 to Static1[ 6 ]
            printit()
            Static3--
         next
      endif
   endif
   return

//---------------------------------------------------[top]-
//  MAKEASTR( Arg1, Arg2 )
//
static function MAKEASTR( Arg1, Arg2 )

   local Local1
   do case
   case Upper(Arg2) == "D"
      Local1 := DToC(Arg1)
   case Upper(Arg2) == "L"
      Local1 := iif( Arg1, "T", "F" )
   case Upper(Arg2) == "N"
      Local1 := Str(Arg1)
   case Upper(Arg2) == "C"
      Local1 := Arg1
   otherwise
      Local1 := "INVALID EXPRESSION"
   endcase
   return Local1

//---------------------------------------------------[top]-
//  OCCURS( Arg1, Arg2 )
//
static function OCCURS( Arg1, Arg2 )

   local Local1, Local2 := 0
   do while ( !Empty(Arg2) )
      if ( ( Local1 := At(Arg1, Arg2) ) != 0 )
         Local2++
         Arg2 := SubStr(Arg2, Local1 + 1)
      else
         Arg2 := ""
      endif
   enddo
   return Local2

//---------------------------------------------------[top]-
//  PRINTIT( Arg1 )
//
static procedure PRINTIT( Arg1 )

   if ( ISNIL( Arg1 ) )
      Arg1 := ""
   else
   endif
   ?? Arg1
   ? 
   return

//---------------------------------------------------[top]-
//  REPORTHEAD
//
static procedure REPORTHEAD

   local Local1 := 0, Local2:= {}, Local3, Local4, Local5, Local6, ;
      Local7, Local8, Local9, Local10, Local11, Local12
   Local3 := Static1[ 2 ] - Static1[ 3 ] - 30
   Local10 := Static1[ 2 ] - Static1[ 4 ]
   Local12 := Min(Local10, 254)
   if ( !Static1[ 9 ] )
      if ( Static1[ 13 ] == "" )
         AAdd(Local2, nationmsg(3) + Str(Static2, 6))
      else
         Local11 := parseheade(Static1[ 13 ], occurs(";", ;
            Static1[ 13 ]) + 1)
         for Local5 := 1 to Len(Local11)
            Local1 := Max(xmlcount(LTrim(Local11[ Local5 ]), Local3), ;
               1)
            for Local9 := 1 to Local1
               AAdd(Local2, Space(15) + ;
                  padc(Trim(xmemoline(LTrim(Local11[ Local5 ]), ;
                  Local3, Local9)), Local3))
            next
         next
         Local2[ 1 ] := stuff(Local2[ 1 ], 1, 14, nationmsg(3) + ;
            Str(Static2, 6))
      endif
      AAdd(Local2, DToC(Date()))
   endif
   for Local5 := 1 to Len(Static1[ 1 ])
      Local1 := Max(xmlcount(LTrim(Static1[ 1 ][ Local5 ]), Local12), ;
         1)
      for Local9 := 1 to Local1
         Local8 := Trim(xmemoline(LTrim(Static1[ 1 ][ Local5 ]), ;
            Local12, Local9))
         AAdd(Local2, Space(( Local10 - Static1[ 3 ] - Len(Local8) ) ;
            / 2) + Local8)
      next
   next
   AAdd(Local2, "")
   Local1 := Len(Local2)
   Local6 := 0
   for Local4 := 1 to Len(Static1[ 11 ])
      Local6 := Max(Len(Static1[ 11 ][ Local4 ][ 4 ]), Local6)
   next
   for Local4 := 1 to Len(Static1[ 11 ])
      asize(Static1[ 11 ][ Local4 ][ 4 ], Local6)
   next
   for Local5 := 1 to Local6
      AAdd(Local2, "")
   next
   for Local4 := 1 to Len(Static1[ 11 ])
      for Local5 := 1 to Local6
         if ( Local4 > 1 )
            Local2[ Local1 + Local5 ] := Local2[ Local1 + Local5 ] + ;
               " "
         endif
         if ( ISNIL( Static1[ 11 ][ Local4 ][ 4 ][ Local5 ] ) )
            Local2[ Local1 + Local5 ] := Local2[ Local1 + Local5 ] + ;
               Space(Static1[ 11 ][ Local4 ][ 5 ])
         elseif ( Static1[ 11 ][ Local4 ][ 3 ] == "N" )
            Local2[ Local1 + Local5 ] := Local2[ Local1 + Local5 ] + ;
               padl(Static1[ 11 ][ Local4 ][ 4 ][ Local5 ], ;
               Static1[ 11 ][ Local4 ][ 5 ])
         else
            Local2[ Local1 + Local5 ] := Local2[ Local1 + Local5 ] + ;
               padr(Static1[ 11 ][ Local4 ][ 4 ][ Local5 ], ;
               Static1[ 11 ][ Local4 ][ 5 ])
         endif
      next
   next
   AAdd(Local2, "")
   AAdd(Local2, "")
   aeval(Local2, { |_1| printit(Space(Static1[ 3 ]) + _1) })
   Static2++
   Static3 := Static1[ 5 ] - Len(Local2)
   Static8 := Static1[ 5 ] - Len(Local2)
   return

//---------------------------------------------------[top]-
//  XMEMOLINE( Arg1, Arg2, Arg3, Arg4, Arg5 )
//
static function XMEMOLINE( Arg1, Arg2, Arg3, Arg4, Arg5 )

   Arg2 := iif( ISNIL( Arg2 ), 79, Arg2 )
   Arg3 := iif( ISNIL( Arg3 ), 1, Arg3 )
   Arg4 := iif( ISNIL( Arg4 ), 4, Arg4 )
   Arg5 := iif( ISNIL( Arg5 ), .T., Arg5 )
   if ( Arg4 >= Arg2 )
      Arg4 := Arg2 - 1
   endif
   return memoline(Arg1, Arg2, Arg3, Arg4, Arg5)

//---------------------------------------------------[top]-
//  XMLCOUNT( Arg1, Arg2, Arg3, Arg4 )
//
static function XMLCOUNT( Arg1, Arg2, Arg3, Arg4 )

   Arg2 := iif( ISNIL( Arg2 ), 79, Arg2 )
   Arg3 := iif( ISNIL( Arg3 ), 4, Arg3 )
   Arg4 := iif( ISNIL( Arg4 ), .T., .F. )
   if ( Arg3 >= Arg2 )
      Arg3 := Arg2 - 1
   endif
   return mlcount(Trim(Arg1), Arg2, Arg3, Arg4)

//---------------------------------------------------[top]-
//  __REPORTFO( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, ;
//
procedure __REPORTFO( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, ;
   Arg8, Arg9, Arg10, Arg11, Arg12, Arg13 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8 := .F., Local9, Local10, Local11
   if ( ISNIL( Arg1 ) )
      Local9 := errornew()
      Local9:severity(2)
      Local9:gencode(1)
      Local9:subsystem("FRMLBL")
      eval(errorblock(), Local9)
   elseif ( At(".", Arg1) == 0 )
      Arg1 := Trim(Arg1) + ".FRM"
   endif
   default Arg11 to ""
   Local1 := iif( Arg2, Set(_SET_PRINTER, Arg2), Set(_SET_PRINTER) )
   Local2 := iif( Arg4, Set(_SET_CONSOLE, .F.), Set(_SET_CONSOLE) )
   if ( Arg2 )
      Static7 := .T.
   else
      Static7 := .F.
   endif
   if ( !Empty(Arg3) )
      Local4 := Set(_SET_EXTRA, .T.)
      Local3 := Set(_SET_EXTRAFILE, Arg3)
   endif
   begin sequence
      Static1 := __frmload(Arg1)
      Static8 := Static1[ 5 ]
      if ( Arg13 == .T. )
         Static1[ 10 ] := Arg13
      endif
      if ( Arg12 != Nil .AND. Arg12 )
         Static1[ 7 ] := .F.
      endif
      if ( Arg10 )
         Static1[ 9 ] := .T.
         Arg11 := ""
         Static7 := .F.
      endif
      Static1[ 13 ] := Arg11
      Static2 := 1
      Static6 := .T.
      Static3 := Static1[ 5 ]
      ? 
      Static3--
      if ( Static1[ 7 ] )
         ejectpage()
      endif
      reporthead()
      Static4 := array(Len(Static1[ 12 ]) + 1, Len(Static1[ 11 ]))
      for Local5 := 1 to Len(Static1[ 11 ])
         if ( Static1[ 11 ][ Local5 ][ 7 ] )
            for Local6 := 1 to Len(Static4)
               Static4[ Local6 ][ Local5 ] := 0
            next
         endif
      next
      Static5 := array(Len(Static1[ 12 ]))
      DBEval({ || executerep() }, Arg5, Arg6, Arg7, Arg8, Arg9)
      for Local6 := Len(Static1[ 12 ]) to 1 step -1
         Local11 := .F.
         for Local5 := 1 to Len(Static1[ 11 ])
            if ( Static1[ 11 ][ Local5 ][ 7 ] )
               Local11 := .T.
               exit
            endif
         next
         if ( !Local11 )
            loop
         endif
         if ( Static3 < 2 )
            ejectpage()
            if ( Static1[ 9 ] )
               Static3 := 1000
            else
               reporthead()
            endif
         endif
         printit(Space(Static1[ 3 ]) + iif( Local6 == 1, ;
            nationmsg(4), nationmsg(5) ))
         ?? Space(Static1[ 3 ])
         for Local5 := 1 to Len(Static1[ 11 ])
            if ( Local5 > 1 )
               ?? " "
            endif
            if ( Static1[ 11 ][ Local5 ][ 7 ] )
               ?? Transform(Static4[ Local6 + 1 ][ Local5 ], ;
                  Static1[ 11 ][ Local5 ][ 8 ])
            else
               ?? Space(Static1[ 11 ][ Local5 ][ 5 ])
            endif
         next
         ? 
      next
      Local10 := .F.
      for Local5 := 1 to Len(Static1[ 11 ])
         if ( Static1[ 11 ][ Local5 ][ 7 ] )
            Local10 := .T.
            exit
         endif
      next
      if ( Local10 )
         if ( Static3 < 2 )
            ejectpage()
            if ( Static1[ 9 ] )
               Static3 := 1000
            else
               reporthead()
            endif
         endif
         printit(Space(Static1[ 3 ]) + nationmsg(6))
         ?? Space(Static1[ 3 ])
         for Local5 := 1 to Len(Static1[ 11 ])
            if ( Local5 > 1 )
               ?? " "
            endif
            if ( Static1[ 11 ][ Local5 ][ 7 ] )
               ?? Transform(Static4[ 1 ][ Local5 ], ;
                  Static1[ 11 ][ Local5 ][ 8 ])
            else
               ?? Space(Static1[ 11 ][ Local5 ][ 5 ])
            endif
         next
         ? 
      endif
      if ( Static1[ 8 ] )
         ejectpage()
      endif
   recover using Local7
      Local8 := .T.
   end sequence
   Static1 := Nil
   Static4 := Nil
   Static5 := Nil
   Static2 := Nil
   Static6 := Nil
   Static3 := Nil
   Static7 := Nil
   Static8 := Nil
   set printer (Local1)
   set console (Local2)
   if ( !Empty(Arg3) )
      Set(_SET_EXTRAFILE, Local3)
      Set(_SET_EXTRA, Local4)
   endif
   if ( Local8 )
      break( Local7 )
   endif
   return

//---EOF


Use your Browser's BACK button to return to Function Listings