summaryrefslogtreecommitdiff
path: root/codegen.php
diff options
context:
space:
mode:
authorJonas Kohl <gitlab@jonaskohl.de>2024-07-23 16:34:35 +0200
committerJonas Kohl <gitlab@jonaskohl.de>2024-07-23 16:34:35 +0200
commit252e4cfa9c2236e50f38adc4611396a5665f8301 (patch)
tree17a3359490f99ecbce2548d775a782fba6c40417 /codegen.php
parente163c5950aa74278401679190fb7d755f730fa04 (diff)
Add codegen & emoticons
Diffstat (limited to 'codegen.php')
-rw-r--r--codegen.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/codegen.php b/codegen.php
new file mode 100644
index 0000000..a842b32
--- /dev/null
+++ b/codegen.php
@@ -0,0 +1,23 @@
+<?php
+
+require_once __DIR__ . "/common.php";
+$cg_dir = SRCDIR . "/codegen";
+foreach (scandir($cg_dir) as $cg_ent) {
+ $cg_path = $cg_dir . "/" . $cg_ent;
+ if (
+ $cg_ent[0] === "." ||
+ !is_file($cg_path) ||
+ strtolower(pathinfo($cg_ent, PATHINFO_EXTENSION)) !== "php"
+ ) continue;
+ echo "[codegen] $cg_ent ";
+ $data = include $cg_path;
+ if (!is_array($data) || count($data) !== 2) {
+ trigger_error(
+ "Invalid data returned from codegen script '$cg_ent'",
+ E_USER_WARNING,
+ );
+ continue;
+ }
+ echo "-> $data[0]\n";
+ file_put_contents(__DIR__ . "/build/" . $data[0], $data[1]);
+}