[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 30 19:43:05 2003 
Subject:Poplog for Redhat 9 now fixed! 
From:Aaron Sloman 
Volume-ID:1030630.01 


The last two messages from Waldek Hebisch seem to have sorted out the
problem, and I am very grateful, as I had thought there was a bug in the
new linker.

I  much prefer to learn that the bugs are in what I have done, because
then I can fix them without waiting for someone else to do it!

So I am very grateful for Waldek's efforts.

He wrote:
> Date: 30 Jun 2003 14:03:47 GMT
>
> Aaron Sloman (axs@cs.bham.ac.uk) wrote:
> : A little more thought suggested that that should be changed to ensure
> : that the conversions between pop11 integers and system integers are
> : right:
 
> :  define active DO_ERRNO_VAL() -> _x;
> :      _extern get_libc_errno() -> _x;
> :      _pint(_x) -> _x;
> :  enddefine;
>
>
> :  define updaterof active DO_ERRNO_VAL(_x);
> :      _extern set_libc_errno(_int(_x))
> :  enddefine;
>
> That does not seem right, the values obtained from/stored to
> errno are clearly treated as non-pop objects.

That is what I originally thought from looking at the contexts
in which the macro _ERNNO occurred. But I could not understand why
the program was not working, and thought I must have missed the
need to convert between system integers and pop11 integers.

Making that change *appeared* to produce a system that worked,
as long as I linked it on redhat 8 not redhat 9. In retrospect
I don't know how it could have worked as well as it did.
So I've now followed Waldek's advice and removed the conversions.

I then followed his additional advice in treating the 'set' C
procedure as returning a result. Apparently although declared as 'void'
it was producing a result that was just left on the poplog stack and
causing all the problems. This may be because of how the _extern syntax
word works in syspop11.

(I have never written programs that invoke external code, so I am
not familiar with all the gory details. Maybe one day I should
study REF EXTERNAL which explains it all...)

Waldek wrote, in his first message:

> Maybe updater of _ERRNO is leaving garbage on poplog stack?
> By the way, I tried in slightly different way and at the moment
> I am getting similar mishaps.
> ...

Then in his later message.

> Date: 30 Jun 2003 14:44:03 GMT
> Organization: Politechnika Wroclawska
>
> Suspecting stack corraption i slightly modified what Aaron Sloman wrote:
> : Step 1:
> : Put Waldek's two C procedures in
> :     $popexternlib/c_core.c
 
> :      int get_libc_errno(void)
> :      {
> :              return errno;
> :      }
 
> :      void set_libc_errno(int x)
> :      {
> :              errno = x;
> :      }
>
> changed to
>
> int set_libc_errno(int x)
> {
>         errno = x;
>         return 0;
> }

OK. Ive copied this now.

> : and run mklibpop to compile them and build the library
> :     $popexternlib/libpop.a
 
> : Step 2:
> : Put an active variable definition in $popsrc/errors.p to
> : invoke those two C programs.
 
> :  define active DO_ERRNO_VAL() -> _x;
> :      _extern get_libc_errno() -> _x
> :  enddefine;
>
>
> :  define updaterof active DO_ERRNO_VAL(_x);
> :      _extern set_libc_errno(_x)
> :  enddefine;
>
> changed to:
>
> define updaterof active DO_ERRNO_VAL(_x);
>      lvars _dummy;
>      _extern set_libc_errno(_x) -> _dummy
> enddefine;

I've slightly modified this to

define updaterof active DO_ERRNO_VAL(_x);
     _extern set_libc_errno(_x) ->
enddefine;

I.e. assigning to nothing removes an item from the stack.

> .....
> : Finally: recompile all the system sources and relink
> ,,,,
> It seems to work OK, at least the mishaps and weird error messages
> which appeared prevoiusly are gone.
>

I have found the same. I now have a version of poplog that starts up on
Redhat 9 without the warning message about 'errno' and also apparently
runs without errors.

I'll do some more testing and will then put a 'patch' tar file
on the poplog web site that can be untarred over an existing
poplog installation to convert it. I'll later build a complete
installation with the fixes.

Many thanks for your help.

Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/ (And free book on Philosophy of AI)
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html