├── common ├── m4 │ └── lib │ │ ├── close-stream.h │ │ ├── fpending.h │ │ ├── closein.h │ │ ├── unistd--.h │ │ ├── stdlib-safer.h │ │ ├── filenamecat.h │ │ ├── xasprintf.c │ │ ├── unistd-safer.h │ │ ├── hash-pjw.h │ │ ├── asnprintf.c │ │ ├── closeout.h │ │ ├── memchr2.h │ │ ├── stdlib--.h │ │ ├── gl_avltree_oset.h │ │ ├── gl_linked_list.h │ │ ├── gl_linkedhash_list.h │ │ ├── stdio--.h │ │ ├── file-set.h │ │ ├── tmpdir.h │ │ ├── hash-pjw.c │ │ ├── mkdtemp.c │ │ ├── gl_anyhash1.h │ │ ├── malloc │ │ ├── scratch_buffer_dupfree.c │ │ ├── scratch_buffer_grow.c │ │ ├── scratch_buffer_set_array_size.c │ │ └── scratch_buffer_grow_preserve.c │ │ ├── vasprintf.c │ │ ├── cloexec.h │ │ ├── windows-spin.h │ │ ├── freadahead.h │ │ ├── hash-triple.h │ │ ├── mkstemp.c │ │ ├── fd-safer.c │ │ ├── xvasprintf.h │ │ ├── same-inode.h │ │ ├── hash-triple-simple.c │ │ ├── gl_anylinked_list1.h │ │ ├── mkstemp-safer.c │ │ ├── canonicalize.h │ │ ├── clean-temp-simple.h │ │ ├── xprintf.h │ │ ├── progname.h │ │ └── _Noreturn.h ├── misc │ ├── pid_tempname.h │ ├── app_path.c │ ├── exitfail.h │ ├── get-errno.h │ ├── xtime.c │ ├── c-ctype.c │ ├── timespec.c │ ├── mbfile.c │ ├── exitfail.c │ ├── bitset │ │ ├── array.h │ │ ├── vector.h │ │ ├── list.h │ │ ├── table.h │ │ └── stats.h │ ├── getline.c │ ├── xstrndup.h │ ├── xmemdup0.h │ ├── gl_hash_map.h │ ├── gl_array_list.h │ ├── gl_rbtree_oset.h │ ├── path-join.h │ ├── gl_rbtreehash_list.h │ ├── reallocarray.c │ ├── getprogname.h │ ├── arg-nonnull.h │ ├── dirname.c │ ├── path-join.c │ ├── mbchar.c │ ├── xstrndup.c │ ├── get-errno.c │ ├── xalloc-die.c │ ├── xhash.c │ ├── stdio-safer.h │ ├── glthread │ │ └── tls.c │ ├── xconcat-filename.c │ ├── gl_anytree_list1.h │ ├── gethrxtime.h │ ├── config.h │ ├── dirname.h │ ├── c-strcasecmp.c │ ├── c-strncasecmp.c │ ├── xmemdup0.c │ ├── integer_length.h │ ├── concat-filename.h │ ├── quote.h │ ├── mbswidth.h │ ├── basename-lgpl.c │ ├── progname.h │ ├── fstrcmp.h │ ├── gethrxtime.c │ ├── pid_tempname.c │ └── c-strcase.h └── CMakeLists.txt ├── bison ├── src │ ├── scan-code-c.c │ ├── scan-gram-c.c │ ├── scan-skel-c.c │ ├── yacc.in │ ├── config.h │ ├── print.h │ ├── LR0.h │ ├── print-graph.h │ ├── output.h │ ├── scan-skel.h │ ├── strversion.h │ ├── fixits.h │ ├── derives.h │ ├── nullable.h │ ├── assoc.h │ ├── named-ref.c │ ├── scan-gram.h │ ├── print-xml.h │ ├── assoc.c │ ├── counterexample.h │ ├── reduce.h │ ├── named-ref.h │ ├── ielr.h │ ├── glyphs.h │ ├── conflicts.h │ ├── closure.h │ ├── strversion.c │ ├── relation.h │ └── lssi.h ├── data │ ├── skeletons │ │ ├── traceon.m4 │ │ ├── d-skel.m4 │ │ ├── c-skel.m4 │ │ ├── c++-skel.m4 │ │ └── java-skel.m4 │ └── bison-default.css ├── lib │ ├── main.c │ └── yyerror.c └── CMakeLists.txt ├── custom_build_rules ├── docs │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── Properties.png │ ├── Verbosity.png │ ├── BisonProperties.png │ ├── FlexProperties.png │ └── Flex_debuging.png ├── win_flex_only │ └── win_flex_custom_build.props ├── win_bison_only │ └── win_bison_custom_build.props └── win_flex_bison │ └── win_flex_bison_custom_build.props ├── UNISTD_ERROR.readme ├── chocolatey ├── tools │ └── chocolateyInstall.ps1 └── winflexbison3.nuspec ├── flex ├── CMakeLists.txt └── src │ ├── libyywrap.c │ ├── libmain.c │ ├── flexint.h │ └── COPYING ├── .appveyor.yml ├── CMakeSettings.json └── README.md /common/m4/lib/close-stream.h: -------------------------------------------------------------------------------- 1 | #include 2 | int close_stream (FILE *stream); 3 | -------------------------------------------------------------------------------- /bison/src/scan-code-c.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "system.h" 3 | #include "src/scan-code.c" 4 | -------------------------------------------------------------------------------- /bison/src/scan-gram-c.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "system.h" 3 | #include "src/scan-gram.c" 4 | -------------------------------------------------------------------------------- /bison/src/scan-skel-c.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "system.h" 3 | #include "src/scan-skel.c" 4 | -------------------------------------------------------------------------------- /custom_build_rules/docs/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/1.png -------------------------------------------------------------------------------- /custom_build_rules/docs/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/2.png -------------------------------------------------------------------------------- /custom_build_rules/docs/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/3.png -------------------------------------------------------------------------------- /custom_build_rules/docs/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/4.png -------------------------------------------------------------------------------- /custom_build_rules/docs/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/5.png -------------------------------------------------------------------------------- /custom_build_rules/docs/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/6.png -------------------------------------------------------------------------------- /bison/data/skeletons/traceon.m4: -------------------------------------------------------------------------------- 1 | dnl GNU M4 treats -dV in a position-independent manner. 2 | m4_debugmode(V)m4_traceon()dnl 3 | -------------------------------------------------------------------------------- /custom_build_rules/docs/Properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/Properties.png -------------------------------------------------------------------------------- /custom_build_rules/docs/Verbosity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/Verbosity.png -------------------------------------------------------------------------------- /custom_build_rules/docs/BisonProperties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/BisonProperties.png -------------------------------------------------------------------------------- /custom_build_rules/docs/FlexProperties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/FlexProperties.png -------------------------------------------------------------------------------- /custom_build_rules/docs/Flex_debuging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lexxmark/winflexbison/HEAD/custom_build_rules/docs/Flex_debuging.png -------------------------------------------------------------------------------- /common/misc/pid_tempname.h: -------------------------------------------------------------------------------- 1 | // The longer pid_tempname was used to distinguish from GNU's tempname header 2 | 3 | ///@brief Generates a unique pid temporary file 4 | const char *pid_tempname (const char *prefix); -------------------------------------------------------------------------------- /common/misc/app_path.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define APP_PATH_LEN 1024 4 | static char app_path[APP_PATH_LEN+1]; 5 | 6 | const char* get_app_path() 7 | { 8 | DWORD res = GetModuleFileNameA(NULL, app_path, APP_PATH_LEN); 9 | 10 | if (res == 0 || res == APP_PATH_LEN) 11 | return 0; 12 | 13 | app_path[APP_PATH_LEN] = '\0'; 14 | return app_path; 15 | } -------------------------------------------------------------------------------- /UNISTD_ERROR.readme: -------------------------------------------------------------------------------- 1 | In case compile errors like "cannot include " in win_flex generated file try add --wincompat invoke option. 2 | This new option changes unix header with windows analog and replaces isatty/fileno functions to 3 | "safe" windows analogs _isatty/_fileno as well. If you have compile issues with it afterwards please open an issue 4 | at https://github.com/lexxmark/winflexbison/issues . 5 | -------------------------------------------------------------------------------- /chocolatey/tools/chocolateyInstall.ps1: -------------------------------------------------------------------------------- 1 | # download and unpack a zip file 2 | Install-ChocolateyZipPackage ` 3 | -PackageName "winflexbison3" ` 4 | -Url "https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip" ` 5 | -Checksum "8D324B62BE33604B2C45AD1DD34AB93D722534448F55A16CA7292DE32B6AC135" ` 6 | -ChecksumType "sha256" ` 7 | -UnzipLocation "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" 8 | -------------------------------------------------------------------------------- /bison/src/yacc.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | @relocatable_sh@ 4 | if test "@RELOCATABLE@" = yes; then 5 | prefix="@prefix@" 6 | exec_prefix="@exec_prefix@" 7 | bindir="@bindir@" 8 | orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables 9 | func_find_curr_installdir # determine curr_installdir 10 | func_find_prefixes 11 | relocate () { 12 | echo "$1/" \ 13 | | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" \ 14 | | sed -e 's,/$,,' 15 | } 16 | else 17 | relocate () { 18 | echo "$1" 19 | } 20 | fi 21 | 22 | prefix=@prefix@ 23 | exec_prefix=@exec_prefix@ 24 | bindir=`relocate "@bindir@"` 25 | exec "$bindir/bison" -y "$@" 26 | -------------------------------------------------------------------------------- /bison/src/config.h: -------------------------------------------------------------------------------- 1 | #define PACKAGE_BUGREPORT "https://github.com/lexxmark/winflexbison/issues" 2 | #define VERSION "3.8.2" 3 | #define PACKAGE_COPYRIGHT_YEAR 2020 4 | #define LOCALEDIR "" 5 | #define PACKAGE_STRING "bison" 6 | #define PACKAGE_URL "https://github.com/lexxmark/winflexbison" 7 | #define PACKAGE "" 8 | #define PACKAGE_VERSION "3.8.2" 9 | #define PACKAGE_NAME "bison" 10 | #define PKGDATADIR "data" 11 | #define RENAME_OPEN_FILE_WORKS 1 12 | 13 | #define ssize_t ptrdiff_t 14 | 15 | extern char* _stpcpy(char *yydest, const char *yysrc); 16 | 17 | #include 18 | #define fopen(n,m) _fsopen(n,m,_SH_DENYNO) 19 | 20 | extern int strverscmp(const char* s1, const char* s2); 21 | 22 | extern int obstack_printf(struct obstack* obs, const char* format, ...); -------------------------------------------------------------------------------- /common/misc/exitfail.h: -------------------------------------------------------------------------------- 1 | /* Failure exit status 2 | 3 | Copyright (C) 2002, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | extern int volatile exit_failure; 19 | -------------------------------------------------------------------------------- /common/misc/get-errno.h: -------------------------------------------------------------------------------- 1 | /* get-errno.h - get and set errno. 2 | 3 | Copyright (C) 2002, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | extern int get_errno (void); 20 | extern void set_errno (int); 21 | -------------------------------------------------------------------------------- /common/misc/xtime.c: -------------------------------------------------------------------------------- 1 | /* xtime -- extended-resolution integer timestamps 2 | 3 | Copyright (C) 2012-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published 7 | by the Free Software Foundation; either version 3 of the License, 8 | or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #define XTIME_INLINE _GL_EXTERN_INLINE 21 | #include "xtime.h" 22 | -------------------------------------------------------------------------------- /common/misc/c-ctype.c: -------------------------------------------------------------------------------- 1 | /* Character handling in C locale. 2 | 3 | Copyright (C) 2003-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #define C_CTYPE_INLINE _GL_EXTERN_INLINE 21 | #include "c-ctype.h" 22 | -------------------------------------------------------------------------------- /common/misc/timespec.c: -------------------------------------------------------------------------------- 1 | /* Inline functions for . 2 | 3 | Copyright (C) 2012-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE 21 | #include "timespec.h" 22 | -------------------------------------------------------------------------------- /common/misc/mbfile.c: -------------------------------------------------------------------------------- 1 | /* Multibyte character I/O: macros for multi-byte encodings. 2 | Copyright (C) 2012-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 3 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | #define MBFILE_INLINE _GL_EXTERN_INLINE 20 | #include "mbfile.h" 21 | -------------------------------------------------------------------------------- /flex/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10 FATAL_ERROR) 2 | 3 | project(win_flex LANGUAGES C) 4 | 5 | file(GLOB SOURCE_FILES 6 | "src/*.c" 7 | "src/*.h" 8 | ) 9 | # exclude some source files 10 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/libmain.c") 11 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/libyywrap.c") 12 | 13 | # Add executable to build. 14 | add_executable(${PROJECT_NAME} 15 | ${SOURCE_FILES} 16 | ) 17 | 18 | target_compile_definitions(${PROJECT_NAME} 19 | PRIVATE "_CONSOLE") 20 | 21 | target_include_directories(${PROJECT_NAME} PRIVATE "src") 22 | 23 | target_link_libraries(${PROJECT_NAME} winflexbison_common kernel32.lib user32.lib) 24 | 25 | # libfl 26 | add_library(fl STATIC 27 | "${CMAKE_CURRENT_SOURCE_DIR}/src/libmain.c" 28 | "${CMAKE_CURRENT_SOURCE_DIR}/src/libyywrap.c") 29 | 30 | target_include_directories(fl 31 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/") 32 | -------------------------------------------------------------------------------- /common/misc/exitfail.c: -------------------------------------------------------------------------------- 1 | /* Failure exit status 2 | 3 | Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include "exitfail.h" 21 | 22 | #include 23 | 24 | int volatile exit_failure = EXIT_FAILURE; 25 | -------------------------------------------------------------------------------- /bison/src/print.h: -------------------------------------------------------------------------------- 1 | /* Print information on generated parser, for bison, 2 | 3 | Copyright (C) 2000, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef PRINT_H_ 22 | # define PRINT_H_ 23 | 24 | void print_results (void); 25 | 26 | #endif /* !PRINT_H_ */ 27 | -------------------------------------------------------------------------------- /chocolatey/winflexbison3.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | winflexbison3 5 | WinFlexBison (bison 3.8.2, flex 2.6.4) 6 | 2.5.25.20220111 7 | Alex Zhondin (in addition to original authors of flex and bison) 8 | lexxmark 9 | WinFlexBison is a port Flex/Bison tools to the Windows platform 10 | flex - The Fast Lexical Analyzer ( https://github.com/westes/flex ) and GNU Bison - parser generator ( https://www.gnu.org/software/bison ) 11 | https://github.com/lexxmark/winflexbison 12 | flex bison 13 | GPL-3.0-or-later 14 | false 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /bison/src/LR0.h: -------------------------------------------------------------------------------- 1 | /* Generate the LR(0) parser states for Bison. 2 | 3 | Copyright (C) 1984, 1986, 1989, 2000-2002, 2009-2015, 2018-2021 Free 4 | Software Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef LR0_H_ 22 | # define LR0_H_ 23 | 24 | void generate_states (void); 25 | 26 | #endif /* !LR0_H_ */ 27 | -------------------------------------------------------------------------------- /bison/lib/main.c: -------------------------------------------------------------------------------- 1 | /* Yacc library main function. 2 | 3 | Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #include 21 | #include 22 | 23 | int yyparse (void); 24 | 25 | int 26 | main (void) 27 | { 28 | setlocale (LC_ALL, ""); 29 | return yyparse (); 30 | } 31 | -------------------------------------------------------------------------------- /bison/src/print-graph.h: -------------------------------------------------------------------------------- 1 | /* Output a graph of the generated parser, for Bison. 2 | 3 | Copyright (C) 2000, 2006, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef PRINT_GRAPH_H_ 22 | # define PRINT_GRAPH_H_ 23 | 24 | void print_graph (void); 25 | 26 | #endif /* !PRINT_GRAPH_H_ */ 27 | -------------------------------------------------------------------------------- /common/m4/lib/fpending.h: -------------------------------------------------------------------------------- 1 | /* Declare __fpending. 2 | 3 | Copyright (C) 2000, 2003, 2005-2006, 2009-2021 Free Software Foundation, 4 | Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | Written by Jim Meyering. */ 20 | 21 | #include 22 | #include 23 | #if HAVE_STDIO_EXT_H 24 | # include 25 | #endif 26 | 27 | #if !HAVE_DECL___FPENDING 28 | size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE; 29 | #endif 30 | -------------------------------------------------------------------------------- /bison/src/output.h: -------------------------------------------------------------------------------- 1 | /* Output the generated parsing program for bison, 2 | 3 | Copyright (C) 2000-2003, 2006-2007, 2009-2015, 2018-2021 Free 4 | Software Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef OUTPUT_H_ 22 | # define OUTPUT_H_ 23 | 24 | /* Output the parsing tables and the parser code to FTABLE. */ 25 | void output (void); 26 | 27 | #endif /* !OUTPUT_H_ */ 28 | -------------------------------------------------------------------------------- /bison/lib/yyerror.c: -------------------------------------------------------------------------------- 1 | /* Yacc library error-printing function. 2 | 3 | Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #include 21 | 22 | #include 23 | 24 | int yyerror (char const *); 25 | 26 | int 27 | yyerror (char const *message) 28 | { 29 | fputs (message, stderr); 30 | fputc ('\n', stderr); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /common/m4/lib/closein.h: -------------------------------------------------------------------------------- 1 | /* Close standard input, rewinding seekable stdin if necessary. 2 | 3 | Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_CLOSEIN_H 19 | # define _GL_CLOSEIN_H 1 20 | 21 | # ifdef __cplusplus 22 | extern "C" { 23 | # endif 24 | 25 | void close_stdin_set_file_name (const char *file); 26 | void close_stdin (void); 27 | 28 | # ifdef __cplusplus 29 | } 30 | # endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /bison/src/scan-skel.h: -------------------------------------------------------------------------------- 1 | /* Scan Bison Skeletons. 2 | 3 | Copyright (C) 2005-2007, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | void scan_skel (FILE *); 22 | 23 | /* Pacify "make syntax-check". */ 24 | extern FILE *skel_in; 25 | extern FILE *skel_out; 26 | extern int skel__flex_debug; 27 | extern int skel_lineno; 28 | void skel_scanner_free (void); 29 | -------------------------------------------------------------------------------- /common/misc/bitset/array.h: -------------------------------------------------------------------------------- 1 | /* Functions to support abitsets. 2 | 3 | Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef _BITSET_ARRAY_H 22 | #define _BITSET_ARRAY_H 23 | 24 | #include "bitset.h" 25 | 26 | size_t abitset_bytes (bitset_bindex); 27 | 28 | bitset abitset_init (bitset, bitset_bindex); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /common/misc/bitset/vector.h: -------------------------------------------------------------------------------- 1 | /* Functions to support vbitsets. 2 | 3 | Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef _BITSET_VECTOR_H 22 | #define _BITSET_VECTOR_H 23 | 24 | #include "bitset.h" 25 | 26 | size_t vbitset_bytes (bitset_bindex); 27 | 28 | bitset vbitset_init (bitset, bitset_bindex); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /common/m4/lib/unistd--.h: -------------------------------------------------------------------------------- 1 | /* Like unistd.h, but redefine some names to avoid glitches. 2 | 3 | Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | //#include 21 | #include "unistd-safer.h" 22 | 23 | #undef dup 24 | #define dup dup_safer 25 | 26 | #undef pipe 27 | #define pipe pipe_safer 28 | 29 | #if GNULIB_PIPE2_SAFER 30 | # undef pipe2 31 | # define pipe2 pipe2_safer 32 | #endif 33 | -------------------------------------------------------------------------------- /bison/src/strversion.h: -------------------------------------------------------------------------------- 1 | /* Convert version string to int. 2 | 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef STRVERSION_H_ 21 | # define STRVERSION_H_ 22 | 23 | /* Convert VERSION into an int (MAJOR * 10000 + MINOR * 100 + MICRO). 24 | E.g., "3.7.4" => 30704, "3.8" => 30800. 25 | Return -1 on errors. */ 26 | int strversion_to_int (char const *version); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /custom_build_rules/win_flex_only/win_flex_custom_build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | Midl 6 | CustomBuild 7 | 8 | 9 | _SelectedFiles;$(FlexDependsOn) 11 | 12 | 13 | 14 | %(Filename).flex.cpp 15 | true 16 | 17 | start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" 18 | exit /b %errorlevel% 19 | %(RootDir)%(Directory)%(OutputFile); 20 | Process "%(Filename)%(Extension)" flex file 21 | 22 | 23 | -------------------------------------------------------------------------------- /common/m4/lib/stdlib-safer.h: -------------------------------------------------------------------------------- 1 | /* Invoke stdlib.h functions, but avoid some glitches. 2 | 3 | Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | int mkstemp_safer (char *); 21 | 22 | #if GNULIB_MKOSTEMP 23 | int mkostemp_safer (char *, int); 24 | #endif 25 | 26 | #if GNULIB_MKOSTEMPS 27 | int mkostemps_safer (char *, int, int); 28 | #endif 29 | 30 | #if GNULIB_MKSTEMPS 31 | int mkstemps_safer (char *, int); 32 | #endif 33 | -------------------------------------------------------------------------------- /common/misc/bitset/list.h: -------------------------------------------------------------------------------- 1 | /* Functions to support lbitsets. 2 | 3 | Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef _BITSET_LIST_H 22 | #define _BITSET_LIST_H 23 | 24 | #include "bitset.h" 25 | 26 | size_t lbitset_bytes (bitset_bindex); 27 | 28 | bitset lbitset_init (bitset, bitset_bindex); 29 | 30 | void lbitset_release_memory (void); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /common/misc/bitset/table.h: -------------------------------------------------------------------------------- 1 | /* Functions to support tbitsets. 2 | 3 | Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef _BITSET_TABLE_H 22 | #define _BITSET_TABLE_H 23 | 24 | #include "bitset.h" 25 | 26 | size_t tbitset_bytes (bitset_bindex); 27 | 28 | bitset tbitset_init (bitset, bitset_bindex); 29 | 30 | void tbitset_release_memory (void); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /common/m4/lib/filenamecat.h: -------------------------------------------------------------------------------- 1 | /* Concatenate two arbitrary file names. 2 | 3 | Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | /* Written by Jim Meyering. */ 20 | 21 | #if GNULIB_FILENAMECAT 22 | char *file_name_concat (char const *dir, char const *base, 23 | char **base_in_result); 24 | #endif 25 | 26 | char *mfile_name_concat (char const *dir, char const *base, 27 | char **base_in_result); 28 | -------------------------------------------------------------------------------- /common/m4/lib/xasprintf.c: -------------------------------------------------------------------------------- 1 | /* vasprintf and asprintf with out-of-memory checking. 2 | Copyright (C) 1999, 2002-2004, 2006, 2009-2021 Free Software Foundation, 3 | Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include "xvasprintf.h" 22 | 23 | char * 24 | xasprintf (const char *format, ...) 25 | { 26 | va_list args; 27 | char *result; 28 | 29 | va_start (args, format); 30 | result = xvasprintf (format, args); 31 | va_end (args); 32 | 33 | return result; 34 | } 35 | -------------------------------------------------------------------------------- /common/m4/lib/unistd-safer.h: -------------------------------------------------------------------------------- 1 | /* Invoke unistd-like functions, but avoid some glitches. 2 | 3 | Copyright (C) 2001, 2003, 2005, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert and Eric Blake. */ 19 | 20 | int dup_safer (int); 21 | int fd_safer (int); 22 | int pipe_safer (int[2]); 23 | 24 | #if GNULIB_FD_SAFER_FLAG 25 | int dup_safer_flag (int, int); 26 | int fd_safer_flag (int, int); 27 | #endif 28 | 29 | #if GNULIB_PIPE2_SAFER 30 | int pipe2_safer (int[2], int); 31 | #endif 32 | -------------------------------------------------------------------------------- /common/misc/getline.c: -------------------------------------------------------------------------------- 1 | /* getline.c --- Implementation of replacement getline function. 2 | Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Simon Josefsson. */ 18 | 19 | #include 20 | 21 | #include 22 | 23 | extern ssize_t 24 | getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp); 25 | 26 | ssize_t 27 | getline (char **lineptr, size_t *n, FILE *stream) 28 | { 29 | return getdelim (lineptr, n, '\n', stream); 30 | } 31 | -------------------------------------------------------------------------------- /common/misc/xstrndup.h: -------------------------------------------------------------------------------- 1 | /* Duplicate a bounded initial segment of a string, with out-of-memory 2 | checking. 3 | Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Return a newly allocated copy of at most N bytes of STRING. 21 | In other words, return a copy of the initial segment of length N of 22 | STRING. */ 23 | extern char *xstrndup (const char *string, size_t n) 24 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE 25 | _GL_ATTRIBUTE_RETURNS_NONNULL; 26 | -------------------------------------------------------------------------------- /common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10 FATAL_ERROR) 2 | 3 | project(winflexbison_common LANGUAGES C) 4 | 5 | # Definition of Macros 6 | add_definitions(-D_LIB) 7 | 8 | file(GLOB SOURCE_FILES 9 | "misc/*.c" 10 | "misc/*.h" 11 | "misc/bitset/*.c" 12 | "misc/bitset/*.h" 13 | "misc/glthread/*.c" 14 | "misc/glthread/*.h" 15 | "m4/*.c" 16 | "m4/*.h" 17 | "m4/lib/*.c" 18 | "m4/lib/*.h" 19 | "m4/lib/malloc/*.c" 20 | "m4/lib/malloc/*.h" 21 | ) 22 | # exclude some source files 23 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/m4/lib/regexec.c") 24 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/m4/lib/regcomp.c") 25 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/m4/lib/regex_internal.c") 26 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/m4/lib/malloc/dynarray-skeleton.c") 27 | 28 | # Add library to build. 29 | add_library(${PROJECT_NAME} STATIC 30 | ${SOURCE_FILES} 31 | ) 32 | 33 | set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 90) 34 | 35 | target_include_directories(${PROJECT_NAME} PUBLIC "misc") 36 | target_include_directories(${PROJECT_NAME} PUBLIC "m4") 37 | target_include_directories(${PROJECT_NAME} PUBLIC "m4/lib") 38 | -------------------------------------------------------------------------------- /common/m4/lib/hash-pjw.h: -------------------------------------------------------------------------------- 1 | /* hash-pjw.h -- declaration for a simple hash function 2 | Copyright (C) 2001, 2003, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | /* Compute a hash code for a NUL-terminated string starting at X, 20 | and return the hash code modulo TABLESIZE. 21 | The result is platform dependent: it depends on the size of the 'size_t' 22 | type and on the signedness of the 'char' type. */ 23 | extern size_t hash_pjw (void const *x, size_t tablesize) _GL_ATTRIBUTE_PURE; 24 | -------------------------------------------------------------------------------- /common/m4/lib/asnprintf.c: -------------------------------------------------------------------------------- 1 | /* Formatted output to strings. 2 | Copyright (C) 1999, 2002, 2006, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "vasnprintf.h" 21 | 22 | #include 23 | 24 | char * 25 | asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) 26 | { 27 | va_list args; 28 | char *result; 29 | 30 | va_start (args, format); 31 | result = vasnprintf (resultbuf, lengthp, format, args); 32 | va_end (args); 33 | return result; 34 | } 35 | -------------------------------------------------------------------------------- /.appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2022 2 | 3 | configuration: 4 | - Release 5 | - Debug 6 | 7 | platform: 8 | - x64 9 | - Win32 10 | 11 | environment: 12 | CMAKE_OPTIONS: "-A \"%platform%\" -DCMAKE_BUILD_TYPE=\"%configuration%\" -DUSE_STATIC_RUNTIME=ON" 13 | # VS VERSION IN CMAKE STYLE 14 | matrix: 15 | - VSVERSION: "17 2022" 16 | - VSVERSION: "16 2019" 17 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 18 | - VSVERSION: "15 2017" 19 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 20 | 21 | matrix: 22 | exclude: 23 | - VSVERSION: "17 2022" 24 | platform: Win32 25 | 26 | init: 27 | - cmake --version 28 | - msbuild /version 29 | 30 | before_build: 31 | - set VSVERSIONSHORT=%VSVERSION:~3,4% 32 | - if "%APPVEYOR_REPO_TAG_NAME%"=="" ( set "APPVEYOR_REPO_TAG_NAME=dev-vs%VSVERSIONSHORT%-%platform%-%configuration%" ) 33 | - mkdir build 34 | - cd build 35 | - cmake -G "Visual Studio %VSVERSION%" -DCPACK_PACKAGE_VERSION="%APPVEYOR_REPO_TAG_NAME%" %CMAKE_OPTIONS% .. 36 | 37 | build_script: 38 | - cmake --build . --config %configuration% 39 | 40 | after_build: 41 | - cmake --build . --target package 42 | 43 | artifacts: 44 | - path: build/win_flex_bison*.zip 45 | -------------------------------------------------------------------------------- /common/m4/lib/closeout.h: -------------------------------------------------------------------------------- 1 | /* Close standard output and standard error. 2 | 3 | Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef CLOSEOUT_H 20 | # define CLOSEOUT_H 1 21 | 22 | # include 23 | 24 | # ifdef __cplusplus 25 | extern "C" { 26 | # endif 27 | 28 | void close_stdout_set_file_name (const char *file); 29 | void close_stdout_set_ignore_EPIPE (bool ignore); 30 | void close_stdout (void); 31 | 32 | # ifdef __cplusplus 33 | } 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /common/misc/xmemdup0.h: -------------------------------------------------------------------------------- 1 | /* xmemdup0.h -- copy a block of arbitrary bytes, plus a trailing NUL 2 | 3 | Copyright (C) 2008-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef XMEMDUP_H_ 19 | # define XMEMDUP_H_ 20 | 21 | # include 22 | 23 | 24 | # ifdef __cplusplus 25 | extern "C" { 26 | # endif 27 | 28 | char *xmemdup0 (void const *p, size_t s) 29 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE 30 | _GL_ATTRIBUTE_RETURNS_NONNULL; 31 | 32 | # ifdef __cplusplus 33 | } 34 | # endif 35 | 36 | #endif /* !XMEMDUP0_H_ */ 37 | -------------------------------------------------------------------------------- /custom_build_rules/win_bison_only/win_bison_custom_build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | Midl 6 | CustomBuild 7 | 8 | 9 | _SelectedFiles;$(BisonDependsOn) 11 | 12 | 13 | 14 | %(Filename).tab.cpp 15 | %(Filename).tab.h 16 | 17 | start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" 18 | exit /b %errorlevel% 19 | %(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile); 20 | Process "%(Filename)%(Extension)" bison file 21 | 22 | 23 | -------------------------------------------------------------------------------- /common/m4/lib/memchr2.h: -------------------------------------------------------------------------------- 1 | /* Scan memory for the first of two bytes. 2 | Copyright (C) 2008-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* Return the first address of either C1 or C2 (treated as unsigned 24 | char) that occurs within N bytes of the memory region S. If 25 | neither byte appears, return NULL. */ 26 | 27 | extern void *memchr2 (void const *s, int c1, int c2, size_t n) 28 | _GL_ATTRIBUTE_PURE; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /common/misc/gl_hash_map.h: -------------------------------------------------------------------------------- 1 | /* Map data type implemented by a hash table. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2018. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_HASH_MAP_H 19 | #define _GL_HASH_MAP_H 20 | 21 | #include "gl_map.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_map_implementation gl_hash_map_implementation; 28 | #define GL_HASH_MAP &gl_hash_map_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_HASH_MAP_H */ 35 | -------------------------------------------------------------------------------- /bison/data/skeletons/d-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # D skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2018-2021 Free Software Foundation, Inc. 6 | 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | b4_glr_if( [b4_complain([%%glr-parser not supported for D])]) 21 | b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])]) 22 | 23 | m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]]) 24 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 25 | 26 | m4_include(b4_used_skeleton) 27 | -------------------------------------------------------------------------------- /common/m4/lib/stdlib--.h: -------------------------------------------------------------------------------- 1 | /* Like stdlib.h, but redefine some names to avoid glitches. 2 | 3 | Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | #include "stdlib-safer.h" 22 | 23 | #undef mkstemp 24 | #define mkstemp mkstemp_safer 25 | 26 | #if GNULIB_MKOSTEMP 27 | # define mkostemp mkostemp_safer 28 | #endif 29 | 30 | #if GNULIB_MKOSTEMPS 31 | # define mkostemps mkostemps_safer 32 | #endif 33 | 34 | #if GNULIB_MKSTEMPS 35 | # define mkstemps mkstemps_safer 36 | #endif 37 | -------------------------------------------------------------------------------- /common/misc/bitset/stats.h: -------------------------------------------------------------------------------- 1 | /* Functions to support bitset statistics. 2 | 3 | Copyright (C) 2002-2004, 2009-2015, 2018-2021 Free Software Foundation, Inc. 4 | 5 | Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef _BITSET_STATS_H 21 | #define _BITSET_STATS_H 22 | 23 | #include "bitset/base.h" 24 | 25 | extern bool bitset_stats_enabled; 26 | 27 | enum bitset_type bitset_stats_type_get (bitset); 28 | 29 | size_t bitset_stats_bytes (void); 30 | 31 | bitset bitset_stats_init (bitset, bitset_bindex, enum bitset_type); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /flex/src/libyywrap.c: -------------------------------------------------------------------------------- 1 | /* libyywrap - flex run-time support library "yywrap" function */ 2 | 3 | /* This file is part of flex. */ 4 | 5 | /* Redistribution and use in source and binary forms, with or without */ 6 | /* modification, are permitted provided that the following conditions */ 7 | /* are met: */ 8 | 9 | /* 1. Redistributions of source code must retain the above copyright */ 10 | /* notice, this list of conditions and the following disclaimer. */ 11 | /* 2. Redistributions in binary form must reproduce the above copyright */ 12 | /* notice, this list of conditions and the following disclaimer in the */ 13 | /* documentation and/or other materials provided with the distribution. */ 14 | 15 | /* Neither the name of the University nor the names of its contributors */ 16 | /* may be used to endorse or promote products derived from this software */ 17 | /* without specific prior written permission. */ 18 | 19 | /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ 20 | /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ 21 | /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ 22 | /* PURPOSE. */ 23 | 24 | int yywrap (void); 25 | 26 | int yywrap (void) 27 | { 28 | return 1; 29 | } 30 | -------------------------------------------------------------------------------- /bison/src/fixits.h: -------------------------------------------------------------------------------- 1 | /* Support for fixing grammar files. 2 | 3 | Copyright (C) 2019-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef FIXITS_H_ 19 | # define FIXITS_H_ 1 20 | 21 | # include "location.h" 22 | 23 | /* Declare a fix to apply. */ 24 | void fixits_register (location const *loc, char const* update); 25 | 26 | /* Apply the fixits: update the source file. */ 27 | void fixits_run (void); 28 | 29 | /* Whether there are no fixits. */ 30 | bool fixits_empty (void); 31 | 32 | /* Free the registered fixits. */ 33 | void fixits_free (void); 34 | 35 | #endif /* !FIXITS_H_ */ 36 | -------------------------------------------------------------------------------- /bison/data/skeletons/c-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # C skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software 6 | # Foundation, Inc. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])]) 22 | b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])]) 23 | 24 | m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]]) 25 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 26 | 27 | m4_include(b4_used_skeleton) 28 | -------------------------------------------------------------------------------- /common/m4/lib/gl_avltree_oset.h: -------------------------------------------------------------------------------- 1 | /* Ordered set data type implemented by a binary tree. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_AVLTREE_OSET_H 19 | #define _GL_AVLTREE_OSET_H 20 | 21 | #include "gl_oset.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_oset_implementation gl_avltree_oset_implementation; 28 | #define GL_AVLTREE_OSET &gl_avltree_oset_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_AVLTREE_OSET_H */ 35 | -------------------------------------------------------------------------------- /common/m4/lib/gl_linked_list.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by a linked list. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_LINKED_LIST_H 19 | #define _GL_LINKED_LIST_H 20 | 21 | #include "gl_list.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_list_implementation gl_linked_list_implementation; 28 | #define GL_LINKED_LIST &gl_linked_list_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_LINKED_LIST_H */ 35 | -------------------------------------------------------------------------------- /common/misc/gl_array_list.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by an array. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_ARRAY_LIST_H 19 | #define _GL_ARRAY_LIST_H 20 | 21 | #include "gl_list.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_list_implementation gl_array_list_implementation; 28 | #define GL_ARRAY_LIST &gl_array_list_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_ARRAY_LIST_H */ 35 | -------------------------------------------------------------------------------- /bison/data/skeletons/c++-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # C++ skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software 6 | # Foundation, Inc. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])]) 22 | b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])]) 23 | 24 | m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]]) 25 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 26 | 27 | m4_include(b4_used_skeleton) 28 | -------------------------------------------------------------------------------- /bison/data/skeletons/java-skel.m4: -------------------------------------------------------------------------------- 1 | -*- Autoconf -*- 2 | 3 | # Java skeleton dispatching for Bison. 4 | 5 | # Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation, 6 | # Inc. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | b4_glr_if( [b4_complain([%%glr-parser not supported for Java])]) 22 | b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])]) 23 | 24 | m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]]) 25 | m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 26 | 27 | m4_include(b4_used_skeleton) 28 | -------------------------------------------------------------------------------- /common/misc/gl_rbtree_oset.h: -------------------------------------------------------------------------------- 1 | /* Ordered set data type implemented by a binary tree. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_RBTREE_OSET_H 19 | #define _GL_RBTREE_OSET_H 20 | 21 | #include "gl_oset.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_oset_implementation gl_rbtree_oset_implementation; 28 | #define GL_RBTREE_OSET &gl_rbtree_oset_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_RBTREE_OSET_H */ 35 | -------------------------------------------------------------------------------- /common/misc/path-join.h: -------------------------------------------------------------------------------- 1 | /* Concatenate path components. 2 | Copyright (C) 2018-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published by the 6 | Free Software Foundation; either version 3 of the License, or any 7 | later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Akim Demaille . */ 18 | 19 | #ifndef _PATH_JOIN_H 20 | # define _PATH_JOIN_H 21 | 22 | # ifdef __cplusplus 23 | extern "C" { 24 | # endif 25 | 26 | 27 | /* Concatenate two paths together. PATH2 may be null, or empty, or 28 | absolute: do what is right. Return a freshly allocated 29 | filename. */ 30 | char * 31 | xpath_join (const char *path1, const char *path2); 32 | 33 | 34 | # ifdef __cplusplus 35 | } 36 | # endif 37 | 38 | #endif /* _PATH_JOIN_H */ 39 | -------------------------------------------------------------------------------- /bison/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10 FATAL_ERROR) 2 | 3 | project(win_bison LANGUAGES C) 4 | 5 | file(GLOB SOURCE_FILES 6 | "src/*.c" 7 | "src/*.h" 8 | ) 9 | # exclude some source files 10 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/scan-code.c") 11 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/scan-gram.c") 12 | list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/scan-skel.c") 13 | 14 | 15 | # Add executable to build. 16 | add_executable(${PROJECT_NAME} 17 | ${SOURCE_FILES} 18 | ) 19 | 20 | target_compile_definitions(${PROJECT_NAME} 21 | PRIVATE "_CONSOLE") 22 | 23 | add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD 24 | COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/data" "$/data" 25 | ) 26 | 27 | target_include_directories(${PROJECT_NAME} PRIVATE "src") 28 | target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") 29 | 30 | target_link_libraries(${PROJECT_NAME} winflexbison_common kernel32.lib user32.lib) 31 | 32 | # liby 33 | file(GLOB liby_src 34 | "lib/*.c" 35 | "lib/*.h" 36 | ) 37 | 38 | add_library(y STATIC ${liby_src}) 39 | 40 | target_include_directories(y 41 | PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/") 42 | -------------------------------------------------------------------------------- /bison/src/derives.h: -------------------------------------------------------------------------------- 1 | /* Match rules with nonterminals for bison, 2 | 3 | Copyright (C) 1984, 1989, 2000-2002, 2009-2015, 2018-2021 Free 4 | Software Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef DERIVES_H_ 22 | # define DERIVES_H_ 23 | 24 | # include "gram.h" 25 | 26 | /* DERIVES[SYMBOL - NTOKENS] points to a vector of the rules that 27 | SYMBOL derives, terminated with NULL. */ 28 | extern rule ***derives; 29 | 30 | /* Compute DERIVES. */ 31 | 32 | void derives_compute (void); 33 | void derives_free (void); 34 | 35 | #endif /* !DERIVES_H_ */ 36 | -------------------------------------------------------------------------------- /bison/src/nullable.h: -------------------------------------------------------------------------------- 1 | /* Part of the bison parser generator, 2 | 3 | Copyright (C) 2000, 2002, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef NULLABLE_H_ 22 | # define NULLABLE_H_ 23 | 24 | /* A vector saying which nonterminals can expand into the null string. 25 | NULLABLE[I - NTOKENS] is nonzero if symbol I can do so. */ 26 | extern bool *nullable; 27 | 28 | /* Set up NULLABLE. */ 29 | extern void nullable_compute (void); 30 | 31 | /* Free NULLABLE. */ 32 | extern void nullable_free (void); 33 | #endif /* !NULLABLE_H_ */ 34 | -------------------------------------------------------------------------------- /bison/src/assoc.h: -------------------------------------------------------------------------------- 1 | /* Associativity information. 2 | 3 | Copyright (C) 2002, 2006, 2008-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef ASSOC_H_ 22 | # define ASSOC_H_ 23 | 24 | /* Associativity values for tokens and rules. */ 25 | typedef enum 26 | { 27 | undef_assoc, /** Not defined. */ 28 | right_assoc, /** %right */ 29 | left_assoc, /** %left */ 30 | non_assoc, /** %nonassoc */ 31 | precedence_assoc /** %precedence */ 32 | } assoc; 33 | 34 | char const *assoc_to_string (assoc a); 35 | 36 | #endif /* !ASSOC_H_ */ 37 | -------------------------------------------------------------------------------- /common/misc/gl_rbtreehash_list.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by a hash table with a binary tree. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_RBTREEHASH_LIST_H 19 | #define _GL_RBTREEHASH_LIST_H 20 | 21 | #include "gl_list.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_list_implementation gl_rbtreehash_list_implementation; 28 | #define GL_RBTREEHASH_LIST &gl_rbtreehash_list_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_RBTREEHASH_LIST_H */ 35 | -------------------------------------------------------------------------------- /common/m4/lib/gl_linkedhash_list.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by a hash table with a linked list. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _GL_LINKEDHASH_LIST_H 19 | #define _GL_LINKEDHASH_LIST_H 20 | 21 | #include "gl_list.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern const struct gl_list_implementation gl_linkedhash_list_implementation; 28 | #define GL_LINKEDHASH_LIST &gl_linkedhash_list_implementation 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _GL_LINKEDHASH_LIST_H */ 35 | -------------------------------------------------------------------------------- /common/misc/reallocarray.c: -------------------------------------------------------------------------------- 1 | /* reallocarray function that is glibc compatible. 2 | 3 | Copyright (C) 2017-2021 Free Software Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* written by Darshit Shah */ 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include "intprops.h" 26 | 27 | void * 28 | reallocarray (void *ptr, size_t nmemb, size_t size) 29 | { 30 | size_t nbytes; 31 | if (INT_MULTIPLY_WRAPV (nmemb, size, &nbytes)) 32 | { 33 | errno = ENOMEM; 34 | return NULL; 35 | } 36 | 37 | /* Rely on the semantics of GNU realloc. */ 38 | return realloc (ptr, nbytes); 39 | } 40 | -------------------------------------------------------------------------------- /common/m4/lib/stdio--.h: -------------------------------------------------------------------------------- 1 | /* Like stdio.h, but redefine some names to avoid glitches. 2 | 3 | Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | #include "stdio-safer.h" 22 | 23 | #if GNULIB_FOPEN_SAFER 24 | # undef fopen 25 | # define fopen fopen_safer 26 | #endif 27 | 28 | #if GNULIB_FREOPEN_SAFER 29 | # undef freopen 30 | # define freopen freopen_safer 31 | #endif 32 | 33 | #if GNULIB_TMPFILE_SAFER 34 | # undef tmpfile 35 | # define tmpfile tmpfile_safer 36 | #endif 37 | 38 | #if GNULIB_POPEN_SAFER 39 | # undef popen 40 | # define popen popen_safer 41 | #endif 42 | -------------------------------------------------------------------------------- /common/misc/getprogname.h: -------------------------------------------------------------------------------- 1 | /* Program name management. 2 | Copyright (C) 2016-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation; either version 2.1 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _GL_GETPROGNAME_H 18 | #define _GL_GETPROGNAME_H 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Return the base name of the executing program. 27 | On native Windows this will usually end in ".exe" or ".EXE". */ 28 | #ifndef HAVE_GETPROGNAME 29 | extern char const *getprogname (void) 30 | # ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME 31 | _GL_ATTRIBUTE_PURE 32 | # endif 33 | ; 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /common/m4/lib/file-set.h: -------------------------------------------------------------------------------- 1 | /* Very specialized set-of-files code. 2 | Copyright (C) 2007-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Jim Meyering, 2007. */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "hash.h" 24 | 25 | extern void record_file (Hash_table *ht, char const *file, 26 | struct stat const *stats) 27 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 28 | __attribute__ ((__nonnull__ (2, 3))) 29 | #endif 30 | ; 31 | 32 | extern bool seen_file (Hash_table const *ht, char const *file, 33 | struct stat const *stats); 34 | -------------------------------------------------------------------------------- /common/m4/lib/tmpdir.h: -------------------------------------------------------------------------------- 1 | /* Determine a temporary directory. 2 | Copyright (C) 2001-2002, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | #include 19 | 20 | /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is 21 | non-null and exists, uses it; otherwise uses the first of $TMPDIR, 22 | P_tmpdir, /tmp that exists. Copies into TMPL a template suitable 23 | for use with mk[s]temp. Will fail (-1) if DIR is non-null and 24 | doesn't exist, none of the searched dirs exists, or there's not 25 | enough space in TMPL. */ 26 | extern int path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir); 27 | -------------------------------------------------------------------------------- /common/misc/arg-nonnull.h: -------------------------------------------------------------------------------- 1 | /* A C macro for declaring that specific arguments must not be NULL. 2 | Copyright (C) 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU Lesser General Public License as published 6 | by the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 18 | that the values passed as arguments n, ..., m must be non-NULL pointers. 19 | n = 1 stands for the first argument, n = 2 for the second argument etc. */ 20 | #ifndef _GL_ARG_NONNULL 21 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ 22 | # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 23 | # else 24 | # define _GL_ARG_NONNULL(params) 25 | # endif 26 | #endif 27 | -------------------------------------------------------------------------------- /common/misc/dirname.c: -------------------------------------------------------------------------------- 1 | /* dirname.c -- return all but the last element in a file name 2 | 3 | Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "dirname.h" 22 | 23 | #include 24 | #include 25 | #include "xalloc.h" 26 | 27 | /* Just like mdir_name (dirname-lgpl.c), except, rather than 28 | returning NULL upon malloc failure, here, we report the 29 | "memory exhausted" condition and exit. */ 30 | 31 | char * 32 | dir_name (char const *file) 33 | { 34 | char *result = mdir_name (file); 35 | if (!result) 36 | xalloc_die (); 37 | return result; 38 | } 39 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x64-Release", 5 | "generator": "Ninja", 6 | "configurationType": "Release", 7 | "inheritEnvironments": [ "msvc_x64_x64" ], 8 | "buildRoot": "${projectDir}\\out\\build\\${name}", 9 | "installRoot": "${projectDir}\\out\\install\\${name}", 10 | "cmakeCommandArgs": "", 11 | "buildCommandArgs": "-v", 12 | "ctestCommandArgs": "", 13 | "variables": [] 14 | }, 15 | { 16 | "name": "x64-RelWithDebInfo", 17 | "generator": "Ninja", 18 | "configurationType": "RelWithDebInfo", 19 | "inheritEnvironments": [ "msvc_x64_x64" ], 20 | "buildRoot": "${projectDir}\\out\\build\\${name}", 21 | "installRoot": "${projectDir}\\out\\install\\${name}", 22 | "cmakeCommandArgs": "", 23 | "buildCommandArgs": "-v", 24 | "ctestCommandArgs": "", 25 | "variables": [] 26 | }, 27 | { 28 | "name": "x64-Debug", 29 | "generator": "Ninja", 30 | "configurationType": "Debug", 31 | "inheritEnvironments": [ "msvc_x64_x64" ], 32 | "buildRoot": "${projectDir}\\out\\build\\${name}", 33 | "installRoot": "${projectDir}\\out\\install\\${name}", 34 | "cmakeCommandArgs": "", 35 | "buildCommandArgs": "-v", 36 | "ctestCommandArgs": "", 37 | "variables": [] 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /flex/src/libmain.c: -------------------------------------------------------------------------------- 1 | /* libmain - flex run-time support library "main" function */ 2 | 3 | /* This file is part of flex. */ 4 | 5 | /* Redistribution and use in source and binary forms, with or without */ 6 | /* modification, are permitted provided that the following conditions */ 7 | /* are met: */ 8 | 9 | /* 1. Redistributions of source code must retain the above copyright */ 10 | /* notice, this list of conditions and the following disclaimer. */ 11 | /* 2. Redistributions in binary form must reproduce the above copyright */ 12 | /* notice, this list of conditions and the following disclaimer in the */ 13 | /* documentation and/or other materials provided with the distribution. */ 14 | 15 | /* Neither the name of the University nor the names of its contributors */ 16 | /* may be used to endorse or promote products derived from this software */ 17 | /* without specific prior written permission. */ 18 | 19 | /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ 20 | /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ 21 | /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ 22 | /* PURPOSE. */ 23 | 24 | #include 25 | 26 | extern int yylex (void); 27 | 28 | int main (int argc, char *argv[]) 29 | { 30 | (void)argc; 31 | (void)argv; 32 | 33 | while (yylex () != 0) ; 34 | 35 | exit(0); 36 | } 37 | -------------------------------------------------------------------------------- /bison/src/named-ref.c: -------------------------------------------------------------------------------- 1 | /* Named symbol references for Bison 2 | 3 | Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #include 21 | #include "system.h" 22 | 23 | #include "named-ref.h" 24 | 25 | named_ref * 26 | named_ref_new (uniqstr id, location loc) 27 | { 28 | named_ref *res = xmalloc (sizeof *res); 29 | 30 | res->id = id; 31 | res->loc = loc; 32 | 33 | return res; 34 | } 35 | 36 | named_ref * 37 | named_ref_copy (const named_ref *r) 38 | { 39 | return named_ref_new (r->id, r->loc); 40 | } 41 | 42 | void 43 | named_ref_free (named_ref *r) 44 | { 45 | free (r); 46 | } 47 | -------------------------------------------------------------------------------- /common/misc/path-join.c: -------------------------------------------------------------------------------- 1 | /* Concatenate path components. 2 | Copyright (C) 2018-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published by the 6 | Free Software Foundation; either version 3 of the License, or any 7 | later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Akim Demaille . */ 18 | 19 | #include 20 | 21 | /* Specification. */ 22 | #include "path-join.h" 23 | 24 | #include /* xconcatenated_filename */ 25 | #include /* IS_ABSOLUTE_PATH */ 26 | #include /* xstrdup */ 27 | 28 | char * 29 | xpath_join (const char *path1, const char *path2) 30 | { 31 | if (!path2 || !*path2) 32 | return xstrdup (path1); 33 | else if (IS_ABSOLUTE_PATH (path2)) 34 | return xstrdup (path2); 35 | else 36 | return xconcatenated_filename (path1, path2, NULL); 37 | } 38 | -------------------------------------------------------------------------------- /bison/src/scan-gram.h: -------------------------------------------------------------------------------- 1 | /* Bison Grammar Scanner 2 | 3 | Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef SCAN_GRAM_H_ 22 | # define SCAN_GRAM_H_ 23 | 24 | /* Initialize the scanner to read file GRAM. */ 25 | void gram_scanner_open (const char *gram); 26 | /* Close the open files. */ 27 | void gram_scanner_close (void); 28 | 29 | /* Free all the memory allocated to the scanner. */ 30 | void gram_scanner_free (void); 31 | void gram_scanner_last_string_free (void); 32 | 33 | # define GRAM_LEX_DECL int gram_lex (GRAM_STYPE *val, location *loc) 34 | GRAM_LEX_DECL; 35 | 36 | #endif /* !SCAN_GRAM_H_ */ 37 | -------------------------------------------------------------------------------- /bison/src/print-xml.h: -------------------------------------------------------------------------------- 1 | /* Output an xml of the generated parser, for Bison. 2 | 3 | Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation, 4 | Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef PRINT_XML_H_ 22 | # define PRINT_XML_H_ 23 | 24 | # include 25 | 26 | void xml_indent (FILE *out, int level); 27 | void xml_puts (FILE *, int, char const *); 28 | void xml_printf (FILE *, int, char const *, ...); 29 | char const *xml_escape_n (int n, char const *str); 30 | char const *xml_escape (char const *str); 31 | void print_xml (void); 32 | 33 | /* Use xsltproc to generate HTML from XML output. */ 34 | void print_html (void); 35 | 36 | #endif /* !PRINT_XML_H_ */ 37 | -------------------------------------------------------------------------------- /common/m4/lib/hash-pjw.c: -------------------------------------------------------------------------------- 1 | /* hash-pjw.c -- compute a hash value from a NUL-terminated string. 2 | 3 | Copyright (C) 2001, 2003, 2006, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include "hash-pjw.h" 21 | 22 | #include 23 | 24 | #define SIZE_BITS (sizeof (size_t) * CHAR_BIT) 25 | 26 | /* A hash function for NUL-terminated char* strings using 27 | the method described by Bruno Haible. 28 | See https://www.haible.de/bruno/hashfunc.html. */ 29 | 30 | size_t 31 | hash_pjw (const void *x, size_t tablesize) 32 | { 33 | const char *s; 34 | size_t h = 0; 35 | 36 | for (s = x; *s; s++) 37 | h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); 38 | 39 | return h % tablesize; 40 | } 41 | -------------------------------------------------------------------------------- /common/misc/mbchar.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. 2 | 3 | This file is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as 5 | published by the Free Software Foundation; either version 2.1 of the 6 | License, or (at your option) any later version. 7 | 8 | This file is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with this program. If not, see . */ 15 | 16 | 17 | #include 18 | 19 | #define MBCHAR_INLINE _GL_EXTERN_INLINE 20 | 21 | #include 22 | 23 | #include "mbchar.h" 24 | 25 | #if IS_BASIC_ASCII 26 | 27 | /* Bit table of characters in the ISO C "basic character set". */ 28 | const unsigned int is_basic_table [UCHAR_MAX / 32 + 1] = 29 | { 30 | 0x00001a00, /* '\t' '\v' '\f' */ 31 | 0xffffffef, /* ' '...'#' '%'...'?' */ 32 | 0xfffffffe, /* 'A'...'Z' '[' '\\' ']' '^' '_' */ 33 | 0x7ffffffe /* 'a'...'z' '{' '|' '}' '~' */ 34 | /* The remaining bits are 0. */ 35 | }; 36 | 37 | #endif /* IS_BASIC_ASCII */ 38 | -------------------------------------------------------------------------------- /bison/src/assoc.c: -------------------------------------------------------------------------------- 1 | /* Associativity information. 2 | 3 | Copyright (C) 2002, 2005-2006, 2008-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #include 22 | #include "system.h" 23 | 24 | #include "assoc.h" 25 | 26 | 27 | const char * 28 | assoc_to_string (assoc a) 29 | { 30 | switch (a) 31 | { 32 | case undef_assoc: 33 | return "undefined associativity"; 34 | 35 | case right_assoc: 36 | return "%right"; 37 | 38 | case left_assoc: 39 | return "%left"; 40 | 41 | case non_assoc: 42 | return "%nonassoc"; 43 | 44 | case precedence_assoc: 45 | return "%precedence"; 46 | } 47 | abort (); 48 | } 49 | -------------------------------------------------------------------------------- /bison/src/counterexample.h: -------------------------------------------------------------------------------- 1 | /* Conflict counterexample generation 2 | 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef COUNTEREXAMPLE_H 21 | # define COUNTEREXAMPLE_H 22 | 23 | # include "state.h" 24 | 25 | // Init/deinit this module. 26 | void counterexample_init (void); 27 | void counterexample_free (void); 28 | 29 | // Print the counterexamples for the conflicts of state S. 30 | // 31 | // Used both for the warnings on the terminal (OUT = stderr, PREFIX = 32 | // ""), and for the reports (OUT != stderr, PREFIX != ""). 33 | void 34 | counterexample_report_state (const state *s, FILE *out, const char *prefix); 35 | 36 | #endif /* COUNTEREXAMPLE_H */ 37 | -------------------------------------------------------------------------------- /common/misc/xstrndup.c: -------------------------------------------------------------------------------- 1 | /* Duplicate a bounded initial segment of a string, with out-of-memory 2 | checking. 3 | Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include "xstrndup.h" 22 | 23 | #include 24 | #include "xalloc.h" 25 | 26 | /* Return a newly allocated copy of at most N bytes of STRING. 27 | In other words, return a copy of the initial segment of length N of 28 | STRING. */ 29 | char * 30 | xstrndup (const char *string, size_t n) 31 | { 32 | size_t len = strnlen(string, n) + 1; 33 | char* s = xmalloc(sizeof(char) * len); 34 | if (!s) 35 | xalloc_die(); 36 | strncpy(s, string, n); 37 | s[n] = 0; 38 | return s; 39 | } 40 | -------------------------------------------------------------------------------- /common/misc/get-errno.c: -------------------------------------------------------------------------------- 1 | /* get-errno.c - get and set errno. 2 | 3 | Copyright (C) 2002, 2006, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | /* Written by Paul Eggert. */ 20 | 21 | #include 22 | 23 | #include "get-errno.h" 24 | 25 | #include 26 | 27 | /* Get and set errno. A source file that needs to set or get errno, 28 | but doesn't need to test for specific errno values, can use these 29 | functions to avoid namespace pollution. For example, a file that 30 | defines EQUAL should not include , since might 31 | define EQUAL; such a file can include instead. */ 32 | 33 | int 34 | get_errno (void) 35 | { 36 | return errno; 37 | } 38 | 39 | void 40 | set_errno (int e) 41 | { 42 | errno = e; 43 | } 44 | -------------------------------------------------------------------------------- /common/misc/xalloc-die.c: -------------------------------------------------------------------------------- 1 | /* Report a memory allocation failure and exit. 2 | 3 | Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | #include "xalloc.h" 22 | 23 | #include 24 | 25 | #include "error.h" 26 | #include "exitfail.h" 27 | 28 | #include "gettext.h" 29 | #define _(msgid) gettext (msgid) 30 | 31 | void 32 | xalloc_die (void) 33 | { 34 | error (exit_failure, 0, "%s", _("memory exhausted")); 35 | 36 | /* _Noreturn cannot be given to error, since it may return if 37 | its first argument is 0. To help compilers understand the 38 | xalloc_die does not return, call abort. Also, the abort is a 39 | safety feature if exit_failure is 0 (which shouldn't happen). */ 40 | abort (); 41 | } 42 | -------------------------------------------------------------------------------- /common/m4/lib/mkdtemp.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1999, 2001-2003, 2006-2007, 2009-2021 Free Software 2 | Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Extracted from misc/mkdtemp.c. */ 19 | 20 | #include 21 | 22 | /* Specification. */ 23 | #include 24 | 25 | #include "tempname.h" 26 | 27 | /* Generate a unique temporary directory from XTEMPLATE. 28 | The last six characters of XTEMPLATE must be "XXXXXX"; 29 | they are replaced with a string that makes the filename unique. 30 | The directory is created, mode 700, and its name is returned. 31 | (This function comes from OpenBSD.) */ 32 | char * 33 | mkdtemp (char *xtemplate) 34 | { 35 | if (gen_tempname (xtemplate, 0, 0, GT_DIR)) 36 | return NULL; 37 | else 38 | return xtemplate; 39 | } 40 | -------------------------------------------------------------------------------- /common/misc/xhash.c: -------------------------------------------------------------------------------- 1 | /* hash - hashing table processing. 2 | 3 | Copyright (C) 2019-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | /* Specification. */ 21 | #include "hash.h" 22 | 23 | #include "xalloc.h" 24 | 25 | Hash_table * 26 | hash_xinitialize (size_t candidate, const Hash_tuning *tuning, 27 | Hash_hasher hasher, Hash_comparator comparator, 28 | Hash_data_freer data_freer) 29 | { 30 | Hash_table *res = 31 | hash_initialize (candidate, tuning, hasher, comparator, data_freer); 32 | if (!res) 33 | xalloc_die (); 34 | return res; 35 | } 36 | 37 | void * 38 | hash_xinsert (Hash_table *table, void const *entry) 39 | { 40 | void *res = hash_insert (table, entry); 41 | if (!res) 42 | xalloc_die (); 43 | return res; 44 | } 45 | -------------------------------------------------------------------------------- /common/misc/stdio-safer.h: -------------------------------------------------------------------------------- 1 | /* Invoke stdio functions, but avoid some glitches. 2 | 3 | Copyright (C) 2001, 2003, 2006, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | 22 | #if GNULIB_FOPEN_SAFER 23 | FILE *fopen_safer (char const *, char const *) 24 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1); 25 | #endif 26 | 27 | #if GNULIB_FREOPEN_SAFER 28 | FILE *freopen_safer (char const *, char const *, FILE *) 29 | _GL_ARG_NONNULL ((2, 3)); 30 | #endif 31 | 32 | #if GNULIB_POPEN_SAFER 33 | FILE *popen_safer (char const *, char const *) 34 | _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1); 35 | #endif 36 | 37 | #if GNULIB_TMPFILE_SAFER 38 | FILE *tmpfile_safer (void) 39 | _GL_ATTRIBUTE_DEALLOC (fclose, 1); 40 | #endif 41 | -------------------------------------------------------------------------------- /common/misc/glthread/tls.c: -------------------------------------------------------------------------------- 1 | /* Thread-local storage in multithreaded situations. 2 | Copyright (C) 2005-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Bruno Haible , 2005. */ 18 | 19 | #include 20 | 21 | #include "glthread/tls.h" 22 | 23 | /* ========================================================================= */ 24 | 25 | #if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS 26 | 27 | #endif 28 | 29 | /* ========================================================================= */ 30 | 31 | #if USE_POSIX_THREADS 32 | 33 | #endif 34 | 35 | /* ========================================================================= */ 36 | 37 | #if USE_WINDOWS_THREADS 38 | 39 | #endif 40 | 41 | /* ========================================================================= */ 42 | -------------------------------------------------------------------------------- /common/m4/lib/gl_anyhash1.h: -------------------------------------------------------------------------------- 1 | /* Hash table for sequential list, set, and map data type. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Common code of 19 | gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c, 20 | gl_linkedhash_set.c, gl_hash_set.c, 21 | gl_linkedhash_map.c, gl_hash_map.c. */ 22 | 23 | /* Hash table entry. */ 24 | struct gl_hash_entry 25 | { 26 | struct gl_hash_entry *hash_next; /* chain of entries in same bucket */ 27 | size_t hashcode; /* cache of the hash code of 28 | - the key (for map data type) or 29 | - the value (for list, set data types) */ 30 | }; 31 | typedef struct gl_hash_entry * gl_hash_entry_t; 32 | -------------------------------------------------------------------------------- /common/m4/lib/malloc/scratch_buffer_dupfree.c: -------------------------------------------------------------------------------- 1 | /* Variable-sized buffer with on-stack default allocation. 2 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public 16 | License along with the GNU C Library; if not, see 17 | . */ 18 | 19 | #ifndef _LIBC 20 | # include 21 | #endif 22 | 23 | #include 24 | #include 25 | 26 | void * 27 | __libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) 28 | { 29 | void *data = buffer->data; 30 | if (data == buffer->__space.__c) 31 | { 32 | void *copy = malloc (size); 33 | return copy != NULL ? memcpy (copy, data, size) : NULL; 34 | } 35 | else 36 | { 37 | void *copy = realloc (data, size); 38 | return copy != NULL ? copy : data; 39 | } 40 | } 41 | libc_hidden_def (__libc_scratch_buffer_dupfree) 42 | -------------------------------------------------------------------------------- /common/m4/lib/vasprintf.c: -------------------------------------------------------------------------------- 1 | /* Formatted output to strings. 2 | Copyright (C) 1999, 2002, 2006-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License along 15 | with this program; if not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #ifdef IN_LIBASPRINTF 21 | # include "vasprintf.h" 22 | #else 23 | # include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "vasnprintf.h" 31 | 32 | int 33 | vasprintf (char **resultp, const char *format, va_list args) 34 | { 35 | size_t length; 36 | char *result = vasnprintf (NULL, &length, format, args); 37 | if (result == NULL) 38 | return -1; 39 | 40 | if (length > INT_MAX) 41 | { 42 | free (result); 43 | errno = EOVERFLOW; 44 | return -1; 45 | } 46 | 47 | *resultp = result; 48 | /* Return the number of resulting bytes, excluding the trailing NUL. */ 49 | return length; 50 | } 51 | -------------------------------------------------------------------------------- /bison/src/reduce.h: -------------------------------------------------------------------------------- 1 | /* Grammar reduction for Bison. 2 | 3 | Copyright (C) 2000-2002, 2007, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef REDUCE_H_ 22 | # define REDUCE_H_ 23 | 24 | void reduce_grammar (void); 25 | void reduce_output (FILE *out); 26 | bool reduce_token_unused_in_grammar (symbol_number i); 27 | 28 | /** Whether symbol \a i is useless in the grammar. 29 | * \pre reduce_grammar was called before. 30 | */ 31 | bool reduce_nonterminal_useless_in_grammar (const sym_content *sym); 32 | 33 | void reduce_free (void); 34 | 35 | /** Map initial nterm numbers to the new ones. Built by 36 | * reduce_grammar. Size nnterms + nuseless_nonterminals. */ 37 | extern symbol_number *nterm_map; 38 | 39 | extern int nuseless_nonterminals; 40 | extern int nuseless_productions; 41 | 42 | #endif /* !REDUCE_H_ */ 43 | -------------------------------------------------------------------------------- /common/misc/xconcat-filename.c: -------------------------------------------------------------------------------- 1 | /* Construct a full filename from a directory and a relative filename. 2 | Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published by the 6 | Free Software Foundation; either version 3 of the License, or any 7 | later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Bruno Haible . */ 18 | 19 | #include 20 | 21 | /* Specification. */ 22 | #include "concat-filename.h" 23 | 24 | #include "xalloc.h" 25 | 26 | /* Concatenate a directory filename, a relative filename and an optional 27 | suffix. The directory may end with the directory separator. The second 28 | argument may not start with the directory separator (it is relative). 29 | Return a freshly allocated filename. */ 30 | char * 31 | xconcatenated_filename (const char *directory, const char *filename, 32 | const char *suffix) 33 | { 34 | char *result; 35 | 36 | result = concatenated_filename (directory, filename, suffix); 37 | if (result == NULL) 38 | xalloc_die (); 39 | 40 | return result; 41 | } 42 | -------------------------------------------------------------------------------- /bison/src/named-ref.h: -------------------------------------------------------------------------------- 1 | /* Named symbol references for Bison 2 | 3 | Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef NAMED_REF_H_ 21 | # define NAMED_REF_H_ 22 | 23 | # include "location.h" 24 | # include "uniqstr.h" 25 | 26 | /* Named reference object. Keeps information about 27 | a symbolic name of a symbol in a rule. */ 28 | typedef struct named_ref 29 | { 30 | /* Symbolic named given by user. */ 31 | uniqstr id; 32 | 33 | /* Location of the symbolic name. Not including brackets. */ 34 | location loc; 35 | } named_ref; 36 | 37 | /* Allocate a named reference object. */ 38 | named_ref *named_ref_new (uniqstr id, location loc); 39 | 40 | /* Allocate and return a copy. */ 41 | named_ref *named_ref_copy (const named_ref *r); 42 | 43 | /* Free a named reference object. */ 44 | void named_ref_free (named_ref *r); 45 | 46 | #endif /* !NAMED_REF_H_ */ 47 | -------------------------------------------------------------------------------- /common/m4/lib/cloexec.h: -------------------------------------------------------------------------------- 1 | /* cloexec.c - set or clear the close-on-exec descriptor flag 2 | 3 | Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #include 21 | 22 | /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, 23 | or clear the flag if VALUE is false. 24 | Return 0 on success, or -1 on error with 'errno' set. 25 | 26 | Note that on MingW, this function does NOT protect DESC from being 27 | inherited into spawned children. Instead, either use dup_cloexec 28 | followed by closing the original DESC, or use interfaces such as 29 | open or pipe2 that accept flags like O_CLOEXEC to create DESC 30 | non-inheritable in the first place. */ 31 | 32 | int set_cloexec_flag (int desc, bool value); 33 | 34 | /* Duplicates a file handle FD, while marking the copy to be closed 35 | prior to exec or spawn. Returns -1 and sets errno if FD could not 36 | be duplicated. */ 37 | 38 | int dup_cloexec (int fd); 39 | -------------------------------------------------------------------------------- /common/m4/lib/windows-spin.h: -------------------------------------------------------------------------------- 1 | /* Spin locks (native Windows implementation). 2 | Copyright (C) 2019-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, see . */ 16 | 17 | /* Written by Bruno Haible , 2019. */ 18 | 19 | #ifndef _WINDOWS_SPIN_H 20 | #define _WINDOWS_SPIN_H 21 | 22 | #define WIN32_LEAN_AND_MEAN /* avoid including junk */ 23 | #include 24 | 25 | typedef struct 26 | { 27 | LONG volatile word; 28 | } 29 | glwthread_spinlock_t; 30 | 31 | #define GLWTHREAD_SPIN_INIT { 0 } 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | extern void glwthread_spin_init (glwthread_spinlock_t *lock); 38 | extern int glwthread_spin_lock (glwthread_spinlock_t *lock); 39 | extern int glwthread_spin_trylock (glwthread_spinlock_t *lock); 40 | extern int glwthread_spin_unlock (glwthread_spinlock_t *lock); 41 | extern int glwthread_spin_destroy (glwthread_spinlock_t *lock); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* _WINDOWS_SPIN_H */ 48 | -------------------------------------------------------------------------------- /common/misc/gl_anytree_list1.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by a binary tree. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Common code of gl_avltree_list.c, gl_rbtree_list.c, 19 | gl_avltreehash_list.c, gl_rbtreehash_list.c. */ 20 | 21 | /* An item on the stack used for iterating across the elements. */ 22 | typedef struct 23 | { 24 | gl_list_node_t node; 25 | size_t rightp; 26 | } iterstack_item_t; 27 | 28 | /* A stack used for iterating across the elements. */ 29 | typedef iterstack_item_t iterstack_t[MAXHEIGHT]; 30 | 31 | /* Frees a non-empty subtree recursively. 32 | This function is recursive and therefore not very fast. */ 33 | static void 34 | free_subtree (gl_list_node_t node) 35 | { 36 | if (node->left != NULL) 37 | free_subtree (node->left); 38 | if (node->right != NULL) 39 | free_subtree (node->right); 40 | free (node); 41 | } 42 | -------------------------------------------------------------------------------- /common/m4/lib/freadahead.h: -------------------------------------------------------------------------------- 1 | /* Retrieve information about a FILE stream. 2 | Copyright (C) 2007-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | #include 19 | 20 | /* Assuming the stream STREAM is open for reading: 21 | Return the number of bytes waiting in the input buffer of STREAM. 22 | This includes both the bytes that have been read from the underlying input 23 | source and the bytes that have been pushed back through 'ungetc'. 24 | 25 | If this number is 0 and the stream is not currently writing, 26 | fflush (STREAM) is known to be a no-op. 27 | 28 | STREAM must not be wide-character oriented. */ 29 | 30 | #if HAVE___FREADAHEAD /* musl libc */ 31 | 32 | # include 33 | # define freadahead(stream) __freadahead (stream) 34 | 35 | #else 36 | 37 | # ifdef __cplusplus 38 | extern "C" { 39 | # endif 40 | 41 | extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE; 42 | 43 | # ifdef __cplusplus 44 | } 45 | # endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /common/m4/lib/hash-triple.h: -------------------------------------------------------------------------------- 1 | /* Hash functions for file-related (name, device, inode) triples. 2 | Copyright (C) 2007-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Jim Meyering, 2007. */ 18 | 19 | #ifndef HASH_TRIPLE_H 20 | #define HASH_TRIPLE_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | /* Describe a just-created or just-renamed destination file. */ 27 | struct F_triple 28 | { 29 | char *name; 30 | ino_t st_ino; 31 | dev_t st_dev; 32 | }; 33 | 34 | /* Defined in module 'hash-triple-simple'. */ 35 | 36 | extern size_t triple_hash (void const *x, size_t table_size) _GL_ATTRIBUTE_PURE; 37 | extern bool triple_compare_ino_str (void const *x, void const *y) 38 | _GL_ATTRIBUTE_PURE; 39 | extern void triple_free (void *x); 40 | 41 | /* Defined in module 'hash-triple'. */ 42 | extern size_t triple_hash_no_name (void const *x, size_t table_size) 43 | _GL_ATTRIBUTE_PURE; 44 | extern bool triple_compare (void const *x, void const *y); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status](https://ci.appveyor.com/api/projects/status/58lcjnr0mb9uc8c8/branch/master?svg=true)](https://ci.appveyor.com/project/lexxmark/winflexbison/branch/master) 2 | 3 | # WinFlexBison - Flex and Bison for Windows 4 | 5 | WinFlexBison is a Windows port of [Flex (the fast lexical analyser)](https://github.com/westes/flex/) and [GNU Bison (parser generator)](https://www.gnu.org/software/bison/). 6 | Both win_flex and win_bison are based on upstream sources but depend on system libraries only. 7 | 8 | **NOTE**: 9 | * 2.4.x versions include GNU Bison version 2.7 10 | * 2.5.x versions include GNU Bison version 3.x.x 11 | 12 | ## License 13 | 14 | Flex uses a [BSD license](flex/src/COPYING), GNU Bison is [licensed under the GNU General Public License (GPLv3+)](bison/src/COPYING). 15 | All build scripts in WinFlexBison are distributed under GPLv3+. See [COPYING](COPYING) for details. 16 | 17 | All documentation, especially those under custom_build_rules/doc, is distributed under the GNU Free Documentation License (FDL 1.3+). 18 | 19 | 20 | ## Downloads 21 | 22 | https://github.com/lexxmark/winflexbison/releases provides stable versions. 23 | To test non-released development versions see the artifacts provided by CI. 24 | 25 | 26 | ## Changelog 27 | 28 | The release page includes the full Changelog but you may also see the [changelog.md](changelog.md) file. 29 | 30 | ## Build requirements 31 | 32 | * Visual Studio 2017 or newer 33 | * CMake 34 | 35 | 36 | ## HowTo 37 | 38 | You may use win_flex and win_bison directly on the command line or [use them via CustomBuildRules in VisualStudio](custom_build_rules/README.md). 39 | 40 | 41 | ## Example flex/bison files 42 | 43 | See https://github.com/meyerd/flex-bison-example 44 | -------------------------------------------------------------------------------- /common/m4/lib/mkstemp.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2021 Free Software 2 | Foundation, Inc. 3 | This file is derived from the one in the GNU C Library. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #if !_LIBC 19 | # include 20 | #endif 21 | 22 | #include 23 | 24 | #if !_LIBC 25 | # include "tempname.h" 26 | # define __gen_tempname gen_tempname 27 | # ifndef __GT_FILE 28 | # define __GT_FILE GT_FILE 29 | # endif 30 | #endif 31 | 32 | #include 33 | 34 | #ifndef __GT_FILE 35 | # define __GT_FILE 0 36 | #endif 37 | 38 | /* Generate a unique temporary file name from XTEMPLATE. 39 | The last six characters of XTEMPLATE must be "XXXXXX"; 40 | they are replaced with a string that makes the file name unique. 41 | Then open the file and return a fd. 42 | 43 | If you are creating temporary files which will later be removed, 44 | consider using the clean-temp module, which avoids several pitfalls 45 | of using mkstemp directly. */ 46 | int 47 | mkstemp (char *xtemplate) 48 | { 49 | return __gen_tempname (xtemplate, 0, 0, __GT_FILE); 50 | } 51 | -------------------------------------------------------------------------------- /common/m4/lib/fd-safer.c: -------------------------------------------------------------------------------- 1 | /* Return a safer copy of a file descriptor. 2 | 3 | Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | #include 22 | #include "unistd-safer.h" 23 | 24 | #include 25 | //#include 26 | 27 | /* Return FD, unless FD would be a copy of standard input, output, or 28 | error; in that case, return a duplicate of FD, closing FD. On 29 | failure to duplicate, close FD, set errno, and return -1. Preserve 30 | errno if FD is negative, so that the caller can always inspect 31 | errno when the returned value is negative. 32 | 33 | This function is usefully wrapped around functions that return file 34 | descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ 35 | 36 | int 37 | fd_safer (int fd) 38 | { 39 | if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) 40 | { 41 | int f = _dup (fd); 42 | int e = errno; 43 | _close (fd); 44 | errno = e; 45 | fd = f; 46 | } 47 | 48 | return fd; 49 | } 50 | -------------------------------------------------------------------------------- /common/misc/gethrxtime.h: -------------------------------------------------------------------------------- 1 | /* gethrxtime -- get high resolution real time 2 | 3 | Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #ifndef GETHRXTIME_H_ 21 | #define GETHRXTIME_H_ 1 22 | 23 | #include "xtime.h" 24 | 25 | #ifndef _GL_INLINE_HEADER_BEGIN 26 | #error "Please include config.h first." 27 | #endif 28 | _GL_INLINE_HEADER_BEGIN 29 | #ifndef GETHRXTIME_INLINE 30 | # define GETHRXTIME_INLINE _GL_INLINE 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Get the current time, as a count of the number of nanoseconds since 38 | an arbitrary epoch (e.g., the system boot time). Prefer a 39 | high-resolution clock that is not subject to resetting or 40 | drifting. */ 41 | 42 | #if HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME 43 | # include 44 | GETHRXTIME_INLINE xtime_t gethrxtime (void) { return gethrtime (); } 45 | # else 46 | xtime_t gethrxtime (void); 47 | #endif 48 | 49 | _GL_INLINE_HEADER_END 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /common/misc/config.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define STDIN_FILENO 0 4 | #define STDOUT_FILENO 1 5 | #define STDERR_FILENO 2 6 | 7 | #define ssize_t ptrdiff_t 8 | 9 | #define _GL_INLINE_HEADER_BEGIN 10 | #define _GL_INLINE_HEADER_END 11 | #define _GL_EXTERN_INLINE inline 12 | #define _GL_ATTRIBUTE_PURE 13 | #define _GL_ATTRIBUTE_CONST 14 | #define _GL_UNUSED 15 | #define _GL_ATTRIBUTE_NODISCARD 16 | #define _GL_ATTRIBUTE_MAYBE_UNUSED 17 | #define HAVE_LONG_LONG_INT 1 18 | # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ 19 | #define HAVE_DECL_STRERROR_R 1 20 | #define HAVE_DECL___ARGV 1 21 | #define _GL_ARG_NONNULL(a) 22 | #define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) 23 | #define _GL_ATTRIBUTE_DEPRECATED 24 | #define _GL_ATTRIBUTE_FALLTHROUGH 25 | #define GNULIB_XALLOC 1 26 | #define _GL_ATTRIBUTE_MALLOC 27 | #define _GL_ATTRIBUTE_ALLOC_SIZE(a) 28 | #define _GL_ATTRIBUTE_DEALLOC_FREE 29 | #define _GL_ATTRIBUTE_DEALLOC(f, i) 30 | #define _GL_ATTRIBUTE_RETURNS_NONNULL 31 | #define _GL_ATTRIBUTE_COLD 32 | #define _GL_ASYNC_SAFE 33 | #define GNULIB_XALLOC_DIE 1 34 | #define _GL_HAVE__STATIC_ASSERT 1 35 | #define _Static_assert(a, b) 36 | #define __PGI 37 | 38 | #define MIN min 39 | #define _GL_CMP(a, b) (a) == (b) 40 | 41 | #define __getopt_argv_const 42 | #if !defined (__MSYS__) && !defined (__MINGW32__) /* defined in sys/cdefs.h */ 43 | #define _Noreturn 44 | #endif 45 | 46 | #ifndef _GL_INLINE 47 | #define _GL_INLINE inline 48 | #endif 49 | 50 | /* should be set by including "filename.h" 51 | #ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 52 | #define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 53 | #endif */ 54 | 55 | #if !defined (__MSYS__) && !defined (__MINGW32__) /* defined in sys/stat.h */ 56 | #define S_ISDIR(mode) (mode & _S_IFDIR) 57 | #endif 58 | 59 | extern char* _stpcpy(char *yydest, const char *yysrc); -------------------------------------------------------------------------------- /bison/src/ielr.h: -------------------------------------------------------------------------------- 1 | /* IELR main implementation. 2 | 3 | Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef IELR_H_ 21 | # define IELR_H_ 22 | 23 | # include 24 | 25 | # include "state.h" 26 | 27 | /** 28 | * \pre 29 | * - \c ::states is of size \c ::nstates and defines an LR(0) parser 30 | * for the users's grammar. 31 | * - \c ::ntokens is the number of tokens in the grammar. 32 | * \post 33 | * - \c ::states is of size \c ::nstates (which might be greater than 34 | * ::nstates \@pre) and defines the type of parser specified by 35 | * the value of the \c \%define variable \c lr.type. Its value can be: 36 | * - \c "lalr". 37 | * - \c "ielr". 38 | * - \c "canonical-lr". 39 | */ 40 | void ielr (void); 41 | 42 | bool ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item, 43 | symbol_number lookahead, state ***predecessors, 44 | bitset **item_lookahead_sets); 45 | 46 | #endif /* !IELR_H_ */ 47 | -------------------------------------------------------------------------------- /bison/src/glyphs.h: -------------------------------------------------------------------------------- 1 | /* Graphical symbols. 2 | 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef GLYPHS_H 21 | # define GLYPHS_H 22 | 23 | /* Initialize the following variables. */ 24 | void glyphs_init (void); 25 | 26 | /* In gnulib/lib/unicodeio.h unicode_to_mb uses a buffer of 25 bytes. 27 | In down_arrow, we append one space. */ 28 | typedef char glyph_buffer_t[26]; 29 | 30 | /* "→", separates the lhs of a rule from its rhs. */ 31 | extern glyph_buffer_t arrow; 32 | extern int arrow_width; 33 | 34 | /* "•", a point in an item (aka, a dotted rule). */ 35 | extern glyph_buffer_t dot; 36 | extern int dot_width; 37 | 38 | /* "↳ ", below an lhs to announce the rhs. */ 39 | extern glyph_buffer_t down_arrow; 40 | extern int down_arrow_width; 41 | 42 | /* "ε", an empty rhs. */ 43 | extern glyph_buffer_t empty; 44 | extern int empty_width; 45 | 46 | /* " ", separate symbols in the rhs of a derivation. */ 47 | extern const char *derivation_separator; 48 | extern int derivation_separator_width; 49 | 50 | #endif /* GLYPHS_H */ 51 | -------------------------------------------------------------------------------- /common/misc/dirname.h: -------------------------------------------------------------------------------- 1 | /* Take file names apart into directory and base names. 2 | 3 | Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, 4 | Inc. 5 | 6 | This file is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as 8 | published by the Free Software Foundation; either version 2.1 of the 9 | License, or (at your option) any later version. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef DIRNAME_H_ 20 | # define DIRNAME_H_ 1 21 | 22 | # include 23 | # include 24 | # include "filename.h" 25 | # include "basename-lgpl.h" 26 | 27 | # ifndef DIRECTORY_SEPARATOR 28 | # define DIRECTORY_SEPARATOR '/' 29 | # endif 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | # if GNULIB_DIRNAME 36 | char *base_name (char const *file) 37 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE 38 | _GL_ATTRIBUTE_RETURNS_NONNULL; 39 | char *dir_name (char const *file) 40 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE 41 | _GL_ATTRIBUTE_RETURNS_NONNULL; 42 | # endif 43 | 44 | char *mdir_name (char const *file) 45 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; 46 | size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE; 47 | 48 | bool strip_trailing_slashes (char *file); 49 | 50 | #ifdef __cplusplus 51 | } /* extern "C" */ 52 | #endif 53 | 54 | #endif /* not DIRNAME_H_ */ 55 | -------------------------------------------------------------------------------- /common/misc/c-strcasecmp.c: -------------------------------------------------------------------------------- 1 | /* c-strcasecmp.c -- case insensitive string comparator in C locale 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "c-strcase.h" 21 | 22 | #include 23 | 24 | #include "c-ctype.h" 25 | 26 | int 27 | c_strcasecmp (const char *s1, const char *s2) 28 | { 29 | register const unsigned char *p1 = (const unsigned char *) s1; 30 | register const unsigned char *p2 = (const unsigned char *) s2; 31 | unsigned char c1, c2; 32 | 33 | if (p1 == p2) 34 | return 0; 35 | 36 | do 37 | { 38 | c1 = c_tolower (*p1); 39 | c2 = c_tolower (*p2); 40 | 41 | if (c1 == '\0') 42 | break; 43 | 44 | ++p1; 45 | ++p2; 46 | } 47 | while (c1 == c2); 48 | 49 | if (UCHAR_MAX <= INT_MAX) 50 | return c1 - c2; 51 | else 52 | /* On machines where 'char' and 'int' are types of the same size, the 53 | difference of two 'unsigned char' values - including the sign bit - 54 | doesn't fit in an 'int'. */ 55 | return _GL_CMP (c1, c2); 56 | } 57 | -------------------------------------------------------------------------------- /common/m4/lib/xvasprintf.h: -------------------------------------------------------------------------------- 1 | /* vasprintf and asprintf with out-of-memory checking. 2 | Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _XVASPRINTF_H 18 | #define _XVASPRINTF_H 19 | 20 | /* Get va_list. */ 21 | #include 22 | 23 | /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD. */ 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Write formatted output to a string dynamically allocated with malloc(), 31 | and return it. Upon [ENOMEM] memory allocation error, call xalloc_die. 32 | On some other error 33 | - [EOVERFLOW] resulting string length is > INT_MAX, 34 | - [EINVAL] invalid format string, 35 | - [EILSEQ] error during conversion between wide and multibyte characters, 36 | return NULL. */ 37 | extern char *xasprintf (const char *format, ...) 38 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2)); 39 | extern char *xvasprintf (const char *format, va_list args) 40 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0)); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _XVASPRINTF_H */ 47 | -------------------------------------------------------------------------------- /flex/src/flexint.h: -------------------------------------------------------------------------------- 1 | /* flex integer type definitions */ 2 | 3 | #ifndef FLEXINT_H 4 | #define FLEXINT_H 5 | 6 | /* C99 systems have . Non-C99 systems may or may not. */ 7 | 8 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 9 | 10 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 11 | * if you want the limit (max/min) macros for int types. 12 | */ 13 | #ifndef __STDC_LIMIT_MACROS 14 | #define __STDC_LIMIT_MACROS 1 15 | #endif 16 | 17 | #include 18 | typedef int8_t flex_int8_t; 19 | typedef uint8_t flex_uint8_t; 20 | typedef int16_t flex_int16_t; 21 | typedef uint16_t flex_uint16_t; 22 | typedef int32_t flex_int32_t; 23 | typedef uint32_t flex_uint32_t; 24 | #else 25 | typedef signed char flex_int8_t; 26 | typedef short int flex_int16_t; 27 | typedef int flex_int32_t; 28 | typedef unsigned char flex_uint8_t; 29 | typedef unsigned short int flex_uint16_t; 30 | typedef unsigned int flex_uint32_t; 31 | 32 | /* Limits of integral types. */ 33 | #ifndef INT8_MIN 34 | #define INT8_MIN (-128) 35 | #endif 36 | #ifndef INT16_MIN 37 | #define INT16_MIN (-32767-1) 38 | #endif 39 | #ifndef INT32_MIN 40 | #define INT32_MIN (-2147483647-1) 41 | #endif 42 | #ifndef INT8_MAX 43 | #define INT8_MAX (127) 44 | #endif 45 | #ifndef INT16_MAX 46 | #define INT16_MAX (32767) 47 | #endif 48 | #ifndef INT32_MAX 49 | #define INT32_MAX (2147483647) 50 | #endif 51 | #ifndef UINT8_MAX 52 | #define UINT8_MAX (255U) 53 | #endif 54 | #ifndef UINT16_MAX 55 | #define UINT16_MAX (65535U) 56 | #endif 57 | #ifndef UINT32_MAX 58 | #define UINT32_MAX (4294967295U) 59 | #endif 60 | 61 | #ifndef SIZE_MAX 62 | #define SIZE_MAX (~(size_t)0) 63 | #endif 64 | 65 | #endif /* ! C99 */ 66 | 67 | #endif /* ! FLEXINT_H */ 68 | -------------------------------------------------------------------------------- /common/misc/c-strncasecmp.c: -------------------------------------------------------------------------------- 1 | /* c-strncasecmp.c -- case insensitive string comparator in C locale 2 | Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | /* Specification. */ 20 | #include "c-strcase.h" 21 | 22 | #include 23 | 24 | #include "c-ctype.h" 25 | 26 | int 27 | c_strncasecmp (const char *s1, const char *s2, size_t n) 28 | { 29 | register const unsigned char *p1 = (const unsigned char *) s1; 30 | register const unsigned char *p2 = (const unsigned char *) s2; 31 | unsigned char c1, c2; 32 | 33 | if (p1 == p2 || n == 0) 34 | return 0; 35 | 36 | do 37 | { 38 | c1 = c_tolower (*p1); 39 | c2 = c_tolower (*p2); 40 | 41 | if (--n == 0 || c1 == '\0') 42 | break; 43 | 44 | ++p1; 45 | ++p2; 46 | } 47 | while (c1 == c2); 48 | 49 | if (UCHAR_MAX <= INT_MAX) 50 | return c1 - c2; 51 | else 52 | /* On machines where 'char' and 'int' are types of the same size, the 53 | difference of two 'unsigned char' values - including the sign bit - 54 | doesn't fit in an 'int'. */ 55 | return _GL_CMP (c1, c2); 56 | } 57 | -------------------------------------------------------------------------------- /common/misc/xmemdup0.c: -------------------------------------------------------------------------------- 1 | /* xmemdup0.c -- copy a block of arbitrary bytes, plus a trailing NUL 2 | 3 | Copyright (C) 2008-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #include 19 | 20 | #include "xmemdup0.h" 21 | #include "xalloc.h" 22 | 23 | #include 24 | 25 | /* Clone an arbitrary block of bytes P of size S, with error checking, 26 | and include a terminating NUL byte. P is of type 'void const *', 27 | to make it easier to use this with other mem* functions that return 28 | 'void *', but since appending a NUL byte only makes sense on bytes, 29 | the return type is 'char *'. 30 | 31 | The terminating NUL makes it safe to use strlen or rawmemchr to 32 | check for embedded NUL; it also speeds up algorithms such as escape 33 | sequence processing on arbitrary memory, by making it always safe 34 | to read the byte after the escape character rather than having to 35 | check if each escape character is the last byte in the object. */ 36 | 37 | char * 38 | xmemdup0 (void const *p, size_t s) 39 | { 40 | char *result = xcharalloc (s + 1); 41 | if (s > 0) 42 | memcpy (result, p, s); 43 | result[s] = 0; 44 | return result; 45 | } 46 | -------------------------------------------------------------------------------- /common/m4/lib/malloc/scratch_buffer_grow.c: -------------------------------------------------------------------------------- 1 | /* Variable-sized buffer with on-stack default allocation. 2 | Copyright (C) 2015-2021 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public 16 | License along with the GNU C Library; if not, see 17 | . */ 18 | 19 | #ifndef _LIBC 20 | # include 21 | #endif 22 | 23 | #include 24 | #include 25 | 26 | bool 27 | __libc_scratch_buffer_grow (struct scratch_buffer *buffer) 28 | { 29 | void *new_ptr; 30 | size_t new_length = buffer->length * 2; 31 | 32 | /* Discard old buffer. */ 33 | scratch_buffer_free (buffer); 34 | 35 | /* Check for overflow. */ 36 | if (__glibc_likely (new_length >= buffer->length)) 37 | new_ptr = malloc (new_length); 38 | else 39 | { 40 | __set_errno (ENOMEM); 41 | new_ptr = NULL; 42 | } 43 | 44 | if (__glibc_unlikely (new_ptr == NULL)) 45 | { 46 | /* Buffer must remain valid to free. */ 47 | scratch_buffer_init (buffer); 48 | return false; 49 | } 50 | 51 | /* Install new heap-based buffer. */ 52 | buffer->data = new_ptr; 53 | buffer->length = new_length; 54 | return true; 55 | } 56 | libc_hidden_def (__libc_scratch_buffer_grow) 57 | -------------------------------------------------------------------------------- /common/m4/lib/same-inode.h: -------------------------------------------------------------------------------- 1 | /* Determine whether two stat buffers are known to refer to the same file. 2 | 3 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef SAME_INODE_H 19 | # define SAME_INODE_H 1 20 | 21 | # include 22 | 23 | # if defined __VMS && __CRTL_VER < 80200000 24 | # define SAME_INODE(a, b) \ 25 | ((a).st_ino[0] == (b).st_ino[0] \ 26 | && (a).st_ino[1] == (b).st_ino[1] \ 27 | && (a).st_ino[2] == (b).st_ino[2] \ 28 | && (a).st_dev == (b).st_dev) 29 | # elif defined _WIN32 && ! defined __CYGWIN__ 30 | /* Native Windows. */ 31 | # if _GL_WINDOWS_STAT_INODES 32 | /* stat() and fstat() set st_dev and st_ino to 0 if information about 33 | the inode is not available. */ 34 | # define SAME_INODE(a, b) \ 35 | (!((a).st_ino == 0 && (a).st_dev == 0) \ 36 | && (a).st_ino == (b).st_ino && (a).st_dev == (b).st_dev) 37 | # else 38 | /* stat() and fstat() set st_ino to 0 always. */ 39 | # define SAME_INODE(a, b) 0 40 | # endif 41 | # else 42 | # define SAME_INODE(a, b) \ 43 | ((a).st_ino == (b).st_ino \ 44 | && (a).st_dev == (b).st_dev) 45 | # endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /common/misc/integer_length.h: -------------------------------------------------------------------------------- 1 | /* integer_length - find most significant bit in an unsigned integer. 2 | Copyright (C) 2011-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* Written by Bruno Haible , 2011. */ 18 | 19 | #ifndef _INTEGER_LENGTH_H 20 | #define _INTEGER_LENGTH_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* These functions return the minimum number of bits required to represent 27 | the given unsigned integer. 28 | For non-zero values, this is the position of the most significant bit 29 | that is set, plus one. For zero, it is 0. */ 30 | 31 | /* Returns the integer length of x. 32 | The result is >= 0, <= sizeof (unsigned int) * CHAR_BIT. */ 33 | extern int integer_length (unsigned int x); 34 | 35 | /* Returns the integer length of x. 36 | The result is >= 0, <= sizeof (unsigned long) * CHAR_BIT. */ 37 | extern int integer_length_l (unsigned long x); 38 | 39 | /* Returns the integer length of x. 40 | The result is >= 0, <= sizeof (unsigned long long) * CHAR_BIT. */ 41 | extern int integer_length_ll (unsigned long long x); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* _INTEGER_LENGTH_H */ 48 | -------------------------------------------------------------------------------- /common/misc/concat-filename.h: -------------------------------------------------------------------------------- 1 | /* Construct a full filename from a directory and a relative filename. 2 | Copyright (C) 2001-2004, 2007-2021 Free Software Foundation, Inc. 3 | 4 | This file is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation; either version 2.1 of the 7 | License, or (at your option) any later version. 8 | 9 | This file is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _CONCAT_FILENAME_H 18 | #define _CONCAT_FILENAME_H 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | /* Concatenate a directory filename, a relative filename and an optional 28 | suffix. Return a freshly allocated filename. Return NULL and set errno 29 | upon memory allocation failure. */ 30 | extern char *concatenated_filename (const char *directory, 31 | const char *filename, const char *suffix) 32 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; 33 | 34 | /* Concatenate a directory filename, a relative filename and an optional 35 | suffix. Return a freshly allocated filename. */ 36 | extern char *xconcatenated_filename (const char *directory, 37 | const char *filename, const char *suffix) 38 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE 39 | _GL_ATTRIBUTE_RETURNS_NONNULL; 40 | 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _CONCAT_FILENAME_H */ 47 | -------------------------------------------------------------------------------- /common/m4/lib/hash-triple-simple.c: -------------------------------------------------------------------------------- 1 | /* Hash functions for file-related triples: name, device, inode. 2 | Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* written by Jim Meyering */ 18 | 19 | #include 20 | 21 | /* Specification. */ 22 | #include "hash-triple.h" 23 | 24 | #include 25 | #include 26 | 27 | #include "hash-pjw.h" 28 | #include "same-inode.h" 29 | 30 | #define STREQ(a, b) (strcmp (a, b) == 0) 31 | 32 | /* Hash an F_triple, and *do* consider the file name. */ 33 | size_t 34 | triple_hash (void const *x, size_t table_size) 35 | { 36 | struct F_triple const *p = x; 37 | size_t tmp = hash_pjw (p->name, table_size); 38 | 39 | /* Ignoring the device number here should be fine. */ 40 | return (tmp ^ p->st_ino) % table_size; 41 | } 42 | 43 | /* Compare two F_triple structs. */ 44 | bool 45 | triple_compare_ino_str (void const *x, void const *y) 46 | { 47 | struct F_triple const *a = x; 48 | struct F_triple const *b = y; 49 | return (SAME_INODE (*a, *b) && STREQ (a->name, b->name)) ? true : false; 50 | } 51 | 52 | /* Free an F_triple. */ 53 | void 54 | triple_free (void *x) 55 | { 56 | struct F_triple *a = x; 57 | free (a->name); 58 | free (a); 59 | } 60 | -------------------------------------------------------------------------------- /common/m4/lib/gl_anylinked_list1.h: -------------------------------------------------------------------------------- 1 | /* Sequential list data type implemented by a linked list. 2 | Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ 19 | 20 | /* -------------------------- gl_list_t Data Type -------------------------- */ 21 | 22 | /* Concrete list node implementation, valid for this file only. */ 23 | struct gl_list_node_impl 24 | { 25 | #if WITH_HASHTABLE 26 | struct gl_hash_entry h; /* hash table entry fields; must be first */ 27 | #endif 28 | struct gl_list_node_impl *next; 29 | struct gl_list_node_impl *prev; 30 | const void *value; 31 | }; 32 | 33 | /* Concrete gl_list_impl type, valid for this file only. */ 34 | struct gl_list_impl 35 | { 36 | struct gl_list_impl_base base; 37 | #if WITH_HASHTABLE 38 | /* A hash table: managed as an array of collision lists. */ 39 | struct gl_hash_entry **table; 40 | size_t table_size; 41 | #endif 42 | /* A circular list anchored at root. 43 | The first node is = root.next, the last node is = root.prev. 44 | The root's value is unused. */ 45 | struct gl_list_node_impl root; 46 | /* Number of list nodes, excluding the root. */ 47 | size_t count; 48 | }; 49 | -------------------------------------------------------------------------------- /flex/src/COPYING: -------------------------------------------------------------------------------- 1 | Flex carries the copyright used for BSD software, slightly modified 2 | because it originated at the Lawrence Berkeley (not Livermore!) Laboratory, 3 | which operates under a contract with the Department of Energy: 4 | 5 | Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The Flex Project. 6 | 7 | Copyright (c) 1990, 1997 The Regents of the University of California. 8 | All rights reserved. 9 | 10 | This code is derived from software contributed to Berkeley by 11 | Vern Paxson. 12 | 13 | The United States Government has rights in this work pursuant 14 | to contract no. DE-AC03-76SF00098 between the United States 15 | Department of Energy and the University of California. 16 | 17 | Redistribution and use in source and binary forms, with or without 18 | modification, are permitted provided that the following conditions 19 | are met: 20 | 21 | 1. Redistributions of source code must retain the above copyright 22 | notice, this list of conditions and the following disclaimer. 23 | 2. Redistributions in binary form must reproduce the above copyright 24 | notice, this list of conditions and the following disclaimer in the 25 | documentation and/or other materials provided with the distribution. 26 | 27 | Neither the name of the University nor the names of its contributors 28 | may be used to endorse or promote products derived from this software 29 | without specific prior written permission. 30 | 31 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 32 | IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 33 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 34 | PURPOSE. 35 | 36 | This basically says "do whatever you please with this software except 37 | remove this notice or take advantage of the University's (or the flex 38 | authors') name". 39 | 40 | Note that the "flex.skl" scanner skeleton carries no copyright notice. 41 | You are free to do whatever you please with scanners generated using flex; 42 | for them, you are not even bound by the above copyright. 43 | -------------------------------------------------------------------------------- /bison/src/conflicts.h: -------------------------------------------------------------------------------- 1 | /* Find and resolve or report lookahead conflicts for bison, 2 | 3 | Copyright (C) 2000-2002, 2004, 2007, 2009-2015, 2018-2021 Free 4 | Software Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef CONFLICTS_H_ 22 | # define CONFLICTS_H_ 23 | # include "state.h" 24 | 25 | void conflicts_solve (void); 26 | 27 | /** 28 | * Update state numbers recorded in internal arrays such that: 29 | * - \c nstates_old is the old number of states. 30 | * - Where \c i is the old state number, old_to_new[i] is either: 31 | * - \c nstates_old if state \c i is removed because it is unreachable. 32 | * - The new state number. 33 | * - The highest new state number is the number of remaining states - 1. 34 | * - The numerical order of the remaining states has not changed. 35 | */ 36 | void conflicts_update_state_numbers (state_number old_to_new[], 37 | state_number nstates_old); 38 | 39 | void conflicts_print (void); 40 | int conflicts_total_count (void); 41 | void conflicts_output (FILE *out); 42 | void conflicts_free (void); 43 | 44 | bool has_conflicts (const state *s); 45 | 46 | /* Were there conflicts? */ 47 | extern int expected_sr_conflicts; 48 | extern int expected_rr_conflicts; 49 | 50 | #endif /* !CONFLICTS_H_ */ 51 | -------------------------------------------------------------------------------- /bison/src/closure.h: -------------------------------------------------------------------------------- 1 | /* Subroutines for bison 2 | 3 | Copyright (C) 1984, 1989, 2000-2002, 2007, 2009-2015, 2018-2021 Free 4 | Software Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | #ifndef CLOSURE_H_ 22 | # define CLOSURE_H_ 23 | 24 | # include "gram.h" 25 | 26 | /* Allocates the itemset and ruleset vectors, and precomputes useful 27 | data so that closure can be called. n is the number of elements to 28 | allocate for itemset. */ 29 | 30 | void closure_new (int n); 31 | 32 | 33 | /* Given the kernel (aka core) of a state (a sorted vector of item indices 34 | ITEMS, of length N), set up RULESET and ITEMSET to indicate what 35 | rules could be run and which items could be accepted when those 36 | items are the active ones. */ 37 | 38 | void closure (item_index const *items, size_t n); 39 | 40 | 41 | /* Free ITEMSET, RULESET and internal data. */ 42 | 43 | void closure_free (void); 44 | 45 | 46 | /* ITEMSET is a sorted vector of item indices; NITEMSET is its size 47 | (actually, points to just beyond the end of the part of it that is 48 | significant). CLOSURE places there the indices of all items which 49 | represent units of input that could arrive next. */ 50 | 51 | extern item_index *itemset; 52 | extern size_t nitemset; 53 | 54 | #endif /* !CLOSURE_H_ */ 55 | -------------------------------------------------------------------------------- /common/misc/quote.h: -------------------------------------------------------------------------------- 1 | /* quote.h - prototypes for quote.c 2 | 3 | Copyright (C) 1998-2001, 2003, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef QUOTE_H_ 19 | # define QUOTE_H_ 1 20 | 21 | # include 22 | 23 | /* The quoting options used by quote_n and quote. Its type is incomplete, 24 | so it's useful only in expressions like '"e_quoting_options'. */ 25 | extern struct quoting_options quote_quoting_options; 26 | 27 | /* Return an unambiguous printable representation of ARG (of size 28 | ARGSIZE), allocated in slot N, suitable for diagnostics. If 29 | ARGSIZE is SIZE_MAX, use the string length of the argument for 30 | ARGSIZE. */ 31 | char const *quote_n_mem (int n, char const *arg, size_t argsize); 32 | 33 | /* Return an unambiguous printable representation of ARG (of size 34 | ARGSIZE), suitable for diagnostics. If ARGSIZE is SIZE_MAX, use 35 | the string length of the argument for ARGSIZE. */ 36 | char const *quote_mem (char const *arg, size_t argsize); 37 | 38 | /* Return an unambiguous printable representation of ARG, allocated in 39 | slot N, suitable for diagnostics. */ 40 | char const *quote_n (int n, char const *arg); 41 | 42 | /* Return an unambiguous printable representation of ARG, suitable for 43 | diagnostics. */ 44 | char const *quote (char const *arg); 45 | 46 | #endif /* !QUOTE_H_ */ 47 | -------------------------------------------------------------------------------- /common/m4/lib/mkstemp-safer.c: -------------------------------------------------------------------------------- 1 | /* Invoke mkstemp, but avoid some glitches. 2 | 3 | Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | 22 | #include "stdlib-safer.h" 23 | 24 | #include 25 | #include "unistd-safer.h" 26 | 27 | /* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or 28 | STDERR_FILENO. */ 29 | 30 | extern int mkstemp (char *xtemplate); 31 | 32 | int 33 | mkstemp_safer (char *templ) 34 | { 35 | return fd_safer (mkstemp (templ)); 36 | } 37 | 38 | #if GNULIB_MKOSTEMP 39 | /* Like mkostemp, but do not return STDIN_FILENO, STDOUT_FILENO, or 40 | STDERR_FILENO. */ 41 | int 42 | mkostemp_safer (char *templ, int flags) 43 | { 44 | return fd_safer_flag (mkostemp (templ, flags), flags); 45 | } 46 | #endif 47 | 48 | #if GNULIB_MKOSTEMPS 49 | /* Like mkostemps, but do not return STDIN_FILENO, STDOUT_FILENO, or 50 | STDERR_FILENO. */ 51 | int 52 | mkostemps_safer (char *templ, int suffixlen, int flags) 53 | { 54 | return fd_safer_flag (mkostemps (templ, suffixlen, flags), flags); 55 | } 56 | #endif 57 | 58 | #if GNULIB_MKSTEMPS 59 | /* Like mkstemps, but do not return STDIN_FILENO, STDOUT_FILENO, or 60 | STDERR_FILENO. */ 61 | int mkstemps_safer (char *templ, int suffixlen) 62 | { 63 | return fd_safer (mkstemps (templ, suffixlen)); 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /bison/src/strversion.c: -------------------------------------------------------------------------------- 1 | /* Convert version string to int. 2 | 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #include 21 | #include "system.h" 22 | 23 | #include "strversion.h" 24 | 25 | #include 26 | #include 27 | 28 | int 29 | strversion_to_int (char const *version) 30 | { 31 | IGNORE_TYPE_LIMITS_BEGIN 32 | int res = 0; 33 | errno = 0; 34 | char *cp = NULL; 35 | 36 | { 37 | long major = strtol (version, &cp, 10); 38 | if (errno || cp == version || *cp != '.' || major < 0 39 | || INT_MULTIPLY_WRAPV (major, 10000, &res)) 40 | return -1; 41 | } 42 | 43 | { 44 | ++cp; 45 | char *prev = cp; 46 | long minor = strtol (cp, &cp, 10); 47 | if (errno || cp == prev || (*cp != '\0' && *cp != '.') 48 | || ! (0 <= minor && minor < 100) 49 | || INT_MULTIPLY_WRAPV (minor, 100, &minor) 50 | || INT_ADD_WRAPV (minor, res, &res)) 51 | return -1; 52 | } 53 | 54 | if (*cp == '.') 55 | { 56 | ++cp; 57 | char *prev = cp; 58 | long micro = strtol (cp, &cp, 10); 59 | if (errno || cp == prev || (*cp != '\0' && *cp != '.') 60 | || ! (0 <= micro && micro < 100) 61 | || INT_ADD_WRAPV (micro, res, &res)) 62 | return -1; 63 | } 64 | 65 | IGNORE_TYPE_LIMITS_END 66 | return res; 67 | } 68 | -------------------------------------------------------------------------------- /bison/src/relation.h: -------------------------------------------------------------------------------- 1 | /* Binary relations. 2 | 3 | Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is part of Bison, the GNU Compiler Compiler. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . */ 20 | 21 | 22 | #ifndef RELATION_H_ 23 | # define RELATION_H_ 24 | 25 | /* Performing operations on graphs coded as list of adjacency. 26 | 27 | If GRAPH is a relation, then GRAPH[Node] is a list of adjacent 28 | nodes, ended with END_NODE. */ 29 | 30 | # define END_NODE ((relation_node) -1) 31 | 32 | typedef size_t relation_node; 33 | typedef relation_node *relation_nodes; 34 | typedef relation_nodes *relation; 35 | 36 | typedef void (relation_node_print) (relation_node node, FILE* out); 37 | 38 | /* Report a relation R that has SIZE vertices. */ 39 | void relation_print (const char *title, 40 | relation r, size_t size, 41 | relation_node_print print, FILE *out); 42 | 43 | /* Compute the transitive closure of the FUNCTION on the relation R 44 | with SIZE vertices. 45 | 46 | If R (NODE1, NODE2) then on exit FUNCTION[NODE1] was extended 47 | (unioned) with FUNCTION[NODE2]. 48 | 49 | FUNCTION is in-out, R is read only. */ 50 | void relation_digraph (const relation r, relation_node size, bitsetv function); 51 | 52 | /* Destructively transpose *R_ARG, of size SIZE. */ 53 | void relation_transpose (relation *R_arg, relation_node size); 54 | 55 | #endif /* ! RELATION_H_ */ 56 | -------------------------------------------------------------------------------- /bison/data/bison-default.css: -------------------------------------------------------------------------------- 1 | /* Default styling rules for Bison when doing terminal output. 2 | Copyright (C) 2019-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | /* This is an experimental feature. The class names may change in the 18 | future. */ 19 | 20 | /* Diagnostics. */ 21 | .warning { color: purple; } 22 | .error { color: red; } 23 | .note { color: cyan; } 24 | 25 | .fixit-insert { color: green; } 26 | 27 | /* Semantic values in Bison's own parser traces. */ 28 | .value { color: green; } 29 | 30 | /* "Sections" in traces (--trace). */ 31 | .trace0 { color: green; } 32 | 33 | /* Syntax error messages. */ 34 | .expected { color: green; } 35 | .unexpected { color: red; } 36 | 37 | 38 | /* Counterexamples. */ 39 | 40 | /* Cex: point in rule. */ 41 | .cex-dot { color: red; } 42 | 43 | /* Cex: coloring various rules. */ 44 | .cex-0 { color: yellow; } 45 | .cex-1 { color: green; } 46 | .cex-2 { color: blue; } 47 | .cex-3 { color: purple; } 48 | .cex-4 { color: violet; } 49 | .cex-5 { color: orange; } 50 | .cex-6 { color: brown; } 51 | .cex-7 { color: mauve; } 52 | .cex-8 { color: #013220; } /* Dark green. */ 53 | .cex-9 { color: #e75480; } /* Dark pink. */ 54 | .cex-10 { color: cyan; } 55 | .cex-11 { color: orange; } 56 | 57 | /* Cex: derivation rewriting steps. */ 58 | .cex-step { font-style: italic; } 59 | 60 | /* Cex: leaves of a derivation. */ 61 | .cex-leaf { font-weight: 600; } 62 | -------------------------------------------------------------------------------- /common/m4/lib/canonicalize.h: -------------------------------------------------------------------------------- 1 | /* Return the canonical absolute name of a given file. 2 | Copyright (C) 1996-2007, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef CANONICALIZE_H_ 18 | # define CANONICALIZE_H_ 19 | 20 | #include /* for canonicalize_file_name */ 21 | 22 | #define CAN_MODE_MASK (CAN_EXISTING | CAN_ALL_BUT_LAST | CAN_MISSING) 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | enum canonicalize_mode_t 29 | { 30 | /* All components must exist. */ 31 | CAN_EXISTING = 0, 32 | 33 | /* All components excluding last one must exist. */ 34 | CAN_ALL_BUT_LAST = 1, 35 | 36 | /* No requirements on components existence. */ 37 | CAN_MISSING = 2, 38 | 39 | /* Don't expand symlinks. */ 40 | CAN_NOLINKS = 4 41 | }; 42 | typedef enum canonicalize_mode_t canonicalize_mode_t; 43 | 44 | /* Return the canonical absolute name of file NAME, while treating 45 | missing elements according to CAN_MODE. A canonical name 46 | does not contain any `.', `..' components nor any repeated file name 47 | separators ('/') or, depending on other CAN_MODE flags, symlinks. 48 | Whether components must exist or not depends on canonicalize mode. 49 | The result is malloc'd. 50 | Upon failure, return NULL with errno set. */ 51 | char *canonicalize_filename_mode (const char *, canonicalize_mode_t); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* !CANONICALIZE_H_ */ 58 | -------------------------------------------------------------------------------- /common/m4/lib/clean-temp-simple.h: -------------------------------------------------------------------------------- 1 | /* Temporary files with automatic cleanup. 2 | Copyright (C) 2006-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2006. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _CLEAN_TEMP_SIMPLE_H 19 | #define _CLEAN_TEMP_SIMPLE_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | 28 | /* See clean-temp.h for a general discussion of this module. */ 29 | 30 | /* Register the given ABSOLUTE_FILE_NAME as being a file that needs to be 31 | removed. 32 | Should be called before the file ABSOLUTE_FILE_NAME is created. 33 | Return 0 upon success, or -1 if there was a memory allocation problem. */ 34 | extern int register_temporary_file (const char *absolute_file_name); 35 | 36 | /* Unregister the given ABSOLUTE_FILE_NAME as being a file that needs to be 37 | removed. 38 | Should be called when the file ABSOLUTE_FILE_NAME could not be created. */ 39 | extern void unregister_temporary_file (const char *absolute_file_name); 40 | 41 | /* Remove the given ABSOLUTE_FILE_NAME and unregister it. 42 | CLEANUP_VERBOSE determines whether errors are reported to standard error. 43 | Return 0 upon success, or -1 if there was some problem. */ 44 | extern int cleanup_temporary_file (const char *absolute_file_name, 45 | bool cleanup_verbose); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* _CLEAN_TEMP_SIMPLE_H */ 53 | -------------------------------------------------------------------------------- /common/m4/lib/xprintf.h: -------------------------------------------------------------------------------- 1 | /* printf wrappers that fail immediately for non-file-related errors 2 | Copyright (C) 2007-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _XPRINTF_H 18 | #define _XPRINTF_H 19 | 20 | #include 21 | #include 22 | 23 | extern int xprintf (char const *restrict format, ...) 24 | #if GNULIB_VPRINTF_POSIX 25 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2)) 26 | #else 27 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 2)) 28 | #endif 29 | ; 30 | 31 | extern int xvprintf (char const *restrict format, va_list args) 32 | #if GNULIB_VPRINTF_POSIX 33 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0)) 34 | #else 35 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 1, 0)) 36 | #endif 37 | ; 38 | 39 | extern int xfprintf (FILE *restrict stream, char const *restrict format, ...) 40 | #if GNULIB_VFPRINTF_POSIX 41 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 3)) 42 | #else 43 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 3)) 44 | #endif 45 | ; 46 | 47 | extern int xvfprintf (FILE *restrict stream, char const *restrict format, 48 | va_list args) 49 | #if GNULIB_VFPRINTF_POSIX 50 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 2, 0)) 51 | #else 52 | _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 2, 0)) 53 | #endif 54 | ; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /common/misc/mbswidth.h: -------------------------------------------------------------------------------- 1 | /* Determine the number of screen columns needed for a string. 2 | Copyright (C) 2000-2004, 2007, 2009-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #include 18 | 19 | /* Avoid a clash of our mbswidth() with a function of the same name defined 20 | in UnixWare 7.1.1 . We need this #include before the #define 21 | below. */ 22 | #if HAVE_DECL_MBSWIDTH_IN_WCHAR_H 23 | # include 24 | #endif 25 | 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | /* Optional flags to influence mbswidth/mbsnwidth behavior. */ 33 | 34 | /* If this bit is set, return -1 upon finding an invalid or incomplete 35 | character. Otherwise, assume invalid characters have width 1. */ 36 | #define MBSW_REJECT_INVALID 1 37 | 38 | /* If this bit is set, return -1 upon finding a non-printable character. 39 | Otherwise, assume unprintable characters have width 0 if they are 40 | control characters and 1 otherwise. */ 41 | #define MBSW_REJECT_UNPRINTABLE 2 42 | 43 | 44 | /* Returns the number of screen columns needed for STRING. */ 45 | #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ 46 | extern int mbswidth (const char *string, int flags); 47 | 48 | /* Returns the number of screen columns needed for the NBYTES bytes 49 | starting at BUF. */ 50 | extern int mbsnwidth (const char *buf, size_t nbytes, int flags); 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /common/misc/basename-lgpl.c: -------------------------------------------------------------------------------- 1 | /* basename.c -- return the last element in a file name 2 | 3 | Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 Free Software 4 | Foundation, Inc. 5 | 6 | This file is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as 8 | published by the Free Software Foundation; either version 2.1 of the 9 | License, or (at your option) any later version. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with this program. If not, see . */ 18 | 19 | #include 20 | 21 | /* Specification. */ 22 | #include "basename-lgpl.h" 23 | 24 | #include 25 | #include 26 | 27 | #include "filename.h" 28 | 29 | char * 30 | last_component (char const *name) 31 | { 32 | char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); 33 | char const *p; 34 | bool last_was_slash = false; 35 | 36 | while (ISSLASH (*base)) 37 | base++; 38 | 39 | for (p = base; *p; p++) 40 | { 41 | if (ISSLASH (*p)) 42 | last_was_slash = true; 43 | else if (last_was_slash) 44 | { 45 | base = p; 46 | last_was_slash = false; 47 | } 48 | } 49 | 50 | return (char *) base; 51 | } 52 | 53 | size_t 54 | base_len (char const *name) 55 | { 56 | size_t len; 57 | size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); 58 | 59 | for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) 60 | continue; 61 | 62 | if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 63 | && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) 64 | return 2; 65 | 66 | if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len 67 | && len == prefix_len && ISSLASH (name[prefix_len])) 68 | return prefix_len + 1; 69 | 70 | return len; 71 | } 72 | -------------------------------------------------------------------------------- /custom_build_rules/win_flex_bison/win_flex_bison_custom_build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | Midl 6 | CustomBuild 7 | 8 | 9 | _SelectedFiles;$(BisonDependsOn) 11 | 12 | 13 | 14 | %(Filename).tab.cpp 15 | %(Filename).tab.h 16 | 17 | start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" 18 | exit /b %errorlevel% 19 | %(RootDir)%(Directory)%(OutputFile);%(RootDir)%(Directory)%(DefinesFile); 20 | Process "%(Filename)%(Extension)" bison file 21 | 22 | 23 | 25 | Midl 26 | CustomBuild 27 | 28 | 29 | _SelectedFiles;$(FlexDependsOn) 31 | 32 | 33 | 34 | %(Filename).flex.cpp 35 | true 36 | 37 | start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" 38 | exit /b %errorlevel% 39 | %(RootDir)%(Directory)%(OutputFile); 40 | Process "%(Filename)%(Extension)" flex file 41 | 42 | 43 | -------------------------------------------------------------------------------- /common/m4/lib/malloc/scratch_buffer_set_array_size.c: -------------------------------------------------------------------------------- 1 | /* Variable-sized buffer with on-stack default allocation. 2 | Copyright (C) 2015-2021 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public 16 | License along with the GNU C Library; if not, see 17 | . */ 18 | 19 | #ifndef _LIBC 20 | # include 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | bool 28 | __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer, 29 | size_t nelem, size_t size) 30 | { 31 | size_t new_length = nelem * size; 32 | 33 | /* Avoid overflow check if both values are small. */ 34 | if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0 35 | && nelem != 0 && size != new_length / nelem) 36 | { 37 | /* Overflow. Discard the old buffer, but it must remain valid 38 | to free. */ 39 | scratch_buffer_free (buffer); 40 | scratch_buffer_init (buffer); 41 | __set_errno (ENOMEM); 42 | return false; 43 | } 44 | 45 | if (new_length <= buffer->length) 46 | return true; 47 | 48 | /* Discard old buffer. */ 49 | scratch_buffer_free (buffer); 50 | 51 | char *new_ptr = malloc (new_length); 52 | if (new_ptr == NULL) 53 | { 54 | /* Buffer must remain valid to free. */ 55 | scratch_buffer_init (buffer); 56 | return false; 57 | } 58 | 59 | /* Install new heap-based buffer. */ 60 | buffer->data = new_ptr; 61 | buffer->length = new_length; 62 | return true; 63 | } 64 | libc_hidden_def (__libc_scratch_buffer_set_array_size) 65 | -------------------------------------------------------------------------------- /bison/src/lssi.h: -------------------------------------------------------------------------------- 1 | /* Lookahead sensitive state item searches for counterexample generation 2 | 3 | Copyright (C) 2020-2021 Free Software Foundation, Inc. 4 | 5 | This file is part of Bison, the GNU Compiler Compiler. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef LSSI_H 21 | # define LSSI_H 22 | 23 | # include "state-item.h" 24 | 25 | /* 26 | All state-item graph nodes should also include a precise follow set (follow_L). 27 | However, ignoring follow_L saves a lot of memory and is a pretty good approximation. 28 | These functions exist to enforce restrictions caused by follow_L sets. 29 | */ 30 | 31 | /* 32 | * find shortest lookahead-sensitive path of state-items to target such that 33 | * next_sym is in the follow_L set of target in that position. 34 | */ 35 | state_item_list shortest_path_from_start (state_item_number target, 36 | symbol_number next_sym); 37 | 38 | /** 39 | * Determine if the given terminal is in the given symbol set or can begin 40 | * a nonterminal in the given symbol set. 41 | */ 42 | bool intersect_symbol (symbol_number sym, bitset syms); 43 | 44 | /** 45 | * Determine if any symbol in ts is in syms 46 | * or can begin with a nonterminal in syms. 47 | */ 48 | bool intersect (bitset ts, bitset syms); 49 | 50 | /** 51 | * Compute a set of sequences of state-items that can make production steps 52 | * to this state-item such that the resulting possible lookahead symbols are 53 | * as given. 54 | */ 55 | state_item_list lssi_reverse_production (const state_item *si, bitset lookahead); 56 | 57 | #endif /* LSSI_H */ 58 | -------------------------------------------------------------------------------- /common/m4/lib/progname.h: -------------------------------------------------------------------------------- 1 | /* Program name management. 2 | Copyright (C) 2001-2004, 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2001. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _PROGNAME_H 19 | #define _PROGNAME_H 20 | 21 | /* Programs using this file should do the following in main(): 22 | set_program_name (argv[0]); 23 | */ 24 | 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | 31 | /* String containing name the program is called with. */ 32 | extern const char *program_name; 33 | 34 | /* Set program_name, based on argv[0]. 35 | argv0 must be a string allocated with indefinite extent, and must not be 36 | modified after this call. */ 37 | extern void set_program_name (const char *argv0); 38 | 39 | #if ENABLE_RELOCATABLE 40 | 41 | /* Set program_name, based on argv[0], and original installation prefix and 42 | directory, for relocatability. */ 43 | extern void set_program_name_and_installdir (const char *argv0, 44 | const char *orig_installprefix, 45 | const char *orig_installdir); 46 | #undef set_program_name 47 | #define set_program_name(ARG0) \ 48 | set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) 49 | 50 | /* Return the full pathname of the current executable, based on the earlier 51 | call to set_program_name_and_installdir. Return NULL if unknown. */ 52 | extern char *get_full_program_name (void); 53 | 54 | #endif 55 | 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | 62 | #endif /* _PROGNAME_H */ 63 | -------------------------------------------------------------------------------- /common/misc/progname.h: -------------------------------------------------------------------------------- 1 | /* Program name management. 2 | Copyright (C) 2001-2004, 2006, 2009-2021 Free Software Foundation, Inc. 3 | Written by Bruno Haible , 2001. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef _PROGNAME_H 19 | #define _PROGNAME_H 20 | 21 | /* Programs using this file should do the following in main(): 22 | set_program_name (argv[0]); 23 | */ 24 | 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | 31 | /* String containing name the program is called with. */ 32 | extern const char *program_name; 33 | 34 | /* Set program_name, based on argv[0]. 35 | argv0 must be a string allocated with indefinite extent, and must not be 36 | modified after this call. */ 37 | extern void set_program_name (const char *argv0); 38 | 39 | #if ENABLE_RELOCATABLE 40 | 41 | /* Set program_name, based on argv[0], and original installation prefix and 42 | directory, for relocatability. */ 43 | extern void set_program_name_and_installdir (const char *argv0, 44 | const char *orig_installprefix, 45 | const char *orig_installdir); 46 | #undef set_program_name 47 | #define set_program_name(ARG0) \ 48 | set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) 49 | 50 | /* Return the full pathname of the current executable, based on the earlier 51 | call to set_program_name_and_installdir. Return NULL if unknown. */ 52 | extern char *get_full_program_name (void); 53 | 54 | #endif 55 | 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | 62 | #endif /* _PROGNAME_H */ 63 | -------------------------------------------------------------------------------- /common/misc/fstrcmp.h: -------------------------------------------------------------------------------- 1 | /* Fuzzy string comparison. 2 | Copyright (C) 1995, 2000, 2002-2003, 2006, 2008-2021 Free Software 3 | Foundation, Inc. 4 | 5 | This file was written by Peter Miller 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | #ifndef _FSTRCMP_H 21 | #define _FSTRCMP_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Fuzzy compare of S1 and S2. Return a measure for the similarity of S1 28 | and S1. The higher the result, the more similar the strings are. 29 | The result is bounded between 0 (meaning very dissimilar strings) and 30 | 1 (meaning identical strings). */ 31 | extern double fstrcmp (const char *s1, const char *s2); 32 | 33 | /* Like fstrcmp (S1, S2), except that if the result is < LOWER_BOUND, an 34 | arbitrary other value < LOWER_BOUND can be returned. */ 35 | extern double fstrcmp_bounded (const char *s1, const char *s2, 36 | double lower_bound); 37 | 38 | /* A shortcut for fstrcmp. Avoids a function call. */ 39 | #define fstrcmp(s1,s2) fstrcmp_bounded (s1, s2, 0.0) 40 | 41 | /* Frees the per-thread resources allocated by this module for the current 42 | thread. 43 | You don't need to call this function in threads other than the main thread, 44 | because per-thread resources are reclaimed automatically when the thread 45 | exits. However, per-thread resources allocated by the main thread are 46 | comparable to static allocations; calling this function can be useful to 47 | avoid an error report from valgrind. */ 48 | extern void fstrcmp_free_resources (void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /common/m4/lib/_Noreturn.h: -------------------------------------------------------------------------------- 1 | /* A C macro for declaring that a function does not return. 2 | Copyright (C) 2011-2021 Free Software Foundation, Inc. 3 | 4 | This program is free software: you can redistribute it and/or modify it 5 | under the terms of the GNU General Public License as published 6 | by the Free Software Foundation; either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . */ 16 | 17 | #ifndef _Noreturn 18 | # if (defined __cplusplus \ 19 | && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 20 | || (defined _MSC_VER && 1900 <= _MSC_VER)) \ 21 | && 0) 22 | /* [[noreturn]] is not practically usable, because with it the syntax 23 | extern _Noreturn void func (...); 24 | would not be valid; such a declaration would only be valid with 'extern' 25 | and '_Noreturn' swapped, or without the 'extern' keyword. However, some 26 | AIX system header files and several gnulib header files use precisely 27 | this syntax with 'extern'. */ 28 | # define _Noreturn [[noreturn]] 29 | # elif ((!defined __cplusplus || defined __clang__) \ 30 | && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ 31 | || (!defined __STRICT_ANSI__ \ 32 | && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ 33 | || (defined __apple_build_version__ \ 34 | ? 6000000 <= __apple_build_version__ \ 35 | : 3 < __clang_major__ + (5 <= __clang_minor__)))))) 36 | /* _Noreturn works as-is. */ 37 | # elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ 38 | || 0x5110 <= __SUNPRO_C) 39 | # define _Noreturn __attribute__ ((__noreturn__)) 40 | # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 41 | # define _Noreturn __declspec (noreturn) 42 | # else 43 | # define _Noreturn 44 | # endif 45 | #endif 46 | -------------------------------------------------------------------------------- /common/misc/gethrxtime.c: -------------------------------------------------------------------------------- 1 | /* gethrxtime -- get high resolution real time 2 | 3 | Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . */ 17 | 18 | /* Written by Paul Eggert. */ 19 | 20 | #include 21 | 22 | #define GETHRXTIME_INLINE _GL_EXTERN_INLINE 23 | #include "gethrxtime.h" 24 | 25 | #if ! (HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME) 26 | 27 | //#include 28 | #include "timespec.h" 29 | 30 | /* Get the current time, as a count of the number of nanoseconds since 31 | an arbitrary epoch (e.g., the system boot time). Prefer a 32 | high-resolution clock that is not subject to resetting or 33 | drifting. */ 34 | 35 | xtime_t 36 | gethrxtime (void) 37 | { 38 | # if HAVE_NANOUPTIME 39 | { 40 | struct timespec ts; 41 | nanouptime (&ts); 42 | return xtime_make (ts.tv_sec, ts.tv_nsec); 43 | } 44 | # else 45 | 46 | # if defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME 47 | { 48 | struct timespec ts; 49 | if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0) 50 | return xtime_make (ts.tv_sec, ts.tv_nsec); 51 | } 52 | # endif 53 | 54 | # if HAVE_MICROUPTIME 55 | { 56 | struct timeval tv; 57 | microuptime (&tv); 58 | return xtime_make (tv.tv_sec, 1000 * tv.tv_usec); 59 | } 60 | 61 | # else 62 | /* No monotonically increasing clocks are available; fall back on a 63 | clock that might jump backwards, since it's the best we can do. */ 64 | { 65 | struct timespec ts; 66 | //gettime(&ts); 67 | timespec_get(&ts, TIME_UTC); 68 | return xtime_make (ts.tv_sec, ts.tv_nsec); 69 | } 70 | # endif 71 | # endif 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /common/m4/lib/malloc/scratch_buffer_grow_preserve.c: -------------------------------------------------------------------------------- 1 | /* Variable-sized buffer with on-stack default allocation. 2 | Copyright (C) 2015-2021 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public 16 | License along with the GNU C Library; if not, see 17 | . */ 18 | 19 | #ifndef _LIBC 20 | # include 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | bool 28 | __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer) 29 | { 30 | size_t new_length = 2 * buffer->length; 31 | void *new_ptr; 32 | 33 | if (buffer->data == buffer->__space.__c) 34 | { 35 | /* Move buffer to the heap. No overflow is possible because 36 | buffer->length describes a small buffer on the stack. */ 37 | new_ptr = malloc (new_length); 38 | if (new_ptr == NULL) 39 | return false; 40 | memcpy (new_ptr, buffer->__space.__c, buffer->length); 41 | } 42 | else 43 | { 44 | /* Buffer was already on the heap. Check for overflow. */ 45 | if (__glibc_likely (new_length >= buffer->length)) 46 | new_ptr = realloc (buffer->data, new_length); 47 | else 48 | { 49 | __set_errno (ENOMEM); 50 | new_ptr = NULL; 51 | } 52 | 53 | if (__glibc_unlikely (new_ptr == NULL)) 54 | { 55 | /* Deallocate, but buffer must remain valid to free. */ 56 | free (buffer->data); 57 | scratch_buffer_init (buffer); 58 | return false; 59 | } 60 | } 61 | 62 | /* Install new heap-based buffer. */ 63 | buffer->data = new_ptr; 64 | buffer->length = new_length; 65 | return true; 66 | } 67 | libc_hidden_def (__libc_scratch_buffer_grow_preserve) 68 | -------------------------------------------------------------------------------- /common/misc/pid_tempname.c: -------------------------------------------------------------------------------- 1 | #include "pid_tempname.h" 2 | #include 3 | #include 4 | 5 | char temp_prefix[40]; 6 | 7 | // This adds the unique process id to the built in _tempnam to prevent race condition 8 | // This race condition is more prevalent in Ninja as it parallelizes build and instantiates multiple win_flex/win_bison 9 | // flex_temp_out_main fails frequently as its used for a longer time (compared to temp_file_names), 10 | // hence more possibility to overlap 11 | const char *pid_tempname (const char *prefix) 12 | { 13 | // Here is the race condition: 14 | // 15 | // flex A 16 | // | flex B 17 | // ↓ | 18 | // _tempnam returns ~file_X ↓ 19 | // | _tempnam returns ~file_X 20 | // ↓ | 21 | // freopen ~file_X w+ ↓ 22 | // | freopen ~file_X w+ 23 | // ↓ | 24 | // ... ↓ 25 | // | ... 26 | // ↓ | 27 | // _unlink ~file_X ... <- Fails to print 28 | // ↓ 29 | // _unlink ~file_X <- Fails to delete 30 | // 31 | // It is also possible that ~file_X was deleted before the lagging win_flex is done, which can cause other errors, 32 | // hence changing to non-fatal error upon missing ~file_X on _unlink will not work all the time 33 | // This problem can be prevented with an even more unique temporary file name by adding the current process ID 34 | // Synchronization is not necessary either as there is no reason for the independent processes to wait... 35 | // The reason why this is an issue is because Windows filesystem is reflected immediately, 36 | // unlike inode in Linux that only properly deletes files when their link count is down to zero 37 | sprintf(temp_prefix, "%s%d_", prefix, _getpid()); 38 | return _tempnam(NULL, temp_prefix); 39 | } -------------------------------------------------------------------------------- /common/misc/c-strcase.h: -------------------------------------------------------------------------------- 1 | /* Case-insensitive string comparison functions in C locale. 2 | Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software 3 | Foundation, Inc. 4 | 5 | This file is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as 7 | published by the Free Software Foundation; either version 2.1 of the 8 | License, or (at your option) any later version. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . */ 17 | 18 | #ifndef C_STRCASE_H 19 | #define C_STRCASE_H 20 | 21 | #include 22 | 23 | 24 | /* The functions defined in this file assume the "C" locale and a character 25 | set without diacritics (ASCII-US or EBCDIC-US or something like that). 26 | Even if the "C" locale on a particular system is an extension of the ASCII 27 | character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it 28 | is ISO-8859-1), the functions in this file recognize only the ASCII 29 | characters. More precisely, one of the string arguments must be an ASCII 30 | string; the other one can also contain non-ASCII characters (but then 31 | the comparison result will be nonzero). */ 32 | 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | 39 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or 40 | greater than zero if S1 is lexicographically less than, equal to or greater 41 | than S2. */ 42 | extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE; 43 | 44 | /* Compare no more than N characters of strings S1 and S2, ignoring case, 45 | returning less than, equal to or greater than zero if S1 is 46 | lexicographically less than, equal to or greater than S2. */ 47 | extern int c_strncasecmp (const char *s1, const char *s2, size_t n) 48 | _GL_ATTRIBUTE_PURE; 49 | 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | 56 | #endif /* C_STRCASE_H */ 57 | --------------------------------------------------------------------------------