/* Stubby - Generate stubs for dynamic-link libraries.
 * Copyright 1999 Tom Rothamel
 *
 * Stubby 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. It 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
 * 
 * This program generates another computer program. I do not assert a      
 * copyright on the generated program that is the normal output of this    
 * program. This is _not_, however, an authorization for you to modify     
 * this program to cause it to output more of itself than necessary for    
 * its proper operation in order to circumvent my copyright.               
 */

/* This file contains code to maintain the typehash. */

#include "str.h"
#include "stubby.h"
#include <glib.h>

GHashTable *typehash;

void init_typehash() {
	typehash = g_hash_table_new(g_str_hash, g_str_equal);
}

void add_type(char *name) {
	char *namedup;

	namedup = strdup(name);
	g_hash_table_insert(typehash, namedup, GINT_TO_POINTER(-1));
}

int istype(char *name) {
	return GPOINTER_TO_INT(g_hash_table_lookup(typehash, name));
}

