home *** CD-ROM | disk | FTP | other *** search
- /*
- fsyminit.c
-
- % fsym_Init() sfile initialization function
-
- C-scape 3.2
- Copyright (c) 1986-1989 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- ---------------------
- 12/20/88 jmd split from fsym.c, changed empty funcs to NULL
- 4/08/89 jdc added full names
- 4/21/89 jdc rewrote for non-global fsymlists
- 5/28/89 jdc added var type stuff
- 7/07/89 jdc all lists get open if is_lnf
- 7/20/89 jdc fixed for fptr, dptr change per ted
-
- 11/89/89 jmd changed void * to VOID *
- 1/20/90 jdc speeded data retrieval
- 1/24/90 jdc fixed retroactive bug
- 3/28/90 jmd ansi-fied
- 9/07/90 jmd renamed oslist funcs
- */
-
- #include "sed.h"
- #include "sfile.h"
-
- boolean fsym_Init(fsyminit_struct *fsyminit_list, oslist_type *oslist_array)
- {
- int i, list, datasize, handle, ffhandle, is_lnf = FALSE;
- char *name;
-
- for (list = 0; list < TOT_FSYM_COUNT; list++) {
- oslist_array[list] = NULL; /* some lists may not exist */
- }
- for (i = 0, list = 0;; i++) {
-
- if (fsyminit_list[i].name == NULL) {
- break;
- }
- else if (*(name = fsyminit_list[i].name) == FSYM_CHAR) {
-
- datasize = FSYM_DATASIZE;
- sscanf(name + 1, "%d", &list);
- if (list == FSYM_TY) {
- /* field funcs with var type for LNF */
- /* open the ffuncs list here the type list is opened below */
-
- if ((oslist_array[FSYM_FF] = oslist_Open(FSYM_LIST_START_SIZE, FSYM_DATASIZE + sizeof(int))) == NULL) {
- goto QUIT;
- }
- datasize = 0;
- is_lnf = TRUE;
- }
- if ((oslist_array[list] = oslist_Open(FSYM_LIST_START_SIZE, datasize)) == NULL) {
- goto QUIT;
- }
- }
- else {
- if ((handle = oslist_SetSym(oslist_array[list], fsyminit_list[i].name,
- (fsyminit_list[i].fptr == FNULL) ? (VOID *)&(fsyminit_list[i].dptr) : (VOID *)&(fsyminit_list[i].fptr))) < 0) {
- goto QUIT;
- }
- if (list == FSYM_TY) {
- /* put the ffuncs name in here the type is in above */
- if ((ffhandle = oslist_SetSym(oslist_array[FSYM_FF],
- fsyminit_list[i].name + strlen(fsyminit_list[i].name) + 1,
- (fsyminit_list[i].fptr == FNULL) ? (VOID *)&(fsyminit_list[i].dptr) : (VOID *)&(fsyminit_list[i].fptr))) < 0) {
-
- goto QUIT;
- }
- /* put the type handle into the ffuncs data */
- *((int *)((char *)oslist_GetData(oslist_array[FSYM_FF], ffhandle) + FSYM_DATASIZE)) = handle;
- }
- }
- }
- if (is_lnf) { /* LNF needs all lists */
-
- for (list = 0; list < TOT_FSYM_COUNT; list++) {
- if (oslist_array[list] == NULL
- && (oslist_array[list] = oslist_Open(FSYM_LIST_START_SIZE, FSYM_DATASIZE)) == NULL) {
- goto QUIT;
- }
- }
- }
- return(TRUE);
-
- QUIT:
- for (list = 0; list < TOT_FSYM_COUNT; list++) {
- oslist_Close(oslist_array[list]);
- }
- return(FALSE);
- }
-