📄 fbtype.c
字号:
/* * FBCC - A simple C compiler. * * Copyright (c) 1996 Fabrice Bellard * * Contact addresses: * mail: Fabrice Bellard, 451 chemin du mas de Matour, 34790 Grabels, France * email: bellard@email.enst.fr * url: http://www.enst.fr/~bellard * * 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; either version 2 of the License, or * (at your option) any later version. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *//* * types handling */#include <stdlib.h>#include <stdio.h>#include "fbcc.h"int local_var_size;SYM *local_var_sym;BLOCK *block_decl;/* * Parsing de la liste de sp閏ificateurs * Retourne le type du sp閏ificateur */int Spec_Parse(int *spec_storage1,SYM **spec_sym,LIST *spec){ int a,spec_storage; int spec_type,spec_sign; spec_sign=0; spec_type=0; spec_storage=STORAGE_DEFAULT; while (spec!=NULL) { a=hd_tag(spec); switch(a) { case QUALIF_CONST: case QUALIF_VOLATILE: break; case TYPE_SIGNED: case TYPE_UNSIGNED: if (spec_sign==0) { spec_sign=a; } else if (spec_sign!=a) Error("'unsigned' et 'signed' incompatibles"); break; case TYPE_VOID: case TYPE_CHAR: case TYPE_SHORT: case TYPE_INT: if ((spec_type==TYPE_INT && a==TYPE_SHORT) || (spec_type==TYPE_SHORT && a==TYPE_INT)) { spec_type=TYPE_SHORT; } else if (spec_type!=0) { Error("Trop de sp閏ificateurs de types"); } else { spec_type=a; } break; case TYPE_TYPEDEF_IDENT: spec=tl(spec); if (spec_type!=0) Error("Trop de sp閏ificateurs de types"); spec_type=TYPE_TYPEDEF_IDENT; *spec_sym=hd_sym(spec); break; case TYPE_STRUCT: case TYPE_UNION: case TYPE_ENUM: spec=tl(spec); *spec_sym=hd_sym(spec); if (spec_type!=0) Error("Trop de sp閏ificateurs de types"); spec_type=a; break; case STORAGE_AUTO: case STORAGE_REGISTER: case STORAGE_STATIC: case STORAGE_EXTERN: case STORAGE_TYPEDEF: if (spec_storage!=STORAGE_DEFAULT) Error("Plus d'un sp閏ificateur de type de stockage d閒ini"); spec_storage=a; break; default: Error("Sp閏ificateur non impl閙ent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -