📄 printlist.c
字号:
/* * printlist.c * Asterix * * Created by Erick van Rijk on 9/28/05. * Copyright 2005 __MyCompanyName__. All rights reserved. * */#include "printlist.h"void print_list(const List *list){#ifdef DEBUG int i=0; for (i=0; i< list_size(list); i++) { Declaration * decl; Type *type; char *name; decl = list_index(list, i); if (decl->subtype==var_decl){ type = VAR_DECL(decl).type; switch (type->subtype) { case record_type: name = RECORD_TYPE(type).decl->token->name; printf("VAR_DECL:case recordtype: List location %d contains subtype %d name %s with type %d\n", i,decl->subtype,name,type->subtype); break; case subprog_type: name = SUBPROG_TYPE(type).decl->token->name; printf("VAR_DECL:case subprogtype: List location %d contains subtype %d name %s with type %d\n", i,decl->subtype,name,type->subtype); break; case int_type: printf("VAR_DECL:int_type\n"); break; case bool_type: printf("VAR_DECL:bool_type\n"); break; case char_type: printf("VAR_DECL:char_type\n"); break; case null_type: printf("VAR_DECL:null_type\n"); break; case real_type: printf("VAR_DECL:real_type\n"); break; case array_type: printf("VAR_DECL:array_type\n"); break; case void_type: printf("VAR_DECL:void_type\n"); break; default: name = "Unknown"; printf("VAR_DECL:Unknown\n"); } } if (decl->subtype==record_decl){ printf("record decl: List location %d contains subtype %d and name %s\n", i, decl->subtype, decl->token->name); printf("Sub list is\n"); print_list(RECORD_DECL(decl).var_list); printf("end sub list\n"); } }#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -