Module: _dbghelp      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:= "CLD.HLP"

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

   local Local1, Local2, Local3, Local4 := fopen(Static1)
   if ( !( ferror() == 0 ) )
      if ( Empty(Static1 := __dbghfile("HLP", ;
            "Path and Name of Help File", "CLD")) )
         fclose(Local4)
         return Local1
      else
         Local4 := fopen(Static1)
         if ( !( ferror() == 0 ) )
            return Local1
         endif
      endif
   endif
   Local1 := Space(512)
   fread(Local4, @Local1, 512)
   Local1 := SubStr(Local1, 4 * ( Arg1 - 1 ) + 1, 4)
   Local2 := Asc(Local1) + 256 * Asc(SubStr(Local1, 2))
   Local3 := Asc(SubStr(Local1, 3)) + 256 * Asc(SubStr(Local1, 4))
   Local1 := Space(Local3)
   fseek(Local4, Local2)
   fread(Local4, @Local1, Local3)
   fclose(Local4)
   if ( Empty(Local1) )
      alert("Could not open Help file")
   endif
   return Local1

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

   local Local1 := hlpgettext(Arg1)
   if ( Empty(Local1) )
      return Nil
   endif
   return hlptext2ar(Local1)

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

   if ( Arg3 < 1 )
      Arg3 := 1
   elseif ( ( Arg3 - 1 ) * ( iif( 20 > MaxRow() - 4, 20, MaxRow() - ;
         4 ) - 1 ) >= Len(Arg1) )
      Arg3--
   endif
   hlppaintto(Arg1, Arg3)
   return Arg3

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

   local Local1, Local2, Local3, Local4
   Scroll(3, 15 + 1, 2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ) ;
      - 1, 76 - 1, 0)
   Local1 := ( Arg2 - 1 ) * ( iif( 20 > MaxRow() - 4, 20, MaxRow() - ;
      4 ) - 1 )
   for Local2 := 1 to iif( iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ) ;
         - 1 < Len(Arg1) - Local1, iif( 20 > MaxRow() - 4, 20, ;
         MaxRow() - 4 ) - 1, Len(Arg1) - Local1 )
      if ( !Empty(Arg1[ Local1 + Local2 ]) )
         dispoutat(2 + Local2, 15 + 1, Arg1[ Local1 + Local2 ])
      endif
   next
   Local3 := Len(Arg1) / ( iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ) ;
      - 1 )
   if ( Local3 > Int(Local3) )
      Local3++
   endif
   Local4 := " Page " + LTrim(Str(Int(Arg2))) + " of " + ;
      LTrim(Str(Int(Local3))) + " "
   dispoutat(2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ), 76 - ( ;
      Len(Local4) + 2 ), Local4)
   return

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

   local Local1 := {}, Local2, Local3
   do while ( !( ISNIL( Arg1 ) ) )
      Local3 := At(Chr(13) + Chr(10), Arg1)
      if ( !Empty(Local3) )
         AAdd(Local1, SubStr(Arg1, 1, Local3 - 1))
         Arg1 := SubStr(Arg1, Local3 + 2)
      else
         AAdd(Local1, Arg1)
         Arg1 := Nil
      endif
   enddo
   return Local1

//---------------------------------------------------[top]-
//  __DBGHELP( Arg1 )
//
procedure __DBGHELP( Arg1 )

   local Local1, Local2, Local3, Local4, Local5 := 0, Local6:= 1, ;
      Local7
   Arg1 := Val(Arg1)
   __dbgsaves()
   Local1 := {"About Help", "Keys", "   Function", "   Window", ;
      "   Other", "Windows", "   Command", "   Code", "   Watch", ;
      "   Monitor", "   CallStack", "Menus", "   File", "   Locate", ;
      "   View", "   Run", "   Point", "   Monitor", "   Options", ;
      "   Window", "Commands", "Script files"}
   do case
   case Arg1 == 42
      Arg1 := 2
   case Arg1 == 43
      Arg1 := 6
   case Arg1 == 44
      Arg1 := 12
   case Arg1 == 45
      Arg1 := 21
   otherwise
      Arg1 := 1
   endcase
   Arg1 := iif( iif( Arg1 < Len(Local1), Arg1, Len(Local1) ) > 1, ;
      iif( Arg1 < Len(Local1), Arg1, Len(Local1) ), 1 )
   Local2 := hlpnewtopi(Arg1)
   if ( Empty(Local2) )
   else
      dispbegin()
      Local7 := SetColor(__dbgclr(8))
      DispBox(2, 2, 2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ), ;
         15)
      DispBox(2, 15, 2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ), ;
         76)
      dbgshadow(2, 2, 2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ;
         ), 76)
      dispoutat(2, 15, "")
      dispoutat(2 + iif( 20 > MaxRow() - 4, 20, MaxRow() - 4 ), 15, ;
         "")
      dispoutat(2, 2 + Round(( 76 - 2 - 6 ) / 2, 0), " Help ")
      Local3 := _abnew(2, 2, 2 + iif( 20 > MaxRow() - 4, 20, MaxRow() ;
         - 4 ), 15, __dbgclr(8) + "," + __dbgclr(10))
      _absetcolu(Local3, 1, Local1)[ 2 ] := 12
      Local3:refreshall()
      Local3[ 1 ][ 1 ] := Arg1:= iif( Arg1 > 1, Arg1, 1 )
      Local3:forcestabl()
      hlppaintto(Local2, Local6)
      dispend()
      do while ( !( Local5 == 27 ) )
         Local5 := InKey(0)
         dispbegin()
         do case
         case Local5 == 18
            Local6 := hlppage(Local2, -1, Local6)
         case Local5 == 3
            Local6 := hlppage(Local2, 1, Local6)
         otherwise
            _abapplyke(Local3, Local5)
            Local3:forcestabl()
            if ( !( Arg1 == Local3[ 1 ][ 1 ] ) )
               Arg1 := Local3[ 1 ][ 1 ]
               Local2 := hlpnewtopi(Arg1)
               if ( Empty(Local2) )
                  Local5 := 27
               else
                  hlppaintto(Local2, Local6 := 1)
               endif
            endif
         endcase
         dispend()
      enddo
      Local3 := Nil
      set color to (Local7)
      __dbgrests()
      return
   endif

//---EOF


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