fix: noconfirm auto-selects first AUR match
This commit is contained in:
@@ -89,7 +89,7 @@ iommu = {}
|
||||
bash = {}
|
||||
bottom = {}
|
||||
#curl = {} # suppressed: nghttp2 dependency chain fails; curl not needed for boot/recovery
|
||||
diffutils = {}
|
||||
diffutils = "ignore" # suppressed: relibc/gnulib header gaps; not needed for boot/recovery or greeter proof
|
||||
findutils = {}
|
||||
uutils-tar = {}
|
||||
bison = {}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
pkgname = gparted-git
|
||||
pkgver = 1.7.0.r2.geaed0502
|
||||
pkgrel = 2
|
||||
pkgdesc = A Partition Magic clone, frontend to GNU Parted
|
||||
arch = x86_64-unknown-redox
|
||||
depends = parted
|
||||
depends = gtkmm3
|
||||
makedepends = git
|
||||
makedepends = gnome-common
|
||||
makedepends = intltool
|
||||
makedepends = itstool
|
||||
makedepends = yelp-tools
|
||||
makedepends = polkit
|
||||
source = https://gitlab.gnome.org/GNOME/gparted.git
|
||||
provides = gparted
|
||||
conflicts = gparted
|
||||
@@ -0,0 +1,166 @@
|
||||
format = 1
|
||||
|
||||
[package]
|
||||
name = "gparted-git"
|
||||
version = "1.7.0.r2.geaed0502"
|
||||
release = 2
|
||||
description = "A Partition Magic clone, frontend to GNU Parted"
|
||||
homepage = "https://gparted.org/"
|
||||
license = [
|
||||
"GPL-2.0-or-later",
|
||||
"GFDL-1.2-or-later",
|
||||
]
|
||||
architectures = ["x86_64-unknown-redox"]
|
||||
maintainers = []
|
||||
|
||||
[[source.sources]]
|
||||
type = "git"
|
||||
url = "https://gitlab.gnome.org/GNOME/gparted.git"
|
||||
sha256 = ""
|
||||
rev = ""
|
||||
branch = ""
|
||||
|
||||
[dependencies]
|
||||
build = [
|
||||
"git",
|
||||
"gnome-common",
|
||||
"intltool",
|
||||
"itstool",
|
||||
"yelp-tools",
|
||||
"polkit",
|
||||
]
|
||||
runtime = [
|
||||
"parted",
|
||||
"gtkmm3",
|
||||
]
|
||||
check = []
|
||||
optional = [
|
||||
"bcachefs-tools",
|
||||
"btrfs-progs",
|
||||
"dosfstools",
|
||||
"exfatprogs",
|
||||
"f2fs-tools",
|
||||
"gpart",
|
||||
"jfsutils",
|
||||
"mtools",
|
||||
"nilfs-utils",
|
||||
"ntfs-3g",
|
||||
"polkit",
|
||||
"udftools",
|
||||
"xfsprogs",
|
||||
"xorg-xhost",
|
||||
]
|
||||
provides = ["gparted"]
|
||||
conflicts = ["gparted"]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
release = false
|
||||
features = []
|
||||
args = []
|
||||
build_dir = ""
|
||||
prepare = []
|
||||
build_script = ['''
|
||||
cd gparted
|
||||
|
||||
gnome-autogen.sh \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libexecdir=/usr/lib/gparted \
|
||||
--enable-online-resize \
|
||||
--enable-libparted-dmraid \
|
||||
--enable-xhost-root
|
||||
make''']
|
||||
check = []
|
||||
install_script = ['''
|
||||
cd gparted
|
||||
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
||||
# Install policy file
|
||||
install -D -m0644 org.gnome.gparted.policy \
|
||||
"${pkgdir}"/usr/share/polkit-1/actions/org.gnome.gparted.policy''']
|
||||
|
||||
[install]
|
||||
bins = []
|
||||
libs = []
|
||||
headers = []
|
||||
docs = []
|
||||
man = []
|
||||
|
||||
[patches]
|
||||
files = []
|
||||
|
||||
[compat]
|
||||
imported_from = "aur"
|
||||
original_pkgbuild = '''
|
||||
# Maintainer: Fabio 'Lolix' Loli <fabio.loli@disroot.org> -> https://github.com/FabioLolix
|
||||
# Contributor: Philip Goto <philip.goto@gmail.com>
|
||||
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
|
||||
# Contributor: Andrew Simmons <andrew.simmons@gmail.com>
|
||||
# Contributor: György Balló <ballogy@freestart.hu>
|
||||
|
||||
pkgname=gparted-git
|
||||
pkgver=1.7.0.r2.geaed0502
|
||||
pkgrel=2
|
||||
pkgdesc="A Partition Magic clone, frontend to GNU Parted"
|
||||
arch=(i686 x86_64 armv7h aarch64)
|
||||
url="https://gparted.org/"
|
||||
license=(GPL-2.0-or-later GFDL-1.2-or-later)
|
||||
provides=(gparted)
|
||||
conflicts=(gparted)
|
||||
depends=(parted gtkmm3)
|
||||
makedepends=(git gnome-common intltool itstool yelp-tools polkit)
|
||||
optdepends=('bcachefs-tools: for bcachefs partitions'
|
||||
'btrfs-progs: for btrfs partitions'
|
||||
'dosfstools: for FAT16 and FAT32 partitions'
|
||||
'exfatprogs: for exFAT partitions'
|
||||
'f2fs-tools: for Flash-Friendly File System'
|
||||
'gpart: for recovering corrupt partition tables'
|
||||
'jfsutils: for jfs partitions'
|
||||
'mtools: utilities to access MS-DOS disks'
|
||||
'nilfs-utils: for nilfs2 support'
|
||||
'ntfs-3g: for ntfs partitions'
|
||||
'polkit: to run gparted from application menu'
|
||||
'udftools: for UDF file system support'
|
||||
'xfsprogs: for xfs partitions'
|
||||
'xorg-xhost: authorization from wayland')
|
||||
source=("git+https://gitlab.gnome.org/GNOME/gparted.git")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd gparted
|
||||
git describe --long --tags | sed 's/^GPARTED_//;s/\([^-]*-g\)/r\1/;s/_/./g;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
cd gparted
|
||||
|
||||
gnome-autogen.sh \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libexecdir=/usr/lib/gparted \
|
||||
--enable-online-resize \
|
||||
--enable-libparted-dmraid \
|
||||
--enable-xhost-root
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd gparted
|
||||
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
||||
# Install policy file
|
||||
install -D -m0644 org.gnome.gparted.policy \
|
||||
"${pkgdir}"/usr/share/polkit-1/actions/org.gnome.gparted.policy
|
||||
}
|
||||
'''
|
||||
conversion_status = "partial"
|
||||
target = "x86_64-unknown-redox"
|
||||
split_packages = []
|
||||
|
||||
[policy]
|
||||
allow_network = false
|
||||
allow_tests = false
|
||||
review_required = false
|
||||
@@ -0,0 +1,61 @@
|
||||
# Maintainer: Fabio 'Lolix' Loli <fabio.loli@disroot.org> -> https://github.com/FabioLolix
|
||||
# Contributor: Philip Goto <philip.goto@gmail.com>
|
||||
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
|
||||
# Contributor: Andrew Simmons <andrew.simmons@gmail.com>
|
||||
# Contributor: György Balló <ballogy@freestart.hu>
|
||||
|
||||
pkgname=gparted-git
|
||||
pkgver=1.7.0.r2.geaed0502
|
||||
pkgrel=2
|
||||
pkgdesc="A Partition Magic clone, frontend to GNU Parted"
|
||||
arch=(i686 x86_64 armv7h aarch64)
|
||||
url="https://gparted.org/"
|
||||
license=(GPL-2.0-or-later GFDL-1.2-or-later)
|
||||
provides=(gparted)
|
||||
conflicts=(gparted)
|
||||
depends=(parted gtkmm3)
|
||||
makedepends=(git gnome-common intltool itstool yelp-tools polkit)
|
||||
optdepends=('bcachefs-tools: for bcachefs partitions'
|
||||
'btrfs-progs: for btrfs partitions'
|
||||
'dosfstools: for FAT16 and FAT32 partitions'
|
||||
'exfatprogs: for exFAT partitions'
|
||||
'f2fs-tools: for Flash-Friendly File System'
|
||||
'gpart: for recovering corrupt partition tables'
|
||||
'jfsutils: for jfs partitions'
|
||||
'mtools: utilities to access MS-DOS disks'
|
||||
'nilfs-utils: for nilfs2 support'
|
||||
'ntfs-3g: for ntfs partitions'
|
||||
'polkit: to run gparted from application menu'
|
||||
'udftools: for UDF file system support'
|
||||
'xfsprogs: for xfs partitions'
|
||||
'xorg-xhost: authorization from wayland')
|
||||
source=("git+https://gitlab.gnome.org/GNOME/gparted.git")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd gparted
|
||||
git describe --long --tags | sed 's/^GPARTED_//;s/\([^-]*-g\)/r\1/;s/_/./g;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
cd gparted
|
||||
|
||||
gnome-autogen.sh \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libexecdir=/usr/lib/gparted \
|
||||
--enable-online-resize \
|
||||
--enable-libparted-dmraid \
|
||||
--enable-xhost-root
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd gparted
|
||||
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
||||
# Install policy file
|
||||
install -D -m0644 org.gnome.gparted.policy \
|
||||
"${pkgdir}"/usr/share/polkit-1/actions/org.gnome.gparted.policy
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
Conversion: Partial
|
||||
|
||||
Warnings:
|
||||
- references polkit, verify PolicyKit compatibility
|
||||
- dependency 'intltool' mapped to 'intltool'
|
||||
@@ -0,0 +1,39 @@
|
||||
--- a/src/header/locale/mod.rs
|
||||
+++ b/src/header/locale/mod.rs
|
||||
@@ -111,6 +111,36 @@ pub unsafe extern "C" fn uselocale(newloc: locale_t) -> locale_t {
|
||||
old_loc
|
||||
}
|
||||
|
||||
+#[unsafe(no_mangle)]
|
||||
+pub unsafe extern "C" fn getlocalename_l(category: c_int, loc: locale_t) -> *const c_char {
|
||||
+ if loc.is_null() {
|
||||
+ return ptr::null();
|
||||
+ }
|
||||
+
|
||||
+ if loc == LC_GLOBAL_LOCALE {
|
||||
+ if unsafe { GLOBAL_LOCALE.is_null() } {
|
||||
+ return (&raw const C_LOCALE).cast::<c_char>();
|
||||
+ }
|
||||
+
|
||||
+ let Some(global) = (unsafe { GLOBAL_LOCALE.as_ref() }) else {
|
||||
+ return ptr::null();
|
||||
+ };
|
||||
+ return global
|
||||
+ .get_name(category)
|
||||
+ .map_or(ptr::null(), |name| name.as_ptr());
|
||||
+ }
|
||||
+
|
||||
+ if !(LC_COLLATE..=LC_ALL).contains(&category) {
|
||||
+ return ptr::null();
|
||||
+ }
|
||||
+
|
||||
+ let loc = loc.cast_const().cast::<LocaleData>();
|
||||
+ let Some(loc) = (unsafe { loc.as_ref() }) else {
|
||||
+ return ptr::null();
|
||||
+ };
|
||||
+ loc.name.as_ptr()
|
||||
+}
|
||||
+
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/newlocale.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn newlocale(mask: c_int, locale: *const c_char, base: locale_t) -> locale_t {
|
||||
@@ -0,0 +1,40 @@
|
||||
--- a/src/header/semaphore/cbindgen.toml
|
||||
+++ b/src/header/semaphore/cbindgen.toml
|
||||
@@ -3,6 +3,9 @@ include_guard = "_RELIBC_SEMAPHORE_H"
|
||||
after_includes = """
|
||||
#include <bits/timespec.h> // for timespec
|
||||
"""
|
||||
+trailer = """
|
||||
+#define SEM_FAILED ((sem_t *) -1)
|
||||
+"""
|
||||
language = "C"
|
||||
style = "Type"
|
||||
no_includes = true
|
||||
--- a/src/header/semaphore/mod.rs
|
||||
+++ b/src/header/semaphore/mod.rs
|
||||
@@ -144,7 +144,8 @@ pub unsafe extern "C" fn sem_init(sem: *mut sem_t, _pshared: c_int, value: c_ui
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sem_open(
|
||||
name: *const c_char,
|
||||
- oflag: c_int, /* (va_list) mode: mode_t, value: c_uint */
|
||||
+ oflag: c_int,
|
||||
+ mut __valist: ...
|
||||
) -> *mut sem_t {
|
||||
if name.is_null() { ERRNO.set(EINVAL); return SEM_FAILED_PTR; }
|
||||
let name_bytes = unsafe { CStr::from_ptr(name) }.to_bytes().to_vec();
|
||||
@@ -156,11 +157,10 @@ pub unsafe extern "C" fn sem_open(
|
||||
with_named_sems(|map| { if let Some(e) = map.get(&name_bytes) { e.refs.fetch_add(1, Ordering::Relaxed); } });
|
||||
return ptr as *mut NamedSemaphore as *mut sem_t;
|
||||
}
|
||||
- let (mode, value): (mode_t, c_uint) = {
|
||||
- let oflag_ptr: *const c_int = &oflag;
|
||||
- let mode_ptr = unsafe { oflag_ptr.add(1) as *const mode_t };
|
||||
- let value_ptr = unsafe { oflag_ptr.add(2) as *const c_uint };
|
||||
- (unsafe { *mode_ptr }, if create { unsafe { *value_ptr } } else { 0 })
|
||||
+ let (mode, value): (mode_t, c_uint) = if create {
|
||||
+ (unsafe { __valist.arg::<mode_t>() }, unsafe { __valist.arg::<c_uint>() })
|
||||
+ } else {
|
||||
+ (0, 0)
|
||||
};
|
||||
let ptr = unsafe { map_named_semaphore(name, oflag, mode, value) };
|
||||
if ptr == SEM_FAILED_PTR { return SEM_FAILED_PTR; }
|
||||
@@ -0,0 +1,57 @@
|
||||
--- a/src/header/stdio/ext.rs
|
||||
+++ b/src/header/stdio/ext.rs
|
||||
@@ -1,8 +1,15 @@
|
||||
use crate::{
|
||||
- header::stdio::{F_NORD, F_NOWR, FILE},
|
||||
+ header::stdio::{F_ERR, F_NORD, F_NOWR, FILE},
|
||||
platform::types::{c_int, size_t},
|
||||
};
|
||||
|
||||
+#[unsafe(no_mangle)]
|
||||
+pub extern "C" fn __freadahead(stream: *mut FILE) -> size_t {
|
||||
+ let stream = unsafe { &mut *stream }.lock();
|
||||
+
|
||||
+ (stream.read_size.saturating_sub(stream.read_pos) + stream.unget.len()) as size_t
|
||||
+}
|
||||
+
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn __fpending(stream: *mut FILE) -> size_t {
|
||||
let stream = unsafe { &mut *stream }.lock();
|
||||
@@ -24,6 +31,13 @@ pub extern "C" fn __fwritable(stream: *mut FILE) -> c_int {
|
||||
c_int::from(stream.flags & F_NOWR == 0)
|
||||
}
|
||||
|
||||
+#[unsafe(no_mangle)]
|
||||
+pub extern "C" fn __fseterr(stream: *mut FILE) {
|
||||
+ let mut stream = unsafe { &mut *stream }.lock();
|
||||
+
|
||||
+ stream.flags |= F_ERR;
|
||||
+}
|
||||
+
|
||||
//TODO: Check last operation when read-write
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn __freading(stream: *mut FILE) -> c_int {
|
||||
--- a/include/stdio_ext.h
|
||||
+++ b/include/stdio_ext.h
|
||||
@@ -2,5 +2,21 @@
|
||||
#define _STDIO_EXT_H
|
||||
|
||||
#include <stdio.h>
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+size_t __freadahead(FILE *stream);
|
||||
+size_t __fpending(FILE *stream);
|
||||
+int __freadable(FILE *stream);
|
||||
+int __freading(FILE *stream);
|
||||
+void __fseterr(FILE *stream);
|
||||
+int __fwritable(FILE *stream);
|
||||
+int __fwriting(FILE *stream);
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+} // extern "C"
|
||||
+#endif
|
||||
|
||||
#endif /* _STDIO_EXT_H */
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/src/header/stdlib/cbindgen.toml b/src/header/stdlib/cbindgen.toml
|
||||
index e0c73c31..5504b0d5 100644
|
||||
--- a/src/header/stdlib/cbindgen.toml
|
||||
+++ b/src/header/stdlib/cbindgen.toml
|
||||
@@ -1,4 +1,4 @@
|
||||
-sys_includes = ["stddef.h", "alloca.h", "wchar.h", "features.h"]
|
||||
+sys_includes = ["stddef.h", "stdint.h", "alloca.h", "wchar.h", "features.h"]
|
||||
include_guard = "_RELIBC_STDLIB_H"
|
||||
trailer = """
|
||||
#ifndef _RELIBC_STDLIB_EXTRA_H
|
||||
diff --git a/src/header/inttypes/cbindgen.toml b/src/header/inttypes/cbindgen.toml
|
||||
index 73018c8e..8bec0e0f 100644
|
||||
--- a/src/header/inttypes/cbindgen.toml
|
||||
+++ b/src/header/inttypes/cbindgen.toml
|
||||
@@ -4,8 +4,7 @@
|
||||
# - "The <inttypes.h> header shall include the <stdint.h> header."
|
||||
# - "wchar_t As described in <stddef.h>."
|
||||
#
|
||||
-# wchar.h brings in both stdint.h and stddef.h
|
||||
-sys_includes = ["wchar.h"]
|
||||
+sys_includes = ["stdint.h", "wchar.h"]
|
||||
include_guard = "_RELIBC_INTTYPES_H"
|
||||
trailer = """
|
||||
#ifndef _RELIBC_BITS_INTTYPES_H
|
||||
diff --git a/src/header/wctype/cbindgen.toml b/src/header/wctype/cbindgen.toml
|
||||
index 37cd9dc9..83b421c0 100644
|
||||
--- a/src/header/wctype/cbindgen.toml
|
||||
+++ b/src/header/wctype/cbindgen.toml
|
||||
@@ -1,4 +1,4 @@
|
||||
-sys_includes = ["wchar.h" ]
|
||||
+sys_includes = ["stdint.h", "wchar.h"]
|
||||
include_guard = "_RELIBC_WCTYPE_H"
|
||||
language = "C"
|
||||
style = "Type"
|
||||
@@ -0,0 +1,49 @@
|
||||
diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml
|
||||
index a31881ba..9e206fd1 100644
|
||||
--- a/src/header/wchar/cbindgen.toml
|
||||
+++ b/src/header/wchar/cbindgen.toml
|
||||
@@ -1,17 +1,13 @@
|
||||
sys_includes = [
|
||||
- "stdio.h",
|
||||
- "time.h",
|
||||
+ "stdarg.h",
|
||||
"features.h",
|
||||
]
|
||||
after_includes = """
|
||||
-// int32_t, uint32_t, WCHAR_MIN, WCHAR_MAX
|
||||
-#include <stdint.h>
|
||||
-
|
||||
#ifndef _WCHAR_T
|
||||
#define _WCHAR_T
|
||||
#ifndef __cplusplus
|
||||
#ifndef __WCHAR_TYPE__
|
||||
- #define __WCHAR_TYPE__ int32_t
|
||||
+ #define __WCHAR_TYPE__ int
|
||||
#endif
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
#endif // __cplusplus
|
||||
@@ -20,7 +16,7 @@ after_includes = """
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
#ifndef __WINT_TYPE__
|
||||
- #define __WINT_TYPE__ uint32_t
|
||||
+ #define __WINT_TYPE__ unsigned int
|
||||
#endif
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
#endif // _WINT_T
|
||||
@@ -31,6 +27,15 @@ after_includes = """
|
||||
#include <stddef.h>
|
||||
|
||||
#define WEOF (0xffffffffu)
|
||||
+
|
||||
+// FILE. Avoid including stdio.h from wchar.h: gnulib wrappers can reach wchar.h
|
||||
+// recursively through stdio.h -> stdint.h -> inttypes.h before wchar prerequisite
|
||||
+// types are visible. wchar.h only needs FILE as an opaque pointer type.
|
||||
+typedef struct FILE FILE;
|
||||
+
|
||||
+// Avoid including time.h from wchar.h for the same wrapper-recursion reason.
|
||||
+// wcsftime only needs struct tm as an opaque pointer type.
|
||||
+struct tm;
|
||||
"""
|
||||
include_guard = "_RELIBC_WCHAR_H"
|
||||
language = "C"
|
||||
@@ -17,10 +17,10 @@ script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
# Use the cross-compiler to produce native redox binaries
|
||||
export CC="${COOKBOOK_TARGET}-gcc"
|
||||
export CXX="${COOKBOOK_TARGET}-g++"
|
||||
export AR="${COOKBOOK_TARGET}-ar"
|
||||
export RANLIB="${COOKBOOK_TARGET}-ranlib"
|
||||
export CC="${GNU_TARGET}-gcc"
|
||||
export CXX="${GNU_TARGET}-g++"
|
||||
export AR="${GNU_TARGET}-ar"
|
||||
export RANLIB="${GNU_TARGET}-ranlib"
|
||||
|
||||
# Configure for native compilation
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
@@ -32,11 +32,14 @@ COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--disable-werror
|
||||
--disable-nls
|
||||
--disable-multilib
|
||||
--disable-gdb
|
||||
--disable-gdbserver
|
||||
--disable-sim
|
||||
)
|
||||
|
||||
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
|
||||
"${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}"
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-binutils all-gas all-ld
|
||||
"${COOKBOOK_MAKE}" install-binutils install-gas install-ld DESTDIR="${COOKBOOK_STAGE}"
|
||||
|
||||
# Native binutils don't need the target prefix - provide unprefixed links
|
||||
for tool in ar as ld nm objcopy objdump ranlib readelf size strings strip; do
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../recipes/dev/binutils-gdb/source
|
||||
@@ -0,0 +1 @@
|
||||
3.8.1
|
||||
@@ -0,0 +1 @@
|
||||
3.8.2
|
||||
@@ -0,0 +1 @@
|
||||
3.8.2
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
Authors of GNU Bison.
|
||||
|
||||
Bison was written primarily by Robert Corbett.
|
||||
|
||||
Richard Stallman made it Yacc-compatible.
|
||||
|
||||
Wilfred Hansen of Carnegie Mellon University added multicharacter
|
||||
string literals and other features (Bison 1.25, 1995).
|
||||
|
||||
Akim Demaille rewrote the parser in Bison, and changed the back end to
|
||||
use M4 (1.50, 2002).
|
||||
|
||||
Paul Hilfinger added GLR support (Bison 1.50, 2002).
|
||||
|
||||
Joel E. Denny contributed canonical-LR support, and invented and added
|
||||
IELR and LAC (Lookahead Correction) support (Bison 2.5, 2011).
|
||||
|
||||
Paolo Bonzini contributed Java support (Bison 2.4, 2008).
|
||||
|
||||
Alex Rozenman added named reference support (Bison 2.5, 2011).
|
||||
|
||||
Paul Eggert fixed a million portability issues, arbitrary limitations,
|
||||
and nasty bugs.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 1998-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,127 @@
|
||||
# Having a separate GNUmakefile lets me 'include' the dynamically
|
||||
# generated rules created via cfg.mk (package-local configuration)
|
||||
# as well as maint.mk (generic maintainer rules).
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
# Copyright (C) 2001, 2003, 2006-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# If the user runs GNU make but has not yet run ./configure,
|
||||
# give them a diagnostic.
|
||||
_gl-Makefile := $(wildcard [M]akefile)
|
||||
ifneq ($(_gl-Makefile),)
|
||||
|
||||
# Make tar archive easier to reproduce.
|
||||
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||
|
||||
# Allow the user to add to this in the Makefile.
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
include Makefile
|
||||
|
||||
# Some projects override e.g., _autoreconf here.
|
||||
-include $(srcdir)/cfg.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include $(srcdir)/maint.mk
|
||||
|
||||
# Ensure that $(VERSION) is up to date for dist-related targets, but not
|
||||
# for others: rerunning autoreconf and recompiling everything isn't cheap.
|
||||
_have-git-version-gen := \
|
||||
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
|
||||
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
|
||||
_is-dist-target ?= $(filter-out %clean, \
|
||||
$(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
|
||||
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
|
||||
ifneq (,$(_is-dist-target)$(_is-install-target))
|
||||
_curr-ver := $(shell cd $(srcdir) \
|
||||
&& $(_build-aux)/git-version-gen \
|
||||
.tarball-version \
|
||||
$(git-version-gen-tag-sed-script))
|
||||
ifneq ($(_curr-ver),$(VERSION))
|
||||
ifeq ($(_curr-ver),UNKNOWN)
|
||||
$(info WARNING: unable to verify if $(VERSION) is the correct version)
|
||||
else
|
||||
ifneq (,$(_is-install-target))
|
||||
# GNU Coding Standards state that 'make install' should not cause
|
||||
# recompilation after 'make all'. But as long as changing the version
|
||||
# string alters config.h, the cost of having 'make all' always have an
|
||||
# up-to-date version is prohibitive. So, as a compromise, we merely
|
||||
# warn when installing a version string that is out of date; the user
|
||||
# should run 'autoreconf' (or something like 'make distcheck') to
|
||||
# fix the version, 'make all' to propagate it, then 'make install'.
|
||||
$(info WARNING: version string $(VERSION) is out of date;)
|
||||
$(info run '$(MAKE) _version' to fix it)
|
||||
else
|
||||
$(info INFO: running autoreconf for new version string: $(_curr-ver))
|
||||
GNUmakefile: _version
|
||||
touch GNUmakefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: _version
|
||||
_version:
|
||||
cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
|
||||
$(MAKE) $(AM_MAKEFLAGS) Makefile
|
||||
|
||||
else
|
||||
|
||||
.DEFAULT_GOAL := abort-due-to-no-makefile
|
||||
srcdir = .
|
||||
|
||||
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
|
||||
-include ./cfg.mk
|
||||
|
||||
# Allow cfg.mk to override these.
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
include ./maint.mk
|
||||
|
||||
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
|
||||
$(MAKECMDGOALS): abort-due-to-no-makefile
|
||||
endif
|
||||
|
||||
abort-due-to-no-makefile:
|
||||
@echo There seems to be no Makefile in this directory. 1>&2
|
||||
@echo "You must run ./configure before running '$(MAKE)'." 1>&2
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel, in case someone tries to build multiple
|
||||
# targets, and one of them can cause a recursive target to be invoked.
|
||||
|
||||
# Only set this if Automake doesn't provide it.
|
||||
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) \
|
||||
dist distcheck tags ctags
|
||||
|
||||
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
|
||||
|
||||
ifneq ($(word 2, $(MAKECMDGOALS)), )
|
||||
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
endif
|
||||
@@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same timestamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
@@ -0,0 +1,149 @@
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = po runtime-po gnulib-po .
|
||||
|
||||
# Files installed for use by Automake.
|
||||
aclocaldir = @aclocaldir@
|
||||
aclocal_DATA = m4/bison-i18n.m4
|
||||
|
||||
EXTRA_DIST = .prev-version .version cfg.mk PACKAGING \
|
||||
ChangeLog-1998 ChangeLog-2012 ChangeLog
|
||||
|
||||
dist_doc_DATA = AUTHORS COPYING NEWS README THANKS TODO
|
||||
|
||||
# Let generated files (e.g., from examples/) depend on this variable,
|
||||
# to make sure they are regenerated when there are changes in Bison.
|
||||
#
|
||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||
# in srcdir, including during distcheck, which is forbidden.
|
||||
dependencies = $(BISON_IN) $(src_bison_SOURCES) $(dist_skeletons_DATA)
|
||||
|
||||
## Running the bison from this tarball. To generate our own parser,
|
||||
## but also to run the tests. Of course, you ought to keep a sane
|
||||
## version of Bison nearby...
|
||||
BISON = $(top_builddir)/tests/bison
|
||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||
YACC = $(BISON) -o y.tab.c
|
||||
AM_YFLAGS_WITH_LINES = --defines -Werror -Wall,dangling-alias --report=all
|
||||
AM_YFLAGS = $(AM_YFLAGS_WITH_LINES) --no-lines
|
||||
|
||||
# Initialization before completion by local.mk's.
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
# Find builddir/src/scan-code.c etc. For some reason "-I./lib"
|
||||
# instead of "-Ilib" avoids infinite recursions on #include_next.
|
||||
AM_CPPFLAGS = -I. -I./lib -I$(top_srcdir) -I$(top_srcdir)/lib
|
||||
BUILT_SOURCES =
|
||||
CLEANDIRS =
|
||||
CLEANFILES =
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST += $(dist_TESTS)
|
||||
MOSTLYCLEANDIRS =
|
||||
MOSTLYCLEANFILES =
|
||||
SUFFIXES =
|
||||
TESTS = $(dist_TESTS)
|
||||
check_PROGRAMS =
|
||||
check_SCRIPTS =
|
||||
dist_TESTS =
|
||||
noinst_LIBRARIES =
|
||||
|
||||
include build-aux/local.mk
|
||||
include data/local.mk
|
||||
include doc/local.mk
|
||||
include etc/local.mk
|
||||
include examples/local.mk
|
||||
include lib/local.mk
|
||||
include src/local.mk
|
||||
include tests/local.mk
|
||||
|
||||
clean-local:
|
||||
rm -rf $(CLEANDIRS)
|
||||
|
||||
.PHONY: gitsort
|
||||
gitsort:
|
||||
cd $(srcdir) \
|
||||
&& for i in $$(git ls-files '*.gitignore' | grep -v doc); do \
|
||||
LC_ALL=C sort $$i -o $$i; \
|
||||
done
|
||||
|
||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||
# working copy (for example, when you run autoreconf && make). Allowing these
|
||||
# to fall out of sync appears to have little potential to improve Bison build
|
||||
# efficiency (even if we were to replace VERSION/PACKAGE_VERSION with .version
|
||||
# everywhere possible). On the other hand, it could be harmful. For example,
|
||||
# a developer might naively reference .version in a test case while the bison
|
||||
# executable still compiles with VERSION, and so the test case might fail or
|
||||
# pass incorrectly.
|
||||
BUILT_SOURCES += $(top_srcdir)/.version
|
||||
$(top_srcdir)/.version: configure
|
||||
echo $(VERSION) > $@-t && mv $@-t $@
|
||||
dist-hook: gen-ChangeLog gen-synclines
|
||||
echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
# When generating a release, include the #lines in Bison's parser. Do it
|
||||
# only if needed. In particular, distcheck runs dist with read-only
|
||||
# sources, so don't try to update src/parse-gram.c: we don't have the
|
||||
# permissions.
|
||||
.PHONY: gen-synclines
|
||||
gen-synclines:
|
||||
cd $(distdir) && \
|
||||
if ! grep '#line' src/parse-gram.c >/dev/null 2>&1; then \
|
||||
$(abs_top_builddir)/tests/bison \
|
||||
$(AM_YFLAGS_WITH_LINES) src/parse-gram.y \
|
||||
-o src/parse-gram.c; \
|
||||
fi
|
||||
|
||||
.PHONY: update-b4-copyright update-package-copyright-year
|
||||
update-b4-copyright:
|
||||
$(AM_V_GEN)find $(srcdir)/data -type f \
|
||||
| xargs $(srcdir)/build-aux/$@
|
||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||
update-package-copyright-year:
|
||||
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
||||
|
||||
gen_start_date = 2012-01-16
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
||||
cl=$(distdir)/ChangeLog && \
|
||||
rm -f $$cl.tmp && \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--strip-tab \
|
||||
--strip-cherry-pick \
|
||||
--no-cluster \
|
||||
--amend=$(srcdir)/build-aux/git-log-fix \
|
||||
--srcdir=$(srcdir) \
|
||||
--since=$(gen_start_date) > $$cl.tmp && \
|
||||
mv -f $$cl.tmp $$cl; \
|
||||
fi
|
||||
|
||||
# Useful to debug.
|
||||
.c.i:
|
||||
$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ -E $<
|
||||
|
||||
.PHONY: codespell
|
||||
CODESPELL = codespell
|
||||
codespell:
|
||||
$(AM_V_GEN) cd $(srcdir) \
|
||||
&& $(CODESPELL) \
|
||||
--regex "[\\w\\-'’\`]+\+*" \
|
||||
--ignore-words-list "ba,circularly,cloneable,copyable,define'd,dout,froms,iff,ifset,od,ois" \
|
||||
$$(git ls-files data doc lib src tests)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
Packaging hints for binary package distributors
|
||||
===============================================
|
||||
|
||||
Although the source of the bison package comes as a single package,
|
||||
in distributions of binary packages the installed files should
|
||||
be split into two packages:
|
||||
|
||||
bison-runtime
|
||||
Contents: Runtime libraries and programs.
|
||||
Audience: Anyone who wants to run internationalized programs
|
||||
that contain Bison-generated parsers.
|
||||
|
||||
bison
|
||||
Contents: Tools and documentation for developers that use Bison.
|
||||
Audience: Anyone who wants to develop programs that use parsers.
|
||||
Dependencies: requires bison-runtime.
|
||||
|
||||
The 'bison-runtime' binary package is much smaller than the 'bison'
|
||||
binary package. It should be included in any distribution that
|
||||
contains localized programs that use the diagnostics contained in
|
||||
Bison-generated parsers.
|
||||
|
||||
If you want to install both packages at the same time, you simply do
|
||||
at the toplevel directory:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
After installation, the file
|
||||
|
||||
$prefix/share/locale/*/LC_MESSAGES/bison-runtime.mo
|
||||
|
||||
belongs to the bison-runtime package; all other installed files belong
|
||||
to the bison package.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2005, 2009-2015, 2018-2021 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,135 @@
|
||||
GNU Bison is a general-purpose parser generator that converts an annotated
|
||||
context-free grammar into a deterministic LR or generalized LR (GLR) parser
|
||||
employing LALR(1) parser tables. Bison can also generate IELR(1) or
|
||||
canonical LR(1) parser tables. Once you are proficient with Bison, you can
|
||||
use it to develop a wide range of language parsers, from those used in
|
||||
simple desk calculators to complex programming languages.
|
||||
|
||||
Bison is upward compatible with Yacc: all properly-written Yacc grammars
|
||||
work with Bison with no change. Anyone familiar with Yacc should be able to
|
||||
use Bison with little trouble. You need to be fluent in C, C++, D or Java
|
||||
programming in order to use Bison.
|
||||
|
||||
Bison and the parsers it generates are portable, they do not require any
|
||||
specific compilers.
|
||||
|
||||
GNU Bison's home page is https://gnu.org/software/bison/.
|
||||
|
||||
# Installation
|
||||
## Build from git
|
||||
The [README-hacking.md file](README-hacking.md) is about building, modifying
|
||||
and checking Bison. See its "Working from the Repository" section to build
|
||||
Bison from the git repo. Roughly, run:
|
||||
|
||||
$ git submodule update --init
|
||||
$ ./bootstrap
|
||||
|
||||
then proceed with the usual `configure && make` steps.
|
||||
|
||||
## Build from tarball
|
||||
See the [INSTALL file](INSTALL) for generic compilation and installation
|
||||
instructions.
|
||||
|
||||
Bison requires GNU m4 1.4.6 or later. See
|
||||
https://ftp.gnu.org/gnu/m4/m4-1.4.6.tar.gz.
|
||||
|
||||
## Running a non installed bison
|
||||
Once you ran `make`, you might want to toy with this fresh bison before
|
||||
installing it. In that case, do not use `src/bison`: it would use the
|
||||
*installed* files (skeletons, etc.), not the local ones. Use `tests/bison`.
|
||||
|
||||
## Colored diagnostics
|
||||
As an experimental feature, diagnostics are now colored, controlled by the
|
||||
`--color` and `--style` options.
|
||||
|
||||
To use them, install the libtextstyle library, 0.20.5 or newer, before
|
||||
configuring Bison. It is available from https://alpha.gnu.org/gnu/gettext/,
|
||||
for instance https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz,
|
||||
or as part of Gettext 0.21 or newer, for instance
|
||||
https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.gz.
|
||||
|
||||
The option --color supports the following arguments:
|
||||
- always, yes: Enable colors.
|
||||
- never, no: Disable colors.
|
||||
- auto, tty (default): Enable colors if the output device is a tty.
|
||||
|
||||
To customize the styles, create a CSS file, say `bison-bw.css`, similar to
|
||||
|
||||
/* bison-bw.css */
|
||||
.warning { }
|
||||
.error { font-weight: 800; text-decoration: underline; }
|
||||
.note { }
|
||||
|
||||
then invoke bison with `--style=bison-bw.css`, or set the `BISON_STYLE`
|
||||
environment variable to `bison-bw.css`.
|
||||
|
||||
In some diagnostics, bison uses libtextstyle to emit special escapes to
|
||||
generate clickable hyperlinks. The environment variable
|
||||
`NO_TERM_HYPERLINKS` can be used to suppress them. This may be useful for
|
||||
terminal emulators which produce garbage output when they receive the escape
|
||||
sequence for a hyperlink. Currently (as of 2020), this affects some versions
|
||||
of emacs, guake, konsole, lxterminal, rxvt, yakuake.
|
||||
|
||||
## Relocatability
|
||||
If you pass `--enable-relocatable` to `configure`, Bison is relocatable.
|
||||
|
||||
A relocatable program can be moved or copied to a different location on the
|
||||
file system. It can also be used through mount points for network sharing.
|
||||
It is possible to make symlinks to the installed and moved programs, and
|
||||
invoke them through the symlink.
|
||||
|
||||
See "Enabling Relocatability" in the documentation.
|
||||
|
||||
## Internationalization
|
||||
Bison supports two catalogs: one for Bison itself (i.e., for the
|
||||
maintainer-side parser generation), and one for the generated parsers (i.e.,
|
||||
for the user-side parser execution). The requirements between both differ:
|
||||
bison needs ngettext, the generated parsers do not. To simplify the build
|
||||
system, neither are installed if ngettext is not supported, even if
|
||||
generated parsers could have been localized. See
|
||||
https://lists.gnu.org/r/bug-bison/2009-08/msg00006.html for more
|
||||
details.
|
||||
|
||||
# Questions
|
||||
See the section FAQ in the documentation (doc/bison.info) for frequently
|
||||
asked questions. The documentation is also available in PDF and HTML,
|
||||
provided you have a recent version of Texinfo installed: run `make pdf` or
|
||||
`make html`.
|
||||
|
||||
If you have questions about using Bison and the documentation does not
|
||||
answer them, please send mail to <help-bison@gnu.org>.
|
||||
|
||||
# Bug reports
|
||||
Please send bug reports to <bug-bison@gnu.org>. Be sure to include the
|
||||
version number from `bison --version`, and a complete, self-contained test
|
||||
case in each bug report.
|
||||
|
||||
# Copyright statements
|
||||
For any copyright year range specified as YYYY-ZZZZ in this package, note
|
||||
that the range specifies every single year in that closed interval.
|
||||
|
||||
<!--
|
||||
|
||||
LocalWords: parsers ngettext Texinfo pdf html YYYY ZZZZ ispell american md
|
||||
LocalWords: MERCHANTABILITY GLR LALR IELR submodule init README src bw
|
||||
LocalWords: Relocatability symlinks symlink
|
||||
|
||||
Local Variables:
|
||||
mode: markdown
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU bison, the GNU Compiler Compiler.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
|
||||
-->
|
||||
@@ -0,0 +1,31 @@
|
||||
-*- text -*-
|
||||
|
||||
This is a test release of this package. Using it more or less
|
||||
implicitly signs you up to help us find whatever problems you report.
|
||||
|
||||
The documentation still needs more work. Suggestions welcome.
|
||||
Patches even more welcome.
|
||||
|
||||
Please send comments and problem reports about this test release to
|
||||
<bug-bison@gnu.org>. This program will get better only if you report
|
||||
the problems you encounter.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,256 @@
|
||||
Bison was originally written by Robert Corbett. It would not be what
|
||||
it is today without the invaluable help of these people:
|
||||
|
||||
Aaro Koskinen aaro.koskinen@iki.fi
|
||||
Аскар Сафин safinaskar@mail.ru
|
||||
Adam Sampson ats@offog.org
|
||||
Adrian Vogelsgesang avogelsgesang@tableau.com
|
||||
Ahcheong Lee dkcjd2000@gmail.com
|
||||
Airy Andre Airy.Andre@edf.fr
|
||||
Akim Demaille akim@gnu.org
|
||||
Albert Chin-A-Young china@thewrittenword.com
|
||||
Alexander Belopolsky alexb@rentec.com
|
||||
Alexandre Duret-Lutz adl@lrde.epita.fr
|
||||
Andre da Costa Barros andre.cbarros@yahoo.com
|
||||
Andreas Damm adamm@onica.com
|
||||
Andreas Schwab schwab@suse.de
|
||||
Andrew Suffield asuffield@users.sourceforge.net
|
||||
Angelo Borsotti angelo.borsotti@gmail.com
|
||||
Anthony Heading ajrh@ajrh.net
|
||||
Antonio Silva Correia amsilvacorreia@hotmail.com
|
||||
Arnold Robbins arnold@skeeve.com
|
||||
Art Haas ahaas@neosoft.com
|
||||
Arthur Schwarz aschwarz1309@att.net
|
||||
Askar Safin safinaskar@mail.ru
|
||||
Balázs Scheidler balazs.scheidler@oneidentity.com
|
||||
Baron Schwartz baron@sequent.org
|
||||
Ben Pfaff blp@cs.stanford.edu
|
||||
Benoit Perrot benoit.perrot@epita.fr
|
||||
Bernd Edlinger bernd.edlinger@hotmail.de
|
||||
Bernd Kiefer kiefer@dfki.de
|
||||
Bert Deknuydt Bert.Deknuydt@esat.kuleuven.ac.be
|
||||
Bill Allombert Bill.Allombert@math.u-bordeaux1.fr
|
||||
Bob Rossi bob@brasko.net
|
||||
Brandon Lucia blucia@gmail.com
|
||||
Brooks Moses bmoses@google.com
|
||||
Bruce Lilly blilly@erols.com
|
||||
Bruno Belanyi bruno.belanyi@epita.fr
|
||||
Bruno Haible bruno@clisp.org
|
||||
Charles-Henri de Boysson de-boy_c@epita.fr
|
||||
Christian Burger cburger@sunysb.edu
|
||||
Clément Démoulins demoulins@lrde.epita.fr
|
||||
Colin Daley colin.daley@outlook.com
|
||||
Cris Bailiff c.bailiff+bison@awayweb.com
|
||||
Cris van Pelt cris@amf03054.office.wxs.nl
|
||||
Csaba Raduly csaba_22@yahoo.co.uk
|
||||
Dagobert Michelsen dam@baltic-online.de
|
||||
Daniel Frużyński daniel@poradnik-webmastera.com
|
||||
Daniel Galloway dg1751@att.com
|
||||
Daniela Becker daniela@lrde.epita.fr
|
||||
Daniel Hagerty hag@gnu.org
|
||||
David Barto david.barto@sparqlcity.com
|
||||
David J. MacKenzie djm@gnu.org
|
||||
David Kastrup dak@gnu.org
|
||||
David Michael fedora.dm0@gmail.com
|
||||
Dengke Du dengke.du@windriver.com
|
||||
Denis Excoffier gcc@Denis-Excoffier.org
|
||||
Dennis Clarke dclarke@blastwave.org
|
||||
Derek Clegg derek@me.com
|
||||
Derek M. Jones derek@knosof.co.uk
|
||||
Di-an Jan dianj@freeshell.org
|
||||
Dick Streefland dick.streefland@altium.nl
|
||||
Didier Godefroy dg@ulysium.net
|
||||
Don Macpherson donmac703@gmail.com
|
||||
Dwight Guth dwight.guth@runtimeverification.com
|
||||
Efi Fogel efifogel@gmail.com
|
||||
Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de
|
||||
Eric Blake ebb9@byu.net
|
||||
Eric S. Raymond esr@thyrsus.com
|
||||
Étienne Renault renault@lrde.epita.fr
|
||||
Evan Lavelle eml-bison@cyconix.com
|
||||
Evan Nemerson evan@nemerson.com
|
||||
Evgeny Stambulchik fnevgeny@plasma-gate.weizmann.ac.il
|
||||
Fabrice Bauzac noon@cote-dazur.com
|
||||
Ferdinand Thiessen ferdinand@fthiessen.de
|
||||
Florian Krohm florian@edamail.fishkill.ibm.com
|
||||
Frank Heckenbach frank@g-n-u.de
|
||||
Frans Englich frans.englich@telia.com
|
||||
Gabriel Rassoul gabriel.rassoul@epita.fr
|
||||
Gary L Peskin garyp@firstech.com
|
||||
Gavin Smith gavinsmith0123@gmail.com
|
||||
Georg Sauthoff gsauthof@TechFak.Uni-Bielefeld.DE
|
||||
George Neuner gneuner2@comcast.net
|
||||
Gilles Espinasse g.esp@free.fr
|
||||
Goran Uddeborg goeran@uddeborg.se
|
||||
Guido Trentalancia trentalg@aston.ac.uk
|
||||
H. Merijn Brand h.m.brand@hccnet.nl
|
||||
Hans Åberg haberg-1@telia.com
|
||||
Horst Von Brand vonbrand@inf.utfsm.cl
|
||||
Jacob L. Mandelson jlm-bbison@jlm.ofb.net
|
||||
Jan Nieuwenhuizen janneke@gnu.org
|
||||
Jannick thirdedition@gmx.net
|
||||
Jeff Hammond jeff_hammond@acm.org
|
||||
Jerry Quinn jlquinn@optonline.net
|
||||
Jesse Thilo jthilo@gnu.org
|
||||
Jim Kent jkent@arch.sel.sony.com
|
||||
Jim Meyering jim@meyering.net
|
||||
Joel E. Denny joeldenny@joeldenny.org
|
||||
Johan van Selst johans@stack.nl
|
||||
John Horigan john@glyphic.com
|
||||
Jonathan Fabrizio jonathan.fabrizio@lrde.epita.fr
|
||||
Jonathan Nieder jrnieder@gmail.com
|
||||
Josh Soref jsoref@gmail.com
|
||||
Juan Manuel Guerrero juan.guerrero@gmx.de
|
||||
Karl Berry karl@freefriends.org
|
||||
Kees Zeelenberg kzlg@users.sourceforge.net
|
||||
Keith Browne kbrowne@legato.com
|
||||
Ken Moffat zarniwhoop@ntlworld.com
|
||||
Kiyoshi Kanazawa yoi_no_myoujou@yahoo.co.jp
|
||||
Lars Maier lars.maier@tefax.net
|
||||
Lars Wendler polynomial-c@gentoo.org
|
||||
László Várady laszlo.varady93@gmail.com
|
||||
Laurent Mascherpa laurent.mascherpa@epita.fr
|
||||
Lie Yan lie.yan@kaust.edu.sa
|
||||
Maarten De Braekeleer maarten.debraekeleer@gmail.com
|
||||
Magnus Fromreide magfr@lysator.liu.se
|
||||
Marc Autret autret_m@epita.fr
|
||||
Marc Mendiola mmendiol@usc.edu
|
||||
Marc Schönefeld marc.schoenefeld@gmx.org
|
||||
Mark Boyall wolfeinstein@gmail.com
|
||||
Martin Blais blais@furius.ca
|
||||
Martin Jacobs martin.jacobs@arcor.de
|
||||
Martin Mokrejs mmokrejs@natur.cuni.cz
|
||||
Martin Nylin martin.nylin@linuxmail.org
|
||||
Matt Kraai kraai@alumni.cmu.edu
|
||||
Matt Rosing rosing@peakfive.com
|
||||
Maxim Prohorenko Maxim.Prohorenko@gmail.com
|
||||
Michael Catanzaro mcatanzaro@gnome.org
|
||||
Michael Felt mamfelt@gmail.com
|
||||
Michael Hayes m.hayes@elec.canterbury.ac.nz
|
||||
Michael Raskin 7c6f434c@mail.ru
|
||||
Michel d'Hooge michel.dhooge@gmail.com
|
||||
Michiel De Wilde mdewilde.agilent@gmail.com
|
||||
Mickael Labau labau_m@epita.fr
|
||||
Mike Castle dalgoda@ix.netcom.com
|
||||
Mike Frysinger vapier@gentoo.org
|
||||
Mike Sullivan Mike.sullivan@Oracle.COM
|
||||
Nate Guerin nathan.guerin@riseup.net
|
||||
Neil Booth NeilB@earthling.net
|
||||
Nelson H. F. Beebe beebe@math.utah.edu
|
||||
neok m4700 neok.m4700@gmail.com
|
||||
Nick Bowler nbowler@elliptictech.com
|
||||
Nicolas Bedon nicolas.bedon@univ-rouen.fr
|
||||
Nicolas Burrus nicolas.burrus@epita.fr
|
||||
Nicolas Tisserand nicolas.tisserand@epita.fr
|
||||
Nikki Valen nicolettavalencia.nv@gmail.com
|
||||
Noah Friedman friedman@gnu.org
|
||||
Odd Arild Olsen oao@fibula.no
|
||||
Oleg Smolsky oleg.smolsky@pacific-simulators.co.nz
|
||||
Oleksii Taran oleksii.taran@gmail.com
|
||||
Oliver Mangold o.mangold@gmail.com
|
||||
Paolo Bonzini bonzini@gnu.org
|
||||
Paolo Simone Gasparello djgaspa@gmail.com
|
||||
Pascal Bart pascal.bart@epita.fr
|
||||
Patrice Dumas pertusus@free.fr
|
||||
Paul Eggert eggert@cs.ucla.edu
|
||||
Paul Hilfinger Hilfinger@CS.Berkeley.EDU
|
||||
Per Allansson per@appgate.com
|
||||
Peter Eisentraut peter_e@gmx.net
|
||||
Peter Fales psfales@lucent.com
|
||||
Peter Hamorsky hamo@upjs.sk
|
||||
Peter Simons simons@cryp.to
|
||||
Petr Machata pmachata@redhat.com
|
||||
Pho pho@cielonegro.org
|
||||
Piotr Gackiewicz gacek@intertel.com.pl
|
||||
Piotr Marcińczyk piomar123@gmail.com
|
||||
Pramod Kumbhar pramod.s.kumbhar@gmail.com
|
||||
Quentin Hocquet hocquet@gostai.com
|
||||
Quoc Peyrot chojin@lrde.epita.fr
|
||||
R Blake blakers@mac.com
|
||||
Raja R Harinath harinath@cs.umn.edu
|
||||
Ralf Wildenhues Ralf.Wildenhues@gmx.de
|
||||
Ryan dev@splintermail.com
|
||||
Rich Wilson richaw@gmail.com
|
||||
Richard Stallman rms@gnu.org
|
||||
Rici Lake ricilake@gmail.com
|
||||
Rob Conde rob.conde@ai-solutions.com
|
||||
Rob Vermaas rob.vermaas@gmail.com
|
||||
Robert Anisko anisko_r@epita.fr
|
||||
Robert Yang liezhi.yang@windriver.com
|
||||
Roland Levillain roland@lrde.epita.fr
|
||||
Satya Kiran Popuri satyakiran@gmail.com
|
||||
Sebastian Setzer sebastian.setzer.ext@siemens.com
|
||||
Sebastien Fricker sebastien.fricker@gmail.com
|
||||
Sébastien Villemot sebastien@debian.org
|
||||
Sergei Steshenko sergstesh@yahoo.com
|
||||
Shura debil_urod@ngs.ru
|
||||
Simon Sobisch simonsobisch@web.de
|
||||
Stefano Lattarini stefano.lattarini@gmail.com
|
||||
Stephen Cameron stephenmcameron@gmail.com
|
||||
Steve Murphy murf@parsetree.com
|
||||
Suhwan Song prada960808@gmail.com
|
||||
Sum Wu sum@geekhouse.org
|
||||
Théophile Ranquet theophile.ranquet@gmail.com
|
||||
Thiru Ramakrishnan thiru.ramakrishnan@gmail.com
|
||||
Thomas Jahns jahns@dkrz.de
|
||||
Thomas Petazzoni thomas.petazzoni@bootlin.com
|
||||
Tim Josling tej@melbpc.org.au
|
||||
Tim Landscheidt tim@tim-landscheidt.de
|
||||
Tim Van Holder tim.van.holder@pandora.be
|
||||
Tobias Frost tobi@debian.org
|
||||
Todd Freed todd.freed@gmail.com
|
||||
Tom Kramer kramer@nist.gov
|
||||
Tom Lane tgl@sss.pgh.pa.us
|
||||
Tom Tromey tromey@cygnus.com
|
||||
Tomasz Kłoczko kloczko.tomasz@gmail.com
|
||||
Tommy Nordgren tommy.nordgren@chello.se
|
||||
Troy A. Johnson troyj@ecn.purdue.edu
|
||||
Tys Lefering gccbison@gmail.com
|
||||
Uxio Prego uxio@uma.es
|
||||
Valentin Tolmer nitnelave1@gmail.com
|
||||
wcventure wcventure@126.com
|
||||
Victor Khomenko victor.khomenko@newcastle.ac.uk
|
||||
Victor Zverovich victor.zverovich@gmail.com
|
||||
Vin Shelton acs@alumni.princeton.edu
|
||||
W.C.A. Wijngaards wouter@NLnetLabs.nl
|
||||
Wayne Green wayne@infosavvy.com
|
||||
Wei Song wsong83@gmail.com
|
||||
Wojciech Polak polak@gnu.org
|
||||
Wolfgang S. Kechel wolfgang.kechel@prs.de
|
||||
Wolfgang Thaller wolfgang.thaller@gmx.net
|
||||
Wolfram Wagner ww@mpi-sb.mpg.de
|
||||
Wwp subscript@free.fr
|
||||
xolodho xolodho@gmail.com
|
||||
Yuichiro Kaneko spiketeika@gmail.com
|
||||
Yuriy Solodkyy solodon@gmail.com
|
||||
Zack Weinberg zack@codesourcery.com
|
||||
江 祖铭 jjzuming@outlook.com
|
||||
長田偉伸 cbh34680@iret.co.jp
|
||||
马俊 majun123@whu.edu.cn
|
||||
|
||||
Many people are not named here because we lost track of them. We
|
||||
thank them! Please, help us keeping this list up to date.
|
||||
|
||||
Local Variables:
|
||||
mode: text
|
||||
coding: utf-8
|
||||
End:
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Parser Generator.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,723 @@
|
||||
* Soon
|
||||
** scan-code
|
||||
The default case is scanning char-per-char.
|
||||
|
||||
/* By default, grow the string obstack with the input. */
|
||||
.|\n STRING_GROW ();
|
||||
|
||||
make it more eager?
|
||||
|
||||
** Missing tests
|
||||
commit 2c294c132528ede23d8ae4959783a67e9ff05ac5
|
||||
Author: Vincent Imbimbo <vmi6@cornell.edu>
|
||||
Date: Sat Jan 23 13:25:18 2021 -0500
|
||||
|
||||
cex: fix state-item pruning
|
||||
|
||||
See https://lists.gnu.org/r/bug-bison/2021-01/msg00002.html
|
||||
|
||||
** pos_set_set
|
||||
The current approach is correct, but with poor performances. Bitsets need
|
||||
to support 'assign' and 'shift'. And instead of extending POS_SET just for
|
||||
the out-of-range new values, we need something like doubling the size.
|
||||
|
||||
** glr
|
||||
There is no test with "Parse on stack %ld rejected by rule %d" in it.
|
||||
|
||||
** yyrline etc.
|
||||
Clarify that rule numbers in the skeletons are 1-based.
|
||||
|
||||
** Macros in C++
|
||||
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
|
||||
etc.
|
||||
|
||||
** yyerrok in Java
|
||||
And add tests in calc.at, to prepare work for D.
|
||||
|
||||
** YYERROR and yynerrs
|
||||
We are missing some cases. Write a test case, and check all the skeletons.
|
||||
|
||||
** Cex
|
||||
*** Improve gnulib
|
||||
Don't do this (counterexample.c):
|
||||
|
||||
// This is the fastest way to get the tail node from the gl_list API.
|
||||
gl_list_node_t
|
||||
list_get_end (gl_list_t list)
|
||||
{
|
||||
gl_list_node_t sentinel = gl_list_add_last (list, NULL);
|
||||
gl_list_node_t res = gl_list_previous_node (list, sentinel);
|
||||
gl_list_remove_node (list, sentinel);
|
||||
return res;
|
||||
}
|
||||
|
||||
*** Ambiguous rewriting
|
||||
If the user is stupid enough to have equal rules, then the derivations are
|
||||
harder to read:
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
2 exp: exp "+" exp .
|
||||
3 exp: exp "+" exp .
|
||||
Example exp "+" exp •
|
||||
First derivation exp ::=[ exp "+" exp • ]
|
||||
Example exp "+" exp •
|
||||
Second derivation exp ::=[ exp "+" exp • ]
|
||||
|
||||
Do we care about this? In color, we use twice the same color here, but we
|
||||
could try to use the same color for the same rule.
|
||||
|
||||
*** XML reports
|
||||
Show the counterexamples. This is going to be really hard and/or painful.
|
||||
Unless we play it dumb (little structure).
|
||||
|
||||
** Bistromathic
|
||||
- How about not evaluating incomplete lines when the text is not finished
|
||||
(as shells do).
|
||||
|
||||
** Questions
|
||||
*** Java
|
||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||
Lexer.
|
||||
|
||||
- is there a migration path that would allow to use TokenKinds in
|
||||
yylex?
|
||||
|
||||
- define the tokens as an enum too.
|
||||
|
||||
- promote YYEOF rather than EOF.
|
||||
|
||||
** YYerror
|
||||
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
||||
|
||||
should be updated to not use YYERRCODE. Returning an undef token is good
|
||||
enough.
|
||||
|
||||
** Java
|
||||
*** calc.at
|
||||
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
||||
|
||||
** doc
|
||||
I feel it's ugly to use the GNU style to declare functions in the doc. It
|
||||
generates tons of white space in the page, and may contribute to bad page
|
||||
breaks.
|
||||
|
||||
** consistency
|
||||
token vs terminal.
|
||||
|
||||
** api.token.raw
|
||||
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
||||
used to report invalid lexemes.
|
||||
|
||||
** push parsers
|
||||
Consider deprecating impure push parsers. They add a lot of complexity, for
|
||||
a bad feature. On the other hand, that would make it much harder to sit
|
||||
push parsers on top of pull parser. Which is currently not relevant, since
|
||||
push parsers are measurably slower.
|
||||
|
||||
** %define parse.error formatted
|
||||
How about pushing Bistromathic's yyreport_syntax_error as another standard
|
||||
way to generate the error message, and leave to the user the task of
|
||||
providing the message formats? Currently in bistro, it reads:
|
||||
|
||||
const char *
|
||||
error_format_string (int argc)
|
||||
{
|
||||
switch (argc)
|
||||
{
|
||||
default: /* Avoid compiler warnings. */
|
||||
case 0: return _("%@: syntax error");
|
||||
case 1: return _("%@: syntax error: unexpected %u");
|
||||
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
||||
// "unexpected token", and '%0e', '%1e'... are expected tokens
|
||||
// at this point.
|
||||
//
|
||||
// For instance on the expression "1 + * 2", you'd get
|
||||
//
|
||||
// 1.5: syntax error: expected - or ( or number or function or variable before *
|
||||
case 2: return _("%@: syntax error: expected %0e before %u");
|
||||
case 3: return _("%@: syntax error: expected %0e or %1e before %u");
|
||||
case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
|
||||
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
||||
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
||||
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
||||
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
|
||||
}
|
||||
}
|
||||
|
||||
The message would have to be generated in a string, and pushed to yyerror.
|
||||
Which will be a pain in the neck in yacc.c.
|
||||
|
||||
If we want to do that, we should think very carefully about the syntax of
|
||||
the format string.
|
||||
|
||||
** yyclearin does not invoke the lookahead token's %destructor
|
||||
https://lists.gnu.org/r/bug-bison/2018-02/msg00000.html
|
||||
Rici:
|
||||
|
||||
> Modifying yyclearin so that it calls yydestruct seems like the simplest
|
||||
> solution to this issue, but it is conceivable that such a change would
|
||||
> break programs which already perform some kind of workaround in order to
|
||||
> destruct the lookahead symbol. So it might be necessary to use some kind of
|
||||
> compatibility %define, or to create a new replacement macro with a
|
||||
> different name such as yydiscardin.
|
||||
>
|
||||
> At a minimum, the fact that yyclearin does not invoke the %destructor
|
||||
> should be highlighted in the documentation, since it is not at all obvious.
|
||||
|
||||
** Issues in i18n
|
||||
|
||||
Les catégories d'avertissements incluent :
|
||||
conflicts-sr conflits S/R (activé par défaut)
|
||||
conflicts-rr conflits R/R (activé par défaut)
|
||||
dangling-alias l'alias chaîne n'est pas attaché à un symbole
|
||||
deprecated construction obsolète
|
||||
empty-rule règle vide sans %empty
|
||||
midrule-values valeurs de règle intermédiaire non définies ou inutilisées
|
||||
precedence priorité et associativité inutiles
|
||||
yacc incompatibilités avec POSIX Yacc
|
||||
other tous les autres avertissements (activé par défaut)
|
||||
all tous les avertissements sauf « dangling-alias » et « yacc »
|
||||
no-CATEGORY désactiver les avertissements dans CATEGORIE
|
||||
none désactiver tous les avertissements
|
||||
error[=CATEGORY] traiter les avertissements comme des erreurs
|
||||
|
||||
Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
||||
|
||||
* Bison 3.9
|
||||
** Rewrite glr.cc (currently glr2.cc)
|
||||
*** custom error messages
|
||||
|
||||
*** Remove jumps
|
||||
We can probably replace setjmp/longjmp with exceptions. That would help
|
||||
tremendously other languages such as D and Java that probably have no
|
||||
similar feature. If we remove jumps, we probably no longer need _Noreturn,
|
||||
so simplify `b4_attribute_define([noreturn])` into `b4_attribute_define`.
|
||||
|
||||
After discussing with Valentin, it was decided that it's better to stay with
|
||||
jumps, since in some places exceptions are ruled out from C++.
|
||||
|
||||
*** Coding style
|
||||
Move to our coding conventions. In particular names such as yy_glr_stack,
|
||||
not yyGLRStack.
|
||||
|
||||
*** yydebug
|
||||
It should be a member of the parser object, see lalr1.cc. Let the parser
|
||||
object decide what the debug stream is, rather than open coding std::cerr.
|
||||
|
||||
*** Avoid pointers
|
||||
There are many places where pointers should be replaced with references.
|
||||
Some occurrences were fixed, but now some have improper names:
|
||||
|
||||
-yygetToken (int *yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
||||
+yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser][]b4_pure_if([, glr_stack* yystackp])[]b4_user_formals[)
|
||||
|
||||
yycharp is no longer a Pointer. And yystackp should probably also be a reference.
|
||||
|
||||
*** parse.assert
|
||||
Currently all the assertions are enabled. Once we are confident in glr2.cc,
|
||||
let parse.assert use the same approach as in lalr1.cc.
|
||||
|
||||
*** debug_stream
|
||||
Stop using std::cerr everywhere.
|
||||
|
||||
*** glr.c
|
||||
When glr2.cc fully replaces glr.cc, get rid of the glr.cc scaffolding in
|
||||
glr.c.
|
||||
|
||||
* Chains
|
||||
** Unit rules / Injection rules (Akim Demaille)
|
||||
Maybe we could expand unit rules (or "injections", see
|
||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
||||
transform
|
||||
|
||||
exp: arith | bool;
|
||||
arith: exp '+' exp;
|
||||
bool: exp '&' exp;
|
||||
|
||||
into
|
||||
|
||||
exp: exp '+' exp | exp '&' exp;
|
||||
|
||||
when there are no actions. This can significantly speed up some grammars.
|
||||
I can't find the papers. In particular the book 'LR parsing: Theory and
|
||||
Practice' is impossible to find, but according to 'Parsing Techniques: a
|
||||
Practical Guide', it includes information about this issue. Does anybody
|
||||
have it?
|
||||
|
||||
** clean up (Akim Demaille)
|
||||
Do not work on these items now, as I (Akim) have branches with a lot of
|
||||
changes in this area (hitting several files), and no desire to have to fix
|
||||
conflicts. Addressing these items will happen after my branches have been
|
||||
merged.
|
||||
|
||||
*** lalr.c
|
||||
Introduce a goto struct, and use it in place of from_state/to_state.
|
||||
Rename states1 as path, length as pathlen.
|
||||
Introduce inline functions for things such as nullable[*rp - ntokens]
|
||||
where we need to map from symbol number to nterm number.
|
||||
|
||||
There are probably a significant part of the relations management that
|
||||
should be migrated on top of a bitsetv.
|
||||
|
||||
*** closure
|
||||
It should probably take a "state*" instead of two arguments.
|
||||
|
||||
*** traces
|
||||
The "automaton" and "set" categories are not so useful. We should probably
|
||||
introduce lr(0) and lalr, just the way we have ielr categories. The
|
||||
"closure" function is too verbose, it should probably have its own category.
|
||||
|
||||
"set" can still be used for summarizing the important sets. That would make
|
||||
tests easy to maintain.
|
||||
|
||||
*** complain.*
|
||||
Rename these guys as "diagnostics.*" (or "diagnose.*"), since that's the
|
||||
name they have in GCC, clang, etc. Likewise for the complain_* series of
|
||||
functions.
|
||||
|
||||
*** ritem
|
||||
states/nstates, rules/nrules, ..., ritem/nritems
|
||||
Fix the latter.
|
||||
|
||||
*** m4: slot, type, type_tag
|
||||
The meaning of type_tag varies depending on api.value.type. We should avoid
|
||||
that and using clear definitions with stable semantics.
|
||||
|
||||
* D programming language
|
||||
There's a number of features that are missing, here sorted in _suggested_
|
||||
order of implementation.
|
||||
|
||||
When copying code from other skeletons, keep the comments exactly as they
|
||||
are. Keep the same variable names. If you change the wording in one place,
|
||||
do it in the others too. In other words: make sure to keep the
|
||||
maintenance *simple* by avoiding any gratuitous difference.
|
||||
|
||||
** CI
|
||||
Check when gdc and ldc.
|
||||
|
||||
** GLR Parser
|
||||
This is very ambitious. That's the final boss. There are currently no
|
||||
"clean" implementation to get inspiration from.
|
||||
|
||||
glr.c is very clean but:
|
||||
- is low-level C
|
||||
- is a different skeleton from yacc.c
|
||||
|
||||
glr.cc is (currently) an ugly hack: a C++ shell around glr.c. Valentin
|
||||
Tolmer is currently rewriting glr.cc to be clean C++, but he is not
|
||||
finished. There will be a lot a common code between lalr1.cc and glr.cc, so
|
||||
eventually I would like them to be fused into a single skeleton, supporting
|
||||
both deterministic and generalized parsing.
|
||||
|
||||
It would be great for D to also support this.
|
||||
|
||||
The basic ideas of GLR are explained here:
|
||||
|
||||
https://www.codeproject.com/Articles/5259825/GLR-Parsing-in-Csharp-How-to-Use-The-Most-Powerful
|
||||
|
||||
* Better error messages
|
||||
The users are not provided with enough tools to forge their error messages.
|
||||
See for instance "Is there an option to change the message produced by
|
||||
YYERROR_VERBOSE?" by Simon Sobisch, on bison-help.
|
||||
|
||||
See also
|
||||
https://www.cs.tufts.edu/~nr/cs257/archive/clinton-jefferey/lr-error-messages.pdf
|
||||
https://research.swtch.com/yyerror
|
||||
http://gallium.inria.fr/~fpottier/publis/fpottier-reachability-cc2016.pdf
|
||||
|
||||
* Modernization
|
||||
Fix data/skeletons/yacc.c so that it defines YYPTRDIFF_T properly for modern
|
||||
and older C++ compilers. Currently the code defaults to defining it to
|
||||
'long' for non-GCC compilers, but it should use the proper C++ magic to
|
||||
define it to the same type as the C ptrdiff_t type.
|
||||
|
||||
* Completion
|
||||
Several features are not available in all the back-ends.
|
||||
|
||||
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
||||
- token constructors: Java, C, D (a bit difficult)
|
||||
- glr: D, Java (super difficult)
|
||||
|
||||
* Bugs
|
||||
** Autotest has quotation issues
|
||||
tests/input.at:1730:AT_SETUP([%define errors])
|
||||
|
||||
->
|
||||
|
||||
$ ./tests/testsuite -l | grep errors | sed q
|
||||
38: input.at:1730 errors
|
||||
|
||||
* Short term
|
||||
** Better design for diagnostics
|
||||
The current implementation of diagnostics is ad hoc, it grew organically.
|
||||
It works as a series of calls to several functions, with dependency of the
|
||||
latter calls on the former. For instance:
|
||||
|
||||
complain (&sym->location,
|
||||
sym->content->status == needed ? complaint : Wother,
|
||||
_("symbol %s is used, but is not defined as a token"
|
||||
" and has no rules; did you mean %s?"),
|
||||
quote_n (0, sym->tag),
|
||||
quote_n (1, best->tag));
|
||||
if (feature_flag & feature_caret)
|
||||
location_caret_suggestion (sym->location, best->tag, stderr);
|
||||
|
||||
We should rewrite this in a more FP way:
|
||||
|
||||
1. build a rich structure that denotes the (complete) diagnostic.
|
||||
"Complete" in the sense that it also contains the suggestions, the list
|
||||
of possible matches, etc.
|
||||
|
||||
2. send this to the pretty-printing routine. The diagnostic structure
|
||||
should be sufficient so that we can generate all the 'format' of
|
||||
diagnostics, including the fixits.
|
||||
|
||||
If properly done, this diagnostic module can be detached from Bison and be
|
||||
put in gnulib. It could be used, for instance, for errors caught by
|
||||
xgettext.
|
||||
|
||||
There's certainly already something alike in GCC. At least that's the
|
||||
impression I get from reading the "-fdiagnostics-format=FORMAT" part of this
|
||||
page:
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
|
||||
|
||||
** Graphviz display code thoughts
|
||||
The code for the --graph option is over two files: print_graph, and
|
||||
graphviz. This is because Bison used to also produce VCG graphs, but since
|
||||
this is no longer true, maybe we could consider these files for fusion.
|
||||
|
||||
An other consideration worth noting is that print_graph.c (correct me if I
|
||||
am wrong) should contain generic functions, whereas graphviz.c and other
|
||||
potential files should contain just the specific code for that output
|
||||
format. It will probably prove difficult to tell if the implementation is
|
||||
actually generic whilst only having support for a single format, but it
|
||||
would be nice to keep stuff a bit tidier: right now, the construction of the
|
||||
bitset used to show reductions is in the graphviz-specific code, and on the
|
||||
opposite side we have some use of \l, which is graphviz-specific, in what
|
||||
should be generic code.
|
||||
|
||||
Little effort seems to have been given to factoring these files and their
|
||||
print{,-xml} counterpart. We would very much like to re-use the pretty format
|
||||
of states from .output for the graphs, etc.
|
||||
|
||||
Since graphviz dies on medium-to-big grammars, maybe consider an other tool?
|
||||
|
||||
** push-parser
|
||||
Check it too when checking the different kinds of parsers. And be
|
||||
sure to check that the initial-action is performed once per parsing.
|
||||
|
||||
** m4 names
|
||||
b4_shared_declarations is no longer what it is. Make it
|
||||
b4_parser_declaration for instance.
|
||||
|
||||
** yychar in lalr1.cc
|
||||
There is a large difference bw maint and master on the handling of
|
||||
yychar (which was removed in lalr1.cc). See what needs to be
|
||||
back-ported.
|
||||
|
||||
|
||||
/* User semantic actions sometimes alter yychar, and that requires
|
||||
that yytoken be updated with the new translation. We take the
|
||||
approach of translating immediately before every use of yytoken.
|
||||
One alternative is translating here after every semantic action,
|
||||
but that translation would be missed if the semantic action
|
||||
invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
|
||||
yychar. In the case of YYABORT or YYACCEPT, an incorrect
|
||||
destructor might then be invoked immediately. In the case of
|
||||
YYERROR, subsequent parser actions might lead to an incorrect
|
||||
destructor call or verbose syntax error message before the
|
||||
lookahead is translated. */
|
||||
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
yytoken = yytranslate_ (yychar);
|
||||
|
||||
|
||||
** Get rid of fake #lines [Bison: ...]
|
||||
Possibly as simple as checking whether the column number is nonnegative.
|
||||
|
||||
I have seen messages like the following from GCC.
|
||||
|
||||
<built-in>:0: fatal error: opening dependency file .deps/libltdl/argz.Tpo: No such file or directory
|
||||
|
||||
|
||||
** Discuss about %printer/%destroy in the case of C++.
|
||||
It would be very nice to provide the symbol classes with an operator<<
|
||||
and a destructor. Unfortunately the syntax we have chosen for
|
||||
%destroy and %printer make them hard to reuse. For instance, the user
|
||||
is invited to write something like
|
||||
|
||||
%printer { debug_stream() << $$; } <my_type>;
|
||||
|
||||
which is hard to reuse elsewhere since it wants to use
|
||||
"debug_stream()" to find the stream to use. The same applies to
|
||||
%destroy: we told the user she could use the members of the Parser
|
||||
class in the printers/destructors, which is not good for an operator<<
|
||||
since it is no longer bound to a particular parser, it's just a
|
||||
(standalone symbol).
|
||||
|
||||
* Various
|
||||
** Rewrite glr.cc in C++ (Valentin Tolmer)
|
||||
As a matter of fact, it would be very interesting to see how much we can
|
||||
share between lalr1.cc and glr.cc. Most of the skeletons should be common.
|
||||
It would be a very nice source of inspiration for the other languages.
|
||||
|
||||
Valentin Tolmer is working on this.
|
||||
|
||||
* From lalr1.cc to yacc.c
|
||||
** Single stack
|
||||
Merging the three stacks in lalr1.cc simplified the code, prompted for
|
||||
other improvements and also made it faster (probably because memory
|
||||
management is performed once instead of three times). I suggest that
|
||||
we do the same in yacc.c.
|
||||
|
||||
(Some time later): it's also very nice to have three stacks: it's more dense
|
||||
as we don't lose bits to padding. For instance the typical stack for states
|
||||
will use 8 bits, while it is likely to consume 32 bits in a struct.
|
||||
|
||||
We need trustworthy benchmarks for Bison, for all our backends. Akim has a
|
||||
few things scattered around; we need to put them in the repo, and make them
|
||||
more useful.
|
||||
|
||||
* Report
|
||||
|
||||
** Figures
|
||||
Some statistics about the grammar and the parser would be useful,
|
||||
especially when asking the user to send some information about the
|
||||
grammars she is working on. We should probably also include some
|
||||
information about the variables (I'm not sure for instance we even
|
||||
specify what LR variant was used).
|
||||
|
||||
** GLR
|
||||
How would Paul like to display the conflicted actions? In particular,
|
||||
what when two reductions are possible on a given lookahead token, but one is
|
||||
part of $default. Should we make the two reductions explicit, or just
|
||||
keep $default? See the following point.
|
||||
|
||||
** Disabled Reductions
|
||||
See 'tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
|
||||
what we want to do.
|
||||
|
||||
** Documentation
|
||||
Extend with error productions. The hard part will probably be finding
|
||||
the right rule so that a single state does not exhibit too many yet
|
||||
undocumented ''features''. Maybe an empty action ought to be
|
||||
presented too. Shall we try to make a single grammar with all these
|
||||
features, or should we have several very small grammars?
|
||||
|
||||
* Extensions
|
||||
** More languages?
|
||||
Well, only if there is really some demand for it.
|
||||
|
||||
*** PHP
|
||||
https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
||||
|
||||
*** Python
|
||||
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
||||
|
||||
** Multiple start symbols
|
||||
Revert a70e75b8a41755ab96ab211a0ea111ac68a4aadd.
|
||||
Revert tests: disable "Multistart reports".
|
||||
|
||||
Would be very useful when parsing closely related languages. The idea is to
|
||||
declare several start symbols, for instance
|
||||
|
||||
%start stmt expr
|
||||
%%
|
||||
stmt: ...
|
||||
expr: ...
|
||||
|
||||
and to generate parse(), parse_stmt() and parse_expr(). Technically, the
|
||||
above grammar would be transformed into
|
||||
|
||||
%start yy_start
|
||||
%token YY_START_STMT YY_START_EXPR
|
||||
%%
|
||||
yy_start: YY_START_STMT stmt | YY_START_EXPR expr
|
||||
|
||||
so that there are no new conflicts in the grammar (as would undoubtedly
|
||||
happen with yy_start: stmt | expr). Then adjust the skeletons so that this
|
||||
initial token (YY_START_STMT, YY_START_EXPR) be shifted first in the
|
||||
corresponding parse function.
|
||||
|
||||
*** Number of useless symbols
|
||||
AT_TEST(
|
||||
[[%start exp;
|
||||
exp: exp;]],
|
||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 2 rules useless in grammar [-Wother]
|
||||
input.y:2.8-10: error: start symbol exp does not derive any sentence]])
|
||||
|
||||
We should say "1 nonterminal": the other one is $accept, which should not
|
||||
participate in the count.
|
||||
|
||||
*** Tokens
|
||||
Do we want to disallow terminal start symbols? The limitation is not
|
||||
technical. Can it be useful to someone to "parse" a token?
|
||||
|
||||
** %include
|
||||
This is a popular demand. We already made many changes in the parser that
|
||||
should make this reasonably easy to implement.
|
||||
|
||||
Bruce Mardle <marblypup@yahoo.co.uk>
|
||||
https://lists.gnu.org/r/bison-patches/2015-09/msg00000.html
|
||||
|
||||
However, there are many other things to do before having such a feature,
|
||||
because I don't want a % equivalent to #include (which we all learned to
|
||||
hate). I want something that builds "modules" of grammars, and assembles
|
||||
them together, paying attention to keep separate bits separated, in pseudo
|
||||
name spaces.
|
||||
|
||||
** Push parsers
|
||||
There is demand for push parsers in C++.
|
||||
|
||||
** Generate code instead of tables
|
||||
This is certainly quite a lot of work. See
|
||||
https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4539.
|
||||
|
||||
** $-1
|
||||
We should find a means to provide an access to values deep in the
|
||||
stack. For instance, instead of
|
||||
|
||||
baz: qux { $$ = $<foo>-1 + $<bar>0 + $1; }
|
||||
|
||||
we should be able to have:
|
||||
|
||||
foo($foo) bar($bar) baz($bar): qux($qux) { $baz = $foo + $bar + $qux; }
|
||||
|
||||
Or something like this.
|
||||
|
||||
** %if and the like
|
||||
It should be possible to have %if/%else/%endif. The implementation is
|
||||
not clear: should it be lexical or syntactic. Vadim Maslow thinks it
|
||||
must be in the scanner: we must not parse what is in a switched off
|
||||
part of %if. Akim Demaille thinks it should be in the parser, so as
|
||||
to avoid falling into another CPP mistake.
|
||||
|
||||
(Later): I'm sure there's actually good case for this. People who need that
|
||||
feature can use m4/cpp on top of Bison. I don't think it is worth the
|
||||
trouble in Bison itself.
|
||||
|
||||
** XML Output
|
||||
There are couple of available extensions of Bison targeting some XML
|
||||
output. Some day we should consider including them. One issue is
|
||||
that they seem to be quite orthogonal to the parsing technique, and
|
||||
seem to depend mostly on the possibility to have some code triggered
|
||||
for each reduction. As a matter of fact, such hooks could also be
|
||||
used to generate the yydebug traces. Some generic scheme probably
|
||||
exists in there.
|
||||
|
||||
XML output for GNU Bison and gcc
|
||||
http://www.cs.may.ie/~jpower/Research/bisonXML/
|
||||
|
||||
XML output for GNU Bison
|
||||
http://yaxx.sourceforge.net/
|
||||
|
||||
* Coding system independence
|
||||
Paul notes:
|
||||
|
||||
Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
|
||||
255). It also assumes that the 8-bit character encoding is
|
||||
the same for the invocation of 'bison' as it is for the
|
||||
invocation of 'cc', but this is not necessarily true when
|
||||
people run bison on an ASCII host and then use cc on an EBCDIC
|
||||
host. I don't think these topics are worth our time
|
||||
addressing (unless we find a gung-ho volunteer for EBCDIC or
|
||||
PDP-10 ports :-) but they should probably be documented
|
||||
somewhere.
|
||||
|
||||
More importantly, Bison does not currently allow NUL bytes in
|
||||
tokens, either via escapes (e.g., "x\0y") or via a NUL byte in
|
||||
the source code. This should get fixed.
|
||||
|
||||
* Broken options?
|
||||
** %token-table
|
||||
** Skeleton strategy
|
||||
Must we keep %token-table?
|
||||
|
||||
* Precedence
|
||||
|
||||
** Partial order
|
||||
It is unfortunate that there is a total order for precedence. It
|
||||
makes it impossible to have modular precedence information. We should
|
||||
move to partial orders (sounds like series/parallel orders to me).
|
||||
|
||||
This is a prerequisite for modules.
|
||||
|
||||
* Pre and post actions.
|
||||
From: Florian Krohm <florian@edamail.fishkill.ibm.com>
|
||||
Subject: YYACT_EPILOGUE
|
||||
To: bug-bison@gnu.org
|
||||
X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
|
||||
|
||||
The other day I had the need for explicitly building the parse tree. I
|
||||
used %locations for that and defined YYLLOC_DEFAULT to call a function
|
||||
that returns the tree node for the production. Easy. But I also needed
|
||||
to assign the S-attribute to the tree node. That cannot be done in
|
||||
YYLLOC_DEFAULT, because it is invoked before the action is executed.
|
||||
The way I solved this was to define a macro YYACT_EPILOGUE that would
|
||||
be invoked after the action. For reasons of symmetry I also added
|
||||
YYACT_PROLOGUE. Although I had no use for that I can envision how it
|
||||
might come in handy for debugging purposes.
|
||||
All is needed is to add
|
||||
|
||||
#if YYLSP_NEEDED
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
|
||||
#else
|
||||
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
|
||||
#endif
|
||||
|
||||
at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
|
||||
|
||||
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
|
||||
to bison. If you're interested, I'll work on a patch.
|
||||
|
||||
* Better graphics
|
||||
Equip the parser with a means to create the (visual) parse tree.
|
||||
|
||||
|
||||
-----
|
||||
|
||||
# LocalWords: Cex gnulib gl Bistromathic TokenKinds yylex enum YYEOF EOF
|
||||
# LocalWords: YYerror gettext af hb YYERRCODE undef calc FIXME dev yyerror
|
||||
# LocalWords: Autoconf YYUNDEFTOK lexemes parsers Bistromathic's yyreport
|
||||
# LocalWords: const argc yacc yyclearin lookahead destructor Rici incluent
|
||||
# LocalWords: yydestruct yydiscardin catégories d'avertissements sr activé
|
||||
# LocalWords: conflits défaut rr l'alias chaîne n'est attaché un symbole
|
||||
# LocalWords: obsolète règle vide midrule valeurs de intermédiaire ou avec
|
||||
# LocalWords: définies inutilisées priorité associativité inutiles POSIX
|
||||
# LocalWords: incompatibilités tous les autres avertissements sauf dans rp
|
||||
# LocalWords: désactiver CATEGORIE traiter comme des erreurs glr Akim bool
|
||||
# LocalWords: Demaille arith lalr goto struct pathlen nullable ntokens lr
|
||||
# LocalWords: nterm bitsetv ielr ritem nstates nrules nritems yysymbol EQ
|
||||
# LocalWords: SymbolKind YYEMPTY YYUNDEF YYTNAME NUM yyntokens yytname sed
|
||||
# LocalWords: nonterminals yykind yycode YYNAMES yynames init getName conv
|
||||
# LocalWords: TokenKind ival yychar yylval yylexer Tolmer hoc
|
||||
# LocalWords: Sobisch YYPTRDIFF ptrdiff Autotest toknum yytoknum
|
||||
# LocalWords: sym Wother stderr FP fixits xgettext fdiagnostics Graphviz
|
||||
# LocalWords: graphviz VCG bitset xml bw maint yytoken YYABORT deps
|
||||
# LocalWords: YYACCEPT yytranslate nonnegative destructors yyerrlab repo
|
||||
# LocalWords: backends stmt expr yy Mardle baz qux Vadim Maslow CPP cpp
|
||||
# LocalWords: yydebug gcc UCHAR EBCDIC gung PDP NUL Pre Florian Krohm utf
|
||||
# LocalWords: YYACT YYLLOC YYLSP yyval yyvsp yylen yyloc yylsp endif
|
||||
# LocalWords: ispell american
|
||||
|
||||
Local Variables:
|
||||
mode: outline
|
||||
coding: utf-8
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2021 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the "GNU Free
|
||||
Documentation License" file as part of this distribution.
|
||||
+1398
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Valgrind suppression file for Bison.
|
||||
|
||||
{
|
||||
Mac OS X initialization
|
||||
Memcheck:Leak
|
||||
fun:?alloc*
|
||||
...
|
||||
fun:*ImageLoader*
|
||||
}
|
||||
|
||||
{
|
||||
Mac OS X initialization
|
||||
Memcheck:Leak
|
||||
fun:?alloc*
|
||||
...
|
||||
fun:*dyld*
|
||||
}
|
||||
|
||||
{
|
||||
Mac OS X initialization
|
||||
Memcheck:Leak
|
||||
fun:?alloc*
|
||||
...
|
||||
fun:__CFInitialize
|
||||
}
|
||||
|
||||
{
|
||||
Mac OS X I/O buffer
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:__smakebuf
|
||||
fun:__swsetup
|
||||
fun:__sfvwrite
|
||||
fun:fwrite
|
||||
}
|
||||
|
||||
{
|
||||
Mac OS X I/O buffer
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:__smakebuf
|
||||
fun:__swsetup
|
||||
fun:__swbuf
|
||||
fun:putchar
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# End:
|
||||
@@ -0,0 +1,61 @@
|
||||
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Valgrind suppression file for Bison.
|
||||
|
||||
# Travis Trusty, 2018-09-07.
|
||||
{
|
||||
libstdcxx_init
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:malloc
|
||||
obj:/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
|
||||
fun:call_init.part.0
|
||||
fun:call_init
|
||||
fun:_dl_init
|
||||
obj:/lib/x86_64-linux-gnu/ld-2.19.so
|
||||
}
|
||||
|
||||
# Linux prague 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015
|
||||
# x86_64 GNU/Linux
|
||||
{
|
||||
Probably exception handling from G++ 5.1.
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:malloc
|
||||
fun:pool
|
||||
fun:__static_initialization_and_destruction_0
|
||||
fun:_GLOBAL__sub_I_eh_alloc.cc
|
||||
fun:call_init.part.0
|
||||
fun:_dl_init
|
||||
obj:/usr/lib/ld-2.21.so
|
||||
}
|
||||
|
||||
# Linux seattle 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012
|
||||
# x86_64 GNU/Linux
|
||||
{
|
||||
index
|
||||
Memcheck:Cond
|
||||
fun:index
|
||||
fun:expand_dynamic_string_token
|
||||
fun:_dl_map_object
|
||||
fun:map_doit
|
||||
fun:_dl_catch_error
|
||||
fun:do_preload
|
||||
fun:dl_main
|
||||
fun:_dl_sysdep_start
|
||||
fun:_dl_start
|
||||
obj:/lib/ld-2.11.3.so
|
||||
}
|
||||
+575
@@ -0,0 +1,575 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Generate a release announcement message.
|
||||
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Jim Meyering
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2021-08-04 09:17'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
my $copyright_year = '2021';
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
|
||||
my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz);
|
||||
my $srcdir = '.';
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
my @types = sort keys %valid_release_types;
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS]
|
||||
Generate an announcement message. Run this from builddir.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
These options must be specified:
|
||||
|
||||
--release-type=TYPE TYPE must be one of @types
|
||||
--package-name=PACKAGE_NAME
|
||||
--previous-version=VER
|
||||
--current-version=VER
|
||||
--gpg-key-id=ID The GnuPG ID of the key used to sign the tarballs
|
||||
--url-directory=URL_DIR
|
||||
|
||||
The following are optional:
|
||||
|
||||
--news=NEWS_FILE include the NEWS section about this release
|
||||
from this NEWS_FILE; accumulates.
|
||||
--srcdir=DIR where to find the NEWS_FILEs (default: $srcdir)
|
||||
--bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g.,
|
||||
autoconf,automake,bison,gnulib
|
||||
--gnulib-version=VERSION report VERSION as the gnulib version, where
|
||||
VERSION is the result of running git describe
|
||||
in the gnulib source directory.
|
||||
required if gnulib is in TOOL_LIST.
|
||||
--no-print-checksums do not emit SHA1 or SHA256 checksums
|
||||
--archive-suffix=SUF add SUF to the list of archive suffixes
|
||||
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
|
||||
To: x\@example.com Cc: y-announce\@example.com,...
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
|
||||
=item C<%size> = C<sizes (@file)>
|
||||
|
||||
Compute the sizes of the C<@file> and return them as a hash. Return
|
||||
C<undef> if one of the computation failed.
|
||||
|
||||
=cut
|
||||
|
||||
sub sizes (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
my $fail = 0;
|
||||
my %res;
|
||||
foreach my $f (@file)
|
||||
{
|
||||
my $cmd = "du -h $f";
|
||||
my $t = `$cmd`;
|
||||
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
|
||||
$@
|
||||
and (warn "command failed: '$cmd'\n"), $fail = 1;
|
||||
chomp $t;
|
||||
$t =~ s/^\s*([\d.]+[MkK]).*/${1}B/;
|
||||
$res{$f} = $t;
|
||||
}
|
||||
return $fail ? undef : %res;
|
||||
}
|
||||
|
||||
=item C<print_locations ($title, \@url, \%size, @file)
|
||||
|
||||
Print a section C<$title> dedicated to the list of <@file>, which
|
||||
sizes are stored in C<%size>, and which are available from the C<@url>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_locations ($\@\%@)
|
||||
{
|
||||
my ($title, $url, $size, @file) = @_;
|
||||
print "Here are the $title:\n";
|
||||
foreach my $url (@{$url})
|
||||
{
|
||||
for my $file (@file)
|
||||
{
|
||||
print " $url/$file";
|
||||
print " (", $$size{$file}, ")"
|
||||
if exists $$size{$file};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
=item C<print_checksums (@file)
|
||||
|
||||
Print the SHA1 and SHA256 signature section for each C<@file>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_checksums (@)
|
||||
{
|
||||
my (@file) = @_;
|
||||
|
||||
print "Here are the SHA1 and SHA256 checksums:\n";
|
||||
print "\n";
|
||||
|
||||
use Digest::file qw(digest_file_hex digest_file_base64);
|
||||
|
||||
foreach my $f (@file)
|
||||
{
|
||||
print digest_file_hex($f, "SHA-1"), " $f\n";
|
||||
print digest_file_base64($f, "SHA-256"), " $f\n";
|
||||
}
|
||||
print "\nThe SHA256 checksum is base64 encoded, instead of the\n";
|
||||
print "hexadecimal encoding that most checksum tools default to.\n\n";
|
||||
}
|
||||
|
||||
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
|
||||
|
||||
Print the section of the NEWS file C<$news_file> addressing changes
|
||||
between versions C<$prev_version> and C<$curr_version>.
|
||||
|
||||
=cut
|
||||
|
||||
sub print_news_deltas ($$$)
|
||||
{
|
||||
my ($news_file, $prev_version, $curr_version) = @_;
|
||||
|
||||
my $news_name = $news_file;
|
||||
$news_name =~ s|^\Q$srcdir\E/||;
|
||||
|
||||
print "\n$news_name\n\n";
|
||||
|
||||
# Print all lines from $news_file, starting with the first one
|
||||
# that mentions $curr_version up to but not including
|
||||
# the first occurrence of $prev_version.
|
||||
my $in_items;
|
||||
|
||||
my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
|
||||
|
||||
my $found_news;
|
||||
open NEWS, '<', $news_file
|
||||
or die "$ME: $news_file: cannot open for reading: $!\n";
|
||||
while (defined (my $line = <NEWS>))
|
||||
{
|
||||
if ( ! $in_items)
|
||||
{
|
||||
# Match lines like these:
|
||||
# * Major changes in release 5.0.1:
|
||||
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
|
||||
or next;
|
||||
$in_items = 1;
|
||||
print $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# This regexp must not match version numbers in NEWS items.
|
||||
# For example, they might well say "introduced in 4.5.5",
|
||||
# and we don't want that to match.
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
|
||||
and last;
|
||||
print $line;
|
||||
$line =~ /\S/
|
||||
and $found_news = 1;
|
||||
}
|
||||
}
|
||||
close NEWS;
|
||||
|
||||
$in_items
|
||||
or die "$ME: $news_file: no matching lines for '$curr_version'\n";
|
||||
$found_news
|
||||
or die "$ME: $news_file: no news item found for '$curr_version'\n";
|
||||
}
|
||||
|
||||
sub print_changelog_deltas ($$)
|
||||
{
|
||||
my ($package_name, $prev_version) = @_;
|
||||
|
||||
# Print new ChangeLog entries.
|
||||
|
||||
# First find all CVS-controlled ChangeLog files.
|
||||
use File::Find;
|
||||
my @changelog;
|
||||
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
|
||||
and push @changelog, $File::Find::name}},
|
||||
'.');
|
||||
|
||||
# If there are no ChangeLog files, we're done.
|
||||
@changelog
|
||||
or return;
|
||||
my %changelog = map {$_ => 1} @changelog;
|
||||
|
||||
# Reorder the list of files so that if there are ChangeLog
|
||||
# files in the specified directories, they're listed first,
|
||||
# in this order:
|
||||
my @dir = qw ( . src lib m4 config doc );
|
||||
|
||||
# A typical @changelog array might look like this:
|
||||
# ./ChangeLog
|
||||
# ./po/ChangeLog
|
||||
# ./m4/ChangeLog
|
||||
# ./lib/ChangeLog
|
||||
# ./doc/ChangeLog
|
||||
# ./config/ChangeLog
|
||||
my @reordered;
|
||||
foreach my $d (@dir)
|
||||
{
|
||||
my $dot_slash = $d eq '.' ? $d : "./$d";
|
||||
my $target = "$dot_slash/ChangeLog";
|
||||
delete $changelog{$target}
|
||||
and push @reordered, $target;
|
||||
}
|
||||
|
||||
# Append any remaining ChangeLog files.
|
||||
push @reordered, sort keys %changelog;
|
||||
|
||||
# Remove leading './'.
|
||||
@reordered = map { s!^\./!!; $_ } @reordered;
|
||||
|
||||
print "\nChangeLog entries:\n\n";
|
||||
# print join ("\n", @reordered), "\n";
|
||||
|
||||
$prev_version =~ s/\./_/g;
|
||||
my $prev_cvs_tag = "\U$package_name\E-$prev_version";
|
||||
|
||||
my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered";
|
||||
open DIFF, '-|', $cmd
|
||||
or die "$ME: cannot run '$cmd': $!\n";
|
||||
# Print two types of lines, making minor changes:
|
||||
# Lines starting with '+++ ', e.g.,
|
||||
# +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247
|
||||
# and those starting with '+'.
|
||||
# Don't print the others.
|
||||
my $prev_printed_line_empty = 1;
|
||||
while (defined (my $line = <DIFF>))
|
||||
{
|
||||
if ($line =~ /^\+\+\+ /)
|
||||
{
|
||||
my $separator = "*"x70 ."\n";
|
||||
$line =~ s///;
|
||||
$line =~ s/\s.*//;
|
||||
$prev_printed_line_empty
|
||||
or print "\n";
|
||||
print $separator, $line, $separator;
|
||||
}
|
||||
elsif ($line =~ /^\+/)
|
||||
{
|
||||
$line =~ s///;
|
||||
print $line;
|
||||
$prev_printed_line_empty = ($line =~ /^$/);
|
||||
}
|
||||
}
|
||||
close DIFF;
|
||||
|
||||
# The exit code should be 1.
|
||||
# Allow in case there are no modified ChangeLog entries.
|
||||
$? == 256 || $? == 128
|
||||
or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n";
|
||||
}
|
||||
|
||||
sub get_tool_versions ($$)
|
||||
{
|
||||
my ($tool_list, $gnulib_version) = @_;
|
||||
@$tool_list
|
||||
or return ();
|
||||
|
||||
my $fail;
|
||||
my @tool_version_pair;
|
||||
foreach my $t (@$tool_list)
|
||||
{
|
||||
if ($t eq 'gnulib')
|
||||
{
|
||||
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
|
||||
next;
|
||||
}
|
||||
# Assume that the last "word" on the first line of
|
||||
# 'tool --version' output is the version string.
|
||||
my ($first_line, undef) = split ("\n", `$t --version`);
|
||||
if ($first_line =~ /.* (\d[\w.-]+)$/)
|
||||
{
|
||||
$t = ucfirst $t;
|
||||
push @tool_version_pair, "$t $1";
|
||||
}
|
||||
else
|
||||
{
|
||||
defined $first_line
|
||||
and $first_line = '';
|
||||
warn "$t: unexpected --version output\n:$first_line";
|
||||
$fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return @tool_version_pair;
|
||||
}
|
||||
|
||||
{
|
||||
# Use the C locale so that, for instance, "du" does not
|
||||
# print "1,2" instead of "1.2", which would confuse our regexps.
|
||||
$ENV{LC_ALL} = "C";
|
||||
|
||||
my $mail_headers;
|
||||
my $release_type;
|
||||
my $package_name;
|
||||
my $prev_version;
|
||||
my $curr_version;
|
||||
my $gpg_key_id;
|
||||
my @url_dir_list;
|
||||
my @news_file;
|
||||
my $bootstrap_tools;
|
||||
my $gnulib_version;
|
||||
my $print_checksums_p = 1;
|
||||
|
||||
# Reformat the warnings before displaying them.
|
||||
local $SIG{__WARN__} = sub
|
||||
{
|
||||
my ($msg) = @_;
|
||||
# Warnings from GetOptions.
|
||||
$msg =~ s/Option (\w)/option --$1/;
|
||||
warn "$ME: $msg";
|
||||
};
|
||||
|
||||
GetOptions
|
||||
(
|
||||
'mail-headers=s' => \$mail_headers,
|
||||
'release-type=s' => \$release_type,
|
||||
'package-name=s' => \$package_name,
|
||||
'previous-version=s' => \$prev_version,
|
||||
'current-version=s' => \$curr_version,
|
||||
'gpg-key-id=s' => \$gpg_key_id,
|
||||
'url-directory=s' => \@url_dir_list,
|
||||
'news=s' => \@news_file,
|
||||
'srcdir=s' => \$srcdir,
|
||||
'bootstrap-tools=s' => \$bootstrap_tools,
|
||||
'gnulib-version=s' => \$gnulib_version,
|
||||
'print-checksums!' => \$print_checksums_p,
|
||||
'archive-suffix=s' => \@archive_suffixes,
|
||||
|
||||
help => sub { usage 0 },
|
||||
version =>
|
||||
sub
|
||||
{
|
||||
print "$ME version $VERSION\n";
|
||||
print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
|
||||
print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
|
||||
. "This is free software: you are free to change and redistribute it.\n"
|
||||
. "There is NO WARRANTY, to the extent permitted by law.\n";
|
||||
print "\n";
|
||||
my $author = "Jim Meyering";
|
||||
print "Written by $author.\n";
|
||||
exit
|
||||
},
|
||||
) or usage 1;
|
||||
|
||||
my $fail = 0;
|
||||
# Ensure that each required option is specified.
|
||||
$release_type
|
||||
or (warn "release type not specified\n"), $fail = 1;
|
||||
$package_name
|
||||
or (warn "package name not specified\n"), $fail = 1;
|
||||
$prev_version
|
||||
or (warn "previous version string not specified\n"), $fail = 1;
|
||||
$curr_version
|
||||
or (warn "current version string not specified\n"), $fail = 1;
|
||||
$gpg_key_id
|
||||
or (warn "GnuPG key ID not specified\n"), $fail = 1;
|
||||
@url_dir_list
|
||||
or (warn "URL directory name(s) not specified\n"), $fail = 1;
|
||||
|
||||
my @tool_list = split ',', $bootstrap_tools
|
||||
if $bootstrap_tools;
|
||||
|
||||
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
|
||||
and (warn "when specifying gnulib as a tool, you must also specify\n"
|
||||
. "--gnulib-version=V, where V is the result of running git describe\n"
|
||||
. "in the gnulib source directory.\n"), $fail = 1;
|
||||
|
||||
!$release_type || exists $valid_release_types{$release_type}
|
||||
or (warn "'$release_type': invalid release type\n"), $fail = 1;
|
||||
|
||||
@ARGV
|
||||
and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"),
|
||||
$fail = 1;
|
||||
$fail
|
||||
and usage 1;
|
||||
|
||||
my $my_distdir = "$package_name-$curr_version";
|
||||
|
||||
my $xd = "$package_name-$prev_version-$curr_version.xdelta";
|
||||
|
||||
my @candidates = map { "$my_distdir.$_" } @archive_suffixes;
|
||||
my @tarballs = grep {-f $_} @candidates;
|
||||
|
||||
@tarballs
|
||||
or die "$ME: none of " . join(', ', @candidates) . " were found\n";
|
||||
my @sizable = @tarballs;
|
||||
-f $xd
|
||||
and push @sizable, $xd;
|
||||
my %size = sizes (@sizable);
|
||||
%size
|
||||
or exit 1;
|
||||
|
||||
my $headers = '';
|
||||
if (defined $mail_headers)
|
||||
{
|
||||
($headers = $mail_headers) =~ s/\s+(\S+:)/\n$1/g;
|
||||
$headers .= "\n";
|
||||
}
|
||||
|
||||
# The markup is escaped as <\# so that when this script is sent by
|
||||
# mail (or part of a diff), Gnus is not triggered.
|
||||
print <<EOF;
|
||||
|
||||
${headers}Subject: $my_distdir released [$release_type]
|
||||
|
||||
<\#secure method=pgpmime mode=sign>
|
||||
|
||||
FIXME: put comments here
|
||||
|
||||
EOF
|
||||
|
||||
if (@url_dir_list == 1 && @tarballs == 1)
|
||||
{
|
||||
# When there's only one tarball and one URL, use a more concise form.
|
||||
my $m = "$url_dir_list[0]/$tarballs[0]";
|
||||
print "Here are the compressed sources and a GPG detached signature[*]:\n"
|
||||
. " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
}
|
||||
|
||||
if ($url_dir_list[0] =~ "gnu\.org")
|
||||
{
|
||||
print "Use a mirror for higher download bandwidth:\n";
|
||||
if (@tarballs == 1 && $url_dir_list[0] =~ m!https://ftp\.gnu\.org/gnu/!)
|
||||
{
|
||||
(my $m = "$url_dir_list[0]/$tarballs[0]")
|
||||
=~ s!https://ftp\.gnu\.org/gnu/!https://ftpmirror\.gnu\.org/!;
|
||||
print " $m\n"
|
||||
. " $m.sig\n\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print " https://www.gnu.org/order/ftp.html\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
$print_checksums_p
|
||||
and print_checksums (@sizable);
|
||||
|
||||
print <<EOF;
|
||||
[*] Use a .sig file to verify that the corresponding file (without the
|
||||
.sig suffix) is intact. First, be sure to download both the .sig file
|
||||
and the corresponding tarball. Then, run a command like this:
|
||||
|
||||
gpg --verify $tarballs[0].sig
|
||||
|
||||
If that command fails because you don't have the required public key,
|
||||
then run this command to import it:
|
||||
|
||||
gpg --keyserver keys.gnupg.net --recv-keys $gpg_key_id
|
||||
|
||||
and rerun the 'gpg --verify' command.
|
||||
EOF
|
||||
|
||||
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);
|
||||
@tool_versions
|
||||
and print "\nThis release was bootstrapped with the following tools:",
|
||||
join ('', map {"\n $_"} @tool_versions), "\n";
|
||||
|
||||
print_news_deltas ($_, $prev_version, $curr_version)
|
||||
foreach @news_file;
|
||||
|
||||
$release_type eq 'stable'
|
||||
or print_changelog_deltas ($package_name, $prev_version);
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||
## Local Variables:
|
||||
## mode: perl
|
||||
## perl-indent-level: 2
|
||||
## perl-continued-statement-offset: 2
|
||||
## perl-continued-brace-offset: 0
|
||||
## perl-brace-offset: 0
|
||||
## perl-brace-imaginary-offset: 0
|
||||
## perl-label-offset: -2
|
||||
## perl-extra-newline-before-brace: t
|
||||
## perl-merge-trailing-else: nil
|
||||
## eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
## time-stamp-line-limit: 50
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
+348
@@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN* | MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+1748
File diff suppressed because it is too large
Load Diff
+152
@@ -0,0 +1,152 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable at run time.
|
||||
#
|
||||
# Copyright 1996-2021 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2003
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variable LD should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
shlibpath_var=
|
||||
case $host_os in
|
||||
aix3*)
|
||||
shlibpath_var=LIBPATH
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# AIX 5 supports IA64
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
else
|
||||
shlibpath_var=LIBPATH
|
||||
fi
|
||||
;;
|
||||
beos*)
|
||||
shlibpath_var=LIBRARY_PATH
|
||||
;;
|
||||
bsdi[45]*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: first we should search . and the directory the executable is in
|
||||
shlibpath_var=PATH
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shlibpath_var=DYLD_LIBRARY_PATH
|
||||
;;
|
||||
dgux*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
freebsd* | dragonfly* | midnightbsd*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
gnu*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case "$host_cpu" in
|
||||
ia64* | hppa*64*) shlibpath_var=LD_LIBRARY_PATH ;;
|
||||
*) shlibpath_var=SHLIB_PATH ;;
|
||||
esac
|
||||
;;
|
||||
interix[3-9]*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
case $host_os in
|
||||
irix5* | nonstopux*)
|
||||
shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in # libtool.m4 will add one of these switches to LD
|
||||
*-32|*"-32 ") shlibsuff= ;;
|
||||
*-n32|*"-n32 ") shlibsuff=N32 ;;
|
||||
*-64|*"-64 ") shlibsuff=64 ;;
|
||||
*) shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
netbsd*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
newsos6)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
nto-qnx*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
openbsd*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
os2*)
|
||||
shlibpath_var=LIBPATH
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
sunos4*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec ;then
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
uts4*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
esac
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# This is the shared library path variable.
|
||||
shlibpath_var=$shlibpath_var
|
||||
|
||||
EOF
|
||||
+684
@@ -0,0 +1,684 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2021 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a '.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
case $cc_basename in
|
||||
ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
icc* | ifort*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
lf95*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
nagfor*)
|
||||
wl='-Wl,-Wl,,'
|
||||
;;
|
||||
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
xl* | bgxl* | bgf* | mpixl*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ F* | *Sun*Fortran*)
|
||||
wl=
|
||||
;;
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
case $cc_basename in
|
||||
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
haiku*)
|
||||
;;
|
||||
interix[3-9]*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
:
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd2.[01]*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | dragonfly* | midnightbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix[4-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
m68k)
|
||||
library_names_spec='$libname.a' ;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd[23].*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
freebsd* | dragonfly* | midnightbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
haiku*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix[3-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
tpf*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
||||
+1884
File diff suppressed because it is too large
Load Diff
+104
@@ -0,0 +1,104 @@
|
||||
#! /usr/bin/env perl
|
||||
|
||||
# Generate a release announcement message.
|
||||
|
||||
# Copyright (C) 2007-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Akim Demaille.
|
||||
|
||||
use warnings;
|
||||
use 5.005;
|
||||
use strict;
|
||||
|
||||
my %option;
|
||||
my %directive;
|
||||
my $scanner = `grep -i '"%[a-z]' $ARGV[0]`;
|
||||
$scanner =~ s/"\[-_\]"/-/g;
|
||||
while (<STDIN>)
|
||||
{
|
||||
if (/^\s* # Initial spaces.
|
||||
(?:(-\w),\s+)? # $1: $short: Possible short option.
|
||||
(--[-\w]+) # $2: $long: Mandatory long option.
|
||||
(\[?) # $3: $opt: '[' iff the argument is optional.
|
||||
(?:=(\S+))? # $4: $arg: Possible argument name.
|
||||
\s # Spaces.
|
||||
/x)
|
||||
{
|
||||
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
||||
$short = '' if ! defined $short;
|
||||
$short = '-d' if $long eq '--defines' && ! $short;
|
||||
my $dir = '%' . substr($long, 2);
|
||||
if (index ($scanner, "\"$dir\"") < 0)
|
||||
{
|
||||
if ($long eq '--force-define') { $dir = '%define'; }
|
||||
else { $dir = ''; }
|
||||
}
|
||||
if ($arg)
|
||||
{
|
||||
# if $opt, $arg contains the closing ].
|
||||
substr ($arg, -1) = ''
|
||||
if $opt eq '[';
|
||||
$arg = lc ($arg);
|
||||
my $dir_arg = $arg;
|
||||
# If the argument is complete (e.g., for --define[=NAME[=VALUE]]),
|
||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||
# @var{name[=value]}].
|
||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||
my $long_arg = "=$arg";
|
||||
if ($opt eq '[') {
|
||||
$long_arg = "[$long_arg]";
|
||||
$arg = "[$arg]";
|
||||
}
|
||||
# For arguments of directives: this only works if all arguments
|
||||
# are strings and have the same syntax as on the command line.
|
||||
if ($dir_arg eq 'name[=value]')
|
||||
{
|
||||
# -D/-F do not add quotes to the argument.
|
||||
$dir_arg =
|
||||
$dir eq "%define"
|
||||
? '@var{name} [@var{value}]'
|
||||
: '@var{name} ["@var{value}"]';
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
||||
$dir_arg = '[' . $dir_arg . ']'
|
||||
if $opt eq '[';
|
||||
}
|
||||
$long = "$long$long_arg";
|
||||
$short = "$short $arg" if $short && $short ne '-d';
|
||||
$dir = "$dir $dir_arg" if $dir;
|
||||
}
|
||||
$option{$long} = $short;
|
||||
$directive{$long} = $dir;
|
||||
}
|
||||
}
|
||||
|
||||
my $sep = '';
|
||||
foreach my $long (sort keys %option)
|
||||
{
|
||||
# Couldn't find a means to escape @ in the format (for @item, @tab), so
|
||||
# pass it as a literal to print.
|
||||
format STDOUT =
|
||||
@item @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @tab @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
{
|
||||
'@', '@option{' . $long . '}',
|
||||
'@', $option{$long} ? ('@option{' . $option{$long} . '}') : '',
|
||||
'@', $directive{$long} ? ('@code{' . $directive{$long} . '}') : ''
|
||||
}
|
||||
.
|
||||
write;
|
||||
}
|
||||
+791
@@ -0,0 +1,791 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,179 @@
|
||||
#!/bin/sh
|
||||
# In a git/autoconf/automake-enabled project with a NEWS file and a version-
|
||||
# controlled .prev-version file, automate the procedure by which we record
|
||||
# the date, release-type and version string in the NEWS file. That commit
|
||||
# will serve to identify the release, so apply a signed tag to it as well.
|
||||
VERSION=2018-03-07.03 # UTC
|
||||
|
||||
# Note: this is a bash script (could be zsh or dash)
|
||||
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Jim Meyering
|
||||
|
||||
ME=$(basename "$0")
|
||||
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
|
||||
die() { warn "$*"; exit 1; }
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $ME [OPTION...] VERSION RELEASE_TYPE
|
||||
|
||||
Run this script from top_srcdir to perform the final pre-release NEWS
|
||||
update in which the date, release-type and version string are
|
||||
recorded. Commit that result with a log entry marking the release,
|
||||
and apply a signed tag. Run it from your project's top-level
|
||||
directory.
|
||||
|
||||
Requirements:
|
||||
- you use git for version-control
|
||||
- a version-controlled .prev-version file
|
||||
- a NEWS file, with line 3 identical to this:
|
||||
$noteworthy_stub
|
||||
|
||||
Options:
|
||||
--branch=BRANCH set release branch (default: $branch)
|
||||
-C, --builddir=DIR location of (configured) Makefile (default: $builddir)
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
EXAMPLE:
|
||||
To update NEWS and tag the beta 8.1 release of coreutils, I would run this:
|
||||
|
||||
$ME 8.1 beta
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
version()
|
||||
{
|
||||
year=$(echo "$VERSION" | sed 's/[^0-9].*//')
|
||||
cat <<EOF
|
||||
$ME $VERSION
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
## ------ ##
|
||||
## Main. ##
|
||||
## ------ ##
|
||||
|
||||
# Constants.
|
||||
noteworthy='* Noteworthy changes in release'
|
||||
noteworthy_stub="$noteworthy ?.? (????-??-??) [?]"
|
||||
|
||||
# Variables.
|
||||
branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
|
||||
builddir=.
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
# Handle --option=value by splitting apart and putting back on argv.
|
||||
case $1 in
|
||||
--*=*)
|
||||
opt=$(echo "$1" | sed -e 's/=.*//')
|
||||
val=$(echo "$1" | sed -e 's/[^=]*=//')
|
||||
shift
|
||||
set dummy "$opt" "$val" "$@"; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help|--version) ${1#--};;
|
||||
--branch) shift; branch=$1; shift ;;
|
||||
-C|--builddir) shift; builddir=$1; shift ;;
|
||||
--*) die "unrecognized option: $1";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
test $# = 2 \
|
||||
|| die "Usage: $ME [OPTION...] VERSION TYPE"
|
||||
|
||||
ver=$1
|
||||
type=$2
|
||||
|
||||
|
||||
## ---------------------- ##
|
||||
## First, sanity checks. ##
|
||||
## ---------------------- ##
|
||||
|
||||
# Verify that $ver looks like a version number, and...
|
||||
echo "$ver"|grep -E '^[0-9][0-9.]*[0-9]$' > /dev/null \
|
||||
|| die "invalid version: $ver"
|
||||
prev_ver=$(cat .prev-version) \
|
||||
|| die 'failed to determine previous version number from .prev-version'
|
||||
|
||||
# Verify that $ver is sensible (> .prev-version).
|
||||
case $(printf "$prev_ver\n$ver\n"|sort -V -u|tr '\n' ':') in
|
||||
"$prev_ver:$ver:") ;;
|
||||
*) die "invalid version: $ver (<= $prev_ver)";;
|
||||
esac
|
||||
|
||||
case $type in
|
||||
alpha|beta|stable) ;;
|
||||
*) die "invalid release type: $type";;
|
||||
esac
|
||||
|
||||
# No local modifications allowed.
|
||||
case $(git diff-index --name-only HEAD) in
|
||||
'') ;;
|
||||
*) die 'this tree is dirty; commit your changes first';;
|
||||
esac
|
||||
|
||||
# Ensure the current branch name is correct:
|
||||
curr_br=$(git rev-parse --symbolic-full-name HEAD)
|
||||
test "$curr_br" = "refs/heads/$branch" || die not on branch $branch
|
||||
|
||||
# Extract package name from Makefile.
|
||||
Makefile=$builddir/Makefile
|
||||
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' "$Makefile") \
|
||||
|| die "failed to determine package name from $Makefile"
|
||||
|
||||
# Check that line 3 of NEWS is the stub line about to be replaced.
|
||||
test "$(sed -n 3p NEWS)" = "$noteworthy_stub" \
|
||||
|| die "line 3 of NEWS must be exactly '$noteworthy_stub'"
|
||||
|
||||
## --------------- ##
|
||||
## Then, changes. ##
|
||||
## --------------- ##
|
||||
|
||||
# Update NEWS to have today's date, plus desired version number and $type.
|
||||
perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
|
||||
-e 'my ($type, $ver) = qw('"$type $ver"');' \
|
||||
-e 'my $pfx = "'"$noteworthy"'";' \
|
||||
-e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
|
||||
NEWS || die 'failed to update NEWS'
|
||||
|
||||
printf "version $ver\n\n* NEWS: Record release date.\n" \
|
||||
| git commit -F - -a || die 'git commit failed'
|
||||
git tag -s -m "$pkg $ver" v$ver HEAD || die 'git tag failed'
|
||||
|
||||
# Local variables:
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "VERSION="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: " # UTC"
|
||||
# End:
|
||||
+510
@@ -0,0 +1,510 @@
|
||||
#!/bin/sh -e
|
||||
# gendocs.sh -- generate a GNU manual in many formats. This script is
|
||||
# mentioned in maintain.texi. See the help message below for usage details.
|
||||
|
||||
scriptversion=2021-07-19.18
|
||||
|
||||
# Copyright 2003-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Original author: Mohit Agarwal.
|
||||
# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
|
||||
#
|
||||
# The latest version of this script, and the companion template, is
|
||||
# available from the Gnulib repository:
|
||||
#
|
||||
# https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
|
||||
# https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
|
||||
|
||||
# TODO:
|
||||
# - image importing was only implemented for HTML generated by
|
||||
# makeinfo. But it should be simple enough to adjust.
|
||||
# - images are not imported in the source tarball. All the needed
|
||||
# formats (PDF, PNG, etc.) should be included.
|
||||
|
||||
prog=`basename "$0"`
|
||||
srcdir=`pwd`
|
||||
|
||||
scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
|
||||
templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
|
||||
|
||||
: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
|
||||
: ${MAKEINFO="makeinfo"}
|
||||
: ${TEXI2DVI="texi2dvi"}
|
||||
: ${DOCBOOK2HTML="docbook2html"}
|
||||
: ${DOCBOOK2PDF="docbook2pdf"}
|
||||
: ${DOCBOOK2TXT="docbook2txt"}
|
||||
: ${GENDOCS_TEMPLATE_DIR="."}
|
||||
: ${PERL='perl'}
|
||||
: ${TEXI2HTML="texi2html"}
|
||||
unset CDPATH
|
||||
unset use_texi2html
|
||||
|
||||
MANUAL_TITLE=
|
||||
PACKAGE=
|
||||
EMAIL=webmasters@gnu.org # please override with --email
|
||||
commonarg= # passed to all makeinfo/texi2html invcations.
|
||||
dirargs= # passed to all tools (-I dir).
|
||||
dirs= # -I directories.
|
||||
htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
|
||||
default_htmlarg=true
|
||||
infoarg=--no-split
|
||||
generate_ascii=true
|
||||
generate_html=true
|
||||
generate_info=true
|
||||
generate_tex=true
|
||||
outdir=manual
|
||||
source_extra=
|
||||
split=node
|
||||
srcfile=
|
||||
texarg="-t @finalout"
|
||||
|
||||
version="gendocs.sh $scriptversion
|
||||
|
||||
Copyright 2021 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING."
|
||||
|
||||
usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
|
||||
|
||||
Generate output in various formats from PACKAGE.texinfo (or .texi or
|
||||
.txi) source. See the GNU Maintainers document for a more extensive
|
||||
discussion:
|
||||
https://www.gnu.org/prep/maintain_toc.html
|
||||
|
||||
Options:
|
||||
--email ADR use ADR as contact in generated web pages; always give this.
|
||||
|
||||
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
|
||||
-o OUTDIR write files into OUTDIR, instead of manual/.
|
||||
-I DIR append DIR to the Texinfo search path.
|
||||
--common ARG pass ARG in all invocations.
|
||||
--html ARG pass ARG to makeinfo or texi2html for HTML targets,
|
||||
instead of '$htmlarg'.
|
||||
--info ARG pass ARG to makeinfo for Info, instead of --no-split.
|
||||
--no-ascii skip generating the plain text output.
|
||||
--no-html skip generating the html output.
|
||||
--no-info skip generating the info output.
|
||||
--no-tex skip generating the dvi and pdf output.
|
||||
--source ARG include ARG in tar archive of sources.
|
||||
--split HOW make split HTML by node, section, chapter; default node.
|
||||
--tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
|
||||
|
||||
--texi2html use texi2html to make HTML target, with all split versions.
|
||||
--docbook convert through DocBook too (xml, txt, html, pdf).
|
||||
|
||||
--help display this help and exit successfully.
|
||||
--version display version information and exit successfully.
|
||||
|
||||
Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
|
||||
|
||||
Typical sequence:
|
||||
cd PACKAGESOURCE/doc
|
||||
wget \"$scripturl\"
|
||||
wget \"$templateurl\"
|
||||
$prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
|
||||
|
||||
Output will be in a new subdirectory \"manual\" (by default;
|
||||
use -o OUTDIR to override). Move all the new files into your web CVS
|
||||
tree, as explained in the Web Pages node of maintain.texi.
|
||||
|
||||
Please use the --email ADDRESS option so your own bug-reporting
|
||||
address will be used in the generated HTML pages.
|
||||
|
||||
MANUAL-TITLE is included as part of the HTML <title> of the overall
|
||||
manual/index.html file. It should include the name of the package being
|
||||
documented. manual/index.html is created by substitution from the file
|
||||
$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
|
||||
generic template for your own purposes.)
|
||||
|
||||
If you have several manuals, you'll need to run this script several
|
||||
times with different MANUAL values, specifying a different output
|
||||
directory with -o each time. Then write (by hand) an overall index.html
|
||||
with links to them all.
|
||||
|
||||
If a manual's Texinfo sources are spread across several directories,
|
||||
first copy or symlink all Texinfo sources into a single directory.
|
||||
(Part of the script's work is to make a tar.gz of the sources.)
|
||||
|
||||
As implied above, by default monolithic Info files are generated.
|
||||
If you want split Info, or other Info options, use --info to override.
|
||||
|
||||
You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
|
||||
and PERL to control the programs that get executed, and
|
||||
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
|
||||
looked for. With --docbook, the environment variables DOCBOOK2HTML,
|
||||
DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
|
||||
|
||||
By default, makeinfo and texi2dvi are run in the default (English)
|
||||
locale, since that's the language of most Texinfo manuals. If you
|
||||
happen to have a non-English manual and non-English web site, see the
|
||||
SETLANG setting in the source.
|
||||
|
||||
Email bug reports or enhancement requests to bug-gnulib@gnu.org.
|
||||
"
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
-s) shift; srcfile=$1;;
|
||||
-o) shift; outdir=$1;;
|
||||
-I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
|
||||
--common) shift; commonarg=$1;;
|
||||
--docbook) docbook=yes;;
|
||||
--email) shift; EMAIL=$1;;
|
||||
--html) shift; default_htmlarg=false; htmlarg=$1;;
|
||||
--info) shift; infoarg=$1;;
|
||||
--no-ascii) generate_ascii=false;;
|
||||
--no-html) generate_ascii=false;;
|
||||
--no-info) generate_info=false;;
|
||||
--no-tex) generate_tex=false;;
|
||||
--source) shift; source_extra=$1;;
|
||||
--split) shift; split=$1;;
|
||||
--tex) shift; texarg=$1;;
|
||||
--texi2html) use_texi2html=1;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
-*)
|
||||
echo "$0: Unknown option \`$1'." >&2
|
||||
echo "$0: Try \`--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test -z "$PACKAGE"; then
|
||||
PACKAGE=$1
|
||||
elif test -z "$MANUAL_TITLE"; then
|
||||
MANUAL_TITLE=$1
|
||||
else
|
||||
echo "$0: extra non-option argument \`$1'." >&2
|
||||
exit 1
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# makeinfo uses the dirargs, but texi2dvi doesn't.
|
||||
commonarg=" $dirargs $commonarg"
|
||||
|
||||
# For most of the following, the base name is just $PACKAGE
|
||||
base=$PACKAGE
|
||||
|
||||
if $default_htmlarg && test -n "$use_texi2html"; then
|
||||
# The legacy texi2html doesn't support TOP_NODE_UP_URL
|
||||
htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css"
|
||||
fi
|
||||
|
||||
if test -n "$srcfile"; then
|
||||
# but here, we use the basename of $srcfile
|
||||
base=`basename "$srcfile"`
|
||||
case $base in
|
||||
*.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
|
||||
esac
|
||||
PACKAGE=$base
|
||||
elif test -s "$srcdir/$PACKAGE.texinfo"; then
|
||||
srcfile=$srcdir/$PACKAGE.texinfo
|
||||
elif test -s "$srcdir/$PACKAGE.texi"; then
|
||||
srcfile=$srcdir/$PACKAGE.texi
|
||||
elif test -s "$srcdir/$PACKAGE.txi"; then
|
||||
srcfile=$srcdir/$PACKAGE.txi
|
||||
else
|
||||
echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
|
||||
echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
|
||||
echo "$0: it is available from $templateurl." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to return size of $1 in something resembling kilobytes.
|
||||
calcsize()
|
||||
{
|
||||
size=`ls -ksl $1 | awk '{print $1}'`
|
||||
echo $size
|
||||
}
|
||||
|
||||
# copy_images OUTDIR HTML-FILE...
|
||||
# -------------------------------
|
||||
# Copy all the images needed by the HTML-FILEs into OUTDIR.
|
||||
# Look for them in . and the -I directories; this is simpler than what
|
||||
# makeinfo supports with -I, but hopefully it will suffice.
|
||||
copy_images()
|
||||
{
|
||||
local odir
|
||||
odir=$1
|
||||
shift
|
||||
$PERL -n -e "
|
||||
BEGIN {
|
||||
\$me = '$prog';
|
||||
\$odir = '$odir';
|
||||
@dirs = qw(. $dirs);
|
||||
}
|
||||
" -e '
|
||||
/<img src="(.*?)"/g && ++$need{$1};
|
||||
|
||||
END {
|
||||
#print "$me: @{[keys %need]}\n"; # for debugging, show images found.
|
||||
FILE: for my $f (keys %need) {
|
||||
for my $d (@dirs) {
|
||||
if (-f "$d/$f") {
|
||||
use File::Basename;
|
||||
my $dest = dirname ("$odir/$f");
|
||||
#
|
||||
use File::Path;
|
||||
-d $dest || mkpath ($dest)
|
||||
|| die "$me: cannot mkdir $dest: $!\n";
|
||||
#
|
||||
use File::Copy;
|
||||
copy ("$d/$f", $dest)
|
||||
|| die "$me: cannot copy $d/$f to $dest: $!\n";
|
||||
next FILE;
|
||||
}
|
||||
}
|
||||
die "$me: $ARGV: cannot find image $f\n";
|
||||
}
|
||||
}
|
||||
' -- "$@" || exit 1
|
||||
}
|
||||
|
||||
case $outdir in
|
||||
/*) abs_outdir=$outdir;;
|
||||
*) abs_outdir=$srcdir/$outdir;;
|
||||
esac
|
||||
|
||||
echo "Making output for $srcfile"
|
||||
echo " in `pwd`"
|
||||
mkdir -p "$outdir/"
|
||||
|
||||
#
|
||||
if $generate_info; then
|
||||
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
|
||||
echo "Generating info... ($cmd)"
|
||||
rm -f $PACKAGE.info* # get rid of any strays
|
||||
eval "$cmd"
|
||||
tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
|
||||
ls -l "$outdir/$PACKAGE.info.tar.gz"
|
||||
info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
|
||||
# do not mv the info files, there's no point in having them available
|
||||
# separately on the web.
|
||||
fi # end info
|
||||
|
||||
#
|
||||
if $generate_tex; then
|
||||
cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
|
||||
printf "\nGenerating dvi... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
# compress/finish dvi:
|
||||
gzip -f -9 $PACKAGE.dvi
|
||||
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
|
||||
mv $PACKAGE.dvi.gz "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.dvi.gz"
|
||||
|
||||
cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
|
||||
printf "\nGenerating pdf... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
pdf_size=`calcsize $PACKAGE.pdf`
|
||||
mv $PACKAGE.pdf "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.pdf"
|
||||
fi # end tex (dvi + pdf)
|
||||
|
||||
#
|
||||
if $generate_ascii; then
|
||||
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating ascii... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
ascii_size=`calcsize $PACKAGE.txt`
|
||||
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
|
||||
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
|
||||
mv $PACKAGE.txt "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
|
||||
fi
|
||||
|
||||
#
|
||||
|
||||
if $generate_html; then
|
||||
# Split HTML at level $1. Used for texi2html.
|
||||
html_split()
|
||||
{
|
||||
opt="--split=$1 --node-files $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
|
||||
printf "\nGenerating html by $1... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
(
|
||||
cd ${split_html_dir} || exit 1
|
||||
ln -sf ${PACKAGE}.html index.html
|
||||
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
|
||||
)
|
||||
eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
|
||||
rm -f "$outdir"/html_$1/*.html
|
||||
mkdir -p "$outdir/html_$1/"
|
||||
mv ${split_html_dir}/*.html "$outdir/html_$1/"
|
||||
rmdir ${split_html_dir}
|
||||
}
|
||||
|
||||
if test -z "$use_texi2html"; then
|
||||
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating monolithic html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
|
||||
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
|
||||
copy_images "$outdir/" $PACKAGE.html
|
||||
mv $PACKAGE.html "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
|
||||
|
||||
# Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
|
||||
# it just always split by node. So if we're splitting by node anyway,
|
||||
# leave it out.
|
||||
if test "x$split" = xnode; then
|
||||
split_arg=
|
||||
else
|
||||
split_arg=--split=$split
|
||||
fi
|
||||
#
|
||||
opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating html by $split... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
copy_images $split_html_dir/ $split_html_dir/*.html
|
||||
(
|
||||
cd $split_html_dir || exit 1
|
||||
tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
|
||||
)
|
||||
eval \
|
||||
html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
|
||||
rm -rf "$outdir/html_$split/"
|
||||
mv $split_html_dir "$outdir/html_$split/"
|
||||
du -s "$outdir/html_$split/"
|
||||
ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
|
||||
|
||||
else # use texi2html:
|
||||
opt="--output $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
|
||||
printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
|
||||
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
|
||||
mv $PACKAGE.html "$outdir/"
|
||||
|
||||
html_split node
|
||||
html_split chapter
|
||||
html_split section
|
||||
fi
|
||||
fi # end html
|
||||
|
||||
#
|
||||
printf "\nMaking .tar.gz for sources...\n"
|
||||
d=`dirname $srcfile`
|
||||
(
|
||||
cd "$d"
|
||||
srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
|
||||
tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
|
||||
ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
|
||||
)
|
||||
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
|
||||
|
||||
#
|
||||
# Do everything again through docbook.
|
||||
if test -n "$docbook"; then
|
||||
opt="-o - --docbook $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
|
||||
printf "\nGenerating docbook XML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_xml_size=`calcsize $PACKAGE-db.xml`
|
||||
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
|
||||
docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
|
||||
mv $PACKAGE-db.xml "$outdir/"
|
||||
|
||||
split_html_db_dir=html_node_db
|
||||
opt="$commonarg -o $split_html_db_dir"
|
||||
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook HTML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
(
|
||||
cd ${split_html_db_dir} || exit 1
|
||||
tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
|
||||
)
|
||||
html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
|
||||
rm -f "$outdir"/html_node_db/*.html
|
||||
mkdir -p "$outdir/html_node_db"
|
||||
mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
|
||||
rmdir ${split_html_db_dir}
|
||||
|
||||
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook ASCII... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
|
||||
mv $PACKAGE-db.txt "$outdir/"
|
||||
|
||||
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
|
||||
printf "\nGenerating docbook PDF... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
|
||||
mv $PACKAGE-db.pdf "$outdir/"
|
||||
fi
|
||||
|
||||
#
|
||||
printf "\nMaking index.html for $PACKAGE...\n"
|
||||
if test -z "$use_texi2html"; then
|
||||
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
|
||||
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
|
||||
else
|
||||
# should take account of --split here.
|
||||
CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
|
||||
fi
|
||||
|
||||
curdate=`$SETLANG date '+%B %d, %Y'`
|
||||
sed \
|
||||
-e "s!%%TITLE%%!$MANUAL_TITLE!g" \
|
||||
-e "s!%%EMAIL%%!$EMAIL!g" \
|
||||
-e "s!%%PACKAGE%%!$PACKAGE!g" \
|
||||
-e "s!%%DATE%%!$curdate!g" \
|
||||
-e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
|
||||
-e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
|
||||
-e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
|
||||
-e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
|
||||
-e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
|
||||
-e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
|
||||
-e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
|
||||
-e "s!%%PDF_SIZE%%!$pdf_size!g" \
|
||||
-e "s!%%ASCII_SIZE%%!$ascii_size!g" \
|
||||
-e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
|
||||
-e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
|
||||
-e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
|
||||
-e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
|
||||
-e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
|
||||
-e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
|
||||
-e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
|
||||
-e "s,%%SCRIPTURL%%,$scripturl,g" \
|
||||
-e "s!%%SCRIPTNAME%%!$prog!g" \
|
||||
-e "$CONDS" \
|
||||
$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
|
||||
|
||||
echo "Done, see $outdir/ subdirectory for new files."
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
#!/bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2019-10-13.15; # UTC
|
||||
|
||||
# Copyright (C) 2007-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/.
|
||||
# It may be run two ways:
|
||||
# - from a git repository in which the "git describe" command below
|
||||
# produces useful output (thus requiring at least one signed tag)
|
||||
# - from a non-git-repo directory containing a .tarball-version file, which
|
||||
# presumes this script is invoked like "./git-version-gen .tarball-version".
|
||||
|
||||
# In order to use intra-version strings in your project, you will need two
|
||||
# separate generated version string files:
|
||||
#
|
||||
# .tarball-version - present only in a distribution tarball, and not in
|
||||
# a checked-out repository. Created with contents that were learned at
|
||||
# the last time autoconf was run, and used by git-version-gen. Must not
|
||||
# be present in either $(srcdir) or $(builddir) for git-version-gen to
|
||||
# give accurate answers during normal development with a checked out tree,
|
||||
# but must be present in a tarball when there is no version control system.
|
||||
# Therefore, it cannot be used in any dependencies. GNUmakefile has
|
||||
# hooks to force a reconfigure at distribution time to get the value
|
||||
# correct, without penalizing normal development with extra reconfigures.
|
||||
#
|
||||
# .version - present in a checked-out repository and in a distribution
|
||||
# tarball. Usable in dependencies, particularly for files that don't
|
||||
# want to depend on config.h but do want to track version changes.
|
||||
# Delete this file prior to any autoconf run where you want to rebuild
|
||||
# files to pick up a version string change; and leave it stale to
|
||||
# minimize rebuild time after unrelated changes to configure sources.
|
||||
#
|
||||
# As with any generated file in a VC'd directory, you should add
|
||||
# /.version to .gitignore, so that you don't accidentally commit it.
|
||||
# .tarball-version is never generated in a VC'd directory, so needn't
|
||||
# be listed there.
|
||||
#
|
||||
# Use the following line in your configure.ac, so that $(VERSION) will
|
||||
# automatically be up-to-date each time configure is run (and note that
|
||||
# since configure.ac no longer includes a version string, Makefile rules
|
||||
# should not depend on configure.ac for version updates).
|
||||
#
|
||||
# AC_INIT([GNU project],
|
||||
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
# [bug-project@example])
|
||||
#
|
||||
# Then use the following lines in your Makefile.am, so that .version
|
||||
# will be present for dependencies, and so that .version and
|
||||
# .tarball-version will exist in distribution tarballs.
|
||||
#
|
||||
# EXTRA_DIST = $(top_srcdir)/.version
|
||||
# BUILT_SOURCES = $(top_srcdir)/.version
|
||||
# $(top_srcdir)/.version:
|
||||
# echo $(VERSION) > $@-t && mv $@-t $@
|
||||
# dist-hook:
|
||||
# echo $(VERSION) > $(distdir)/.tarball-version
|
||||
|
||||
|
||||
me=$0
|
||||
|
||||
year=`expr "$scriptversion" : '\([^-]*\)'`
|
||||
version="git-version-gen $scriptversion
|
||||
|
||||
Copyright (C) ${year} Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
|
||||
usage="\
|
||||
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
|
||||
Print a version string.
|
||||
|
||||
Options:
|
||||
|
||||
--prefix PREFIX prefix of git tags (default 'v')
|
||||
--fallback VERSION
|
||||
fallback version to use if \"git --version\" fails
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Running without arguments will suffice in most cases."
|
||||
|
||||
prefix=v
|
||||
fallback=
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
--prefix) shift; prefix=${1?};;
|
||||
--fallback) shift; fallback=${1?};;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1'." >&2
|
||||
echo "$0: Try '--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test "x$tarball_version_file" = x; then
|
||||
tarball_version_file="$1"
|
||||
elif test "x$tag_sed_script" = x; then
|
||||
tag_sed_script="$1"
|
||||
else
|
||||
echo "$0: extra non-option argument '$1'." >&2
|
||||
exit 1
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test "x$tarball_version_file" = x; then
|
||||
echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tag_sed_script="${tag_sed_script:-s/x/x/}"
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# Avoid meddling by environment variable of the same name.
|
||||
v=
|
||||
v_from_git=
|
||||
|
||||
# First see if there is a tarball-only version file.
|
||||
# then try "git describe", then default.
|
||||
if test -f $tarball_version_file
|
||||
then
|
||||
v=`cat $tarball_version_file` || v=
|
||||
case $v in
|
||||
*$nl*) v= ;; # reject multi-line output
|
||||
esac
|
||||
test "x$v" = x \
|
||||
&& echo "$0: WARNING: $tarball_version_file is damaged" 1>&2
|
||||
fi
|
||||
|
||||
if test "x$v" != x
|
||||
then
|
||||
: # use $v
|
||||
# Otherwise, if there is at least one git commit involving the working
|
||||
# directory, and "git describe" output looks sensible, use that to
|
||||
# derive a version string.
|
||||
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
|
||||
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
|
||||
&& case $v in
|
||||
$prefix[0-9]*) ;;
|
||||
*) (exit 1) ;;
|
||||
esac
|
||||
then
|
||||
# Is this a new git that lists number of commits since the last
|
||||
# tag or the previous older version that did not?
|
||||
# Newer: v6.10-77-g0f8faeb
|
||||
# Older: v6.10-g0f8faeb
|
||||
vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v
|
||||
case $vprefix in
|
||||
*-*) : git describe is probably okay three part flavor ;;
|
||||
*)
|
||||
: git describe is older two part flavor
|
||||
# Recreate the number of commits and rewrite such that the
|
||||
# result is the same as if we were using the newer version
|
||||
# of git describe.
|
||||
vtag=`echo "$v" | sed 's/-.*//'`
|
||||
commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
|
||||
|| { commit_list=failed;
|
||||
echo "$0: WARNING: git rev-list failed" 1>&2; }
|
||||
numcommits=`echo "$commit_list" | wc -l`
|
||||
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
|
||||
test "$commit_list" = failed && v=UNKNOWN
|
||||
;;
|
||||
esac
|
||||
|
||||
# Change the penultimate "-" to ".", for version-comparing tools.
|
||||
# Remove the "g" to save a byte.
|
||||
v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
|
||||
v_from_git=1
|
||||
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
|
||||
v=UNKNOWN
|
||||
else
|
||||
v=$fallback
|
||||
fi
|
||||
|
||||
v=`echo "$v" |sed "s/^$prefix//"`
|
||||
|
||||
# Test whether to append the "-dirty" suffix only if the version
|
||||
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
|
||||
# or if it came from .tarball-version.
|
||||
if test "x$v_from_git" != x; then
|
||||
# Don't declare a version "dirty" merely because a timestamp has changed.
|
||||
git update-index --refresh > /dev/null 2>&1
|
||||
|
||||
dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
|
||||
case "$dirty" in
|
||||
'') ;;
|
||||
*) # Append the suffix only if there isn't one already.
|
||||
case $v in
|
||||
*-dirty) ;;
|
||||
*) v="$v-dirty" ;;
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
|
||||
printf %s "$v"
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,516 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Convert git log output to ChangeLog format.
|
||||
|
||||
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Jim Meyering
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2021-02-24 23:42'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # https://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] [ARGS]
|
||||
|
||||
Convert git log output to ChangeLog format. If present, any ARGS
|
||||
are passed to "git log". To avoid ARGS being parsed as options to
|
||||
$ME, they may be preceded by '--'.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
|
||||
makes a change to SHA1's commit log text or metadata.
|
||||
--append-dot append a dot to the first line of each commit message if
|
||||
there is no other punctuation or blank at the end.
|
||||
--no-cluster never cluster commit messages under the same date/author
|
||||
header; the default is to cluster adjacent commit messages
|
||||
if their headers are the same and neither commit message
|
||||
contains multiple paragraphs.
|
||||
--srcdir=DIR the root of the source tree, from which the .git/
|
||||
directory can be derived.
|
||||
--since=DATE convert only the logs since DATE;
|
||||
the default is to convert all log entries.
|
||||
--until=DATE convert only the logs older than DATE.
|
||||
--ignore-matching=PAT ignore commit messages whose first lines match PAT.
|
||||
--ignore-line=PAT ignore lines of commit messages that match PAT.
|
||||
--format=FMT set format string for commit subject and body;
|
||||
see 'man git-log' for the list of format metacharacters;
|
||||
the default is '%s%n%b%n'
|
||||
--strip-tab remove one additional leading TAB from commit message lines.
|
||||
--strip-cherry-pick remove data inserted by "git cherry-pick";
|
||||
this includes the "cherry picked from commit ..." line,
|
||||
and the possible final "Conflicts:" paragraph.
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
$ME --since=2008-01-01 > ChangeLog
|
||||
$ME -- -n 5 foo > last-5-commits-to-branch-foo
|
||||
|
||||
SPECIAL SYNTAX:
|
||||
|
||||
The following types of strings are interpreted specially when they appear
|
||||
at the beginning of a log message line. They are not copied to the output.
|
||||
|
||||
Copyright-paperwork-exempt: Yes
|
||||
Append the "(tiny change)" notation to the usual "date name email"
|
||||
ChangeLog header to mark a change that does not require a copyright
|
||||
assignment.
|
||||
Co-authored-by: Joe User <user\@example.com>
|
||||
List the specified name and email address on a second
|
||||
ChangeLog header, denoting a co-author.
|
||||
Signed-off-by: Joe User <user\@example.com>
|
||||
These lines are simply elided.
|
||||
|
||||
In a FILE specified via --amend, comment lines (starting with "#") are ignored.
|
||||
FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
|
||||
a line) referring to a commit in the current project, and CODE refers to one
|
||||
or more consecutive lines of Perl code. Pairs must be separated by one or
|
||||
more blank line.
|
||||
|
||||
Here is sample input for use with --amend=FILE, from coreutils:
|
||||
|
||||
3a169f4c5d9159283548178668d2fae6fced3030
|
||||
# fix typo in title:
|
||||
s/all tile types/all file types/
|
||||
|
||||
1379ed974f1fa39b12e2ffab18b3f7a607082202
|
||||
# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
|
||||
# Change the author to be Paul. Note the escaped "@":
|
||||
s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
# If the string $S is a well-behaved file name, simply return it.
|
||||
# If it contains white space, quotes, etc., quote it, and return the new string.
|
||||
sub shell_quote($)
|
||||
{
|
||||
my ($s) = @_;
|
||||
if ($s =~ m![^\w+/.,-]!)
|
||||
{
|
||||
# Convert each single quote to '\''
|
||||
$s =~ s/\'/\'\\\'\'/g;
|
||||
# Then single quote the string.
|
||||
$s = "'$s'";
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub quoted_cmd(@)
|
||||
{
|
||||
return join (' ', map {shell_quote $_} @_);
|
||||
}
|
||||
|
||||
# Parse file F.
|
||||
# Comment lines (starting with "#") are ignored.
|
||||
# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
|
||||
# (alone on a line) referring to a commit in the current project, and
|
||||
# CODE refers to one or more consecutive lines of Perl code.
|
||||
# Pairs must be separated by one or more blank line.
|
||||
sub parse_amend_file($)
|
||||
{
|
||||
my ($f) = @_;
|
||||
|
||||
open F, '<', $f
|
||||
or die "$ME: $f: failed to open for reading: $!\n";
|
||||
|
||||
my $fail;
|
||||
my $h = {};
|
||||
my $in_code = 0;
|
||||
my $sha;
|
||||
while (defined (my $line = <F>))
|
||||
{
|
||||
$line =~ /^\#/
|
||||
and next;
|
||||
chomp $line;
|
||||
$line eq ''
|
||||
and $in_code = 0, next;
|
||||
|
||||
if (!$in_code)
|
||||
{
|
||||
$line =~ /^([[:xdigit:]]{40})$/
|
||||
or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
|
||||
$fail = 1, next;
|
||||
$sha = lc $1;
|
||||
$in_code = 1;
|
||||
exists $h->{$sha}
|
||||
and (warn "$ME: $f:$.: duplicate SHA1\n"),
|
||||
$fail = 1, next;
|
||||
}
|
||||
else
|
||||
{
|
||||
$h->{$sha} ||= '';
|
||||
$h->{$sha} .= "$line\n";
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
$fail
|
||||
and exit 1;
|
||||
|
||||
return $h;
|
||||
}
|
||||
|
||||
# git_dir_option $SRCDIR
|
||||
#
|
||||
# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
|
||||
# is undef). Return as a list (0 or 1 element).
|
||||
sub git_dir_option($)
|
||||
{
|
||||
my ($srcdir) = @_;
|
||||
my @res = ();
|
||||
if (defined $srcdir)
|
||||
{
|
||||
my $qdir = shell_quote $srcdir;
|
||||
my $cmd = "cd $qdir && git rev-parse --show-toplevel";
|
||||
my $qcmd = shell_quote $cmd;
|
||||
my $git_dir = qx($cmd);
|
||||
defined $git_dir
|
||||
or die "$ME: cannot run $qcmd: $!\n";
|
||||
$? == 0
|
||||
or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
|
||||
chomp $git_dir;
|
||||
push @res, "--git-dir=$git_dir/.git";
|
||||
}
|
||||
@res;
|
||||
}
|
||||
|
||||
{
|
||||
my $since_date;
|
||||
my $until_date;
|
||||
my $format_string = '%s%n%b%n';
|
||||
my $amend_file;
|
||||
my $append_dot = 0;
|
||||
my $cluster = 1;
|
||||
my $ignore_matching;
|
||||
my $ignore_line;
|
||||
my $strip_tab = 0;
|
||||
my $strip_cherry_pick = 0;
|
||||
my $srcdir;
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
'since=s' => \$since_date,
|
||||
'until=s' => \$until_date,
|
||||
'format=s' => \$format_string,
|
||||
'amend=s' => \$amend_file,
|
||||
'append-dot' => \$append_dot,
|
||||
'cluster!' => \$cluster,
|
||||
'ignore-matching=s' => \$ignore_matching,
|
||||
'ignore-line=s' => \$ignore_line,
|
||||
'strip-tab' => \$strip_tab,
|
||||
'strip-cherry-pick' => \$strip_cherry_pick,
|
||||
'srcdir=s' => \$srcdir,
|
||||
) or usage 1;
|
||||
|
||||
defined $since_date
|
||||
and unshift @ARGV, "--since=$since_date";
|
||||
defined $until_date
|
||||
and unshift @ARGV, "--until=$until_date";
|
||||
|
||||
# This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
|
||||
# that makes a correction in the log or attribution of that commit.
|
||||
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
|
||||
|
||||
my @cmd = ('git',
|
||||
git_dir_option $srcdir,
|
||||
qw(log --log-size),
|
||||
'--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
|
||||
open PIPE, '-|', @cmd
|
||||
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
|
||||
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
|
||||
|
||||
my $prev_multi_paragraph;
|
||||
my $prev_date_line = '';
|
||||
my @prev_coauthors = ();
|
||||
my @skipshas = ();
|
||||
while (1)
|
||||
{
|
||||
defined (my $in = <PIPE>)
|
||||
or last;
|
||||
$in =~ /^log size (\d+)$/
|
||||
or die "$ME:$.: Invalid line (expected log size):\n$in";
|
||||
my $log_nbytes = $1;
|
||||
|
||||
my $log;
|
||||
my $n_read = read PIPE, $log, $log_nbytes;
|
||||
$n_read == $log_nbytes
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
|
||||
# Extract leading hash.
|
||||
my ($sha, $rest) = split ':', $log, 2;
|
||||
defined $sha
|
||||
or die "$ME:$.: malformed log entry\n";
|
||||
$sha =~ /^[[:xdigit:]]{40}$/
|
||||
or die "$ME:$.: invalid SHA1: $sha\n";
|
||||
|
||||
my $skipflag = 0;
|
||||
if (@skipshas)
|
||||
{
|
||||
foreach(@skipshas)
|
||||
{
|
||||
if ($sha =~ /^$_/)
|
||||
{
|
||||
$skipflag = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If this commit's log requires any transformation, do it now.
|
||||
my $code = $amend_code->{$sha};
|
||||
if (defined $code)
|
||||
{
|
||||
eval 'use Safe';
|
||||
my $s = new Safe;
|
||||
# Put the unpreprocessed entry into "$_".
|
||||
$_ = $rest;
|
||||
|
||||
# Let $code operate on it, safely.
|
||||
my $r = $s->reval("$code")
|
||||
or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
|
||||
|
||||
# Note that we've used this entry.
|
||||
delete $amend_code->{$sha};
|
||||
|
||||
# Update $rest upon success.
|
||||
$rest = $_;
|
||||
}
|
||||
|
||||
# Remove lines inserted by "git cherry-pick".
|
||||
if ($strip_cherry_pick)
|
||||
{
|
||||
$rest =~ s/^\s*Conflicts:\n.*//sm;
|
||||
$rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
|
||||
}
|
||||
|
||||
my @line = split /[ \t]*\n/, $rest;
|
||||
my $author_line = shift @line;
|
||||
defined $author_line
|
||||
or die "$ME:$.: unexpected EOF\n";
|
||||
$author_line =~ /^(\d+) (.*>)$/
|
||||
or die "$ME:$.: Invalid line "
|
||||
. "(expected date/author/email):\n$author_line\n";
|
||||
|
||||
# Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
|
||||
# `(tiny change)' annotation.
|
||||
my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line)
|
||||
? ' (tiny change)' : '');
|
||||
|
||||
my $date_line = sprintf "%s %s$tiny\n",
|
||||
strftime ("%Y-%m-%d", localtime ($1)), $2;
|
||||
|
||||
my @coauthors = grep /^Co-authored-by:.*$/, @line;
|
||||
# Omit meta-data lines we've already interpreted.
|
||||
@line = grep !/^(?:Signed-off-by:[ ].*>$
|
||||
|Co-authored-by:[ ]
|
||||
|Copyright-paperwork-exempt:[ ]
|
||||
|Tiny-change:[ ]
|
||||
)/x, @line;
|
||||
|
||||
# Remove leading and trailing blank lines.
|
||||
if (@line)
|
||||
{
|
||||
while ($line[0] =~ /^\s*$/) { shift @line; }
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
}
|
||||
|
||||
# Handle Emacs gitmerge.el "skipped" commits.
|
||||
# Yes, this should be controlled by an option. So sue me.
|
||||
if ( grep /^(; )?Merge from /, @line )
|
||||
{
|
||||
my $found = 0;
|
||||
foreach (@line)
|
||||
{
|
||||
if (grep /^The following commit.*skipped:$/, $_)
|
||||
{
|
||||
$found = 1;
|
||||
## Reset at each merge to reduce chance of false matches.
|
||||
@skipshas = ();
|
||||
next;
|
||||
}
|
||||
if ($found && $_ =~ /^([[:xdigit:]]{7,}) [^ ]/)
|
||||
{
|
||||
push ( @skipshas, $1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Ignore commits that match the --ignore-matching pattern, if specified.
|
||||
if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/)
|
||||
{
|
||||
$skipflag = 1;
|
||||
}
|
||||
elsif ($skipflag)
|
||||
{
|
||||
## Perhaps only warn if a pattern matches more than once?
|
||||
warn "$ME: warning: skipping $sha due to $skipflag\n";
|
||||
}
|
||||
|
||||
if (! $skipflag)
|
||||
{
|
||||
if (defined $ignore_line && @line)
|
||||
{
|
||||
@line = grep ! /$ignore_line/, @line;
|
||||
while ($line[$#line] =~ /^\s*$/) { pop @line; }
|
||||
}
|
||||
|
||||
# Record whether there are two or more paragraphs.
|
||||
my $multi_paragraph = grep /^\s*$/, @line;
|
||||
|
||||
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
|
||||
# standard multi-author ChangeLog format.
|
||||
for (@coauthors)
|
||||
{
|
||||
s/^Co-authored-by:\s*/\t /;
|
||||
s/\s*</ </;
|
||||
|
||||
/<.*?@.*\..*>/
|
||||
or warn "$ME: warning: missing email address for "
|
||||
. substr ($_, 5) . "\n";
|
||||
}
|
||||
|
||||
# If clustering of commit messages has been disabled, if this header
|
||||
# would be different from the previous date/name/etc. header,
|
||||
# or if this or the previous entry consists of two or more paragraphs,
|
||||
# then print the header.
|
||||
if ( ! $cluster
|
||||
|| $date_line ne $prev_date_line
|
||||
|| "@coauthors" ne "@prev_coauthors"
|
||||
|| $multi_paragraph
|
||||
|| $prev_multi_paragraph)
|
||||
{
|
||||
$prev_date_line eq ''
|
||||
or print "\n";
|
||||
print $date_line;
|
||||
@coauthors
|
||||
and print join ("\n", @coauthors), "\n";
|
||||
}
|
||||
$prev_date_line = $date_line;
|
||||
@prev_coauthors = @coauthors;
|
||||
$prev_multi_paragraph = $multi_paragraph;
|
||||
|
||||
# If there were any lines
|
||||
if (@line == 0)
|
||||
{
|
||||
warn "$ME: warning: empty commit message:\n"
|
||||
. " commit $sha\n $date_line\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($append_dot)
|
||||
{
|
||||
# If the first line of the message has enough room, then
|
||||
if (length $line[0] < 72)
|
||||
{
|
||||
# append a dot if there is no other punctuation or blank
|
||||
# at the end.
|
||||
$line[0] =~ /[[:punct:]\s]$/
|
||||
or $line[0] .= '.';
|
||||
}
|
||||
}
|
||||
|
||||
# Remove one additional leading TAB from each line.
|
||||
$strip_tab
|
||||
and map { s/^\t// } @line;
|
||||
|
||||
# Prefix each non-empty line with a TAB.
|
||||
@line = map { length $_ ? "\t$_" : '' } @line;
|
||||
|
||||
print "\n", join ("\n", @line), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
defined ($in = <PIPE>)
|
||||
or last;
|
||||
$in ne "\n"
|
||||
and die "$ME:$.: unexpected line:\n$in";
|
||||
}
|
||||
|
||||
close PIPE
|
||||
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
|
||||
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
|
||||
|
||||
# Complain about any unused entry in the --amend=F specified file.
|
||||
my $fail = 0;
|
||||
foreach my $sha (keys %$amend_code)
|
||||
{
|
||||
warn "$ME:$amend_file: unused entry: $sha\n";
|
||||
$fail = 1;
|
||||
}
|
||||
|
||||
exit $fail;
|
||||
}
|
||||
|
||||
# Local Variables:
|
||||
# mode: perl
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-line-limit: 50
|
||||
# time-stamp-start: "my $VERSION = '"
|
||||
# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "'; # UTC"
|
||||
# End:
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
#!/bin/sh
|
||||
# Run this after each non-alpha release, to update the web documentation at
|
||||
# https://www.gnu.org/software/$pkg/manual/
|
||||
|
||||
VERSION=2021-01-09.09; # UTC
|
||||
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
ME=$(basename "$0")
|
||||
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
|
||||
die() { warn "$*"; exit 1; }
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $ME
|
||||
|
||||
Run this script from top_srcdir (no arguments) after each non-alpha
|
||||
release, to update the web documentation at
|
||||
https://www.gnu.org/software/\$pkg/manual/
|
||||
|
||||
This script assumes you're using git for revision control, and
|
||||
requires a .prev-version file as well as a Makefile, from which it
|
||||
extracts the version number and package name, respectively. Also, it
|
||||
assumes all documentation is in the doc/ sub-directory.
|
||||
|
||||
Options:
|
||||
-C, --builddir=DIR location of (configured) Makefile (default: .)
|
||||
-n, --dry-run don't actually commit anything
|
||||
-m, --mirror remove out of date files from document server
|
||||
-u, --user the name of the CVS user on Savannah
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
version()
|
||||
{
|
||||
year=$(echo "$VERSION" | sed 's/[^0-9].*//')
|
||||
cat <<EOF
|
||||
$ME $VERSION
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
|
||||
# find_tool ENVVAR NAMES...
|
||||
# -------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
#
|
||||
# FIXME: code duplication, see also bootstrap.
|
||||
find_tool ()
|
||||
{
|
||||
find_tool_envvar=$1
|
||||
shift
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
## ------ ##
|
||||
## Main. ##
|
||||
## ------ ##
|
||||
|
||||
# Requirements: everything required to bootstrap your package, plus
|
||||
# these.
|
||||
find_tool CVS cvs
|
||||
find_tool GIT git
|
||||
find_tool RSYNC rsync
|
||||
find_tool XARGS gxargs xargs
|
||||
|
||||
builddir=.
|
||||
dryrun=
|
||||
rm_stale='echo'
|
||||
cvs_user="$USER"
|
||||
while test $# != 0
|
||||
do
|
||||
# Handle --option=value by splitting apart and putting back on argv.
|
||||
case $1 in
|
||||
--*=*)
|
||||
opt=$(echo "$1" | sed -e 's/=.*//')
|
||||
val=$(echo "$1" | sed -e 's/[^=]*=//')
|
||||
shift
|
||||
set dummy "$opt" "$val" "$@"; shift
|
||||
;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help|--version) ${1#--};;
|
||||
-C|--builddir) shift; builddir=$1; shift ;;
|
||||
-n|--dry-run) dryrun=echo; shift;;
|
||||
-m|--mirror) rm_stale=''; shift;;
|
||||
-u|--user) shift; cvs_user=$1; shift ;;
|
||||
--*) die "unrecognized option: $1";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
test $# = 0 \
|
||||
|| die "too many arguments"
|
||||
|
||||
prev=.prev-version
|
||||
version=$(cat $prev) || die "no $prev file?"
|
||||
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \
|
||||
|| die "no Makefile?"
|
||||
tmp_branch=web-doc-$version-$$
|
||||
current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}')
|
||||
|
||||
cleanup()
|
||||
{
|
||||
__st=$?
|
||||
$dryrun rm -rf "$tmp"
|
||||
$GIT checkout "$current_branch"
|
||||
$GIT submodule update --recursive
|
||||
$GIT branch -d $tmp_branch
|
||||
exit $__st
|
||||
}
|
||||
trap cleanup 0
|
||||
trap 'exit $?' 1 2 13 15
|
||||
|
||||
# We must build using sources for which --version reports the
|
||||
# just-released version number, not some string like 7.6.18-20761.
|
||||
# That version string propagates into all documentation.
|
||||
set -e
|
||||
$GIT checkout -b $tmp_branch v$version
|
||||
$GIT submodule update --recursive
|
||||
./bootstrap
|
||||
srcdir=$(pwd)
|
||||
cd "$builddir"
|
||||
builddir=$(pwd)
|
||||
./config.status --recheck
|
||||
./config.status
|
||||
make
|
||||
make web-manual
|
||||
cd "$srcdir"
|
||||
set +e
|
||||
|
||||
tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
|
||||
( cd $tmp \
|
||||
&& $CVS -d $cvs_user@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
|
||||
$RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
|
||||
|
||||
(
|
||||
cd $tmp/$pkg/manual
|
||||
|
||||
# Add all the files. This is simpler than trying to add only the
|
||||
# new ones because of new directories
|
||||
# First add non empty dirs individually
|
||||
find . -name CVS -prune -o -type d \! -empty -print \
|
||||
| $XARGS -n1 --no-run-if-empty -- $dryrun $CVS add -ko
|
||||
# Now add all files
|
||||
find . -name CVS -prune -o -type f -print \
|
||||
| $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
|
||||
|
||||
# Report/Remove stale files
|
||||
# excluding doc server specific files like CVS/* and .symlinks
|
||||
if test -n "$rm_stale"; then
|
||||
echo 'Consider the --mirror option if all of the manual is generated,' >&2
|
||||
echo 'which will run `cvs remove` to remove stale files.' >&2
|
||||
fi
|
||||
{ find . \( -name CVS -o -type f -name '.*' \) -prune -o -type f -print
|
||||
(cd "$builddir"/doc/manual/ && find . -type f -print | sed p)
|
||||
} | sort | uniq -u \
|
||||
| $XARGS --no-run-if-empty -- ${rm_stale:-$dryrun} $CVS remove -f
|
||||
|
||||
$dryrun $CVS ci -m $version
|
||||
)
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "VERSION="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+480
@@ -0,0 +1,480 @@
|
||||
#!/bin/sh
|
||||
# Sign files and upload them.
|
||||
|
||||
scriptversion=2021-04-11.09; # UTC
|
||||
|
||||
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
|
||||
# The master copy of this file is maintained in the gnulib Git repository.
|
||||
# Please send bug reports and feature requests to bug-gnulib@gnu.org.
|
||||
|
||||
set -e
|
||||
|
||||
GPG=gpg
|
||||
# Choose the proper version of gpg, so as to avoid a
|
||||
# "gpg-agent is not available in this session" error
|
||||
# when gpg-agent is version 2 but gpg is still version 1.
|
||||
# FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg
|
||||
gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
|
||||
case "$gpg_agent_version" in
|
||||
2.*)
|
||||
gpg_version=`(gpg --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
|
||||
case "$gpg_version" in
|
||||
1.*)
|
||||
if (type gpg2) >/dev/null 2>/dev/null; then
|
||||
# gpg2 is present.
|
||||
GPG=gpg2
|
||||
else
|
||||
# gpg2 is missing. Ubuntu users should install the package 'gnupg2'.
|
||||
echo "WARNING: Using 'gpg', which is too old. You should install 'gpg2'." 1>&2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
GPG="${GPG} --batch --no-tty"
|
||||
conffile=.gnuploadrc
|
||||
to=
|
||||
dry_run=false
|
||||
replace=
|
||||
symlink_files=
|
||||
delete_files=
|
||||
delete_symlinks=
|
||||
collect_var=
|
||||
dbg=
|
||||
nl='
|
||||
'
|
||||
|
||||
usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
|
||||
|
||||
Sign all FILES, and process them at the destinations specified with --to.
|
||||
If CMD is not given, it defaults to uploading. See examples below.
|
||||
|
||||
Commands:
|
||||
--delete delete FILES from destination
|
||||
--symlink create symbolic links
|
||||
--rmsymlink remove symbolic links
|
||||
-- treat the remaining arguments as files to upload
|
||||
|
||||
Options:
|
||||
--to DEST specify a destination DEST for FILES
|
||||
(multiple --to options are allowed)
|
||||
--user NAME sign with key NAME
|
||||
--replace allow replacements of existing files
|
||||
--symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names
|
||||
-n, --dry-run do nothing, show what would have been done
|
||||
(including the constructed directive file)
|
||||
--version output version information and exit
|
||||
-h, --help print this help text and exit
|
||||
|
||||
If --symlink-regex is given without EXPR, then the link target name
|
||||
is created by replacing the version information with '-latest', e.g.:
|
||||
foo-1.3.4.tar.gz -> foo-latest.tar.gz
|
||||
|
||||
Recognized destinations are:
|
||||
alpha.gnu.org:DIRECTORY
|
||||
savannah.gnu.org:DIRECTORY
|
||||
savannah.nongnu.org:DIRECTORY
|
||||
ftp.gnu.org:DIRECTORY
|
||||
build directive files and upload files by FTP
|
||||
download.gnu.org.ua:{alpha|ftp}/DIRECTORY
|
||||
build directive files and upload files by SFTP
|
||||
[user@]host:DIRECTORY upload files with scp
|
||||
|
||||
Options and commands are applied in order. If the file $conffile exists
|
||||
in the current working directory, its contents are prepended to the
|
||||
actual command line options. Use this to keep your defaults. Comments
|
||||
(#) and empty lines in $conffile are allowed.
|
||||
|
||||
<https://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
|
||||
gives some further background.
|
||||
|
||||
Examples:
|
||||
1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
|
||||
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
|
||||
|
||||
2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
|
||||
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
|
||||
|
||||
3. Same as above, and also create symbolic links to foobar-latest.tar.*:
|
||||
gnupload --to ftp.gnu.org:foobar \\
|
||||
--symlink-regex \\
|
||||
foobar-1.0.tar.gz foobar-1.0.tar.xz
|
||||
|
||||
4. Create a symbolic link foobar-latest.tar.gz -> foobar-1.0.tar.gz
|
||||
and likewise for the corresponding .sig file:
|
||||
gnupload --to ftp.gnu.org:foobar \\
|
||||
--symlink foobar-1.0.tar.gz foobar-latest.tar.gz \\
|
||||
foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig
|
||||
or (equivalent):
|
||||
gnupload --to ftp.gnu.org:foobar \\
|
||||
--symlink foobar-1.0.tar.gz foobar-latest.tar.gz \\
|
||||
--symlink foobar-1.0.tar.gz.sig foobar-latest.tar.gz.sig
|
||||
|
||||
5. Upload foobar-0.9.90.tar.gz to two sites:
|
||||
gnupload --to alpha.gnu.org:foobar \\
|
||||
--to sources.redhat.com:~ftp/pub/foobar \\
|
||||
foobar-0.9.90.tar.gz
|
||||
|
||||
6. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
|
||||
(the -- terminates the list of files to delete):
|
||||
gnupload --to alpha.gnu.org:foobar \\
|
||||
--to sources.redhat.com:~ftp/pub/foobar \\
|
||||
--delete oopsbar-0.9.91.tar.gz \\
|
||||
-- foobar-0.9.91.tar.gz
|
||||
|
||||
gnupload executes a program ncftpput to do the transfers; if you don't
|
||||
happen to have an ncftp package installed, the ncftpput-ftp script in
|
||||
the build-aux/ directory of the gnulib package
|
||||
(https://savannah.gnu.org/projects/gnulib) may serve as a replacement.
|
||||
|
||||
Send patches and bug reports to <bug-gnulib@gnu.org>."
|
||||
|
||||
copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
|
||||
copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
|
||||
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
|
||||
# Read local configuration file
|
||||
if test -r "$conffile"; then
|
||||
echo "$0: Reading configuration file $conffile"
|
||||
conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '`
|
||||
eval set x "$conf \"\$@\""
|
||||
shift
|
||||
fi
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-*)
|
||||
collect_var=
|
||||
case $1 in
|
||||
-h | --help)
|
||||
echo "$usage"
|
||||
exit $?
|
||||
;;
|
||||
--to)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --to" 1>&2
|
||||
exit 1
|
||||
elif echo "$2" | grep 'ftp-upload\.gnu\.org' >/dev/null; then
|
||||
echo "$0: Use ftp.gnu.org:PKGNAME or alpha.gnu.org:PKGNAME" >&2
|
||||
echo "$0: for the destination, not ftp-upload.gnu.org (which" >&2
|
||||
echo "$0: is used for direct ftp uploads, not with gnupload)." >&2
|
||||
echo "$0: See --help and its examples if need be." >&2
|
||||
exit 1
|
||||
else
|
||||
to="$to $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--user)
|
||||
if test -z "$2"; then
|
||||
echo "$0: Missing argument for --user" 1>&2
|
||||
exit 1
|
||||
else
|
||||
GPG="$GPG --local-user $2"
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--delete)
|
||||
collect_var=delete_files
|
||||
;;
|
||||
--replace)
|
||||
replace="replace: true"
|
||||
;;
|
||||
--rmsymlink)
|
||||
collect_var=delete_symlinks
|
||||
;;
|
||||
--symlink-regex=*)
|
||||
symlink_expr=`expr "$1" : '[^=]*=\(.*\)'`
|
||||
;;
|
||||
--symlink-regex)
|
||||
symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'
|
||||
;;
|
||||
--symlink)
|
||||
collect_var=symlink_files
|
||||
;;
|
||||
-n | --dry-run)
|
||||
dry_run=:
|
||||
;;
|
||||
--version)
|
||||
echo "gnupload $scriptversion"
|
||||
echo "$copyright"
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1', try '$0 --help'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
if test -z "$collect_var"; then
|
||||
break
|
||||
else
|
||||
eval "$collect_var=\"\$$collect_var $1\""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
dprint()
|
||||
{
|
||||
echo "Running $* ..."
|
||||
}
|
||||
|
||||
if $dry_run; then
|
||||
dbg=dprint
|
||||
fi
|
||||
|
||||
if test -z "$to"; then
|
||||
echo "$0: Missing destination sites" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -n "$symlink_files"; then
|
||||
x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'`
|
||||
if test -n "$x"; then
|
||||
echo "$0: Odd number of symlink arguments" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then
|
||||
echo "$0: No file to upload" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Make sure all files exist. We don't want to ask
|
||||
# for the passphrase if the script will fail.
|
||||
for file
|
||||
do
|
||||
if test ! -f $file; then
|
||||
echo "$0: Cannot find '$file'" 1>&2
|
||||
exit 1
|
||||
elif test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
if test -z "$linkname"; then
|
||||
echo "$0: symlink expression produces empty results" >&2
|
||||
exit 1
|
||||
elif test "$linkname" = $file; then
|
||||
echo "$0: symlink expression does not alter file name" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Make sure passphrase is not exported in the environment.
|
||||
unset passphrase
|
||||
unset passphrase_fd_0
|
||||
GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
|
||||
|
||||
# Reset PATH to be sure that echo is a built-in. We will later use
|
||||
# 'echo $passphrase' to output the passphrase, so it is important that
|
||||
# it is a built-in (third-party programs tend to appear in 'ps'
|
||||
# listings with their arguments...).
|
||||
# Remember this script runs with 'set -e', so if echo is not built-in
|
||||
# it will exit now.
|
||||
if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else
|
||||
PATH=/empty echo -n "Enter GPG passphrase: "
|
||||
stty -echo
|
||||
read -r passphrase
|
||||
stty echo
|
||||
echo
|
||||
passphrase_fd_0="--passphrase-fd 0"
|
||||
fi
|
||||
|
||||
if test $# -ne 0; then
|
||||
for file
|
||||
do
|
||||
echo "Signing $file ..."
|
||||
rm -f $file.sig
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# mkdirective DESTDIR BASE FILE STMT
|
||||
# Arguments: See upload, below
|
||||
mkdirective ()
|
||||
{
|
||||
stmt="$4"
|
||||
if test -n "$3"; then
|
||||
stmt="
|
||||
filename: $3$stmt"
|
||||
fi
|
||||
|
||||
cat >${2}.directive<<EOF
|
||||
version: 1.2
|
||||
directory: $1
|
||||
comment: gnupload v. $scriptversion$stmt
|
||||
EOF
|
||||
if $dry_run; then
|
||||
echo "File ${2}.directive:"
|
||||
cat ${2}.directive
|
||||
echo "File ${2}.directive:" | sed 's/./-/g'
|
||||
fi
|
||||
}
|
||||
|
||||
mksymlink ()
|
||||
{
|
||||
while test $# -ne 0
|
||||
do
|
||||
echo "symlink: $1 $2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# upload DEST DESTDIR BASE FILE STMT FILES
|
||||
# Arguments:
|
||||
# DEST Destination site;
|
||||
# DESTDIR Destination directory;
|
||||
# BASE Base name for the directive file;
|
||||
# FILE Name of the file to distribute (may be empty);
|
||||
# STMT Additional statements for the directive file;
|
||||
# FILES List of files to upload.
|
||||
upload ()
|
||||
{
|
||||
dest=$1
|
||||
destdir=$2
|
||||
base=$3
|
||||
file=$4
|
||||
stmt=$5
|
||||
files=$6
|
||||
|
||||
rm -f $base.directive $base.directive.asc
|
||||
case $dest in
|
||||
alpha.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
|
||||
;;
|
||||
ftp.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
|
||||
;;
|
||||
savannah.gnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
savannah.nongnu.org:*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files
|
||||
;;
|
||||
download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*)
|
||||
destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
|
||||
destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
|
||||
mkdirective "$destdir_p1" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
for f in $files $base.directive.asc
|
||||
do
|
||||
echo put $f
|
||||
done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir
|
||||
;;
|
||||
/*)
|
||||
dest_host=`echo "$dest" | sed 's,:.*,,'`
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg cp $files $base.directive.asc $dest_host
|
||||
;;
|
||||
*)
|
||||
if test -z "$files"; then
|
||||
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
||||
fi
|
||||
$dbg scp $files $dest
|
||||
;;
|
||||
esac
|
||||
rm -f $base.directive $base.directive.asc
|
||||
}
|
||||
|
||||
#####
|
||||
# Process any standalone directives
|
||||
stmt=
|
||||
if test -n "$symlink_files"; then
|
||||
stmt="$stmt
|
||||
`mksymlink $symlink_files`"
|
||||
fi
|
||||
|
||||
for file in $delete_files
|
||||
do
|
||||
stmt="$stmt
|
||||
archive: $file"
|
||||
done
|
||||
|
||||
for file in $delete_symlinks
|
||||
do
|
||||
stmt="$stmt
|
||||
rmsymlink: $file"
|
||||
done
|
||||
|
||||
if test -n "$stmt"; then
|
||||
for dest in $to
|
||||
do
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt"
|
||||
done
|
||||
fi
|
||||
|
||||
# Process actual uploads
|
||||
for dest in $to
|
||||
do
|
||||
for file
|
||||
do
|
||||
echo "Uploading $file to $dest ..."
|
||||
stmt=
|
||||
#
|
||||
# allowing file replacement is all or nothing.
|
||||
if test -n "$replace"; then stmt="$stmt
|
||||
$replace"
|
||||
fi
|
||||
#
|
||||
files="$file $file.sig"
|
||||
destdir=`echo $dest | sed 's/[^:]*://'`
|
||||
if test -n "$symlink_expr"; then
|
||||
linkname=`echo $file | sed "$symlink_expr"`
|
||||
stmt="$stmt
|
||||
symlink: $file $linkname
|
||||
symlink: $file.sig $linkname.sig"
|
||||
fi
|
||||
upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files"
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
#!/bin/sh
|
||||
# install-reloc - install a program including a relocating wrapper
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
# Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Usage 1:
|
||||
# install-reloc -- library_path_var library_path_value prefix destdir \
|
||||
# compile_command srcdir builddir config_h_dir exeext \
|
||||
# strip_command \
|
||||
# install_command... destprog
|
||||
# where
|
||||
# - library_path_var is the platform dependent runtime library path variable
|
||||
# - library_path_value is a colon separated list of directories that contain
|
||||
# the libraries at installation time (use this instead of -rpath)
|
||||
# - prefix is the base directory at installation time
|
||||
# - destdir is a string that is prepended to all file names at installation
|
||||
# time; it is already prepended to destprog but not to library_path_value
|
||||
# and prefix
|
||||
# - compile_command is a C compiler compilation and linking command
|
||||
# - srcdir is the directory where to find relocwrapper.c and its dependencies
|
||||
# - builddir is the directory where to find built dependencies (namely,
|
||||
# alloca.h and stdbool.h)
|
||||
# - config_h_dir is the directory where to find config.h
|
||||
# - exeext is platform dependent suffix of executables
|
||||
# - strip_command is the command for stripping executables, or : if no
|
||||
# stripping is desired
|
||||
# - install_command is the install command line, excluding the final destprog
|
||||
# - destprog is the destination program name
|
||||
# Usage 2:
|
||||
# env RELOC_LIBRARY_PATH_VAR=library_path_var \
|
||||
# RELOC_LIBRARY_PATH_VALUE=library_path_value \
|
||||
# RELOC_PREFIX=prefix \
|
||||
# RELOC_DESTDIR=destdir \
|
||||
# RELOC_COMPILE_COMMAND=compile_command \
|
||||
# RELOC_SRCDIR=srcdir \
|
||||
# RELOC_BUILDDIR=builddir \
|
||||
# RELOC_CONFIG_H_DIR=config_h_dir \
|
||||
# RELOC_EXEEXT=exeext \
|
||||
# RELOC_STRIP_PROG=strip_command \
|
||||
# RELOC_INSTALL_PROG=install_command... \
|
||||
# install-reloc prog1 ... destprog
|
||||
# where destprog is either the destination program name (when only one program
|
||||
# is specified) or the destination directory for all programs.
|
||||
# install-reloc renames destprog to destprog.bin and installs a relocating
|
||||
# wrapper in the place of destprog.
|
||||
|
||||
progname=$0
|
||||
|
||||
if test $# -ge 12 && test "x$1" = "x--"; then
|
||||
# Get fixed position arguments.
|
||||
shift
|
||||
library_path_var=$1
|
||||
library_path_value=$2
|
||||
prefix=$3
|
||||
destdir=$4
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
compile_command=$1
|
||||
srcdir=$2
|
||||
builddir=$3
|
||||
config_h_dir=$4
|
||||
exeext=$5
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
strip_prog=$1
|
||||
shift
|
||||
install_prog=$1 # maybe not including the "-c" option
|
||||
shift
|
||||
else
|
||||
if test $# -ge 2; then
|
||||
# Get arguments from environment variables.
|
||||
library_path_var=$RELOC_LIBRARY_PATH_VAR
|
||||
library_path_value=$RELOC_LIBRARY_PATH_VALUE
|
||||
prefix=$RELOC_PREFIX
|
||||
destdir=$RELOC_DESTDIR
|
||||
compile_command=$RELOC_COMPILE_COMMAND
|
||||
srcdir=$RELOC_SRCDIR
|
||||
builddir=$RELOC_BUILDDIR
|
||||
config_h_dir=$RELOC_CONFIG_H_DIR
|
||||
exeext=$RELOC_EXEEXT
|
||||
strip_prog=$RELOC_STRIP_PROG
|
||||
install_prog=$RELOC_INSTALL_PROG # including the "-c" option
|
||||
else
|
||||
echo "Usage: $0 -- library_path_var library_path_value prefix destdir" \
|
||||
"compile_command srcdir builddir config_h_dir exeext" \
|
||||
"strip_command" \
|
||||
"install_command... destprog" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get destprog, last argument.
|
||||
destprog=
|
||||
for arg
|
||||
do
|
||||
destprog=$arg
|
||||
done
|
||||
# Determine whether destprog is a program name or a directory name.
|
||||
if test -d "$destprog"; then
|
||||
sed_remove_trailing_slashes='s|//*$||'
|
||||
destprog_directory=`echo "$destprog" | sed -e "$sed_remove_trailing_slashes"`
|
||||
if test -z "$destprog_directory"; then
|
||||
destprog_directory='/'
|
||||
fi
|
||||
else
|
||||
destprog_directory=
|
||||
fi
|
||||
# Prepare for remove trailing $exeext, if present.
|
||||
if test -n "$exeext"; then
|
||||
sed_quote='s,\.,\\.,g'
|
||||
sed_remove_exeext='s|'`echo "$exeext" | sed -e "$sed_quote"`'$||'
|
||||
fi
|
||||
if test -z "$destprog_directory"; then
|
||||
# Remove trailing $exeext, if present.
|
||||
if test -n "$exeext"; then
|
||||
destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Outputs a command and runs it.
|
||||
func_verbose ()
|
||||
{
|
||||
# Make it easy to copy&paste the printed command into a shell in most cases,
|
||||
# by escaping '\\', '"', and '$'. This is not perfect, just good enough.
|
||||
echo "$@" | sed -e 's/\([\\"$]\)/\\\1/g'
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Run install_command.
|
||||
func_verbose $install_prog "$@" || exit $?
|
||||
|
||||
# Iterate over all destination program names.
|
||||
# func_iterate f
|
||||
# applies f to each destination program names, after setting destprog.
|
||||
sed_basename_of_file='s|^.*/||'
|
||||
func_iterate ()
|
||||
{
|
||||
if test -n "$destprog_directory"; then
|
||||
prev_arg=
|
||||
for arg
|
||||
do
|
||||
if test -n "prev_arg"; then
|
||||
destprog="$destprog_directory"/`echo "$prev_arg" | sed -e "$sed_basename_of_file"`
|
||||
$1
|
||||
fi
|
||||
prev_arg="$arg"
|
||||
done
|
||||
else
|
||||
$1
|
||||
fi
|
||||
}
|
||||
|
||||
# Run strip_command.
|
||||
func_strip ()
|
||||
{
|
||||
# Remove trailing $exeext, if present.
|
||||
if test -n "$exeext"; then
|
||||
destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"`
|
||||
fi
|
||||
func_verbose "$strip_prog" "$destprog$exeext" || exit $?
|
||||
}
|
||||
if test "$strip_prog" != ':'; then
|
||||
func_iterate func_strip
|
||||
fi
|
||||
|
||||
# If the platform doesn't support LD_LIBRARY_PATH or similar, we cannot build
|
||||
# a wrapper.
|
||||
test -n "$library_path_var" || exit 0
|
||||
|
||||
libdirs=
|
||||
save_IFS="$IFS"; IFS=":"
|
||||
for dir in $library_path_value; do
|
||||
IFS="$save_IFS"
|
||||
if test -n "$dir"; then
|
||||
case "$libdirs" in
|
||||
*"\"$dir\""*) ;; # remove duplicate
|
||||
*) libdirs="$libdirs\"$dir\"," ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
# If there are no library directories to add at runtime, we don't need a
|
||||
# wrapper.
|
||||
test -n "$libdirs" || exit 0
|
||||
|
||||
# Determine installdir from destprog, removing a leading destdir if present.
|
||||
if test -n "$destprog_directory"; then
|
||||
installdir="$destprog_directory"
|
||||
else
|
||||
installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'`
|
||||
fi
|
||||
if test -n "$destdir"; then
|
||||
sed_quote='s,\([|.\*^$[]\),\\\1,g'
|
||||
sed_remove_destdir='s|^'`echo "$destdir" | sed -e "$sed_quote"`'||'
|
||||
installdir=`echo "$installdir" | sed -e "$sed_remove_destdir"`
|
||||
fi
|
||||
|
||||
# Compile and install wrapper.
|
||||
func_create_wrapper ()
|
||||
{
|
||||
# Remove trailing $exeext, if present.
|
||||
if test -n "$exeext"; then
|
||||
destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"`
|
||||
fi
|
||||
|
||||
# Compile wrapper.
|
||||
func_verbose $compile_command \
|
||||
-I"$builddir" -I"$srcdir" -I"$config_h_dir" \
|
||||
-DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC \
|
||||
-D"INSTALLPREFIX=\"$prefix\"" -D"INSTALLDIR=\"$installdir\"" \
|
||||
-D"LIBPATHVAR=\"$library_path_var\"" -D"LIBDIRS=$libdirs" \
|
||||
-D"EXEEXT=\"$exeext\"" \
|
||||
"$srcdir"/relocwrapper.c \
|
||||
"$srcdir"/progname.c \
|
||||
"$srcdir"/progreloc.c \
|
||||
"$srcdir"/areadlink.c \
|
||||
"$srcdir"/careadlinkat.c \
|
||||
"$srcdir"/allocator.c \
|
||||
"$srcdir"/readlink.c \
|
||||
"$srcdir"/stat.c \
|
||||
"$srcdir"/canonicalize-lgpl.c \
|
||||
"$srcdir"/malloc/scratch_buffer_dupfree.c \
|
||||
"$srcdir"/malloc/scratch_buffer_grow.c \
|
||||
"$srcdir"/malloc/scratch_buffer_grow_preserve.c \
|
||||
"$srcdir"/malloc/scratch_buffer_set_array_size.c \
|
||||
"$srcdir"/malloc.c \
|
||||
"$srcdir"/realloc.c \
|
||||
"$srcdir"/free.c \
|
||||
"$srcdir"/mempcpy.c \
|
||||
"$srcdir"/rawmemchr.c \
|
||||
"$srcdir"/malloca.c \
|
||||
"$srcdir"/relocatable.c \
|
||||
"$srcdir"/setenv.c \
|
||||
"$srcdir"/c-ctype.c \
|
||||
-o "$destprog.wrapper$exeext"
|
||||
rc=$?
|
||||
# Clean up object files left over in the current directory by the native C
|
||||
# compilers on Solaris, HP-UX, OSF/1, IRIX.
|
||||
rm -f relocwrapper.o \
|
||||
progname.o \
|
||||
progreloc.o \
|
||||
areadlink.o \
|
||||
careadlinkat.o \
|
||||
allocator.o \
|
||||
readlink.o \
|
||||
stat.o \
|
||||
canonicalize-lgpl.o \
|
||||
scratch_buffer_dupfree.o \
|
||||
scratch_buffer_grow.o \
|
||||
scratch_buffer_grow_preserve.o \
|
||||
scratch_buffer_set_array_size.o \
|
||||
malloc.o \
|
||||
realloc.o \
|
||||
free.o \
|
||||
mempcpy.o \
|
||||
rawmemchr.o \
|
||||
malloca.o \
|
||||
relocatable.o \
|
||||
setenv.o \
|
||||
c-ctype.o
|
||||
test $rc = 0 || exit $?
|
||||
# Clean up debugging information left over by the native C compiler on MacOS X.
|
||||
rm -rf "$destprog.wrapper$exeext.dSYM"
|
||||
test $rc = 0 || exit $?
|
||||
|
||||
# Strip wrapper.
|
||||
test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $?
|
||||
|
||||
# Rename $destprog.wrapper -> $destprog -> $destprog.bin.
|
||||
ln -f "$destprog$exeext" "$destprog.bin$exeext" \
|
||||
|| { rm -f "$destprog.bin$exeext" \
|
||||
&& cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \
|
||||
|| exit 1
|
||||
mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1
|
||||
}
|
||||
func_iterate func_create_wrapper
|
||||
|
||||
exit 0
|
||||
+541
@@ -0,0 +1,541 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
# Compile a Java program.
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# This uses the same choices as javacomp.c, but instead of relying on the
|
||||
# environment settings at run time, it uses the environment variables
|
||||
# present at configuration time.
|
||||
#
|
||||
# This is a separate shell script, because it must be able to unset JAVA_HOME
|
||||
# in some cases, which a simple shell command cannot do.
|
||||
#
|
||||
# The extra CLASSPATH must have been set prior to calling this script.
|
||||
# Options that can be passed are -O, -g and "-d DIRECTORY".
|
||||
|
||||
CONF_JAVAC='@CONF_JAVAC@'
|
||||
CONF_CLASSPATH='@CLASSPATH@'
|
||||
if test -n "@HAVE_JAVAC_ENVVAR@"; then
|
||||
# Combine given CLASSPATH and configured CLASSPATH.
|
||||
if test -n "$CLASSPATH"; then
|
||||
CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
|
||||
else
|
||||
CLASSPATH="$CONF_CLASSPATH"
|
||||
fi
|
||||
export CLASSPATH
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
|
||||
exec $CONF_JAVAC "$@"
|
||||
else
|
||||
unset JAVA_HOME
|
||||
if test -n "@HAVE_GCJ_C@"; then
|
||||
# In this case, $CONF_JAVAC starts with "gcj -C".
|
||||
CLASSPATH="$CLASSPATH"
|
||||
export CLASSPATH
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
|
||||
exec $CONF_JAVAC "$@"
|
||||
else
|
||||
if test -n "@HAVE_JAVAC@"; then
|
||||
# In this case, $CONF_JAVAC starts with "javac".
|
||||
CLASSPATH="$CLASSPATH"
|
||||
export CLASSPATH
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
|
||||
exec $CONF_JAVAC "$@"
|
||||
else
|
||||
if test -n "@HAVE_JIKES@"; then
|
||||
# In this case, $CONF_JAVAC starts with "jikes".
|
||||
# Combine given CLASSPATH and configured CLASSPATH.
|
||||
if test -n "$CLASSPATH"; then
|
||||
CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
|
||||
else
|
||||
CLASSPATH="$CONF_CLASSPATH"
|
||||
fi
|
||||
export CLASSPATH
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
|
||||
exec $CONF_JAVAC "$@"
|
||||
else
|
||||
echo 'Java compiler not found, try installing gcj or set $JAVAC, then reconfigure' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
# Execute a Java program.
|
||||
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# This uses the same choices as javaexec.c, but instead of relying on the
|
||||
# environment settings at run time, it uses the environment variables
|
||||
# present at configuration time.
|
||||
#
|
||||
# This is a separate shell script, because it must be able to unset JAVA_HOME
|
||||
# in some cases, which a simple shell command cannot do.
|
||||
#
|
||||
# The extra CLASSPATH must have been set prior to calling this script.
|
||||
|
||||
CONF_JAVA='@CONF_JAVA@'
|
||||
CONF_CLASSPATH='@CLASSPATH@'
|
||||
if test -n "@HAVE_JAVA_ENVVAR@"; then
|
||||
# Combine given CLASSPATH and configured CLASSPATH.
|
||||
if test -n "$CLASSPATH"; then
|
||||
CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
|
||||
else
|
||||
CLASSPATH="$CONF_CLASSPATH"
|
||||
fi
|
||||
export CLASSPATH
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
|
||||
exec $CONF_JAVA "$@"
|
||||
else
|
||||
unset JAVA_HOME
|
||||
export CLASSPATH
|
||||
if test -n "@HAVE_GIJ@"; then
|
||||
# In this case, $CONF_JAVA is "gij".
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
|
||||
exec $CONF_JAVA "$@"
|
||||
else
|
||||
if test -n "@HAVE_JAVA@"; then
|
||||
# In this case, $CONF_JAVA is "java".
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
|
||||
exec $CONF_JAVA "$@"
|
||||
else
|
||||
if test -n "@HAVE_JRE@"; then
|
||||
# In this case, $CONF_JAVA is "jre".
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
|
||||
exec $CONF_JAVA "$@"
|
||||
else
|
||||
if test -n "@HAVE_JVIEW@"; then
|
||||
# In this case, $CONF_JAVA is "jview".
|
||||
test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
|
||||
exec $CONF_JAVA "$@"
|
||||
else
|
||||
echo 'Java virtual machine not found, try installing gij or set $JAVA, then reconfigure' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
# libtool-reloc - libtool wrapper with support for relocatable programs
|
||||
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||
# Written by Bruno Haible <bruno@clisp.org>, 2019.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Usage: libtool-reloc libtool LIBTOOL_ARGUMENTS
|
||||
|
||||
# Outputs a command and runs it.
|
||||
func_verbose ()
|
||||
{
|
||||
# Make it easy to copy&paste the printed command into a shell in most cases,
|
||||
# by escaping '\\', '"', and '$'. This is not perfect, just good enough.
|
||||
echo "$@" | sed -e 's/\([\\"$]\)/\\\1/g'
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Determine the mode from the arguments.
|
||||
mode=
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
--mode=link) mode=link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$mode" = link; then
|
||||
# Determine the target from the arguments.
|
||||
target=
|
||||
next_is_target=false
|
||||
for arg
|
||||
do
|
||||
if $next_is_target; then
|
||||
target="$arg"
|
||||
next_is_target=false
|
||||
else
|
||||
case "$arg" in
|
||||
-o) next_is_target=true ;;
|
||||
*) next_is_target=false ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
case "$target" in
|
||||
*.la)
|
||||
# When creating a library:
|
||||
# 1. Add a '-Wl,-rpath,@loader_path' option.
|
||||
# (A '-R @loader_path' option does not work: libtool produces
|
||||
# an error "error: only absolute run-paths are allowed".)
|
||||
# (Also note that 'install_name_tool -add_rpath @loader_path ...'
|
||||
# does not work on Mac OS X 10.5.)
|
||||
# This is done through the RELOCATABLE_LDFLAGS macro.
|
||||
# 2. After creating the library, run
|
||||
# install_name_tool -id @rpath/$dlname $target_dir/.libs/$dlname
|
||||
# (This is easier than to modify the libtool script to emit a different
|
||||
# install_name. Also, an option '-Wl,-install_name,@rpath/$dlname' does
|
||||
# not work since libtool emits another option '-Wl,-install_name,...'
|
||||
# after it.
|
||||
"$@" && {
|
||||
dlname_assignment=`grep '^dlname=' "$target"`
|
||||
dlname=
|
||||
eval "$dlname_assignment"
|
||||
# Nothing to do when --disable-shared was specified.
|
||||
if test -n "$dlname"; then
|
||||
target_dir=`dirname "$target"`
|
||||
if test -f "$target_dir/.libs/$dlname"; then
|
||||
func_verbose install_name_tool -id "@rpath/$dlname" "$target_dir/.libs/$dlname"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
;;
|
||||
*)
|
||||
"$@"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
@@ -0,0 +1,22 @@
|
||||
## Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
EXTRA_DIST += \
|
||||
build-aux/Darwin.valgrind \
|
||||
build-aux/Linux.valgrind \
|
||||
build-aux/cross-options.pl \
|
||||
build-aux/move-if-change \
|
||||
build-aux/prev-version.txt \
|
||||
build-aux/update-b4-copyright
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1995-2021 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No file. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: mdate-sh [--help] [--version] FILE
|
||||
|
||||
Pretty-print the modification day of FILE, in the format:
|
||||
1 January 1970
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "mdate-sh $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
error ()
|
||||
{
|
||||
echo "$0: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Use UTC to get reproducible result.
|
||||
TZ=UTC0
|
||||
export TZ
|
||||
|
||||
# GNU ls changes its time format in response to the TIME_STYLE
|
||||
# variable. Since we cannot assume 'unset' works, revert this
|
||||
# variable to its documented default.
|
||||
if test "${TIME_STYLE+set}" = set; then
|
||||
TIME_STYLE=posix-long-iso
|
||||
export TIME_STYLE
|
||||
fi
|
||||
|
||||
save_arg1=$1
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
# Avoid user/group names that might have spaces, when possible.
|
||||
if ls -n /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command="$ls_command -n"
|
||||
fi
|
||||
|
||||
# A 'ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named "Jan", or "Feb", etc. However, it's unlikely that '/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set x`$ls_command /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
test $# -gt 0 || error "failed parsing '$ls_command /' output"
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -n "$month" || error "failed parsing '$ls_command /' output"
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set dummy x`eval "$ls_command \"\\\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Because of the dummy argument above, month is in $2.
|
||||
#
|
||||
# On a POSIX system, we should have
|
||||
#
|
||||
# $# = 5
|
||||
# $1 = file size
|
||||
# $2 = month
|
||||
# $3 = day
|
||||
# $4 = year or time
|
||||
# $5 = filename
|
||||
#
|
||||
# On Darwin 7.7.0 and 7.6.0, we have
|
||||
#
|
||||
# $# = 4
|
||||
# $1 = day
|
||||
# $2 = month
|
||||
# $3 = year or time
|
||||
# $4 = filename
|
||||
|
||||
# Get the month.
|
||||
case $2 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
case $3 in
|
||||
???*) day=$1;;
|
||||
*) day=$3; shift;;
|
||||
esac
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
# Like mv $1 $2, but if the files are the same, just delete $1.
|
||||
# Status is zero if successful, nonzero otherwise.
|
||||
|
||||
VERSION='2018-03-07 03:47'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
usage="usage: $0 SOURCE DEST"
|
||||
|
||||
help="$usage
|
||||
or: $0 OPTION
|
||||
If SOURCE is different than DEST, then move it to DEST; else remove SOURCE.
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
The variable CMPPROG can be used to specify an alternative to 'cmp'.
|
||||
|
||||
Report bugs to <bug-gnulib@gnu.org>."
|
||||
|
||||
year=`expr "$VERSION" : '\([^-]*\)'`
|
||||
version=`expr "$VERSION" : '\([^ ]*\)'`
|
||||
version="move-if-change (gnulib) $version
|
||||
Copyright $year Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
--help | --hel | --he | --h)
|
||||
exec echo "$help" ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v)
|
||||
exec echo "$version" ;;
|
||||
--)
|
||||
shift
|
||||
break ;;
|
||||
-*)
|
||||
echo "$0: invalid option: $arg" >&2
|
||||
exit 1 ;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
test $# -eq 2 || { echo "$0: $usage" >&2; exit 1; }
|
||||
|
||||
if test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null; then
|
||||
rm -f -- "$1"
|
||||
else
|
||||
if mv -f -- "$1" "$2"; then :; else
|
||||
# Ignore failure due to a concurrent move-if-change.
|
||||
test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null && rm -f -- "$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
## Local Variables:
|
||||
## eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
## time-stamp-start: "VERSION='"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Rewrite a gnulib.mk, adding prefixes to work with automake's subdir-objects.
|
||||
|
||||
# Copyright (C) 2012-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
#
|
||||
# Written by Jim Meyering
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2020-04-04 15:07'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
use strict;
|
||||
use IO::File;
|
||||
use Getopt::Long;
|
||||
use File::Basename; # for dirname
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
my $prefix;
|
||||
my $lib_name;
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME --lib-name=NAME FILE
|
||||
or: $ME [--help|--version]
|
||||
Rewrite a gnulib-tool-generated FILE like lib/gnulib.mk to work with
|
||||
automake's subdir-objects.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
This option must be specified:
|
||||
|
||||
--lib-name=NAME library name, often "lib\$project"
|
||||
|
||||
The following are optional:
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
# contents ($FILE_NAME)
|
||||
# ---------------------
|
||||
sub contents ($)
|
||||
{
|
||||
my ($file) = @_;
|
||||
local $/; # Turn on slurp-mode.
|
||||
my $f = new IO::File "< $file" or die "$file";
|
||||
my $contents = $f->getline or die "$file";
|
||||
$f->close;
|
||||
return $contents;
|
||||
}
|
||||
|
||||
# prefix_word ($WORD)
|
||||
# -------------------
|
||||
# Do not prefix special words such as variable dereferences. Also,
|
||||
# "Makefile" is really "Makefile", since precisely there is no
|
||||
# lib/Makefile.
|
||||
sub prefix_word ($)
|
||||
{
|
||||
local ($_) = @_;
|
||||
$_ = $prefix . $_
|
||||
unless (/^-/ || m{^\$\(\w+\)} || $_ eq "Makefile" || $_ eq '\\'
|
||||
|| $_ eq '@ALLOCA@');
|
||||
return $_;
|
||||
}
|
||||
|
||||
|
||||
# prefix_words ($TEXT)
|
||||
# --------------------
|
||||
sub prefix_words ($)
|
||||
{
|
||||
local ($_) = @_;
|
||||
s{(\S+)}{prefix_word($1)}gem;
|
||||
return $_;
|
||||
}
|
||||
|
||||
|
||||
# prefix_assignment ($LHS-AND-ASSIGN-OP, $RHS)
|
||||
# --------------------------------------------
|
||||
sub prefix_assignment ($$)
|
||||
{
|
||||
my ($lhs_and_assign_op, $rhs) = @_;
|
||||
|
||||
# Some variables are initialized by gnulib.mk, and we don't want
|
||||
# that. Change '=' to '+='.
|
||||
if ($lhs_and_assign_op =~ /^(GPERF|V_GPERF.*) =$/)
|
||||
{
|
||||
# Do not change the RHS, which specifies the GPERF program.
|
||||
}
|
||||
# Don't change variables such as HAVE_INCLUDE_NEXT.
|
||||
elsif ($lhs_and_assign_op =~ /^HAVE_/)
|
||||
{
|
||||
}
|
||||
elsif ($lhs_and_assign_op =~
|
||||
/^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES
|
||||
|CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES
|
||||
|AM_GNU_GETTEXT)\ =/x)
|
||||
{
|
||||
$lhs_and_assign_op =~ s/=/+=/;
|
||||
}
|
||||
# We don't want things such as AM_CPPFLAGS +=
|
||||
# -DDEFAULT_TEXT_DOMAIN=\"bison-gnulib\" to apply to the whole
|
||||
# Makefile.in: scope it to the library: libbison_a_CPPFLAGS =
|
||||
# $(AM_CPPFLAGS) -DDEFAULT_TEXT_DOMAIN=\"bison-gnulib\".
|
||||
elsif ($lhs_and_assign_op =~
|
||||
/^(AM_CFLAGS|AM_CPPFLAGS)\ \+?=/x)
|
||||
{
|
||||
$lhs_and_assign_op =~ s/^AM_(\w+)\ \+?=/${lib_name}_a_$1 =/;
|
||||
$rhs = " \$(AM_$1)$rhs";
|
||||
}
|
||||
# We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
|
||||
elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/)
|
||||
{
|
||||
$lhs_and_assign_op =~ s/^/# /;
|
||||
}
|
||||
# Elide any SUFFIXES assignment or concatenation.
|
||||
elsif ($lhs_and_assign_op =~ /^SUFFIXES /)
|
||||
{
|
||||
$lhs_and_assign_op =~ s/^/# /;
|
||||
}
|
||||
# The words are (probably) paths to files in lib/: prefix them.
|
||||
else
|
||||
{
|
||||
$rhs = prefix_words($rhs)
|
||||
}
|
||||
|
||||
# Variables whose name depend on the location: libbison_a_SOURCES =>
|
||||
# lib_libbison_a_SOURCES.
|
||||
$lhs_and_assign_op =~ s/($lib_name)/lib_$1/g;
|
||||
|
||||
$lhs_and_assign_op . $rhs;
|
||||
}
|
||||
|
||||
# prefix $CONTENTS
|
||||
# ----------------
|
||||
# $CONTENTS is a Makefile content. Post-process it so that each file-name
|
||||
# is prefixed with $prefix (e.g., "lib/").
|
||||
#
|
||||
# Relies heavily on the regularity of the file generated by gnulib-tool.
|
||||
sub prefix ($)
|
||||
{
|
||||
# Work on $_.
|
||||
local ($_) = @_;
|
||||
|
||||
# Prefix all the occurrence of files in rules. If there is nothing
|
||||
# after in the :, it's probably a phony target, or a suffix rule.
|
||||
# Don't touch it.
|
||||
s{^([-\w+/]+\.[-\w.]+ *: *\S.*)$}
|
||||
{prefix_words($1)}gem;
|
||||
|
||||
# Prefix files in variables.
|
||||
s{^([\w.]+\s*\+?=)(.*)$}
|
||||
{prefix_assignment($1, $2)}gem;
|
||||
|
||||
# $(srcdir)/ is actually $(top_srcdir)/$prefix/.
|
||||
# The trailing slash is required to avoid matching this rule:
|
||||
# test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile
|
||||
s{\$\(srcdir\)/}{\$(top_srcdir)/$prefix}g;
|
||||
|
||||
# Sometimes, t-$@ is used instead of $@-t, which, of course, does
|
||||
# not work when we have a $@ with a directory in it.
|
||||
s{t-\$\@}{\$\@-t}g;
|
||||
|
||||
# Some AC_SUBST patterns remain and would better be Make macros.
|
||||
s{\@(MKDIR_P)\@}{\$($1)}g;
|
||||
|
||||
# Adjust paths in mkdir.
|
||||
s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
# process ($IN)
|
||||
# -------------
|
||||
sub process ($)
|
||||
{
|
||||
my ($file) = @_;
|
||||
my ($bak) = "$file.bak";
|
||||
rename ($file, $bak) or die "$ME: rename $file $bak failed: $!\n";
|
||||
my $contents = contents ($bak);
|
||||
$contents = prefix ($contents);
|
||||
my $out = new IO::File(">$file")
|
||||
or die "$ME: $file: failed to open for writing: $!\n";
|
||||
print $out $contents;
|
||||
}
|
||||
|
||||
{
|
||||
GetOptions
|
||||
(
|
||||
'lib-name=s' => \$lib_name,
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
) or usage 1;
|
||||
|
||||
my $fail = 0;
|
||||
defined $lib_name
|
||||
or (warn "$ME: no library name; use --lib-name=NAME\n"), $fail = 1;
|
||||
|
||||
# There must be exactly one argument.
|
||||
@ARGV == 0
|
||||
and (warn "$ME: missing FILE argument\n"), $fail = 1;
|
||||
1 < @ARGV
|
||||
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
|
||||
$fail = 1;
|
||||
$fail
|
||||
and usage 1;
|
||||
|
||||
my $file = $ARGV[0];
|
||||
$prefix = (dirname $file) . '/';
|
||||
warn "prefix=$prefix\n";
|
||||
|
||||
process $file;
|
||||
}
|
||||
|
||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||
## Local Variables:
|
||||
## perl-indent-level: 2
|
||||
## perl-continued-statement-offset: 2
|
||||
## perl-continued-brace-offset: 0
|
||||
## perl-brace-offset: 0
|
||||
## perl-brace-imaginary-offset: 0
|
||||
## perl-label-offset: -2
|
||||
## cperl-indent-level: 2
|
||||
## cperl-brace-offset: 0
|
||||
## cperl-continued-brace-offset: 0
|
||||
## cperl-label-offset: -2
|
||||
## cperl-extra-newline-before-brace: t
|
||||
## cperl-merge-trailing-else: nil
|
||||
## cperl-continued-statement-offset: 2
|
||||
## eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
## time-stamp-line-limit: 50
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
@@ -0,0 +1 @@
|
||||
2.0
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent linker command for putting a relocatable library
|
||||
# search path into an executable.
|
||||
#
|
||||
# Copyright 2003-2021 Free Software Foundation, Inc.
|
||||
# Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variable LD should be set by the caller.
|
||||
#
|
||||
# The second argument is a colon separated list of directories that contain
|
||||
# the libraries at installation time.
|
||||
#
|
||||
# The third argument is the directory into which the executable is going to be
|
||||
# installed.
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
library_path_value=$2
|
||||
|
||||
installdir=$3
|
||||
|
||||
# Verify that installdir is absolute.
|
||||
case "$installdir" in
|
||||
/*) ;;
|
||||
*)
|
||||
echo "installdir is not absolute: $installdir" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
origin_token=
|
||||
case "$host_os" in
|
||||
linux* | gnu* | kfreebsd* | \
|
||||
freebsd* | dragonfly* | midnightbsd* | \
|
||||
netbsd* | \
|
||||
openbsd* | \
|
||||
solaris* | \
|
||||
haiku*)
|
||||
origin_token='$ORIGIN'
|
||||
;;
|
||||
darwin*)
|
||||
origin_token='@loader_path'
|
||||
;;
|
||||
esac
|
||||
if test -n "$origin_token"; then
|
||||
# We are not on AIX, HP-UX, or IRIX. Therefore the -rpath options are
|
||||
# cumulative.
|
||||
rpath_options=
|
||||
save_IFS="$IFS"; IFS=":"
|
||||
for dir in $library_path_value; do
|
||||
IFS="$save_IFS"
|
||||
case "$dir" in
|
||||
/*)
|
||||
# Make dir relative to installdir. (Works only if dir is absolute.)
|
||||
idir="$installdir"
|
||||
while true; do
|
||||
dfirst=`echo "$dir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'`
|
||||
ifirst=`echo "$idir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'`
|
||||
if test -z "$dfirst" || test -z "$ifirst"; then
|
||||
break
|
||||
fi
|
||||
if test "$dfirst" != "$ifirst"; then
|
||||
break
|
||||
fi
|
||||
dir=`echo "$dir" | sed -e 's,^//*[^/]*,,'`
|
||||
idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'`
|
||||
done
|
||||
dir="$origin_token"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir"
|
||||
# Augment rpath_options with dir.
|
||||
rpath_options="${rpath_options}${rpath_options:+ }-Wl,-rpath,$dir"
|
||||
;;
|
||||
*)
|
||||
if test -n "$dir"; then
|
||||
echo "libdir is not absolute: $dir" 1>&2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
# Output it.
|
||||
if test -n "$rpath_options"; then
|
||||
case "$host_os" in
|
||||
# At least some versions of FreeBSD, DragonFly, and OpenBSD need the
|
||||
# linker option "-z origin". See <https://lekensteyn.nl/rpath.html>.
|
||||
freebsd* | dragonfly* | openbsd*)
|
||||
rpath_options="-Wl,-z,origin $rpath_options" ;;
|
||||
esac
|
||||
echo "$rpath_options"
|
||||
fi
|
||||
else
|
||||
echo "relocation via rpath not supported on this system: $host" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,99 @@
|
||||
# The functions in this file provide support for relocatability of
|
||||
# shell scripts. They should be included near the beginning of each
|
||||
# shell script in a relocatable program, by adding @relocatable_sh@
|
||||
# and causing the script to be expanded with AC_CONFIG_FILES. A
|
||||
# small amount of additional code must be added and adapted to the
|
||||
# package by hand; see doc/relocatable-maint.texi (in Gnulib) for
|
||||
# details.
|
||||
#
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Support for relocatability.
|
||||
func_find_curr_installdir ()
|
||||
{
|
||||
# Determine curr_installdir, even taking into account symlinks.
|
||||
curr_executable="$0"
|
||||
case "$curr_executable" in
|
||||
*/* | *\\*) ;;
|
||||
*) # Need to look in the PATH.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
# Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
|
||||
# contains only /bin. Note that ksh looks also at the FPATH variable,
|
||||
# so we have to set that as well for the test.
|
||||
PATH_SEPARATOR=:
|
||||
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|
||||
&& { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|
||||
|| PATH_SEPARATOR=';'
|
||||
}
|
||||
fi
|
||||
save_IFS="$IFS"; IFS="$PATH_SEPARATOR"
|
||||
for dir in $PATH; do
|
||||
IFS="$save_IFS"
|
||||
test -z "$dir" && dir=.
|
||||
for exec_ext in ''; do
|
||||
if test -f "$dir/$curr_executable$exec_ext"; then
|
||||
curr_executable="$dir/$curr_executable$exec_ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
;;
|
||||
esac
|
||||
# Make absolute.
|
||||
case "$curr_executable" in
|
||||
/* | ?:/* | ?:\\*) ;;
|
||||
*) curr_executable=`pwd`/"$curr_executable" ;;
|
||||
esac
|
||||
# Resolve symlinks.
|
||||
sed_dirname='s,/[^/]*$,,'
|
||||
sed_linkdest='s,^.* -> \(.*\),\1,p'
|
||||
while : ; do
|
||||
lsline=`LC_ALL=C ls -l "$curr_executable"`
|
||||
case "$lsline" in
|
||||
*" -> "*)
|
||||
linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
|
||||
case "$linkdest" in
|
||||
/* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
|
||||
*) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
|
||||
esac ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
|
||||
# Canonicalize.
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
}
|
||||
func_find_prefixes ()
|
||||
{
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
orig_installprefix="$orig_installdir"
|
||||
curr_installprefix="$curr_installdir"
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name NAME --log-file PATH --trs-file PATH
|
||||
[--expect-failure {yes|no}] [--color-tests {yes|no}]
|
||||
[--enable-hard-errors {yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
See the GNU Automake documentation for information.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here. We create the file first, then append to it,
|
||||
# to ameliorate tests themselves also writing to the log file. Our tests
|
||||
# don't, but others can (automake bug#35762).
|
||||
: >"$log_file"
|
||||
"$@" >>"$log_file" 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/perl -0777 -pi
|
||||
|
||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||
# include the current year.
|
||||
|
||||
# Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $margin = 72;
|
||||
|
||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
||||
{
|
||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
||||
$this_year = $year + 1900;
|
||||
}
|
||||
my $old_re = <<'EOF'
|
||||
(
|
||||
(?:^|\n)
|
||||
#BEFORE
|
||||
(?:
|
||||
b4_copyright\(\[[^][]*]
|
||||
| m4_(?:push|pop)def\(\[b4_copyright_years]
|
||||
)
|
||||
#AFTER
|
||||
)
|
||||
(?:
|
||||
,\s*
|
||||
(
|
||||
\[\s* (?:\d{4}(?:,\s*|-))* (\d{4}) \s*]
|
||||
)
|
||||
)?
|
||||
\)
|
||||
EOF
|
||||
;
|
||||
|
||||
while (/($old_re)/gx)
|
||||
{
|
||||
my $start = pos() - length ($1);
|
||||
my $b4_copyright_line = $2;
|
||||
my $year_lines = $3;
|
||||
my $final_year = $4;
|
||||
$year_lines .= ')';
|
||||
|
||||
# If there was a second argument, it contains years, so update them.
|
||||
if ($final_year)
|
||||
{
|
||||
$b4_copyright_line .= ',';
|
||||
if ($final_year != $this_year)
|
||||
{
|
||||
# Update the year.
|
||||
$year_lines =~ s/$final_year/$final_year, $this_year/;
|
||||
}
|
||||
|
||||
# Normalize all whitespace.
|
||||
$year_lines =~ s/\s+/ /g;
|
||||
|
||||
# Put spaces after commas.
|
||||
$year_lines =~ s/, ?/, /g;
|
||||
|
||||
# Compress to intervals.
|
||||
$year_lines =~
|
||||
s/
|
||||
(\d{4})
|
||||
(?:
|
||||
(,\ |-)
|
||||
((??{
|
||||
if ($2 eq '-') { '\d{4}'; }
|
||||
elsif (!$3) { $1 + 1; }
|
||||
else { $3 + 1; }
|
||||
}))
|
||||
)+
|
||||
/$1-$3/gx;
|
||||
|
||||
# Format within margin.
|
||||
my $year_lines_new;
|
||||
my $indent = index ($b4_copyright_line, '[');
|
||||
--$indent if ($b4_copyright_line =~ m/^\n/);
|
||||
while (length $year_lines)
|
||||
{
|
||||
my $text_margin = $margin - $indent;
|
||||
if (($year_lines =~ s/^(.{1,$text_margin})(?: |$)//)
|
||||
|| ($year_lines =~ s/^([\S]+)(?: |$)//))
|
||||
{
|
||||
my $line = "\n" . (' 'x$indent) . $1;
|
||||
++$indent if (!$year_lines_new);
|
||||
$year_lines_new .= $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Should be unreachable, but we don't want an infinite
|
||||
# loop if it can be reached.
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
# Replace the old invocation. Should never die.
|
||||
die if (!s/$old_re\G/$b4_copyright_line$year_lines_new/x);
|
||||
|
||||
# Prepare for the next search.
|
||||
pos () = $start + length ("$b4_copyright_line$year_lines_new");
|
||||
}
|
||||
}
|
||||
|
||||
while (/(\bb4_copyright\()/g)
|
||||
{
|
||||
my $start = pos () - length ($1);
|
||||
my $end = pos ();
|
||||
my $re = $old_re;
|
||||
pos () = $start;
|
||||
$re =~ s/\#BEFORE/\\G/;
|
||||
if (!/$re/x)
|
||||
{
|
||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
||||
print STDERR
|
||||
"$ARGV:$line: warning: failed to update a b4_copyright\n";
|
||||
}
|
||||
pos () = $end;
|
||||
}
|
||||
|
||||
while (/(\[b4_copyright_years])/g)
|
||||
{
|
||||
my $start = pos () - length ($1);
|
||||
my $end = pos ();
|
||||
my $re = $old_re;
|
||||
$re =~ s/\#AFTER/\\G/;
|
||||
if (!/$re/x)
|
||||
{
|
||||
# The substr operation blows away pos (), so restoring pos ()
|
||||
# at the end is necessary.
|
||||
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
|
||||
print STDERR
|
||||
"$ARGV:$line: warning: failed to update a"
|
||||
. " b4_copyright_years\n";
|
||||
}
|
||||
pos () = $end;
|
||||
}
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Update an FSF copyright year list to include the current year.
|
||||
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Jim Meyering and Joel E. Denny
|
||||
|
||||
# This script updates an FSF copyright year list to include the current year.
|
||||
# Usage: update-copyright [FILE...]
|
||||
#
|
||||
# The arguments to this script should be names of files that contain
|
||||
# copyright statements to be updated. The copyright holder's name
|
||||
# defaults to "Free Software Foundation, Inc." but may be changed to
|
||||
# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
|
||||
# variable.
|
||||
#
|
||||
# For example, you might wish to use the update-copyright target rule
|
||||
# in maint.mk from gnulib's maintainer-makefile module.
|
||||
#
|
||||
# Iff a copyright statement is recognized in a file and the final
|
||||
# year is not the current year, then the statement is updated for the
|
||||
# new year and it is reformatted to:
|
||||
#
|
||||
# 1. Fit within 72 columns.
|
||||
# 2. Convert 2-digit years to 4-digit years by prepending "19".
|
||||
# 3. Expand copyright year intervals. (See "Environment variables"
|
||||
# below.)
|
||||
#
|
||||
# A warning is printed for every file for which no copyright
|
||||
# statement is recognized.
|
||||
#
|
||||
# Each file's copyright statement must be formatted correctly in
|
||||
# order to be recognized. For example, each of these is fine:
|
||||
#
|
||||
# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
|
||||
# Foundation, Inc.
|
||||
#
|
||||
# # Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# /*
|
||||
# * Copyright © 90,2005,2007-2009
|
||||
# * Free Software Foundation, Inc.
|
||||
# */
|
||||
#
|
||||
# However, the following format is not recognized because the line
|
||||
# prefix changes after the first line:
|
||||
#
|
||||
# ## Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||
# # Foundation, Inc.
|
||||
#
|
||||
# However, any correctly formatted copyright statement following
|
||||
# a non-matching copyright statements would be recognized.
|
||||
#
|
||||
# The exact conditions that a file's copyright statement must meet
|
||||
# to be recognized are:
|
||||
#
|
||||
# 1. It is the first copyright statement that meets all of the
|
||||
# following conditions. Subsequent copyright statements are
|
||||
# ignored.
|
||||
# 2. Its format is "Copyright (C)", then a list of copyright years,
|
||||
# and then the name of the copyright holder.
|
||||
# 3. The "(C)" takes one of the following forms or is omitted
|
||||
# entirely:
|
||||
#
|
||||
# A. (C)
|
||||
# B. (c)
|
||||
# C. @copyright{}
|
||||
# D. ©
|
||||
# E. ©
|
||||
#
|
||||
# 4. The "Copyright" appears at the beginning of a line, except that it
|
||||
# may be prefixed by any sequence (e.g., a comment) of no more than
|
||||
# 5 characters -- including white space.
|
||||
# 5. Iff such a prefix is present, the same prefix appears at the
|
||||
# beginning of each remaining line within the FSF copyright
|
||||
# statement. There is one exception in order to support C-style
|
||||
# comments: if the first line's prefix contains nothing but
|
||||
# whitespace surrounding a "/*", then the prefix for all subsequent
|
||||
# lines is the same as the first line's prefix except with each of
|
||||
# "/" and possibly "*" replaced by a " ". The replacement of "*"
|
||||
# by " " is consistent throughout all subsequent lines.
|
||||
# 6. Blank lines, even if preceded by the prefix, do not appear
|
||||
# within the FSF copyright statement.
|
||||
# 7. Each copyright year is 2 or 4 digits, and years are separated by
|
||||
# commas, "-", or "--". Whitespace may appear after commas.
|
||||
#
|
||||
# Environment variables:
|
||||
#
|
||||
# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
|
||||
# is reformatted even if it does not need updating for the new
|
||||
# year. If unset or set to 0, only updated FSF copyright
|
||||
# statements are reformatted.
|
||||
# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
|
||||
# copyright years (such as 90, 1991, 1992-2007, 2008) in a
|
||||
# reformatted FSF copyright statement is collapsed to a single
|
||||
# interval (such as 1990-2008). If unset or set to 0, all existing
|
||||
# copyright year intervals in a reformatted FSF copyright statement
|
||||
# are expanded instead.
|
||||
# If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
|
||||
# to the minimal containing range. For example, convert
|
||||
# 2000, 2004-2007, 2009 to 2000-2009.
|
||||
# 3. For testing purposes, you can set the assumed current year in
|
||||
# UPDATE_COPYRIGHT_YEAR.
|
||||
# 4. The default maximum line length for a copyright line is 72.
|
||||
# Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
|
||||
# 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
|
||||
# than "Free Software Foundation, Inc.".
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx -0777 -pi "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2020-04-04.15:07'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $copyright_re = 'Copyright';
|
||||
my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©|©)';
|
||||
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
|
||||
$holder ||= 'Free Software Foundation, Inc.';
|
||||
my $prefix_max = 5;
|
||||
my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
|
||||
!$margin || $margin !~ m/^\d+$/
|
||||
and $margin = 72;
|
||||
|
||||
my $tab_width = 8;
|
||||
|
||||
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
||||
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
||||
{
|
||||
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
||||
$this_year = $year + 1900;
|
||||
}
|
||||
|
||||
# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
|
||||
my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
|
||||
|
||||
my $leading;
|
||||
my $prefix;
|
||||
my $ws_re;
|
||||
my $stmt_re;
|
||||
while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
|
||||
{
|
||||
$leading = "$1$2";
|
||||
$prefix = $2;
|
||||
if ($prefix =~ /^(\s*\/)\*(\s*)$/)
|
||||
{
|
||||
$prefix =~ s,/, ,;
|
||||
my $prefix_ws = $prefix;
|
||||
$prefix_ws =~ s/\*/ /; # Only whitespace.
|
||||
if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
|
||||
{
|
||||
$prefix = $prefix_ws;
|
||||
}
|
||||
}
|
||||
$ws_re = '[ \t\r\f]'; # \s without \n
|
||||
$ws_re =
|
||||
"(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
|
||||
my $holder_re = $holder;
|
||||
$holder_re =~ s/\s/$ws_re/g;
|
||||
my $stmt_remainder_re =
|
||||
"(?:$ws_re$circle_c_re)?"
|
||||
. "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*"
|
||||
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
|
||||
if (/\G$stmt_remainder_re/)
|
||||
{
|
||||
$stmt_re =
|
||||
quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (defined $stmt_re)
|
||||
{
|
||||
/$stmt_re/ or die; # Should never die.
|
||||
my $stmt = $1;
|
||||
my $final_year_orig = $2;
|
||||
|
||||
# Handle two-digit year numbers like "98" and "99".
|
||||
my $final_year = $final_year_orig;
|
||||
$final_year <= 99
|
||||
and $final_year += 1900;
|
||||
|
||||
if ($final_year != $this_year)
|
||||
{
|
||||
# Update the year.
|
||||
$stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/;
|
||||
}
|
||||
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
|
||||
{
|
||||
# Normalize all whitespace including newline-prefix sequences.
|
||||
$stmt =~ s/$ws_re/ /g;
|
||||
|
||||
# Put spaces after commas.
|
||||
$stmt =~ s/, ?/, /g;
|
||||
|
||||
# Convert 2-digit to 4-digit years.
|
||||
$stmt =~ s/(\b\d\d\b)/19$1/g;
|
||||
|
||||
# Make the use of intervals consistent.
|
||||
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
|
||||
{
|
||||
$stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-";
|
||||
|
||||
$stmt =~
|
||||
s/
|
||||
(\d{4})
|
||||
(?:
|
||||
(,\ |--?)
|
||||
((??{
|
||||
if ($2 ne ', ') { '\d{4}'; }
|
||||
elsif (!$3) { $1 + 1; }
|
||||
else { $3 + 1; }
|
||||
}))
|
||||
)+
|
||||
/$1$ndash$3/gx;
|
||||
|
||||
# When it's 2, emit a single range encompassing all year numbers.
|
||||
$ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
|
||||
and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/;
|
||||
}
|
||||
|
||||
# Format within margin.
|
||||
my $stmt_wrapped;
|
||||
my $text_margin = $margin - length($prefix);
|
||||
if ($prefix =~ /^(\t+)/)
|
||||
{
|
||||
$text_margin -= length($1) * ($tab_width - 1);
|
||||
}
|
||||
while (length $stmt)
|
||||
{
|
||||
if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
|
||||
|| ($stmt =~ s/^([\S]+)(?: |$)//))
|
||||
{
|
||||
my $line = $1;
|
||||
$stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
|
||||
$stmt_wrapped .= $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Should be unreachable, but we don't want an infinite
|
||||
# loop if it can be reached.
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
# Replace the old copyright statement.
|
||||
s/$stmt_re/$stmt_wrapped/;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$ARGV: warning: copyright statement not found\n";
|
||||
}
|
||||
|
||||
# Hey Emacs!
|
||||
# Local variables:
|
||||
# coding: utf-8
|
||||
# mode: perl
|
||||
# indent-tabs-mode: nil
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-line-limit: 200
|
||||
# time-stamp-start: "my $VERSION = '"
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "'; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,240 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Detect instances of "if (p) free (p);".
|
||||
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
|
||||
|
||||
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Jim Meyering
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2021-04-11 10:11'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
my $copyright_year = '2021';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # https://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] FILE...
|
||||
|
||||
Detect any instance in FILE of a useless "if" test before a free call, e.g.,
|
||||
"if (p) free (p);". Any such test may be safely removed without affecting
|
||||
the semantics of the C code in FILE. Use --name=FOO --name=BAR to also
|
||||
detect free-like functions named FOO and BAR.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--list print only the name of each matching FILE (\\0-terminated)
|
||||
--name=N add name N to the list of \'free\'-like functions to detect;
|
||||
may be repeated
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Exit status:
|
||||
|
||||
0 one or more matches
|
||||
1 no match
|
||||
2 an error
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
For example, this command prints all removable "if" tests before "free"
|
||||
and "kfree" calls in the linux kernel sources:
|
||||
|
||||
git ls-files -z |xargs -0 $ME --name=kfree
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
sub is_NULL ($)
|
||||
{
|
||||
my ($expr) = @_;
|
||||
return ($expr eq 'NULL' || $expr eq '0');
|
||||
}
|
||||
|
||||
{
|
||||
sub EXIT_MATCH {0}
|
||||
sub EXIT_NO_MATCH {1}
|
||||
sub EXIT_ERROR {2}
|
||||
my $err = EXIT_NO_MATCH;
|
||||
|
||||
my $list;
|
||||
my @name = qw(free);
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version =>
|
||||
sub
|
||||
{
|
||||
print "$ME version $VERSION\n";
|
||||
print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
|
||||
print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
|
||||
. "This is free software: you are free to change and redistribute it.\n"
|
||||
. "There is NO WARRANTY, to the extent permitted by law.\n";
|
||||
print "\n";
|
||||
my $author = "Jim Meyering";
|
||||
print "Written by $author.\n";
|
||||
exit
|
||||
},
|
||||
list => \$list,
|
||||
'name=s@' => \@name,
|
||||
) or usage 1;
|
||||
|
||||
# Make sure we have the right number of non-option arguments.
|
||||
# Always tell the user why we fail.
|
||||
@ARGV < 1
|
||||
and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
|
||||
|
||||
my $or = join '|', @name;
|
||||
my $regexp = qr/(?:$or)/;
|
||||
|
||||
# Set the input record separator.
|
||||
# Note: this makes it impractical to print line numbers.
|
||||
$/ = '"';
|
||||
|
||||
my $found_match = 0;
|
||||
FILE:
|
||||
foreach my $file (@ARGV)
|
||||
{
|
||||
open FH, '<', $file
|
||||
or (warn "$ME: can't open '$file' for reading: $!\n"),
|
||||
$err = EXIT_ERROR, next;
|
||||
while (defined (my $line = <FH>))
|
||||
{
|
||||
# Skip non-matching lines early to save time
|
||||
$line =~ /\bif\b/
|
||||
or next;
|
||||
while ($line =~
|
||||
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
|
||||
# 1 2 3
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
|
||||
{
|
||||
my $all = $1;
|
||||
my ($lhs, $rhs) = ($2, $3);
|
||||
my ($free_opnd, $braced_free_opnd) = ($4, $5);
|
||||
my $non_NULL;
|
||||
if (!defined $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $lhs) { $non_NULL = $rhs }
|
||||
else { next }
|
||||
|
||||
# Compare the non-NULL part of the "if" expression and the
|
||||
# free'd expression, without regard to white space.
|
||||
$non_NULL =~ tr/ \t//d;
|
||||
my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
|
||||
$e2 =~ tr/ \t//d;
|
||||
if ($non_NULL eq $e2)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $all\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
{
|
||||
close FH;
|
||||
}
|
||||
|
||||
$found_match && $err == EXIT_NO_MATCH
|
||||
and $err = EXIT_MATCH;
|
||||
|
||||
exit $err;
|
||||
}
|
||||
|
||||
my $foo = <<'EOF';
|
||||
# The above is to *find* them.
|
||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||
|
||||
# FIXME: do something like this as an option (doesn't do braces):
|
||||
free=xfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0x3b -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
|
||||
|
||||
# Use the following to remove redundant uses of kfree inside braces.
|
||||
# Note that -0777 puts perl in slurp-whole-file mode;
|
||||
# but we have plenty of memory, these days...
|
||||
free=kfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0777 -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
|
||||
|
||||
Be careful that the result of the above transformation is valid.
|
||||
If the matched string is followed by "else", then obviously, it won't be.
|
||||
|
||||
When modifying files, refuse to process anything other than a regular file.
|
||||
EOF
|
||||
|
||||
## Local Variables:
|
||||
## mode: perl
|
||||
## indent-tabs-mode: nil
|
||||
## eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
## time-stamp-line-limit: 50
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
#!/bin/sh
|
||||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# List the specified version-controlled files.
|
||||
# With no argument, list them all. With a single DIRECTORY argument,
|
||||
# list the version-controlled files in that directory.
|
||||
|
||||
# If there's an argument, it must be a single, "."-relative directory name.
|
||||
# cvsu is part of the cvsutils package: https://www.red-bean.com/cvsutils/
|
||||
|
||||
postprocess=
|
||||
case $1 in
|
||||
--help) cat <<EOF
|
||||
Usage: $0 [-C SRCDIR] [DIR...]
|
||||
|
||||
Output a list of version-controlled files in DIR (default .), relative to
|
||||
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
||||
|
||||
Options:
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
-C SRCDIR change directory to SRCDIR before generating list
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
--version)
|
||||
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
|
||||
cat <<EOF
|
||||
vc-list-files $scriptversion
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
-C)
|
||||
test "$2" = . || postprocess="| sed 's|^|$2/|'"
|
||||
cd "$2" || exit 1
|
||||
shift; shift ;;
|
||||
esac
|
||||
|
||||
test $# = 0 && set .
|
||||
|
||||
for dir
|
||||
do
|
||||
if test -d .git || test -f .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# Ignore git symlinks - either they point into the tree, in which case
|
||||
# we don't need to visit the target twice, or they point somewhere
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
else
|
||||
eval awk -F/ \''{ \
|
||||
if (!$1 && $3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
if (f ~ /CVS\/Entries$/) \
|
||||
f = substr(f, 1, length(f)-11); \
|
||||
print f $2; \
|
||||
}}'\'' \
|
||||
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
||||
fi
|
||||
elif test -d .svn; then
|
||||
eval exec svn list -R '"$dir"' $postprocess
|
||||
else
|
||||
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
+247
@@ -0,0 +1,247 @@
|
||||
#! /bin/sh
|
||||
# ylwrap - wrapper for lex/yacc invocations.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
get_dirname ()
|
||||
{
|
||||
case $1 in
|
||||
*/*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
|
||||
# Otherwise, we want the empty string (not ".").
|
||||
esac
|
||||
}
|
||||
|
||||
# guard FILE
|
||||
# ----------
|
||||
# The CPP macro used to guard inclusion of FILE.
|
||||
guard ()
|
||||
{
|
||||
printf '%s\n' "$1" \
|
||||
| sed \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
|
||||
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \
|
||||
-e 's/__*/_/g'
|
||||
}
|
||||
|
||||
# quote_for_sed [STRING]
|
||||
# ----------------------
|
||||
# Return STRING (or stdin) quoted to be used as a sed pattern.
|
||||
quote_for_sed ()
|
||||
{
|
||||
case $# in
|
||||
0) cat;;
|
||||
1) printf '%s\n' "$1";;
|
||||
esac \
|
||||
| sed -e 's|[][\\.*]|\\&|g'
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'')
|
||||
echo "$0: No files given. Try '$0 --help' for more information." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
--basedir)
|
||||
basedir=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--h*)
|
||||
cat <<\EOF
|
||||
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
|
||||
|
||||
Wrapper for lex/yacc invocations, renaming files as desired.
|
||||
|
||||
INPUT is the input file
|
||||
OUTPUT is one file PROG generates
|
||||
DESIRED is the file we actually want instead of OUTPUT
|
||||
PROGRAM is program to run
|
||||
ARGS are passed to PROG
|
||||
|
||||
Any number of OUTPUT,DESIRED pairs may be used.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v|--v*)
|
||||
echo "ylwrap $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# The input.
|
||||
input=$1
|
||||
shift
|
||||
# We'll later need for a correct munging of "#line" directives.
|
||||
input_sub_rx=`get_dirname "$input" | quote_for_sed`
|
||||
case $input in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
# Absolute path; do nothing.
|
||||
;;
|
||||
*)
|
||||
# Relative path. Make it absolute.
|
||||
input=`pwd`/$input
|
||||
;;
|
||||
esac
|
||||
input_rx=`get_dirname "$input" | quote_for_sed`
|
||||
|
||||
# Since DOS filename conventions don't allow two dots,
|
||||
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
|
||||
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
|
||||
y_tab_nodot=false
|
||||
if test -f y_tab.c || test -f y_tab.h; then
|
||||
y_tab_nodot=true
|
||||
fi
|
||||
|
||||
# The parser itself, the first file, is the destination of the .y.c
|
||||
# rule in the Makefile.
|
||||
parser=$1
|
||||
|
||||
# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
|
||||
# instance, we rename #include "y.tab.h" into #include "parse.h"
|
||||
# during the conversion from y.tab.c to parse.c.
|
||||
sed_fix_filenames=
|
||||
|
||||
# Also rename header guards, as Bison 2.7 for instance uses its header
|
||||
# guard in its implementation file.
|
||||
sed_fix_header_guards=
|
||||
|
||||
while test $# -ne 0; do
|
||||
if test x"$1" = x"--"; then
|
||||
shift
|
||||
break
|
||||
fi
|
||||
from=$1
|
||||
# Handle y_tab.c and y_tab.h output by DOS
|
||||
if $y_tab_nodot; then
|
||||
case $from in
|
||||
"y.tab.c") from=y_tab.c;;
|
||||
"y.tab.h") from=y_tab.h;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
to=$1
|
||||
shift
|
||||
sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
|
||||
sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
|
||||
done
|
||||
|
||||
# The program to run.
|
||||
prog=$1
|
||||
shift
|
||||
# Make any relative path in $prog absolute.
|
||||
case $prog in
|
||||
[\\/]* | ?:[\\/]*) ;;
|
||||
*[\\/]*) prog=`pwd`/$prog ;;
|
||||
esac
|
||||
|
||||
dirname=ylwrap$$
|
||||
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
mkdir $dirname || exit 1
|
||||
|
||||
cd $dirname
|
||||
|
||||
case $# in
|
||||
0) "$prog" "$input" ;;
|
||||
*) "$prog" "$@" "$input" ;;
|
||||
esac
|
||||
ret=$?
|
||||
|
||||
if test $ret -eq 0; then
|
||||
for from in *
|
||||
do
|
||||
to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
|
||||
if test -f "$from"; then
|
||||
# If $2 is an absolute path name, then just use that,
|
||||
# otherwise prepend '../'.
|
||||
case $to in
|
||||
[\\/]* | ?:[\\/]*) target=$to;;
|
||||
*) target=../$to;;
|
||||
esac
|
||||
|
||||
# Do not overwrite unchanged header files to avoid useless
|
||||
# recompilations. Always update the parser itself: it is the
|
||||
# destination of the .y.c rule in the Makefile. Divert the
|
||||
# output of all other files to a temporary file so we can
|
||||
# compare them to existing versions.
|
||||
if test $from != $parser; then
|
||||
realtarget=$target
|
||||
target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
|
||||
fi
|
||||
|
||||
# Munge "#line" or "#" directives. Don't let the resulting
|
||||
# debug information point at an absolute srcdir. Use the real
|
||||
# output file name, not yy.lex.c for instance. Adjust the
|
||||
# include guards too.
|
||||
sed -e "/^#/!b" \
|
||||
-e "s|$input_rx|$input_sub_rx|" \
|
||||
-e "$sed_fix_filenames" \
|
||||
-e "$sed_fix_header_guards" \
|
||||
"$from" >"$target" || ret=$?
|
||||
|
||||
# Check whether files must be updated.
|
||||
if test "$from" != "$parser"; then
|
||||
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
|
||||
echo "$to is unchanged"
|
||||
rm -f "$target"
|
||||
else
|
||||
echo "updating $to"
|
||||
mv -f "$target" "$realtarget"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# A missing file is only an error for the parser. This is a
|
||||
# blatant hack to let us support using "yacc -d". If -d is not
|
||||
# specified, don't fail when the header file is "missing".
|
||||
if test "$from" = "$parser"; then
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Remove the directory.
|
||||
cd ..
|
||||
rm -rf $dirname
|
||||
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
@@ -0,0 +1,178 @@
|
||||
## Customize maint.mk -*- makefile -*-
|
||||
## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Update version, then recompile so that tests/bison --version be
|
||||
# up-to-date, then compile our parser again with our up-to-date bison.
|
||||
.PHONY: regen
|
||||
regen: _version
|
||||
$(MAKE) $(AM_MAKEFLAGS)
|
||||
touch $(srcdir)/src/parse-gram.y
|
||||
$(MAKE) $(AM_MAKEFLAGS)
|
||||
|
||||
# Used in maint.mk's web-manual rule
|
||||
manual_title = The Yacc-compatible Parser Generator
|
||||
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
||||
|
||||
# By default, propagate -j from make to Bison's test suite.
|
||||
TESTSUITEFLAGS = $(filter -j%,$(MAKEFLAGS))
|
||||
|
||||
# It's useful to run maintainer-check* targets during development, but we
|
||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||
# override the _is-dist-target from GNUmakefile so that maintainer-check*
|
||||
# targets are filtered out.
|
||||
_is-dist-target = $(filter-out %clean maintainer-check%, \
|
||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||
|
||||
url_dir_list = \
|
||||
https://$(gnu_rel_host)/gnu/bison
|
||||
|
||||
# Tests not to run as part of "make distcheck".
|
||||
local-checks-to-skip = \
|
||||
sc_immutable_NEWS \
|
||||
sc_indent
|
||||
|
||||
# The local directory containing the checked-out copy of gnulib used in
|
||||
# this release. Used solely to get a date for the "announcement" target.
|
||||
gnulib_dir = $(srcdir)/gnulib
|
||||
|
||||
bootstrap-tools = autoconf,automake,flex,gettext,gnulib
|
||||
|
||||
announcement_Cc_ = \
|
||||
bug-bison@gnu.org, bison-announce@gnu.org, \
|
||||
coordinator@translationproject.org
|
||||
|
||||
update-copyright: update-b4-copyright update-package-copyright-year
|
||||
update-copyright-env = \
|
||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
||||
|
||||
|
||||
## -------------------- ##
|
||||
## More syntax-checks. ##
|
||||
## -------------------- ##
|
||||
|
||||
# Indent only with spaces.
|
||||
# Taken from Coreutils.
|
||||
sc_prohibit_tab_based_indentation:
|
||||
@prohibit='^ * ' \
|
||||
halt='TAB in indentation; use only spaces' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Prohibit the use of `...` in tests/. Use $(...) instead.
|
||||
# Taken from Coreutils.
|
||||
# Not ready for Bison yet.
|
||||
#sc_prohibit_test_backticks:
|
||||
# @prohibit='`' in_vc_files='^tests/' \
|
||||
# halt='use $$(...), not `...` in tests/' \
|
||||
# $(_sc_search_regexp)
|
||||
|
||||
# Enforce recommended preprocessor indentation style.
|
||||
# Taken from Coreutils.
|
||||
sc_preprocessor_indentation:
|
||||
@if cppi --version >/dev/null 2>&1; then \
|
||||
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|
||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
||||
exit 1; }; \
|
||||
else \
|
||||
echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
|
||||
fi
|
||||
|
||||
###########################################################
|
||||
# Taken from Coreutils.
|
||||
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
||||
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
||||
_pre_anchored = ^\($(_pre)\)
|
||||
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
|
||||
# help font-lock mode: '
|
||||
|
||||
# A sed expression that removes ANSI C and ISO C99 comments.
|
||||
# Derived from the one in GNU gettext's 'moopp' preprocessor.
|
||||
_sed_remove_comments = \
|
||||
/[/][/*]/{ \
|
||||
ta; \
|
||||
:a; \
|
||||
s,$(_pre_anchored)//.*,\1,; \
|
||||
te; \
|
||||
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
|
||||
ta; \
|
||||
/^$(_pre)[/][*]/{ \
|
||||
s,$(_pre_anchored)/[*].*,\1 ,; \
|
||||
tu; \
|
||||
:u; \
|
||||
n; \
|
||||
s,^\($(_comment_and_close),,; \
|
||||
tv; \
|
||||
s,^.*$$,,; \
|
||||
bu; \
|
||||
:v; \
|
||||
}; \
|
||||
:e; \
|
||||
}
|
||||
# Quote all single quotes.
|
||||
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
|
||||
# help font-lock mode: '
|
||||
|
||||
_space_before_paren_exempt =? \\n\\$$
|
||||
_space_before_paren_exempt = \
|
||||
(^ *\#|(LA)?LR\([01]\)|percent_(code|define)|b4_syncline|m4_(define|init))
|
||||
# Ensure that there is a space before each open parenthesis in C code.
|
||||
sc_space_before_open_paren:
|
||||
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
|
||||
fail=0; \
|
||||
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
|
||||
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
|
||||
| grep -i '[[:alnum:]](' \
|
||||
| grep -vE '$(_space_before_paren_exempt)' \
|
||||
| grep . && { fail=1; echo "*** $$c"; }; \
|
||||
done; \
|
||||
test $$fail = 1 && \
|
||||
{ echo '$(ME): the above files lack a space-before-open-paren' \
|
||||
1>&2; exit 1; } || :; \
|
||||
else :; \
|
||||
fi
|
||||
|
||||
## -------------------------- ##
|
||||
## syntax-checks exceptions. ##
|
||||
## -------------------------- ##
|
||||
|
||||
# po-check: we use gnulib-po, so we don't need/want them in our POTFILE.
|
||||
generated_files =
|
||||
|
||||
exclude = \
|
||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||
|
||||
$(call exclude, \
|
||||
bindtextdomain=^lib/main.c$$ \
|
||||
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||
error_message_uppercase=etc/bench.pl.in$$ \
|
||||
file_system=^doc/Doxyfile.in$$ \
|
||||
po_check=^tests|(^po/POTFILES.in|.md)$$ \
|
||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||
program_name=^lib/main.c$$ \
|
||||
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||
prohibit_atoi_atof=^(doc|etc|examples|tests)/ \
|
||||
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||
prohibit_strcmp=^doc/bison\.texi|examples|tests \
|
||||
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
|
||||
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
|
||||
space_before_open_paren=^data/skeletons/ \
|
||||
two_space_separator_in_usage=^(bootstrap|build-aux/install-icc.sh) \
|
||||
unmarked_diagnostics=^(doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||
)
|
||||
+58836
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,359 @@
|
||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
AC_PREREQ([2.71])
|
||||
m4_pattern_forbid([^_?(gl_[A-Z]|AX_|BISON_)])
|
||||
m4_pattern_allow([^BISON_USE_NLS$])
|
||||
|
||||
AC_INIT([GNU Bison],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
[bug-bison@gnu.org],
|
||||
[],
|
||||
[https://www.gnu.org/software/bison/])
|
||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2021])
|
||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||
[The copyright year for this package])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# When we move to Automake 1.16, simplify examples/c/reccalc/local.mk.
|
||||
# Our CI build the packages on Bionic, which has only Automake 1.15.
|
||||
#
|
||||
# We want gnits strictness only when rolling a stable release. For
|
||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||
# doesn't like that, so we let the underscore disable gnits. Between
|
||||
# releases, we want to be able run make dist without being required to
|
||||
# add a bogus NEWS entry. In that case, the version string
|
||||
# automatically contains a dash, which we also let disable gnits.
|
||||
AM_INIT_AUTOMAKE([1.15 dist-lzip dist-xz nostdinc
|
||||
color-tests parallel-tests
|
||||
silent-rules]
|
||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||
[gnu], [gnits]))
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
|
||||
|
||||
# Checks for the compiler.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
||||
# Gnulib (early checks).
|
||||
gl_EARLY
|
||||
|
||||
# We want ostream_printf and hyperlink support.
|
||||
gl_LIBTEXTSTYLE_OPTIONAL([0.20.5])
|
||||
|
||||
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
||||
# warnings, but older gcc doesn't support this.
|
||||
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||
[lv_cv_gcc_pragma_push_works], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
CFLAGS='-Wunknown-pragmas -Werror'
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic pop
|
||||
]])],
|
||||
[lv_cv_gcc_pragma_push_works=yes],
|
||||
[lv_cv_gcc_pragma_push_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
||||
BISON_CXXSTD([98])
|
||||
BISON_CXXSTD([03])
|
||||
BISON_CXXSTD([11])
|
||||
BISON_CXXSTD([14])
|
||||
BISON_CXXSTD([17])
|
||||
BISON_CXXSTD([20])
|
||||
BISON_CXXSTD([2b])
|
||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||
AM_CONDITIONAL([ENABLE_CXX14], [test x"$CXX14_CXXFLAGS" != x])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
||||
Also, issue synclines from the examples/ to
|
||||
the corresponding source in the Texinfo doc.],
|
||||
[case $enable_gcc_warnings in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([invalid value for --gcc-warnings: $enable_gcc_warnings]);;
|
||||
esac],
|
||||
[enable_gcc_warnings=no])
|
||||
AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
# -Wno-tautological-constant-out-of-range-compare for Clang 3.3 and
|
||||
# 3.4 on GNU/Linux that choke on intprops.h's INT_MULTIPLY_WRAPV,
|
||||
# etc.
|
||||
#
|
||||
# ICC: -wr188
|
||||
#
|
||||
# 1669 warnings warnings_default =
|
||||
# ../src/complain.c(318): error #188: enumerated type mixed with another type
|
||||
# 1670 Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
|
||||
# 1671 ^
|
||||
# 1672
|
||||
# 1673../src/complain.c(393): error #188: enumerated type mixed with another type
|
||||
# 1674 warnings w = 1 << wbit;
|
||||
# 1675 ^
|
||||
#
|
||||
# ICC: -wr3179
|
||||
#
|
||||
# char const *usefulness
|
||||
# = rule_useless_in_grammar_p (&rules[r]) ? "useless-in-grammar"
|
||||
# : rule_useless_in_parser_p (&rules[r]) ? "useless-in-parser"
|
||||
# : "useful";
|
||||
#
|
||||
# gives
|
||||
#
|
||||
# error #3179: deprecated conversion of string literal to char* (should be const char*)
|
||||
#
|
||||
# ICC: -wr2259 (that's in C, in spite of what the error messages which seems to be about C++).
|
||||
# error #2259: non-pointer conversion from "int" to "yybool={signed char}" may lose significant bits
|
||||
# yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
||||
# ^
|
||||
warn_common='-Wall -Wextra
|
||||
-Wcast-align -Wchar-subscripts
|
||||
-fparse-all-comments -Wdocumentation
|
||||
-Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference
|
||||
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
|
||||
-Wpointer-arith -Wshadow -Wstrict-aliasing
|
||||
-Wwrite-strings
|
||||
-wr188 -wr2259 -wr3179'
|
||||
warn_c='-Wbad-function-cast
|
||||
-Wmissing-prototypes
|
||||
-Wstrict-prototypes'
|
||||
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
|
||||
-Wweak-vtables'
|
||||
# Warnings for the test suite only.
|
||||
#
|
||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||
# messages is confusing the tests looking at the compiler's output
|
||||
# (e.g., synclines.at).
|
||||
#
|
||||
# -Wno-keyword-macro: We use the "#define private public" dirty
|
||||
# trick in the test suite to check some private implementation
|
||||
# details for lalr1.cc.
|
||||
warn_tests='-Wundef -pedantic -Wconversion
|
||||
-Wdeprecated -Wsign-compare -Wsign-conversion
|
||||
-Wtautological-constant-out-of-range-compare
|
||||
-fno-color-diagnostics
|
||||
-Wno-keyword-macro'
|
||||
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
# Clang supports many of GCC's -W options, but only issues warnings
|
||||
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||
# thinks the option is supported, and unknown options are then added
|
||||
# to CFLAGS. But then, when -Werror is added in the test suite for
|
||||
# instance, the warning about the unknown option turns into an
|
||||
# error.
|
||||
#
|
||||
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
||||
# meanwhile, turn warnings about unknown options into errors in
|
||||
# CFLAGS, and restore CFLAGS after the tests.
|
||||
save_CFLAGS=$CFLAGS
|
||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
||||
# and 3.4).
|
||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CFLAGS],
|
||||
[AC_LANG_PROGRAM([],
|
||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
||||
for i in $warn_common $warn_c;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||
done
|
||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||
|
||||
# Warnings for the test suite, and maybe for bison if GCC is modern
|
||||
# enough.
|
||||
test $lv_cv_gcc_pragma_push_works = yes &&
|
||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||
|
||||
# Warnings for the test suite only.
|
||||
for i in $warn_tests -Wincompatible-pointer-types;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
||||
done
|
||||
CFLAGS=$save_CFLAGS
|
||||
AC_LANG_POP([C])
|
||||
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
save_CXXFLAGS=$CXXFLAGS
|
||||
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||
for i in $warn_common $warn_cxx;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||
done
|
||||
# Accept this warning only if it is not too touchy (e.g., clang 3.3
|
||||
# and 3.4).
|
||||
gl_WARN_ADD([-Wunreachable-code], [WARN_CXXFLAGS],
|
||||
[AC_LANG_PROGRAM([],
|
||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
||||
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||
[AC_LANG_PROGRAM([], [nullptr])])
|
||||
# Before GCC6, the pragmas don't work well enough to neutralize
|
||||
# this warning.
|
||||
gl_WARN_ADD([-Wuseless-cast], [WARN_CXXFLAGS],
|
||||
[AC_LANG_PROGRAM([], [
|
||||
#if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6
|
||||
syntax error
|
||||
#endif
|
||||
])])
|
||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||
# Warnings for the test suite only.
|
||||
for i in $warn_tests;
|
||||
do
|
||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
||||
done
|
||||
# Too many compilers complain about Flex generated code.
|
||||
gl_WARN_ADD([-Wno-error], [FLEX_SCANNER_CXXFLAGS])
|
||||
# Clang++ deprecates compiling C.
|
||||
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
|
||||
CXXFLAGS=$save_CXXFLAGS
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
|
||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||
|
||||
# D.
|
||||
AC_CHECK_PROGS([DC], [dmd])
|
||||
AC_CHECK_PROGS([DCFLAGS], [-g])
|
||||
AM_CONDITIONAL([ENABLE_D], [test x"$DC" != x])
|
||||
|
||||
# Java.
|
||||
gt_JAVACOMP([1.7], [1.7])
|
||||
gt_JAVAEXEC
|
||||
AM_CONDITIONAL([ENABLE_JAVA], [test x"$CONF_JAVAC" != x && test x"$CONF_JAVA" != x])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([yacc],
|
||||
[AS_HELP_STRING([--disable-yacc],
|
||||
[do not build a yacc command or an -ly library])],
|
||||
, [enable_yacc=yes])
|
||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||
AC_CONFIG_FILES([src/yacc], [chmod +x src/yacc])
|
||||
|
||||
# Checks for programs.
|
||||
AM_MISSING_PROG([DOT], [dot])
|
||||
AC_PROG_LEX
|
||||
if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then
|
||||
AC_MSG_WARN([bypassing lex because flex is required])
|
||||
LEX=:
|
||||
fi
|
||||
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||
[$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes])
|
||||
AC_PROG_YACC
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_GNU_M4
|
||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
||||
supports -g, otherwise to "".])
|
||||
AC_PATH_PROG([PERL], [perl])
|
||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||
AC_SUBST([XSLTPROC])
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS_ONCE([locale.h])
|
||||
|
||||
# Checks for compiler characteristics.
|
||||
AC_C_INLINE
|
||||
|
||||
# Gnulib (later checks). Putting them here rather than right after
|
||||
# gl_EARLY avoids some redundant checks.
|
||||
gl_INIT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS_ONCE([setlocale])
|
||||
|
||||
# Gettext.
|
||||
# We use gnulib, which is only guaranteed to work properly with the
|
||||
# latest Gettext.
|
||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||
AM_GNU_GETTEXT_VERSION([0.19])
|
||||
BISON_I18N
|
||||
AC_CONFIG_FILES([gnulib-po/Makefile.in])
|
||||
|
||||
# Internationalized parsers.
|
||||
AC_CONFIG_FILES([runtime-po/Makefile.in])
|
||||
# Autoconf macros for packages using internationalized parsers.
|
||||
aclocaldir='${datadir}/aclocal'
|
||||
AC_SUBST([aclocaldir])
|
||||
|
||||
# Create the benchmark script.
|
||||
AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
||||
|
||||
# Initialize the test suite.
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
AC_CONFIG_FILES([tests/atlocal])
|
||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||
|
||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||
# Use something simpler that $host_os to select our suppression file.
|
||||
uname=`uname`
|
||||
case $VALGRIND:$uname in
|
||||
'':*) ;;
|
||||
*:Darwin)
|
||||
# See README-hacking.md.
|
||||
VALGRIND=;;
|
||||
*:*)
|
||||
suppfile=build-aux/$uname.valgrind
|
||||
if test -f "$srcdir/$suppfile"; then
|
||||
AC_SUBST([VALGRIND_OPTS_SUPPRESSION],
|
||||
["--suppressions=\$(abs_top_srcdir)/$suppfile"])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_CHECKING([Valgrind suppression file])
|
||||
AC_MSG_RESULT([$suppfile])
|
||||
|
||||
# Whether we cannot run the compiled bison.
|
||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||
|
||||
# Build bistromathic if we have the lib and both readline/readline.h
|
||||
# and readline/history.h.
|
||||
AM_CONDITIONAL([ENABLE_BISTROMATHIC],
|
||||
[test "$gl_cv_lib_readline" != no &&
|
||||
test "$ac_cv_header_readline_readline_h" = yes &&
|
||||
test "$ac_cv_header_readline_history_h" = yes])
|
||||
|
||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||
# Needed by tests/atlocal.in.
|
||||
AC_SUBST([GCC])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
po/Makefile.in
|
||||
doc/yacc.1])
|
||||
|
||||
# Fix LIBOBJS to give the Makefile the right file names. Otherwise
|
||||
# compilation works, but with unexpected file names, so clean rules don't
|
||||
# remove the actual files and distcheck fails.
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
case $am__api_version in
|
||||
1.14*|1.15*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/lib_libbison_a-,g'`;;
|
||||
*) gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, lib/, lib/libbison_a-,g'`;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,227 @@
|
||||
This directory contains data needed by Bison.
|
||||
|
||||
# Directory Content
|
||||
## Skeletons
|
||||
Bison skeletons: the general shapes of the different parser kinds, that are
|
||||
specialized for specific grammars by the bison program.
|
||||
|
||||
Currently, the supported skeletons are:
|
||||
|
||||
- yacc.c
|
||||
It used to be named bison.simple: it corresponds to C Yacc
|
||||
compatible LALR(1) parsers.
|
||||
|
||||
- lalr1.cc
|
||||
Produces a C++ parser class.
|
||||
|
||||
- lalr1.java
|
||||
Produces a Java parser class.
|
||||
|
||||
- glr.c
|
||||
A Generalized LR C parser based on Bison's LALR(1) tables.
|
||||
|
||||
- glr.cc
|
||||
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
|
||||
|
||||
These skeletons are the only ones supported by the Bison team. Because the
|
||||
interface between skeletons and the bison program is not finished, *we are
|
||||
not bound to it*. In particular, Bison is not mature enough for us to
|
||||
consider that "foreign skeletons" are supported.
|
||||
|
||||
## m4sugar
|
||||
This directory contains M4sugar, sort of an extended library for M4, which
|
||||
is used by Bison to instantiate the skeletons.
|
||||
|
||||
## xslt
|
||||
This directory contains XSLT programs that transform Bison's XML output into
|
||||
various formats.
|
||||
|
||||
- bison.xsl
|
||||
A library of routines used by the other XSLT programs.
|
||||
|
||||
- xml2dot.xsl
|
||||
Conversion into GraphViz's dot format.
|
||||
|
||||
- xml2text.xsl
|
||||
Conversion into text.
|
||||
|
||||
- xml2xhtml.xsl
|
||||
Conversion into XHTML.
|
||||
|
||||
# Implementation Notes About the Skeletons
|
||||
|
||||
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
|
||||
executable with LR tables, facts about the symbols, etc. and they generate
|
||||
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
|
||||
charge of generating the parser and its auxiliary files, they do not
|
||||
generate the XML output, the parser.output reports, nor the graphical
|
||||
rendering.
|
||||
|
||||
The bits of information passing from bison to the backend is named
|
||||
"muscles". Muscles are passed to M4 via its standard input: it's a set of
|
||||
m4 definitions. To see them, use `--trace=muscles`.
|
||||
|
||||
Except for muscles, whose names are generated by bison, the skeletons have
|
||||
no constraint at all on the macro names: there is no technical/theoretical
|
||||
limitation, as long as you generate the output, you can do what you want.
|
||||
However, of course, that would be a bad idea if, say, the C and C++
|
||||
skeletons used different approaches and had completely different
|
||||
implementations. That would be a maintenance nightmare.
|
||||
|
||||
Below, we document some of the macros that we use in several of the
|
||||
skeletons. If you are to write a new skeleton, please, implement them for
|
||||
your language. Overall, be sure to follow the same patterns as the existing
|
||||
skeletons.
|
||||
|
||||
## Vocabulary
|
||||
|
||||
We use "formal arguments", or "formals" for short, to denote the declared
|
||||
parameters of a function (e.g., `int argc, const char **argv`). Yes, this
|
||||
is somewhat contradictory with `param` in the `%param` directives.
|
||||
|
||||
We use "effective arguments", or "args" for short, to denote the values
|
||||
passed in function calls (e.g., `argc, argv`).
|
||||
|
||||
## Symbols
|
||||
|
||||
### `b4_symbol(NUM, FIELD)`
|
||||
In order to unify the handling of the various aspects of symbols (tag, type
|
||||
name, whether terminal, etc.), bison.exe defines one macro per (token,
|
||||
field), where field can `has_id`, `id`, etc.: see
|
||||
`prepare_symbol_definitions()` in `src/output.c`.
|
||||
|
||||
NUM can be:
|
||||
- `empty` to denote the "empty" pseudo-symbol when it exists,
|
||||
- `eof`, `error`, or `undef`
|
||||
- a symbol number.
|
||||
|
||||
FIELD can be:
|
||||
|
||||
- `has_id`: 0 or 1
|
||||
Whether the symbol has an `id`.
|
||||
|
||||
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
|
||||
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
|
||||
defined), otherwise empty. Guaranteed to be usable as a C identifier.
|
||||
This is used to define the token kind (i.e., the enum used by the return
|
||||
value of yylex). Should be named `token_kind`.
|
||||
|
||||
- `tag`: string
|
||||
A human readable representation of the symbol. Can be `'foo'`,
|
||||
`'foo.id'`, `'"foo"'` etc.
|
||||
|
||||
- `code`: integer
|
||||
The token code associated to the token kind `id`.
|
||||
The external number as used by yylex. Can be ASCII code when a character,
|
||||
some number chosen by bison, or some user number in the case of `%token
|
||||
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
||||
|
||||
- `is_token`: 0 or 1
|
||||
Whether this is a terminal symbol.
|
||||
|
||||
- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
|
||||
The base of the symbol kind, i.e., the enumerator of this symbol (token or
|
||||
nonterminal) which is mapped to its `number`.
|
||||
|
||||
- `kind`: string
|
||||
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
|
||||
EOF's `kind_base` and `kind` are `YYSYMBOL_YYEOF` in C, but are
|
||||
`S_YYEMPTY` and `symbol_kind::S_YYEMPTY` in C++.
|
||||
|
||||
- `number`: integer
|
||||
The code associated to the `kind`.
|
||||
The internal number (computed from the external number by yytranslate).
|
||||
Corresponds to yytoken in yacc.c. This is the same number that serves as
|
||||
key in b4_symbol(NUM, FIELD).
|
||||
|
||||
In bison, symbols are first assigned increasing numbers in order of
|
||||
appearance (but tokens first, then nterms). After grammar reduction,
|
||||
unused nterms are then renumbered to appear last (i.e., first tokens, then
|
||||
used nterms and finally unused nterms). This final number NUM is the one
|
||||
contained in this field, and it is the one used as key in `b4_symbol(NUM,
|
||||
FIELD)`.
|
||||
|
||||
The code of the rule actions, however, is emitted before we know what
|
||||
symbols are unused, so they use the original numbers. To avoid confusion,
|
||||
they actually use "orig NUM" instead of just "NUM". bison also emits
|
||||
definitions for `b4_symbol(orig NUM, number)` that map from original
|
||||
numbers to the new ones. `b4_symbol` actually resolves `orig NUM` in the
|
||||
other case, i.e., `b4_symbol(orig 42, tag)` would return the tag of the
|
||||
symbols whose original number was 42.
|
||||
|
||||
- `has_type`: 0, 1
|
||||
Whether has a semantic value.
|
||||
|
||||
- `type_tag`: string
|
||||
When api.value.type=union, the generated name for the union member.
|
||||
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
|
||||
|
||||
- `type`: string
|
||||
If it has a semantic value, its type tag, or, if variant are used,
|
||||
its type.
|
||||
In the case of api.value.type=union, type is the real type (e.g. int).
|
||||
|
||||
- `slot`: string
|
||||
If it has a semantic value, the name of the union member (i.e., bounces to
|
||||
either `type_tag` or `type`). It would be better to fix our mess and
|
||||
always use `type` for the true type of the member, and `type_tag` for the
|
||||
name of the union member.
|
||||
|
||||
- `has_printer`: 0, 1
|
||||
- `printer`: string
|
||||
- `printer_file`: string
|
||||
- `printer_line`: integer
|
||||
- `printer_loc`: location
|
||||
If the symbol has a printer, everything about it.
|
||||
|
||||
- `has_destructor`, `destructor`, `destructor_file`, `destructor_line`, `destructor_loc`
|
||||
Likewise.
|
||||
|
||||
### `b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])`
|
||||
Expansion of $$, $1, $<TYPE-TAG>3, etc.
|
||||
|
||||
The semantic value from a given VAL.
|
||||
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
|
||||
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
|
||||
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
|
||||
|
||||
The result can be used safely, it is put in parens to avoid nasty precedence
|
||||
issues.
|
||||
|
||||
### `b4_lhs_value(SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
|
||||
|
||||
### `b4_rhs_data(RULE-LENGTH, POS)`
|
||||
The data corresponding to the symbol `#POS`, where the current rule has
|
||||
`RULE-LENGTH` symbols on RHS.
|
||||
|
||||
### `b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])`
|
||||
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
|
||||
on RHS.
|
||||
|
||||
<!--
|
||||
|
||||
Local Variables:
|
||||
mode: markdown
|
||||
fill-column: 76
|
||||
ispell-dictionary: "american"
|
||||
End:
|
||||
|
||||
Copyright (C) 2002, 2008-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bison.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
@@ -0,0 +1,61 @@
|
||||
/* Default styling rules for Bison when doing terminal output.
|
||||
Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This is an experimental feature. The class names may change in the
|
||||
future. */
|
||||
|
||||
/* Diagnostics. */
|
||||
.warning { color: purple; }
|
||||
.error { color: red; }
|
||||
.note { color: cyan; }
|
||||
|
||||
.fixit-insert { color: green; }
|
||||
|
||||
/* Semantic values in Bison's own parser traces. */
|
||||
.value { color: green; }
|
||||
|
||||
/* "Sections" in traces (--trace). */
|
||||
.trace0 { color: green; }
|
||||
|
||||
/* Syntax error messages. */
|
||||
.expected { color: green; }
|
||||
.unexpected { color: red; }
|
||||
|
||||
|
||||
/* Counterexamples. */
|
||||
|
||||
/* Cex: point in rule. */
|
||||
.cex-dot { color: red; }
|
||||
|
||||
/* Cex: coloring various rules. */
|
||||
.cex-0 { color: yellow; }
|
||||
.cex-1 { color: green; }
|
||||
.cex-2 { color: blue; }
|
||||
.cex-3 { color: purple; }
|
||||
.cex-4 { color: violet; }
|
||||
.cex-5 { color: orange; }
|
||||
.cex-6 { color: brown; }
|
||||
.cex-7 { color: mauve; }
|
||||
.cex-8 { color: #013220; } /* Dark green. */
|
||||
.cex-9 { color: #e75480; } /* Dark pink. */
|
||||
.cex-10 { color: cyan; }
|
||||
.cex-11 { color: orange; }
|
||||
|
||||
/* Cex: derivation rewriting steps. */
|
||||
.cex-step { font-style: italic; }
|
||||
|
||||
/* Cex: leaves of a derivation. */
|
||||
.cex-leaf { font-weight: 600; }
|
||||
@@ -0,0 +1,58 @@
|
||||
## Copyright (C) 2002, 2005-2015, 2018-2021 Free Software Foundation,
|
||||
## Inc.
|
||||
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
data/README.md \
|
||||
data/bison-default.css
|
||||
|
||||
skeletonsdir = $(pkgdatadir)/skeletons
|
||||
dist_skeletons_DATA = \
|
||||
data/skeletons/bison.m4 \
|
||||
data/skeletons/c++-skel.m4 \
|
||||
data/skeletons/c++.m4 \
|
||||
data/skeletons/c-like.m4 \
|
||||
data/skeletons/c-skel.m4 \
|
||||
data/skeletons/c.m4 \
|
||||
data/skeletons/glr.c \
|
||||
data/skeletons/glr.cc \
|
||||
data/skeletons/glr2.cc \
|
||||
data/skeletons/java-skel.m4 \
|
||||
data/skeletons/java.m4 \
|
||||
data/skeletons/lalr1.cc \
|
||||
data/skeletons/lalr1.java \
|
||||
data/skeletons/location.cc \
|
||||
data/skeletons/stack.hh \
|
||||
data/skeletons/traceon.m4 \
|
||||
data/skeletons/variant.hh \
|
||||
data/skeletons/yacc.c
|
||||
|
||||
# Experimental support for the D language.
|
||||
dist_skeletons_DATA += \
|
||||
data/skeletons/d-skel.m4 \
|
||||
data/skeletons/d.m4 \
|
||||
data/skeletons/lalr1.d
|
||||
|
||||
m4sugardir = $(pkgdatadir)/m4sugar
|
||||
dist_m4sugar_DATA = \
|
||||
data/m4sugar/foreach.m4 \
|
||||
data/m4sugar/m4sugar.m4
|
||||
|
||||
xsltdir = $(pkgdatadir)/xslt
|
||||
dist_xslt_DATA = \
|
||||
data/xslt/bison.xsl \
|
||||
data/xslt/xml2dot.xsl \
|
||||
data/xslt/xml2text.xsl \
|
||||
data/xslt/xml2xhtml.xsl
|
||||
@@ -0,0 +1,362 @@
|
||||
# -*- Autoconf -*-
|
||||
# This file is part of Autoconf.
|
||||
# foreach-based replacements for recursive functions.
|
||||
# Speeds up GNU M4 1.4.x by avoiding quadratic $@ recursion, but penalizes
|
||||
# GNU M4 1.6 by requiring more memory and macro expansions.
|
||||
#
|
||||
# Copyright (C) 2008-2017, 2020 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of Autoconf. This program is free
|
||||
# software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# Under Section 7 of GPL version 3, you are granted additional
|
||||
# permissions described in the Autoconf Configure Script Exception,
|
||||
# version 3.0, as published by the Free Software Foundation.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# and a copy of the Autoconf Configure Script Exception along with
|
||||
# this program; see the files COPYINGv3 and COPYING.EXCEPTION
|
||||
# respectively. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Written by Eric Blake.
|
||||
|
||||
# In M4 1.4.x, every byte of $@ is rescanned. This means that an
|
||||
# algorithm on n arguments that recurses with one less argument each
|
||||
# iteration will scan n * (n + 1) / 2 arguments, for O(n^2) time. In
|
||||
# M4 1.6, this was fixed so that $@ is only scanned once, then
|
||||
# back-references are made to information stored about the scan.
|
||||
# Thus, n iterations need only scan n arguments, for O(n) time.
|
||||
# Additionally, in M4 1.4.x, recursive algorithms did not clean up
|
||||
# memory very well, requiring O(n^2) memory rather than O(n) for n
|
||||
# iterations.
|
||||
#
|
||||
# This file is designed to overcome the quadratic nature of $@
|
||||
# recursion by writing a variant of m4_foreach that uses m4_for rather
|
||||
# than $@ recursion to operate on the list. This involves more macro
|
||||
# expansions, but avoids the need to rescan a quadratic number of
|
||||
# arguments, making these replacements very attractive for M4 1.4.x.
|
||||
# On the other hand, in any version of M4, expanding additional macros
|
||||
# costs additional time; therefore, in M4 1.6, where $@ recursion uses
|
||||
# fewer macros, these replacements actually pessimize performance.
|
||||
# Additionally, the use of $10 to mean the tenth argument violates
|
||||
# POSIX; although all versions of m4 1.4.x support this meaning, a
|
||||
# future m4 version may switch to take it as the first argument
|
||||
# concatenated with a literal 0, so the implementations in this file
|
||||
# are not future-proof. Thus, this file is conditionally included as
|
||||
# part of m4_init(), only when it is detected that M4 probably has
|
||||
# quadratic behavior (ie. it lacks the macro __m4_version__).
|
||||
#
|
||||
# Please keep this file in sync with m4sugar.m4.
|
||||
|
||||
# _m4_foreach(PRE, POST, IGNORED, ARG...)
|
||||
# ---------------------------------------
|
||||
# Form the common basis of the m4_foreach and m4_map macros. For each
|
||||
# ARG, expand PRE[ARG]POST[]. The IGNORED argument makes recursion
|
||||
# easier, and must be supplied rather than implicit.
|
||||
#
|
||||
# This version minimizes the number of times that $@ is evaluated by
|
||||
# using m4_for to generate a boilerplate into _m4_f then passing $@ to
|
||||
# that temporary macro. Thus, the recursion is done in m4_for without
|
||||
# reparsing any user input, and is not quadratic. For an idea of how
|
||||
# this works, note that m4_foreach(i,[1,2],[i]) calls
|
||||
# _m4_foreach([m4_define([i],],[)i],[],[1],[2])
|
||||
# which defines _m4_f:
|
||||
# $1[$4]$2[]$1[$5]$2[]_m4_popdef([_m4_f])
|
||||
# then calls _m4_f([m4_define([i],],[)i],[],[1],[2]) for a net result:
|
||||
# m4_define([i],[1])i[]m4_define([i],[2])i[]_m4_popdef([_m4_f]).
|
||||
m4_define([_m4_foreach],
|
||||
[m4_if([$#], [3], [],
|
||||
[m4_pushdef([_m4_f], _m4_for([4], [$#], [1],
|
||||
[$0_([1], [2],], [)])[_m4_popdef([_m4_f])])_m4_f($@)])])
|
||||
|
||||
m4_define([_m4_foreach_],
|
||||
[[$$1[$$3]$$2[]]])
|
||||
|
||||
# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
|
||||
# -----------------------------------------------------------
|
||||
# Find the first VAL that SWITCH matches, and expand the corresponding
|
||||
# IF-VAL. If there are no matches, expand DEFAULT.
|
||||
#
|
||||
# Use m4_for to create a temporary macro in terms of a boilerplate
|
||||
# m4_if with final cleanup. If $# is even, we have DEFAULT; if it is
|
||||
# odd, then rounding the last $# up in the temporary macro is
|
||||
# harmless. For example, both m4_case(1,2,3,4,5) and
|
||||
# m4_case(1,2,3,4,5,6) result in the intermediate _m4_case being
|
||||
# m4_if([$1],[$2],[$3],[$1],[$4],[$5],_m4_popdef([_m4_case])[$6])
|
||||
m4_define([m4_case],
|
||||
[m4_if(m4_eval([$# <= 2]), [1], [$2],
|
||||
[m4_pushdef([_$0], [m4_if(]_m4_for([2], m4_eval([($# - 1) / 2 * 2]), [2],
|
||||
[_$0_(], [)])[_m4_popdef(
|
||||
[_$0])]m4_dquote($m4_eval([($# + 1) & ~1]))[)])_$0($@)])])
|
||||
|
||||
m4_define([_m4_case_],
|
||||
[$0_([1], [$1], m4_incr([$1]))])
|
||||
|
||||
m4_define([_m4_case__],
|
||||
[[[$$1],[$$2],[$$3],]])
|
||||
|
||||
# m4_bmatch(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT)
|
||||
# -----------------------------------------------------
|
||||
# m4 equivalent of
|
||||
#
|
||||
# if (SWITCH =~ RE1)
|
||||
# VAL1;
|
||||
# elif (SWITCH =~ RE2)
|
||||
# VAL2;
|
||||
# elif ...
|
||||
# ...
|
||||
# else
|
||||
# DEFAULT
|
||||
#
|
||||
# We build the temporary macro _m4_b:
|
||||
# m4_define([_m4_b], _m4_defn([_m4_bmatch]))_m4_b([$1], [$2], [$3])...
|
||||
# _m4_b([$1], [$m-1], [$m])_m4_b([], [], [$m+1]_m4_popdef([_m4_b]))
|
||||
# then invoke m4_unquote(_m4_b($@)), for concatenation with later text.
|
||||
m4_define([m4_bmatch],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
|
||||
[$#], 1, [m4_fatal([$0: too few arguments: $#: $1])],
|
||||
[$#], 2, [$2],
|
||||
[m4_pushdef([_m4_b], [m4_define([_m4_b],
|
||||
_m4_defn([_$0]))]_m4_for([3], m4_eval([($# + 1) / 2 * 2 - 1]),
|
||||
[2], [_$0_(], [)])[_m4_b([], [],]m4_dquote([$]m4_eval(
|
||||
[($# + 1) / 2 * 2]))[_m4_popdef([_m4_b]))])m4_unquote(_m4_b($@))])])
|
||||
|
||||
m4_define([_m4_bmatch],
|
||||
[m4_if(m4_bregexp([$1], [$2]), [-1], [], [[$3]m4_define([$0])])])
|
||||
|
||||
m4_define([_m4_bmatch_],
|
||||
[$0_([1], m4_decr([$1]), [$1])])
|
||||
|
||||
m4_define([_m4_bmatch__],
|
||||
[[_m4_b([$$1], [$$2], [$$3])]])
|
||||
|
||||
|
||||
# m4_cond(TEST1, VAL1, IF-VAL1, TEST2, VAL2, IF-VAL2, ..., [DEFAULT])
|
||||
# -------------------------------------------------------------------
|
||||
# Similar to m4_if, except that each TEST is expanded when encountered.
|
||||
# If the expansion of TESTn matches the string VALn, the result is IF-VALn.
|
||||
# The result is DEFAULT if no tests passed. This macro allows
|
||||
# short-circuiting of expensive tests, where it pays to arrange quick
|
||||
# filter tests to run first.
|
||||
#
|
||||
# m4_cond already guarantees either 3*n or 3*n + 1 arguments, 1 <= n.
|
||||
# We only have to speed up _m4_cond, by building the temporary _m4_c:
|
||||
# m4_define([_m4_c], _m4_defn([m4_unquote]))_m4_c([m4_if(($1), [($2)],
|
||||
# [[$3]m4_define([_m4_c])])])_m4_c([m4_if(($4), [($5)],
|
||||
# [[$6]m4_define([_m4_c])])])..._m4_c([m4_if(($m-2), [($m-1)],
|
||||
# [[$m]m4_define([_m4_c])])])_m4_c([[$m+1]]_m4_popdef([_m4_c]))
|
||||
# We invoke m4_unquote(_m4_c($@)), for concatenation with later text.
|
||||
m4_define([_m4_cond],
|
||||
[m4_pushdef([_m4_c], [m4_define([_m4_c],
|
||||
_m4_defn([m4_unquote]))]_m4_for([2], m4_eval([$# / 3 * 3 - 1]), [3],
|
||||
[$0_(], [)])[_m4_c(]m4_dquote(m4_dquote(
|
||||
[$]m4_eval([$# / 3 * 3 + 1])))[_m4_popdef([_m4_c]))])m4_unquote(_m4_c($@))])
|
||||
|
||||
m4_define([_m4_cond_],
|
||||
[$0_(m4_decr([$1]), [$1], m4_incr([$1]))])
|
||||
|
||||
m4_define([_m4_cond__],
|
||||
[[_m4_c([m4_if(($$1), [($$2)], [[$$3]m4_define([_m4_c])])])]])
|
||||
|
||||
# m4_bpatsubsts(STRING, RE1, SUBST1, RE2, SUBST2, ...)
|
||||
# ----------------------------------------------------
|
||||
# m4 equivalent of
|
||||
#
|
||||
# $_ = STRING;
|
||||
# s/RE1/SUBST1/g;
|
||||
# s/RE2/SUBST2/g;
|
||||
# ...
|
||||
#
|
||||
# m4_bpatsubsts already validated an odd number of arguments; we only
|
||||
# need to speed up _m4_bpatsubsts. To avoid nesting, we build the
|
||||
# temporary _m4_p:
|
||||
# m4_define([_m4_p], [$1])m4_define([_m4_p],
|
||||
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$2], [$3]))m4_define([_m4_p],
|
||||
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$4], [$5]))m4_define([_m4_p],...
|
||||
# m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$m-1], [$m]))m4_unquote(
|
||||
# _m4_defn([_m4_p])_m4_popdef([_m4_p]))
|
||||
m4_define([_m4_bpatsubsts],
|
||||
[m4_pushdef([_m4_p], [m4_define([_m4_p],
|
||||
]m4_dquote([$]1)[)]_m4_for([3], [$#], [2], [$0_(],
|
||||
[)])[m4_unquote(_m4_defn([_m4_p])_m4_popdef([_m4_p]))])_m4_p($@)])
|
||||
|
||||
m4_define([_m4_bpatsubsts_],
|
||||
[$0_(m4_decr([$1]), [$1])])
|
||||
|
||||
m4_define([_m4_bpatsubsts__],
|
||||
[[m4_define([_m4_p],
|
||||
m4_bpatsubst(m4_dquote(_m4_defn([_m4_p])), [$$1], [$$2]))]])
|
||||
|
||||
# m4_shiftn(N, ...)
|
||||
# -----------------
|
||||
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
|
||||
#
|
||||
# m4_shiftn already validated arguments; we only need to speed up
|
||||
# _m4_shiftn. If N is 3, then we build the temporary _m4_s, defined as
|
||||
# ,[$5],[$6],...,[$m]_m4_popdef([_m4_s])
|
||||
# before calling m4_shift(_m4_s($@)).
|
||||
m4_define([_m4_shiftn],
|
||||
[m4_if(m4_incr([$1]), [$#], [], [m4_pushdef([_m4_s],
|
||||
_m4_for(m4_eval([$1 + 2]), [$#], [1],
|
||||
[[,]m4_dquote($], [)])[_m4_popdef([_m4_s])])m4_shift(_m4_s($@))])])
|
||||
|
||||
# m4_do(STRING, ...)
|
||||
# ------------------
|
||||
# This macro invokes all its arguments (in sequence, of course). It is
|
||||
# useful for making your macros more structured and readable by dropping
|
||||
# unnecessary dnl's and have the macros indented properly.
|
||||
#
|
||||
# Here, we use the temporary macro _m4_do, defined as
|
||||
# $1[]$2[]...[]$n[]_m4_popdef([_m4_do])
|
||||
m4_define([m4_do],
|
||||
[m4_if([$#], [0], [],
|
||||
[m4_pushdef([_$0], _m4_for([1], [$#], [1],
|
||||
[$], [[[]]])[_m4_popdef([_$0])])_$0($@)])])
|
||||
|
||||
# m4_dquote_elt(ARGS)
|
||||
# -------------------
|
||||
# Return ARGS as an unquoted list of double-quoted arguments.
|
||||
#
|
||||
# _m4_foreach to the rescue.
|
||||
m4_define([m4_dquote_elt],
|
||||
[m4_if([$#], [0], [], [[[$1]]_m4_foreach([,m4_dquote(], [)], $@)])])
|
||||
|
||||
# m4_reverse(ARGS)
|
||||
# ----------------
|
||||
# Output ARGS in reverse order.
|
||||
#
|
||||
# Invoke _m4_r($@) with the temporary _m4_r built as
|
||||
# [$m], [$m-1], ..., [$2], [$1]_m4_popdef([_m4_r])
|
||||
m4_define([m4_reverse],
|
||||
[m4_if([$#], [0], [], [$#], [1], [[$1]],
|
||||
[m4_pushdef([_m4_r], [[$$#]]_m4_for(m4_decr([$#]), [1], [-1],
|
||||
[[, ]m4_dquote($], [)])[_m4_popdef([_m4_r])])_m4_r($@)])])
|
||||
|
||||
|
||||
# m4_map_args_pair(EXPRESSION, [END-EXPR = EXPRESSION], ARG...)
|
||||
# -------------------------------------------------------------
|
||||
# Perform a pairwise grouping of consecutive ARGs, by expanding
|
||||
# EXPRESSION([ARG1], [ARG2]). If there are an odd number of ARGs, the
|
||||
# final argument is expanded with END-EXPR([ARGn]).
|
||||
#
|
||||
# Build the temporary macro _m4_map_args_pair, with the $2([$m+1])
|
||||
# only output if $# is odd:
|
||||
# $1([$3], [$4])[]$1([$5], [$6])[]...$1([$m-1],
|
||||
# [$m])[]m4_default([$2], [$1])([$m+1])[]_m4_popdef([_m4_map_args_pair])
|
||||
m4_define([m4_map_args_pair],
|
||||
[m4_if([$#], [0], [m4_fatal([$0: too few arguments: $#])],
|
||||
[$#], [1], [m4_fatal([$0: too few arguments: $#: $1])],
|
||||
[$#], [2], [],
|
||||
[$#], [3], [m4_default([$2], [$1])([$3])[]],
|
||||
[m4_pushdef([_$0], _m4_for([3],
|
||||
m4_eval([$# / 2 * 2 - 1]), [2], [_$0_(], [)])_$0_end(
|
||||
[1], [2], [$#])[_m4_popdef([_$0])])_$0($@)])])
|
||||
|
||||
m4_define([_m4_map_args_pair_],
|
||||
[$0_([1], [$1], m4_incr([$1]))])
|
||||
|
||||
m4_define([_m4_map_args_pair__],
|
||||
[[$$1([$$2], [$$3])[]]])
|
||||
|
||||
m4_define([_m4_map_args_pair_end],
|
||||
[m4_if(m4_eval([$3 & 1]), [1], [[m4_default([$$2], [$$1])([$$3])[]]])])
|
||||
|
||||
# m4_join(SEP, ARG1, ARG2...)
|
||||
# ---------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn. Avoid back-to-back SEP when a given ARG
|
||||
# is the empty string. No expansion is performed on SEP or ARGs.
|
||||
#
|
||||
# Use a self-modifying separator, since we don't know how many
|
||||
# arguments might be skipped before a separator is first printed, but
|
||||
# be careful if the separator contains $. _m4_foreach to the rescue.
|
||||
m4_define([m4_join],
|
||||
[m4_pushdef([_m4_sep], [m4_define([_m4_sep], _m4_defn([m4_echo]))])]dnl
|
||||
[_m4_foreach([_$0([$1],], [)], $@)_m4_popdef([_m4_sep])])
|
||||
|
||||
m4_define([_m4_join],
|
||||
[m4_if([$2], [], [], [_m4_sep([$1])[$2]])])
|
||||
|
||||
# m4_joinall(SEP, ARG1, ARG2...)
|
||||
# ------------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn. An empty ARG results in back-to-back SEP.
|
||||
# No expansion is performed on SEP or ARGs.
|
||||
#
|
||||
# A bit easier than m4_join. _m4_foreach to the rescue.
|
||||
m4_define([m4_joinall],
|
||||
[[$2]m4_if(m4_eval([$# <= 2]), [1], [],
|
||||
[_m4_foreach([$1], [], m4_shift($@))])])
|
||||
|
||||
# m4_list_cmp(A, B)
|
||||
# -----------------
|
||||
# Compare the two lists of integer expressions A and B.
|
||||
#
|
||||
# m4_list_cmp takes care of any side effects; we only override
|
||||
# _m4_list_cmp_raw, where we can safely expand lists multiple times.
|
||||
# First, insert padding so that both lists are the same length; the
|
||||
# trailing +0 is necessary to handle a missing list. Next, create a
|
||||
# temporary macro to perform pairwise comparisons until an inequality
|
||||
# is found. For example, m4_list_cmp([1], [1,2]) creates _m4_cmp as
|
||||
# m4_if(m4_eval([($1) != ($3)]), [1], [m4_cmp([$1], [$3])],
|
||||
# m4_eval([($2) != ($4)]), [1], [m4_cmp([$2], [$4])],
|
||||
# [0]_m4_popdef([_m4_cmp]))
|
||||
# then calls _m4_cmp([1+0], [0*2], [1], [2+0])
|
||||
m4_define([_m4_list_cmp_raw],
|
||||
[m4_if([$1], [$2], 0,
|
||||
[_m4_list_cmp($1+0_m4_list_pad(m4_count($1), m4_count($2)),
|
||||
$2+0_m4_list_pad(m4_count($2), m4_count($1)))])])
|
||||
|
||||
m4_define([_m4_list_pad],
|
||||
[m4_if(m4_eval($1 < $2), [1],
|
||||
[_m4_for(m4_incr([$1]), [$2], [1], [,0*])])])
|
||||
|
||||
m4_define([_m4_list_cmp],
|
||||
[m4_pushdef([_m4_cmp], [m4_if(]_m4_for(
|
||||
[1], m4_eval([$# >> 1]), [1], [$0_(], [,]m4_eval([$# >> 1])[)])[
|
||||
[0]_m4_popdef([_m4_cmp]))])_m4_cmp($@)])
|
||||
|
||||
m4_define([_m4_list_cmp_],
|
||||
[$0_([$1], m4_eval([$1 + $2]))])
|
||||
|
||||
m4_define([_m4_list_cmp__],
|
||||
[[m4_eval([($$1) != ($$2)]), [1], [m4_cmp([$$1], [$$2])],
|
||||
]])
|
||||
|
||||
# m4_max(EXPR, ...)
|
||||
# m4_min(EXPR, ...)
|
||||
# -----------------
|
||||
# Return the decimal value of the maximum (or minimum) in a series of
|
||||
# integer expressions.
|
||||
#
|
||||
# _m4_foreach to the rescue; we only need to replace _m4_minmax. Here,
|
||||
# we need a temporary macro to track the best answer so far, so that
|
||||
# the foreach expression is tractable.
|
||||
m4_define([_m4_minmax],
|
||||
[m4_pushdef([_m4_best], m4_eval([$2]))_m4_foreach(
|
||||
[m4_define([_m4_best], $1(_m4_best,], [))], m4_shift($@))]dnl
|
||||
[_m4_best[]_m4_popdef([_m4_best])])
|
||||
|
||||
# m4_set_add_all(SET, VALUE...)
|
||||
# -----------------------------
|
||||
# Add each VALUE into SET. This is O(n) in the number of VALUEs, and
|
||||
# can be faster than calling m4_set_add for each VALUE.
|
||||
#
|
||||
# _m4_foreach to the rescue. If no deletions have occurred, then
|
||||
# avoid the speed penalty of m4_set_add.
|
||||
m4_define([m4_set_add_all],
|
||||
[m4_if([$#], [0], [], [$#], [1], [],
|
||||
[m4_define([_m4_set_size($1)], m4_eval(m4_set_size([$1])
|
||||
+ m4_len(_m4_foreach(m4_ifdef([_m4_set_cleanup($1)],
|
||||
[[m4_set_add]], [[_$0]])[([$1],], [)], $@))))])])
|
||||
|
||||
m4_define([_m4_set_add_all],
|
||||
[m4_ifdef([_m4_set([$1],$2)], [],
|
||||
[m4_define([_m4_set([$1],$2)],
|
||||
[1])m4_pushdef([_m4_set([$1])], [$2])-])])
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# C++ skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.cc]])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.cc]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
@@ -0,0 +1,778 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Sanity checks, before defaults installed by c.m4.
|
||||
b4_percent_define_ifdef([[api.value.union.name]],
|
||||
[b4_complain_at(b4_percent_define_get_loc([[api.value.union.name]]),
|
||||
[named %union is invalid in C++])])
|
||||
|
||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
||||
|
||||
m4_include(b4_skeletonsdir/[c.m4])
|
||||
|
||||
b4_percent_define_check_kind([api.namespace], [code], [deprecated])
|
||||
b4_percent_define_check_kind([api.parser.class], [code], [deprecated])
|
||||
|
||||
|
||||
## ----- ##
|
||||
## C++. ##
|
||||
## ----- ##
|
||||
|
||||
# b4_comment(TEXT, [PREFIX])
|
||||
# --------------------------
|
||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment],
|
||||
[_b4_comment([$1], [$2// ], [$2// ])])
|
||||
|
||||
|
||||
# b4_inline(hh|cc)
|
||||
# ----------------
|
||||
# Expand to `inline\n ` if $1 is hh.
|
||||
m4_define([b4_inline],
|
||||
[m4_case([$1],
|
||||
[cc], [],
|
||||
[hh], [[inline
|
||||
]],
|
||||
[m4_fatal([$0: invalid argument: $1])])])
|
||||
|
||||
|
||||
# b4_cxx_portability
|
||||
# ------------------
|
||||
m4_define([b4_cxx_portability],
|
||||
[#if defined __cplusplus
|
||||
# define YY_CPLUSPLUS __cplusplus
|
||||
#else
|
||||
# define YY_CPLUSPLUS 199711L
|
||||
#endif
|
||||
|
||||
// Support move semantics when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_MOVE std::move
|
||||
# define YY_MOVE_OR_COPY move
|
||||
# define YY_MOVE_REF(Type) Type&&
|
||||
# define YY_RVREF(Type) Type&&
|
||||
# define YY_COPY(Type) Type
|
||||
#else
|
||||
# define YY_MOVE
|
||||
# define YY_MOVE_OR_COPY copy
|
||||
# define YY_MOVE_REF(Type) Type&
|
||||
# define YY_RVREF(Type) const Type&
|
||||
# define YY_COPY(Type) const Type&
|
||||
#endif
|
||||
|
||||
// Support noexcept when possible.
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
# define YY_NOEXCEPT noexcept
|
||||
# define YY_NOTHROW
|
||||
#else
|
||||
# define YY_NOEXCEPT
|
||||
# define YY_NOTHROW throw ()
|
||||
#endif
|
||||
|
||||
// Support constexpr when possible.
|
||||
#if 201703 <= YY_CPLUSPLUS
|
||||
# define YY_CONSTEXPR constexpr
|
||||
#else
|
||||
# define YY_CONSTEXPR
|
||||
#endif[]dnl
|
||||
])
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
b4_percent_define_default([[api.parser.class]], [[parser]])
|
||||
|
||||
# Don't do that so that we remember whether we're using a user
|
||||
# request, or the default value.
|
||||
#
|
||||
# b4_percent_define_default([[api.location.type]], [[location]])
|
||||
|
||||
b4_percent_define_default([[api.filename.type]], [[const std::string]])
|
||||
# Make it a warning for those who used betas of Bison 3.0.
|
||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
||||
|
||||
b4_percent_define_default([[define_location_comparison]],
|
||||
[m4_if(b4_percent_define_get([[filename_type]]),
|
||||
[std::string], [[true]], [[false]])])
|
||||
|
||||
|
||||
|
||||
## ----------- ##
|
||||
## Namespace. ##
|
||||
## ----------- ##
|
||||
|
||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
||||
|
||||
|
||||
# Don't permit an empty b4_namespace_ref. Any '::parser::foo' appended to it
|
||||
# would compile as an absolute reference with 'parser' in the global namespace.
|
||||
# b4_namespace_open would open an anonymous namespace and thus establish
|
||||
# internal linkage. This would compile. However, it's cryptic, and internal
|
||||
# linkage for the parser would be specified in all translation units that
|
||||
# include the header, which is always generated. If we ever need to permit
|
||||
# internal linkage somehow, surely we can find a cleaner approach.
|
||||
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
||||
[[namespace reference is empty]])])
|
||||
|
||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||
# invalid b4_namespace_ref that would be converted to a valid
|
||||
# b4_namespace_open. The problem is that Bison doesn't always output
|
||||
# b4_namespace_ref to uncommented code but should reserve the ability to do so
|
||||
# in future releases without risking breaking any existing user grammars.
|
||||
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
||||
# those into anonymous namespaces, and that might tempt some users.
|
||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
||||
[[namespace reference has consecutive "::"]])])
|
||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
||||
[[namespace reference has a trailing "::"]])])
|
||||
|
||||
m4_define([b4_namespace_open],
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
||||
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||
[^\(.\)[ ]*::], [\1])),
|
||||
[::], [ { namespace ])[ {]])])
|
||||
|
||||
m4_define([b4_namespace_close],
|
||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])dnl
|
||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
||||
[\1])),
|
||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## Token kinds. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# b4_token_enums
|
||||
# --------------
|
||||
# Output the definition of the token kinds.
|
||||
m4_define([b4_token_enums],
|
||||
[[enum token_kind_type
|
||||
{
|
||||
]b4_symbol([-2], [id])[ = -2,
|
||||
]b4_symbol_foreach([b4_token_enum])dnl
|
||||
[ };]dnl
|
||||
])
|
||||
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Symbol kinds. ##
|
||||
## -------------- ##
|
||||
|
||||
# b4_declare_symbol_enum
|
||||
# ----------------------
|
||||
# The definition of the symbol internal numbers as an enum.
|
||||
# Defining YYEMPTY here is important: it forces the compiler
|
||||
# to use a signed type, which matters for yytoken.
|
||||
m4_define([b4_declare_symbol_enum],
|
||||
[[enum symbol_kind_type
|
||||
{
|
||||
YYNTOKENS = ]b4_tokens_number[, ///< Number of tokens.
|
||||
]b4_symbol(empty, kind_base)[ = -2,
|
||||
]b4_symbol_foreach([ b4_symbol_enum])dnl
|
||||
[ };]])
|
||||
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Semantic Values. ##
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
|
||||
# b4_value_type_declare
|
||||
# ---------------------
|
||||
# Declare value_type.
|
||||
m4_define([b4_value_type_declare],
|
||||
[b4_value_type_setup[]dnl
|
||||
[ /// Symbol semantic values.
|
||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||
[code],
|
||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]],
|
||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
||||
[union\|union-directive],
|
||||
[[ union value_type
|
||||
{
|
||||
]b4_user_union_members[
|
||||
};]])])dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_public_types_declare
|
||||
# -----------------------
|
||||
# Define the public types: token, semantic value, location, and so forth.
|
||||
# Depending on %define token_lex, may be output in the header or source file.
|
||||
m4_define([b4_public_types_declare],
|
||||
[b4_glr2_cc_if(
|
||||
[b4_value_type_declare],
|
||||
[[#ifdef ]b4_api_PREFIX[STYPE
|
||||
# ifdef __GNUC__
|
||||
# pragma GCC message "bison: do not #define ]b4_api_PREFIX[STYPE in C++, use %define api.value.type"
|
||||
# endif
|
||||
typedef ]b4_api_PREFIX[STYPE value_type;
|
||||
#else
|
||||
]b4_value_type_declare[
|
||||
#endif
|
||||
/// Backward compatibility (Bison 3.8).
|
||||
typedef value_type semantic_type;
|
||||
]])[]b4_locations_if([
|
||||
/// Symbol locations.
|
||||
typedef b4_percent_define_get([[api.location.type]],
|
||||
[[location]]) location_type;])[
|
||||
|
||||
/// Syntax errors thrown from user actions.
|
||||
struct syntax_error : std::runtime_error
|
||||
{
|
||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||
: std::runtime_error (m)]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
syntax_error (const syntax_error& s)
|
||||
: std::runtime_error (s.what ())]b4_locations_if([
|
||||
, location (s.location)])[
|
||||
{}
|
||||
|
||||
~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
|
||||
|
||||
location_type location;])[
|
||||
};
|
||||
|
||||
/// Token kinds.
|
||||
struct token
|
||||
{
|
||||
]b4_token_enums[]b4_glr2_cc_if([], [[
|
||||
/// Backward compatibility alias (Bison 3.6).
|
||||
typedef token_kind_type yytokentype;]])[
|
||||
};
|
||||
|
||||
/// Token kind, as returned by yylex.
|
||||
typedef token::token_kind_type token_kind_type;]b4_glr2_cc_if([], [[
|
||||
|
||||
/// Backward compatibility alias (Bison 3.6).
|
||||
typedef token_kind_type token_type;]])[
|
||||
|
||||
/// Symbol kinds.
|
||||
struct symbol_kind
|
||||
{
|
||||
]b4_declare_symbol_enum[
|
||||
};
|
||||
|
||||
/// (Internal) symbol kind.
|
||||
typedef symbol_kind::symbol_kind_type symbol_kind_type;
|
||||
|
||||
/// The number of tokens.
|
||||
static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
|
||||
]])
|
||||
|
||||
|
||||
# b4_symbol_type_define
|
||||
# ---------------------
|
||||
# Define symbol_type, the external type for symbols used for symbol
|
||||
# constructors.
|
||||
m4_define([b4_symbol_type_define],
|
||||
[[ /// A complete symbol.
|
||||
///
|
||||
/// Expects its Base type to provide access to the symbol kind
|
||||
/// via kind ().
|
||||
///
|
||||
/// Provide access to semantic value]b4_locations_if([ and location])[.
|
||||
template <typename Base>
|
||||
struct basic_symbol : Base
|
||||
{
|
||||
/// Alias to Base.
|
||||
typedef Base super_type;
|
||||
|
||||
/// Default constructor.
|
||||
basic_symbol () YY_NOEXCEPT
|
||||
: value ()]b4_locations_if([
|
||||
, location ()])[
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
basic_symbol (basic_symbol&& that)
|
||||
: Base (std::move (that))
|
||||
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
||||
, location (std::move (that.location))])[
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([this->kind ()], [value], [move],
|
||||
[std::move (that.value)])
|
||||
])[}
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
basic_symbol (const basic_symbol& that);]b4_variant_if([[
|
||||
|
||||
/// Constructors for typed symbols.
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_define], [
|
||||
])], [[
|
||||
/// Constructor for valueless symbols.
|
||||
basic_symbol (typename Base::kind_type t]b4_locations_if([,
|
||||
YY_MOVE_REF (location_type) l])[);
|
||||
|
||||
/// Constructor for symbols with semantic value.
|
||||
basic_symbol (typename Base::kind_type t,
|
||||
YY_RVREF (value_type) v]b4_locations_if([,
|
||||
YY_RVREF (location_type) l])[);
|
||||
]])[
|
||||
/// Destroy the symbol.
|
||||
~basic_symbol ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
|
||||
]b4_glr2_cc_if([[
|
||||
/// Copy assignment.
|
||||
basic_symbol& operator= (const basic_symbol& that)
|
||||
{
|
||||
Base::operator= (that);]b4_variant_if([[
|
||||
]b4_symbol_variant([this->kind ()], [value], [copy],
|
||||
[that.value])], [[
|
||||
value = that.value]])[;]b4_locations_if([[
|
||||
location = that.location;]])[
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Move assignment.
|
||||
basic_symbol& operator= (basic_symbol&& that)
|
||||
{
|
||||
Base::operator= (std::move (that));]b4_variant_if([[
|
||||
]b4_symbol_variant([this->kind ()], [value], [move],
|
||||
[std::move (that.value)])], [[
|
||||
value = std::move (that.value)]])[;]b4_locations_if([[
|
||||
location = std::move (that.location);]])[
|
||||
return *this;
|
||||
}
|
||||
]])[
|
||||
|
||||
/// Destroy contents, and record that is empty.
|
||||
void clear () YY_NOEXCEPT
|
||||
{]b4_variant_if([[
|
||||
// User destructor.
|
||||
symbol_kind_type yykind = this->kind ();
|
||||
basic_symbol<Base>& yysym = *this;
|
||||
(void) yysym;
|
||||
switch (yykind)
|
||||
{
|
||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||
[ default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Value type destructor.
|
||||
]b4_symbol_variant([[yykind]], [[value]], [[template destroy]])])[
|
||||
Base::clear ();
|
||||
}
|
||||
|
||||
]b4_parse_error_bmatch(
|
||||
[custom\|detailed],
|
||||
[[ /// The user-facing name of this symbol.
|
||||
const char *name () const YY_NOEXCEPT
|
||||
{
|
||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||
}]],
|
||||
[simple],
|
||||
[[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||
/// The user-facing name of this symbol.
|
||||
const char *name () const YY_NOEXCEPT
|
||||
{
|
||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||
}
|
||||
#endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
|
||||
]],
|
||||
[verbose],
|
||||
[[ /// The user-facing name of this symbol.
|
||||
std::string name () const YY_NOEXCEPT
|
||||
{
|
||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||
}]])[]b4_glr2_cc_if([], [[
|
||||
|
||||
/// Backward compatibility (Bison 3.6).
|
||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
||||
|
||||
/// Whether empty.
|
||||
bool empty () const YY_NOEXCEPT;
|
||||
|
||||
/// Destructive move, \a s is emptied into this.
|
||||
void move (basic_symbol& s);
|
||||
|
||||
/// The semantic value.
|
||||
value_type value;]b4_locations_if([
|
||||
|
||||
/// The location.
|
||||
location_type location;])[
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Assignment operator.
|
||||
basic_symbol& operator= (const basic_symbol& that);
|
||||
#endif
|
||||
};
|
||||
|
||||
/// Type access provider for token (enum) based symbols.
|
||||
struct by_kind
|
||||
{
|
||||
/// The symbol kind as needed by the constructor.
|
||||
typedef token_kind_type kind_type;
|
||||
|
||||
/// Default constructor.
|
||||
by_kind () YY_NOEXCEPT;
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Move constructor.
|
||||
by_kind (by_kind&& that) YY_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
/// Copy constructor.
|
||||
by_kind (const by_kind& that) YY_NOEXCEPT;
|
||||
|
||||
/// Constructor from (external) token numbers.
|
||||
by_kind (kind_type t) YY_NOEXCEPT;
|
||||
|
||||
]b4_glr2_cc_if([[
|
||||
/// Copy assignment.
|
||||
by_kind& operator= (const by_kind& that);
|
||||
|
||||
/// Move assignment.
|
||||
by_kind& operator= (by_kind&& that);
|
||||
]])[
|
||||
|
||||
/// Record that this symbol is empty.
|
||||
void clear () YY_NOEXCEPT;
|
||||
|
||||
/// Steal the symbol kind from \a that.
|
||||
void move (by_kind& that);
|
||||
|
||||
/// The (internal) type number (corresponding to \a type).
|
||||
/// \a empty when empty.
|
||||
symbol_kind_type kind () const YY_NOEXCEPT;]b4_glr2_cc_if([], [[
|
||||
|
||||
/// Backward compatibility (Bison 3.6).
|
||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
||||
|
||||
/// The symbol kind.
|
||||
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
||||
symbol_kind_type kind_;
|
||||
};]b4_glr2_cc_if([], [[
|
||||
|
||||
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
||||
typedef by_kind by_type;]])[
|
||||
|
||||
/// "External" symbols: returned by the scanner.
|
||||
struct symbol_type : basic_symbol<by_kind>
|
||||
{]b4_variant_if([[
|
||||
/// Superclass.
|
||||
typedef basic_symbol<by_kind> super_type;
|
||||
|
||||
/// Empty symbol.
|
||||
symbol_type () YY_NOEXCEPT {}
|
||||
|
||||
/// Constructor for valueless symbols, and symbols from each type.
|
||||
]b4_type_foreach([_b4_symbol_constructor_define])dnl
|
||||
])[};
|
||||
]])
|
||||
|
||||
|
||||
# b4_public_types_define(hh|cc)
|
||||
# -----------------------------
|
||||
# Provide the implementation needed by the public types.
|
||||
m4_define([b4_public_types_define],
|
||||
[[ // basic_symbol.
|
||||
template <typename Base>
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
||||
: Base (that)
|
||||
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
||||
, location (that.location)])[
|
||||
{]b4_variant_if([
|
||||
b4_symbol_variant([this->kind ()], [value], [copy],
|
||||
[YY_MOVE (that.value)])
|
||||
])[}
|
||||
|
||||
]b4_variant_if([], [[
|
||||
/// Constructor for valueless symbols.
|
||||
template <typename Base>
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_locations_if([YY_MOVE_REF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value ()]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
|
||||
template <typename Base>
|
||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
[YY_RVREF (value_type) v],
|
||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||
: Base (t)
|
||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
||||
, location (YY_MOVE (l))])[
|
||||
{]b4_variant_if([[
|
||||
(void) v;
|
||||
]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||
|
||||
]b4_glr2_cc_if([], [[
|
||||
template <typename Base>
|
||||
]b4_parser_class[::symbol_kind_type
|
||||
]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
||||
{
|
||||
return this->kind ();
|
||||
}
|
||||
]])[
|
||||
|
||||
template <typename Base>
|
||||
bool
|
||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||
{
|
||||
return this->kind () == ]b4_symbol(empty, kind)[;
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
void
|
||||
]b4_parser_class[::basic_symbol<Base>::move (basic_symbol& s)
|
||||
{
|
||||
super_type::move (s);
|
||||
]b4_variant_if([b4_symbol_variant([this->kind ()], [value], [move],
|
||||
[YY_MOVE (s.value)])],
|
||||
[value = YY_MOVE (s.value);])[]b4_locations_if([
|
||||
location = YY_MOVE (s.location);])[
|
||||
}
|
||||
|
||||
// by_kind.
|
||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind () YY_NOEXCEPT
|
||||
: kind_ (]b4_symbol(empty, kind)[)
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that) YY_NOEXCEPT
|
||||
: kind_ (that.kind_)
|
||||
{
|
||||
that.clear ();
|
||||
}
|
||||
#endif
|
||||
|
||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that) YY_NOEXCEPT
|
||||
: kind_ (that.kind_)
|
||||
{}
|
||||
|
||||
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t) YY_NOEXCEPT
|
||||
: kind_ (yytranslate_ (t))
|
||||
{}
|
||||
|
||||
]b4_glr2_cc_if([[
|
||||
]b4_inline([$1])]b4_parser_class[::by_kind&
|
||||
b4_parser_class[::by_kind::by_kind::operator= (const by_kind& that)
|
||||
{
|
||||
kind_ = that.kind_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
]b4_inline([$1])]b4_parser_class[::by_kind&
|
||||
b4_parser_class[::by_kind::by_kind::operator= (by_kind&& that)
|
||||
{
|
||||
kind_ = that.kind_;
|
||||
that.clear ();
|
||||
return *this;
|
||||
}
|
||||
]])[
|
||||
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
|
||||
{
|
||||
kind_ = ]b4_symbol(empty, kind)[;
|
||||
}
|
||||
|
||||
]b4_inline([$1])[void
|
||||
]b4_parser_class[::by_kind::move (by_kind& that)
|
||||
{
|
||||
kind_ = that.kind_;
|
||||
that.clear ();
|
||||
}
|
||||
|
||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||
]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT
|
||||
{
|
||||
return kind_;
|
||||
}
|
||||
|
||||
]b4_glr2_cc_if([], [[
|
||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
||||
{
|
||||
return this->kind ();
|
||||
}
|
||||
]])[
|
||||
]])
|
||||
|
||||
|
||||
# b4_token_constructor_define
|
||||
# ----------------------------
|
||||
# Define make_FOO for all the token kinds.
|
||||
# Use at class-level. Redefined in variant.hh.
|
||||
m4_define([b4_token_constructor_define], [])
|
||||
|
||||
|
||||
# b4_yytranslate_define(cc|hh)
|
||||
# ----------------------------
|
||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||
# sometimes in the cc file.
|
||||
m4_define([b4_yytranslate_define],
|
||||
[ b4_inline([$1])b4_parser_class[::symbol_kind_type
|
||||
]b4_parser_class[::yytranslate_ (int t) YY_NOEXCEPT
|
||||
{
|
||||
]b4_api_token_raw_if(
|
||||
[[ return static_cast<symbol_kind_type> (t);]],
|
||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||
// TOKEN-NUM as returned by yylex.
|
||||
static
|
||||
const ]b4_int_type_for([b4_translate])[
|
||||
translate_table[] =
|
||||
{
|
||||
]b4_translate[
|
||||
};
|
||||
// Last valid token kind.
|
||||
const int code_max = ]b4_code_max[;
|
||||
|
||||
if (t <= 0)
|
||||
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
||||
else if (t <= code_max)
|
||||
return static_cast <symbol_kind_type> (translate_table[t]);
|
||||
else
|
||||
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
m4_define([b4_lhs_value],
|
||||
[b4_symbol_value([yyval], [$1])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, POS, [TYPE])
|
||||
# --------------------------------------
|
||||
# FIXME: Dead code.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[(yylocation_stack_@{($1) - ($2)@})])
|
||||
|
||||
|
||||
# b4_parse_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
# Change the parameter names from "foo" into "foo_yyarg", so that
|
||||
# there is no collision bw the user chosen attribute name, and the
|
||||
# argument name in the constructor.
|
||||
m4_define([b4_parse_param_decl],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
|
||||
|
||||
m4_define([b4_parse_param_decl_1],
|
||||
[$1_yyarg])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_cons
|
||||
# -------------------
|
||||
# Extra initialisations of the constructor.
|
||||
m4_define([b4_parse_param_cons],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[
|
||||
b4_cc_constructor_calls(b4_parse_param)])])
|
||||
m4_define([b4_cc_constructor_calls],
|
||||
[m4_map_sep([b4_cc_constructor_call], [,
|
||||
], [$@])])
|
||||
m4_define([b4_cc_constructor_call],
|
||||
[$2 ($2_yyarg)])
|
||||
|
||||
# b4_parse_param_vars
|
||||
# -------------------
|
||||
# Extra instance variables.
|
||||
m4_define([b4_parse_param_vars],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[
|
||||
// User arguments.
|
||||
b4_cc_var_decls(b4_parse_param)])])
|
||||
m4_define([b4_cc_var_decls],
|
||||
[m4_map_sep([b4_cc_var_decl], [
|
||||
], [$@])])
|
||||
m4_define([b4_cc_var_decl],
|
||||
[ $1;])
|
||||
|
||||
|
||||
## ---------##
|
||||
## Values. ##
|
||||
## ---------##
|
||||
|
||||
# b4_yylloc_default_define
|
||||
# ------------------------
|
||||
# Define YYLLOC_DEFAULT.
|
||||
m4_define([b4_yylloc_default_define],
|
||||
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||
If N is 0, then set CURRENT to the empty location which ends
|
||||
the previous symbol: RHS[0] (always defined). */
|
||||
|
||||
# ifndef YYLLOC_DEFAULT
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||
} \
|
||||
while (false)
|
||||
# endif
|
||||
]])
|
||||
|
||||
## -------- ##
|
||||
## Checks. ##
|
||||
## -------- ##
|
||||
|
||||
b4_token_ctor_if([b4_variant_if([],
|
||||
[b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
|
||||
[cannot use '%s' without '%s'],
|
||||
[%define api.token.constructor],
|
||||
[%define api.value.type variant]))])])
|
||||
@@ -0,0 +1,72 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# Common code for C-like languages (C, C++, Java, etc.)
|
||||
|
||||
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
||||
# --------------------------------------
|
||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||
# Avoid adding indentation to the first line, as the indentation comes
|
||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
||||
# Turn "*/" in TEXT into "* /" so that we don't unexpectedly close
|
||||
# the comments before its end.
|
||||
#
|
||||
# Prefix all the output lines with PREFIX.
|
||||
m4_define([_b4_comment],
|
||||
[$2[]b4_gsub(m4_expand([$1]),
|
||||
[[*]/], [*\\/],
|
||||
[/[*]], [/\\*],
|
||||
[
|
||||
\(.\)], [
|
||||
$3\1])$4])
|
||||
|
||||
|
||||
# b4_comment(TEXT, [PREFIX])
|
||||
# --------------------------
|
||||
# Put TEXT in comment. Prefix all the output lines with PREFIX.
|
||||
m4_define([b4_comment],
|
||||
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
|
||||
|
||||
|
||||
|
||||
|
||||
# _b4_dollar_dollar(VALUE, SYMBOL-NUM, FIELD, DEFAULT-FIELD)
|
||||
# ----------------------------------------------------------
|
||||
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
||||
# otherwise just VALUE. Be sure to pass "(VALUE)" if VALUE is a
|
||||
# pointer.
|
||||
m4_define([_b4_dollar_dollar],
|
||||
[b4_symbol_value([$1],
|
||||
[$2],
|
||||
m4_if([$3], [[]],
|
||||
[[$4]], [[$3]]))])
|
||||
|
||||
# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
|
||||
# b4_dollar_popdef
|
||||
# ------------------------------------------------------------------
|
||||
# Define b4_dollar_dollar for VALUE-POINTER and DEFAULT-FIELD,
|
||||
# and b4_at_dollar for LOCATION.
|
||||
m4_define([b4_dollar_pushdef],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[_b4_dollar_dollar([$1], [$2], m4_dquote($][1), [$3])])dnl
|
||||
m4_pushdef([b4_at_dollar], [$4])dnl
|
||||
])
|
||||
m4_define([b4_dollar_popdef],
|
||||
[m4_popdef([b4_at_dollar])dnl
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
])
|
||||
@@ -0,0 +1,27 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# C skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
b4_glr_if( [m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
||||
b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_skeletonsdir/[glr.c]])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[yacc.c]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# D skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
b4_glr_if( [b4_complain([%%glr-parser not supported for D])])
|
||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for D])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.d]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
@@ -0,0 +1,628 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# D language support for Bison
|
||||
|
||||
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||
|
||||
|
||||
# b4_symbol_action(SYMBOL-NUM, ACTION)
|
||||
# ------------------------------------
|
||||
# Run the action ACTION ("destructor" or "printer") for SYMBOL-NUM.
|
||||
m4_define([b4_symbol_action],
|
||||
[b4_symbol_if([$1], [has_$2],
|
||||
[b4_dollar_pushdef([yyval],
|
||||
[$1],
|
||||
[],
|
||||
[yyloc])dnl
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;
|
||||
|
||||
b4_dollar_popdef[]dnl
|
||||
])])
|
||||
|
||||
|
||||
# b4_use(EXPR)
|
||||
# ------------
|
||||
# Pacify the compiler about some maybe unused value.
|
||||
m4_define([b4_use],
|
||||
[])
|
||||
|
||||
|
||||
# b4_sync_start(LINE, FILE)
|
||||
# -------------------------
|
||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||
|
||||
|
||||
# b4_list2(LIST1, LIST2)
|
||||
# ----------------------
|
||||
# Join two lists with a comma if necessary.
|
||||
m4_define([b4_list2],
|
||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||
|
||||
|
||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
||||
# -------------------------------------------
|
||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
||||
# otherwise NOT.
|
||||
m4_define([b4_percent_define_get3],
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||
|
||||
# b4_percent_define_if_get2(ARG1, ARG2, DEF, NOT)
|
||||
# -----------------------------------------------
|
||||
# Expand to the value of DEF if ARG1 or ARG2 are %define'ed,
|
||||
# otherwise NOT.
|
||||
m4_define([b4_percent_define_if_get2],
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||
[$3], [m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
||||
[$3], [$4])])])
|
||||
|
||||
# b4_percent_define_class_before_interface(CLASS, INTERFACE)
|
||||
# ----------------------------------------------------------
|
||||
# Expand to a ', ' if both a class and an interface have been %define'ed
|
||||
m4_define([b4_percent_define_class_before_interface],
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$2])),
|
||||
[, ])])])
|
||||
|
||||
|
||||
# b4_flag_value(BOOLEAN-FLAG)
|
||||
# ---------------------------
|
||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||
|
||||
|
||||
# b4_parser_class_declaration
|
||||
# ---------------------------
|
||||
# The declaration of the parser class ("class YYParser"), with all its
|
||||
# qualifiers/annotations.
|
||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
||||
|
||||
m4_define([b4_parser_class_declaration],
|
||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
||||
[class ]b4_parser_class[]dnl
|
||||
b4_percent_define_if_get2([api.parser.extends], [api.parser.implements], [ : ])dnl
|
||||
b4_percent_define_get([api.parser.extends])dnl
|
||||
b4_percent_define_class_before_interface([api.parser.extends], [api.parser.implements])dnl
|
||||
b4_percent_define_get([api.parser.implements])])
|
||||
|
||||
|
||||
# b4_lexer_if(TRUE, FALSE)
|
||||
# ------------------------
|
||||
m4_define([b4_lexer_if],
|
||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_position_type_if(TRUE, FALSE)
|
||||
# --------------------------------
|
||||
m4_define([b4_position_type_if],
|
||||
[b4_percent_define_ifdef([[position_type]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_location_type_if(TRUE, FALSE)
|
||||
# --------------------------------
|
||||
m4_define([b4_location_type_if],
|
||||
[b4_percent_define_ifdef([[location_type]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_identification
|
||||
# -----------------
|
||||
m4_define([b4_identification],
|
||||
[[/** Version number for the Bison executable that generated this parser. */
|
||||
public static immutable string yy_bison_version = "]b4_version_string[";
|
||||
|
||||
/** Name of the skeleton that generated this parser. */
|
||||
public static immutable string yy_bison_skeleton = ]b4_skeleton[;
|
||||
]])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data types. ##
|
||||
## ------------ ##
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included).
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
[int])])
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# `NAME_min' to `NAME_max' (included).
|
||||
m4_define([b4_int_type_for],
|
||||
[b4_int_type($1_min, $1_max)])
|
||||
|
||||
# b4_null
|
||||
# -------
|
||||
m4_define([b4_null], [null])
|
||||
|
||||
|
||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
||||
#-----------------------------------------------------
|
||||
# Define "yy<TABLE-NAME>" whose contents is CONTENT.
|
||||
m4_define([b4_integral_parser_table_define],
|
||||
[m4_ifvaln([$3], [b4_comment([$3], [ ])])dnl
|
||||
private static immutable b4_int_type_for([$2])[[]] yy$1_ =
|
||||
@{
|
||||
$2
|
||||
@};dnl
|
||||
])
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## Token kinds. ##
|
||||
## ------------- ##
|
||||
|
||||
m4_define([b4_symbol(-2, id)], [[YYEMPTY]])
|
||||
b4_percent_define_default([[api.token.raw]], [[true]])
|
||||
|
||||
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# ---------------------------------------
|
||||
# Output the definition of this token as an enum.
|
||||
m4_define([b4_token_enum],
|
||||
[b4_token_format([ %s = %s,
|
||||
], [$1])])
|
||||
|
||||
# b4_token_enums
|
||||
# --------------
|
||||
# Output the definition of the tokens as enums.
|
||||
m4_define([b4_token_enums],
|
||||
[/* Token kinds. */
|
||||
public enum TokenKind {
|
||||
]b4_symbol(empty, id)[ = -2,
|
||||
b4_symbol_foreach([b4_token_enum])dnl
|
||||
}
|
||||
])
|
||||
|
||||
# b4_symbol_translate(STRING)
|
||||
# ---------------------------
|
||||
# Used by "bison" in the array of symbol names to mark those that
|
||||
# require translation.
|
||||
m4_define([b4_symbol_translate],
|
||||
[[_($1)]])
|
||||
|
||||
|
||||
# _b4_token_constructor_define(SYMBOL-NUM)
|
||||
# ----------------------------------------
|
||||
# Define Symbol.FOO for SYMBOL-NUM.
|
||||
m4_define([_b4_token_constructor_define],
|
||||
[b4_token_visible_if([$1],
|
||||
[[
|
||||
static auto ]b4_symbol([$1], [id])[(]b4_symbol_if([$1], [has_type],
|
||||
[b4_union_if([b4_symbol([$1], [type]],
|
||||
[[typeof(YYSemanticType.]b4_symbol([$1], [type])[]])) [val]])dnl
|
||||
[]b4_locations_if([b4_symbol_if([$1], [has_type], [[, ]])[Location l]])[)
|
||||
{
|
||||
return Symbol(TokenKind.]b4_symbol([$1], [id])[]b4_symbol_if([$1], [has_type],
|
||||
[[, val]])[]b4_locations_if([[, l]])[);
|
||||
}]])])
|
||||
|
||||
# b4_token_constructor_define
|
||||
# ---------------------------
|
||||
# Define Symbol.FOO for each token kind FOO.
|
||||
m4_define([b4_token_constructor_define],
|
||||
[[
|
||||
/* Implementation of token constructors for each symbol type visible to
|
||||
* the user. The code generates static methods that have the same names
|
||||
* as the TokenKinds.
|
||||
*/]b4_symbol_foreach([_b4_token_constructor_define])dnl
|
||||
])
|
||||
|
||||
## -------------- ##
|
||||
## Symbol kinds. ##
|
||||
## -------------- ##
|
||||
|
||||
# b4_symbol_kind(NUM)
|
||||
# -------------------
|
||||
m4_define([b4_symbol_kind],
|
||||
[SymbolKind.b4_symbol_kind_base($@)])
|
||||
|
||||
|
||||
# b4_symbol_enum(SYMBOL-NUM)
|
||||
# --------------------------
|
||||
# Output the definition of this symbol as an enum.
|
||||
m4_define([b4_symbol_enum],
|
||||
[m4_format([ %-30s %s],
|
||||
m4_format([[%s = %s,]],
|
||||
b4_symbol([$1], [kind_base]),
|
||||
[$1]),
|
||||
[b4_symbol_tag_comment([$1])])])
|
||||
|
||||
|
||||
# b4_declare_symbol_enum
|
||||
# ----------------------
|
||||
# The definition of the symbol internal numbers as an enum.
|
||||
# Defining YYEMPTY here is important: it forces the compiler
|
||||
# to use a signed type, which matters for yytoken.
|
||||
m4_define([b4_declare_symbol_enum],
|
||||
[[ /* Symbol kinds. */
|
||||
struct SymbolKind
|
||||
{
|
||||
enum
|
||||
{
|
||||
]b4_symbol(empty, kind_base)[ = -2, /* No symbol. */
|
||||
]b4_symbol_foreach([b4_symbol_enum])dnl
|
||||
[ }
|
||||
|
||||
private int yycode_;
|
||||
alias yycode_ this;
|
||||
|
||||
this(int code)
|
||||
{
|
||||
yycode_ = code;
|
||||
}
|
||||
|
||||
/* Return YYSTR after stripping away unnecessary quotes and
|
||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||
that double-quoting is unnecessary unless the string contains an
|
||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||
YYSTR is taken from yytname. */
|
||||
final void toString(W)(W sink) const
|
||||
if (isOutputRange!(W, char))
|
||||
{
|
||||
immutable string[] yy_sname = @{
|
||||
]b4_symbol_names[
|
||||
@};]b4_has_translations_if([[
|
||||
/* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
|
||||
internationalizable. */
|
||||
immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{
|
||||
]b4_translatable[
|
||||
@};]])[
|
||||
|
||||
put(sink, yy_sname[yycode_]);
|
||||
}
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
# b4_case(ID, CODE, [COMMENTS])
|
||||
# -----------------------------
|
||||
m4_define([b4_case], [ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||
$2
|
||||
break;])
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||
b4_percent_define_default([[stype]], [[YYSemanticType]])])
|
||||
|
||||
# %name-prefix
|
||||
m4_define_default([b4_prefix], [[YY]])
|
||||
|
||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])])
|
||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
#b4_percent_define_default([[location_type]], [Location])])
|
||||
m4_define([b4_location_type], b4_percent_define_ifdef([[location_type]],[b4_percent_define_get([[location_type]])],[YYLocation]))
|
||||
|
||||
#b4_percent_define_default([[position_type]], [Position])])
|
||||
m4_define([b4_position_type], b4_percent_define_ifdef([[position_type]],[b4_percent_define_get([[position_type]])],[YYPosition]))
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## api.value.type. ##
|
||||
## ---------------- ##
|
||||
|
||||
|
||||
# ---------------------- #
|
||||
# api.value.type=union. #
|
||||
# ---------------------- #
|
||||
|
||||
# b4_symbol_type_register(SYMBOL-NUM)
|
||||
# -----------------------------------
|
||||
# Symbol SYMBOL-NUM has a type (for union) instead of a type-tag.
|
||||
# Extend the definition of %union's body (b4_union_members) with a
|
||||
# field of that type, and extend the symbol's "type" field to point to
|
||||
# the field name, instead of the type name.
|
||||
m4_define([b4_symbol_type_register],
|
||||
[m4_define([b4_symbol($1, type_tag)],
|
||||
[b4_symbol_if([$1], [has_id],
|
||||
[b4_symbol([$1], [id])],
|
||||
[yykind_[]b4_symbol([$1], [number])])])dnl
|
||||
m4_append([b4_union_members],
|
||||
m4_expand([m4_format([ %-40s %s],
|
||||
m4_expand([b4_symbol([$1], [type]) b4_symbol([$1], [type_tag]);]),
|
||||
[b4_symbol_tag_comment([$1])])]))
|
||||
])
|
||||
|
||||
|
||||
# b4_type_define_tag(SYMBOL1-NUM, ...)
|
||||
# ------------------------------------
|
||||
# For the batch of symbols SYMBOL1-NUM... (which all have the same
|
||||
# type), enhance the %union definition for each of them, and set
|
||||
# there "type" field to the field tag name, instead of the type name.
|
||||
m4_define([b4_type_define_tag],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[m4_map([b4_symbol_type_register], [$@])])
|
||||
])
|
||||
|
||||
|
||||
# b4_symbol_value_union(VAL, SYMBOL-NUM, [TYPE])
|
||||
# ----------------------------------------------
|
||||
# Same of b4_symbol_value, but when api.value.type=union.
|
||||
m4_define([b4_symbol_value_union],
|
||||
[m4_ifval([$3],
|
||||
[(*($3*)(&$1))],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[($1.b4_symbol([$2], [type_tag]))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
# b4_value_type_setup_union
|
||||
# -------------------------
|
||||
# Setup support for api.value.type=union. Symbols are defined with a
|
||||
# type instead of a union member name: build the corresponding union,
|
||||
# and give the symbols their tag.
|
||||
m4_define([b4_value_type_setup_union],
|
||||
[m4_define([b4_union_members])
|
||||
b4_type_foreach([b4_type_define_tag])
|
||||
m4_copy_force([b4_symbol_value_union], [b4_symbol_value])
|
||||
])
|
||||
|
||||
|
||||
# _b4_value_type_setup_keyword
|
||||
# ----------------------------
|
||||
# api.value.type is defined with a keyword/string syntax. Check if
|
||||
# that is properly defined, and prepare its use.
|
||||
m4_define([_b4_value_type_setup_keyword],
|
||||
[b4_percent_define_check_values([[[[api.value.type]],
|
||||
[[none]],
|
||||
[[union]],
|
||||
[[union-directive]],
|
||||
[[yystype]]]])dnl
|
||||
m4_case(b4_percent_define_get([[api.value.type]]),
|
||||
[union], [b4_value_type_setup_union])])
|
||||
|
||||
|
||||
# b4_value_type_setup
|
||||
# -------------------
|
||||
# Check if api.value.type is properly defined, and possibly prepare
|
||||
# its use.
|
||||
b4_define_silent([b4_value_type_setup],
|
||||
[
|
||||
# Define default value.
|
||||
b4_percent_define_ifdef([[api.value.type]], [],
|
||||
[# %union => api.value.type=union-directive
|
||||
m4_ifdef([b4_union_members],
|
||||
[m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||
m4_define([b4_percent_define(api.value.type)], [union-directive])],
|
||||
[# no tag seen => api.value.type={int}
|
||||
m4_if(b4_tag_seen_flag, 0,
|
||||
[m4_define([b4_percent_define_kind(api.value.type)], [code])
|
||||
m4_define([b4_percent_define(api.value.type)], [int])],
|
||||
[# otherwise api.value.type=yystype
|
||||
m4_define([b4_percent_define_kind(api.value.type)], [keyword])
|
||||
m4_define([b4_percent_define(api.value.type)], [yystype])])])])
|
||||
|
||||
# Set up.
|
||||
m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||
[keyword], [_b4_value_type_setup_keyword])
|
||||
])
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Semantic Values. ##
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||
# ----------------------------------------------
|
||||
# See README. FIXME: factor in c-like?
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[($1.$3)],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[($1.b4_symbol([$2], [type]))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
# b4_lhs_value(SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------
|
||||
# See README.
|
||||
m4_define([b4_lhs_value],
|
||||
[b4_symbol_value([yyval], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------------------------
|
||||
# See README.
|
||||
#
|
||||
# In this simple implementation, %token and %type have class names
|
||||
# between the angle brackets.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[yystack.locationAt (b4_subtract($@))])
|
||||
|
||||
|
||||
# b4_lex_param
|
||||
# b4_parse_param
|
||||
# --------------
|
||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
||||
# it to be single quoted. Same for b4_parse_param.
|
||||
|
||||
# TODO: should be in bison.m4
|
||||
m4_define_default([b4_lex_param], [[]]))
|
||||
m4_define([b4_lex_param], b4_lex_param))
|
||||
m4_define([b4_parse_param], b4_parse_param))
|
||||
|
||||
# b4_lex_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_lex_param_decl],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_lex_param))],
|
||||
[$1])])
|
||||
|
||||
m4_define([b4_param_decls],
|
||||
[m4_map([b4_param_decl], [$@])])
|
||||
m4_define([b4_param_decl], [, $1])
|
||||
|
||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_parse_param_decl],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_parse_param))],
|
||||
[$1])])
|
||||
|
||||
|
||||
|
||||
# b4_lex_param_call
|
||||
# -------------------
|
||||
# Delegating the lexer parameters to the lexer constructor.
|
||||
m4_define([b4_lex_param_call],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_calls(b4_lex_param))],
|
||||
[$1])])
|
||||
m4_define([b4_param_calls],
|
||||
[m4_map([b4_param_call], [$@])])
|
||||
m4_define([b4_param_call], [, $2])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_cons
|
||||
# -------------------
|
||||
# Extra initialisations of the constructor.
|
||||
m4_define([b4_parse_param_cons],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_constructor_calls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_constructor_calls],
|
||||
[m4_map([b4_constructor_call], [$@])])
|
||||
m4_define([b4_constructor_call],
|
||||
[this.$2 = $2;
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_vars
|
||||
# -------------------
|
||||
# Extra instance variables.
|
||||
m4_define([b4_parse_param_vars],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[
|
||||
/* User arguments. */
|
||||
b4_var_decls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_var_decls],
|
||||
[m4_map_sep([b4_var_decl], [
|
||||
], [$@])])
|
||||
m4_define([b4_var_decl],
|
||||
[ protected $1;])
|
||||
|
||||
|
||||
# b4_public_types_declare
|
||||
# -----------------------
|
||||
# Define the public types: token, semantic value, location, and so forth.
|
||||
# Depending on %define token_lex, may be output in the header or source file.
|
||||
m4_define([b4_public_types_declare],
|
||||
[[
|
||||
alias Symbol = ]b4_parser_class[.Symbol;
|
||||
alias Value = ]b4_yystype[;]b4_locations_if([[
|
||||
alias Location = ]b4_location_type[;
|
||||
alias Position = ]b4_position_type[;]b4_push_if([[
|
||||
alias PUSH_MORE = ]b4_parser_class[.YYPUSH_MORE;
|
||||
alias ABORT = ]b4_parser_class[.YYABORT;
|
||||
alias ACCEPT = ]b4_parser_class[.YYACCEPT;]])[]])[
|
||||
]])
|
||||
|
||||
|
||||
# b4_basic_symbol_constructor_define
|
||||
# ----------------------------------
|
||||
# Create Symbol struct constructors for all the visible types.
|
||||
m4_define([b4_basic_symbol_constructor_define],
|
||||
[b4_token_visible_if([$1],
|
||||
[[ this(TokenKind token]b4_symbol_if([$1], [has_type],
|
||||
[[, ]b4_union_if([], [[typeof(YYSemanticType.]])b4_symbol([$1], [type])dnl
|
||||
[]b4_union_if([], [[) ]])[ val]])[]b4_locations_if([[, Location loc]])[)
|
||||
{
|
||||
kind = yytranslate_(token);]b4_union_if([b4_symbol_if([$1], [has_type], [[
|
||||
static foreach (member; __traits(allMembers, YYSemanticType))
|
||||
{
|
||||
static if (is(typeof(mixin("value_." ~ member)) == ]b4_symbol([$1], [type])[))
|
||||
{
|
||||
mixin("value_." ~ member ~ " = val;");
|
||||
}
|
||||
}]])], [b4_symbol_if([$1], [has_type], [[
|
||||
value_.]b4_symbol([$1], [type])[ = val;]])])[]b4_locations_if([
|
||||
location_ = loc;])[
|
||||
}
|
||||
]])])
|
||||
|
||||
|
||||
# b4_symbol_type_define
|
||||
# ---------------------
|
||||
# Define symbol_type, the external type for symbols used for symbol
|
||||
# constructors.
|
||||
m4_define([b4_symbol_type_define],
|
||||
[[
|
||||
/**
|
||||
* A complete symbol
|
||||
*/
|
||||
struct Symbol
|
||||
{
|
||||
private SymbolKind kind;
|
||||
private Value value_;]b4_locations_if([[
|
||||
private Location location_;]])[
|
||||
|
||||
]b4_type_foreach([b4_basic_symbol_constructor_define])[
|
||||
SymbolKind token() { return kind; }
|
||||
Value value() { return value_; }]b4_locations_if([[
|
||||
Location location() { return location_; }]])[
|
||||
]b4_token_ctor_if([b4_token_constructor_define])[
|
||||
}
|
||||
]])
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,397 @@
|
||||
# C++ GLR skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# This skeleton produces a C++ class that encapsulates a C glr parser.
|
||||
# This is in order to reduce the maintenance burden. The glr.c
|
||||
# skeleton is clean and pure enough so that there are no real
|
||||
# problems. The C++ interface is the same as that of lalr1.cc. In
|
||||
# fact, glr.c can replace yacc.c without the user noticing any
|
||||
# difference, and similarly for glr.cc replacing lalr1.cc.
|
||||
#
|
||||
# The passing of parse-params
|
||||
#
|
||||
# The additional arguments are stored as members of the parser
|
||||
# object, yyparser. The C routines need to carry yyparser
|
||||
# throughout the C parser; that's easy: make yyparser an
|
||||
# additional parse-param. But because the C++ skeleton needs to
|
||||
# know the "real" original parse-param, we save them
|
||||
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||
# (and c.m4 strips one level of quotes). This is a PITA, and
|
||||
# explains why there are so many levels of quotes.
|
||||
#
|
||||
# The locations
|
||||
#
|
||||
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||
# the locations in a union, the position and location classes
|
||||
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||
# must not define "b4_location_constructors". As a consequence the
|
||||
# user must initialize the first positions (in particular the
|
||||
# filename member).
|
||||
|
||||
# We require a pure interface.
|
||||
m4_define([b4_pure_flag], [1])
|
||||
|
||||
m4_include(b4_skeletonsdir/[c++.m4])
|
||||
b4_bison_locations_if([m4_include(b4_skeletonsdir/[location.cc])])
|
||||
|
||||
m4_define([b4_parser_class],
|
||||
[b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
# Save the parse parameters.
|
||||
m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
||||
|
||||
# b4_parse_param_wrap
|
||||
# -------------------
|
||||
# New ones.
|
||||
m4_ifset([b4_parse_param],
|
||||
[m4_define([b4_parse_param_wrap],
|
||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]],]
|
||||
m4_defn([b4_parse_param]))],
|
||||
[m4_define([b4_parse_param_wrap],
|
||||
[[b4_namespace_ref::b4_parser_class[& yyparser], [[yyparser]]]])
|
||||
])
|
||||
|
||||
|
||||
# b4_yy_symbol_print_define
|
||||
# -------------------------
|
||||
# Bypass the default implementation to generate the "yy_symbol_print"
|
||||
# and "yy_symbol_value_print" functions.
|
||||
m4_define([b4_yy_symbol_print_define],
|
||||
[[/*--------------------.
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
static void
|
||||
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
||||
const ]b4_namespace_ref::b4_parser_class[::value_type *yyvaluep]b4_locations_if([[,
|
||||
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
||||
{
|
||||
]b4_parse_param_use[]dnl
|
||||
[ yyparser.yy_symbol_print_ (yytoken, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||
}
|
||||
]])[
|
||||
|
||||
# Hijack the initial action to initialize the locations.
|
||||
]b4_bison_locations_if([m4_define([b4_initial_action],
|
||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||
m4_defn([b4_initial_action])]))])[
|
||||
|
||||
# Hijack the post prologue to declare yyerror.
|
||||
]m4_append([b4_post_prologue],
|
||||
[b4_syncline([@oline@], [@ofile@])dnl
|
||||
[static void
|
||||
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||
])[const char* msg);]])[
|
||||
|
||||
# Inserted before the epilogue to define implementations (yyerror, parser member
|
||||
# functions etc.).
|
||||
]m4_define([b4_glr_cc_pre_epilogue],
|
||||
[b4_syncline([@oline@], [@ofile@])dnl
|
||||
[
|
||||
/*------------------.
|
||||
| Report an error. |
|
||||
`------------------*/
|
||||
|
||||
static void
|
||||
yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp,
|
||||
]])[]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param),
|
||||
])[const char* msg)
|
||||
{
|
||||
]b4_parse_param_use[]dnl
|
||||
[ yyparser.error (]b4_locations_if([[*yylocationp, ]])[msg);
|
||||
}
|
||||
|
||||
|
||||
]b4_namespace_open[
|
||||
]dnl In this section, the parse params are the original parse_params.
|
||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
[ /// Build a parser object.
|
||||
]b4_parser_class::b4_parser_class[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||
:])[
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||
#endif]b4_parse_param_cons[
|
||||
{}
|
||||
|
||||
]b4_parser_class::~b4_parser_class[ ()
|
||||
{}
|
||||
|
||||
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
||||
{}
|
||||
|
||||
int
|
||||
]b4_parser_class[::operator() ()
|
||||
{
|
||||
return parse ();
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class[::parse ()
|
||||
{
|
||||
return ::yy_parse_impl (*this]b4_user_args[);
|
||||
}
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
/*--------------------.
|
||||
| Print this symbol. |
|
||||
`--------------------*/
|
||||
|
||||
void
|
||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||
const value_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[) const
|
||||
{]b4_locations_if([[
|
||||
YY_USE (yylocationp);]])[
|
||||
YY_USE (yyvaluep);
|
||||
std::ostream& yyo = debug_stream ();
|
||||
std::ostream& yyoutput = yyo;
|
||||
YY_USE (yyoutput);
|
||||
]b4_symbol_actions([printer])[
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
||||
const value_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[) const
|
||||
{
|
||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||
<< ' ' << yysymbol_name (yykind) << " ("]b4_locations_if([[
|
||||
<< *yylocationp << ": "]])[;
|
||||
yy_symbol_value_print_ (yykind, yyvaluep]b4_locations_if([[, yylocationp]])[);
|
||||
*yycdebug_ << ')';
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
]b4_parser_class[::debug_stream () const
|
||||
{
|
||||
return *yycdebug_;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class[::set_debug_stream (std::ostream& o)
|
||||
{
|
||||
yycdebug_ = &o;
|
||||
}
|
||||
|
||||
|
||||
]b4_parser_class[::debug_level_type
|
||||
]b4_parser_class[::debug_level () const
|
||||
{
|
||||
return yydebug;
|
||||
}
|
||||
|
||||
void
|
||||
]b4_parser_class[::set_debug_level (debug_level_type l)
|
||||
{
|
||||
// Actually, it is yydebug which is really used.
|
||||
yydebug = l;
|
||||
}
|
||||
|
||||
#endif
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
b4_namespace_close[]dnl
|
||||
])
|
||||
|
||||
|
||||
m4_define([b4_define_symbol_kind],
|
||||
[m4_format([#define %-15s %s],
|
||||
b4_symbol($][1, kind_base),
|
||||
b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol($1, kind_base))
|
||||
])
|
||||
|
||||
# b4_glr_cc_setup
|
||||
# ---------------
|
||||
# Setup redirections for glr.c: Map the names used in c.m4 to the ones used
|
||||
# in c++.m4.
|
||||
m4_define([b4_glr_cc_setup],
|
||||
[[]b4_attribute_define[
|
||||
]b4_null_define[
|
||||
|
||||
// This skeleton is based on C, yet compiles it as C++.
|
||||
// So expect warnings about C style casts.
|
||||
#if defined __clang__ && 306 <= __clang_major__ * 100 + __clang_minor__
|
||||
# pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#elif defined __GNUC__ && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
|
||||
// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
|
||||
// -pedantic reports as being a C++11 extension.
|
||||
#if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
|
||||
&& defined __clang__ && 4 <= __clang_major__
|
||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||
#endif
|
||||
|
||||
#undef ]b4_symbol(empty, [id])[
|
||||
#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[
|
||||
#undef ]b4_symbol(eof, [id])[
|
||||
#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[
|
||||
#undef ]b4_symbol(error, [id])[
|
||||
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
||||
|
||||
#ifndef ]b4_api_PREFIX[STYPE
|
||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
|
||||
#endif
|
||||
#ifndef ]b4_api_PREFIX[LTYPE
|
||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
||||
#endif
|
||||
|
||||
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
||||
|
||||
// Expose C++ symbol kinds to C.
|
||||
]b4_define_symbol_kind(-2)dnl
|
||||
b4_symbol_foreach([b4_define_symbol_kind])])[
|
||||
]])
|
||||
|
||||
|
||||
m4_define([b4_undef_symbol_kind],
|
||||
[[#undef ]b4_symbol($1, kind_base)[
|
||||
]])
|
||||
|
||||
|
||||
# b4_glr_cc_cleanup
|
||||
# -----------------
|
||||
# Remove redirections for glr.c.
|
||||
m4_define([b4_glr_cc_cleanup],
|
||||
[[#undef ]b4_symbol(empty, [id])[
|
||||
#undef ]b4_symbol(eof, [id])[
|
||||
#undef ]b4_symbol(error, [id])[
|
||||
|
||||
]b4_undef_symbol_kind(-2)dnl
|
||||
b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_shared_declarations(hh|cc)
|
||||
# -----------------------------
|
||||
# Declaration that might either go into the header (if --header, $1 = hh)
|
||||
# or in the implementation file.
|
||||
m4_define([b4_shared_declarations],
|
||||
[m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
b4_percent_code_get([[requires]])[
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
]b4_cxx_portability[
|
||||
]m4_ifdef([b4_location_include],
|
||||
[[# include ]b4_location_include])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
// Whether we are compiled with exception support.
|
||||
#ifndef YY_EXCEPTIONS
|
||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||
# define YY_EXCEPTIONS 0
|
||||
# else
|
||||
# define YY_EXCEPTIONS 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
]b4_YYDEBUG_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
|
||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||
[b4_location_define])])[
|
||||
|
||||
/// A Bison parser.
|
||||
class ]b4_parser_class[
|
||||
{
|
||||
public:
|
||||
]b4_public_types_declare[
|
||||
|
||||
/// Build a parser object.
|
||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class[ ();
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
/// The current debugging stream.
|
||||
std::ostream& debug_stream () const;
|
||||
/// Set the current debugging stream.
|
||||
void set_debug_stream (std::ostream &);
|
||||
|
||||
/// Type for debugging levels.
|
||||
typedef int debug_level_type;
|
||||
/// The current debugging level.
|
||||
debug_level_type debug_level () const;
|
||||
/// Set the current debugging level.
|
||||
void set_debug_level (debug_level_type l);
|
||||
#endif
|
||||
|
||||
/// Report a syntax error.]b4_locations_if([[
|
||||
/// \param loc where the syntax error is found.]])[
|
||||
/// \param msg a description of the syntax error.
|
||||
virtual void error (]b4_locations_if([[const location_type& loc, ]])[const std::string& msg);
|
||||
|
||||
# if ]b4_api_PREFIX[DEBUG
|
||||
public:
|
||||
/// \brief Report a symbol value on the debug stream.
|
||||
/// \param yykind The symbol kind.
|
||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||
/// \param yylocationp Its location.]])[
|
||||
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||
const value_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[) const;
|
||||
/// \brief Report a symbol on the debug stream.
|
||||
/// \param yykind The symbol kind.
|
||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||
/// \param yylocationp Its location.]])[
|
||||
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
||||
const value_type* yyvaluep]b4_locations_if([[,
|
||||
const location_type* yylocationp]])[) const;
|
||||
private:
|
||||
/// Debug stream.
|
||||
std::ostream* yycdebug_;
|
||||
#endif
|
||||
|
||||
]b4_parse_param_vars[
|
||||
};
|
||||
|
||||
]b4_namespace_close[
|
||||
|
||||
]b4_percent_code_get([[provides]])[
|
||||
]m4_popdef([b4_parse_param])dnl
|
||||
])[
|
||||
|
||||
]b4_header_if(
|
||||
[b4_output_begin([b4_spec_header_file])
|
||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
[2002-2015, 2018-2021])[
|
||||
// C++ GLR parser skeleton written by Akim Demaille.
|
||||
|
||||
]b4_disclaimer[
|
||||
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
|
||||
]b4_shared_declarations[
|
||||
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
|
||||
]b4_output_end])
|
||||
|
||||
# Let glr.c (and b4_shared_declarations) believe that the user
|
||||
# arguments include the parser itself.
|
||||
m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_wrap]))
|
||||
m4_include(b4_skeletonsdir/[glr.c])
|
||||
m4_popdef([b4_parse_param])
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# Java skeleton dispatching for Bison.
|
||||
|
||||
# Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation,
|
||||
# Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
b4_glr_if( [b4_complain([%%glr-parser not supported for Java])])
|
||||
b4_nondeterministic_if([b4_complain([%%nondeterministic-parser not supported for Java])])
|
||||
|
||||
m4_define_default([b4_used_skeleton], [b4_skeletonsdir/[lalr1.java]])
|
||||
m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
|
||||
|
||||
m4_include(b4_used_skeleton)
|
||||
@@ -0,0 +1,502 @@
|
||||
-*- Autoconf -*-
|
||||
|
||||
# Java language support for Bison
|
||||
|
||||
# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
m4_include(b4_skeletonsdir/[c-like.m4])
|
||||
|
||||
|
||||
# b4_list2(LIST1, LIST2)
|
||||
# ----------------------
|
||||
# Join two lists with a comma if necessary.
|
||||
m4_define([b4_list2],
|
||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||
|
||||
|
||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
||||
# -------------------------------------------
|
||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
||||
# otherwise NOT.
|
||||
m4_define([b4_percent_define_get3],
|
||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||
|
||||
|
||||
|
||||
# b4_flag_value(BOOLEAN-FLAG)
|
||||
# ---------------------------
|
||||
m4_define([b4_flag_value], [b4_flag_if([$1], [true], [false])])
|
||||
|
||||
|
||||
# b4_parser_class_declaration
|
||||
# ---------------------------
|
||||
# The declaration of the parser class ("class YYParser"), with all its
|
||||
# qualifiers/annotations.
|
||||
b4_percent_define_default([[api.parser.abstract]], [[false]])
|
||||
b4_percent_define_default([[api.parser.final]], [[false]])
|
||||
b4_percent_define_default([[api.parser.public]], [[false]])
|
||||
b4_percent_define_default([[api.parser.strictfp]], [[false]])
|
||||
|
||||
m4_define([b4_parser_class_declaration],
|
||||
[b4_percent_define_get3([api.parser.annotations], [], [ ])dnl
|
||||
b4_percent_define_flag_if([api.parser.public], [public ])dnl
|
||||
b4_percent_define_flag_if([api.parser.abstract], [abstract ])dnl
|
||||
b4_percent_define_flag_if([api.parser.final], [final ])dnl
|
||||
b4_percent_define_flag_if([api.parser.strictfp], [strictfp ])dnl
|
||||
[class ]b4_parser_class[]dnl
|
||||
b4_percent_define_get3([api.parser.extends], [ extends ])dnl
|
||||
b4_percent_define_get3([api.parser.implements], [ implements ])])
|
||||
|
||||
|
||||
# b4_lexer_if(TRUE, FALSE)
|
||||
# ------------------------
|
||||
m4_define([b4_lexer_if],
|
||||
[b4_percent_code_ifdef([[lexer]], [$1], [$2])])
|
||||
|
||||
|
||||
# b4_identification
|
||||
# -----------------
|
||||
m4_define([b4_identification],
|
||||
[[ /** Version number for the Bison executable that generated this parser. */
|
||||
public static final String bisonVersion = "]b4_version_string[";
|
||||
|
||||
/** Name of the skeleton that generated this parser. */
|
||||
public static final String bisonSkeleton = ]b4_skeleton[;
|
||||
]])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## Data types. ##
|
||||
## ------------ ##
|
||||
|
||||
# b4_int_type(MIN, MAX)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# MIN to MAX (included).
|
||||
m4_define([b4_int_type],
|
||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||
[int])])
|
||||
|
||||
# b4_int_type_for(NAME)
|
||||
# ---------------------
|
||||
# Return the smallest int type able to handle numbers ranging from
|
||||
# 'NAME_min' to 'NAME_max' (included).
|
||||
m4_define([b4_int_type_for],
|
||||
[b4_int_type($1_min, $1_max)])
|
||||
|
||||
# b4_null
|
||||
# -------
|
||||
m4_define([b4_null], [null])
|
||||
|
||||
|
||||
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
||||
# -------------------------------------------------------
|
||||
# We use intermediate functions (e.g., yypact_init) to work around the
|
||||
# 64KB limit for JVM methods. See
|
||||
# https://lists.gnu.org/r/help-bison/2008-11/msg00004.html.
|
||||
m4_define([b4_typed_parser_table_define],
|
||||
[m4_ifval([$4], [b4_comment([$4])
|
||||
])dnl
|
||||
[private static final ]$1[[] yy$2_ = yy$2_init();
|
||||
private static final ]$1[[] yy$2_init()
|
||||
{
|
||||
return new ]$1[[]
|
||||
{
|
||||
]$3[
|
||||
};
|
||||
}]])
|
||||
|
||||
|
||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
||||
#-----------------------------------------------------
|
||||
m4_define([b4_integral_parser_table_define],
|
||||
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## Token kinds. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# b4_token_enum(TOKEN-NUM)
|
||||
# ------------------------
|
||||
# Output the definition of this token as an enum.
|
||||
m4_define([b4_token_enum],
|
||||
[b4_token_visible_if([$1],
|
||||
[m4_format([[ /** Token %s, to be returned by the scanner. */
|
||||
static final int %s = %s%s;
|
||||
]],
|
||||
b4_symbol([$1], [tag]),
|
||||
b4_symbol([$1], [id]),
|
||||
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
|
||||
|
||||
|
||||
# b4_token_enums
|
||||
# --------------
|
||||
# Output the definition of the tokens (if there are) as enums.
|
||||
m4_define([b4_token_enums],
|
||||
[b4_any_token_visible_if([ /* Token kinds. */
|
||||
b4_symbol_foreach([b4_token_enum])])])
|
||||
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Symbol kinds. ##
|
||||
## -------------- ##
|
||||
|
||||
|
||||
# b4_symbol_kind(NUM)
|
||||
# -------------------
|
||||
m4_define([b4_symbol_kind],
|
||||
[SymbolKind.b4_symbol_kind_base($@)])
|
||||
|
||||
|
||||
# b4_symbol_enum(SYMBOL-NUM)
|
||||
# --------------------------
|
||||
# Output the definition of this symbol as an enum.
|
||||
m4_define([b4_symbol_enum],
|
||||
[m4_format([ %-30s %s],
|
||||
m4_format([[%s(%s)%s]],
|
||||
b4_symbol([$1], [kind_base]),
|
||||
[$1],
|
||||
m4_if([$1], b4_last_symbol, [[;]], [[,]])),
|
||||
[b4_symbol_tag_comment([$1])])])
|
||||
|
||||
|
||||
# b4_declare_symbol_enum
|
||||
# ----------------------
|
||||
# The definition of the symbol internal numbers as an enum.
|
||||
m4_define([b4_declare_symbol_enum],
|
||||
[[ public enum SymbolKind
|
||||
{
|
||||
]b4_symbol_foreach([b4_symbol_enum])[
|
||||
|
||||
private final int yycode_;
|
||||
|
||||
SymbolKind (int n) {
|
||||
this.yycode_ = n;
|
||||
}
|
||||
|
||||
private static final SymbolKind[] values_ = {
|
||||
]m4_map_args_sep([b4_symbol_kind(], [)], [,
|
||||
], b4_symbol_numbers)[
|
||||
};
|
||||
|
||||
static final SymbolKind get(int code) {
|
||||
return values_[code];
|
||||
}
|
||||
|
||||
public final int getCode() {
|
||||
return this.yycode_;
|
||||
}
|
||||
|
||||
]b4_parse_error_bmatch(
|
||||
[simple\|verbose],
|
||||
[[ /* Return YYSTR after stripping away unnecessary quotes and
|
||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||
that double-quoting is unnecessary unless the string contains an
|
||||
apostrophe, a comma, or backslash (other than backslash-backslash).
|
||||
YYSTR is taken from yytname. */
|
||||
private static String yytnamerr_(String yystr)
|
||||
{
|
||||
if (yystr.charAt (0) == '"')
|
||||
{
|
||||
StringBuffer yyr = new StringBuffer();
|
||||
strip_quotes: for (int i = 1; i < yystr.length(); i++)
|
||||
switch (yystr.charAt(i))
|
||||
{
|
||||
case '\'':
|
||||
case ',':
|
||||
break strip_quotes;
|
||||
|
||||
case '\\':
|
||||
if (yystr.charAt(++i) != '\\')
|
||||
break strip_quotes;
|
||||
/* Fall through. */
|
||||
default:
|
||||
yyr.append(yystr.charAt(i));
|
||||
break;
|
||||
|
||||
case '"':
|
||||
return yyr.toString();
|
||||
}
|
||||
}
|
||||
return yystr;
|
||||
}
|
||||
|
||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
||||
|
||||
/* The user-facing name of this symbol. */
|
||||
public final String getName() {
|
||||
return yytnamerr_(yytname_[yycode_]);
|
||||
}
|
||||
]],
|
||||
[custom\|detailed],
|
||||
[[ /* YYNAMES_[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */
|
||||
]b4_typed_parser_table_define([String], [names], [b4_symbol_names])[
|
||||
|
||||
/* The user-facing name of this symbol. */
|
||||
public final String getName() {
|
||||
return yynames_[yycode_];
|
||||
}]])[
|
||||
};
|
||||
]])])
|
||||
|
||||
|
||||
|
||||
# b4_case(ID, CODE, [COMMENTS])
|
||||
# -----------------------------
|
||||
# We need to fool Java's stupid unreachable code detection.
|
||||
m4_define([b4_case],
|
||||
[ case $1:m4_ifval([$3], [ b4_comment([$3])])
|
||||
if (yyn == $1)
|
||||
$2;
|
||||
break;
|
||||
])
|
||||
|
||||
|
||||
# b4_predicate_case(LABEL, CONDITIONS)
|
||||
# ------------------------------------
|
||||
m4_define([b4_predicate_case],
|
||||
[ case $1:
|
||||
if (! ($2)) YYERROR;
|
||||
break;
|
||||
])
|
||||
|
||||
|
||||
## -------- ##
|
||||
## Checks. ##
|
||||
## -------- ##
|
||||
|
||||
b4_percent_define_check_kind([[api.value.type]], [code], [deprecated])
|
||||
|
||||
b4_percent_define_check_kind([[annotations]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[extends]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[implements]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[init_throws]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[lex_throws]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[api.parser.class]], [code], [deprecated])
|
||||
b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Default values. ##
|
||||
## ---------------- ##
|
||||
|
||||
m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
|
||||
b4_percent_define_default([[api.value.type]], [[Object]])
|
||||
b4_percent_define_default([[api.symbol.prefix]], [[S_]])
|
||||
|
||||
# b4_api_prefix, b4_api_PREFIX
|
||||
# ----------------------------
|
||||
# Corresponds to %define api.prefix
|
||||
b4_percent_define_default([[api.prefix]], [[YY]])
|
||||
m4_define([b4_api_prefix],
|
||||
[b4_percent_define_get([[api.prefix]])])
|
||||
m4_define([b4_api_PREFIX],
|
||||
[m4_toupper(b4_api_prefix)])
|
||||
|
||||
# b4_prefix
|
||||
# ---------
|
||||
# If the %name-prefix is not given, it is api.prefix.
|
||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||
|
||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
|
||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
||||
|
||||
b4_percent_define_default([[throws]], [])
|
||||
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
||||
|
||||
b4_percent_define_default([[init_throws]], [])
|
||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
||||
|
||||
b4_percent_define_default([[api.location.type]], [Location])
|
||||
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
||||
|
||||
b4_percent_define_default([[api.position.type]], [Position])
|
||||
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Semantic Values. ##
|
||||
## ----------------- ##
|
||||
|
||||
|
||||
# b4_symbol_translate(STRING)
|
||||
# ---------------------------
|
||||
# Used by "bison" in the array of symbol names to mark those that
|
||||
# require translation.
|
||||
m4_define([b4_symbol_translate],
|
||||
[[i18n($1)]])
|
||||
|
||||
|
||||
# b4_trans(STRING)
|
||||
# ----------------
|
||||
# Translate a string if i18n is enabled. Avoid collision with b4_translate.
|
||||
m4_define([b4_trans],
|
||||
[b4_has_translations_if([i18n($1)], [$1])])
|
||||
|
||||
|
||||
|
||||
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
|
||||
# ----------------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[(($3)($1))],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[((b4_symbol([$2], [type]))($1))],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
# b4_lhs_value([SYMBOL-NUM], [TYPE])
|
||||
# ----------------------------------
|
||||
# See README.
|
||||
m4_define([b4_lhs_value], [yyval])
|
||||
|
||||
|
||||
# b4_rhs_data(RULE-LENGTH, POS)
|
||||
# -----------------------------
|
||||
# See README.
|
||||
m4_define([b4_rhs_data],
|
||||
[yystack.valueAt (b4_subtract($@))])
|
||||
|
||||
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
|
||||
# --------------------------------------------------
|
||||
# See README.
|
||||
#
|
||||
# In this simple implementation, %token and %type have class names
|
||||
# between the angle brackets.
|
||||
m4_define([b4_rhs_value],
|
||||
[b4_symbol_value([b4_rhs_data([$1], [$2])], [$3], [$4])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[(yyloc)])
|
||||
|
||||
|
||||
# b4_rhs_location(RULE-LENGTH, POS)
|
||||
# ---------------------------------
|
||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||
# on RHS.
|
||||
m4_define([b4_rhs_location],
|
||||
[yystack.locationAt (b4_subtract($@))])
|
||||
|
||||
|
||||
# b4_lex_param
|
||||
# b4_parse_param
|
||||
# --------------
|
||||
# If defined, b4_lex_param arrives double quoted, but below we prefer
|
||||
# it to be single quoted. Same for b4_parse_param.
|
||||
|
||||
# TODO: should be in bison.m4
|
||||
m4_define_default([b4_lex_param], [[]])
|
||||
m4_define([b4_lex_param], b4_lex_param)
|
||||
m4_define([b4_parse_param], b4_parse_param)
|
||||
|
||||
# b4_lex_param_decl
|
||||
# -----------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_lex_param_decl],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_lex_param))],
|
||||
[$1])])
|
||||
|
||||
m4_define([b4_param_decls],
|
||||
[m4_map([b4_param_decl], [$@])])
|
||||
m4_define([b4_param_decl], [, $1])
|
||||
|
||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_decl
|
||||
# -------------------
|
||||
# Extra formal arguments of the constructor.
|
||||
m4_define([b4_parse_param_decl],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_decls(b4_parse_param))],
|
||||
[$1])])
|
||||
|
||||
|
||||
|
||||
# b4_lex_param_call
|
||||
# -----------------
|
||||
# Delegating the lexer parameters to the lexer constructor.
|
||||
m4_define([b4_lex_param_call],
|
||||
[m4_ifset([b4_lex_param],
|
||||
[b4_remove_comma([$1],
|
||||
b4_param_calls(b4_lex_param))],
|
||||
[$1])])
|
||||
m4_define([b4_param_calls],
|
||||
[m4_map([b4_param_call], [$@])])
|
||||
m4_define([b4_param_call], [, $2])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_cons
|
||||
# -------------------
|
||||
# Extra initialisations of the constructor.
|
||||
m4_define([b4_parse_param_cons],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[b4_constructor_calls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_constructor_calls],
|
||||
[m4_map([b4_constructor_call], [$@])])
|
||||
m4_define([b4_constructor_call],
|
||||
[this.$2 = $2;
|
||||
])
|
||||
|
||||
|
||||
|
||||
# b4_parse_param_vars
|
||||
# -------------------
|
||||
# Extra instance variables.
|
||||
m4_define([b4_parse_param_vars],
|
||||
[m4_ifset([b4_parse_param],
|
||||
[
|
||||
/* User arguments. */
|
||||
b4_var_decls(b4_parse_param)])])
|
||||
|
||||
m4_define([b4_var_decls],
|
||||
[m4_map_sep([b4_var_decl], [
|
||||
], [$@])])
|
||||
m4_define([b4_var_decl],
|
||||
[ protected final $1;])
|
||||
|
||||
|
||||
|
||||
# b4_maybe_throws(THROWS)
|
||||
# -----------------------
|
||||
# Expand to either an empty string or "throws THROWS".
|
||||
m4_define([b4_maybe_throws],
|
||||
[m4_ifval($1, [ throws $1])])
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,380 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
m4_pushdef([b4_copyright_years],
|
||||
[2002-2015, 2018-2021])
|
||||
|
||||
|
||||
# b4_location_file
|
||||
# ----------------
|
||||
# Name of the file containing the position/location class,
|
||||
# if we want this file.
|
||||
b4_percent_define_check_file([b4_location_file],
|
||||
[[api.location.file]],
|
||||
b4_header_if([[location.hh]]))
|
||||
|
||||
# b4_location_include
|
||||
# -------------------
|
||||
# If location.hh is to be generated, the name under which should it be
|
||||
# included.
|
||||
#
|
||||
# b4_location_path
|
||||
# ----------------
|
||||
# The path to use for the CPP guard.
|
||||
m4_ifdef([b4_location_file],
|
||||
[m4_define([b4_location_include],
|
||||
[b4_percent_define_get([[api.location.include]],
|
||||
["b4_location_file"])])
|
||||
m4_define([b4_location_path],
|
||||
b4_percent_define_get([[api.location.include]],
|
||||
["b4_mapped_dir_prefix[]b4_location_file"]))
|
||||
m4_define([b4_location_path],
|
||||
m4_substr(m4_defn([b4_location_path]), 1, m4_eval(m4_len(m4_defn([b4_location_path])) - 2)))
|
||||
])
|
||||
|
||||
|
||||
# b4_position_file
|
||||
# ----------------
|
||||
# Name of the file containing the position class, if we want this file.
|
||||
b4_header_if(
|
||||
[b4_required_version_if(
|
||||
[30200], [],
|
||||
[m4_ifdef([b4_location_file],
|
||||
[m4_define([b4_position_file], [position.hh])])])])
|
||||
|
||||
|
||||
|
||||
# b4_location_define
|
||||
# ------------------
|
||||
# Define the position and location classes.
|
||||
m4_define([b4_location_define],
|
||||
[[ /// A point in a source file.
|
||||
class position
|
||||
{
|
||||
public:
|
||||
/// Type for file name.
|
||||
typedef ]b4_percent_define_get([[api.filename.type]])[ filename_type;
|
||||
/// Type for line and column numbers.
|
||||
typedef int counter_type;
|
||||
]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (filename_type* f = YY_NULLPTR,
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
: filename (f)
|
||||
, line (l)
|
||||
, column (c)
|
||||
{}
|
||||
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (filename_type* fn = YY_NULLPTR,
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
{
|
||||
filename = fn;
|
||||
line = l;
|
||||
column = c;
|
||||
}
|
||||
|
||||
/** \name Line and Column related manipulators
|
||||
** \{ */
|
||||
/// (line related) Advance to the COUNT next lines.
|
||||
void lines (counter_type count = 1)
|
||||
{
|
||||
if (count)
|
||||
{
|
||||
column = ]b4_location_initial_column[;
|
||||
line = add_ (line, count, ]b4_location_initial_line[);
|
||||
}
|
||||
}
|
||||
|
||||
/// (column related) Advance to the COUNT next columns.
|
||||
void columns (counter_type count = 1)
|
||||
{
|
||||
column = add_ (column, count, ]b4_location_initial_column[);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
/// File name to which this position refers.
|
||||
filename_type* filename;
|
||||
/// Current line number.
|
||||
counter_type line;
|
||||
/// Current column number.
|
||||
counter_type column;
|
||||
|
||||
private:
|
||||
/// Compute max (min, lhs+rhs).
|
||||
static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min)
|
||||
{
|
||||
return lhs + rhs < min ? min : lhs + rhs;
|
||||
}
|
||||
};
|
||||
|
||||
/// Add \a width columns, in place.
|
||||
inline position&
|
||||
operator+= (position& res, position::counter_type width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add \a width columns.
|
||||
inline position
|
||||
operator+ (position res, position::counter_type width)
|
||||
{
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns, in place.
|
||||
inline position&
|
||||
operator-= (position& res, position::counter_type width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns.
|
||||
inline position
|
||||
operator- (position res, position::counter_type width)
|
||||
{
|
||||
return res -= width;
|
||||
}
|
||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||
/// Compare two position objects.
|
||||
inline bool
|
||||
operator== (const position& pos1, const position& pos2)
|
||||
{
|
||||
return (pos1.line == pos2.line
|
||||
&& pos1.column == pos2.column
|
||||
&& (pos1.filename == pos2.filename
|
||||
|| (pos1.filename && pos2.filename
|
||||
&& *pos1.filename == *pos2.filename)));
|
||||
}
|
||||
|
||||
/// Compare two position objects.
|
||||
inline bool
|
||||
operator!= (const position& pos1, const position& pos2)
|
||||
{
|
||||
return !(pos1 == pos2);
|
||||
}
|
||||
]])[
|
||||
/** \brief Intercept output stream redirection.
|
||||
** \param ostr the destination output stream
|
||||
** \param pos a reference to the position to redirect
|
||||
*/
|
||||
template <typename YYChar>
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||
{
|
||||
if (pos.filename)
|
||||
ostr << *pos.filename << ':';
|
||||
return ostr << pos.line << '.' << pos.column;
|
||||
}
|
||||
|
||||
/// Two points in a source file.
|
||||
class location
|
||||
{
|
||||
public:
|
||||
/// Type for file name.
|
||||
typedef position::filename_type filename_type;
|
||||
/// Type for line and column numbers.
|
||||
typedef position::counter_type counter_type;
|
||||
]m4_ifdef([b4_location_constructors], [
|
||||
/// Construct a location from \a b to \a e.
|
||||
location (const position& b, const position& e)
|
||||
: begin (b)
|
||||
, end (e)
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a p.
|
||||
explicit location (const position& p = position ())
|
||||
: begin (p)
|
||||
, end (p)
|
||||
{}
|
||||
|
||||
/// Construct a 0-width location in \a f, \a l, \a c.
|
||||
explicit location (filename_type* f,
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
: begin (f, l, c)
|
||||
, end (f, l, c)
|
||||
{}
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (filename_type* f = YY_NULLPTR,
|
||||
counter_type l = ]b4_location_initial_line[,
|
||||
counter_type c = ]b4_location_initial_column[)
|
||||
{
|
||||
begin.initialize (f, l, c);
|
||||
end = begin;
|
||||
}
|
||||
|
||||
/** \name Line and Column related manipulators
|
||||
** \{ */
|
||||
public:
|
||||
/// Reset initial location to final location.
|
||||
void step ()
|
||||
{
|
||||
begin = end;
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next columns.
|
||||
void columns (counter_type count = 1)
|
||||
{
|
||||
end += count;
|
||||
}
|
||||
|
||||
/// Extend the current location to the COUNT next lines.
|
||||
void lines (counter_type count = 1)
|
||||
{
|
||||
end.lines (count);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
|
||||
public:
|
||||
/// Beginning of the located region.
|
||||
position begin;
|
||||
/// End of the located region.
|
||||
position end;
|
||||
};
|
||||
|
||||
/// Join two locations, in place.
|
||||
inline location&
|
||||
operator+= (location& res, const location& end)
|
||||
{
|
||||
res.end = end.end;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Join two locations.
|
||||
inline location
|
||||
operator+ (location res, const location& end)
|
||||
{
|
||||
return res += end;
|
||||
}
|
||||
|
||||
/// Add \a width columns to the end position, in place.
|
||||
inline location&
|
||||
operator+= (location& res, location::counter_type width)
|
||||
{
|
||||
res.columns (width);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Add \a width columns to the end position.
|
||||
inline location
|
||||
operator+ (location res, location::counter_type width)
|
||||
{
|
||||
return res += width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns to the end position, in place.
|
||||
inline location&
|
||||
operator-= (location& res, location::counter_type width)
|
||||
{
|
||||
return res += -width;
|
||||
}
|
||||
|
||||
/// Subtract \a width columns to the end position.
|
||||
inline location
|
||||
operator- (location res, location::counter_type width)
|
||||
{
|
||||
return res -= width;
|
||||
}
|
||||
]b4_percent_define_flag_if([[define_location_comparison]], [[
|
||||
/// Compare two location objects.
|
||||
inline bool
|
||||
operator== (const location& loc1, const location& loc2)
|
||||
{
|
||||
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
||||
}
|
||||
|
||||
/// Compare two location objects.
|
||||
inline bool
|
||||
operator!= (const location& loc1, const location& loc2)
|
||||
{
|
||||
return !(loc1 == loc2);
|
||||
}
|
||||
]])[
|
||||
/** \brief Intercept output stream redirection.
|
||||
** \param ostr the destination output stream
|
||||
** \param loc a reference to the location to redirect
|
||||
**
|
||||
** Avoid duplicate information.
|
||||
*/
|
||||
template <typename YYChar>
|
||||
std::basic_ostream<YYChar>&
|
||||
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||
{
|
||||
location::counter_type end_col
|
||||
= 0 < loc.end.column ? loc.end.column - 1 : 0;
|
||||
ostr << loc.begin;
|
||||
if (loc.end.filename
|
||||
&& (!loc.begin.filename
|
||||
|| *loc.begin.filename != *loc.end.filename))
|
||||
ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
|
||||
else if (loc.begin.line < loc.end.line)
|
||||
ostr << '-' << loc.end.line << '.' << end_col;
|
||||
else if (loc.begin.column < end_col)
|
||||
ostr << '-' << end_col;
|
||||
return ostr;
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
m4_ifdef([b4_position_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_position_file])[
|
||||
]b4_generated_by[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined in "]b4_location_file[".
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add '%require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system
|
||||
// 3. if you used to include it, include "]b4_location_file[" instead.
|
||||
|
||||
#include ]b4_location_include[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_ifdef([b4_location_file], [[
|
||||
]b4_output_begin([b4_dir_prefix], [b4_location_file])[
|
||||
]b4_copyright([Locations for Bison parsers in C++])[
|
||||
/**
|
||||
** \file ]b4_location_path[
|
||||
** Define the ]b4_namespace_ref[::location class.
|
||||
*/
|
||||
|
||||
]b4_cpp_guard_open([b4_location_path])[
|
||||
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
|
||||
]b4_null_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
]b4_location_define[
|
||||
]b4_namespace_close[
|
||||
]b4_cpp_guard_close([b4_location_path])[
|
||||
]b4_output_end[
|
||||
]])
|
||||
|
||||
|
||||
m4_popdef([b4_copyright_years])
|
||||
@@ -0,0 +1,157 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# b4_stack_file
|
||||
# -------------
|
||||
# Name of the file containing the stack class, if we want this file.
|
||||
b4_header_if([b4_required_version_if([30200], [],
|
||||
[m4_define([b4_stack_file], [stack.hh])])])
|
||||
|
||||
|
||||
# b4_stack_define
|
||||
# ---------------
|
||||
m4_define([b4_stack_define],
|
||||
[[ /// A stack with random access from its top.
|
||||
template <typename T, typename S = std::vector<T> >
|
||||
class stack
|
||||
{
|
||||
public:
|
||||
// Hide our reversed order.
|
||||
typedef typename S::iterator iterator;
|
||||
typedef typename S::const_iterator const_iterator;
|
||||
typedef typename S::size_type size_type;
|
||||
typedef typename std::ptrdiff_t index_type;
|
||||
|
||||
stack (size_type n = 200) YY_NOEXCEPT
|
||||
: seq_ (n)
|
||||
{}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
stack (const stack&) = delete;
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&) = delete;
|
||||
#endif
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
const T&
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Random access.
|
||||
///
|
||||
/// Index 0 returns the topmost element.
|
||||
T&
|
||||
operator[] (index_type i)
|
||||
{
|
||||
return seq_[size_type (size () - 1 - i)];
|
||||
}
|
||||
|
||||
/// Steal the contents of \a t.
|
||||
///
|
||||
/// Close to move-semantics.
|
||||
void
|
||||
push (YY_MOVE_REF (T) t)
|
||||
{
|
||||
seq_.push_back (T ());
|
||||
operator[] (0).move (t);
|
||||
}
|
||||
|
||||
/// Pop elements from the stack.
|
||||
void
|
||||
pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
seq_.pop_back ();
|
||||
}
|
||||
|
||||
/// Pop all elements from the stack.
|
||||
void
|
||||
clear () YY_NOEXCEPT
|
||||
{
|
||||
seq_.clear ();
|
||||
}
|
||||
|
||||
/// Number of elements on the stack.
|
||||
index_type
|
||||
size () const YY_NOEXCEPT
|
||||
{
|
||||
return index_type (seq_.size ());
|
||||
}
|
||||
|
||||
/// Iterator on top of the stack (going downwards).
|
||||
const_iterator
|
||||
begin () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.begin ();
|
||||
}
|
||||
|
||||
/// Bottom of the stack.
|
||||
const_iterator
|
||||
end () const YY_NOEXCEPT
|
||||
{
|
||||
return seq_.end ();
|
||||
}
|
||||
|
||||
/// Present a slice of the top of a stack.
|
||||
class slice
|
||||
{
|
||||
public:
|
||||
slice (const stack& stack, index_type range) YY_NOEXCEPT
|
||||
: stack_ (stack)
|
||||
, range_ (range)
|
||||
{}
|
||||
|
||||
const T&
|
||||
operator[] (index_type i) const
|
||||
{
|
||||
return stack_[range_ - i];
|
||||
}
|
||||
|
||||
private:
|
||||
const stack& stack_;
|
||||
index_type range_;
|
||||
};
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
stack (const stack&);
|
||||
/// Non copyable.
|
||||
stack& operator= (const stack&);
|
||||
#endif
|
||||
/// The wrapped container.
|
||||
S seq_;
|
||||
};
|
||||
]])
|
||||
|
||||
m4_ifdef([b4_stack_file],
|
||||
[b4_output_begin([b4_dir_prefix], [b4_stack_file])[
|
||||
]b4_generated_by[
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined with the parser itself.
|
||||
//
|
||||
// To get rid of this file:
|
||||
// 1. add '%require "3.2"' (or newer) to your grammar file
|
||||
// 2. remove references to this file from your build system.
|
||||
]b4_output_end[
|
||||
]])
|
||||
@@ -0,0 +1,2 @@
|
||||
dnl GNU M4 treats -dV in a position-independent manner.
|
||||
m4_debugmode(V)m4_traceon()dnl
|
||||
@@ -0,0 +1,525 @@
|
||||
# C++ skeleton for Bison
|
||||
|
||||
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
## --------- ##
|
||||
## variant. ##
|
||||
## --------- ##
|
||||
|
||||
# b4_assert
|
||||
# ---------
|
||||
# The name of YY_ASSERT.
|
||||
m4_define([b4_assert],
|
||||
[b4_api_PREFIX[]_ASSERT])
|
||||
|
||||
|
||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
||||
# ------------------------------------------------
|
||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
||||
# YYTYPE.
|
||||
m4_define([b4_symbol_variant],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[$2.$3< $][3 > (m4_shift3($@))])dnl
|
||||
switch ($1)
|
||||
{
|
||||
b4_type_foreach([_b4_type_action])[]dnl
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m4_popdef([b4_dollar_dollar])dnl
|
||||
])
|
||||
|
||||
|
||||
# _b4_char_sizeof_counter
|
||||
# -----------------------
|
||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
||||
m4_define([_b4_char_sizeof_counter],
|
||||
[0])
|
||||
|
||||
# _b4_char_sizeof_dummy
|
||||
# ---------------------
|
||||
# At each call return a new C++ identifier.
|
||||
m4_define([_b4_char_sizeof_dummy],
|
||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
||||
dummy[]_b4_char_sizeof_counter])
|
||||
|
||||
|
||||
# b4_char_sizeof(SYMBOL-NUMS)
|
||||
# ---------------------------
|
||||
# To be mapped on the list of type names to produce:
|
||||
#
|
||||
# char dummy1[sizeof (type_name_1)];
|
||||
# char dummy2[sizeof (type_name_2)];
|
||||
#
|
||||
# for defined type names.
|
||||
m4_define([b4_char_sizeof],
|
||||
[b4_symbol_if([$1], [has_type],
|
||||
[
|
||||
m4_map([ b4_symbol_tag_comment], [$@])dnl
|
||||
char _b4_char_sizeof_dummy@{sizeof (b4_symbol([$1], [type]))@};
|
||||
])])
|
||||
|
||||
|
||||
# b4_variant_includes
|
||||
# -------------------
|
||||
# The needed includes for variants support.
|
||||
m4_define([b4_variant_includes],
|
||||
[b4_parse_assert_if([[#include <typeinfo>
|
||||
#ifndef ]b4_assert[
|
||||
# include <cassert>
|
||||
# define ]b4_assert[ assert
|
||||
#endif
|
||||
]])])
|
||||
|
||||
|
||||
|
||||
## -------------------------- ##
|
||||
## Adjustments for variants. ##
|
||||
## -------------------------- ##
|
||||
|
||||
|
||||
# b4_value_type_declare
|
||||
# ---------------------
|
||||
# Define value_type.
|
||||
m4_define([b4_value_type_declare],
|
||||
[[ /// A buffer to store and retrieve objects.
|
||||
///
|
||||
/// Sort of a variant, but does not keep track of the nature
|
||||
/// of the stored data, since that knowledge is available
|
||||
/// via the current parser state.
|
||||
class value_type
|
||||
{
|
||||
public:
|
||||
/// Type of *this.
|
||||
typedef value_type self_type;
|
||||
|
||||
/// Empty construction.
|
||||
value_type () YY_NOEXCEPT
|
||||
: yyraw_ ()]b4_parse_assert_if([
|
||||
, yytypeid_ (YY_NULLPTR)])[
|
||||
{}
|
||||
|
||||
/// Construct and fill.
|
||||
template <typename T>
|
||||
value_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||
: yytypeid_ (&typeid (T))])[
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (sizeof (T) <= size);]])[
|
||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||
}
|
||||
|
||||
#if 201103L <= YY_CPLUSPLUS
|
||||
/// Non copyable.
|
||||
value_type (const self_type&) = delete;
|
||||
/// Non copyable.
|
||||
self_type& operator= (const self_type&) = delete;
|
||||
#endif
|
||||
|
||||
/// Destruction, allowed only if empty.
|
||||
~value_type () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([
|
||||
]b4_assert[ (!yytypeid_);
|
||||
])[}
|
||||
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
template <typename T, typename... U>
|
||||
T&
|
||||
emplace (U&&... u)
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (!yytypeid_);
|
||||
]b4_assert[ (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);]])[
|
||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||
}
|
||||
# else
|
||||
/// Instantiate an empty \a T in here.
|
||||
template <typename T>
|
||||
T&
|
||||
emplace ()
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (!yytypeid_);
|
||||
]b4_assert[ (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);]])[
|
||||
return *new (yyas_<T> ()) T ();
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
template <typename T>
|
||||
T&
|
||||
emplace (const T& t)
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (!yytypeid_);
|
||||
]b4_assert[ (sizeof (T) <= size);
|
||||
yytypeid_ = & typeid (T);]])[
|
||||
return *new (yyas_<T> ()) T (t);
|
||||
}
|
||||
# endif
|
||||
|
||||
/// Instantiate an empty \a T in here.
|
||||
/// Obsolete, use emplace.
|
||||
template <typename T>
|
||||
T&
|
||||
build ()
|
||||
{
|
||||
return emplace<T> ();
|
||||
}
|
||||
|
||||
/// Instantiate a \a T in here from \a t.
|
||||
/// Obsolete, use emplace.
|
||||
template <typename T>
|
||||
T&
|
||||
build (const T& t)
|
||||
{
|
||||
return emplace<T> (t);
|
||||
}
|
||||
|
||||
/// Accessor to a built \a T.
|
||||
template <typename T>
|
||||
T&
|
||||
as () YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (yytypeid_);
|
||||
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||
]b4_assert[ (sizeof (T) <= size);]])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// Const accessor to a built \a T (for %printer).
|
||||
template <typename T>
|
||||
const T&
|
||||
as () const YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (yytypeid_);
|
||||
]b4_assert[ (*yytypeid_ == typeid (T));
|
||||
]b4_assert[ (sizeof (T) <= size);]])[
|
||||
return *yyas_<T> ();
|
||||
}
|
||||
|
||||
/// Swap the content with \a that, of same type.
|
||||
///
|
||||
/// Both variants must be built beforehand, because swapping the actual
|
||||
/// data requires reading it (with as()), and this is not possible on
|
||||
/// unconstructed variants: it would require some dynamic testing, which
|
||||
/// should not be the variant's responsibility.
|
||||
/// Swapping between built and (possibly) non-built is done with
|
||||
/// self_type::move ().
|
||||
template <typename T>
|
||||
void
|
||||
swap (self_type& that) YY_NOEXCEPT
|
||||
{]b4_parse_assert_if([[
|
||||
]b4_assert[ (yytypeid_);
|
||||
]b4_assert[ (*yytypeid_ == *that.yytypeid_);]])[
|
||||
std::swap (as<T> (), that.as<T> ());
|
||||
}
|
||||
|
||||
/// Move the content of \a that to this.
|
||||
///
|
||||
/// Destroys \a that.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type& that)
|
||||
{
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
emplace<T> (std::move (that.as<T> ()));
|
||||
# else
|
||||
emplace<T> ();
|
||||
swap<T> (that);
|
||||
# endif
|
||||
that.destroy<T> ();
|
||||
}
|
||||
|
||||
# if 201103L <= YY_CPLUSPLUS
|
||||
/// Move the content of \a that to this.
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type&& that)
|
||||
{
|
||||
emplace<T> (std::move (that.as<T> ()));
|
||||
that.destroy<T> ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Copy the content of \a that to this.
|
||||
template <typename T>
|
||||
void
|
||||
copy (const self_type& that)
|
||||
{
|
||||
emplace<T> (that.as<T> ());
|
||||
}
|
||||
|
||||
/// Destroy the stored \a T.
|
||||
template <typename T>
|
||||
void
|
||||
destroy ()
|
||||
{
|
||||
as<T> ().~T ();]b4_parse_assert_if([
|
||||
yytypeid_ = YY_NULLPTR;])[
|
||||
}
|
||||
|
||||
private:
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
/// Non copyable.
|
||||
value_type (const self_type&);
|
||||
/// Non copyable.
|
||||
self_type& operator= (const self_type&);
|
||||
#endif
|
||||
|
||||
/// Accessor to raw memory as \a T.
|
||||
template <typename T>
|
||||
T*
|
||||
yyas_ () YY_NOEXCEPT
|
||||
{
|
||||
void *yyp = yyraw_;
|
||||
return static_cast<T*> (yyp);
|
||||
}
|
||||
|
||||
/// Const accessor to raw memory as \a T.
|
||||
template <typename T>
|
||||
const T*
|
||||
yyas_ () const YY_NOEXCEPT
|
||||
{
|
||||
const void *yyp = yyraw_;
|
||||
return static_cast<const T*> (yyp);
|
||||
}
|
||||
|
||||
/// An auxiliary type to compute the largest semantic type.
|
||||
union union_type
|
||||
{]b4_type_foreach([b4_char_sizeof])[ };
|
||||
|
||||
/// The size of the largest semantic type.
|
||||
enum { size = sizeof (union_type) };
|
||||
|
||||
/// A buffer to store semantic values.
|
||||
union
|
||||
{
|
||||
/// Strongest alignment constraints.
|
||||
long double yyalign_me_;
|
||||
/// A buffer large enough to store any of the semantic values.
|
||||
char yyraw_[size];
|
||||
};]b4_parse_assert_if([
|
||||
|
||||
/// Whether the content is built: if defined, the name of the stored type.
|
||||
const std::type_info *yytypeid_;])[
|
||||
};
|
||||
]])
|
||||
|
||||
|
||||
# How the semantic value is extracted when using variants.
|
||||
|
||||
# b4_symbol_value(VAL, SYMBOL-NUM, [TYPE])
|
||||
# ----------------------------------------
|
||||
# See README.
|
||||
m4_define([b4_symbol_value],
|
||||
[m4_ifval([$3],
|
||||
[$1.as< $3 > ()],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[$1.as < b4_symbol([$2], [type]) > ()],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
# b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
|
||||
# -------------------------------------------------
|
||||
# Same as b4_symbol_value, but used in a template method.
|
||||
m4_define([b4_symbol_value_template],
|
||||
[m4_ifval([$3],
|
||||
[$1.template as< $3 > ()],
|
||||
[m4_ifval([$2],
|
||||
[b4_symbol_if([$2], [has_type],
|
||||
[$1.template as < b4_symbol([$2], [type]) > ()],
|
||||
[$1])],
|
||||
[$1])])])
|
||||
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## make_SYMBOL. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# _b4_includes_tokens(SYMBOL-NUM...)
|
||||
# ----------------------------------
|
||||
# Expands to non-empty iff one of the SYMBOL-NUM denotes
|
||||
# a token.
|
||||
m4_define([_b4_is_token],
|
||||
[b4_symbol_if([$1], [is_token], [1])])
|
||||
m4_define([_b4_includes_tokens],
|
||||
[m4_map([_b4_is_token], [$@])])
|
||||
|
||||
|
||||
# _b4_token_maker_define(SYMBOL-NUM)
|
||||
# ----------------------------------
|
||||
# Declare make_SYMBOL for SYMBOL-NUM. Use at class-level.
|
||||
m4_define([_b4_token_maker_define],
|
||||
[b4_token_visible_if([$1],
|
||||
[#if 201103L <= YY_CPLUSPLUS
|
||||
static
|
||||
symbol_type
|
||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[b4_symbol([$1], [type]) v]),
|
||||
b4_locations_if([location_type l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||
b4_locations_if([std::move (l)])));
|
||||
}
|
||||
#else
|
||||
static
|
||||
symbol_type
|
||||
make_[]_b4_symbol([$1], [id]) (b4_join(
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l])))
|
||||
{
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l])));
|
||||
}
|
||||
#endif
|
||||
])])
|
||||
|
||||
|
||||
# b4_token_kind(SYMBOL-NUM)
|
||||
# -------------------------
|
||||
# Some tokens don't have an ID.
|
||||
m4_define([b4_token_kind],
|
||||
[b4_symbol_if([$1], [has_id],
|
||||
[token::b4_symbol([$1], [id])],
|
||||
[b4_symbol([$1], [code])])])
|
||||
|
||||
|
||||
# _b4_tok_in(SYMBOL-NUM, ...)
|
||||
# ---------------------------
|
||||
# See b4_tok_in below. The SYMBOL-NUMs... are tokens only.
|
||||
#
|
||||
# We iterate over the tokens to group them by "range" of token numbers (not
|
||||
# symbols numbers!).
|
||||
#
|
||||
# b4_fst is the start of that range.
|
||||
# b4_prev is the previous value.
|
||||
# b4_val is the current value.
|
||||
# If b4_val is the successor of b4_prev in token numbers, update the latter,
|
||||
# otherwise emit the code for range b4_fst .. b4_prev.
|
||||
# $1 is also used as a terminator in the foreach, but it will not be printed.
|
||||
#
|
||||
m4_define([_b4_tok_in],
|
||||
[m4_pushdef([b4_prev], [$1])dnl
|
||||
m4_pushdef([b4_fst], [$1])dnl
|
||||
m4_pushdef([b4_sep], [])dnl
|
||||
m4_foreach([b4_val], m4_dquote(m4_shift($@, $1)),
|
||||
[m4_if(b4_symbol(b4_val, [code]), m4_eval(b4_symbol(b4_prev, [code]) + 1), [],
|
||||
[b4_sep[]m4_if(b4_fst, b4_prev,
|
||||
[tok == b4_token_kind(b4_fst)],
|
||||
[(b4_token_kind(b4_fst) <= tok && tok <= b4_token_kind(b4_prev))])[]dnl
|
||||
m4_define([b4_fst], b4_val)dnl
|
||||
m4_define([b4_sep], [
|
||||
|| ])])dnl
|
||||
m4_define([b4_prev], b4_val)])dnl
|
||||
m4_popdef([b4_sep])dnl
|
||||
m4_popdef([b4_fst])dnl
|
||||
m4_popdef([b4_prev])dnl
|
||||
])
|
||||
|
||||
|
||||
# _b4_filter_tokens(SYMBOL-NUM, ...)
|
||||
# ----------------------------------
|
||||
# Expand as the list of tokens amongst SYMBOL-NUM.
|
||||
m4_define([_b4_filter_tokens],
|
||||
[m4_pushdef([b4_sep])dnl
|
||||
m4_foreach([b4_val], [$@],
|
||||
[b4_symbol_if(b4_val, [is_token], [b4_sep[]b4_val[]m4_define([b4_sep], [,])])])dnl
|
||||
m4_popdef([b4_sep])dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_tok_in(SYMBOL-NUM, ...)
|
||||
# ---------------------------
|
||||
# A C++ conditional that checks that `tok` is a member of this list of symbol
|
||||
# numbers.
|
||||
m4_define([b4_tok_in],
|
||||
[_$0(_b4_filter_tokens($@))])
|
||||
|
||||
|
||||
|
||||
|
||||
# _b4_symbol_constructor_define(SYMBOL-NUM...)
|
||||
# --------------------------------------------
|
||||
# Define a symbol_type constructor common to all the SYMBOL-NUM (they
|
||||
# have the same type). Use at class-level.
|
||||
m4_define([_b4_symbol_constructor_define],
|
||||
[m4_ifval(_b4_includes_tokens($@),
|
||||
[[#if 201103L <= YY_CPLUSPLUS
|
||||
symbol_type (]b4_join(
|
||||
[int tok],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[b4_symbol([$1], [type]) v]),
|
||||
b4_locations_if([location_type l]))[)
|
||||
: super_type (]b4_join([token_kind_type (tok)],
|
||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||
b4_locations_if([std::move (l)]))[)
|
||||
#else
|
||||
symbol_type (]b4_join(
|
||||
[int tok],
|
||||
b4_symbol_if([$1], [has_type],
|
||||
[const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: super_type (]b4_join([token_kind_type (tok)],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l]))[)
|
||||
#endif
|
||||
{]b4_parse_assert_if([[
|
||||
#if !defined _MSC_VER || defined __clang__
|
||||
]b4_assert[ (]b4_tok_in($@)[);
|
||||
#endif
|
||||
]])[}
|
||||
]])])
|
||||
|
||||
|
||||
# b4_basic_symbol_constructor_define(SYMBOL-NUM)
|
||||
# ----------------------------------------------
|
||||
# Generate a constructor for basic_symbol from given type.
|
||||
m4_define([b4_basic_symbol_constructor_define],
|
||||
[[#if 201103L <= YY_CPLUSPLUS
|
||||
basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_symbol_if([$1], [has_type], [b4_symbol([$1], [type])&& v]),
|
||||
b4_locations_if([location_type&& l]))[)
|
||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||
, value (std::move (v))])[]b4_locations_if([
|
||||
, location (std::move (l))])[
|
||||
{}
|
||||
#else
|
||||
basic_symbol (]b4_join(
|
||||
[typename Base::kind_type t],
|
||||
b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]),
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: Base (t)]b4_symbol_if([$1], [has_type], [
|
||||
, value (v)])[]b4_locations_if([
|
||||
, location (l)])[
|
||||
{}
|
||||
#endif
|
||||
]])
|
||||
|
||||
|
||||
# b4_token_constructor_define
|
||||
# ---------------------------
|
||||
# Define the overloaded versions of make_FOO for all the token kinds.
|
||||
m4_define([b4_token_constructor_define],
|
||||
[ // Implementation of make_symbol for each token kind.
|
||||
b4_symbol_foreach([_b4_token_maker_define])])
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
bison.xsl - common templates for Bison XSLT.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||
|
||||
<xsl:key
|
||||
name="bison:symbolByName"
|
||||
match="/bison-xml-report/grammar/nonterminals/nonterminal"
|
||||
use="@name"
|
||||
/>
|
||||
<xsl:key
|
||||
name="bison:symbolByName"
|
||||
match="/bison-xml-report/grammar/terminals/terminal"
|
||||
use="@name"
|
||||
/>
|
||||
<xsl:key
|
||||
name="bison:ruleByNumber"
|
||||
match="/bison-xml-report/grammar/rules/rule"
|
||||
use="@number"
|
||||
/>
|
||||
<xsl:key
|
||||
name="bison:ruleByLhs"
|
||||
match="/bison-xml-report/grammar/rules/rule[
|
||||
@usefulness != 'useless-in-grammar']"
|
||||
use="lhs"
|
||||
/>
|
||||
<xsl:key
|
||||
name="bison:ruleByRhs"
|
||||
match="/bison-xml-report/grammar/rules/rule[
|
||||
@usefulness != 'useless-in-grammar']"
|
||||
use="rhs/symbol"
|
||||
/>
|
||||
|
||||
<!-- For the specified state, output: #sr-conflicts,#rr-conflicts -->
|
||||
<xsl:template match="state" mode="bison:count-conflicts">
|
||||
<xsl:variable name="transitions" select="actions/transitions"/>
|
||||
<xsl:variable name="reductions" select="actions/reductions"/>
|
||||
<xsl:variable
|
||||
name="terminals"
|
||||
select="
|
||||
$transitions/transition[@type='shift']/@symbol
|
||||
| $reductions/reduction/@symbol
|
||||
"
|
||||
/>
|
||||
<xsl:variable name="conflict-data">
|
||||
<xsl:for-each select="$terminals">
|
||||
<xsl:variable name="name" select="."/>
|
||||
<xsl:if test="generate-id($terminals[. = $name][1]) = generate-id(.)">
|
||||
<xsl:variable
|
||||
name="shift-count"
|
||||
select="count($transitions/transition[@symbol=$name])"
|
||||
/>
|
||||
<xsl:variable
|
||||
name="reduce-count"
|
||||
select="count($reductions/reduction[@symbol=$name])"
|
||||
/>
|
||||
<xsl:if test="$shift-count > 0 and $reduce-count > 0">
|
||||
<xsl:text>s</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$reduce-count > 1">
|
||||
<xsl:text>r</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="string-length(translate($conflict-data, 'r', ''))"/>
|
||||
<xsl:text>,</xsl:text>
|
||||
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="space">
|
||||
<xsl:param name="repeat">0</xsl:param>
|
||||
<xsl:param name="fill" select="' '"/>
|
||||
<xsl:if test="number($repeat) >= 1">
|
||||
<xsl:call-template name="space">
|
||||
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
||||
<xsl:with-param name="fill" select="$fill"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$fill"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,401 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Written by Wojciech Polak <polak@gnu.org>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||
|
||||
<xsl:import href="bison.xsl"/>
|
||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="bison-xml-report"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bison-xml-report">
|
||||
<xsl:text>// Generated by GNU Bison </xsl:text>
|
||||
<xsl:value-of select="@version"/>
|
||||
<xsl:text>. </xsl:text>
|
||||
<xsl:text>// Report bugs to <</xsl:text>
|
||||
<xsl:value-of select="@bug-report"/>
|
||||
<xsl:text>>. </xsl:text>
|
||||
<xsl:text>// Home page: <</xsl:text>
|
||||
<xsl:value-of select="@url"/>
|
||||
<xsl:text>>. </xsl:text>
|
||||
<xsl:apply-templates select="automaton">
|
||||
<xsl:with-param name="filename" select="filename"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="automaton">
|
||||
<xsl:param name="filename"/>
|
||||
<xsl:text>digraph "</xsl:text>
|
||||
<xsl:call-template name="escape">
|
||||
<xsl:with-param name="subject" select="$filename"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>" {
|
||||
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||
edge [fontname = courier]
|
||||
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="state"/>
|
||||
<xsl:text>} </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="automaton/state">
|
||||
<xsl:call-template name="output-node">
|
||||
<xsl:with-param name="number" select="@number"/>
|
||||
<xsl:with-param name="label">
|
||||
<xsl:apply-templates select="itemset/item"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:apply-templates select="actions/transitions"/>
|
||||
<xsl:apply-templates select="actions/reductions">
|
||||
<xsl:with-param name="staten">
|
||||
<xsl:value-of select="@number"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="actions/reductions">
|
||||
<xsl:param name="staten"/>
|
||||
<xsl:for-each select='reduction'>
|
||||
<!-- These variables are needed because the current context can't be
|
||||
referred to directly in XPath expressions. -->
|
||||
<xsl:variable name="rul">
|
||||
<xsl:value-of select="@rule"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="ena">
|
||||
<xsl:value-of select="@enabled"/>
|
||||
</xsl:variable>
|
||||
<!-- The foreach's body is protected by this, so that we are actually
|
||||
going to iterate once per reduction rule, and not per lookahead. -->
|
||||
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
|
||||
<xsl:variable name="rule">
|
||||
<xsl:choose>
|
||||
<!-- The acceptation state is referred to as 'accept' in the XML, but
|
||||
just as '0' in the DOT. -->
|
||||
<xsl:when test="@rule='accept'">
|
||||
<xsl:text>0</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@rule"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- The edge's beginning -->
|
||||
<xsl:call-template name="reduction-edge-start">
|
||||
<xsl:with-param name="state" select="$staten"/>
|
||||
<xsl:with-param name="rule" select="$rule"/>
|
||||
<xsl:with-param name="enabled" select="@enabled"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- The edge's tokens -->
|
||||
<!-- Don't show labels for the default action. In other cases, there will
|
||||
always be at least one token, so 'label="[]"' will not occur. -->
|
||||
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
|
||||
<xsl:text>label="[</xsl:text>
|
||||
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
|
||||
<xsl:call-template name="escape">
|
||||
<xsl:with-param name="subject" select="@symbol"/>
|
||||
</xsl:call-template>
|
||||
<xsl:if test="position() != last ()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>]", </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- The edge's end -->
|
||||
<xsl:text>style=solid] </xsl:text>
|
||||
|
||||
<!-- The diamond representing the reduction -->
|
||||
<xsl:call-template name="reduction-node">
|
||||
<xsl:with-param name="state" select="$staten"/>
|
||||
<xsl:with-param name="rule" select="$rule"/>
|
||||
<xsl:with-param name="color">
|
||||
<xsl:choose>
|
||||
<xsl:when test='@enabled="true"'>
|
||||
<xsl:text>3</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>5</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="actions/transitions">
|
||||
<xsl:apply-templates select="transition"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<xsl:param name="prev-rule-number"
|
||||
select="preceding-sibling::item[1]/@rule-number"/>
|
||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||
<xsl:with-param name="dot" select="@dot"/>
|
||||
<xsl:with-param name="num" select="@rule-number"/>
|
||||
<xsl:with-param name="prev-lhs"
|
||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||
/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="lookaheads"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="rule">
|
||||
<xsl:param name="dot"/>
|
||||
<xsl:param name="num"/>
|
||||
<xsl:param name="prev-lhs"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$num < 10">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="$num < 100">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text></xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="$num"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$prev-lhs = lhs[text()]">
|
||||
<xsl:call-template name="lpad">
|
||||
<xsl:with-param name="str" select="'|'"/>
|
||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="lhs"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$dot = 0">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- RHS -->
|
||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="$dot = position()">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="symbol">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> %empty</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
<xsl:text> [</xsl:text>
|
||||
<xsl:apply-templates select="symbol"/>
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads/symbol">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="reduction-edge-start">
|
||||
<xsl:param name="state"/>
|
||||
<xsl:param name="rule"/>
|
||||
<xsl:param name="enabled"/>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$state"/>
|
||||
<xsl:text> -> "</xsl:text>
|
||||
<xsl:value-of select="$state"/>
|
||||
<xsl:text>R</xsl:text>
|
||||
<xsl:value-of select="$rule"/>
|
||||
<xsl:if test='$enabled = "false"'>
|
||||
<xsl:text>d</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>" [</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="reduction-node">
|
||||
<xsl:param name="state"/>
|
||||
<xsl:param name="rule"/>
|
||||
<xsl:param name="color"/>
|
||||
|
||||
<xsl:text> "</xsl:text>
|
||||
<xsl:value-of select="$state"/>
|
||||
<xsl:text>R</xsl:text>
|
||||
<xsl:value-of select="$rule"/>
|
||||
<xsl:if test="$color = 5">
|
||||
<xsl:text>d</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>" [label="</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$rule = 0">
|
||||
<xsl:text>Acc", fillcolor=1</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>R</xsl:text>
|
||||
<xsl:value-of select="$rule"/>
|
||||
<xsl:text>", fillcolor=</xsl:text>
|
||||
<xsl:value-of select="$color"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>, shape=diamond, style=filled] </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="transition">
|
||||
<xsl:call-template name="output-edge">
|
||||
<xsl:with-param name="src" select="../../../@number"/>
|
||||
<xsl:with-param name="dst" select="@state"/>
|
||||
<xsl:with-param name="style">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@symbol = 'error'">
|
||||
<xsl:text>dotted</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'shift'">
|
||||
<xsl:text>solid</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>dashed</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="label">
|
||||
<xsl:if test="not(@symbol = 'error')">
|
||||
<xsl:value-of select="@symbol"/>
|
||||
</xsl:if>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="output-node">
|
||||
<xsl:param name="number"/>
|
||||
<xsl:param name="label"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$number"/>
|
||||
<xsl:text> [label="</xsl:text>
|
||||
<xsl:text>State </xsl:text>
|
||||
<xsl:value-of select="$number"/>
|
||||
<xsl:text>\n</xsl:text>
|
||||
<xsl:call-template name="escape">
|
||||
<xsl:with-param name="subject" select="$label"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>\l"] </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="output-edge">
|
||||
<xsl:param name="src"/>
|
||||
<xsl:param name="dst"/>
|
||||
<xsl:param name="style"/>
|
||||
<xsl:param name="label"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$src"/>
|
||||
<xsl:text> -> </xsl:text>
|
||||
<xsl:value-of select="$dst"/>
|
||||
<xsl:text> [style=</xsl:text>
|
||||
<xsl:value-of select="$style"/>
|
||||
<xsl:if test="$label and $label != ''">
|
||||
<xsl:text> label="</xsl:text>
|
||||
<xsl:call-template name="escape">
|
||||
<xsl:with-param name="subject" select="$label"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>"</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>] </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="escape">
|
||||
<xsl:param name="subject"/> <!-- required -->
|
||||
<xsl:call-template name="string-replace">
|
||||
<xsl:with-param name="subject">
|
||||
<xsl:call-template name="string-replace">
|
||||
<xsl:with-param name="subject">
|
||||
<xsl:call-template name="string-replace">
|
||||
<xsl:with-param name="subject" select="$subject"/>
|
||||
<xsl:with-param name="search" select="'\'"/>
|
||||
<xsl:with-param name="replace" select="'\\'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="search" select="'"'"/>
|
||||
<xsl:with-param name="replace" select="'\"'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="search" select="' '"/>
|
||||
<xsl:with-param name="replace" select="'\l'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="string-replace">
|
||||
<xsl:param name="subject"/>
|
||||
<xsl:param name="search"/>
|
||||
<xsl:param name="replace"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($subject, $search)">
|
||||
<xsl:variable name="before" select="substring-before($subject, $search)"/>
|
||||
<xsl:variable name="after" select="substring-after($subject, $search)"/>
|
||||
<xsl:value-of select="$before"/>
|
||||
<xsl:value-of select="$replace"/>
|
||||
<xsl:call-template name="string-replace">
|
||||
<xsl:with-param name="subject" select="$after"/>
|
||||
<xsl:with-param name="search" select="$search"/>
|
||||
<xsl:with-param name="replace" select="$replace"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$subject"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="lpad">
|
||||
<xsl:param name="str" select="''"/>
|
||||
<xsl:param name="pad" select="0"/>
|
||||
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$diff < 0">
|
||||
<xsl:value-of select="$str"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="space">
|
||||
<xsl:with-param name="repeat" select="$diff"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$str"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
@@ -0,0 +1,572 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
xml2text.xsl - transform Bison XML Report into plain text.
|
||||
|
||||
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Written by Wojciech Polak <polak@gnu.org>.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:bison="https://www.gnu.org/software/bison/">
|
||||
|
||||
<xsl:import href="bison.xsl"/>
|
||||
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="bison-xml-report"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bison-xml-report">
|
||||
<xsl:apply-templates select="grammar" mode="reductions"/>
|
||||
<xsl:apply-templates select="grammar" mode="useless-in-parser"/>
|
||||
<xsl:apply-templates select="automaton" mode="conflicts"/>
|
||||
<xsl:apply-templates select="grammar"/>
|
||||
<xsl:apply-templates select="automaton"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="grammar" mode="reductions">
|
||||
<xsl:apply-templates select="nonterminals" mode="useless-in-grammar"/>
|
||||
<xsl:apply-templates select="terminals" mode="unused-in-grammar"/>
|
||||
<xsl:apply-templates select="rules" mode="useless-in-grammar"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="nonterminals" mode="useless-in-grammar">
|
||||
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
||||
<xsl:text>Nonterminals useless in grammar </xsl:text>
|
||||
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="terminals" mode="unused-in-grammar">
|
||||
<xsl:if test="terminal[@usefulness='unused-in-grammar']">
|
||||
<xsl:text>Terminals unused in grammar </xsl:text>
|
||||
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
||||
<xsl:sort select="@symbol-number" data-type="number"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="rules" mode="useless-in-grammar">
|
||||
<xsl:variable name="set" select="rule[@usefulness='useless-in-grammar']"/>
|
||||
<xsl:if test="$set">
|
||||
<xsl:text>Rules useless in grammar </xsl:text>
|
||||
<xsl:call-template name="style-rule-set">
|
||||
<xsl:with-param name="rule-set" select="$set"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="grammar" mode="useless-in-parser">
|
||||
<xsl:variable
|
||||
name="set" select="rules/rule[@usefulness='useless-in-parser']"
|
||||
/>
|
||||
<xsl:if test="$set">
|
||||
<xsl:text>Rules useless in parser due to conflicts </xsl:text>
|
||||
<xsl:call-template name="style-rule-set">
|
||||
<xsl:with-param name="rule-set" select="$set"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="grammar">
|
||||
<xsl:text>Grammar </xsl:text>
|
||||
<xsl:call-template name="style-rule-set">
|
||||
<xsl:with-param
|
||||
name="rule-set" select="rules/rule[@usefulness!='useless-in-grammar']"
|
||||
/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="terminals"/>
|
||||
<xsl:apply-templates select="nonterminals"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="style-rule-set">
|
||||
<xsl:param name="rule-set"/>
|
||||
<xsl:for-each select="$rule-set">
|
||||
<xsl:apply-templates select=".">
|
||||
<xsl:with-param name="pad" select="'3'"/>
|
||||
<xsl:with-param name="prev-lhs">
|
||||
<xsl:if test="position()>1">
|
||||
<xsl:variable name="position" select="position()"/>
|
||||
<xsl:value-of select="$rule-set[$position - 1]/lhs"/>
|
||||
</xsl:if>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="grammar/terminals">
|
||||
<xsl:text>Terminals, with rules where they appear </xsl:text>
|
||||
<xsl:apply-templates select="terminal"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="grammar/nonterminals">
|
||||
<xsl:text>Nonterminals, with rules where they appear </xsl:text>
|
||||
<xsl:apply-templates select="nonterminal[@usefulness!='useless-in-grammar']"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="terminal">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:call-template name="line-wrap">
|
||||
<xsl:with-param name="first-line-length">
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(@name) > 66">0</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="66 - string-length(@name)" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="line-length" select="66" />
|
||||
<xsl:with-param name="text">
|
||||
<xsl:if test="string-length(@type) != 0">
|
||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="concat(' (', @token-number, ')')"/>
|
||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||
<xsl:value-of select="concat(' ', @number)"/>
|
||||
</xsl:for-each>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="nonterminal">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="string-length(@type) != 0">
|
||||
<xsl:value-of select="concat(' <', @type, '>')"/>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="concat(' (', @symbol-number, ')')"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:variable name="output">
|
||||
<xsl:call-template name="line-wrap">
|
||||
<xsl:with-param name="line-length" select="66" />
|
||||
<xsl:with-param name="text">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||
<xsl:text>on@left:</xsl:text>
|
||||
<xsl:for-each select="key('bison:ruleByLhs', @name)">
|
||||
<xsl:value-of select="concat(' ', @number)"/>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
<xsl:if test="key('bison:ruleByRhs', @name)">
|
||||
<xsl:if test="key('bison:ruleByLhs', @name)">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>on@right:</xsl:text>
|
||||
<xsl:for-each select="key('bison:ruleByRhs', @name)">
|
||||
<xsl:value-of select="concat(' ', @number)"/>
|
||||
</xsl:for-each>
|
||||
</xsl:if>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="translate($output, '@', ' ')" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="automaton" mode="conflicts">
|
||||
<xsl:variable name="conflict-report">
|
||||
<xsl:apply-templates select="state" mode="conflicts"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="string-length($conflict-report) != 0">
|
||||
<xsl:value-of select="$conflict-report"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="state" mode="conflicts">
|
||||
<xsl:variable name="conflict-counts">
|
||||
<xsl:apply-templates select="." mode="bison:count-conflicts" />
|
||||
</xsl:variable>
|
||||
<xsl:variable
|
||||
name="sr-count" select="substring-before($conflict-counts, ',')"
|
||||
/>
|
||||
<xsl:variable
|
||||
name="rr-count" select="substring-after($conflict-counts, ',')"
|
||||
/>
|
||||
<xsl:if test="$sr-count > 0 or $rr-count > 0">
|
||||
<xsl:value-of select="concat('State ', @number, ' conflicts:')"/>
|
||||
<xsl:if test="$sr-count > 0">
|
||||
<xsl:value-of select="concat(' ', $sr-count, ' shift/reduce')"/>
|
||||
<xsl:if test="$rr-count > 0">
|
||||
<xsl:value-of select="(',')"/>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="$rr-count > 0">
|
||||
<xsl:value-of select="concat(' ', $rr-count, ' reduce/reduce')"/>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="' '"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="automaton">
|
||||
<xsl:apply-templates select="state">
|
||||
<xsl:with-param name="pad" select="'3'"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="automaton/state">
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:text>State </xsl:text>
|
||||
<xsl:value-of select="@number"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="itemset/item">
|
||||
<xsl:with-param name="pad" select="$pad"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="actions/transitions">
|
||||
<xsl:with-param name="type" select="'shift'"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="actions/errors"/>
|
||||
<xsl:apply-templates select="actions/reductions"/>
|
||||
<xsl:apply-templates select="actions/transitions">
|
||||
<xsl:with-param name="type" select="'goto'"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates select="solved-conflicts"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="actions/transitions">
|
||||
<xsl:param name="type"/>
|
||||
<xsl:if test="transition[@type = $type]">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="transition[@type = $type]">
|
||||
<xsl:with-param name="pad">
|
||||
<xsl:call-template name="max-width-symbol">
|
||||
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="actions/errors">
|
||||
<xsl:if test="error">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="error">
|
||||
<xsl:with-param name="pad">
|
||||
<xsl:call-template name="max-width-symbol">
|
||||
<xsl:with-param name="node" select="error"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="actions/reductions">
|
||||
<xsl:if test="reduction">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="reduction">
|
||||
<xsl:with-param name="pad">
|
||||
<xsl:call-template name="max-width-symbol">
|
||||
<xsl:with-param name="node" select="reduction"/>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:param name="prev-rule-number"
|
||||
select="preceding-sibling::item[1]/@rule-number"/>
|
||||
<xsl:apply-templates
|
||||
select="key('bison:ruleByNumber', current()/@rule-number)"
|
||||
>
|
||||
<xsl:with-param name="itemset" select="'true'"/>
|
||||
<xsl:with-param name="pad" select="$pad"/>
|
||||
<xsl:with-param
|
||||
name="prev-lhs"
|
||||
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||
/>
|
||||
<xsl:with-param name="dot" select="@dot"/>
|
||||
<xsl:with-param name="lookaheads">
|
||||
<xsl:apply-templates select="lookaheads"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="rule">
|
||||
<xsl:param name="itemset"/>
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:param name="prev-lhs"/>
|
||||
<xsl:param name="dot"/>
|
||||
<xsl:param name="lookaheads"/>
|
||||
|
||||
<xsl:if test="$itemset != 'true' and not($prev-lhs = lhs[text()])">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="lpad">
|
||||
<xsl:with-param name="str" select="string(@number)"/>
|
||||
<xsl:with-param name="pad" select="number($pad)"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
|
||||
<!-- LHS -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
||||
<xsl:call-template name="lpad">
|
||||
<xsl:with-param name="str" select="'|'"/>
|
||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
||||
<xsl:call-template name="lpad">
|
||||
<xsl:with-param name="str" select="'|'"/>
|
||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="lhs"/>
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<!-- RHS -->
|
||||
<xsl:for-each select="rhs/*">
|
||||
<xsl:if test="position() = $dot + 1">
|
||||
<xsl:text> •</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="position() = last() and position() = $dot">
|
||||
<xsl:text> •</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="$lookaheads">
|
||||
<xsl:value-of select="$lookaheads"/>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="symbol">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> %empty</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
<xsl:text> [</xsl:text>
|
||||
<xsl:apply-templates select="symbol"/>
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads/symbol">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="transition">
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="rpad">
|
||||
<xsl:with-param name="str" select="string(@symbol)"/>
|
||||
<xsl:with-param name="pad" select="number($pad) + 2"/>
|
||||
</xsl:call-template>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type = 'shift'">
|
||||
<xsl:text>shift, and go to state </xsl:text>
|
||||
<xsl:value-of select="@state"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'goto'">
|
||||
<xsl:text>go to state </xsl:text>
|
||||
<xsl:value-of select="@state"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="error">
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="rpad">
|
||||
<xsl:with-param name="str" select="string(@symbol)"/>
|
||||
<xsl:with-param name="pad" select="number($pad) + 2"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>error</xsl:text>
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="text()"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="reduction">
|
||||
<xsl:param name="pad"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="rpad">
|
||||
<xsl:with-param name="str" select="string(@symbol)"/>
|
||||
<xsl:with-param name="pad" select="number($pad) + 2"/>
|
||||
</xsl:call-template>
|
||||
<xsl:if test="@enabled = 'false'">
|
||||
<xsl:text>[</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@rule = 'accept'">
|
||||
<xsl:text>accept</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>reduce using rule </xsl:text>
|
||||
<xsl:value-of select="@rule"/>
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of
|
||||
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="@enabled = 'false'">
|
||||
<xsl:text>]</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solved-conflicts">
|
||||
<xsl:if test="resolution">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="resolution"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="resolution">
|
||||
<xsl:text> Conflict between rule </xsl:text>
|
||||
<xsl:value-of select="@rule"/>
|
||||
<xsl:text> and token </xsl:text>
|
||||
<xsl:value-of select="@symbol"/>
|
||||
<xsl:text> resolved as </xsl:text>
|
||||
<xsl:if test="@type = 'error'">
|
||||
<xsl:text>an </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="@type"/>
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>). </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="max-width-symbol">
|
||||
<xsl:param name="node"/>
|
||||
<xsl:variable name="longest">
|
||||
<xsl:for-each select="$node">
|
||||
<xsl:sort data-type="number" select="string-length(@symbol)"
|
||||
order="descending"/>
|
||||
<xsl:if test="position() = 1">
|
||||
<xsl:value-of select="string-length(@symbol)"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="$longest"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="lpad">
|
||||
<xsl:param name="str" select="''"/>
|
||||
<xsl:param name="pad" select="0"/>
|
||||
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$diff < 0">
|
||||
<xsl:value-of select="$str"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="space">
|
||||
<xsl:with-param name="repeat" select="$diff"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$str"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="rpad">
|
||||
<xsl:param name="str" select="''"/>
|
||||
<xsl:param name="pad" select="0"/>
|
||||
<xsl:variable name="diff" select="$pad - string-length($str)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$diff < 0">
|
||||
<xsl:value-of select="$str"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$str"/>
|
||||
<xsl:call-template name="space">
|
||||
<xsl:with-param name="repeat" select="$diff"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="line-wrap">
|
||||
<xsl:param name="line-length"/> <!-- required -->
|
||||
<xsl:param name="first-line-length" select="$line-length"/>
|
||||
<xsl:param name="text"/> <!-- required -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="normalize-space($text) = ''" />
|
||||
<xsl:when test="string-length($text) <= $first-line-length">
|
||||
<xsl:value-of select="concat($text, ' ')" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="break-pos">
|
||||
<xsl:call-template name="ws-search">
|
||||
<xsl:with-param name="text" select="$text" />
|
||||
<xsl:with-param name="start" select="$first-line-length+1" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="substring($text, 1, $break-pos - 1)" />
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="line-wrap">
|
||||
<xsl:with-param name="line-length" select="$line-length" />
|
||||
<xsl:with-param
|
||||
name="text" select="concat(' ', substring($text, $break-pos+1))"
|
||||
/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="ws-search">
|
||||
<xsl:param name="text"/> <!-- required -->
|
||||
<xsl:param name="start"/> <!-- required -->
|
||||
<xsl:variable name="search-text" select="substring($text, $start)" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(contains($search-text, ' '))">
|
||||
<xsl:value-of select="string-length($text)+1" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of
|
||||
select="$start + string-length(substring-before($search-text, ' '))"
|
||||
/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user