Module: _dbtotal      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

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

   local Local1, Local2, Local3 := Select(), Local4, Local5
   if ( ( Local1 := At("->", Arg1) ) > 0 )
      Local2 := Left(Arg1, Local1 - 1)
      if ( Select(Local2) != Local3 )
         Local4 := errornew()
         Local4:severity(2)
         Local4:gencode(7)
         Local4:subsystem("DBCMD")
         Local4:candefaul(.T.)
         Local4:operation(Arg1)
         Local4:subcode(1101)
         Local5 := eval(errorblock(), Local4)
         if ( ValType(Local5) != "L" .OR. Local5 )
            errorinhan()
         endif
         Static1 := .T.
         break( Local4 )
      endif
      Arg1 := SubStr(Arg1, Local1 + 2)
   endif
   return fieldblock(Arg1)

//---------------------------------------------------[top]-
//  __DBTOTAL( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8 )
//
function __DBTOTAL( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9 := .F.
   Static1 := .F.
   if ( ISNIL( Arg5 ) )
      Arg5 := { || .T. }
   else
      Arg8 := .T.
   endif
   default Arg4 to { || .T. }
   default Arg8 to .F.
   if ( Arg7 != Nil )
      goto Arg7
      Arg6 := 1
   else
      if ( ISNIL( Arg6 ) )
         Arg6 := -1
      else
         Arg8 := .T.
      endif
      if ( !Arg8 )
         goto top
      endif
   endif
   Local1 := Select()
   Local3 := {}
   aeval(dbstruct(), { |_1| iif( _1[ 2 ] == "M", Nil, AAdd(Local3, ;
      _1) ) })
   if ( Empty(Local3) )
      return .F.
   endif
   begin sequence
      Local4 := {}
      aeval(Arg3, { |_1| AAdd(Local4, getfield(_1)) })
      Local5 := array(Len(Local4))
      dbcreate(Arg1, Local3, .T., .T., "")
      Local2 := Select()
      select (Local1)
      do while ( !EOF() .AND. Arg6 != 0 .AND. eval(Arg5) )
         Local6 := .F.
         afill(Local5, 0)
         Local7 := eval(Arg2)
         do while ( !EOF() .AND. Arg6-- != 0 .AND. eval(Arg5) .AND. ;
               Local7 == eval(Arg2) )
            if ( eval(Arg4) )
               if ( !Local6 )
                  __dbtransr(Local2, Local3)
                  select (Local1)
                  Local6 := .T.
               endif
               aeval(Local4, { |_1, _2| Local5[ _2 ] := Local5[ _2 ] ;
                  + eval(_1) })
            endif
            skip 
         enddo
         if ( Local6 )
            select (Local2)
            aeval(Local4, { |_1, _2| eval(_1, Local5[ _2 ]) })
            select (Local1)
         endif
      enddo
   recover using Local8
      Local9 := .T.
   end sequence
   if ( Local2 != Nil )
      select (Local2)
      close
   endif
   select (Local1)
   if ( Local9 .AND. !Static1 )
      break( Local8 )
   endif
   return .T.

//---EOF


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