/* acf4:comp.os.vms / ACM@NAUVAX.UCC.NAU.EDU / 9:54 am Dec 21, 1990 */ In the last six months I've seen the same question over and over. How does one call/use SMG$ menu routines from VAX C ?? Well, I'd solved that one about the time I saw the first query on INFO-VAX. There seems to be enough interest though that I'll post a copy to the list. This program does essentially the same thing as the FORTRAN example in the RTL manual except that it has been rewritten in VAX C. The biggest problem was taking apart the bizzare descriptor that SMG needs when it is passed an array of strings. The first typedef is that descriptor. C Source follows... ---------------------------cut here-------------------------------- typedef struct { short int length; /* MAXSTRLEN */ char dtype; /* 14 string */ char class; /* 04 array */ char *pointer; /* address of first element */ char scale; /* zero */ char digits; /* zero */ char aflags; /* 224 column dominant BLKs 2 and 3 */ char dimct; /* 01 dimension count */ int arsize; /* ARRAYSIZE */ int a0; /* address of A(0) */ int m1; /* NUMOFSTRINGS */ int l1; /* 0 lower bound */ int u1; /* NUMOFSTRINGS - 1 upper bound */ } strarydsc; typedef struct { short int length; /* length of the string */ char dtype; /* 14 string */ char class; /* 01 fixed length */ char *pointer; /* address of string */ } strdsc; #define MAXSTRLEN 20 #define NUMOFSTRINGS 5 #define ARRAYSIZE MAXSTRLEN * NUMOFSTRINGS #include #include void build_descr(strdsc *p,char *s); main() { strarydsc choices; char list[NUMOFSTRINGS][MAXSTRLEN]={"One","Two","Three","Four","Five"}; strdsc string; char s[MAXSTRLEN]; int pbid,kbid,did1,did2,i; short int n; build_descr(&string,s); string.length = MAXSTRLEN; /* strcpy(list[0],"One"); strcpy(list[1],"Two"); strcpy(list[2],"Three"); strcpy(list[3],"Four"); strcpy(list[4],"Five"); */ choices.length = MAXSTRLEN; choices.dtype = 14; choices.class = 4; choices.pointer = &list[0][0]; choices.scale = 0; choices.digits = 0; choices.aflags = 224; choices.dimct = 1; choices.arsize = ARRAYSIZE; choices.a0 = &list[0][0]; choices.m1 = NUMOFSTRINGS; choices.l1 = 0; choices.u1 = NUMOFSTRINGS - 1; i = smg$create_pasteboard(&pbid); i = smg$create_virtual_keyboard(&kbid); i = smg$create_virtual_display(&6,&50,&did1,&SMG$M_BORDER); i = smg$create_virtual_display(&6,&50,&did2,&SMG$M_BORDER); i = smg$paste_virtual_display(&did2,&pbid,&2,&2); i = smg$paste_virtual_display(&did1,&pbid,&10,&2); i = smg$create_menu(&did1,&choices,&SMG$K_HORIZONTAL,0,&2,&SMG$M_REVERSE); while (n != 4) { i = smg$select_from_menu(&kbid,&did1,&n,&0,0,0,0,0, &string,&SMG$M_BOLD,&0); i = smg$put_line(&did2,&string); } i = smg$delete_menu(&did1); i = smg$delete_virtual_display(&did1); i = smg$delete_virtual_display(&did2); i = smg$delete_virtual_keyboard(&kbid); i = smg$delete_pasteboard(&pbid); } void build_descr(p,s) /* Build descriptor takes a STRDSC struct and a string and builds */ /* a fixed length string descriptor out of the STRDSC struct. */ strdsc *p; char s[]; { p->length = strlen(s); p->dtype = 14; p->class = 1; p->pointer = s; } ---------------------------and here-------------------------------- Tony McCracken ACM@nauvax.ucc.nau.edu /* ---------- */