diff --git a/src/allocator.c b/src/allocator.c index c45affd..2d446f1 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -1,3 +1,20 @@ +/* Arena allocator for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include #include diff --git a/src/allocator.h b/src/allocator.h index 4904b29..eaff3c8 100644 --- a/src/allocator.h +++ b/src/allocator.h @@ -1,3 +1,20 @@ +/* Arena allocator for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef HAMMER_ALLOCATOR__H__ #define HAMMER_ALLOCATOR__H__ #include diff --git a/src/bitreader.c b/src/bitreader.c index d3553f0..43038df 100644 --- a/src/bitreader.c +++ b/src/bitreader.c @@ -1,3 +1,20 @@ +/* Bit-parsing operations for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include #include #include "internal.h" diff --git a/src/hammer.h b/src/hammer.h index 7c7e296..a353641 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -72,7 +72,7 @@ typedef struct parsed_token { uint64_t uint; double dbl; float flt; - GSequence *seq; + GSequence *seq; // a sequence of parsed_token_t's }; } parsed_token_t; diff --git a/src/internal.h b/src/internal.h index 771a0ee..8a756c4 100644 --- a/src/internal.h +++ b/src/internal.h @@ -1,3 +1,20 @@ +/* Internals for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef HAMMER_INTERNAL__H #define HAMMER_INTERNAL__H #include @@ -11,6 +28,23 @@ typedef struct parser_cache_key { const parser_t *parser; } parser_cache_key_t; +typedef enum parser_cache_value_type { + PC_BASE, + PC_IN_RECURSION, + PC_LRESULT, + PC_RESULT +} parser_cache_value_type_t; + +typedef struct parser_cache_value { + parser_cache_value_type_t value_type; + union { + int base; + parse_result_t *in_recursion; + parse_result_t *lresult; + parse_result_t *result; + }; +} parser_cache_value_t; + typedef unsigned int *charset; static inline charset new_charset() { diff --git a/src/pprint.c b/src/pprint.c index a4fe43d..6832b30 100644 --- a/src/pprint.c +++ b/src/pprint.c @@ -1,3 +1,20 @@ +/* Pretty-printer for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #define _GNU_SOURCE #include #include diff --git a/src/test_suite.c b/src/test_suite.c index 9d0d9a2..016274c 100644 --- a/src/test_suite.c +++ b/src/test_suite.c @@ -1,3 +1,20 @@ +/* Test suite for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "hammer.h" #include "test_suite.h" diff --git a/src/test_suite.h b/src/test_suite.h index a67fa1f..8f0b07a 100644 --- a/src/test_suite.h +++ b/src/test_suite.h @@ -1,3 +1,20 @@ +/* Test suite for Hammer. + * Copyright (C) 2012 Meredith L. Patterson, Dan "TQ" Hirsch + * + * 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, version 2. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef HAMMER_TEST_SUITE__H #define HAMMER_TEST_SUITE__H