Module: _dbflist      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"

//---------------------------------------------------[top]-
//  DBLAREACHA( Arg1, Arg2 )
//
static procedure DBLAREACHA( Arg1, Arg2 )

   local Local1, Local2, Local3
   select (Arg1[ 5 ][ 2 ][ Arg2 ])
   Arg1[ 1 ] := Arg1[ 5 ][ 2 ][ Arg2 ]
   Local1 := dbstruct()
   dblfillins(Arg1)
   Arg1[ 6 ] := array(Local3:= FCount())
   for Local2 := 1 to Local3
      Arg1[ 6 ][ Local2 ] := padr(Local1[ Local2 ][ 1 ], 11) + ;
         Local1[ Local2 ][ 2 ] + Str(Local1[ Local2 ][ 3 ], 4, 0) + ;
         Str(Local1[ Local2 ][ 4 ], 3, 0)
   next
   dblfieldso(Arg1):forcestabl():dehilite()
   dblbuildou(Arg1)
   dblitemsob(Arg1):forcestabl():dehilite()
   dblsettlea(Arg1, Arg2)
   return

//---------------------------------------------------[top]-
//  DBLAREASOB( Arg1 )
//
static function DBLAREASOB( Arg1 )

   local Local1, Local2
   Local1 := dblcreateb(2, 3, MaxRow() - 3, 3 + 12)
   Local2 := _absetcolu(Local1, 1, Arg1[ 5 ][ 1 ])
   Local2[ 2 ] := 15 - 3
   Local2[ 5 ] := { |_1| iif( _1 == alias(Arg1[ 2 ]), {3, 4}, {1, 2} ;
      ) }
   Local1:configure()
   return Local1

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

   local Local1 := Arg1[ 1 ], Local2:= array(45 + FCount(), 4), ;
      Local3, Local4 := .F.
   Arg1[ 3 ] := 1
   itemadd(Local2, Arg1, 0, .T., "[" + LTrim(Str(Select())) + "] " + ;
      alias(Local1), iif( Arg1[ 2 ] == Local1, 9, 8 ))
   itemadd(Local2, Arg1, 4, .T., "Current Driver")
   itemadd(Local2, Arg1, 8, .T., rddname())
   Local3 := 1
   if ( !Empty(dbrelation(Local3)) )
      itemadd(Local2, Arg1, 4, .T., "Relation To")
      do while ( !Empty(dbrelation(Local3)) )
         itemadd(Local2, Arg1, 8, .T., dbrelation(Local3))
         Local3++
      enddo
   endif
   for Local3 := 1 to 10
      if ( !( Len(Trim(ordkey(Local3))) == 0 ) )
         if ( !Local4 )
            Local4 := .T.
            itemadd(Local2, Arg1, 4, .T., "Order Keys")
         endif
         itemadd(Local2, Arg1, 8, .T., SubStr(ordkey(Local3), 1, ;
            21), iif( Local3 == indexord(), 9, 8 ))
      endif
   next
   itemadd(Local2, Arg1, 4, .T., "Workarea Information")
   itemadd(Local2, Arg1, 8, .T., "Select Area: " + ;
      LTrim(Str(Select())))
   itemadd(Local2, Arg1, 8, .T., "Record Size: " + ;
      LTrim(Str(recsize())))
   itemadd(Local2, Arg1, 8, .T., "Header Size: " + ;
      LTrim(Str(header())))
   itemadd(Local2, Arg1, 8, .T., "Field Count: " + ;
      LTrim(Str(FCount())))
   itemadd(Local2, Arg1, 8, .T., "Last Update: " + DToC(lupdate()))
   itemadd(Local2, Arg1, 8, .T., "Index Order: " + ;
      LTrim(Str(indexord())))
   itemadd(Local2, Arg1, 4, .T., "Current Record")
   for Local3 := 1 to FCount()
      itemadd(Local2, Arg1, 8, .T., pad(FieldName(Local3), 11) + ;
         "= " + Transform(fieldget(Local3), ""))
   next
   itemadd(Local2, Arg1, -1, .F., "")
   Arg1[ 3 ]--
   Arg1[ 4 ] := Local2
   return

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

   return _abnew(Arg1, Arg2, Arg3, Arg4, __dbgclr(8) + "," + ;
      __dbgclr(10) + "," + __dbgclr(9) + "," + __dbgclr(11))

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

   local Local1, Local2, Local3, Local4, Local5
   do while ( !( ( Local3 := InKey(0) ) == 27 ) )
      dispbegin()
      do case
      case Local3 == 1001
      case Local3 == 1002 .OR. Local3 == 1006
         do case
         case ( Local4 := mrow() ) < 2
         case ( Local5 := mcol() ) <= 3
         case Local4 >= MaxRow() - 3
         case Local5 >= MaxCol() - 5
         case Local5 == 15
         case Local5 == MaxCol() - 5 - 20
         case Local4 == 2
            if ( Local5 == 5 )
               dispend()
               exit
            endif
         otherwise
            if ( Local5 < 15 .AND. Arg1[ 7 ] != 1 )
               Arg1[ 7 ] := 1
               dblswitchp(Arg1)
            elseif ( Local5 > MaxCol() - 5 - 20 .AND. Arg1[ 7 ] != 3 )
               Arg1[ 7 ] := 3
               dblswitchp(Arg1)
            elseif ( Local4 > 8 .AND. Arg1[ 7 ] != 2 )
               Arg1[ 7 ] := 2
               dblswitchp(Arg1)
            endif
            _abapplyke(Arg1[ 8 ], Local3)
            if ( Local3 != 1006 )
            elseif ( Arg1[ 7 ] == 2 )
               dblitemexp(Arg1)
            endif
         endcase
      case Local3 == 9
         Arg1[ 7 ] := iif( Arg1[ 7 ] == 3, 1, Arg1[ 7 ] + 1 )
         dblswitchp(Arg1)
      case Local3 == 271
         Arg1[ 7 ] := iif( Arg1[ 7 ] == 1, 3, Arg1[ 7 ] - 1 )
         dblswitchp(Arg1)
      case Local3 == 13
         if ( Arg1[ 7 ] == 2 )
            dblitemexp(Arg1)
         endif
      otherwise
         if ( !( Local3 == 3 .AND. Arg1[ 7 ] == 2 ) )
            _abapplyke(Arg1[ 8 ], Local3)
         endif
         if ( Arg1[ 7 ] == 1 )
            Arg1[ 8 ]:forcestabl()
            dblareacha(Arg1, Arg1[ 8 ][ 1 ][ 1 ])
         endif
      endcase
      dispend()
      Arg1[ 8 ]:forcestabl()
   enddo
   return

