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

📄 soapcpp2_lex.l

📁 linux下简单对象应用协议的开发库
💻 L
📖 第 1 页 / 共 2 页
字号:
				if (yytext[k] == 10 || yytext[k] == 13)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';		 	if (strcmp(s, "encoded"))				m->part = s;			else				m->part = "";		}		else if (!strncmp(yytext+i, "method-response-encoding:", 25))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = RESPONSE_ENCODING;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] == 10 || yytext[k] == 13)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';		 	if (strcmp(s, "encoded"))				m->part = s;			else				m->part = "";		}		else if (!strncmp(yytext+i, "method-documentation:", 21))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = COMMENT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] == 10 || yytext[k] == 13)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-action:", 14))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = ACTION;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-mime-type:", 17))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = MIMEIN | MIMEOUT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-input-mime-type:", 23))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = MIMEIN;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-output-mime-type:", 24))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = MIMEOUT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-header-part:", 19))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = HDRIN | HDROUT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-input-header-part:", 25))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = HDRIN;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-output-header-part:", 26))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = HDROUT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "method-fault:", 13))		{	m = (Method*)emalloc(sizeof(Method));			m->name = s;			m->mess = FAULT;			m->part = NULL;			m->next = sp->list;			sp->list = m;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] <= 32)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			m->part = s;		}		else if (!strncmp(yytext+i, "type-documentation:", 19))		{	d = (Data*)emalloc(sizeof(Data));			d->name = s;			d->part = NULL;			d->next = sp->data;			sp->data = d;			for (j = k; yytext[j]; j++)				if (yytext[j] > 32)					break;			for (k = j; yytext[k]; k++)				if (yytext[k] == 10 || yytext[k] == 13)					break;			if (j == k)				return;			s = (char*)emalloc(k-j+1);			strncpy(s, yytext+j, k-j);			s[k-j] = '\0';			d->part = s;		}		else                {	sprintf(errbuf, "unrecognized gsoap directive: %s", yytext+i);			semwarn(errbuf);		}	}	else        {	sprintf(errbuf, "unrecognized gsoap directive: %s", yytext);		semwarn(errbuf);	}}static void option(){	int i;	if (imports)        {	sprintf(errbuf, "options directive: %s ignored in imported file(s)", yytext);		semwarn(errbuf);		return;	}	for (i = 10; yytext[i]; i++)		if (yytext[i] > 32)			break;	for (; yytext[i]; i++)		switch (yytext[i])		{	case 'c':				cflag = 1;				break;		 	case 'e':				eflag = 1;				break;		 	case 'n':				nflag = 1;				break;		 	case 'l':				lflag = 1;				break;		 	case 't':				tflag = 1;				break;		 	case 'w':				wflag = 1;				break;			default:				if (yytext[i] <= 32)					return;		}}/*	error_chr - lexical error in character constant. Return character 0 to	allow parsing to continue*/static Tokenerror_chr(){	lexerror("Ending-' missing in character constant");	yylval.c = '\0';	return CHR;}/*	error_str - lexical error in string. Return empty string to allow	parsing to continue*/static Tokenerror_str(){	lexerror("Ending-\" missing in string");	yylval.s = "";	return STR;}/*	Character conversion functions*/static intconvchar(int *p){	switch (yytext[(*p)++])	{	case 'a':	return '\a';		case 'b':	return '\b';		case 'f':	return '\f';		case 'n':	return '\n';		case 'r':	return '\r';		case 't':	return '\t';		case 'v':	return '\v';		case 'x':	return hexchar(p);		case '0':		case '1':		case '2':		case '3':		case '4':		case '5':		case '6':		case '7':	(*p)--;				return octchar(p);		default:	return yytext[*p-1];	}}static inthexchar(int *p){	int i, d, c = 0;	for (i = 0; isxdigit(d = yytext[*p]) && i < 2; i++)	{	c = (c << 4) + (d <= '9' ? d - '0' : toupper(d) - '7');		(*p)++;	}	return c;}static intoctchar(int *p){	int i, d, c = 0;	for (i = 0; (d = yytext[*p]) >= '0' && d <= '7' && i < 3; i++)	{	c = (c << 3) + d - '0';		(*p)++;	}	return c;}static void module(const char *name, const char *fullname){ if (!fullname)    fullname = name;  if (imports)  { Pragma **pp;    char *s = emalloc(strlen(fullname)+15);    sprintf(s, "#include \"%sH.h\"", fullname);    for (pp = &pragmas; *pp; pp = &(*pp)->next)      if (!strcmp((*pp)->pragma, s))        break;    if (!*pp)    { *pp = (Pragma*)emalloc(sizeof(Pragma));      (*pp)->pragma = s;      (*pp)->next = NULL;    }    imported = (char*)emalloc(strlen(fullname)+1);    strcpy(imported, fullname);    fprintf(stderr, "Importing module '%s'\n\n", fullname);  }  else  { lflag = 1;    typeNO = magic(name);    prefix = (char*)emalloc(strlen(fullname)+1);    strcpy(prefix, fullname);    fprintf(stderr, "Compiling module '%s' (magic number = %d)\n\n", fullname, typeNO);  }}static int magic(const char *name){ size_t i;  int n;  if (strlen(name) > 4)    semerror("#module name length must not exceed four characters");  n = 0;  for (i = 0; i < strlen(name); i++)    if (name[i] >= 'a' && name[i] <= 'z')      n = 26*n + name[i] - 'a';    else if (name[i] >= 'A' && name[i] <= 'Z')      n = 26*n + name[i] - 'A';    else      semerror("#module name must be alphabetic and the length must not exceed four characters.\nUse '#module name longname' for longer names.");  return 4699*n + 153424;}#ifdef WITH_LEXstatic void import(const char *file){ execerror("Cannot #import: soapcpp2 not compiled with flex");}#elsestatic void import(const char *file){ char buf[1024];  struct importlist *p;  for (p = importlist; p; p = p->next)    if (!strcmp(p->name, file))      return;  if (imports >= MAX_IMPORT_DEPTH)    execerror("Imports nested too deep");  instk[imports] = YY_CURRENT_BUFFER;  strcpy(fnstk[imports], filename);  lnstk[imports] = yylineno;  imstk[imports] = imported;  /* imported = NULL; this is useful to change the semantics of #import to NOT consider non-module imports to be part of the current module */  imports++;  if (!(yyin = fopen(file, "r")))  { if (importpath)    { char *s, *t;      s = importpath;      do      { t = strstr(s, SOAP_PATHSEP);        if (t)        { if (t - s >= sizeof(buf))	    t = s + sizeof(buf) - 1;	  strncpy(buf, s, t - s);	  buf[t - s] = '\0';	  s = t + sizeof(SOAP_PATHSEP) - 1;	}	else        { strcpy(buf, s);          s = NULL;	}        strcat(buf, "/");        strcat(buf, file);        yyin = fopen(buf, "r");      }      while (s && !yyin);    }    if (!yyin)    { sprintf(errbuf, "#import: Cannot open file \"%s\" for reading.\nHint: use option -I<path> (you can define multiple paths separated with '"SOAP_PATHSEP"')", file);      execerror(errbuf);    }  }  p = (struct importlist*)malloc(sizeof(struct importlist) + strlen(file)); /* has already + 1 byte size */  strcpy(p->name, file);  p->next = importlist;  importlist = p;  strcpy(filename, file);  yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));}#endif

⌨️ 快捷键说明

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