[futurebasic] buggy DCOD?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: "Pete" <furbies@...>
Date: Sun, 09 May 1999 17:28:46 +1000
First off let me apologise for the size of this post

Can someone see what might be wrong with the following code

I can't get it to work...
When ever I call the DCOD my app crashes, so I'm assuming that there's
something wrong with the DCOD

I've tried just about anything I can think of but no luck

Tia

Pete...

'=========================================
RESOURCES "vers.rsrc","rsrcRSED","DCOD",128,"Another Module"
COMPILE 0, _MacsBugLabels _CaseInsensitive _DimmedVarsOnly _pointerVars
_OptimizeAsInt
OUTPUT FILE "module.RSRC"
'=========================================
'Module Globals
'=========================================
DIM gModuleError%                                 'return any errors
'=========================================
DIM gModuleSelector%                              'what the Module is to do
_getModuleSpecs                 = 1
_processData                    = 2
_buildPrintReport               = 3
'=========================================
DIM gSMGrecPtr&                                   'points to the shared
global
:                                                 'rec in the ladder app
DIM RECORD SMGrec
  '
----------------------------
  DIM SMGtheDataH&                                'handle leading to the
'data'
  :                                               'from the user's "data"
file
  :                                               'loaded into memory by the
  :                                               'ladder app.
  :                                               'the ladder app creates &
  :                                               'destroys the handle
  DIM SMGtheData%                                 'if the gTheDataH& needs
to saved
  :                                               'then set gSaveTheData% to
_true
  '
----------------------------
  DIM SMGprintH&                                  'points to the handle the
Module
  :                                               'has created for printing
  :                                               'the module fills the
handle with
  :                                               'the preformatted data so
the
  :                                               'ladder app can print it
  :                                               'ladder app disposes of
the handle
  '
----------------------------
  :                                               'DEF USING globals
  DIM SMGerrorPtr&                                'points to the error
dialog in
  :                                               'the ladder app
  '
----------------------------
  DIM SMGreturn1&, SMGreturn2&                    'useful for sending
multiple
  DIM SMGreturn3&, SMGreturn4&                    'values to/from the ladder
app
  DIM SMGreturn5&, SMGreturn6&
  '
----------------------------
DIM END RECORD .SMGrec

DIM gSMGblk.SMGrec

'=========================================
'=========================================
END GLOBALS
GOTO "Start"
DEFSTR LONG
'=========================================
'Module Functions
'=========================================

LOCAL FN getModuleSpecs
  gSMGblk.SMGreturn1& = _"TEST"                   'module ident
  gSMGblk.SMGreturn2& = 1                         'version
  gSMGblk.SMGreturn3& = [_time]                   'compile date
END FN

'=========================================

LOCAL FN processData
  DIM dummy
  dummy = 1                                       'just so the FN does
something
END FN

'=========================================

LOCAL FN buildPrintReport
  DIM dummy
  dummy = 1                                       'just so the FN does
something
END FN

'=========================================
"Start"
'=========================================
ENTERPROC% (gModuleSelector%, gSMGrecPtr&)
  gModuleError% = _false

  LONG IF gSMGrecPtr&
    BLOCKMOVE gSMGrecPtr&, @gSMGblk, _SMGrec
    gModuleError% = _false

    SELECT gModuleSelector%
      CASE _getModuleSpecs:               FN getModuleSpecs
      CASE _processData:                  FN processData
      CASE _buildPrintReport:             FN buildPrintReport
    END SELECT

    BLOCKMOVE @gSMGblk, gSMGrecPtr&, _SMGrec
  XELSE
    gModuleError% = _true
  END IF
EXITPROC% = gModuleError%
RETURN
'=========================================