1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Allow enabling/disabling of peg module.

Use compiler define -DJANET_NO_PEG to turn off the peg module.
This commit is contained in:
Calvin Rose 2019-02-17 21:22:03 -05:00
parent 54227ebff1
commit 1e70c97ef0
4 changed files with 12 additions and 1 deletions

View File

@ -1,7 +1,7 @@
[![Join the chat](https://badges.gitter.im/janet-language/community.svg)](https://gitter.im/janet-language/community) [![Join the chat](https://badges.gitter.im/janet-language/community.svg)](https://gitter.im/janet-language/community)
   
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/bjraxrxexmt3sxyv/branch/master?svg=true)](https://ci.appveyor.com/project/bakpakin/janet/branch/master)
[![Build Status](https://travis-ci.org/janet-lang/janet.svg?branch=master)](https://travis-ci.org/janet-lang/janet) [![Build Status](https://travis-ci.org/janet-lang/janet.svg?branch=master)](https://travis-ci.org/janet-lang/janet)
[![Appveyor Status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/janet-lang/janet)
[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml.svg)](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml?) [![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml.svg)](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml?)
<img src="https://raw.githubusercontent.com/janet-lang/janet/master/assets/janet-w200.png" alt="Janet logo" width=200 align="left"> <img src="https://raw.githubusercontent.com/janet-lang/janet/master/assets/janet-w200.png" alt="Janet logo" width=200 align="left">

View File

@ -753,7 +753,9 @@ JanetTable *janet_core_env(void) {
janet_lib_debug(env); janet_lib_debug(env);
janet_lib_string(env); janet_lib_string(env);
janet_lib_marsh(env); janet_lib_marsh(env);
#ifdef JANET_PEG
janet_lib_peg(env); janet_lib_peg(env);
#endif
#ifdef JANET_ASSEMBLER #ifdef JANET_ASSEMBLER
janet_lib_asm(env); janet_lib_asm(env);
#endif #endif

View File

@ -20,6 +20,8 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
#ifdef JANET_PEG
#ifndef JANET_AMALG #ifndef JANET_AMALG
#include <janet/janet.h> #include <janet/janet.h>
#include <string.h> #include <string.h>
@ -1105,3 +1107,5 @@ static const JanetReg peg_cfuns[] = {
void janet_lib_peg(JanetTable *env) { void janet_lib_peg(JanetTable *env) {
janet_core_cfuns(env, NULL, peg_cfuns); janet_core_cfuns(env, NULL, peg_cfuns);
} }
#endif /* ifdef JANET_PEG */

View File

@ -123,6 +123,11 @@ extern "C" {
#define JANET_ASSEMBLER #define JANET_ASSEMBLER
#endif #endif
/* Enable or disable the peg module */
#ifndef JANET_NO_PEG
#define JANET_PEG
#endif
/* How to export symbols */ /* How to export symbols */
#ifndef JANET_API #ifndef JANET_API
#ifdef JANET_WINDOWS #ifdef JANET_WINDOWS