/* Copyright Yann Weber This file is part of asmsh. asmsh 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 3 of the License, or any later version. asmsh 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 asmsh. If not, see . */ #ifndef ASMSH_SHELL_ENV_H #define ASMSH_SHELL_ENV_H #include "config.h" #include #include #include #define ASMSH_VARNAME_MAX 31 #define ASMSH_SYMALLOC 64 typedef struct asmsh_sym_s asmsh_sym_t; typedef struct asmsh_symtable_s asmsh_symtable_t; struct asmsh_sym_s { char name[ASMSH_VARNAME_MAX + 1]; void *val; }; struct asmsh_symtable_s { short freeval; asmsh_sym_t *syms; size_t syms_sz; size_t alloc; }; /** if freeval value given to add are freed on clean */ int asmsh_symtable_init(asmsh_symtable_t *table, short freeval); void asmsh_symtable_clean(asmsh_symtable_t *table); int asmsh_symtable_add(asmsh_symtable_t *table, const char *name, void *val); int asmsh_symtable_del(asmsh_symtable_t *table, const char *name); const asmsh_sym_t *asmsh_symtable_get(asmsh_symtable_t *table, const char *name); #include "shell.h" #endif