Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

(GetFuncResult)

Mnemonic: (GetFuncResult)
Discussion: Requests the 32 bit (4 byte) result of the last printer or GDI function. This function must be followed immediately by an INPUT statement to receive the value into the MTB program.
History: This mnemonic is valid in Comet98 and greater.
Example 1:
! Variables for GetFuncResult
Length    2 & Local Word$              ! Temporary 2 byte word holder
Length    4 & Local Result$            ! 4 byte string result
Length  5.0 & Local LoResult, HiResult ! Lower/upper 16 bit value
Length 10.0 & Local BigResult          ! 32 bit value

! Variables for GetPageSize
Length  5.0 & Local PageWidth, PageHeight		! Printable page size


! Program segment
.
.
Gosub GetPageSize					! Define printer page size
.
.

GetPageSize:
    Print (LUN) (GetPageInfo = PTR.PAGEINFO.PRINTABLESIZE) 
    Gosub GetFuncResult                ! Get low and high 16 bit results
    PageWidth = LoResult               ! Store resulting page width
    PageHeight = HiResult              ! Store resulting page height
Return

GetFuncResult:
    Print (LUN) (GetFuncResult)                   ! Request result
    Input (LUN) Result$                           ! Input result
    Word$     = SUB(Result$,2,1)+ Result$         ! Get and reverse 1st 2 bytes
    LoResult  = HEXDEC(Word$)                     ! Convert to MTB numeric
    Word$     = SUB(Result$,4,1)+SUB(Result$,3,1) ! Get and reverse 2nd 2 bytes 
    HiResult  = HEXDEC(Word$)                     ! Convert to MTB numeric 
    BigResult = HiResult*65536+LoResult           ! Combined 32 bit numeric value
Return
Example 2:
! Variables for GetFuncResult
Length      2 & Local Word$				! Temporary 2 byte word holder
Length      4 & Local Result$				! 4 byte string result
Length   5.0 & Local LoResult, HiResult			! Lower/upper 16 bit value
Length 10.0 & Local BigResult				! 32 bit value

! Variables for GetBkMode
Length   5.0 & Local PrevBkMode


! Program segment
.
.
Gosub GetBkMode
.
.

GetBkModeSize:
    Print (GetBkMode) 
    Gosub GetFuncResult					! Get lresults
    PrevBkMode = LoResult					! Store resulting mode
Return

GetFuncResult:
    Print (LUN) (GetFuncResult)				! Request result
    Input (LUN) Result$					! Input result
    Word$	= SUB(Result$,2,1)+ Result$		! Get and reverse 1st 2 bytes
    LoResult	= HEXDEC(Word$)				! Convert to MTB numeric
    Word$	= SUB(Result$,4,1)+SUB(Result$,3,1)	! Get and reverse 2nd 2 bytes 
    HiResult	= HEXDEC(Word$)				! Convert to MTB numeric 
    BigResult	= HiResult*65536+LoResult		! Combined 32 bit numeric value
Return