T.R | Title | User | Personal Name | Date | Lines |
---|
2228.1 | | ULTRA::WRAY | John Wray, Secure Systems Development | Wed Feb 07 1990 11:14 | 32 |
| The type should be obvious from module DWT, in file
SYS$LIBRARY:DECW$DWT_.ADA, and the Ada compiler should also have listed
the type it was expecting when it tried to find a DWT$FETCH_SET_VALUES
procedure whose signature matched the actuals. The Ada compiler
generates very helpful error messages, containing a lot of information.
It's worth reading them.
From SYS$LIBRARY:DECW$DWT_.ADA:
procedure FETCH_SET_VALUES (
STATUS : out CARDINAL_TYPE; -- return value
HIERARCHY_ID : in DRM_HIERARCHY_TYPE;
WIDGET : in WIDGET_TYPE;
ARGS : in ARG_ARRAY_TYPE;
NUM_ARGS : in CARDINAL_TYPE);
ARGS is an ARG_ARRAY_TYPE, which is defined as follows:
type ARG_ARRAY_TYPE is array (NATURAL range <>) of ARG_TYPE;
where
type ARG_TYPE is
record
ARG_NAME : STRNG_TYPE; -- ptr to actual chars
ARG_VALUE : ARG_VAL_TYPE; -- index into arglist
end record;
So your user needs an array of ARG_TYPEs, not a single one.
John
|
2228.2 | ARG_VAL_TYPE the issue, not ARGS... | PEACHS::BELDIN | | Wed Feb 07 1990 12:28 | 45 |
| Re .1
> type ARG_TYPE is
> record
> ARG_NAME : STRNG_TYPE; -- ptr to actual chars
> ARG_VALUE : ARG_VAL_TYPE; -- index into arglist
> end record;
>
I guess the question should be restated in that how do you specify items
for the ARG_VALUE field of the ARG_TYPE record. On page 4-16 of the
DECwindows Programming, Vol II of Toolkit Routines in the chapter on
DRM routines, they show an example (in C) of how to specify the name
and value part of the arglist. They show:
args[n].name = "label"
args[n].value = "OK_button_label"
Now, the problem is when you look at what ARG_VAL_TYPE is it is defined to
be (from SYS$LIBRARY:DECW$DWT_.ADA):
-- System Dependent Definitions
--
--
-- XtArgVal ought to be a union of caddr_t, char *, long, int *, and proc *
-- but casting to union types is not really supported.
--
-- So the typedef for XtArgVal should be chosen such that
--
-- sizeof (XtArgVal) >= sizeof(caddr_t)
-- sizeof(char *)
-- sizeof(long)
-- sizeof(int *)
-- sizeof(proc *)
--
-- ArgLists rely heavily on the above typedef.
--
--***************************************************************
subtype ARG_VAL_TYPE is INTEGER;
When he tries to assign a string to that item of the arglist, he gets a
compiler error. Is he supposed to pass a ptr to the string? That is what
C does... Or are the bindings in error?
Rick Beldin
|
2228.3 | | QUARK::LIONEL | Free advice is worth every cent | Wed Feb 07 1990 13:26 | 7 |
| You need to assign the address of a null-terminated string to the VALUE
field of the array element. STRNG_TYPE is a subtype of SYSTEM.ADDRESS.
The DECBURGER and HELLOWORLD Ada examples have lots of uses of this type
of construct, though FETCH_SET_VALUES isn't used directly in either one.
Steve
|
2228.4 | | ULTRA::WRAY | John Wray, Secure Systems Development | Wed Feb 07 1990 13:40 | 33 |
| You're better off using the convenience routines to get inside an
ARG_ARRAY_TYPE value:
declare
arglist : dwt.arg_array_type(0..0);
label : constant string:= "OK_button_label" & ascii.nul;
begin
-- Put some values into the argument list
dwt.vms_set_arg(label'address,
arglist,
0,
dwt.C_label);
-- Use arglist is a DWT.xxxxxx call
-- Then free any storage allocated by VMS_SET_ARG
for i in arglist'range loop
dwt.vms_free_argnames(arglist,i);
-- Free the storage allocated by VMS_SET_ARG for the
-- copy it makes of the argument name
end loop;
end;
There is a convenience routine called VMS_SET_DESC_ARG, which is
supposed to stuff a string directly into an ARG_ARRAY_TYPE (so you
don't have to declare a constant null-terminated string and get the
address of it), but I don't see how you're supposed to free up the
temporary storage that that will allocate (unless VMS_FREE_ARGNAMES
is very clever, which I doubt). Maybe the documentation fo V5.3 is
clearer on this point?
John
|
2228.5 | | QUARK::LIONEL | Free advice is worth every cent | Wed Feb 07 1990 15:13 | 4 |
| VMS_FREE_ARGNAMES is indeed what you use to free the storage allocated
by VMS_SET_DESC_ARG.
Steve
|