Added dynamic function 'Project.no-echo' to disable echoing in examples.

This commit is contained in:
Erik Svedäng 2018-06-05 10:05:33 +02:00
parent 8928b10aa4
commit 669aca2b96
12 changed files with 20 additions and 1 deletions

View File

@ -7,6 +7,13 @@
(defdynamic dec [x]
(- x 1))
(defmodule Project
(doc no-echo "Turn off debug printing in the compiler.")
(defdynamic no-echo []
(do
(Project.config "print-ast" false)
(Project.config "echo-compiler-cmd" false))))
)

View File

@ -3,6 +3,7 @@
(use Float)
(use Array)
(use IO)
(Project.no-echo)
(defn fib [n]
(if (< n 2)

View File

@ -1,4 +1,5 @@
(local-include "../examples/banana.h")
(Project.no-echo)
(register-type Apple)
(register-type Banana [price Double, size Int])

View File

@ -2,6 +2,7 @@
(load "SDL_ttf.carp")
;;(Debug.sanitize-addresses)
(Project.config "title" "Fonts")
(def font (the (Ptr TTF_Font) NULL))
(def text1 (the (Ptr SDL_Texture) NULL))

View File

@ -1,3 +1,4 @@
(Project.no-echo)
(Debug.sanitize-addresses)
(Project.config "print-ast" true)

View File

@ -1,6 +1,7 @@
(use IO)
(use Int)
(use Array)
(Project.no-echo)
(definterface fmap (λ [(λ [a] a) b] b))

View File

@ -1,4 +1,5 @@
(Debug.sanitize-addresses)
(Project.no-echo)
(use Array)
(deftype (Trivial t) [x t])

View File

@ -1,4 +1,4 @@
(Project.config "print-ast" true)
(Project.no-echo)
(Debug.sanitize-addresses)
(def s "I'm a global string...")

View File

@ -1,5 +1,7 @@
(load-and-use SDL)
(Project.config "title" "Minimal")
(defn tick [state]
(+ state 10))

View File

@ -1,3 +1,5 @@
(Project.no-echo)
(defn changing-target-of-ref []
(let [s1 @"hello"
s2 @"goodbye"

View File

@ -1,4 +1,5 @@
(use Array)
(Project.no-echo)
(deftype Age [x Int])

View File

@ -1,6 +1,7 @@
;; A slightly bigger example of how to work with structs and arrays that change
(use IO)
(Project.no-echo)
(deftype Pos
[x Float