/************************************************************************* * * (c) Copyright 1992,1993,1994 by G & A Technical Software, Inc., * 28 Research Drive, Hampton, Virginia, 23666. * * All Rights Reserved. No part of this software or publication may be * reproduced, stored in a retrieval system, or transmitted, in any form * or by any means, electronic, mechanical, photocopying, recording, or * otherwise without the prior written permission of G & A Technical * Software, Inc. * ************************************************************************* * * Filename: s3_emt_parse_funcs.c * * Purpose: Support functions for the EMT file Parser * * Author: John Burton * * Date: 4/12/97 * ************************************************************************* * * Modification History: * * $Log: s3_parser_emt_functions.c,v $ * Revision 2.1 1994/07/08 17:52:24 jcburt * Updated typedefs, defines and function protypes to allow recursive * parsing of pct files. Enabled use of sub-PDT files and scoping of * datasets. Datasets used in a pct must be defined either in the * associated pdt file or the pdt file associated with the direct * ancestors of the current pct file. * * DataSet functions and subroutines now have an additional parameter * passed to them, indicating the number of parameters passed in the * dataset list, i.e. was: function(DataSet **dl) * now: function(int nargs, DataSet **dl) * Parameters passed to the dataset routines from the PCT level are all * still contained in the dataset list, nargs is during the function or * subroutine call from s3_exec_enode * * Revision 2.0.0.1 1994/06/28 18:48:28 jcburt * S3 Version 2.0 Initial Source * * ************************************************************************* * * Revision Control Information: */ static char rcsid[] = "$Id: s3_parser_emt_functions.c,v 2.1 1994/07/08 17:52:24 jcburt Exp $"; static char rcsrev[] = "$Revision: 2.1 $"; /************************************************************************* * * Include Files * *************************************************************************/ #include #include #include #include #include #include #include #include "s3_defines.h" #include "s3_typedefs.h" #include "s3_externals.h" #include "s3_globals.h" #include "s3_parser.tab.h" #include "s3_parser_globals.h" /************************************************************************* * * Defines and Macros * *************************************************************************/ /************************************************************************* * * Global Variables * *************************************************************************/ static File_list *LibList = NULL; static File_list *ObjList = NULL; char *loadflags = D_LOADFLAGS; char *applib = NULL; char *shapplib = NULL; static char *libname = NULL; char *uliblist = NULL; static char *uobjlist = NULL; static char *Make_cmd = NULL; static char *Export_file = NULL; static char *exports = NULL; static int build_shared_lib = FALSE; /************************************************************************* * * Global Variables Access & Manipulation Routines * *************************************************************************/ File_list *s3_GetLibList(void) { return (LibList); } void s3_SetLibList(File_list *list) { LibList = list; } void s3_AddLibstoLibList(File_list *list) { File_list *curr; if(LibList == NULL) LibList = list; else { curr = LibList; while(curr->next != NULL) curr = curr->next; curr->next = list; } } File_list *s3_GetObjList(void) { return (ObjList); } void s3_SetObjList(File_list *list) { ObjList = list; } void s3_AddObjstoObjList(File_list *list) { File_list *curr; if(ObjList == NULL) ObjList = list; else { curr = ObjList; while(curr->next != NULL) curr = curr->next; curr->next = list; } } void s3_init_parser_emt(char *basename) { struct stat buff; char tmp[128]; int len, result; libname = strsave2("lib",strsave2(basename,".a")); applib = strsave2(strsave2(shlibdir,"/lib"),strsave2(basename,".a")); shapplib = strsave2(strsave2(shlibdir,"/lib"),strsave2(basename,".so")); Export_file = strsave2(strsave2(shlibdir,"/"),strsave2(progname,".exp")); } /************************************************************************* * * Module: * * Description: * * Syntax: * * Inputs: * * Outputs: * * Returns: * * Modules Called: * *************************************************************************/ void s3_setup_pnode(char *name ,char *fname) { ST_entry *entry; if((entry = s3_add_symbol(name)) == NULL) s3_parse_warning("symbol %s previously defined",name); else { entry->pn.type = PNODE; entry->pn.parsed = FALSE; entry->pn.NE = 0; entry->pn.EOI = 0; entry->pn.EOL = NULL; entry->pn.description = NULL; entry->pn.filename = strsave(fname); entry->pn.breakpt = NULL; entry->pn.elkey = NULL; entry->pn.elist = NULL; entry->pn.NDS = 0; entry->pn.dslist = NULL; } } /************************************************************************* * * Module: * * Description: * * Syntax: * * Inputs: * * Outputs: * * Returns: * * Modules Called: * *************************************************************************/ void s3_setup_enode(int type, ST_entry **entry, int count) { int i,j,result; char *tmp,*etmp; if((type == DFUNC)||(type == DSUBR)) return; etmp = strsave(""); emt_info->exe_list = s3_add_to_list(emt_info->exe_list,entry, &(emt_info->nexe),count); for(i=0;ien.name); etmp = stringcat(etmp,"\n"); entry[i]->ss.type = type; entry[i]->en.NDS = UNDEFINED; entry[i]->en.function = NULL; entry[i]->en.filename = strsave(shapplib); } if(exports == NULL) exports = strsave(etmp); else exports = stringcat(exports,etmp); xfree(etmp); } /************************************************************************* * * Module: * * Description: * * Syntax: * * Inputs: * * Outputs: * * Returns: * * Modules Called: * *************************************************************************/ void s3_add_objects_to_list(File_list *flist) { File_list *tmp; if(flist == NULL) { s3_parse_warning("No Object files specified"); return; } s3_AddObjstoObjList(flist); } /************************************************************************* * * Module: * * Description: * * Syntax: * * Inputs: * * Outputs: * * Returns: * * Modules Called: * *************************************************************************/ void s3_add_libs_to_list(File_list *flist) { File_list *tmp; char *lst,*ctmp; int len,result; struct stat buff1,buff2; if(flist == NULL) { s3_parse_warning("No libraries specified"); return; } s3_AddLibstoLibList(flist); }