[comp.sys.apollo] Need help with creating a pad.

cantrell@killer.Dallas.TX.US (Keith Cantrell) (03/10/89)

Could some kind sole tell me what is wrong with the following code.
All I am trying to do is create a window with a help file in it.
Every time I try an run this I get an "Invalid leaf" error, but I
know the file exist!  I am running a C-Shell under BSD4.2 with
SR 9.7.


#include "/sys/ins/base.ins.c"
#include "/sys/ins/pad.ins.c"
#include "/sys/ins/error.ins.c"

main()

{
  char *path = {"/sys/help/help.hlp"};
  status_$t status;
  pad_$window_desc_t window_desc;
  stream_$id_t stream_id;
  
  window_desc.top = window_desc.left = window_desc.height = 
    window_desc.width = 0;
  pad_$create_window(path, (short) strlen(path), pad_$read_edit, (short) 1,
                     window_desc, stream_id, status);
  error_$print(status);
}

Thanks for any help,

Keith

-----------------------------------------------------------------------
Keith Cantrell                Phones:  hm: 214-492-1088
Integrated Telecom                     wk: 214-234-3340

USMAIL:                       EMAIL:
2100 Sonata Ln                cantrell@killer.DALLAS.TX.US
Carrollton TX 75007                   or
                  ...!uunet!{killer | texsun | letni}!dalitc!keith
-----------------------------------------------------------------------

lnz@LUCID.COM (Leonard N. Zubkoff) (03/10/89)

Change

  pad_$create_window(path, (short) strlen(path), pad_$read_edit, (short) 1,
                     window_desc, stream_id, status);

to

  pad_$create_window(*path, (short) strlen(path), pad_$read_edit, (short) 1,
                     window_desc, stream_id, status);

GBOPOLY1@NUSVM.BITNET (fclim) (03/10/89)

     In article <7489@killer.Dallas.TX.US>, Keith Cantrell ask
> Could some kind sole tell me what is wrong with the following code.
> All I am trying to do is create a window with a help file in it.
> Every time I try an run this I get an "Invalid leaf" error, but I
> know the file exist!  I am running a C-Shell under BSD4.2 with
> SR 9.7.

Your problem is that when you declared path as
    char *path;      /* A pointer */
you must pass path to pad_$create_window() as in
    pad_$create_window(*path, (short)strlen(path), ...);
ie you must derefernce path.  The reason is the differences in the ways
C and Pascal passes arguments.

Another way to fix the problem is
    char path[BUFSIZ];      /* An array */
    strcpy(path, "/sys/help/help.hlp");
    pad_$create_window(path, (short)strlen(path), ...);

You have to use either method whenever you uses any Aegis
subroutines that requires string arguments.

fclim.  :-)

fclim          --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu
computer centre
singapore polytechnic
dover road
singapore 0513.

bhv@igloo.Scum.COM (Bronis Vidugiris) (03/11/89)

In article <7489@killer.Dallas.TX.US> cantrell@killer.DALLAS.TX.US (Keith Cantrell) writes:
=Could some kind sole tell me what is wrong with the following code.
=All I am trying to do is create a window with a help file in it.
=Every time I try an run this I get an "Invalid leaf" error, but I
=know the file exist!  I am running a C-Shell under BSD4.2 with
=SR 9.7.
=
=
=#include "/sys/ins/base.ins.c"
=#include "/sys/ins/pad.ins.c"
=#include "/sys/ins/error.ins.c"
=
=main()
=
={
=  char *path = {"/sys/help/help.hlp"};
=  status_$t status;
=  pad_$window_desc_t window_desc;
=  stream_$id_t stream_id;
=  
=  window_desc.top = window_desc.left = window_desc.height = 
=    window_desc.width = 0;
=  pad_$create_window(path, (short) strlen(path), pad_$read_edit, (short) 1,

I haven't tried compiling this myself - but from past experience I suspect
that you will have to replace path with *path here due to the vagaries of
the 'standard call'.  Another workaround is to copy the information in
path into a variable declared with the 'standard' filename type - (don't
recall what it is.  Hope this works

=                     window_desc, stream_id, status);
=  error_$print(status);
=}
=
-- 
bhv@igloo