[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Fri, 13 Feb 2004 16:49:12 +0000 (UTC) 
Subject:Re: importing typedefs from C to Poplog 
From:Aaron Sloman 
Volume-ID: 

David writes:

> Date: Fri, 13 Feb 2004 12:43:34 +0000 (UTC)
> ..
> Hi, all,
>
> I was just wondering if its possible to import typedef enums from a C so
> object into pop11.

I don't know anything about typedef enums, but using grep found a
use of 'enum' in the C code for the poplog widget set (Xpw):

    $usepop/pop/x/Xpw/XpwPixmap.h

typedef enum {
    PixmapOn,
    PixmapOff,
    PixmapHasNone,
    PixmapOnly
} PixmapStatus;

So you can perhaps look to see where that is used in the C code and
pop11 code for Xpw

    grep PixmapStatus $usepop/pop/x/Xpw/*
    grep PixmapStatus $usepop/pop/x/pop/lib/Xpw/*.p

It looks as if typedef enum enables you to define an ordered list of
symbolic types. The compiled C code will probably have translated
those names into some low level so I don't believe you will be able
automatically to get them to be presented to pop11 as words or
strings. You may find they come out as integers, and you'll then
have to do your own translation, perhaps using a property, e.g.
always writing something like pop11_of(BOOL),e.g.

    if pop11_of(BOOL) == "true" then....

Maybe you'll find something relevant in REF SHADOWCLASS, which I
have never read -- but grep shows that it includes 'typedef'

 From the context provided by the rest of the message I wonder
whether you are trying to use sockets in Pop11.

If that is the case there is already an elaborate package described
in REF SOCKETS. The code for it can be viewed using
    SHOWLIB unix_sockets

Maybe by copying and changing some of the code in there you can get
what you want if the library does not already provide what you want.

That pop11 library file has

    include unix_sockets.ph;
    include unix_errno.ph;

In pop11 'include' is for merging another file with the current
compilation stream (eg to get lconstant macro definitions), and you
can look at the included file using 'showinclude'

    ENTER showinclude unix_sockets.ph


> Also wondering if its possible to get pointers (char * to be exact) into
> pop11 from C.

Things of that sort are required for the pop11 X window interface,
among other things. Relevant files include
    REF EXTERNAL
    REF EXTERNAL_DATA
    REF DATA

But I've never used them myself.

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