On 09/05/2010 09:56 AM, Gabriel Dos Reis wrote:
>
> The errors are caused by mixing Lisp variables/instructions with Spad
> variables/instructions in way that the Spad compiler does not
> understand.  This is a problem common to all AXIOM compilers; older
> versions may let it pass by, but only to lead to random `memory may be
> damaged' errors.
>
> For example, in sendCommand(), we have
>
>              SETQ(tmpmathml$Lisp, MAKE_-STRING_-OUTPUT_-STREAM()$Lisp)$Lisp
>              SETQ(tmpalgebra$Lisp, MAKE_-STRING_-OUTPUT_-STREAM()$Lisp)$Lisp
>              SETQ(savemathml$Lisp, _$texOutputStream$Lisp)$Lisp
>              SETQ(savealgebra$Lisp, _$algebraOutputStream$Lisp)$Lisp
>
>
> As currently written, the variables `tmpmathml', `tmpalgebra', etc.,
> appear to be intended to Lisp-level special variables, not Spad
> variables.  However the Spad compiler does not know that.  So it
> generates code that does not  tell the Lisp compiler that they are
> special variables.  The way we  tell the Spad compiler that a Lisp
> variable is special, is that its name starts with a dollar --
> e.g. _$algebraOutputStream.
>
> On the other hand, I am not too sure you wanted `tmpmathml' or `tmpalgebra'
> to be Lisp-level special variables.  So, my question is: are they
> reasons why you don't say
>
>     tmpmathml :=  MAKE_-STRING_-OUTPUT_-STREAM()$Lisp
>     tmpalgebra := MAKE_-STRING_-OUTPUT_-STREAM()$Lisp
>     savemathml := _$texOutputStream$Lisp
>     savealgebra := _$algebraOutputStream$Lisp
>
> -- Gaby
>

Hi Gaby,

I tried out your suggestions both ways, with Lisp variables and with 
Spad variables, but still didn't get it to compile properly.

I have no idea what the problem is so I started stripping things out to 
try and isolate the problem.  I discovered that the first version below 
compiles but the second doesn't:

)abbrev package SOCKLIB SockLib

SockLib(): Public == Private where

     Public == Type with

         handleInsert: () -> Integer
         sendInsertFile: () -> String


     Private == add

         handleInsert() ==
             retval:Integer := 0
             SETQ(_$FILEINSERT,"test")
             retval

         sendInsertFile() ==
             retval:String := "test"
             fileInsert:String := _$FILEINSERT$Lisp



)abbrev package SOCKLIB SockLib

SockLib(): Public == Private where

     Public == Type with

         handleInsert: () -> Integer
         sendInsertFile: () -> String


     Private == add

         handleInsert() ==
             retval:Integer := 0
             SETQ(_$FILEINSERT,"test")
             retval

         sendInsertFile() ==
             retval:String := "test"
             fileInsert:String := _$FILEINSERT$Lisp
             retval


However if I replace 'sendInsertFile' with

         sendInsertFile() ==
             retval:String := "test"
             fileInsert:String := _$FILEINSERT$Lisp
           retval

then it  does compile.

Arthur

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to