/* * rtmk - A free real-time micro-kernel. * Copyright (c) 1999, 2000 Johan Rydberg. * * 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, 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ /* * $Id: type.c,v 1.1 2001/12/13 02:09:38 jrydberg Exp $ */ #include #include #include #include "type.h" queue_head_t type_list; void type_interal (char *name, char *cname, int t) { struct type *type; type = type_allocate (); type->name = name; type->cname = cname; type->type = t; type_add (type); } void types_init () { queue_init (&type_list); type_interal ("int", "int", 0); type_interal ("char", "char", 0); } struct type * type_allocate () { struct type *type; type = (struct type *) malloc (sizeof *type); assert (type != 0); memset (type, 0, sizeof *type); return type; } void type_add (type) struct type *type; { enqueue (&type_list, &type->link); } struct type * type_find (name) char *name; { struct type *type; for (type = (struct type *) queue_first (&type_list); !queue_end (&type_list, &type->link); type = (struct type *) queue_next (&type->link)) { if (strcmp (type->name, name) == 0) return type; } return (struct type *) 0; }