⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 symbol2.c

📁 linux下简单对象应用协议的开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
/*symbol2.cSymbol table handling, type graph handling, and code generation.gSOAP XML Web services toolsCopyright (C) 2000-2007, Robert van Engelen, Genivia Inc. All Rights Reserved.This part of the software is released under one of the following licenses:GPL, the gSOAP public license, or Genivia's license for commercial use.--------------------------------------------------------------------------------gSOAP public license.The contents of this file are subject to the gSOAP Public License Version 1.3(the "License"); you may not use this file except in compliance with theLicense. You may obtain a copy of the License athttp://www.cs.fsu.edu/~engelen/soaplicense.htmlSoftware distributed under the License is distributed on an "AS IS" basis,WITHOUT WARRANTY OF ANY KIND, either express or implied. See the Licensefor the specific language governing rights and limitations under the License.The Initial Developer of the Original Code is Robert A. van Engelen.Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc. All Rights Reserved.--------------------------------------------------------------------------------GPL license.This program is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the Free SoftwareFoundation; either version 2 of the License, or (at your option) any laterversion.This program is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along withthis program; if not, write to the Free Software Foundation, Inc., 59 TemplePlace, Suite 330, Boston, MA 02111-1307 USAAuthor contact information:engelen@genivia.com / engelen@acm.org--------------------------------------------------------------------------------A commercial use license is available from Genivia, Inc., contact@genivia.com--------------------------------------------------------------------------------*/#include "soapcpp2.h"#ifdef HAVE_CONFIG_H#include "soapcpp2_yacc.h"#else#include "soapcpp2_yacc.tab.h"#endifchar *envURI = "http://schemas.xmlsoap.org/soap/envelope/";char *encURI = "http://schemas.xmlsoap.org/soap/encoding/";char *rpcURI = "http://www.w3.org/2003/05/soap-rpc";char *xsiURI = "http://www.w3.org/2001/XMLSchema-instance";char *xsdURI = "http://www.w3.org/2001/XMLSchema";char *tmpURI = "http://tempuri.org";static	Symbol *symlist = (Symbol*) 0;	/* pointer to linked list of symbols */static	Symbol *nslist = (Symbol*) 0;	/* pointer to linked list of namespace prefix symbols */static Tnode *Tptr[TYPES];Service *services = NULL;FILE *fout, *fhead, *fclient, *fserver, *fheader, *flib, *fmatlab, *fmheader;int typeNO = 1;	/* unique no. assigned to all types */static int is_anytype_flag = 0; /* anytype is used */static int has_nsmap = 0;int tagcmp(const char *s, const char *t);int is_soap12(const char*);int has_detail_string();int has_Detail_string();int is_header_or_fault(Tnode *typ);int is_body(Tnode *typ);int is_volatile(Tnode* typ);int is_untyped(Tnode* typ);int is_primclass(Tnode* typ);int is_imported(Tnode* typ);int is_template(Tnode* typ);int is_mask(Tnode* typ);int is_attachment(Tnode* typ);int is_void(Tnode* typ);int has_external(Tnode *typ);int has_volatile(Tnode *typ);int is_invisible(const char *name);int is_eq_nons(const char *s, const char *t);int is_eq(const char *s, const char *t);int is_item(Entry *p);const char *cstring(const char*);/*install - add new symbol*/Symbol *install(const char *name, Token token){ Symbol *p;  p = (Symbol*)emalloc(sizeof(Symbol));  p->name = emalloc(strlen(name)+1);  strcpy(p->name, name);  p->token = token;  p->next = symlist;  symlist = p;  return p;}/*lookup - search for an identifier's name. If found, return pointer to symbol table entry. Return pointer 0 if not found.*/Symbol *lookup(const char *name){ Symbol *p;  for (p = symlist; p; p = p->next)    if (!strcmp(p->name, name))      return p;  return NULL;}/*gensymidx - generate new symbol from base name and index*/Symbol *gensymidx(const char *base, int idx){ char buf[1024];  Symbol *s;  sprintf(buf, "%s_%d", base, idx);  s = lookup(buf);  if (s)    return s;  return install(buf, ID);}/*gensym - generate new symbol from base name*/Symbol *gensym(const char *base){ static int num = 1;  return gensymidx(base, num++);}/*mktable - make a new symbol table with a pointer to a previous table*/Table*mktable(Table *table){	Table	*p;	p = (Table*)emalloc(sizeof(Table));	p->sym = lookup("/*?*/");	p->list = (Entry*) 0;	if (table == (Table*) 0)		p->level = INTERNAL;	else	p->level = table->level+1;	p->prev = table;	return p;}/*mkmethod - make a new method by calling mktype*/Tnode*mkmethod(Tnode *ret, Table *args){	FNinfo *fn = (FNinfo*)emalloc(sizeof(FNinfo));	fn->ret = ret;	fn->args = args;	return mktype(Tfun, fn, 0);}/*freetable - free space by removing a table*/voidfreetable(Table *table){	Entry	*p, *q;	if (table == (Table*) 0)		return;	for (p = table->list; p != (Entry*) 0; p = q) {		q = p->next;		free(p);	}	free(table);}/*unlinklast - unlink last entry added to table*/Entry *unlinklast(Table *table){	Entry	**p, *q;	if (table == (Table*)0)		return (Entry*)0;	for (p = &table->list; *p != (Entry*)0 && (*p)->next != (Entry*)0;	     p = &(*p)->next);	q = *p;	*p = (Entry*)0;	return q;}/*enter - enter a symbol in a table. Error if already in the table*/Entry	*enter(table, sym)Table	*table;Symbol	*sym;{ Entry	*p, *q = NULL;  for (p = table->list; p; q = p, p = p->next)    if (p->sym == sym && p->info.typ->type != Tfun)    { sprintf(errbuf, "Duplicate declaration of %s (already declarared at line %d)", sym->name, p->lineno);      semerror(errbuf);      return p;    }  p = (Entry*)emalloc(sizeof(Entry));  p->sym = sym;  p->info.typ = NULL;  p->info.sto = Snone;  p->info.hasval = False;  p->info.minOccurs = 1;  p->info.maxOccurs = 1;  p->info.offset = 0;  p->level = table->level;  p->lineno = yylineno;  p->next = NULL;  if (!q)    table->list = p;  else    q->next = p;  return p;}/*entry - return pointer to table entry of a symbol*/Entry	*entry(table, sym)Table	*table;Symbol	*sym;{ Table	*t;  Entry	*p;  for (t = table; t; t = t->prev)    for (p = t->list; p; p = p->next)      if (p->sym == sym)	return p;  return NULL;}/*reenter - re-enter a symbol in a table.*/Entry	*reenter(table, sym)Table	*table;Symbol	*sym;{ Entry	*p, *q = NULL;  for (p = table->list; p; q = p, p = p->next)    if (p->sym == sym)      break;  if (p && p->next)  { if (q)      q->next = p->next;    else      table->list = p->next;    for (q = p->next; q->next; q = q->next)      ;    q->next = p;    p->next = NULL;  }  return p;}Entry *enumentry(Symbol *sym){ Table	*t;  Entry	*p, *q;  for (t = enumtable; t; t = t->prev)  { for (p = t->list; p; p = p->next)    { q = entry(p->info.typ->ref, sym);      if (q)	return q;    }  }  return NULL;}char *get_mxClassID(Tnode*);char *t_ident(Tnode*);char *c_ident(Tnode*);char *ident(char*);char *soap_type(Tnode*);char *c_storage(Storage);char *c_init(Entry*);char *c_type(Tnode*);char *c_type_id(Tnode*, char*);char *xsi_type_cond(Tnode*, int);char *xsi_type(Tnode*);char *xsi_type_cond_u(Tnode*, int);char *xsi_type_u(Tnode*);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -