ootread.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
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
#include <stdio.h>
#include "wish.h"
#include "typetab.h"
#include "optabdefs.h"
#include "partabdefs.h"
#include "ifuncdefs.h"
#include "mess.h"
#include "mio.h"
#include "terror.h"
#include "var_arrays.h"
#include "sizes.h"
/*
* read the object operations and parts information from the definition
* of the internal TeleSystem name of the object. The format of this file is:
*
* OBJECT DEFINITIONS
* Number of parts
* Part Definition 1
* Part Definition 2
* ...
* Part Definition n
* Operation Definition 1
* Operation Definition 2
* ...
* Operation Definition m
*
* where:
* OBJECT DEFINITIONS = displayname class oeu format applic prod rclass
* Part Definition = partname template flags
* Operation Def = funcname but type intern extern optype mult all none
*
* All fields are tab separated. See optabdefs.h and partabdefs.h for the
* format of the internal tables.
*
* Basically, the way this whole thing works is that there is an internal
* set of tables (the oot and the opt) which define internally-known
* objects. If a VAR adds an object, he makes a file with the above format
* which will define it. If the object architecture is asked to handle an
* object which is not in the internal table, it looks out in the external
* files directory for a file with the name of the object it is supposed to
* handle. It reads it into the last slot of the internal table. Thus, if
* such an object is accessed twice in a row, there is no need to read it in
* again the second time.
*/
extern struct operation Ascii_open;
struct operation Obj_viewfull;
struct operation Unknown_ex;
struct operation Unknown_cv;
struct oper_trans {
char *name;
} Optrans[] = {
{"SH", &Obj_sh},
{"VI", &Obj_view},
{"CP", &Obj_cp},
{"RN", &Obj_rn},
{"MV", &Obj_mv},
{"SP", &Obj_sp},
{"SC", &Obj_sc},
{"UNSC", &Obj_unsc},
{"RM", &Obj_rm},
{"UNRM", &Obj_unrm},
{"ML", &Obj_ml},
{"VF", &Obj_viewfull},
{"PR", &Ascii_pr},
{"ED", &Ascii_open},
{"UNK_EX", &Unknown_ex},
{"UNK_CV", &Unknown_cv},
{"ASC_CV", &Ascii_cv},
{"DIR_SH", &Dir_sh},
{"DIR_VI", &Dir_view},
{"DIR_EX", &Dir_ex},
{"NOP", &No_op},
{"ILL", &Illeg_op},
{"",NULL}
};
static char **Notfound; /* all the objects I could never find... */
int
char *obj;
{
char *fname;
register int i;
char *externoot();
int lcv;
if (Notfound)
{
for (i = 0; i < lcv; i++)
return O_FAIL;
}
return O_FAIL;
}
return O_FAIL;
}
for (i = 0; i < MAX_OPERS; i++) {
break;
}
if (i < MAX_OPERS)
return O_OK;
}
static int
int index;
{
char *p;
register int i;
extern int (*Function[MAX_IFUNCS])();
char *get_skip();
char *tab_parse();
char *unbackslash();
long tab_long();
return O_FAIL;
if (buf[0] == '.') {
#ifdef _DEBUG
#endif
return O_OK;
}
}
#ifdef _DEBUG
#endif
return O_FAIL;
}
if (optab->intern_func < 0 || optab->intern_func >= MAX_IFUNCS || Function[optab->intern_func] == NULL) {
#ifdef _DEBUG
#endif
}
if (p && *p) {
#ifdef _DEBUG
"PARSED FUNC: %s %x %x %x %s %x %x %x %x at %d\n",
index);
#endif
return O_OK;
}
#ifdef _DEBUG
#endif
return O_FAIL;
}
#ifndef WISH
int
{
struct one_part *p;
register int i, j;
extern char *Oasys;
struct operation **obj_to_oot();
struct opt_entry *obj_to_opt();
char *esc_nl();
char *ctime();
for (i=0; i < MAX_TYPES; i++) {
continue;
}
return(O_OK);
}
return(O_FAIL);
return(O_FAIL);
return(O_FAIL);
time(&t);
p->part_template, p->part_flags);
}
/* find alias if one exists */
break;
oot[i]->intern_func,
}
}
char *
esc_nl(s)
char *s;
{
if (s == NULL || *s == '\0')
return("none");
while (*s) {
if (*s != '\n')
*ns = *s;
else {
*ns++ = '\\';
*ns = 'n';
}
s++;
ns++;
}
*ns = '\0';
return(&news[0]);
}
#endif