if_menu.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 AT&T
* All Rights Reserved
*/
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.39 */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "wish.h"
#include "vtdefs.h"
#include "ctl.h"
#include "menudefs.h"
#include "token.h"
#include "slk.h"
#include "actrec.h"
#include "typetab.h"
#include "fm_mn_par.h"
#include "objmenu.h"
#include "var_arrays.h"
#include "terror.h"
#include "moremacros.h"
#include "interrupt.h"
#include "sizes.h"
#include "message.h"
#define MN_ONINTR PAR_ONINTR
#define MN_MENU 3
#define MN_HELP 4
#define MN_LIFE 5
#define MN_INIT 6
#define MN_BEGROW 7
#define MN_BEGCOL 8
#define MN_ROWS 9
#define MN_COLUMNS 10
#define MN_CLOSE 11
#define MN_REREAD 12
#define MN_MULTI 13
#define MN_MSELECT 14
#define MN_ALTSLKS 15
#define MN_FRMMSG 16
/* defined above
#define MN_INTR PAR_INTR
#define MN_ONINTR PAR_ONINTR
abs */
#define MN_ACTI PAR_ACTION
#define MN_DESC 4
#define MN_BUTT 5
#define MN_LININFO 6
#define MN_SHOW 7
#define MN_ARG 8
#define MN_SELECTED 9
#define MN_ITEMMSG 10
#define MN_INACTIVE 11
#define MN_KEYS 17
};
#define MN_FLD_KEYS 12
};
static struct menu_line objmenu_disp();
struct fm_mn parse_menu();
/*
** Calls setaction and returns the token.
*/
static token
{
token make_action();
}
/*
** Calls close function and frees the structures.
*/
static int
struct actrec *a;
{
int lcv, i;
char *p, *strchr();
Cur_rec = a;
for (i = 0; i < lcv; i++) {
*p = '\0';
if (p)
*p = '=';
}
/*
* Free information in the activation record
*/
}
/*
* Rereads if reread is set
*/
static int
struct actrec *a;
{
Cur_rec = a;
return(objmenu_reread(a));
return(SUCCESS);
}
/*
** Front-end to parser(), it sets up defaults.
*/
static struct fm_mn
int flags;
char *info_or_file;
{
return(fm_mn);
}
/*
** If a->id >= 0 this is a reread. If so it frees the old info.
** Either way it calls the parser.
*/
static int
register struct actrec *a;
{
extern char * itoa();
register int i, but;
char buf[10];
int lcv;
Cur_rec = a;
mi = CURmenuinfo();
/* make sure file exists and is readable (if there is a file)
* The "flags" say if a->path is the information
* itself or the file of where the information sits. abs k15
*/
{
if (a->id >= 0) /* if frame is already posted */
else
return(FAIL);
}
if (a->id >= 0)
if (a->id >= 0)
return(FAIL);
}
mn_vislist(mi);
(NUMactive() <= 0))
{
if (a->id >= 0) /* form is already posted */
{
if (a->lifetime == AR_INITIAL)
{
mess_temp("can't close this frame");
mess_lock();
}
else
{
return(FAIL);
}
}
else
{
return(FAIL);
}
}
else
for (i = 0; i < lcv; i++) {
continue;
}
if (a->id >= 0) {
}
return(SUCCESS);
}
/*
** Takes this object's information out of the altenv.
*/
static int
objmenu_noncur(a, all)
struct actrec *a;
bool all;
{
register int i;
register char *p;
int lcv;
Cur_rec = a;
for (i = 0; i < lcv; i++) {
*p = '\0';
if (p)
*p = '=';
}
if (all)
return(menu_noncurrent(a->id));
else
return(SUCCESS);
}
/*
** Moves information in this object's altenv to the major altenv.
*/
static int
struct actrec *a;
{
int line;
char *str;
Cur_rec = a;
copyAltenv(ARGS());
return(menu_current(a->id));
}
/*
** get the right ARGS. abs k18
*/
static int
struct actrec *a;
{
Cur_rec = a;
copyAltenv(ARGS());
return(menu_current(a->id));
}
/*
** Calculates the show functions to decide which menu lines and SLKs
** should be shown.
*/
{
int i;
int lcv;
}
else {
}
NUMactive() = 0;
for (i = 0; i < lcv; i++)
else
/*
* Keep track of number of active menu items
*/
NUMactive()++;
}
}
/*
* TOGGLE MARK will toggle the "mark" flag for a given menu
* item indexed by i (Multiple Selection Menus).
*/
toggle_mark(ptr, i)
int i;
{
}
/*
* ISMARKED will check for the "mark" flag
*/
int i;
{
if (!att)
return(0);
toggle_mark(ptr, i);
}
}
/*
** Calculates NAME, FLAGS, and DESCRIPTION
*/
static struct menu_line
objmenu_disp(n, mi)
int n;
{
register int i;
struct menu_line m;
else {
m.flags = 0;
m.flags = MENU_INACT;
}
}
return(m);
}
/*
** Shrinks the string (if needed) to max_len characters.
** Terminate the string with TRUNCATE_STR to show that it was
** truncated.
*/
char *
char *str;
int max_len;
{
int len;
{
}
else
{
}
return(shrunk);
}
int
int cmd;
{
int pos;
switch (cmd)
{
case CTGETARG:
{
char *str;
return(FAIL);
{
return(SUCCESS);
}
return(FAIL);
}
case CTSETMSG:
{
/*
* if arg1 == TRUE then the frame message was
* generated "externally" (i.e., via the message
* built-it). Update the "framemsg" descriptor
* accordingly.
*/
char *newmsg, *get_mess_frame();
newmsg = get_mess_frame();
}
else
return(SUCCESS);
}
case CTSETLIFE:
{
char *life;
/* used Cur_rec before. abs F15 */
return(SUCCESS);
}
case CTSETSTRT:
{
char *str;
return(SUCCESS);
}
/* not needed (yet) afterall. to add must make this routine return char *
case CTGETDESCRIPTION:
{
menuinfo *mi = (menuinfo *)arg2;
struct fm_mn *ptr = &(mi->fm_mn);
if (arg1 >= array_len(mi->visible))
return(NULL);
else
return(multi_eval(ptr, mi->visible[arg1], MN_DESC));
}
*/
default:
}
}
/*
** Uses path_to_ar() and nextpath_to_ar() to see if it is a reopen
** and if so, makes it current. Otherwise, it builds the actrec and
** calls ar_create().
*/
int
register char **args;
{
register int i;
int do_inline;
char *life;
char envbuf[6];
a.serial = 0;
{
}
else
{
}
envbuf[3]++, i++)
break;
return(SUCCESS);
}
break;
}
if (do_inline)
else
a.id = -1;
Cur_rec = &a;
if (objmenu_reread(&a) == FAIL)
return(FAIL);
/*
* create the menu (menu frame)
*/
(char *)mi);
return(FAIL);
a.flags = AR_ALTSLKS;
else
a.flags = 0;
}
/*
** Takes a line number and calls setaction on its ACTION.
** (re-evaluate the lifetime descriptor before actually performing
** the specifie action via "setaction")
*/
linaction(n)
int n;
{
}
/*
** Catches SLKs and processes them.
*/
{
int line;
char *ott_to_path();
int *slks;
extern int Arg_count;
int lcv;
/* kludge for per-item message (menu_stream passes TOK_NEXT) */
return(TOK_NOP);
}
}
else
delAltenv("LININFO");
int num;
int i;
for (i = 0; i < lcv; i++) {
}
}
/*
* If this is a multiple selection menu then
* mark the item (and update the menu)
*/
/*
* SELECTED is updated in the alternate
* environment in case the "action" descriptor
* contains a reference to $SELECTED
*/
putAltenv("SELECTED=true");
else
putAltenv("SELECTED=false");
}
else {
}
}
return(tok);
}
/*
** Calls menu_stream and objmenu_stream()
*/
static token
if_omsh(a, t)
struct actrec *a;
register token t;
{
extern token menu_stream();
register int olifetime;
Cur_rec = a;
func[0] = menu_stream;
return(t);
}