Mercurial > ~dholland > hg > ag > index.cgi
view examples/dsl/symbol.h @ 7:57b2cc9b87f7
Use memcpy instead of strncpy when we know the length anyway.
Modern gcc seems to think it knows how to detect misuse of strncpy,
but it's wrong (in fact: very, very wrong) and the path of least
resistance is to not try to fight with it.
author | David A. Holland |
---|---|
date | Mon, 30 May 2022 23:47:52 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/***** AnaGram Programming Examples A Dos Script Language Symbol Table Declarations Copyright 1993 Parsifal Software. All Rights Reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. *****/ #ifndef SYMBOL_H #define SYMBOL_H #include "array.h" #include "charsink.h" #include "strdict.h" struct action_pointer { unsigned char *pointer; int line, column; }; enum symbol_type { undefined_type, dos_type, action_type, value_type, internal_type, integer_type, string_type, formula_type, built_in_function_type }; struct action_descriptor { int n_args; unsigned *args; action_pointer ap; }; struct symbol_table_entry { symbol_type type; union { char *text; int (*proc)(int, char *[]); long (*func)(void); action_descriptor *action; long integer; } data; }; struct internal_commands_descriptor { const char *name; int (*proc)(int n_args, char *args[]); }; struct built_ins_descriptor { const char *name; long (*proc) (void); }; extern string_accumulator sa; extern string_dictionary sd; extern array<symbol_table_entry> st; void define_action(int n); void define_integer(const char *name, long value); void define_string(void); void expand_formula(const int *s); void init_dos_internals(void); void release(action_descriptor *d); void release(symbol_table_entry &s); void set_arg(int, char *); #endif