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

📄 preproc.c

📁 关系型数据库 Postgresql 6.5.2
💻 C
📖 第 1 页 / 共 5 页
字号:
{	/* make sure this is a valid indicator variable */	switch (var->typ)	{		struct ECPGstruct_member *p;		case ECPGt_short:		case ECPGt_int:		case ECPGt_long:		case ECPGt_unsigned_short:		case ECPGt_unsigned_int:		case ECPGt_unsigned_long:			break;		case ECPGt_struct:		case ECPGt_union:			for (p = var->u.members; p; p = p->next)				check_indicator(p->typ);			break;		case ECPGt_array:			check_indicator(var->u.element);			break;		default: 			yyerror ("indicator variable must be integer type");			break;	}}static char *make1_str(const char *str){        char * res_str = (char *)mm_alloc(strlen(str) + 1);	strcpy(res_str, str);	return res_str;}static char *make2_str(char *str1, char *str2){ 	char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + 1);	strcpy(res_str, str1);	strcat(res_str, str2);	free(str1);	free(str2);	return(res_str);}static char *cat2_str(char *str1, char *str2){ 	char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + 2);	strcpy(res_str, str1);	strcat(res_str, " ");	strcat(res_str, str2);	free(str1);	free(str2);	return(res_str);}static char *make3_str(char *str1, char *str2, char * str3){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + 1);             strcpy(res_str, str1);        strcat(res_str, str2);	strcat(res_str, str3);	free(str1);	free(str2);	free(str3);        return(res_str);}    static char *cat3_str(char *str1, char *str2, char * str3){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + 3);             strcpy(res_str, str1);	strcat(res_str, " ");        strcat(res_str, str2);	strcat(res_str, " ");	strcat(res_str, str3);	free(str1);	free(str2);	free(str3);        return(res_str);}    static char *make4_str(char *str1, char *str2, char *str3, char *str4){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + strlen(str4) + 1);             strcpy(res_str, str1);        strcat(res_str, str2);	strcat(res_str, str3);	strcat(res_str, str4);	free(str1);	free(str2);	free(str3);	free(str4);        return(res_str);}static char *cat4_str(char *str1, char *str2, char *str3, char *str4){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + strlen(str4) + 4);             strcpy(res_str, str1);	strcat(res_str, " ");        strcat(res_str, str2);	strcat(res_str, " ");	strcat(res_str, str3);	strcat(res_str, " ");	strcat(res_str, str4);	free(str1);	free(str2);	free(str3);	free(str4);        return(res_str);}static char *make5_str(char *str1, char *str2, char *str3, char *str4, char *str5){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + strlen(str4) + strlen(str5) + 1);             strcpy(res_str, str1);        strcat(res_str, str2);	strcat(res_str, str3);	strcat(res_str, str4);	strcat(res_str, str5);	free(str1);	free(str2);	free(str3);	free(str4);	free(str5);        return(res_str);}    static char *cat5_str(char *str1, char *str2, char *str3, char *str4, char *str5){            char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + strlen(str3) + strlen(str4) + strlen(str5) + 5);             strcpy(res_str, str1);	strcat(res_str, " ");        strcat(res_str, str2);	strcat(res_str, " ");	strcat(res_str, str3);	strcat(res_str, " ");	strcat(res_str, str4);	strcat(res_str, " ");	strcat(res_str, str5);	free(str1);	free(str2);	free(str3);	free(str4);	free(str5);        return(res_str);}    static char *make_name(void){	char * name = (char *)mm_alloc(yyleng + 1);	strncpy(name, yytext, yyleng);	name[yyleng] = '\0';	return(name);}static voidoutput_statement(char * stmt, int mode){	int i, j=strlen(stmt);	fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"", connection ? connection : "NULL");	/* do this char by char as we have to filter '\"' */	for (i = 0;i < j; i++)		if (stmt[i] != '\"')			fputc(stmt[i], yyout);	fputs("\", ", yyout);	/* dump variables to C file*/	dump_variables(argsinsert, 1);	fputs("ECPGt_EOIT, ", yyout);	dump_variables(argsresult, 1);	fputs("ECPGt_EORT);", yyout);	mode |= 2;	whenever_action(mode);	free(stmt);	if (connection != NULL)		free(connection);}static struct typedefs *get_typedef(char *name){	struct typedefs *this;	for (this = types; this && strcmp(this->name, name); this = this->next);	if (!this)	{		sprintf(errortext, "invalid datatype '%s'", name);		yyerror(errortext);	}	return(this);}static voidadjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dimension, int type_index, bool pointer){	if (type_index >= 0) 	{		if (*length >= 0)                      	yyerror("No multi-dimensional array support");		*length = type_index;	}		       	if (type_dimension >= 0)	{		if (*dimension >= 0 && *length >= 0)			yyerror("No multi-dimensional array support");		if (*dimension >= 0)			*length = *dimension;		*dimension = type_dimension;	}	if (*length >= 0 && *dimension >= 0 && pointer)		yyerror("No multi-dimensional array support");	switch (type_enum)	{	   case ECPGt_struct:	   case ECPGt_union:	        /* pointer has to get dimension 0 */                if (pointer)	        {		    *length = *dimension;                    *dimension = 0;	        }                if (*length >= 0)                   yyerror("No multi-dimensional array support for structures");                break;           case ECPGt_varchar:	        /* pointer has to get dimension 0 */                if (pointer)                    *dimension = 0;                /* one index is the string length */                if (*length < 0)                {                   *length = *dimension;                   *dimension = -1;                }                break;           case ECPGt_char:           case ECPGt_unsigned_char:	        /* pointer has to get length 0 */                if (pointer)                    *length=0;                /* one index is the string length */                if (*length < 0)                {                   *length = (*dimension < 0) ? 1 : *dimension;                   *dimension = -1;                }                break;           default: 	        /* a pointer has dimension = 0 */                if (pointer) {                    *length = *dimension;		    *dimension = 0;	        }                if (*length >= 0)                   yyerror("No multi-dimensional array support for simple data types");                break;	}}#line 651 "preproc.y"typedef union {	double                  dval;        int                     ival;	char *                  str;	struct when             action;	struct index		index;	int			tagname;	struct this_type	type;	enum ECPGttype		type_enum;} YYSTYPE;#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define	YYFINAL		2494#define	YYFLAG		-32768

⌨️ 快捷键说明

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