//---------------------------------------------------[top]-
//  DBLFIELDSO( Arg1 )
//
static function DBLFIELDSO( Arg1 )

   local Local1
   Local1 := dblcreateb(2, MaxCol() - 5 - 20, MaxRow() - 3, MaxCol() ;
      - 5)
   _absetcolu(Local1, 1, Arg1[ 6 ])
   return Local1

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

   Scroll(3, 15 + 1, 8 - 1, MaxCol() - 5 - 20 - 1, 0)
   dispoutat(3, 16, "Alias:")
   dispoutat(3, 23, padr(alias(Arg1[ 1 ]), 10))
   dispoutat(3, 38, "Record:")
   dispoutat(3, 45, padr(alltrim(Str(RecNo())) + "/" + ;
      alltrim(Str(LastRec())), MaxCol() - 5 - 20 - 45))
   dispoutat(4, 19, "BOF:")
   dispoutat(4, 24, yesno(BOF()))
   dispoutat(5, 19, "EOF:")
   dispoutat(5, 24, yesno(EOF()))
   dispoutat(6, 16, "Filter:")
   dispoutat(6, 24, SubStr(dbfilter(), 1, MaxCol() - 5 - 20 - 24))
   dispoutat(7, 16, "   Key:")
   dispoutat(7, 24, SubStr(ordkey(0), 1, MaxCol() - 5 - 20 - 24))
   dispoutat(4, 32, "Deleted:")
   dispoutat(4, 41, yesno(Deleted()))
   dispoutat(5, 32, "  Found:")
   dispoutat(5, 41, yesno(Found()))
   return

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

   local Local1, Local2, Local3
   Local1 := Arg1[ 8 ][ 1 ][ 1 ]
   if ( Arg1[ 4 ][ Local1 ][ 2 ] < Arg1[ 4 ][ Local1 + 1 ][ 2 ] ;
         .AND. Local1 <= dblitemlas(Arg1) )
      Local2 := Arg1[ 4 ][ Local1 ][ 2 ]
      Local1++
      Local3 := !Arg1[ 4 ][ Local1 ][ 3 ]
      do while ( Arg1[ 4 ][ Local1 ][ 2 ] > Local2 )
         if ( Local3 .AND. Arg1[ 4 ][ Local1 ][ 2 ] > Local2 + 4 )
            Local1++
         else
            Arg1[ 4 ][ Local1++ ][ 3 ] := Local3
         endif
      enddo
      Arg1[ 8 ]:refreshall()
   endif
   return

