hla

HLA example calling error


'm starting at the HLA world, and I'm trying to compile the example, CallingHLA, and HLA compile the code, I am getting the following error:

Error in file "hlaFunc.hla" at line 76 [errid:82229/hlaparse.bsn]:
Too few actual parameters.
Near: << ) >>

HLAPARSE assembly failed with 1 errors

the code is:

unit hlaFuncUnit;

#include( "stdlib.hhf" )

procedure hlaFunc( i:int32 ); @cdecl; @external( "_hlaFunc" );

procedure BuildExcepts; @external("BuildExcepts__hla_");
procedure HardwareException; @external( "HardwareException__hla_" );
procedure DefaultExceptionHandler; @external( "DefaultExceptionHandler__hla_" );

procedure HWexcept; @external( "HWexcept__hla_" );
procedure DfltExHndlr; @external( "DfltExHndlr__hla_" );
procedure QuitMain; @external( "QuitMain__hla_" );

procedure ExitProcess( rtnCode:dword ); @external( "_ExitProcess@4" );

static
    MainPgmVMT: dword:= &QuitMain;

    MainPgmCoroutine:   dword[ 5 ]; @external( "MainPgmCoroutine__hla_" );
    MainPgmCoroutine:   dword; @nostorage;
                        dword &MainPgmVMT, 0, 0;
    SaveSEHPointer:     dword; @nostorage; // Still part of MainPgmCoroutine...
                        dword 0, 0;

procedure QuitMain;
begin QuitMain;

    ExitProcess( 1 );

end QuitMain;

procedure HWexcept;
begin HWexcept;

    jmp HardwareException;

end HWexcept;

procedure DfltExHndlr;
begin DfltExHndlr;

    jmp DefaultExceptionHandler;

end DfltExHndlr;

procedure hlaFunc( i:int32 );
var
    s:string;

begin hlaFunc;

    call BuildExcepts;

    try

        stdout.put( "stdout.put called from HLA code, i = ", i, nl );
        raise( 5 );

      exception( 5 );
        stdout.put( "Exception handled by HLA code" nl );

    endtry;

    try
        stralloc( 16 );
        mov( eax, s );
        str.cpy( "Hello World", s );
        stdout.put( "Successfully copied 'Hello World' to s: ", s, nl );
        str.cpy( "0123456789abcdefghijklmnop", s );
        stdout.put( "Shouldn't get here" nl );

      anyexception

        stdout.put( "Exception code: ", eax, nl );
        ex.printExceptionError();

    endtry;
    strfree( s );
    stdout.put( "Returning to C code" nl );

    mov( SaveSEHPointer, eax );

    #asm
        mov fs:[0], eax
    #endasm

end hlaFunc;

end hlaFuncUnit;

Where is the erro ( I know, the error is in TRY ), but, how I can solve that error ? Thanks


Solution

  • The problem is printExceptionError, it should be something like this:

    ex.printExceptionError( eax, ebx, ecx, edx, edi );
    

    so, as the error says, you are missing the parameters.