MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at type-hints-typescript 139 lines 4.4 kB view raw
1#!/bin/bash 2set -e 3. "$(dirname "$0")/common.sh" 4 5OUTPUT="$1" 6ANT_VERSION="$2" 7ANT_BUILD_TIMESTAMP="$3" 8ANT_GIT_HASH="$4" 9ANT_TARGET_TRIPLE="$5" 10INCLUDE_DIR="$ROOT_DIR/include" 11 12if [ -z "$OUTPUT" ] || [ -z "$ANT_VERSION" ]; then 13 echo "Usage: $0 <output.h> <version> <timestamp> <git_hash> <target_triple>" 14 exit 1 15fi 16 17VENDOR_DIR="$SCRIPT_DIR/vendor" 18 19HEADERS=( 20 "debug.h:$INCLUDE_DIR/debug.h" 21 "common.h:$INCLUDE_DIR/common.h" 22 "types.h:$INCLUDE_DIR/types.h" 23 "uthash.h:$VENDOR_DIR/uthash-2.3.0/src/uthash.h" 24 "errors.h:$INCLUDE_DIR/errors.h" 25 "ant.h:$INCLUDE_DIR/ant.h" 26 "internal.h:$INCLUDE_DIR/internal.h" 27 "silver/vm.h:$INCLUDE_DIR/silver/vm.h" 28 "silver/engine.h:$INCLUDE_DIR/silver/engine.h" 29 "minicoro.h:$VENDOR_DIR/minicoro/minicoro.h" 30 "sugar.h:$INCLUDE_DIR/sugar.h" 31 "reactor.h:$INCLUDE_DIR/reactor.h" 32 "tokens.h:$INCLUDE_DIR/tokens.h" 33 "stack.h:$INCLUDE_DIR/stack.h" 34 "compat.h:$INCLUDE_DIR/compat.h" 35 "utils.h:$INCLUDE_DIR/utils.h" 36 "runtime.h:$INCLUDE_DIR/runtime.h" 37 "esm/remote.h:$INCLUDE_DIR/esm/remote.h" 38) 39 40for f in "$INCLUDE_DIR"/modules/*.h; do 41 name="modules/$(basename "$f")" 42 HEADERS+=("$name:$f") 43done 44 45cat > "$OUTPUT" << EOF 46/* 47 * Ant JavaScript Engine 48 * https://github.com/themackabu/ant 49 * 50 * The MIT License (MIT) 51 * 52 * Copyright (c) 2026 theMackabu (me@themackabu.dev) 53 * 54 * Permission is hereby granted, free of charge, to any person obtaining a copy 55 * of this software and associated documentation files (the "Software"), to deal 56 * in the Software without restriction, including without limitation the rights 57 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 58 * copies of the Software, and to permit persons to whom the Software is 59 * furnished to do so, subject to the following conditions: 60 * 61 * The above copyright notice and this permission notice shall be included in all 62 * copies or substantial portions of the Software. 63 * 64 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 65 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 66 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 67 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 68 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 69 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 70 * SOFTWARE. 71 * 72 * --- 73 * 74 * This is an auto-generated amalgamated header containing all public APIs. 75 * Link with libant.a and required system libraries: 76 * macOS: -framework Security -framework CoreFoundation -lpthread 77 * Linux: -lpthread -ldl -lm 78 * Windows: -lws2_32 -lrpcrt4 -lsecur32 -lntdll -lcrypt32 -luserenv 79 */ 80#ifndef LIBANT_H 81#define LIBANT_H 82 83/* forward declarations */ 84struct arg_file; 85 86/* === metadata === */ 87#define ANT_VERSION "$ANT_VERSION" 88#define ANT_BUILD_TIMESTAMP $ANT_BUILD_TIMESTAMP 89#define ANT_GIT_HASH "$ANT_GIT_HASH" 90#define ANT_TARGET_TRIPLE "$ANT_TARGET_TRIPLE" 91 92EOF 93 94for entry in "${HEADERS[@]}"; do 95 name="${entry%%:*}" 96 path="${entry##*:}" 97 98 if [ ! -f "$path" ]; then 99 echo "Warning: $path not found, skipping" >&2 100 continue 101 fi 102 103 echo "/* === $name === */" >> "$OUTPUT" 104 105 while IFS= read -r line || [ -n "$line" ]; do 106 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*pragma[[:space:]]+once ]]; then 107 continue 108 fi 109 110 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"silver/opcode\.h\" ]]; then 111 cat "$INCLUDE_DIR/silver/opcode.h" >> "$OUTPUT" 112 continue 113 fi 114 115 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"(metadata\.h|errors\.h|common\.h|gc.\h|types\.h|compat\.h|ant\.h|utils\.h|arena\.h|runtime\.h|internal\.h)\" ]]; then 116 continue 117 fi 118 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"esm/ ]]; then 119 continue 120 fi 121 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"modules/ ]]; then 122 continue 123 fi 124 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"silver/ ]]; then 125 continue 126 fi 127 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\<(metadata|common|uv|types|uthash|minicoro)\.h\> ]]; then 128 continue 129 fi 130 131 echo "$line" >> "$OUTPUT" 132 done < "$path" 133 134 echo "" >> "$OUTPUT" 135done 136 137echo "#endif /* LIBANT_H */" >> "$OUTPUT" 138 139echo "Generated $OUTPUT"