From 70076b6a47206b1e6c668cdc468e23953ae1f2fb Mon Sep 17 00:00:00 2001 From: compudj Date: Sat, 20 Aug 2005 15:23:09 +0000 Subject: [PATCH] remove old LTTV XML parser git-svn-id: http://ltt.polymtl.ca/svn@1027 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/parser.c | 1242 -------------------------------- ltt/branches/poly/ltt/parser.h | 226 ------ 2 files changed, 1468 deletions(-) delete mode 100644 ltt/branches/poly/ltt/parser.c delete mode 100644 ltt/branches/poly/ltt/parser.h diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c deleted file mode 100644 index 8e409aa9..00000000 --- a/ltt/branches/poly/ltt/parser.c +++ /dev/null @@ -1,1242 +0,0 @@ -/* - -parser.c: Generate helper declarations and functions to trace events - from an event description file. - -Copyright (C) 2002, Xianxiu Yang -Copyright (C) 2002, Michel Dagenais -Copyright (C) 2005, Mathieu Desnoyers - -This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* This program reads the ".xml" event definitions input files - and constructs structure for each event. - - The program uses a very simple tokenizer, called from a hand written - recursive descent parser to fill a data structure describing the events. - The result is a sequence of events definitions which refer to type - definitions. - - A table of named types is maintained to allow refering to types by name - when the same type is used at several places. Finally a sequence of - all types is maintained to facilitate the freeing of all type - information when the processing of an ".xml" file is finished. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - - -#include "parser.h" - -/***************************************************************************** - *Function name - * getSize : translate from string to integer - *Input params - * in : input file handle - *Return values - * size - *****************************************************************************/ - -int getSize(parse_file *in) -{ - gchar *token; - - token = getToken(in); - if(in->type == NUMBER) { - if(g_ascii_strcasecmp(token,"1") == 0) return 0; - else if(g_ascii_strcasecmp(token,"2") == 0) return 1; - else if(g_ascii_strcasecmp(token,"4") == 0) return 2; - else if(g_ascii_strcasecmp(token,"8") == 0) return 3; - } - else if(in->type == NAME) { - if(g_ascii_strcasecmp(token,"short") == 0) return 4; - else if(g_ascii_strcasecmp(token,"medium") == 0) return 5; - else if(g_ascii_strcasecmp(token,"long") == 0) return 6; - } - in->error(in,"incorrect size specification"); - return -1; -} - -/***************************************************************************** - *Function name - * error_callback : print out error info - *Input params - * in : input file handle - * msg : message to be printed - ****************************************************************************/ - -void error_callback(parse_file *in, char *msg) -{ - if(in) - g_printf("Error in file %s, line %d: %s\n", in->name, in->lineno, msg); - else - printf("%s\n",msg); -} - -/************************************************************************** - * Function : - * getNameAttribute,getFormatAttribute,getSizeAttribute,getValueAttribute - * getValueStrAttribute - * Description : - * Read the attribute from the input file. - * - * Parameters : - * in , input file handle. - * - * Return values : - * address of the attribute. - * - **************************************************************************/ - -gchar * getNameAttribute(parse_file *in) -{ - gchar * token; - gunichar car; - GIOStatus status; - - token = getName(in); - if(g_ascii_strcasecmp("name",token))in->error(in,"name was expected"); - getEqual(in); - - status = seekNextChar(in, &car); - if(status == G_IO_STATUS_EOF || status == G_IO_STATUS_ERROR) - in->error(in,"name was expected"); - else if(car == '\"') token = getQuotedString(in); - else token = getName(in); - return token; -} - -char * getFormatAttribute(parse_file *in) -{ - char * token; - - //format is an option - token = getToken(in); - if(g_ascii_strcasecmp("/",token) == 0 || g_ascii_strcasecmp(">",token) == 0){ - ungetToken(in); - return NULL; - } - - if(g_ascii_strcasecmp("format",token))in->error(in,"format was expected"); - getEqual(in); - token = getQuotedString(in); - return token; -} - -int getSizeAttribute(parse_file *in) -{ - /* skip name and equal */ - getName(in); - getEqual(in); - - return getSize(in); -} - -int getValueAttribute(parse_file *in) -{ - /* skip name and equal */ - getName(in); - getEqual(in); - - return getNumber(in); -} - -//for