Announcement

Collapse
No announcement yet.

Help with error 484

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with error 484

    I am working with a class, and i need to make conversions for all datatypes (a class for associative arrays), but, writing code for each class method would be too tedious. So, i was thinking i could generate methods with macros... and i ran across this error:

    Error 484 - Requires procedure (Function/Method...)

    Requires procedure (Sub/Function/Method/Property) - The statement or function found here is only allowed within a procedure (SUB, FUNCTION, METHOD or PROPERTY). Elsewhere, it has no valid meaning and must be removed.
    Basically what i am trying to do is generate apointer method, a getter and a setter, this is the macro code:

    Code:
    MACRO ASC_PLB_VAR_HANDLER(DT,GS,PT,TP)
        METHOD PT(BYVAL k AS STRING) AS DWORD
        END METHOD
        PROPERTY GET GS(byval k as string) AS DT
        END PROPERTY
        PROPERTY SET GS(byval k as string, BYVAL v AS DT)
        END PROPERTY    
    END MACRO
    And i am invoking it like this:

    Code:
    ASC_PLB_VAR_HANDLER(INTEGER,sInt,pInt,1)
    The macro is being invoked from within the INTERFACE body of a class... like this:

    Code:
    CLASS PluriBASIC_Associative_Class
        INTERFACE PluriBASIC_Associative_Interface
            INHERIT IUNKNOWN
            ASC_PLB_VAR_HANDLER(INTEGER,sInt,pInt,1)
        END INTERFACE
    END CLASS
    Am i doing something wrong or is it an error from PowerBASIC?















    www.pluribasic.com

  • #2
    Strange workaround i found... modifying the macro like this::

    Code:
    MACRO ASC_PLB_VAR_HANDLER(DT,GS,TP)
        END METHOD
        PROPERTY GET GS(byval k as string) AS DT
        END PROPERTY
        PROPERTY SET GS(byval k as string, BYVAL v AS DT)
    END MACRO
    And invoking it like this (for each datatype):

    Code:
    METHOD pInt(BYVAL k AS STRING) AS DWORD
       ASC_PLB_VAR_HANDLER(INTEGER,sInt,1)
    END PROPERTY
    www.pluribasic.com

    Comment


    • #3
      Strange! is that a work-around or just a compile-around? Could you use PB Collections or even iDictionary interfaces?

      Comment


      • #4
        I think it is a compile-around as you say. For the rest, yes, no problem, it all works fine once compiled. I think it is just that classes are block scanned and nothing else is expected besides methods. Once it finds one, macros work with no issues.
        www.pluribasic.com

        Comment

        Working...
        X