1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 14:27:35 +00:00

Ports: Add cfunge

This adds the `cfunge` Befunge interpreter. An interpreter for the
esoteric programming language Befunge written in C.
This commit is contained in:
Tobias Christiansen 2022-03-24 15:41:48 +01:00 committed by Andreas Kling
parent 7ab62ecd16
commit acdb0860b1
7 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Patches for cfunge on SerenityOS
## `arc4random_buf.patch`
Somewhere on the way of configuring the variable `HAVE_arc4random_buf` was set which lead to the linker complaining about not knowing a certain `arc4random_stir()` function.
This patch just negates the define and the linker is happy.
## `define-max.patch`
It is expected that `sys/param.h` defines a `MAX` macro. We don't. So here the needed macro is just inserted instead of the include.
## `posix-mapped-files.patch`
It is expected that `_POSIX_MAPPED_FILES` is defined as at least `1`, so we do that here.
## `posix-regexp.patch`
Same as before, just for `_POSIX_REGEXP`

View file

@ -0,0 +1,10 @@
--- ../src/prng.c
+++ ../src/prng.c
@@ -29,6 +29,7 @@
# undef HAVE_arc4random_buf
#endif
+#undef HAVE_arc4random_buf
#ifdef HAVE_arc4random_buf
# define HAVE_ARC4RANDOM
# ifndef ARC4RANDOM_IN_BSD

View file

@ -0,0 +1,11 @@
--- ../lib/fungestring/funge_str-two-way.h
+++ ../lib/fungestring/funge_str-two-way.h
@@ -53,7 +53,7 @@
#include <limits.h>
#include <stdint.h>
-#include <sys/param.h> /* Defines MAX. */
+#define MAX(a,b) (((a)>(b))?(a):(b))
/* We use the Two-Way string matching algorithm, which guarantees
linear complexity with constant space. Additionally, for long

View file

@ -0,0 +1,10 @@
--- ../src/funge-space/funge-space.c
+++ ../src/funge-space/funge-space.c
@@ -47,6 +47,7 @@
#include <sys/stat.h> /* fstat, open */
#include <fcntl.h> /* open, posix_fallocate */
+#define _POSIX_MAPPED_FILES 1
#if !defined(_POSIX_MAPPED_FILES) || (_POSIX_MAPPED_FILES < 1)
# error "cfunge needs a working mmap(), which this system claims it lacks."
#endif

View file

@ -0,0 +1,10 @@
--- ../src/fingerprints/REXP/REXP.c
+++ ../src/fingerprints/REXP/REXP.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <string.h>
+#define _POSIX_REGEXP 1
#if !defined(_POSIX_REGEXP) || (_POSIX_REGEXP < 1)
# error "cfunge needs POSIX regular expressions, which this system claims it doesn't have."
#endif