[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 25 14:12:52 1994 
Subject:Re: sys_io_control 
From:Adrian Howard 
Volume-ID:941126.02 

In article <CzqGFC.B9s@csug.cs.reading.ac.uk>,
Anthony Worrall <adw@Reading.ac.uk> wrote:
>
>I want to use sys_io_control with a record structure define as a C structure
>using newc_dec and external declare. However when I call sys_io_control it
>complains that the structure is not byte accessable.

That's because it isn't ;-) The Pop-11 structure created by LIB * NEWC_DEC
contains full-fields, ie:

    vars foo = initaudio_info(false);
    foo.datakey.class_field_spec=>
    ** [full exptr full full full full]

The Pop-11 "shadow" does not have the same structure as the external
structure, therefore passing it to sys_io_control will not work.

You want to pass the underlying external structure to sys_io_control. So,
first we make an external pointer to a fixed byte addressable struture of the
appropriate size:

    vars e_mem = exptr_init_fixed(SIZEOFTYPE(:audio_info), string_key)

then we turn it into an audio_info structure

    vars foo = initaudio_info(e_mem);

We can now access the byte addressable string stored in the external_ptr_props
field of the e_mem structure.

    sys_io_control(dev, AUDIO_GETINFO, e_mem.external_ptr_props) =>

Easy eh :-)

It would be nicer if exptr_mem structures were byte addressable, but for some
reason they're not --- I'll raise a bug report on this.

Adrian

aids (adrianh@cogs.susx.ac.uk)  ObDisclamer: Poplog used to pay my wages
Phone: +44 (0)273 678367  URL: http://www.cogs.susx.ac.uk/users/adrianh/