Shop OBEX P1 Docs P2 Docs Learn Events
how to use tokenizer.dll in VB6??? — Parallax Forums

how to use tokenizer.dll in VB6???

phd_swedenphd_sweden Posts: 6
edited 2010-12-30 06:38 in BASIC Stamp
anyone know how to properly declare the function in tokenizer.dll in VB?
e.g how to do wite the Declare statement after that you have referred to the tokenizer.dll?

I just get the "can not find entry point to" error...

grateful for any help

/Anders

Comments

  • Jon SinnreichJon Sinnreich Posts: 3
    edited 2010-12-29 08:06
    Hello Anders,

    I have had limited success with this procedure. In a declaration module, I have added the following code:
    '
    Type pbTModuleRecType ' TModuleRec record type
    Suceeded As Long
    Error As Long
    DebugFlag As Byte
    TargetModule(2) As Byte
    TargetStart As Long
    ProjectFiles(6) As Long
    ProjectFilesStart(6) As Long
    Port As Long
    PortStart As Long
    LanguageVersion As Long
    LanguageStart As Long
    SourceSize As Long
    ErrorStart As Long
    ErrorLength As Long
    EEPROM(2047) As Byte
    EEPROMFlags(2047) As Byte
    VarCounts(3) As Byte
    PacketCount As Byte
    PacketBuffer(2303) As Byte
    End Type

    Type pbSrcTokReference ' SrcTokReference record type
    pbtSrcStart As Integer
    pbtTokStart As Integer
    End Type

    Global Sourcebuffer() As Byte ' Source buffer dynamic array declaration
    Global TModuleRec As pbTModuleRecType ' TModuleRec declaration
    Global TSrcTokReference(2337) As pbSrcTokReference ' SrcTokReference array declaration

    Public Declare Function TestRecAlignment Lib "tokenizer.dll" (ByRef TMR As pbTModuleRecType) As Boolean
    Public Declare Function Version Lib "tokenizer.dll" () As Integer
    Public Declare Function Compile Lib "tokenizer.dll" (ByRef TMRec As pbTModuleRecType, ByRef SBuffer As Byte, _
    DirectivesOnly As Boolean, ParseStampDirective As Boolean, STRef As pbSrcTokReference) As Boolean
    '

    Note that I used Long data type (4 bytes) in place of the "Char" data they list in the documentation in the TModuleRec record type, since the data is a 4-byte long pointer to a memory location (not a character string). Also, the function declaration for the Compile declaration must include the SrcTokReference type, it is not optional and will not accept NULL when calling the function (contrary to the documentation example).

    Next, in my executable, I have tried either the command:

    pbTest = TestRecAlignment(TModuleRec)

    or, separately, the command:

    pbCompile = Compile(TModuleRec, Sourcebuffer(0), False, True, TSrcTokReference(0))

    (after filling the Sourcebuffer array with a BS2 command file). I think the TestRecAlignment function is working properly, the result of the function call is True and all the numeric values seem to fill in where they are supposed to. However, I have not been able to get sensible results from the character string pointers. When I look at the indicated memory location, all I get back are "??" strings. When using the Compile function, I also get a True result (as well as True in the Succeeded field), but the PacketCount is 0 and the packet buffer is empty! In other words, I can execute the code without getting any errors but it does not seem to actually compile anything.

    Hope this helps and please let me know if you get any farther.

    cheers,
    Jon
  • $WMc%$WMc% Posts: 1,884
    edited 2010-12-29 18:36
    Jon:
    '
    Join Date
    03-07-2006
    Last Activity
    Today 03:16 PM
    '
    One Post
    '
    You have really been saving it.
    '
    '
    P.S. Not even close
  • electrosyselectrosys Posts: 212
    edited 2010-12-30 02:12
    @ $WMc%
    That must be a new record. ; )
  • Jon SinnreichJon Sinnreich Posts: 3
    edited 2010-12-30 06:38
    OK, so I prefer reading to writing. "P.S. Not even close". Great, if you know the answer, care to share, or am I missing the point of this forum?

    Thanks in advance, Jon
Sign In or Register to comment.