mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-17 16:38:14 +03:00
Added dynamic function 'Project.no-echo' to disable echoing in examples.
This commit is contained in:
parent
8928b10aa4
commit
669aca2b96
@ -7,6 +7,13 @@
|
|||||||
(defdynamic dec [x]
|
(defdynamic dec [x]
|
||||||
(- x 1))
|
(- 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))))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
(use Float)
|
(use Float)
|
||||||
(use Array)
|
(use Array)
|
||||||
(use IO)
|
(use IO)
|
||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(defn fib [n]
|
(defn fib [n]
|
||||||
(if (< n 2)
|
(if (< n 2)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
(local-include "../examples/banana.h")
|
(local-include "../examples/banana.h")
|
||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(register-type Apple)
|
(register-type Apple)
|
||||||
(register-type Banana [price Double, size Int])
|
(register-type Banana [price Double, size Int])
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
(load "SDL_ttf.carp")
|
(load "SDL_ttf.carp")
|
||||||
|
|
||||||
;;(Debug.sanitize-addresses)
|
;;(Debug.sanitize-addresses)
|
||||||
|
(Project.config "title" "Fonts")
|
||||||
|
|
||||||
(def font (the (Ptr TTF_Font) NULL))
|
(def font (the (Ptr TTF_Font) NULL))
|
||||||
(def text1 (the (Ptr SDL_Texture) NULL))
|
(def text1 (the (Ptr SDL_Texture) NULL))
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
(Project.no-echo)
|
||||||
(Debug.sanitize-addresses)
|
(Debug.sanitize-addresses)
|
||||||
|
|
||||||
(Project.config "print-ast" true)
|
(Project.config "print-ast" true)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
(use IO)
|
(use IO)
|
||||||
(use Int)
|
(use Int)
|
||||||
(use Array)
|
(use Array)
|
||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(definterface fmap (λ [(λ [a] a) b] b))
|
(definterface fmap (λ [(λ [a] a) b] b))
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
(Debug.sanitize-addresses)
|
(Debug.sanitize-addresses)
|
||||||
|
(Project.no-echo)
|
||||||
(use Array)
|
(use Array)
|
||||||
|
|
||||||
(deftype (Trivial t) [x t])
|
(deftype (Trivial t) [x t])
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
(Project.config "print-ast" true)
|
(Project.no-echo)
|
||||||
(Debug.sanitize-addresses)
|
(Debug.sanitize-addresses)
|
||||||
|
|
||||||
(def s "I'm a global string...")
|
(def s "I'm a global string...")
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(load-and-use SDL)
|
(load-and-use SDL)
|
||||||
|
|
||||||
|
(Project.config "title" "Minimal")
|
||||||
|
|
||||||
(defn tick [state]
|
(defn tick [state]
|
||||||
(+ state 10))
|
(+ state 10))
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(defn changing-target-of-ref []
|
(defn changing-target-of-ref []
|
||||||
(let [s1 @"hello"
|
(let [s1 @"hello"
|
||||||
s2 @"goodbye"
|
s2 @"goodbye"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
(use Array)
|
(use Array)
|
||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(deftype Age [x Int])
|
(deftype Age [x Int])
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
;; A slightly bigger example of how to work with structs and arrays that change
|
;; A slightly bigger example of how to work with structs and arrays that change
|
||||||
|
|
||||||
(use IO)
|
(use IO)
|
||||||
|
(Project.no-echo)
|
||||||
|
|
||||||
(deftype Pos
|
(deftype Pos
|
||||||
[x Float
|
[x Float
|
||||||
|
Loading…
Reference in New Issue
Block a user