//---------------------------------------------------[top]-
//  DBLITEMLAS( Arg1 )
//
static function DBLITEMLAS( Arg1 )

   local Local1
   for Local1 := Arg1[ 3 ] - 1 to 1 step -1
      if ( Arg1[ 4 ][ Local1 ][ 3 ] )
         return Local1
      endif
   next
   return 1

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

   local Local1
   for Local1 := Arg1[ 1 ][ 1 ] + 1 to Arg2[ 3 ] - 1
      if ( Arg2[ 4 ][ Local1 ][ 3 ] )
         return Local1
      endif
   next
   return Arg1[ 1 ][ 1 ]

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

   local Local1
   for Local1 := Arg1[ 1 ][ 1 ] - 1 to 1 step -1
      if ( Arg2[ 4 ][ Local1 ][ 3 ] )
         return Local1
      endif
   next
   return 1

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

   local Local1, Local2 := 0, Local3:= Arg1[ 1 ][ 1 ]
   if ( Arg3 > 0 )
      do while ( Local2 < Arg3 )
         if ( ( Local1 := dblitemnex(Arg1, Arg2) ) == Local3 )
            exit
         else
            Arg1[ 1 ][ 1 ] := Local1
         endif
         Local2++
      enddo
   elseif ( Arg3 < 0 )
      do while ( Local2 > Arg3 )
         if ( ( Local1 := dblitempre(Arg1, Arg2) ) == Local3 )
            exit
         else
            Arg1[ 1 ][ 1 ] := Local1
         endif
         Local2--
      enddo
   endif
   return Local2

//---------------------------------------------------[top]-
//  DBLITEMSOB( Arg1 )
//
static function DBLITEMSOB( Arg1 )

   local Local1, Local2
   Local2 := dblcreateb(2 + 6, 3 + 12, MaxRow() - 3, MaxCol() - 5 - 20)
   Local2[ 1 ][ 2 ] := Arg1[ 4 ]
   Local1 := tbcolumnne("", { || ;
      pad(Space(Arg1[ 4 ][ Local2[ 1 ][ 1 ] ][ 2 ]) + ;
      Arg1[ 4 ][ Local2[ 1 ][ 1 ] ][ 1 ], MaxCol() - 5 - 20 - 1 - ( ;
      15 + 1 ) + 1) })
   Local1[ 2 ] := MaxCol() - 5 - 20 - 15
   Local1[ 5 ] := { |_1| iif( Arg1[ 4 ][ Local2[ 1 ][ 1 ] ][ 4 ] == ;
      9, {3, 4}, {1, 2} ) }
   AAdd(Local2[ 6 ], Local1)
   Local2[ 12 ] := { || Local2[ 1 ][ 1 ]:= 1 }
   Local2[ 13 ] := { || Local2[ 1 ][ 1 ]:= dblitemlas(Arg1) }
   Local2[ 11 ] := { |_1| dblitemski(Local2, Arg1, _1) }
   Local2:configure()
   return Local2

