if_help.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.42 */
#include <stdio.h>
#include <string.h>
#include <curses.h>
#include "wish.h"
#include "vtdefs.h"
#include "ctl.h"
#include "token.h"
#include "winp.h"
#include "form.h"
#include "slk.h"
#include "actrec.h"
#include "typetab.h"
#include "fm_mn_par.h"
#include "objhelp.h"
#include "var_arrays.h"
#include "terror.h"
#include "moremacros.h"
#include "interrupt.h"
#include "vt.h" /* abs for headers */
#include "sizes.h"
#include "message.h"
#define HL_ONINTR PAR_ONINTR
#define HL_TITLE 3
#define HL_TEXT 4
#define HL_WRAP 5
#define HL_EDIT 6
#define HL_INIT 7
#define HL_LIFE 8
#define HL_ROWS 9
#define HL_COLUMNS 10
#define HL_BEGROW 11
#define HL_BEGCOL 12
#define HL_HELP 13
#define HL_REREAD 14
#define HL_CLOSE 15
#define HL_ALTSLKS 16
#define HL_FRMMSG 17
/* defined above
#define HL_INTR PAR_INTR
#define HL_ONINTR PAR_ONINTR
*/
#define HL_ACTI PAR_ACTION
#define HL_BUTT 4
#define HL_SHOW 5
#define HL_KEYS 19
};
#define HL_FLD_KEYS 6
};
extern int Vflag; /* abs k15 */
extern char *strnsave();
extern char *shrink_str();
struct fm_mn parse_help();
static token bighelp_stream();
/*
** Returns a token so that the help object can be brought up.
*/
static token
objhelp_help(a)
struct actrec *a;
{
}
/*
** Frees up the structures and calls the close function.
*/
static int
struct actrec *a;
{
register int i, lcv;
char *p, *strchr();
Cur_rec = a;
/*
* free information IN the helpinfo structure
*/
if (PTRS()) /* holdptrs array */
for (i = 0; i < lcv; i++) { /* (e.g., $TEXT) */
*p = '\0';
if (p)
*p = '=';
}
/*
* Free information in the activation record structure
*/
return(SUCCESS);
}
/*
** Checks to see whether to reread and if so, calls reread.
*/
static int
struct actrec *a;
{
Cur_rec = a;
return(objhelp_reread(a));
return(SUCCESS);
}
/*
** Front-end to parser(), which sets up defaults.
*/
static struct fm_mn
int flags;
char *info_or_file;
{
return(fm_mn);
}
/*
** Frees contents of old help, and sets new one. Note: odptr
** is set either way since freeitup will not free anything if
** the single array is empty
*/
static int
register struct actrec *a;
{
register int i;
Cur_rec = a;
hi = CURhelpinfo();
/* 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)
/*
* very strange indeed ...
*
if (a->id < 0)
sing_eval(fm_mn, HL_CLOSE);
*/
return(FAIL);
}
if (PTRS())
for (i = 0; i < lcv; i++)
hl_vislist(hi);
/*
* If "init=false" then clean-up
*/
{
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);
}
}
/*
* update the interrupt descriptors in the activation rec
*/
/*
* Set up object's SLK array
*/
for (i = 0; i < lcv; i++) {
continue;
}
if (a->id >= 0)
return(SUCCESS);
}
/*
** Takes this object's information out of the major altenv.
*/
static int
objhelp_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(form_noncurrent(a->id));
else
return(SUCCESS);
}
/*
** Puts this object's altenv() into the major altenv().
*/
static int
struct actrec *a;
{
int ret;
Cur_rec = a;
copyAltenv(ARGS());
return(ret);
}
/*
** Sets up SLK array, based on show functions.
*/
{
int i;
int lcv;
else
for (i = 0; i < lcv; i++)
}
/* Size a text header by counting the newlines */
header_size(m)
formfield m;
{
register char *c;
register int linefeeds;
register struct vt *v;
if (*m.value == 0) /* null string */
return(0);
if (*c == '\n')
linefeeds++;
/* leave at least MIN_ROWS_TEXT rows for text */
}
/*
** Gives header and text as only fields, fields that have no names.
*/
static formfield
objhelp_disp(n, hi)
int n;
{
char *readfile();
formfield m;
static int header_rows;
switch (n)
{
case 0: /* non-scrolling header field. abs8/88 */
m.frow = 0;
m.fcol = 0;
m.nrow = VT_UNDEFINED;
m.ncol = VT_UNDEFINED;
break;
case 1: /* text field */
m.fcol = 0;
m.nrow = VT_UNDEFINED;
m.ncol = VT_UNDEFINED;
if (header_rows == 0) /* curses optimization.. */
break;
default:
}
return(m);
}
/*
** There are no args, so return FAIL. Otherwise, pass it on.
*/
int
int cmd;
{
return(FAIL);
/*
* 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);
}
char *life;
return(SUCCESS);
}
}
/*
** Uses path_to_ar and nextpath_to_ar to see if it is a reopen. If
** so, make it current. Otherwise, set up the actrec and call
** ar_create.
*/
int
register char **args;
{
register int i;
int do_inline;
extern char *filename();
char *life;
char *ptr;
{
}
else
{
}
envbuf[3]++, i++)
break;
return(SUCCESS);
}
break;
}
a.id = -1;
if (do_inline)
else
Cur_rec = &a;
if (objhelp_reread(&a) == FAIL)
return(FAIL);
if (Vflag) /* abs k15 */
else /* abs k15 */
objhelp_disp, (char *)hi);
return(FAIL);
a.flags = AR_ALTSLKS;
else
a.flags = 0;
}
/*
** Intercepts SLKs after the editor. Also, TOK_SAVE is an exit.
*/
{
char *buf, *s;
int *slks;
int lcv;
s = NULL;
int num;
int i;
for (i = 0; i < lcv; i++)
break;
}
}
if (!s) {
}
/* tok = sing_eval(CURhelp(), HL_DONE) ? TOK_CLOSE : TOK_BADCHAR; abs */
}
return(tok);
}
/*
** Sets up stream and calls stream.
*/
static token
bighelp_stream(a, t)
struct actrec *a;
register token t;
{
extern int field_stream();
register int olifetime;
Cur_rec = a;
return(t);
}