{"id":13782967,"url":"https://github.com/VorpalBlade/cfunge","last_synced_at":"2025-05-11T17:30:34.397Z","repository":{"id":44773154,"uuid":"85464921","full_name":"VorpalBlade/cfunge","owner":"VorpalBlade","description":"A fast Befunge93/98 interpreter in C","archived":false,"fork":false,"pushed_at":"2023-04-24T19:33:37.000Z","size":6253,"stargazers_count":19,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T18:55:42.825Z","etag":null,"topics":["befunge","interpreter"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VorpalBlade.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-03-19T09:37:26.000Z","updated_at":"2025-03-27T16:28:51.000Z","dependencies_parsed_at":"2024-04-24T13:44:40.599Z","dependency_job_id":null,"html_url":"https://github.com/VorpalBlade/cfunge","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VorpalBlade%2Fcfunge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VorpalBlade%2Fcfunge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VorpalBlade%2Fcfunge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VorpalBlade%2Fcfunge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VorpalBlade","download_url":"https://codeload.github.com/VorpalBlade/cfunge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604379,"owners_count":21934851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["befunge","interpreter"],"created_at":"2024-08-03T18:01:49.611Z","updated_at":"2025-05-11T17:30:34.019Z","avatar_url":"https://github.com/VorpalBlade.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# cfunge\n\n![Build status](https://github.com/VorpalBlade/cfunge/actions/workflows/ci.yml/badge.svg)\n\nThis is cfunge - a fast Befunge93/98/109 interpreter in C.\n\ncfunge offers some features that many other standard conforming interpreters\ndon't. For example:\n\n * Sandbox mode, prevents programs from harming system (more details below).\n * Advance tracing support, debugging protocol support system under development.\n * Passes mycology (of course other conforming interpreters does this, but most\n   interpreters are, sadly, not conforming).\n * Tested using Valgrind and similar tools.\n * Tested with fuzz testing to ensure cfunge does not segfault on random stuff.\n * Coded for maximum performance AND correctness.\n * Support for selecting either 64-bit or 32-bit integers as datatype in\n   funge-space at compile time.\n\n\n## Dependencies\n\n### Required\n\n * cmake (http://www.cmake.org/) to generate a Makefile for cfunge. At least\n   version 3.12 is required.\n\n * A C99 compiler, or one that supports a large subset of C99, such as GCC or\n   clang. Any relatively modern versions should work. Other compilers may or\n   may not work.\n\n * A POSIX.1-2001 system with the memory mapped file option. It also needs the\n   function strdup() which is part of the XSI extension. (For POSIX.1-2008 both\n   strdup() and memory mapped files are mandatory and part of the base.)\n   Operating systems known to work:\n   + Linux 2.6.28 (with glibc 2.9) and later (earlier versions unknown but will\n     probably work unless very old).\n   + FreeBSD 6.4 or later (earlier versions unknown).\n   + Mac OS X (unknown version) has been reported to work but I don't have it\n     myself and thus can't test it.\n   + NetBSD 5.0.1/amd64 is known to work.\n   + OpenBSD 4.4 (sparc64): I have not managed to get cmake 2.6 to compile on\n     OpenBSD, but I did manage to build cfunge by hand, required some strange\n     workarounds and defines.\n\n   Windows most likely won't work. Nor do I plan to support it. Cygwin may work,\n   but you are on your own if it doesn't.\n\n### Highly recommended\n\n * Ncurses (http://www.gnu.org/software/ncurses/), needed for the TERM\n   fingerprint. This is most likely already installed, though headers may need\n   to be installed separately via some form of -dev package. Ncurses will be\n   automatically used if found.\n * IEC 60559 floating-point arithmetic. Please see Annex F in ISO/IEC 9899 for\n   more details.\n * LibBSD (or have a BSD libc). This allows using arc4random which provides\n   better randomness than the standard random() function.\n\n\n## Configuring\n\n**Warning**: Out of tree builds are highly recommended. Building in the source\ntree will not work. Building in a sub-directory of the source tree may work\nbut is _completely_ untested.\n\n**Warning**: Only the make and ninja backends for cmake have been tested. Other\nbackends may work, but are untested.\n\nTo build using cmake, you can run these commands in the top source directory:\n\n```console\n$ mkdir ../build \u0026\u0026 cd ../build\n$ cmake ../cfunge  # Adjust path as needed.\n```\n\nIf you are on a 32-bit system you may want to use 32-bit integers (instead of\n64-bit integers) for speed. It is also slightly faster on some 64-bit systems\nto use 32-bit integers. This may vary between architectures. To use 32-bit\nintegers you could use these commands instead of the above ones:\n\n```console\n$ mkdir ../build \u0026\u0026 cd ../build\n$ cmake -DUSE_64BIT=OFF ../cfunge  # Adjust path as needed.\n```\n\nIf you want to see a list of available options use ccmake. It will allow you to\nselect options in a ncurses based user interface. Help is always shown at the\nbottom of the screen.\n\n```console\n$ mkdir ../build \u0026\u0026 cd ../build\n$ ccmake ../cfunge  # Adjust path as needed.\n  (press c)\n  (change options - use t to show advanced options)\n  (press c again)\n  (press g to generate make file)\n```\n\nFor more information see:\n\n```console\n$ cmake --help\n```\n\nand/or\n\n```console\n$ ccmake --help\n```\n\n\n## Compiling\n\nAfter having run cmake as described in the above section, just run:\n\n```console\n$ make\n```\n\n\nInstalling\n----------\nNot needed, cfunge can be run from build directory, but if you want to (after\nhaving compiled cfunge):\n\n```console\n$ make install\n```\n\n\nFingerprints\n------------\nIt is planned to implement most or all of the existing fingerprints,\nwith some exceptions:\n\n * FNGR - Contradicts with 98 standard.\n * IMAP - Too intrusive.\n * MODE - Intrusive into IP handling.\n * TRDS - Exceedingly complex and intrusive.\n * WIND - Too complex to implement and not portable.\n\nShort descriptions of implemented fingerprints:\n\nFinger print | Description\n------------ | -----------\n3DSP         | 3D space manipulation extension\nBASE         | I/O for numbers in other bases\nBOOL         | Logic Functions\nCPLI         | Complex Integer extension\nDATE         | Date Functions\nDIRF         | Directory functions extension\nFILE         | File I/O functions\nFING         | Operate on single fingerprint semantics\nFIXP         | Some useful math functions\nFPDP         | Double precision floating point\nFPSP         | Single precision floating point\nFRTH         | Some common forth commands\nHRTI         | High-Resolution Timer Interface\nINDV         | Pointer functions\nJSTR         | Read and write strings in Funge-Space\nMODU         | Modulo Arithmetic Extension\nNCRS         | Ncurses Extension\nNULL         | Funge-98 Null Fingerprint\nORTH         | Orthogonal Easement Library\nPERL         | Generic Interface to the Perl Language\nREFC         | Referenced Cells Extension\nREXP         | Regular Expression Matching\nROMA         | Funge-98 Roman Numerals\nSCKE         | TCP/IP async socket and dns resolving extension\nSOCK         | TCP/IP socket extension\nSTRN         | String functions\nSUBR         | Subroutine extension\nTERM         | Terminal control functions\nTIME         | Time and Date functions\nTOYS         | Funge-98 Standard Toys\nTURT         | Simple Turtle Graphics Library\n\nFor more details please see the specs for each fingerprint.\nIn cases of undefined behaviour in fingerprints, cfunge mostly tries to do the\nsame thing as CCBI.\n\n\n## Undefined behaviour\n\nThe Befunge98 standard leaves some things undefined, here is what we do for\nsome of those cases:\n\n * `y` pushes time in UTC not local time.\n * `k` with a negative argument reflects.\n * `#` across edge of funge-space may or may not skip first char after wrapping\n   depending on exact situation.\n * `(` and `)` with a negative count reflects and doesn't pop any fingerprint.\n * Loaded fingerprints are inherited to child IPs at split (`t`).\n * STDOUT is only flushed at:\n   * Newline (line feed, ASCII 10) printed using `,` instruction.\n   * Any input instructions.\n   * End of program.\n * Standard input is read one line at a time and buffered internally. Those\n   instructions reading chars fetch one char from this buffer, leaving the rest\n   (if any) including any ending newline. Instructions reading an integer will\n   leave anything after the integer in the buffer with one exception: if the\n   next char is a newline it will be discarded.\n\n\n## Notes on different standards\n\nThe option `-s 93` does not prevent the program from accessing outside the first\n80x25 cells. Nor does it disallow instructions that didn't exist in 93. It does\nhowever change space behaviour to match 93 style.\n\nIf a program depends on a instruction that is undefined in 93 to reflect, it\nshould be easy to replace such instructions with a r for reflect or any in the\nrange `A`-`Z` (and not load any fingerprint).\n\nFurther division by zero always returns 0 in all modes, though the Befunge93\nspecs says the interpreter should ask the user what result he/she wants in that\nsituation.\n\n\n## Sandbox mode\n\nSandbox mode prevents Funge programs from doing \"harmful\" things, this includes,\nbut is not limited to:\n\n * Any file or filesystem IO is forbidden.\n * The list of environment variables the program can see in y are restricted.\n * Non-safe fingerprints can not be loaded (this includes network and file\n   system access as well as other things).\n\n\n## Version number scheme\n\ncfunge uses decimal versions as of 1,0. That is, 1,15 is between 1,1 and 1,2,\ntreating the number as a proper decimal number. In addition, the widely used\n(outside English that is) convention of comma (,) as the decimal separator is\nused instead of a period.\n\nFor the `y` instruction, the version number multiplied by 10000 is used. Should\nmore than 4 decimals ever be used, the versioning scheme will change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVorpalBlade%2Fcfunge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVorpalBlade%2Fcfunge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVorpalBlade%2Fcfunge/lists"}