//---------------------------------------------------[top]-
//  DBLSETTLEA( Arg1, Arg2 )
//
static procedure DBLSETTLEA( Arg1, Arg2 )

   Arg1[ 8 ] := dblareasob(Arg1)
   dispbegin()
   Arg1[ 8 ]:forcestabl()
   do while ( !( Arg1[ 8 ][ 1 ][ 1 ] == Arg2 ) )
      if ( Arg2 > Arg1[ 8 ][ 1 ][ 1 ] )
         Arg1[ 8 ]:down()
      else
         Arg1[ 8 ]:up()
      endif
      Arg1[ 8 ]:forcestabl()
   enddo
   dispend()
   return

//---------------------------------------------------[top]-
//  DBLSHOWINI
//
static function DBLSHOWINI

   local Local1
   DispBox(2, 3, MaxRow() - 3, MaxCol() - 5)
   DispBox(2, 15, MaxRow() - 3, MaxCol() - 5 - 20)
   dbgshadow(2, 3, MaxRow() - 3, MaxCol() - 5)
   dispoutat(2, 15, "")
   dispoutat(MaxRow() - 3, 15, "")
   dispoutat(2, MaxCol() - 5 - 20, "")
   dispoutat(MaxRow() - 3, MaxCol() - 5 - 20, "")
   dispoutat(8, 15, "" + Replicate("", MaxCol() - 5 - 20 - 15 + 1 ;
      - 2) + "")
   dispoutat(2, 4, " ")
   Local1 := SetColor(__dbgclr(9))
   dispoutat(2, 5, "")
   set color to (Local1)
   dispoutat(2, 8, " Area ")
   dispoutat(2, 15 + Round(( MaxCol() - 5 - 20 - 15 - 8 ) / 2, 0), ;
      " Status ")
   dispoutat(2, MaxCol() - 5 - 20 + Round(( MaxCol() - 5 - ( ;
      MaxCol() - 5 - 20 ) - 11 ) / 2, 0), " Structure ")
   return Nil

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

   Arg1[ 8 ]:dehilite()
   if ( Arg1[ 7 ] == 1 )
      dblsettlea(Arg1, Arg1[ 1 ])
   elseif ( Arg1[ 7 ] == 2 )
      Arg1[ 8 ] := dblitemsob(Arg1)
   elseif ( Arg1[ 7 ] == 3 )
      Arg1[ 8 ] := dblfieldso(Arg1)
   endif
   return

//---------------------------------------------------[top]-
//  ITEMADD( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6 )
//
static procedure ITEMADD( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6 )

   Arg1[ Arg2[ 3 ] ][ 2 ] := Arg3
   Arg1[ Arg2[ 3 ] ][ 3 ] := Arg4
   Arg1[ Arg2[ 3 ] ][ 1 ] := Arg5
   Arg1[ Arg2[ 3 ] ][ 4 ] := iif( ISNIL( Arg6 ), 8, Arg6 )
   Arg2[ 3 ]++
   return

//---------------------------------------------------[top]-
//  YESNO( Arg1 )
//
static function YESNO( Arg1 )

   return iif( Arg1, "Yes", "No " )

//---------------------------------------------------[top]-
//  __DBFLIST
//
procedure __DBFLIST

   local Local1, Local2[8], Local3, Local4
   __dbgsaves()
   Local2[ 2 ] := Select()
   if ( used() )
      Local4 := Local2[ 2 ]
   else
      Local4 := 1
   endif
   Local2[ 5 ] := {{}, {}}
   for Local1 := 1 to 254
      select (Local1)
      if ( ( AAdd(( AAdd(Local2[ 5 ][ 1 ], alias(Local1)), ;
            Local2[ 5 ][ 2 ] ), Local1), used() .AND. Local1 == ;
            Local4 ) )
         Local4 := Len(Local2[ 5 ][ 2 ])
      endif
   next
   if ( Empty(Local2[ 5 ][ 1 ]) )
      alert(__dbgtext(17))
      select (Local2[ 2 ])
      __dbgrests()
   else
      Local2[ 7 ] := 1
      dispbegin()
      Local3 := SetColor(__dbgclr(8))
      dblshowini()
      dblareacha(Local2, Local4)
      dispend()
      dbleventlo(Local2)
      select (Local2[ 2 ])
      Local2 := Nil
      set color to (Local3)
      __dbgrests()
      return
   endif

//---EOF


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