├── src
├── atom_internal.h
├── vector.h
├── vector.c
├── main.c
├── atom.h
├── kvec.h
└── atom_lib.c
├── test
├── minunit.h
├── print.scm
├── accept.scm
├── input.txt
├── bug.scm
├── sicp
│ ├── sort.scm
│ ├── base.scm
│ └── ch1.scm
├── r5rs.scm
├── the_little_schemer.scm
├── test.scm
├── sicp-results.scm
├── test.c
└── r5rs_pitfall.scm
├── atom
├── .atom_log
└── atom.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── atom.xccheckout
│ └── project.pbxproj
├── doc
├── r5rs.pdf
├── TODO.md
└── r5rs-todo.txt
├── .gitmodules
├── README.markdown
├── .gitignore
├── Makefile
└── Doxyfile
/src/atom_internal.h:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/minunit.h:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/atom/.atom_log:
--------------------------------------------------------------------------------
1 | Input String: (define (fact-helper x res)
2 |
--------------------------------------------------------------------------------
/doc/r5rs.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marcomorain/atom/HEAD/doc/r5rs.pdf
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/linenoise"]
2 | path = src/linenoise
3 | url = git://github.com/antirez/linenoise.git
4 |
--------------------------------------------------------------------------------
/test/print.scm:
--------------------------------------------------------------------------------
1 | ; Looping version
2 | (define hello-world
3 | (lambda ()
4 | (display "Hello, World!")
5 | (newline)))
6 | (hello-world)
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | # Atom
2 | ## As small as I can make a *complete* R5RS Scheme implementation.
3 |
4 | ## Project Goals
5 | - A complete scheme r5rs implementation
6 | - Designed to be embedded in a C / C++ application.
7 |
--------------------------------------------------------------------------------
/atom/atom.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | /build/scheme.build*
3 | /scheme.1
4 | /a.out
5 | /a.out.dSYM/
6 | /build/Debug/scheme
7 | /src/a.out
8 | /src/a.out.dSYM/
9 | /src/atom
10 | /src/*.o
11 | .atom_history
12 | xcuserdata
13 | atom/build/
14 | /bin/
15 | /html/
16 | /.atom_log
17 | *~
18 |
--------------------------------------------------------------------------------
/test/accept.scm:
--------------------------------------------------------------------------------
1 | (if 1 2)
2 | 123.4567
3 | (define errors 0)
4 |
5 | (define assert
6 | (lambda (test) (if test
7 |
8 | errors
9 | (set! errors (+ errors 1)))))
10 | (assert (eq? 2 (+ 1 1)))
11 | (display "Errors: ")
12 | (display errors)
--------------------------------------------------------------------------------
/src/vector.h:
--------------------------------------------------------------------------------
1 | //
2 | // vector.h
3 | // atom
4 | //
5 | // Created by Marc O'Morain on 24/12/2014.
6 | // Copyright (c) 2014 yTR3m9aXwX. All rights reserved.
7 | //
8 |
9 | #ifndef __atom__vector__
10 | #define __atom__vector__
11 |
12 | #include
13 |
14 | #endif /* defined(__atom__vector__) */
15 |
--------------------------------------------------------------------------------
/src/vector.c:
--------------------------------------------------------------------------------
1 | #include "vector.h"
2 |
3 | struct vector
4 | {
5 | const size_t element_size;
6 | char* elements;
7 | int num_elements;
8 | };
9 |
10 | char* vector_access(const struct vector* vector, int i) {
11 | char* element = vector->elements + (i * vector->element_size);
12 | return element;
13 | }
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CCFLAGS = -std=c99 #-Wall
2 |
3 | default: src/*.c src/*.h
4 | @mkdir -p bin
5 | cc ${CCFLAGS} -o bin/test src/atom.c src/atom_lib.c test/test.c
6 | cc ${CCFLAGS} -o bin/atom src/atom.c src/atom_lib.c src/linenoise/linenoise.c src/main.c
7 | @echo `cat src/atom.c src/atom_lib.c | tr -dc ';' | wc -c` 'lines of code.'
8 | bin/test > /dev/null
9 |
10 | clean :
11 | rm -f bin/test bin/atom
12 |
--------------------------------------------------------------------------------
/test/input.txt:
--------------------------------------------------------------------------------
1 | ; http://www2.latech.edu/~acm/helloworld/scheme.html
2 |
3 | ; Scheme
4 |
5 | (define hello-world
6 | (lambda ()
7 | (begin
8 | (write 'Hello-World)
9 | (newline)
10 | (hello-world))))
11 |
12 |
13 | (hello-world)
14 |
15 | ; submitted by: indigo@owlnet.rice.edu (Scott Ruthfield)
16 |
17 | ; Looping version
18 | (define hello-world
19 | (lambda ()
20 | (display "Hello, World!")
21 | (newline)
22 | (hello-world)))
23 | (hello-world)
24 |
25 | ; submitted by: mcornick@d.umn.edu (Mandy Cornick)
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/bug.scm:
--------------------------------------------------------------------------------
1 | '()
2 | (vector 1 2 3)
3 | (vector->list #(1 2 3 4))
4 | (list->vector '(1 2 3 4))
5 |
6 | ;`(list ,(+ 1 2) 4)
7 |
8 | ;`(list ,(+ 1 2) 4)
9 | ; (list 3 4)
10 |
11 | ;(let ((name 'a))
12 | ; `(list ,name ',name))
13 | ; (list a (quote a))
14 |
15 | ;`(a ,(+ 1 2) ,@'(4 5 6) b)
16 | ; (a3456b)
17 |
18 | ;`(( foo ,(- 10 3)) ,@(cdr '(c)) . ,(car '(cons)))
19 |
20 | `(1 . ,(+ 1 2))
21 |
22 | ; ((foo 7) . cons)
23 |
24 | ;; `#(10 5 ,(sqrt 4) ,@(map sqrt '(16 9)) 8) =⇒ #(1052438)
25 |
26 | ;(current-output-port)
27 | ; CRASH
28 | ;(input-port? 1)
29 | ;(if (input-port? 1) (display "yes"))
30 | ;(if (output-port? (current-output-port)) (display "win"))
31 | ;(if (output-port? (current-output-port)) (display "win"))
32 | ;(if (output-port? (current-output-port)) (display "win"))
33 | ;(if (output-port? (current-input-port)) (display "True"))
--------------------------------------------------------------------------------
/test/sicp/sort.scm:
--------------------------------------------------------------------------------
1 | (define (same-length lst)
2 | (sort (map string-length lst)))
3 | (define a (list "one" "two" "three" "four" "five" "six" "seven" "eight"))
4 |
5 | (define (selection-sort lst)
6 | (if (null? lst)
7 | '()
8 | (selection-sort-helper (smallest lst) lst)))
9 |
10 | ; The helper procedure handles the deletion of the smallest
11 | ; element and the repetition
12 | (define (selection-sort-helper smallest-value lst)
13 | (cons smallest-value
14 | (selection-sort (list-remove lst smallest-value))))
15 |
16 | (define (smallest lst)
17 | (if (null? (cdr lst))
18 | (car lst)
19 | (smaller (car lst) (smallest (cdr lst)))))
20 |
21 | (define (smaller val1 val2)
22 | (if (< val1 val2) val1 val2))
23 |
24 | (define (list-remove lst val)
25 | (if (eq? val (car lst))
26 | (cdr lst)
27 | (cons (car lst) (list-remove (cdr lst) val))))
28 |
29 | (define sort selection-sort)
30 | (define b (map string-length a))
--------------------------------------------------------------------------------
/src/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "linenoise/linenoise.h"
5 | #include "atom.h"
6 |
7 | static void do_repl(atom_state* cont)
8 | {
9 | for (;;)
10 | {
11 | char* line = linenoise("> ");
12 |
13 | if (!line) // eof/ctrl+d
14 | {
15 | break;
16 | }
17 |
18 | if (*line)
19 | {
20 | linenoiseHistoryAdd(line);
21 | atom_state_load(cont, line);
22 | }
23 |
24 | free(line);
25 | }
26 | }
27 |
28 | static const char* history = ".atom_history";
29 |
30 |
31 | int main (int argc, char** argv)
32 | {
33 | atom_state* atom = atom_state_new();
34 |
35 | atom_load_libraries(atom);
36 |
37 | for (int i=1; i 3 2) 'yes 'no))
30 | (expect-eq? 'no (if (> 2 3) 'yes 'no))
31 | (expect-eq? 1 (if (> 3 2)
32 | (- 3 2)
33 | (+ 3 2)))
34 |
35 | (expect-true 1)
36 | (expect-true 3.1415)
37 | (expect-true '())
38 | (expect-true #t)
39 | (expect-true 'symbol)
40 | (expect-true "string")
41 | (expect-true +) ; a built-in function
42 | (expect-true expect) ; a compiled function
43 | (expect-false #f)
44 |
45 |
46 | (display "Passed: ")
47 | (display passed)
48 | (display "Failed: ")
49 | (display failed)
--------------------------------------------------------------------------------
/test/the_little_schemer.scm:
--------------------------------------------------------------------------------
1 | #( 1 2 3)
2 | (+ 1 2)
3 | '()
4 | '(a (a v) d)
5 |
6 | (string #\a #\b)
7 |
8 | (define atom?
9 | (lambda (x)
10 | (and (not (pair? x)) (not (null? x)))))
11 |
12 | (define expect-true
13 | (lambda (x)
14 | (or x (error "expected to be true"))))
15 |
16 | (define expect-false
17 | (lambda (x)
18 | (or (not x) (error "expected to be false"))))
19 |
20 | (define expect-equal
21 | (lambda (a b)
22 | (or (equal? a b) (error "expected a and b to be the same"))))
23 |
24 | (expect-true #t)
25 | (expect-false #f)
26 |
27 | (expect-true (atom? 'atom))
28 | (expect-true (atom? 'turkey))
29 | (expect-true (atom? 1492))
30 | (expect-true (atom? 'u))
31 | (expect-true (atom? '*abc$))
32 | (expect-true (list? '(atom)))
33 | (expect-true (list? '((atom turkey) or)))
34 | (expect-true (list? '(how are you doing so far)))
35 | (expect-true (list? '(((how) are) ((you) (doing so)) far)))
36 | (expect-true (list? '()))
37 | (expect-false (atom? '()))
38 | (expect-true (list? '(() () () ())))
39 | (expect-equal 'a (car '(a b c)))
40 | (expect-equal '(a b c) (car '((a b c) x y z)))
41 |
--------------------------------------------------------------------------------
/test/sicp/base.scm:
--------------------------------------------------------------------------------
1 | (define errors 0)
2 | (define pass 0)
3 |
4 | (define (report-error expected actual)
5 | (set! errors (+ 1 errors))
6 | (display "ERROR: Expected ")
7 | (display expected)
8 | (display " but received ")
9 | (display actual)
10 | (newline))
11 |
12 | (define (passed actual)
13 | (set! pass (+ 1 pass))
14 | (display "PASS: ")
15 | (display actual)
16 | (newline))
17 |
18 | (define (assert-equal expected actual)
19 | (if (equal? expected actual)
20 | (passed actual)
21 | (report-error expected actual)))
22 |
23 |
24 | ;;;SECTION 1.1.1
25 | (assert-equal 486 (+ 137 349))
26 |
27 | (assert-equal 486 (+ 137 349))
28 | (assert-equal 666 (- 1000 334))
29 | (assert-equal 495 (* 5 99))
30 | (assert-equal 2 (/ 10 5))
31 | (assert-equal 12.7 (+ 2.7 10))
32 | (assert-equal 75 (+ 21 35 12 7))
33 | (assert-equal 1200 (* 25 4 12))
34 | (assert-equal 19 (+ (* 3 5) (- 10 6)))
35 | (assert-equal 57 (+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6)))
36 | (assert-equal 57 (+ (* 3
37 | (+ (* 2 4)
38 | (+ 3 5)))
39 | (+ (- 10 7)
40 | 6)))
41 |
42 | (display "Passed: ")
43 | (display pass)
44 | (display " Errors: ")
45 | (display errors)
46 | (newline)
47 |
--------------------------------------------------------------------------------
/src/atom.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | typedef struct atom_state atom_state;
6 |
7 | // Create a new atom state.
8 | struct atom_state* atom_state_new();
9 | void atom_state_free(atom_state* state);
10 | void atom_state_load(atom_state* state, const char* data);
11 | void atom_state_load_file(atom_state* state, const char* filename);
12 |
13 | double atom_state_pop_number(atom_state* state);
14 |
15 | bool atom_api_to_boolean(atom_state* cont, int n);
16 | const char* atom_api_to_string(atom_state* cont, int n);
17 | size_t atom_api_get_top(atom_state* cont);
18 | void atom_api_clear(atom_state* cont);
19 |
20 |
21 | // Libraries
22 | void atom_load_libraries(atom_state* state);
23 |
24 | // Internal
25 | struct Environment;
26 | typedef struct Environment Environment;
27 |
28 | // Calling convention:
29 | // Pop params off the stack
30 | // Push (1) the result.
31 | typedef void (*atom_builtin) (Environment* env, int params);
32 |
33 | struct Library
34 | {
35 | const char* name;
36 | atom_builtin func;
37 | };
38 |
39 | double atom_pop_number(Environment* env);
40 | void atom_push_number(Environment* env, double x);
41 | void atom_add_builtin(atom_state* state, const char* name, atom_builtin function);
42 |
43 | int atom_type(atom_state* state, int n);
44 |
--------------------------------------------------------------------------------
/doc/TODO.md:
--------------------------------------------------------------------------------
1 | ### TODO:
2 |
3 | #### Alpha 1
4 | * Implement define with varying number of paramters
5 | * Test suite should pass
6 | * Packages
7 |
8 | #### Alpha 2
9 | * Code coverage
10 | * Simple Macros
11 | * Full hygenic macros
12 | * Full number tower
13 | * Full number parsing
14 | * Fix all warnings
15 | * Call CC up only
16 | * Full call CC
17 | * Debug data on each Cell (file and line and column were it was created).
18 | * C API for user functions
19 | * Userdata / void* / C / C++ data types? (with gc callback)
20 | * add const flag to data if it is compile time created data.
21 | * Add proper tail recursion for if
22 | * Implement C library with the API
23 |
24 | ## Report
25 | ### Chapter 4: Expressions
26 | * case
27 | * letrec
28 | * do
29 | * let (named)
30 | * delay
31 | * quasiquote
32 | * let-syntax
33 | * letrec-syntax
34 | * syntax-rules
35 |
36 | ### Chapter 5: Program structure
37 | * define-syntax
38 |
39 | ### Chapter 6: Standard Procedures
40 | #### 6.1. Equivalence predicates
41 | #### 6.2. Numbers
42 | * quotient
43 | * remainder
44 | * gcd
45 | * lcm
46 | * numerator
47 | * denominator
48 | * rationalize
49 | * make-rectangular
50 | * make-polar
51 | * real-part
52 | * imag-part
53 | * magnitude
54 | * angle
55 | * exact->inexact
56 | * inexact->exact
57 |
58 | ## 6.2.6 Numerical input and output
59 |
60 | * number->string
61 | * string->number
62 |
63 | ## Booleans
64 | ## Pairs and lists
65 | * reverse
66 | * memq
67 | * memv
68 | * member
69 | * assq
70 | * assv
71 | * assoc
72 |
73 |
74 | ### 6.4 Control Features
75 | * map
76 | * for-each
77 | * force
78 | * call-with-current-continuation
79 | * values
80 | * call-with-values
81 | * dynamic-wind
82 |
83 | ### 6.5 Eval
84 | * eval
85 |
86 | ### 6.6.1 Ports
87 | * call-with-input-file
88 | * call-with-output-file
89 |
90 | ### 6.6.3 Input
91 | * read
92 | * char-ready?
93 |
--------------------------------------------------------------------------------
/atom/atom.xcodeproj/project.xcworkspace/xcshareddata/atom.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | FCBAF219-D66E-486B-8DF2-B8CDDF0A9C58
9 | IDESourceControlProjectName
10 | atom
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 2F3239FAF6D0B2DA344D24787E38846BF9FCE921
14 | github.com:marcomorain/atom.git
15 | 374CEE1191055548D9EA0190CC077BC3720213B9
16 | git://github.com/antirez/linenoise.git
17 |
18 | IDESourceControlProjectPath
19 | atom/atom.xcodeproj
20 | IDESourceControlProjectRelativeInstallPathDictionary
21 |
22 | 2F3239FAF6D0B2DA344D24787E38846BF9FCE921
23 | ../../..
24 | 374CEE1191055548D9EA0190CC077BC3720213B9
25 | ../../..src/linenoise
26 |
27 | IDESourceControlProjectURL
28 | github.com:marcomorain/atom.git
29 | IDESourceControlProjectVersion
30 | 111
31 | IDESourceControlProjectWCCIdentifier
32 | 2F3239FAF6D0B2DA344D24787E38846BF9FCE921
33 | IDESourceControlProjectWCConfigurations
34 |
35 |
36 | IDESourceControlRepositoryExtensionIdentifierKey
37 | public.vcs.git
38 | IDESourceControlWCCIdentifierKey
39 | 2F3239FAF6D0B2DA344D24787E38846BF9FCE921
40 | IDESourceControlWCCName
41 | atom
42 |
43 |
44 | IDESourceControlRepositoryExtensionIdentifierKey
45 | public.vcs.git
46 | IDESourceControlWCCIdentifierKey
47 | 374CEE1191055548D9EA0190CC077BC3720213B9
48 | IDESourceControlWCCName
49 | linenoise
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/kvec.h:
--------------------------------------------------------------------------------
1 | /* The MIT License
2 |
3 | Copyright (c) 2008, by Attractive Chaos
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 | */
25 |
26 | /*
27 | An example:
28 |
29 | #include "kvec.h"
30 | int main() {
31 | kvec_t(int) array;
32 | kv_init(array);
33 | kv_push(int, array, 10); // append
34 | kv_a(int, array, 20) = 5; // dynamic
35 | kv_A(array, 20) = 4; // static
36 | kv_destroy(array);
37 | return 0;
38 | }
39 | */
40 |
41 | /*
42 | 2008-09-22 (0.1.0):
43 |
44 | * The initial version.
45 |
46 | */
47 |
48 | #ifndef AC_KVEC_H
49 | #define AC_KVEC_H
50 |
51 | #include
52 |
53 | #define kv_roundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
54 |
55 | #define kvec_t(type) struct { size_t n, m; type *a; }
56 | #define kv_init(v) ((v).n = (v).m = 0, (v).a = 0)
57 | #define kv_destroy(v) free((v).a)
58 | #define kv_A(v, i) ((v).a[(i)])
59 | #define kv_pop(v) ((v).a[--(v).n])
60 | #define kv_size(v) ((v).n)
61 | #define kv_max(v) ((v).m)
62 |
63 | #define kv_resize(type, v, s) ((v).m = (s), (v).a = (type*)realloc((v).a, sizeof(type) * (v).m))
64 |
65 | #define kv_copy(type, v1, v0) do { \
66 | if ((v1).m < (v0).n) kv_resize(type, v1, (v0).n); \
67 | (v1).n = (v0).n; \
68 | memcpy((v1).a, (v0).a, sizeof(type) * (v0).n); \
69 | } while (0) \
70 |
71 | #define kv_push(type, v, x) do { \
72 | if ((v).n == (v).m) { \
73 | (v).m = (v).m? (v).m<<1 : 2; \
74 | (v).a = (type*)realloc((v).a, sizeof(type) * (v).m); \
75 | } \
76 | (v).a[(v).n++] = (x); \
77 | } while (0)
78 |
79 | #define kv_pushp(type, v) (((v).n == (v).m)? \
80 | ((v).m = ((v).m? (v).m<<1 : 2), \
81 | (v).a = (type*)realloc((v).a, sizeof(type) * (v).m), 0) \
82 | : 0), ((v).a + ((v).n++))
83 |
84 | #define kv_a(type, v, i) (((v).m <= (size_t)(i)? \
85 | ((v).m = (v).n = (i) + 1, kv_roundup32((v).m), \
86 | (v).a = (type*)realloc((v).a, sizeof(type) * (v).m), 0) \
87 | : (v).n <= (size_t)(i)? (v).n = (i) + 1 \
88 | : 0), (v).a[(i)])
89 |
90 | #endif
--------------------------------------------------------------------------------
/test/test.scm:
--------------------------------------------------------------------------------
1 |
2 | (define error
3 | (lambda (msg)
4 | (display msg)
5 | (newline)))
6 |
7 | (define (assert cond)
8 | (if (not cond)
9 | (error "assertion failed")
10 | #t))
11 |
12 | (assert (= (+ 1 2) 4))
13 |
14 | ;(- 3 4)
15 | ;(- (a . b) (c . d))
16 |
17 | (if #t 1)
18 | (if #f 1 2)
19 | (if #f 1)
20 |
21 | (assert #t)
22 |
23 | (assert 1)
24 |
25 | (assert '())
26 | (assert (cons 1 2))
27 | '()
28 |
29 | ; Set awy to one
30 | (define awy 1)
31 |
32 | ; Then see what awy is
33 | awy
34 |
35 | (cons 1 2)
36 |
37 | (define marc (cons 3 4))
38 |
39 | marc
40 |
41 | (car marc)
42 | (cdr marc)
43 |
44 | (define finnegan #f)
45 | finnegan
46 |
47 | (define true #t)
48 |
49 | (define bools (cons true finnegan))
50 | (car bools)
51 | (cdr bools)
52 |
53 | (boolean? #t)
54 | (boolean? #f)
55 | (boolean? 1)
56 | (boolean? marc)
57 |
58 | (number? 1)
59 | (number? awy)
60 | (number? #t)
61 | (number? #f)
62 | ; bug here (number? #\s)
63 | (number? #\space)
64 |
65 | (pair? marc)
66 | (pair? #t)
67 | (pair? #f)
68 | (pair? #\newline)
69 | (pair? bools)
70 | (pair? awy)
71 |
72 |
73 | bools
74 | (set-car! bools #f)
75 | (set-cdr! bools #t)
76 | bools
77 |
78 | (list? (quote(a b c))) ; => #t
79 | (list? (quote())) ; => #t
80 | (list? (quote(a . b))) ; => #f
81 | (list? '(a b c))
82 |
83 | (+ 1 1 1 1)
84 | (* 1)
85 | (*)
86 |
87 | (> 1 2)
88 | (> 3 2 3)
89 | (> 2 1)
90 | (> 2 1 0)
91 | (> 2 1 3)
92 |
93 |
94 | (cond ((> 3 3) 'greater)
95 | ((< 3 3) 'less)
96 | (else 'equal))
97 |
98 | (cond ((> 3 2) 'greater)
99 | ((< 3 2) 'less))
100 |
101 | ;(cond ((assv 'b '((a 1) (b 2))) => cadr)
102 | ; (else #f))
103 |
104 | (= 1 2)
105 | (= 1 1 1)
106 | (= 1 1 1 4)
107 | (= 1 1 1)
108 | (assert #t)
109 |
110 | (load "/Users/marcomorain/dev/scheme/test/print.scm")
111 |
112 | (apply + '(1 2 3 ))
113 |
114 | (define printer
115 | (lambda (a b c)
116 | (define inner
117 | (lambda (d)
118 | (+ a d)))
119 | (display (inner 2))
120 | (newline)
121 | 'done))
122 | (printer 1 2 3)
123 |
124 | (define (add a b c)
125 | (+ a b c))
126 | (add 3 3 3)
127 |
128 | (symbol->string 'add)
129 | (make-string 5)
130 | (make-string 5 #\a)
131 |
132 | (string->symbol "foo")
133 | (assert (symbol? (string->symbol "bar")))
134 |
135 | (char->integer #\a)
136 |
137 | (integer->char 100)
138 |
139 | (integer->char (char->integer #\m))
140 |
141 | (integer->char (char->integer #\M))
142 |
143 | (define a 1)
144 |
145 |
146 | (define fizz-buzz (lambda (count)
147 | (if (> count 0)
148 | (begin
149 | (display
150 | (cond ((= 0 (modulo count 15)) "FizzBuzz")
151 | ((= 0 (modulo count 3)) "Fizz")
152 | ((= 0 (modulo count 5)) "Buzz")
153 | (else count)))
154 | (newline)
155 | (fizz-buzz (- count 1))))))
156 | (fizz-buzz 100)
157 |
158 | (define c "ok")
159 | c
160 | (let ((a 1)
161 | (b 2)
162 | (c "foobar"))
163 | c)
164 | c
165 |
166 |
167 | (define a "string")
168 | (let* ((a 1)
169 | (b (+ a 1)))
170 | (display "side effect")
171 | (+ b 1))
172 | a
173 |
174 | (letrec ((even?
175 | (lambda (n)
176 | (if (zero? n)
177 | #t
178 | (odd? (- n 1)))))
179 | (odd?
180 | (lambda (n)
181 | (if (zero? n)
182 | #f
183 | (even? (- n 1))))))
184 | (even? 88))
185 |
186 | ;(let ((a 1)) )
187 |
188 | ; (display ((lambda lambda lambda) 'x))
189 |
--------------------------------------------------------------------------------
/test/sicp-results.scm:
--------------------------------------------------------------------------------
1 | ; http://community.schemewiki.org/?SICP-Solutions
2 |
3 | (define (test a b)
4 | (if (not (= a b))
5 | (error "a is not equal b")
6 | #t))
7 |
8 | ;; ex 1.2
9 |
10 | (/ (+ 5
11 | 4
12 | (- 2 (- 3 (+ 6 (/ 4 5)))))
13 | (* 3
14 | (- 6 2)
15 | (- 2 7)))
16 |
17 |
18 |
19 | ;; Result is -0.24666666666666667, or -37/150
20 |
21 |
22 | ;; ex1.3: Define a procedure that takes three numbers as arguments
23 | ;; and returns the sum of the squares of the two larger numbers.
24 |
25 | (define (square x) (* x x))
26 |
27 | (define (sum-of-squares x y) (+ (square x) (square y)))
28 |
29 |
30 |
31 | (define (sum-of-squared-largest-two x y z)
32 | (cond ((= (min x y z) x) (sum-of-squares y z))
33 | ((= (min x y z) y) (sum-of-squares x z))
34 | ((= (min x y z) z) (sum-of-squares x y))))
35 |
36 | ;; Testing
37 |
38 |
39 | (test 9 (square 3))
40 | (test 41 (sum-of-squares 5 4))
41 | (test 25 (sum-of-squared-largest-two 1 3 4))
42 | (test 25 (sum-of-squared-largest-two 4 1 3))
43 | (test 25 (sum-of-squared-largest-two 3 4 1))
44 |
45 |
46 | ;; ex 1.3
47 | ;; implemented using only techniques covered to this point
48 |
49 | (define (square x) (* x x))
50 |
51 | (define (sum-of-squares x y)
52 | (+ (square x) (square y)))
53 |
54 | (define (largest-two-of-three x y z)
55 | (if (>= x y)
56 | (sum-of-squares x (if (>= y z) y z))
57 | (sum-of-squares y (if (>= x z) x z))))
58 |
59 | ;; tests
60 | (test 25 (largest-two-of-three 2 3 4))
61 | (test 25 (largest-two-of-three 4 2 3))
62 | (test 25 (largest-two-of-three 3 4 2))
63 |
64 | (define (smallest-two-of-three a b c)
65 | (if (< a b)
66 | (if (< a c) a c)
67 | (if (< b c) b c)))
68 |
69 | (define (square a)
70 | (* a a))
71 |
72 | (define (sum-of-squares-largest-two-of-three a b c)
73 | (+ (square a) (square b) (square c) (- (square (smallest-two-of-three a b c)))))
74 | (define (square a)
75 | (* a a))
76 |
77 | (define (two-greatest-first? x y z)
78 | (and (>= x z) (>= x y)))
79 |
80 | (define (sum-of-greatest-squares x y z)
81 | (if (two-greatest-first? x y z)
82 | (+ (square x) (square y))
83 | (sum-of-greatest-squares y z x)))
84 | (define (sum-of-squares x y)
85 | (+ (* x x) (* y y)))
86 |
87 | (define (sum-of-squares-of-two-largest a b c)
88 | (cond ((and (<= a b) (<= a c)) (sum-of-squares b c))
89 | ((<= a b) (sum-of-squares a b))
90 | (else (sum-of-squares a c))))
91 | (define (sum-of-squared-largest-two a b c)
92 | (- (+ (square a) (square b) (square c)) (square (min a b c))))
93 | ;; a recursive solution
94 |
95 | (define (sum-of-squares-of-two-largest a b c)
96 | (define (>= x y)
97 | (or (> x y) (= x y)))
98 | (define (square x)
99 | (* x x))
100 | (cond ((and (>= a b) (>= b c)) (+ (square a) (square b))) ; a >= b >= c
101 | ((and (>= b a) (>= c b)) (+ (square b) (square c))) ; a <= b <= c
102 | (else (sum-of-squares-of-two-largest b c a))))
103 |
104 |
105 | (test 25 (sum-of-squares-of-two-largest 1 3 4))
106 | (test 25 (sum-of-squares-of-two-largest 4 1 3))
107 | (test 25 (sum-of-squares-of-two-largest 3 4 1))
108 | ;; ex1.3: Define a procedure that takes three numbers as arguments
109 | ;; and returns the sum of the squares of the two larger numbers.
110 |
111 | (define (sum-of-squared-largest-two a b c)
112 | (+ (if (or (> a b) (> a c))
113 | (* a a )
114 | 0)
115 | (if (or (> b a) (> b c))
116 | (* b b )
117 | 0)
118 | (if (or (> c a) (> c b))
119 | (* c c )
120 | 0)))
121 |
122 | (test 25 (sum-of-squared-largest-two 1 3 4))
123 | (test 25 (sum-of-squared-largest-two 4 1 3))
124 | (test 25 (sum-of-squared-largest-two 3 4 1))
125 |
--------------------------------------------------------------------------------
/src/atom_lib.c:
--------------------------------------------------------------------------------
1 | #include "atom.h"
2 | #include
3 |
4 | // 6.2.5 Numerical Operations
5 |
6 | static void plus_mul_helper(Environment* env, int params, bool is_add)
7 | {
8 | // If we are adding the identity element is 0
9 | // If we are adding the identity element is 1
10 | double result = is_add ? 0 : 1;
11 |
12 | for (int i=0; i 0)
51 | {
52 | for (int i=0; iname; library++)
184 | {
185 | atom_add_builtin(state, library->name, library->func);
186 | }
187 |
188 | }
189 |
--------------------------------------------------------------------------------
/test/test.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include "../src/atom.h"
3 |
4 | /* file: minunit.h */
5 | static int tests_run = 0;
6 | #define mu_assert(message, test) do { if (!(test)) return (char*)message; } while (0)
7 | #define mu_run_test(test) do { char *message = test(); tests_run++; if (message) return message; } while (0)
8 | #define mu_str_expand(token) #token
9 | #define mu_str(token) mu_str_expand(token)
10 | #define mu_assert_msg(test) mu_assert(mu_str(test), (test))
11 |
12 | int foo = 7;
13 | int bar = 5;
14 |
15 |
16 | static atom_state* atom_with_code(const char* code)
17 | {
18 | struct atom_state* atom = atom_state_new();
19 | atom_load_libraries(atom);
20 | atom_state_load(atom, code);
21 | return atom;
22 | }
23 |
24 | static char * test_open_close() {
25 |
26 | atom_state* c = atom_state_new();
27 | mu_assert_msg(c != 0);
28 | atom_state_free(c);
29 |
30 | c = atom_state_new();
31 | mu_assert_msg(c != 0);
32 | atom_state_free(c);
33 |
34 | return 0;
35 | }
36 |
37 | static char* test_comile() {
38 | struct atom_state* atom = atom_state_new();
39 | atom_state_load(atom, "1");
40 | double number = atom_state_pop_number(atom);
41 | mu_assert_msg(number == 1.0);
42 | mu_assert_msg(atom_api_get_top(atom) == 0);
43 |
44 | atom_state_load(atom, "\"foo\"");
45 | mu_assert_msg(atom_api_get_top(atom) == 1);
46 |
47 | const char* str = atom_api_to_string(atom, 1);
48 | mu_assert_msg(strcmp(str, "foo") == 0);
49 |
50 | atom_state_free(atom);
51 |
52 | return 0;
53 | }
54 |
55 |
56 | static double do_numeric_operation(struct atom_state* atom, const char* op)
57 | {
58 | atom_state_load(atom, op);
59 | return atom_state_pop_number(atom);
60 | }
61 |
62 | static char* test_plus() {
63 |
64 | struct atom_state* atom = atom_state_new();
65 |
66 | atom_load_libraries(atom);
67 |
68 | mu_assert_msg(do_numeric_operation(atom, "(+)") == 0);
69 | mu_assert_msg(do_numeric_operation(atom, "(+ 7)") == 7);
70 | mu_assert_msg(do_numeric_operation(atom, "(+ 1 2 3 4)") == 10);
71 | mu_assert_msg(do_numeric_operation(atom, "(*)") == 1);
72 | mu_assert_msg(do_numeric_operation(atom, "(* 1 2 )") == 2);
73 | mu_assert_msg(do_numeric_operation(atom, "(* 10 9 1)") == 90);
74 | mu_assert_msg(do_numeric_operation(atom, "(* 2 3 4)") == 24);
75 |
76 | mu_assert_msg(do_numeric_operation(atom, "(- 1)") == -1);
77 | mu_assert_msg(do_numeric_operation(atom, "(- 101 2)") == 99);
78 | mu_assert_msg(do_numeric_operation(atom, "(- 2 5)") == -3);
79 | mu_assert_msg(do_numeric_operation(atom, "(abs 5)") == 5);
80 |
81 | atom_state_free(atom);
82 | return 0;
83 | }
84 |
85 | static char* test_state() {
86 | struct atom_state* atom = atom_state_new();
87 | atom_state_load(atom, "(define x 17)");
88 | atom_api_clear(atom);
89 | mu_assert_msg(do_numeric_operation(atom, "x") == 17);
90 |
91 | atom_state_load(atom, "(set! x 9)");
92 | atom_api_clear(atom);
93 |
94 | mu_assert_msg(do_numeric_operation(atom, "x") == 9);
95 |
96 | atom_state_free(atom);
97 | return 0;
98 | }
99 |
100 | static bool do_boolean_operation(struct atom_state* atom, const char* op)
101 | {
102 | atom_state_load(atom, op);
103 | bool result = atom_api_to_boolean(atom, 1);
104 | atom_api_clear(atom);
105 | return result;
106 | }
107 |
108 | static char* test_equality() {
109 | struct atom_state* atom = atom_state_new();
110 | mu_assert_msg( do_boolean_operation(atom, "(eq? 5 5)"));
111 | mu_assert_msg(!do_boolean_operation(atom, "(eq? 1 2)"));
112 | mu_assert_msg(!do_boolean_operation(atom, "(eq? \"foo\" \"bar\")"));
113 | atom_state_free(atom);
114 | return 0;
115 | }
116 |
117 | static char* test_quote()
118 | {
119 | struct atom_state* atom = atom_state_new();
120 | atom_state_load(atom, "(quote a)");
121 | atom_api_clear(atom);
122 | atom_state_load(atom, "'a");
123 | atom_api_clear(atom);
124 | atom_state_free(atom);
125 | return 0;
126 | }
127 |
128 | static char* test_if()
129 | {
130 | struct atom_state* atom = atom_state_new();
131 | mu_assert_msg( do_boolean_operation(atom, "(if 1 2 3)"));
132 | atom_state_free(atom);
133 | return 0;
134 | }
135 |
136 | static char* test_list()
137 | {
138 | struct atom_state* atom = atom_with_code("(list 1 2 3)");
139 | int type = atom_type(atom, 0);
140 | mu_assert_msg(type == 5);
141 | return 0;
142 | }
143 |
144 | static char* test_lambda()
145 | {
146 | struct atom_state* atom = atom_with_code("(define plus (lambda (x) (+ x 1)))");
147 | atom_api_clear(atom);
148 | atom_state_load(atom, "(plus 4)");
149 | mu_assert_msg(atom_state_pop_number(atom) == 5);
150 | atom_state_free(atom);
151 | return 0;
152 | }
153 |
154 | static char* test_define_short() {
155 | struct atom_state* atom = atom_state_new();
156 | atom_load_libraries(atom);
157 | atom_state_load(atom, "(define (square x) (* x x))");
158 | atom_api_clear(atom);
159 | atom_state_load(atom, "(square 2)");
160 | mu_assert_msg(atom_state_pop_number(atom) == 4);
161 | atom_state_load(atom, "(square 3)");
162 | mu_assert_msg(atom_state_pop_number(atom) == 9);
163 | atom_state_free(atom);
164 | return 0;
165 | }
166 |
167 | static char* test_macros()
168 | {
169 | struct atom_state* atom = atom_state_new();
170 | atom_state_load(atom,
171 | " (define-syntax and "
172 | " (syntax-rules () "
173 | " ((and) #t) "
174 | " ((and test) test) "
175 | " ((and test1 test2 ...) "
176 | " (if test1 (and test2 ...) #f)))) ");
177 |
178 | atom_state_load(atom,
179 | " (define-syntax or "
180 | " (syntax-rules () "
181 | " ((or) #f) "
182 | " ((or test) test) "
183 | " ((or test1 test2 ...) "
184 | " (let ((x test1)) "
185 | " (if x x (or test2 ...))))))");
186 |
187 | atom_state_free(atom);
188 | return 0;
189 | }
190 |
191 | static char * all_tests() {
192 | //mu_run_test(test_macros);
193 | mu_run_test(test_define_short);
194 | mu_run_test(test_list);
195 | mu_run_test(test_quote);
196 | mu_run_test(test_comile);
197 | mu_run_test(test_lambda);
198 | mu_run_test(test_if);
199 | mu_run_test(test_equality);
200 | mu_run_test(test_state);
201 | mu_run_test(test_open_close);
202 | mu_run_test(test_plus);
203 | return 0;
204 | }
205 |
206 | int main(int argc, char* *argv)
207 | {
208 | char *result = all_tests();
209 | if (result != 0) {
210 | printf("TEST FAILED: %s\n", result);
211 | }
212 | else {
213 | printf("ALL TESTS PASSED\n");
214 | }
215 | printf("Tests run: %d\n", tests_run);
216 |
217 | return result != 0;
218 | }
219 |
--------------------------------------------------------------------------------
/test/r5rs_pitfall.scm:
--------------------------------------------------------------------------------
1 | ;; r5rs_pitfalls.scm
2 | ;;
3 | ;; This program attempts to test a Scheme implementation's conformance
4 | ;; to various subtle edge-cases and consequences of the R5RS Scheme standard.
5 | ;; Code was collected from public forums, and is hereby placed in the public domain.
6 | ;;
7 | ;;
8 | (define-syntax should-be
9 | (syntax-rules ()
10 | ((_ test-id value expression)
11 | (let ((return-value expression))
12 | (if (not (equal? return-value value))
13 | (for-each (lambda (v) (display v))
14 | `("Failure: " test-id ", expected '"
15 | value "', got '" ,return-value "'." #\newline))
16 | (for-each (lambda (v) (display v))
17 | '("Passed: " test-id #\newline)))))))
18 |
19 | (define call/cc call-with-current-continuation)
20 |
21 | ;; Section 1: Proper letrec implementation
22 |
23 | ;;Credits to Al Petrofsky
24 | ;; In thread:
25 | ;; defines in letrec body
26 | ;; http://groups.google.com/groups?selm=87bsoq0wfk.fsf%40app.dial.idiom.com
27 | (should-be 1.1 0
28 | (let ((cont #f))
29 | (letrec ((x (call-with-current-continuation (lambda (c) (set! cont c) 0)))
30 | (y (call-with-current-continuation (lambda (c) (set! cont c) 0))))
31 | (if cont
32 | (let ((c cont))
33 | (set! cont #f)
34 | (set! x 1)
35 | (set! y 1)
36 | (c 0))
37 | (+ x y)))))
38 |
39 | ;;Credits to Al Petrofsky
40 | ;; In thread:
41 | ;; Widespread bug (arguably) in letrec when an initializer returns twice
42 | ;; http://groups.google.com/groups?selm=87d793aacz.fsf_-_%40app.dial.idiom.com
43 | (should-be 1.2 #t
44 | (letrec ((x (call/cc list)) (y (call/cc list)))
45 | (cond ((procedure? x) (x (pair? y)))
46 | ((procedure? y) (y (pair? x))))
47 | (let ((x (car x)) (y (car y)))
48 | (and (call/cc x) (call/cc y) (call/cc x)))))
49 |
50 | ;;Credits to Alan Bawden
51 | ;; In thread:
52 | ;; LETREC + CALL/CC = SET! even in a limited setting
53 | ;; http://groups.google.com/groups?selm=19890302162742.4.ALAN%40PIGPEN.AI.MIT.EDU
54 | (should-be 1.3 #t
55 | (letrec ((x (call-with-current-continuation
56 | (lambda (c)
57 | (list #T c)))))
58 | (if (car x)
59 | ((cadr x) (list #F (lambda () x)))
60 | (eq? x ((cadr x))))))
61 |
62 | ;; Section 2: Proper call/cc and procedure application
63 |
64 | ;;Credits to Al Petrofsky, (and a wink to Matthias Blume)
65 | ;; In thread:
66 | ;; Widespread bug in handling (call/cc (lambda (c) (0 (c 1)))) => 1
67 | ;; http://groups.google.com/groups?selm=87g00y4b6l.fsf%40radish.petrofsky.org
68 | (should-be 2.1 1
69 | (call/cc (lambda (c) (0 (c 1)))))
70 |
71 | ;; Section 3: Hygienic macros
72 |
73 | ;; Eli Barzilay
74 | ;; In thread:
75 | ;; R5RS macros...
76 | ;; http://groups.google.com/groups?selm=skitsdqjq3.fsf%40tulare.cs.cornell.edu
77 | (should-be 3.1 4
78 | (let-syntax ((foo
79 | (syntax-rules ()
80 | ((_ expr) (+ expr 1)))))
81 | (let ((+ *))
82 | (foo 3))))
83 |
84 |
85 | ;; Al Petrofsky again
86 | ;; In thread:
87 | ;; Buggy use of begin in r5rs cond and case macros.
88 | ;; http://groups.google.com/groups?selm=87bse3bznr.fsf%40radish.petrofsky.org
89 | (should-be 3.2 2
90 | (let-syntax ((foo (syntax-rules ()
91 | ((_ var) (define var 1)))))
92 | (let ((x 2))
93 | (begin (define foo +))
94 | (cond (else (foo x)))
95 | x)))
96 |
97 | ;;Al Petrofsky
98 | ;; In thread:
99 | ;; An Advanced syntax-rules Primer for the Mildly Insane
100 | ;; http://groups.google.com/groups?selm=87it8db0um.fsf@radish.petrofsky.org
101 |
102 | (should-be 3.3 1
103 | (let ((x 1))
104 | (let-syntax
105 | ((foo (syntax-rules ()
106 | ((_ y) (let-syntax
107 | ((bar (syntax-rules ()
108 | ((_) (let ((x 2)) y)))))
109 | (bar))))))
110 | (foo x))))
111 |
112 | ;; Al Petrofsky
113 | ;; Contributed directly
114 | (should-be 3.4 1
115 | (let-syntax ((x (syntax-rules ()))) 1))
116 |
117 | ;; Setion 4: No identifiers are reserved
118 |
119 | ;;(Brian M. Moore)
120 | ;; In thread:
121 | ;; shadowing syntatic keywords, bug in MIT Scheme?
122 | ;; http://groups.google.com/groups?selm=6e6n88%248qf%241%40news.cc.ukans.edu
123 | (should-be 4.1 '(x)
124 | ((lambda lambda lambda) 'x))
125 |
126 | (should-be 4.2 '(1 2 3)
127 | ((lambda (begin) (begin 1 2 3)) (lambda lambda lambda)))
128 |
129 | (should-be 4.3 #f
130 | (let ((quote -)) (eqv? '1 1)))
131 | ;; Section 5: #f/() distinctness
132 |
133 | ;; Scott Miller
134 | (should-be 5.1 #f
135 | (eq? #f '()))
136 | (should-be 5.2 #f
137 | (eqv? #f '()))
138 | (should-be 5.3 #f
139 | (equal? #f '()))
140 |
141 | ;; Section 6: string->symbol case sensitivity
142 |
143 | ;; Jens Axel S?gaard
144 | ;; In thread:
145 | ;; Symbols in DrScheme - bug?
146 | ;; http://groups.google.com/groups?selm=3be55b4f%240%24358%24edfadb0f%40dspool01.news.tele.dk
147 | (should-be 6.1 #f
148 | (eq? (string->symbol "f") (string->symbol "F")))
149 |
150 | ;; Section 7: First class continuations
151 |
152 | ;; Scott Miller
153 | ;; No newsgroup posting associated. The gist of this test and 7.2
154 | ;; is that once captured, a continuation should be unmodified by the
155 | ;; invocation of other continuations. This test determines that this is
156 | ;; the case by capturing a continuation and setting it aside in a temporary
157 | ;; variable while it invokes that and another continuation, trying to
158 | ;; side effect the first continuation. This test case was developed when
159 | ;; testing SISC 1.7's lazy CallFrame unzipping code.
160 | (define r #f)
161 | (define a #f)
162 | (define b #f)
163 | (define c #f)
164 | (define i 0)
165 | (should-be 7.1 28
166 | (let ()
167 | (set! r (+ 1 (+ 2 (+ 3 (call/cc (lambda (k) (set! a k) 4))))
168 | (+ 5 (+ 6 (call/cc (lambda (k) (set! b k) 7))))))
169 | (if (not c)
170 | (set! c a))
171 | (set! i (+ i 1))
172 | (case i
173 | ((1) (a 5))
174 | ((2) (b 8))
175 | ((3) (a 6))
176 | ((4) (c 4)))
177 | r))
178 |
179 | ;; Same test, but in reverse order
180 | (define r #f)
181 | (define a #f)
182 | (define b #f)
183 | (define c #f)
184 | (define i 0)
185 | (should-be 7.2 28
186 | (let ()
187 | (set! r (+ 1 (+ 2 (+ 3 (call/cc (lambda (k) (set! a k) 4))))
188 | (+ 5 (+ 6 (call/cc (lambda (k) (set! b k) 7))))))
189 | (if (not c)
190 | (set! c a))
191 | (set! i (+ i 1))
192 | (case i
193 | ((1) (b 8))
194 | ((2) (a 5))
195 | ((3) (b 7))
196 | ((4) (c 4)))
197 | r))
198 |
199 | ;; Credits to Matthias Radestock
200 | ;; Another test case used to test SISC's lazy CallFrame routines.
201 | (should-be 7.3 '((-1 4 5 3)
202 | (4 -1 5 3)
203 | (-1 5 4 3)
204 | (5 -1 4 3)
205 | (4 5 -1 3)
206 | (5 4 -1 3))
207 | (let ((k1 #f)
208 | (k2 #f)
209 | (k3 #f)
210 | (state 0))
211 | (define (identity x) x)
212 | (define (fn)
213 | ((identity (if (= state 0)
214 | (call/cc (lambda (k) (set! k1 k) +))
215 | +))
216 | (identity (if (= state 0)
217 | (call/cc (lambda (k) (set! k2 k) 1))
218 | 1))
219 | (identity (if (= state 0)
220 | (call/cc (lambda (k) (set! k3 k) 2))
221 | 2))))
222 | (define (check states)
223 | (set! state 0)
224 | (let* ((res '())
225 | (r (fn)))
226 | (set! res (cons r res))
227 | (if (null? states)
228 | res
229 | (begin (set! state (car states))
230 | (set! states (cdr states))
231 | (case state
232 | ((1) (k3 4))
233 | ((2) (k2 2))
234 | ((3) (k1 -)))))))
235 | (map check '((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1)))))
236 |
237 | ;; Modification of the yin-yang puzzle so that it terminates and produces
238 | ;; a value as a result. (Scott G. Miller)
239 | (should-be 7.4 '(10 9 8 7 6 5 4 3 2 1 0)
240 | (let ((x '())
241 | (y 0))
242 | (call/cc
243 | (lambda (escape)
244 | (let* ((yin ((lambda (foo)
245 | (set! x (cons y x))
246 | (if (= y 10)
247 | (escape x)
248 | (begin
249 | (set! y 0)
250 | foo)))
251 | (call/cc (lambda (bar) bar))))
252 | (yang ((lambda (foo)
253 | (set! y (+ y 1))
254 | foo)
255 | (call/cc (lambda (baz) baz)))))
256 | (yin yang))))))
257 |
258 | ;; Miscellaneous
259 |
260 | ;;Al Petrofsky
261 | ;; In thread:
262 | ;; R5RS Implementors Pitfalls
263 | ;; http://groups.google.com/groups?selm=871zemtmd4.fsf@app.dial.idiom.com
264 | (should-be 8.1 -1
265 | (let - ((n (- 1))) n))
266 |
267 | (should-be 8.2 '(1 2 3 4 1 2 3 4 5)
268 | (let ((ls (list 1 2 3 4)))
269 | (append ls ls '(5))))
270 |
271 | ;; This example actually illustrates a bug in R5RS. If a Scheme system
272 | ;; follows the letter of the standard, 1 should be returned, but
273 | ;; the general agreement is that 2 should instead be returned.
274 | ;; The reason is that in R5RS, let-syntax always introduces new scope, thus
275 | ;; in the following test, the let-syntax breaks the definition section
276 | ;; and begins the expression section of the let.
277 | ;;
278 | ;; The general agreement by the implementors in 1998 was that the following
279 | ;; should be possible, but isn't:
280 | ;;
281 | ;; (define ---)
282 | ;; (let-syntax (---)
283 | ;; (define ---)
284 | ;; (define ---))
285 | ;; (define ---)
286 | ;;
287 | ;; Scheme systems based on the Portable syntax-case expander by Dybvig
288 | ;; and Waddell do allow the above, and thus often violate the letter of
289 | ;; R5RS. In such systems, the following will produce a local scope:
290 | ;;
291 | ;; (define ---)
292 | ;; (let-syntax ((a ---))
293 | ;; (let ()
294 | ;; (define ---)
295 | ;; (define ---)))
296 | ;; (define ---)
297 | ;;
298 | ;; Credits to Matthias Radestock and thanks to R. Kent Dybvig for the
299 | ;; explanation and background
300 | (should-be 8.3 1
301 | (let ((x 1))
302 | (let-syntax ((foo (syntax-rules () ((_) 2))))
303 | (define x (foo))
304 | 3)
305 | x))
306 |
307 | ;;Not really an error to fail this (Matthias Radestock)
308 | ;;If this returns (0 1 0), your map isn't call/cc safe, but is probably
309 | ;;tail-recursive. If its (0 0 0), the opposite is true.
310 | (let ((result
311 | (let ()
312 | (define executed-k #f)
313 | (define cont #f)
314 | (define res1 #f)
315 | (define res2 #f)
316 | (set! res1 (map (lambda (x)
317 | (if (= x 0)
318 | (call/cc (lambda (k) (set! cont k) 0))
319 | 0))
320 | '(1 0 2)))
321 | (if (not executed-k)
322 | (begin (set! executed-k #t)
323 | (set! res2 res1)
324 | (cont 1)))
325 | res2)))
326 | (if (equal? result '(0 0 0))
327 | (display "Map is call/cc safe, but probably not tail recursive or inefficient.")
328 | (display "Map is not call/cc safe, but probably tail recursive and efficient."))
329 | (newline))
330 |
331 |
--------------------------------------------------------------------------------
/atom/atom.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 49D03BDD1A4AF4DD00B2D932 /* vector.c in Sources */ = {isa = PBXBuildFile; fileRef = 49D03BDB1A4AF4DD00B2D932 /* vector.c */; };
11 | 8F30E33E16B41E0B00AB947C /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = 8F30E32E16B4177800AB947C /* test.c */; };
12 | 8F8544B7180AF5F3000E5CF1 /* atom_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C55716CFB2BC00445C75 /* atom_lib.c */; };
13 | 8F8544B8180AF5F3000E5CF1 /* linenoise.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C55D16CFB2BC00445C75 /* linenoise.c */; };
14 | 8F8544B9180AF5F3000E5CF1 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C56116CFB2BC00445C75 /* main.c */; };
15 | 8F8544BD180AF603000E5CF1 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C55816CFB2BC00445C75 /* atom.c */; };
16 | 8FB3C56F16CFB37F00445C75 /* atom_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C55716CFB2BC00445C75 /* atom_lib.c */; };
17 | 8FB3C57016CFB37F00445C75 /* atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 8FB3C55816CFB2BC00445C75 /* atom.c */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXCopyFilesBuildPhase section */
21 | 8F30E33216B41DE200AB947C /* CopyFiles */ = {
22 | isa = PBXCopyFilesBuildPhase;
23 | buildActionMask = 2147483647;
24 | dstPath = /usr/share/man/man1/;
25 | dstSubfolderSpec = 0;
26 | files = (
27 | );
28 | runOnlyForDeploymentPostprocessing = 1;
29 | };
30 | 8FB66696135BCB15000DE583 /* CopyFiles */ = {
31 | isa = PBXCopyFilesBuildPhase;
32 | buildActionMask = 2147483647;
33 | dstPath = /usr/share/man/man1/;
34 | dstSubfolderSpec = 0;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 1;
38 | };
39 | /* End PBXCopyFilesBuildPhase section */
40 |
41 | /* Begin PBXFileReference section */
42 | 49B017381511B9CC009B5DAC /* minunit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = minunit.h; path = ../test/minunit.h; sourceTree = ""; };
43 | 49D03BDB1A4AF4DD00B2D932 /* vector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vector.c; path = ../src/vector.c; sourceTree = ""; };
44 | 49D03BDC1A4AF4DD00B2D932 /* vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vector.h; path = ../src/vector.h; sourceTree = ""; };
45 | 8F30E32E16B4177800AB947C /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = test.c; path = ../test/test.c; sourceTree = ""; };
46 | 8F30E33416B41DE200AB947C /* test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 8F8544B6180AF567000E5CF1 /* kvec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kvec.h; path = ../src/kvec.h; sourceTree = ""; };
48 | 8FB3C55616CFB2BC00445C75 /* atom_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atom_internal.h; path = ../src/atom_internal.h; sourceTree = ""; };
49 | 8FB3C55716CFB2BC00445C75 /* atom_lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = atom_lib.c; path = ../src/atom_lib.c; sourceTree = ""; };
50 | 8FB3C55816CFB2BC00445C75 /* atom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = atom.c; path = ../src/atom.c; sourceTree = ""; };
51 | 8FB3C55916CFB2BC00445C75 /* atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atom.h; path = ../src/atom.h; sourceTree = ""; };
52 | 8FB3C55D16CFB2BC00445C75 /* linenoise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = linenoise.c; sourceTree = ""; };
53 | 8FB3C55E16CFB2BC00445C75 /* linenoise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linenoise.h; sourceTree = ""; };
54 | 8FB3C56116CFB2BC00445C75 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../src/main.c; sourceTree = ""; };
55 | 8FB66698135BCB15000DE583 /* atom */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = atom; sourceTree = BUILT_PRODUCTS_DIR; };
56 | /* End PBXFileReference section */
57 |
58 | /* Begin PBXFrameworksBuildPhase section */
59 | 8F30E33116B41DE200AB947C /* Frameworks */ = {
60 | isa = PBXFrameworksBuildPhase;
61 | buildActionMask = 2147483647;
62 | files = (
63 | );
64 | runOnlyForDeploymentPostprocessing = 0;
65 | };
66 | 8FB66695135BCB15000DE583 /* Frameworks */ = {
67 | isa = PBXFrameworksBuildPhase;
68 | buildActionMask = 2147483647;
69 | files = (
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 49B0173B1511B9D4009B5DAC /* test */ = {
77 | isa = PBXGroup;
78 | children = (
79 | 49B017381511B9CC009B5DAC /* minunit.h */,
80 | 8F30E32E16B4177800AB947C /* test.c */,
81 | );
82 | name = test;
83 | sourceTree = "";
84 | };
85 | 8FB3C55A16CFB2BC00445C75 /* linenoise */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 8FB3C55D16CFB2BC00445C75 /* linenoise.c */,
89 | 8FB3C55E16CFB2BC00445C75 /* linenoise.h */,
90 | );
91 | name = linenoise;
92 | path = ../src/linenoise;
93 | sourceTree = "";
94 | };
95 | 8FB6668D135BCB14000DE583 = {
96 | isa = PBXGroup;
97 | children = (
98 | 49D03BDB1A4AF4DD00B2D932 /* vector.c */,
99 | 49D03BDC1A4AF4DD00B2D932 /* vector.h */,
100 | 8F8544B6180AF567000E5CF1 /* kvec.h */,
101 | 8FB3C55616CFB2BC00445C75 /* atom_internal.h */,
102 | 8FB3C55716CFB2BC00445C75 /* atom_lib.c */,
103 | 8FB3C55816CFB2BC00445C75 /* atom.c */,
104 | 8FB3C55916CFB2BC00445C75 /* atom.h */,
105 | 8FB3C55A16CFB2BC00445C75 /* linenoise */,
106 | 8FB3C56116CFB2BC00445C75 /* main.c */,
107 | 49B0173B1511B9D4009B5DAC /* test */,
108 | 8FB66699135BCB15000DE583 /* Products */,
109 | );
110 | sourceTree = "";
111 | };
112 | 8FB66699135BCB15000DE583 /* Products */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 8FB66698135BCB15000DE583 /* atom */,
116 | 8F30E33416B41DE200AB947C /* test */,
117 | );
118 | name = Products;
119 | sourceTree = "";
120 | };
121 | /* End PBXGroup section */
122 |
123 | /* Begin PBXNativeTarget section */
124 | 8F30E33316B41DE200AB947C /* test */ = {
125 | isa = PBXNativeTarget;
126 | buildConfigurationList = 8F30E33B16B41DE200AB947C /* Build configuration list for PBXNativeTarget "test" */;
127 | buildPhases = (
128 | 8F30E33016B41DE200AB947C /* Sources */,
129 | 8F30E33116B41DE200AB947C /* Frameworks */,
130 | 8F30E33216B41DE200AB947C /* CopyFiles */,
131 | );
132 | buildRules = (
133 | );
134 | dependencies = (
135 | );
136 | name = test;
137 | productName = test;
138 | productReference = 8F30E33416B41DE200AB947C /* test */;
139 | productType = "com.apple.product-type.tool";
140 | };
141 | 8FB66697135BCB15000DE583 /* atom */ = {
142 | isa = PBXNativeTarget;
143 | buildConfigurationList = 8FB666A1135BCB15000DE583 /* Build configuration list for PBXNativeTarget "atom" */;
144 | buildPhases = (
145 | 8FB66694135BCB15000DE583 /* Sources */,
146 | 8FB66695135BCB15000DE583 /* Frameworks */,
147 | 8FB66696135BCB15000DE583 /* CopyFiles */,
148 | );
149 | buildRules = (
150 | );
151 | dependencies = (
152 | );
153 | name = atom;
154 | productName = atom;
155 | productReference = 8FB66698135BCB15000DE583 /* atom */;
156 | productType = "com.apple.product-type.tool";
157 | };
158 | /* End PBXNativeTarget section */
159 |
160 | /* Begin PBXProject section */
161 | 8FB6668F135BCB14000DE583 /* Project object */ = {
162 | isa = PBXProject;
163 | attributes = {
164 | LastUpgradeCheck = 0500;
165 | ORGANIZATIONNAME = yTR3m9aXwX;
166 | };
167 | buildConfigurationList = 8FB66692135BCB14000DE583 /* Build configuration list for PBXProject "atom" */;
168 | compatibilityVersion = "Xcode 3.2";
169 | developmentRegion = English;
170 | hasScannedForEncodings = 0;
171 | knownRegions = (
172 | en,
173 | );
174 | mainGroup = 8FB6668D135BCB14000DE583;
175 | productRefGroup = 8FB66699135BCB15000DE583 /* Products */;
176 | projectDirPath = "";
177 | projectRoot = "";
178 | targets = (
179 | 8FB66697135BCB15000DE583 /* atom */,
180 | 8F30E33316B41DE200AB947C /* test */,
181 | );
182 | };
183 | /* End PBXProject section */
184 |
185 | /* Begin PBXSourcesBuildPhase section */
186 | 8F30E33016B41DE200AB947C /* Sources */ = {
187 | isa = PBXSourcesBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | 8FB3C56F16CFB37F00445C75 /* atom_lib.c in Sources */,
191 | 8FB3C57016CFB37F00445C75 /* atom.c in Sources */,
192 | 8F30E33E16B41E0B00AB947C /* test.c in Sources */,
193 | );
194 | runOnlyForDeploymentPostprocessing = 0;
195 | };
196 | 8FB66694135BCB15000DE583 /* Sources */ = {
197 | isa = PBXSourcesBuildPhase;
198 | buildActionMask = 2147483647;
199 | files = (
200 | 8F8544BD180AF603000E5CF1 /* atom.c in Sources */,
201 | 8F8544B7180AF5F3000E5CF1 /* atom_lib.c in Sources */,
202 | 8F8544B8180AF5F3000E5CF1 /* linenoise.c in Sources */,
203 | 49D03BDD1A4AF4DD00B2D932 /* vector.c in Sources */,
204 | 8F8544B9180AF5F3000E5CF1 /* main.c in Sources */,
205 | );
206 | runOnlyForDeploymentPostprocessing = 0;
207 | };
208 | /* End PBXSourcesBuildPhase section */
209 |
210 | /* Begin XCBuildConfiguration section */
211 | 8F30E33C16B41DE200AB947C /* Debug */ = {
212 | isa = XCBuildConfiguration;
213 | buildSettings = {
214 | ALWAYS_SEARCH_USER_PATHS = NO;
215 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
216 | CLANG_CXX_LIBRARY = "libc++";
217 | CLANG_ENABLE_OBJC_ARC = YES;
218 | CLANG_WARN_EMPTY_BODY = YES;
219 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
220 | COPY_PHASE_STRIP = NO;
221 | GCC_DYNAMIC_NO_PIC = NO;
222 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
223 | GCC_PREPROCESSOR_DEFINITIONS = (
224 | "DEBUG=1",
225 | "$(inherited)",
226 | );
227 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
228 | MACOSX_DEPLOYMENT_TARGET = "";
229 | PRODUCT_NAME = "$(TARGET_NAME)";
230 | };
231 | name = Debug;
232 | };
233 | 8F30E33D16B41DE200AB947C /* Release */ = {
234 | isa = XCBuildConfiguration;
235 | buildSettings = {
236 | ALWAYS_SEARCH_USER_PATHS = NO;
237 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
238 | CLANG_CXX_LIBRARY = "libc++";
239 | CLANG_ENABLE_OBJC_ARC = YES;
240 | CLANG_WARN_EMPTY_BODY = YES;
241 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
242 | COPY_PHASE_STRIP = YES;
243 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
244 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
245 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
246 | MACOSX_DEPLOYMENT_TARGET = "";
247 | PRODUCT_NAME = "$(TARGET_NAME)";
248 | };
249 | name = Release;
250 | };
251 | 8FB6669F135BCB15000DE583 /* Debug */ = {
252 | isa = XCBuildConfiguration;
253 | buildSettings = {
254 | CLANG_WARN_BOOL_CONVERSION = YES;
255 | CLANG_WARN_CONSTANT_CONVERSION = YES;
256 | CLANG_WARN_EMPTY_BODY = YES;
257 | CLANG_WARN_ENUM_CONVERSION = YES;
258 | CLANG_WARN_INT_CONVERSION = YES;
259 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
260 | GCC_C_LANGUAGE_STANDARD = gnu99;
261 | GCC_ENABLE_ASM_KEYWORD = NO;
262 | GCC_OPTIMIZATION_LEVEL = 0;
263 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
264 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
265 | GCC_VERSION = "";
266 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
267 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
268 | GCC_WARN_UNDECLARED_SELECTOR = YES;
269 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
270 | GCC_WARN_UNUSED_FUNCTION = YES;
271 | GCC_WARN_UNUSED_VARIABLE = YES;
272 | GENERATE_PROFILING_CODE = YES;
273 | MACOSX_DEPLOYMENT_TARGET = 10.9;
274 | ONLY_ACTIVE_ARCH = YES;
275 | SDKROOT = macosx;
276 | };
277 | name = Debug;
278 | };
279 | 8FB666A0135BCB15000DE583 /* Release */ = {
280 | isa = XCBuildConfiguration;
281 | buildSettings = {
282 | CLANG_WARN_BOOL_CONVERSION = YES;
283 | CLANG_WARN_CONSTANT_CONVERSION = YES;
284 | CLANG_WARN_EMPTY_BODY = YES;
285 | CLANG_WARN_ENUM_CONVERSION = YES;
286 | CLANG_WARN_INT_CONVERSION = YES;
287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
288 | GCC_C_LANGUAGE_STANDARD = gnu99;
289 | GCC_ENABLE_ASM_KEYWORD = NO;
290 | GCC_VERSION = "";
291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
292 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
293 | GCC_WARN_UNDECLARED_SELECTOR = YES;
294 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
295 | GCC_WARN_UNUSED_FUNCTION = YES;
296 | GCC_WARN_UNUSED_VARIABLE = YES;
297 | GENERATE_PROFILING_CODE = YES;
298 | MACOSX_DEPLOYMENT_TARGET = 10.9;
299 | ONLY_ACTIVE_ARCH = YES;
300 | SDKROOT = macosx;
301 | };
302 | name = Release;
303 | };
304 | 8FB666A2135BCB15000DE583 /* Debug */ = {
305 | isa = XCBuildConfiguration;
306 | buildSettings = {
307 | ALWAYS_SEARCH_USER_PATHS = NO;
308 | CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
309 | CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
310 | CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
311 | COPY_PHASE_STRIP = NO;
312 | GCC_DYNAMIC_NO_PIC = NO;
313 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
314 | INFOPLIST_EXPAND_BUILD_SETTINGS = YES;
315 | MACOSX_DEPLOYMENT_TARGET = 10.6;
316 | ONLY_ACTIVE_ARCH = NO;
317 | PRODUCT_NAME = "$(TARGET_NAME)";
318 | SUPPORTED_PLATFORMS = macosx;
319 | VALID_ARCHS = x86_64;
320 | };
321 | name = Debug;
322 | };
323 | 8FB666A3135BCB15000DE583 /* Release */ = {
324 | isa = XCBuildConfiguration;
325 | buildSettings = {
326 | ALWAYS_SEARCH_USER_PATHS = NO;
327 | CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
328 | CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
329 | CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
330 | COPY_PHASE_STRIP = YES;
331 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
332 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
333 | INFOPLIST_EXPAND_BUILD_SETTINGS = YES;
334 | MACOSX_DEPLOYMENT_TARGET = 10.6;
335 | ONLY_ACTIVE_ARCH = NO;
336 | PRODUCT_NAME = "$(TARGET_NAME)";
337 | SUPPORTED_PLATFORMS = macosx;
338 | VALID_ARCHS = x86_64;
339 | };
340 | name = Release;
341 | };
342 | /* End XCBuildConfiguration section */
343 |
344 | /* Begin XCConfigurationList section */
345 | 8F30E33B16B41DE200AB947C /* Build configuration list for PBXNativeTarget "test" */ = {
346 | isa = XCConfigurationList;
347 | buildConfigurations = (
348 | 8F30E33C16B41DE200AB947C /* Debug */,
349 | 8F30E33D16B41DE200AB947C /* Release */,
350 | );
351 | defaultConfigurationIsVisible = 0;
352 | defaultConfigurationName = Debug;
353 | };
354 | 8FB66692135BCB14000DE583 /* Build configuration list for PBXProject "atom" */ = {
355 | isa = XCConfigurationList;
356 | buildConfigurations = (
357 | 8FB6669F135BCB15000DE583 /* Debug */,
358 | 8FB666A0135BCB15000DE583 /* Release */,
359 | );
360 | defaultConfigurationIsVisible = 0;
361 | defaultConfigurationName = Debug;
362 | };
363 | 8FB666A1135BCB15000DE583 /* Build configuration list for PBXNativeTarget "atom" */ = {
364 | isa = XCConfigurationList;
365 | buildConfigurations = (
366 | 8FB666A2135BCB15000DE583 /* Debug */,
367 | 8FB666A3135BCB15000DE583 /* Release */,
368 | );
369 | defaultConfigurationIsVisible = 0;
370 | defaultConfigurationName = Debug;
371 | };
372 | /* End XCConfigurationList section */
373 | };
374 | rootObject = 8FB6668F135BCB14000DE583 /* Project object */;
375 | }
376 |
--------------------------------------------------------------------------------
/test/sicp/ch1.scm:
--------------------------------------------------------------------------------
1 | ;;;;CODE FROM CHAPTER 1 OF STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS
2 |
3 | ;;; Examples from the book are commented out with ;: so that they
4 | ;;; are easy to find and so that they will be omitted if you evaluate a
5 | ;;; chunk of the file (programs with intervening examples) in Scheme.
6 |
7 | ;;; BEWARE: Although the whole file can be loaded into Scheme,
8 | ;;; don't expect the programs to work if you do so. For example,
9 | ;;; the redefinition of + in exercise 1.9 wreaks havoc with the
10 | ;;; last version of square defined here.
11 |
12 |
13 | ;;;SECTION 1.1.1
14 |
15 | ;; interpreter examples
16 |
17 | ;: 486
18 |
19 | ;: (+ 137 349)
20 | ;: (- 1000 334)
21 | ;: (* 5 99)
22 | ;: (/ 10 5)
23 | ;: (+ 2.7 10)
24 |
25 | ;: (+ 21 35 12 7)
26 | ;: (* 25 4 12)
27 |
28 | ;: (+ (* 3 5) (- 10 6))
29 |
30 | ;: (+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6))
31 |
32 | ;: (+ (* 3
33 | ;: (+ (* 2 4)
34 | ;: (+ 3 5)))
35 | ;: (+ (- 10 7)
36 | ;: 6))
37 |
38 |
39 | ;;;SECTION 1.1.2
40 |
41 | ;: (define size 2)
42 | ;: size
43 | ;: (* 5 size)
44 |
45 | ;: (define pi 3.14159)
46 | ;: (define radius 10)
47 | ;: (* pi (* radius radius))
48 | ;: (define circumference (* 2 pi radius))
49 | ;: circumference
50 |
51 |
52 | ;;;SECTION 1.1.3
53 |
54 | ;: (* (+ 2 (* 4 6))
55 | ;: (+ 3 5 7))
56 |
57 |
58 | ;;;SECTION 1.1.4
59 |
60 | (define (square x) (* x x))
61 |
62 | ;: (square 21)
63 | ;: (square (+ 2 5))
64 | ;: (square (square 3))
65 |
66 | (define (sum-of-squares x y)
67 | (+ (square x) (square y)))
68 |
69 | ;: (sum-of-squares 3 4)
70 |
71 | (define (f a)
72 | (sum-of-squares (+ a 1) (* a 2)))
73 |
74 | ;: (f 5)
75 |
76 |
77 | ;;;SECTION 1.1.5
78 |
79 | ;: (f 5)
80 | ;: (sum-of-squares (+ 5 1) (* 5 2))
81 | ;: (+ (square 6) (square 10))
82 | ;: (+ (* 6 6) (* 10 10))
83 | ;: (+ 36 100)
84 |
85 | ;: (f 5)
86 | ;: (sum-of-squares (+ 5 1) (* 5 2))
87 | ;: (+ (square (+ 5 1)) (square (* 5 2)) )
88 | ;: (+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))
89 | ;: (+ (* 6 6) (* 10 10))
90 | ;: (+ 36 100)
91 | ;: 136
92 |
93 |
94 | ;;;SECTION 1.1.6
95 |
96 | (define (abs x)
97 | (cond ((> x 0) x)
98 | ((= x 0) 0)
99 | ((< x 0) (- x))))
100 |
101 | (define (abs x)
102 | (cond ((< x 0) (- x))
103 | (else x)))
104 |
105 | (define (abs x)
106 | (if (< x 0)
107 | (- x)
108 | x))
109 |
110 | ;: (and (> x 5) (< x 10))
111 |
112 | (define (>= x y)
113 | (or (> x y) (= x y)))
114 |
115 | (define (>= x y)
116 | (not (< x y)))
117 |
118 |
119 | ;;EXERCISE 1.1
120 | ;: 10
121 |
122 | ;: (+ 5 3 4)
123 |
124 | ;: (- 9 1)
125 |
126 | ;: (/ 6 2)
127 |
128 | ;: (+ (* 2 4) (- 4 6))
129 |
130 | ;: (define a 3)
131 |
132 | ;: (define b (+ a 1))
133 |
134 | ;: (+ a b (* a b))
135 |
136 | ;: (= a b)
137 |
138 | ;: (if (and (> b a) (< b (* a b)))
139 | ;: b
140 | ;: a)
141 |
142 | ;: (cond ((= a 4) 6)
143 | ;: ((= b 4) (+ 6 7 a))
144 | ;: (else 25))
145 |
146 | ;: (+ 2 (if (> b a) b a))
147 |
148 | ;: (* (cond ((> a b) a)
149 | ;: ((< a b) b)
150 | ;: (else -1))
151 | ;: (+ a 1))
152 |
153 | ;;EXERCISE 1.4
154 | (define (a-plus-abs-b a b)
155 | ((if (> b 0) + -) a b))
156 |
157 | ;;EXERCISE 1.5
158 | (define (p) (p))
159 |
160 | (define (test x y)
161 | (if (= x 0)
162 | 0
163 | y))
164 |
165 | ;: (test 0 (p))
166 |
167 |
168 | ;;;SECTION 1.1.7
169 |
170 | (define (sqrt-iter guess x)
171 | (if (good-enough? guess x)
172 | guess
173 | (sqrt-iter (improve guess x)
174 | x)))
175 |
176 | (define (improve guess x)
177 | (average guess (/ x guess)))
178 |
179 | (define (average x y)
180 | (/ (+ x y) 2))
181 |
182 | (define (good-enough? guess x)
183 | (< (abs (- (square guess) x)) 0.001))
184 |
185 | (define (sqrt x)
186 | (sqrt-iter 1.0 x))
187 |
188 |
189 | ;: (sqrt 9)
190 | ;: (sqrt (+ 100 37))
191 | ;: (sqrt (+ (sqrt 2) (sqrt 3)))
192 | ;: (square (sqrt 1000))
193 |
194 |
195 | ;;EXERCISE 1.6
196 | (define (new-if predicate then-clause else-clause)
197 | (cond (predicate then-clause)
198 | (else else-clause)))
199 |
200 | ;: (new-if (= 2 3) 0 5)
201 |
202 | ;: (new-if (= 1 1) 0 5)
203 |
204 | (define (sqrt-iter guess x)
205 | (new-if (good-enough? guess x)
206 | guess
207 | (sqrt-iter (improve guess x)
208 | x)))
209 |
210 |
211 | ;;;SECTION 1.1.8
212 |
213 | (define (square x) (* x x))
214 |
215 | (define (square x)
216 | (exp (double (log x))))
217 |
218 | (define (double x) (+ x x))
219 |
220 |
221 | ;; As in 1.1.7
222 | (define (sqrt x)
223 | (sqrt-iter 1.0 x))
224 |
225 | (define (sqrt-iter guess x)
226 | (if (good-enough? guess x)
227 | guess
228 | (sqrt-iter (improve guess x) x)))
229 |
230 | (define (good-enough? guess x)
231 | (< (abs (- (square guess) x)) 0.001))
232 |
233 | (define (improve guess x)
234 | (average guess (/ x guess)))
235 |
236 |
237 | ;; Block-structured
238 | (define (sqrt x)
239 | (define (good-enough? guess x)
240 | (< (abs (- (square guess) x)) 0.001))
241 | (define (improve guess x)
242 | (average guess (/ x guess)))
243 | (define (sqrt-iter guess x)
244 | (if (good-enough? guess x)
245 | guess
246 | (sqrt-iter (improve guess x) x)))
247 | (sqrt-iter 1.0 x))
248 |
249 | ;; Taking advantage of lexical scoping
250 | (define (sqrt x)
251 | (define (good-enough? guess)
252 | (< (abs (- (square guess) x)) 0.001))
253 | (define (improve guess)
254 | (average guess (/ x guess)))
255 | (define (sqrt-iter guess)
256 | (if (good-enough? guess)
257 | guess
258 | (sqrt-iter (improve guess))))
259 | (sqrt-iter 1.0))
260 |
261 | ;;;SECTION 1.2.1
262 |
263 | ;; Recursive
264 |
265 | (define (factorial n)
266 | (if (= n 1)
267 | 1
268 | (* n (factorial (- n 1)))))
269 |
270 |
271 | ;; Iterative
272 |
273 | (define (factorial n)
274 | (fact-iter 1 1 n))
275 |
276 | (define (fact-iter product counter max-count)
277 | (if (> counter max-count)
278 | product
279 | (fact-iter (* counter product)
280 | (+ counter 1)
281 | max-count)))
282 |
283 | ;; Iterative, block-structured (from footnote)
284 | (define (factorial n)
285 | (define (iter product counter)
286 | (if (> counter n)
287 | product
288 | (iter (* counter product)
289 | (+ counter 1))))
290 | (iter 1 1))
291 |
292 |
293 | ;;EXERCISE 1.9
294 | (define (+ a b)
295 | (if (= a 0)
296 | b
297 | (inc (+ (dec a) b))))
298 |
299 | (define (+ a b)
300 | (if (= a 0)
301 | b
302 | (+ (dec a) (inc b))))
303 |
304 | ;;EXERCISE 1.10
305 | (define (A x y)
306 | (cond ((= y 0) 0)
307 | ((= x 0) (* 2 y))
308 | ((= y 1) 2)
309 | (else (A (- x 1)
310 | (A x (- y 1))))))
311 |
312 | ;: (A 1 10)
313 |
314 | ;: (A 2 4)
315 |
316 | ;: (A 3 3)
317 |
318 | (define (f n) (A 0 n))
319 |
320 | (define (g n) (A 1 n))
321 |
322 | (define (h n) (A 2 n))
323 |
324 | (define (k n) (* 5 n n))
325 |
326 |
327 | ;;;SECTION 1.2.2
328 |
329 | ;; Recursive
330 |
331 | (define (fib n)
332 | (cond ((= n 0) 0)
333 | ((= n 1) 1)
334 | (else (+ (fib (- n 1))
335 | (fib (- n 2))))))
336 |
337 | ;; Iterative
338 |
339 | (define (fib n)
340 | (fib-iter 1 0 n))
341 |
342 | (define (fib-iter a b count)
343 | (if (= count 0)
344 | b
345 | (fib-iter (+ a b) a (- count 1))))
346 |
347 |
348 | ;; Counting change
349 |
350 | (define (count-change amount)
351 | (cc amount 5))
352 |
353 | (define (cc amount kinds-of-coins)
354 | (cond ((= amount 0) 1)
355 | ((or (< amount 0) (= kinds-of-coins 0)) 0)
356 | (else (+ (cc amount
357 | (- kinds-of-coins 1))
358 | (cc (- amount
359 | (first-denomination kinds-of-coins))
360 | kinds-of-coins)))))
361 |
362 | (define (first-denomination kinds-of-coins)
363 | (cond ((= kinds-of-coins 1) 1)
364 | ((= kinds-of-coins 2) 5)
365 | ((= kinds-of-coins 3) 10)
366 | ((= kinds-of-coins 4) 25)
367 | ((= kinds-of-coins 5) 50)))
368 |
369 | ;: (count-change 100)
370 |
371 |
372 | ;;;SECTION 1.2.3
373 |
374 | ;;EXERCISE 1.15
375 | (define (cube x) (* x x x))
376 |
377 | (define (p x) (- (* 3 x) (* 4 (cube x))))
378 |
379 | (define (sine angle)
380 | (if (not (> (abs angle) 0.1))
381 | angle
382 | (p (sine (/ angle 3.0)))))
383 |
384 |
385 | ;;;SECTION 1.2.4
386 |
387 | ;; Linear recursion
388 | (define (expt b n)
389 | (if (= n 0)
390 | 1
391 | (* b (expt b (- n 1)))))
392 |
393 |
394 | ;; Linear iteration
395 | (define (expt b n)
396 | (expt-iter b n 1))
397 |
398 | (define (expt-iter b counter product)
399 | (if (= counter 0)
400 | product
401 | (expt-iter b
402 | (- counter 1)
403 | (* b product))))
404 |
405 | ;; Logarithmic iteration
406 | (define (fast-expt b n)
407 | (cond ((= n 0) 1)
408 | ((even? n) (square (fast-expt b (/ n 2))))
409 | (else (* b (fast-expt b (- n 1))))))
410 |
411 | (define (even? n)
412 | (= (remainder n 2) 0))
413 |
414 |
415 | ;;EXERCISE 1.17
416 | (define (* a b)
417 | (if (= b 0)
418 | 0
419 | (+ a (* a (- b 1)))))
420 |
421 | ;;EXERCISE 1.19
422 | (define (fib n)
423 | (fib-iter 1 0 0 1 n))
424 |
425 | (define (fib-iter a b p q count)
426 | (cond ((= count 0) b)
427 | ((even? count)
428 | (fib-iter a
429 | b
430 | ??FILL-THIS-IN?? ; compute p'
431 | ??FILL-THIS-IN?? ; compute q'
432 | (/ count 2)))
433 | (else (fib-iter (+ (* b q) (* a q) (* a p))
434 | (+ (* b p) (* a q))
435 | p
436 | q
437 | (- count 1)))))
438 |
439 |
440 | ;;;SECTION 1.2.5
441 |
442 | (define (gcd a b)
443 | (if (= b 0)
444 | a
445 | (gcd b (remainder a b))))
446 |
447 |
448 | ;;;SECTION 1.2.6
449 |
450 | ;; prime?
451 |
452 | (define (smallest-divisor n)
453 | (find-divisor n 2))
454 |
455 | (define (find-divisor n test-divisor)
456 | (cond ((> (square test-divisor) n) n)
457 | ((divides? test-divisor n) test-divisor)
458 | (else (find-divisor n (+ test-divisor 1)))))
459 |
460 | (define (divides? a b)
461 | (= (remainder b a) 0))
462 |
463 | (define (prime? n)
464 | (= n (smallest-divisor n)))
465 |
466 |
467 | ;; fast-prime?
468 |
469 | (define (expmod base exp m)
470 | (cond ((= exp 0) 1)
471 | ((even? exp)
472 | (remainder (square (expmod base (/ exp 2) m))
473 | m))
474 | (else
475 | (remainder (* base (expmod base (- exp 1) m))
476 | m))))
477 |
478 | (define (fermat-test n)
479 | (define (try-it a)
480 | (= (expmod a n n) a))
481 | (try-it (+ 1 (random (- n 1)))))
482 |
483 | (define (fast-prime? n times)
484 | (cond ((= times 0) true)
485 | ((fermat-test n) (fast-prime? n (- times 1)))
486 | (else false)))
487 |
488 |
489 | ;;EXERCISE 1.22
490 | (define (timed-prime-test n)
491 | (newline)
492 | (display n)
493 | (start-prime-test n (runtime)))
494 |
495 | (define (start-prime-test n start-time)
496 | (if (prime? n)
497 | (report-prime (- (runtime) start-time))))
498 |
499 | (define (report-prime elapsed-time)
500 | (display " *** ")
501 | (display elapsed-time))
502 |
503 | ;;EXERCISE 1.25
504 | (define (expmod base exp m)
505 | (remainder (fast-expt base exp) m))
506 |
507 | ;;EXERCISE 1.26
508 | (define (expmod base exp m)
509 | (cond ((= exp 0) 1)
510 | ((even? exp)
511 | (remainder (* (expmod base (/ exp 2) m)
512 | (expmod base (/ exp 2) m))
513 | m))
514 | (else
515 | (remainder (* base (expmod base (- exp 1) m))
516 | m))))
517 |
518 | ;;;SECTION 1.3
519 |
520 | (define (cube x) (* x x x))
521 |
522 | ;;;SECTION 1.3.1
523 |
524 | (define (sum-integers a b)
525 | (if (> a b)
526 | 0
527 | (+ a (sum-integers (+ a 1) b))))
528 |
529 | (define (sum-cubes a b)
530 | (if (> a b)
531 | 0
532 | (+ (cube a) (sum-cubes (+ a 1) b))))
533 |
534 | (define (pi-sum a b)
535 | (if (> a b)
536 | 0
537 | (+ (/ 1.0 (* a (+ a 2))) (pi-sum (+ a 4) b))))
538 |
539 | (define (sum term a next b)
540 | (if (> a b)
541 | 0
542 | (+ (term a)
543 | (sum term (next a) next b))))
544 |
545 |
546 | ;; Using sum
547 |
548 | (define (inc n) (+ n 1))
549 |
550 | (define (sum-cubes a b)
551 | (sum cube a inc b))
552 |
553 | ;: (sum-cubes 1 10)
554 |
555 |
556 | (define (identity x) x)
557 |
558 | (define (sum-integers a b)
559 | (sum identity a inc b))
560 |
561 | ;: (sum-integers 1 10)
562 |
563 |
564 | (define (pi-sum a b)
565 | (define (pi-term x)
566 | (/ 1.0 (* x (+ x 2))))
567 | (define (pi-next x)
568 | (+ x 4))
569 | (sum pi-term a pi-next b))
570 |
571 | ;: (* 8 (pi-sum 1 1000))
572 |
573 |
574 | (define (integral f a b dx)
575 | (define (add-dx x) (+ x dx))
576 | (* (sum f (+ a (/ dx 2)) add-dx b)
577 | dx))
578 |
579 | ;: (integral cube 0 1 0.01)
580 |
581 | ;: (integral cube 0 1 0.001)
582 |
583 |
584 | ;;EXERCISE 1.32
585 | ;: (accumulate combiner null-value term a next b)
586 |
587 | ;;;SECTION 1.3.2
588 |
589 | (define (pi-sum a b)
590 | (sum (lambda (x) (/ 1.0 (* x (+ x 2))))
591 | a
592 | (lambda (x) (+ x 4))
593 | b))
594 |
595 | (define (integral f a b dx)
596 | (* (sum f
597 | (+ a (/ dx 2.0))
598 | (lambda (x) (+ x dx))
599 | b)
600 | dx))
601 |
602 | (define (plus4 x) (+ x 4))
603 |
604 | (define plus4 (lambda (x) (+ x 4)))
605 |
606 | ;: ((lambda (x y z) (+ x y (square z))) 1 2 3)
607 |
608 |
609 | ;; Using let
610 |
611 | (define (f x y)
612 | (define (f-helper a b)
613 | (+ (* x (square a))
614 | (* y b)
615 | (* a b)))
616 | (f-helper (+ 1 (* x y))
617 | (- 1 y)))
618 |
619 | (define (f x y)
620 | ((lambda (a b)
621 | (+ (* x (square a))
622 | (* y b)
623 | (* a b)))
624 | (+ 1 (* x y))
625 | (- 1 y)))
626 |
627 | (define (f x y)
628 | (let ((a (+ 1 (* x y)))
629 | (b (- 1 y)))
630 | (+ (* x (square a))
631 | (* y b)
632 | (* a b))))
633 |
634 | ;: (+ (let ((x 3))
635 | ;: (+ x (* x 10)))
636 | ;: x)
637 |
638 | ;: (let ((x 3)
639 | ;: (y (+ x 2)))
640 | ;: (* x y))
641 |
642 | (define (f x y)
643 | (define a (+ 1 (* x y)))
644 | (define b (- 1 y))
645 | (+ (* x (square a))
646 | (* y b)
647 | (* a b)))
648 |
649 |
650 | ;;EXERCISE 1.34
651 | (define (f g)
652 | (g 2))
653 |
654 | ;: (f square)
655 |
656 | ;: (f (lambda (z) (* z (+ z 1))))
657 |
658 |
659 | ;;;SECTION 1.3.3
660 |
661 | ;; Half-interval method
662 |
663 | (define (search f neg-point pos-point)
664 | (let ((midpoint (average neg-point pos-point)))
665 | (if (close-enough? neg-point pos-point)
666 | midpoint
667 | (let ((test-value (f midpoint)))
668 | (cond ((positive? test-value)
669 | (search f neg-point midpoint))
670 | ((negative? test-value)
671 | (search f midpoint pos-point))
672 | (else midpoint))))))
673 |
674 | (define (close-enough? x y)
675 | (< (abs (- x y)) 0.001))
676 |
677 | (define (half-interval-method f a b)
678 | (let ((a-value (f a))
679 | (b-value (f b)))
680 | (cond ((and (negative? a-value) (positive? b-value))
681 | (search f a b))
682 | ((and (negative? b-value) (positive? a-value))
683 | (search f b a))
684 | (else
685 | (error "Values are not of opposite sign" a b)))))
686 |
687 |
688 | ;: (half-interval-method sin 2.0 4.0)
689 |
690 | ;: (half-interval-method (lambda (x) (- (* x x x) (* 2 x) 3))
691 | ;: 1.0
692 | ;: 2.0)
693 |
694 |
695 | ;; Fixed points
696 |
697 | (define tolerance 0.00001)
698 |
699 | (define (fixed-point f first-guess)
700 | (define (close-enough? v1 v2)
701 | (< (abs (- v1 v2)) tolerance))
702 | (define (try guess)
703 | (let ((next (f guess)))
704 | (if (close-enough? guess next)
705 | next
706 | (try next))))
707 | (try first-guess))
708 |
709 |
710 | ;: (fixed-point cos 1.0)
711 |
712 | ;: (fixed-point (lambda (y) (+ (sin y) (cos y)))
713 | ;: 1.0)
714 |
715 |
716 | (define (sqrt x)
717 | (fixed-point (lambda (y) (/ x y))
718 | 1.0))
719 |
720 | (define (sqrt x)
721 | (fixed-point (lambda (y) (average y (/ x y)))
722 | 1.0))
723 |
724 |
725 | ;;EXERCISE 1.37
726 | ;: (cont-frac (lambda (i) 1.0)
727 | ;: (lambda (i) 1.0)
728 | ;: k)
729 |
730 |
731 | ;;;SECTION 1.3.4
732 |
733 | (define (average-damp f)
734 | (lambda (x) (average x (f x))))
735 |
736 | ;: ((average-damp square) 10)
737 |
738 | (define (sqrt x)
739 | (fixed-point (average-damp (lambda (y) (/ x y)))
740 | 1.0))
741 |
742 | (define (cube-root x)
743 | (fixed-point (average-damp (lambda (y) (/ x (square y))))
744 | 1.0))
745 |
746 |
747 | ;; Newton's method
748 |
749 | (define (deriv g)
750 | (lambda (x)
751 | (/ (- (g (+ x dx)) (g x))
752 | dx)))
753 | (define dx 0.00001)
754 |
755 |
756 | (define (cube x) (* x x x))
757 |
758 | ;: ((deriv cube) 5)
759 |
760 | (define (newton-transform g)
761 | (lambda (x)
762 | (- x (/ (g x) ((deriv g) x)))))
763 |
764 | (define (newtons-method g guess)
765 | (fixed-point (newton-transform g) guess))
766 |
767 |
768 | (define (sqrt x)
769 | (newtons-method (lambda (y) (- (square y) x))
770 | 1.0))
771 |
772 |
773 | ;; Fixed point of transformed function
774 |
775 | (define (fixed-point-of-transform g transform guess)
776 | (fixed-point (transform g) guess))
777 |
778 | (define (sqrt x)
779 | (fixed-point-of-transform (lambda (y) (/ x y))
780 | average-damp
781 | 1.0))
782 |
783 | (define (sqrt x)
784 | (fixed-point-of-transform (lambda (y) (- (square y) x))
785 | newton-transform
786 | 1.0))
787 |
788 |
789 | ;;EXERCISE 1.40
790 | ;: (newtons-method (cubic a b c) 1)
791 |
792 |
793 | ;;EXERCISE 1.41
794 | ;: (((double (double double)) inc) 5)
795 |
796 |
797 | ;;EXERCISE 1.42
798 | ;: ((compose square inc) 6)
799 |
800 |
801 | ;;EXERCISE 1.43
802 | ;: ((repeated square 2) 5)
803 |
804 |
--------------------------------------------------------------------------------
/doc/r5rs-todo.txt:
--------------------------------------------------------------------------------
1 | -- procedure: quotient n1 n2
2 | -- procedure: remainder n1 n2
3 | -- procedure: modulo n1 n2
4 | These procedures implement number-theoretic (integer) division.
5 | N2 should be non-zero. All three procedures return integers. If
6 | N1/N2 is an integer:
7 |
8 | (quotient N1 N2) ==> N1/N2
9 | (remainder N1 N2) ==> 0
10 | (modulo N1 N2) ==> 0
11 |
12 | If N1/N2 is not an integer:
13 |
14 | (quotient N1 N2) ==> N_Q
15 | (remainder N1 N2) ==> N_R
16 | (modulo N1 N2) ==> N_M
17 |
18 | where N_Q is N1/N2 rounded towards zero, 0 < |N_R| < |N2|, 0 <
19 | |N_M| < |N2|, N_R and N_M differ from N1 by a multiple of N2, N_R
20 | has the same sign as N1, and N_M has the same sign as N2.
21 |
22 | From this we can conclude that for integers N1 and N2 with N2 not
23 | equal to 0,
24 |
25 | (= N1 (+ (* N2 (quotient N1 N2))
26 | (remainder N1 N2)))
27 | ==> #t
28 |
29 | provided all numbers involved in that computation are exact.
30 |
31 | (modulo 13 4) ==> 1
32 | (remainder 13 4) ==> 1
33 |
34 | (modulo -13 4) ==> 3
35 | (remainder -13 4) ==> -1
36 |
37 | (modulo 13 -4) ==> -3
38 | (remainder 13 -4) ==> 1
39 |
40 | (modulo -13 -4) ==> -1
41 | (remainder -13 -4) ==> -1
42 |
43 | (remainder -13 -4.0) ==> -1.0 ; inexact
44 |
45 |
46 | -- library procedure: gcd n1 ...,
47 | -- library procedure: lcm n1 ...,
48 | These procedures return the greatest common divisor or least common
49 | multiple of their arguments. The result is always non-negative.
50 |
51 | (gcd 32 -36) ==> 4
52 | (gcd) ==> 0
53 | (lcm 32 -36) ==> 288
54 | (lcm 32.0 -36) ==> 288.0 ; inexact
55 | (lcm) ==> 1
56 |
57 |
58 | -- procedure: numerator Q
59 | -- procedure: denominator Q
60 | These procedures return the numerator or denominator of their
61 | argument; the result is computed as if the argument was
62 | represented as a fraction in lowest terms. The denominator is
63 | always positive. The denominator of 0 is defined to be 1.
64 |
65 | (numerator (/ 6 4)) ==> 3
66 | (denominator (/ 6 4)) ==> 2
67 | (denominator
68 | (exact->inexact (/ 6 4))) ==> 2.0
69 |
70 |
71 | -- library procedure: rationalize x y
72 | `Rationalize' returns the _simplest_ rational number differing
73 | from X by no more than Y. A rational number r_1 is _simpler_
74 | than another rational number r_2 if r_1 = p_1/q_1 and r_2 =
75 | p_2/q_2 (in lowest terms) and |p_1|<= |p_2| and |q_1| <= |q_2|.
76 | Thus 3/5 is simpler than 4/7. Although not all rationals are
77 | comparable in this ordering (consider 2/7 and 3/5) any interval
78 | contains a rational number that is simpler than every other
79 | rational number in that interval (the simpler 2/5 lies between 2/7
80 | and 3/5). Note that 0 = 0/1 is the simplest rational of all.
81 |
82 | (rationalize
83 | (inexact->exact .3) 1/10) ==> 1/3 ; exact
84 | (rationalize .3 1/10) ==> #i1/3 ; inexact
85 |
86 |
87 | -- procedure: make-rectangular x1 x2
88 | -- procedure: make-polar x3 x4
89 | -- procedure: real-part Z
90 | -- procedure: imag-part Z
91 | -- procedure: magnitude Z
92 | -- procedure: angle Z
93 | These procedures are part of every implementation that supports
94 | general complex numbers. Suppose X1, X2, X3, and X4 are real
95 | numbers and Z is a complex number such that
96 |
97 | Z = X1 + X2i = X3 . e^i X4
98 |
99 | Then
100 |
101 | (make-rectangular X1 X2) ==> Z
102 | (make-polar X3 X4) ==> Z
103 | (real-part Z) ==> X1
104 | (imag-part Z) ==> X2
105 | (magnitude Z) ==> |X3|
106 | (angle Z) ==> x_angle
107 |
108 | where -pi < x_angle <= pi with x_angle = X4 + 2pi n for some
109 | integer n.
110 |
111 | _Rationale:_ `Magnitude' is the same as `abs' for a real
112 | argument, but `abs' must be present in all implementations,
113 | whereas `magnitude' need only be present in implementations
114 | that support general complex numbers.
115 |
116 |
117 | -- procedure: exact->inexact Z
118 | -- procedure: inexact->exact Z
119 | `Exact->inexact' returns an inexact representation of Z. The
120 | value returned is the inexact number that is numerically closest
121 | to the argument. If an exact argument has no reasonably close
122 | inexact equivalent, then a violation of an implementation
123 | restriction may be reported.
124 |
125 | `Inexact->exact' returns an exact representation of Z. The value
126 | returned is the exact number that is numerically closest to the
127 | argument. If an inexact argument has no reasonably close exact
128 | equivalent, then a violation of an implementation restriction may
129 | be reported.
130 |
131 | These procedures implement the natural one-to-one correspondence
132 | between exact and inexact integers throughout an
133 | implementation-dependent range. See section *note Implementation
134 | restrictions::.
135 |
136 | 6.2.6 Numerical input and output
137 | --------------------------------
138 |
139 | -- procedure: number->string z
140 | -- procedure: number->string z radix
141 | RADIX must be an exact integer, either 2, 8, 10, or 16. If
142 | omitted, RADIX defaults to 10. The procedure `number->string'
143 | takes a number and a radix and returns as a string an external
144 | representation of the given number in the given radix such that
145 |
146 | (let ((number NUMBER)
147 | (radix RADIX))
148 | (eqv? number
149 | (string->number (number->string number
150 | radix)
151 | radix)))
152 |
153 | is true. It is an error if no possible result makes this
154 | expression true.
155 |
156 | If Z is inexact, the radix is 10, and the above expression can be
157 | satisfied by a result that contains a decimal point, then the
158 | result contains a decimal point and is expressed using the minimum
159 | number of digits (exclusive of exponent and trailing zeroes)
160 | needed to make the above expression true [howtoprint], [howtoread];
161 | otherwise the format of the result is unspecified.
162 |
163 | The result returned by `number->string' never contains an explicit
164 | radix prefix.
165 |
166 | _Note:_ The error case can occur only when Z is not a complex
167 | number or is a complex number with a non-rational real or
168 | imaginary part.
169 |
170 | _Rationale:_ If Z is an inexact number represented using
171 | flonums, and the radix is 10, then the above expression is
172 | normally satisfied by a result containing a decimal point.
173 | The unspecified case allows for infinities, NaNs, and
174 | non-flonum representations.
175 |
176 |
177 | -- procedure: string->number string
178 | -- procedure: string->number string radix
179 | Returns a number of the maximally precise representation expressed
180 | by the given STRING. RADIX must be an exact integer, either 2, 8,
181 | 10, or 16. If supplied, RADIX is a default radix that may be
182 | overridden by an explicit radix prefix in STRING (e.g. "#o177").
183 | If RADIX is not supplied, then the default radix is 10. If STRING
184 | is not a syntactically valid notation for a number, then
185 | `string->number' returns #f.
186 |
187 | (string->number "100") ==> 100
188 | (string->number "100" 16) ==> 256
189 | (string->number "1e2") ==> 100.0
190 | (string->number "15##") ==> 1500.0
191 |
192 | _Note:_ The domain of `string->number' may be restricted by
193 | implementations in the following ways. `String->number' is
194 | permitted to return #f whenever STRING contains an explicit
195 | radix prefix. If all numbers supported by an implementation
196 | are real, then `string->number' is permitted to return #f
197 | whenever STRING uses the polar or rectangular notations for
198 | complex numbers. If all numbers are integers, then
199 | `string->number' may return #f whenever the fractional
200 | notation is used. If all numbers are exact, then
201 | `string->number' may return #f whenever an exponent marker or
202 | explicit exactness prefix is used, or if a # appears in place
203 | of a digit. If all inexact numbers are integers, then
204 | `string->number' may return #f whenever a decimal point is
205 | used.
206 |
207 |
208 | 6.3 Other data types
209 | ====================
210 |
211 | This section describes operations on some of Scheme's non-numeric data
212 | types: booleans, pairs, lists, symbols, characters, strings and vectors.
213 |
214 | 6.3.2 Pairs and lists
215 | ---------------------
216 | -- library procedure: caar pair
217 | -- library procedure: cadr pair
218 | -- : ...
219 | -- library procedure: cdddar pair
220 | -- library procedure: cddddr pair
221 | These procedures are compositions of `car' and `cdr', where for
222 | example `caddr' could be defined by
223 |
224 | (define caddr (lambda (x) (car (cdr (cdr x))))).
225 |
226 | Arbitrary compositions, up to four deep, are provided. There are
227 | twenty-eight of these procedures in all.
228 |
229 | -- library procedure: reverse list
230 | Returns a newly allocated list consisting of the elements of LIST
231 | in reverse order.
232 |
233 | (reverse '(a b c)) ==> (c b a)
234 | (reverse '(a (b c) d (e (f))))
235 | ==> ((e (f)) d (b c) a)
236 |
237 |
238 | -- library procedure: list-tail list K
239 | Returns the sublist of LIST obtained by omitting the first K
240 | elements. It is an error if LIST has fewer than K elements.
241 | `List-tail' could be defined by
242 |
243 | (define list-tail
244 | (lambda (x k)
245 | (if (zero? k)
246 | x
247 | (list-tail (cdr x) (- k 1)))))
248 |
249 |
250 | -- library procedure: list-ref list K
251 | Returns the Kth element of LIST. (This is the same as the car of
252 | (list-tail LIST K).) It is an error if LIST has fewer than K
253 | elements.
254 |
255 | (list-ref '(a b c d) 2) ==> c
256 | (list-ref '(a b c d)
257 | (inexact->exact (round 1.8)))
258 | ==> c
259 |
260 |
261 | -- library procedure: memq obj list
262 | -- library procedure: memv obj list
263 | -- library procedure: member obj list
264 | These procedures return the first sublist of LIST whose car is
265 | OBJ, where the sublists of LIST are the non-empty lists returned
266 | by (list-tail LIST K) for K less than the length of LIST. If OBJ
267 | does not occur in LIST, then #f (not the empty list) is returned.
268 | `Memq' uses `eq?' to compare OBJ with the elements of LIST, while
269 | `memv' uses `eqv?' and `member' uses `equal?'.
270 |
271 | (memq 'a '(a b c)) ==> (a b c)
272 | (memq 'b '(a b c)) ==> (b c)
273 | (memq 'a '(b c d)) ==> #f
274 | (memq (list 'a) '(b (a) c)) ==> #f
275 | (member (list 'a)
276 | '(b (a) c)) ==> ((a) c)
277 | (memq 101 '(100 101 102)) ==> _unspecified_
278 | (memv 101 '(100 101 102)) ==> (101 102)
279 |
280 |
281 | -- library procedure: assq obj alist
282 | -- library procedure: assv obj alist
283 | -- library procedure: assoc obj alist
284 | ALIST (for "association list") must be a list of pairs. These
285 | procedures find the first pair in ALIST whose car field is OBJ,
286 | and returns that pair. If no pair in ALIST has OBJ as its car,
287 | then #f (not the empty list) is returned. `Assq' uses `eq?' to
288 | compare OBJ with the car fields of the pairs in ALIST, while
289 | `assv' uses `eqv?' and `assoc' uses `equal?'.
290 |
291 | (define e '((a 1) (b 2) (c 3)))
292 | (assq 'a e) ==> (a 1)
293 | (assq 'b e) ==> (b 2)
294 | (assq 'd e) ==> #f
295 | (assq (list 'a) '(((a)) ((b)) ((c))))
296 | ==> #f
297 | (assoc (list 'a) '(((a)) ((b)) ((c))))
298 | ==> ((a))
299 | (assq 5 '((2 3) (5 7) (11 13)))
300 | ==> _unspecified_
301 | (assv 5 '((2 3) (5 7) (11 13)))
302 | ==> (5 7)
303 |
304 | _Rationale:_ Although they are ordinarily used as predicates,
305 | `memq', `memv', `member', `assq', `assv', and `assoc' do not
306 | have question marks in their names because they return useful
307 | values rather than just #t or #f.
308 |
309 | 6.4 Control features
310 | ====================
311 |
312 | -- procedure: apply proc arg1 ... args
313 | PROC must be a procedure and ARGS must be a list. Calls PROC with
314 | the elements of the list `(append (list ARG1 ...,) ARGS)' as the
315 | actual arguments.
316 |
317 | (apply + (list 3 4)) ==> 7
318 |
319 | (define compose
320 | (lambda (f g)
321 | (lambda args
322 | (f (apply g args)))))
323 |
324 | ((compose sqrt *) 12 75) ==> 30
325 |
326 |
327 | -- library procedure: map proc list1 list2 ...,
328 | The LISTs must be lists, and PROC must be a procedure taking as
329 | many arguments as there are lists and returning a single value.
330 | If more than one LIST is given, then they must all be the same
331 | length. `Map' applies PROC element-wise to the elements of the
332 | LISTs and returns a list of the results, in order. The dynamic
333 | order in which PROC is applied to the elements of the LISTs is
334 | unspecified.
335 |
336 | (map cadr '((a b) (d e) (g h)))
337 | ==> (b e h)
338 |
339 | (map (lambda (n) (expt n n))
340 | '(1 2 3 4 5))
341 | ==> (1 4 27 256 3125)
342 |
343 | (map + '(1 2 3) '(4 5 6)) ==> (5 7 9)
344 |
345 | (let ((count 0))
346 | (map (lambda (ignored)
347 | (set! count (+ count 1))
348 | count)
349 | '(a b))) ==> (1 2) OR (2 1)
350 |
351 |
352 | -- library procedure: for-each proc list1 list2 ...,
353 | The arguments to `for-each' are like the arguments to `map', but
354 | `for-each' calls PROC for its side effects rather than for its
355 | values. Unlike `map', `for-each' is guaranteed to call PROC on
356 | the elements of the LISTs in order from the first element(s) to the
357 | last, and the value returned by `for-each' is unspecified.
358 |
359 | (let ((v (make-vector 5)))
360 | (for-each (lambda (i)
361 | (vector-set! v i (* i i)))
362 | '(0 1 2 3 4))
363 | v) ==> #(0 1 4 9 16)
364 |
365 |
366 | -- library procedure: force promise
367 | Forces the value of PROMISE (see `delay', section *note Delayed
368 | evaluation::). If no value has been computed for the promise,
369 | then a value is computed and returned. The value of the promise
370 | is cached (or "memoized") so that if it is forced a second time,
371 | the previously computed value is returned.
372 |
373 | (force (delay (+ 1 2))) ==> 3
374 | (let ((p (delay (+ 1 2))))
375 | (list (force p) (force p)))
376 | ==> (3 3)
377 |
378 | (define a-stream
379 | (letrec ((next
380 | (lambda (n)
381 | (cons n (delay (next (+ n 1)))))))
382 | (next 0)))
383 | (define head car)
384 | (define tail
385 | (lambda (stream) (force (cdr stream))))
386 |
387 | (head (tail (tail a-stream)))
388 | ==> 2
389 |
390 | `Force' and `delay' are mainly intended for programs written in
391 | functional style. The following examples should not be considered
392 | to illustrate good programming style, but they illustrate the
393 | property that only one value is computed for a promise, no matter
394 | how many times it is forced.
395 |
396 | (define count 0)
397 | (define p
398 | (delay (begin (set! count (+ count 1))
399 | (if (> count x)
400 | count
401 | (force p)))))
402 | (define x 5)
403 | p ==> a promise
404 | (force p) ==> 6
405 | p ==> a promise, still
406 | (begin (set! x 10)
407 | (force p)) ==> 6
408 |
409 | Here is a possible implementation of `delay' and `force'.
410 | Promises are implemented here as procedures of no arguments, and
411 | `force' simply calls its argument:
412 |
413 | (define force
414 | (lambda (object)
415 | (object)))
416 |
417 | We define the expression
418 |
419 | (delay )
420 |
421 | to have the same meaning as the procedure call
422 |
423 | (make-promise (lambda () ))
424 |
425 | as follows
426 |
427 | (define-syntax delay
428 | (syntax-rules ()
429 | ((delay expression)
430 | (make-promise (lambda () expression))))),
431 |
432 | where `make-promise' is defined as follows:
433 |
434 | (define make-promise
435 | (lambda (proc)
436 | (let ((result-ready? #f)
437 | (result #f))
438 | (lambda ()
439 | (if result-ready?
440 | result
441 | (let ((x (proc)))
442 | (if result-ready?
443 | result
444 | (begin (set! result-ready? #t)
445 | (set! result x)
446 | result))))))))
447 |
448 | _Rationale:_ A promise may refer to its own value, as in the
449 | last example above. Forcing such a promise may cause the
450 | promise to be forced a second time before the value of the
451 | first force has been computed. This complicates the
452 | definition of `make-promise'.
453 |
454 | Various extensions to this semantics of `delay' and `force' are
455 | supported in some implementations:
456 |
457 | * Calling `force' on an object that is not a promise may simply
458 | return the object.
459 |
460 | * It may be the case that there is no means by which a promise
461 | can be operationally distinguished from its forced value.
462 | That is, expressions like the following may evaluate to
463 | either #t or to #f, depending on the implementation:
464 |
465 | (eqv? (delay 1) 1) ==> _unspecified_
466 | (pair? (delay (cons 1 2))) ==> _unspecified_
467 |
468 | * Some implementations may implement "implicit forcing," where
469 | the value of a promise is forced by primitive procedures like
470 | `cdr' and `+':
471 |
472 | (+ (delay (* 3 7)) 13) ==> 34
473 |
474 |
475 |
476 | -- procedure: call-with-current-continuation proc
477 | PROC must be a procedure of one argument. The procedure
478 | `call-with-current-continuation' packages up the current
479 | continuation (see the rationale below) as an "escape procedure"
480 | and passes it as an argument to PROC. The escape procedure is a
481 | Scheme procedure that, if it is later called, will abandon
482 | whatever continuation is in effect at that later time and will
483 | instead use the continuation that was in effect when the escape
484 | procedure was created. Calling the escape procedure may cause the
485 | invocation of BEFORE and AFTER thunks installed using
486 | `dynamic-wind'.
487 |
488 | The escape procedure accepts the same number of arguments as the
489 | continuation to the original call to
490 | call-with-current-continuation. Except for continuations created
491 | by the `call-with-values' procedure, all continuations take
492 | exactly one value. The effect of passing no value or more than
493 | one value to continuations that were not created by
494 | call-with-values is unspecified.
495 |
496 | The escape procedure that is passed to PROC has unlimited extent
497 | just like any other procedure in Scheme. It may be stored in
498 | variables or data structures and may be called as many times as
499 | desired.
500 |
501 | The following examples show only the most common ways in which
502 | `call-with-current-continuation' is used. If all real uses were as
503 | simple as these examples, there would be no need for a procedure
504 | with the power of `call-with-current-continuation'.
505 |
506 | (call-with-current-continuation
507 | (lambda (exit)
508 | (for-each (lambda (x)
509 | (if (negative? x)
510 | (exit x)))
511 | '(54 0 37 -3 245 19))
512 | #t)) ==> -3
513 |
514 | (define list-length
515 | (lambda (obj)
516 | (call-with-current-continuation
517 | (lambda (return)
518 | (letrec ((r
519 | (lambda (obj)
520 | (cond ((null? obj) 0)
521 | ((pair? obj)
522 | (+ (r (cdr obj)) 1))
523 | (else (return #f))))))
524 | (r obj))))))
525 |
526 | (list-length '(1 2 3 4)) ==> 4
527 |
528 | (list-length '(a b . c)) ==> #f
529 |
530 | _Rationale:_
531 |
532 | A common use of `call-with-current-continuation' is for
533 | structured, non-local exits from loops or procedure bodies,
534 | but in fact `call-with-current-continuation' is extremely
535 | useful for implementing a wide variety of advanced control
536 | structures.
537 |
538 | Whenever a Scheme expression is evaluated there is a
539 | "continuation" wanting the result of the expression. The
540 | continuation represents an entire (default) future for the
541 | computation. If the expression is evaluated at top level,
542 | for example, then the continuation might take the result,
543 | print it on the screen, prompt for the next input, evaluate
544 | it, and so on forever. Most of the time the continuation
545 | includes actions specified by user code, as in a continuation
546 | that will take the result, multiply it by the value stored in
547 | a local variable, add seven, and give the answer to the top
548 | level continuation to be printed. Normally these ubiquitous
549 | continuations are hidden behind the scenes and programmers do
550 | not think much about them. On rare occasions, however, a
551 | programmer may need to deal with continuations explicitly.
552 | `Call-with-current-continuation' allows Scheme programmers to
553 | do that by creating a procedure that acts just like the
554 | current continuation.
555 |
556 | Most programming languages incorporate one or more
557 | special-purpose escape constructs with names like exit,
558 | `return', or even goto. In 1965, however, Peter Landin
559 | [Landin65] invented a general purpose escape operator called
560 | the J-operator. John Reynolds [Reynolds72] described a
561 | simpler but equally powerful construct in 1972. The `catch'
562 | special form described by Sussman and Steele in the 1975
563 | report on Scheme is exactly the same as Reynolds's construct,
564 | though its name came from a less general construct in
565 | MacLisp. Several Scheme implementors noticed that the full
566 | power of the `catch' construct could be provided by a
567 | procedure instead of by a special syntactic construct, and
568 | the name `call-with-current-continuation' was coined in 1982.
569 | This name is descriptive, but opinions differ on the merits
570 | of such a long name, and some people use the name `call/cc'
571 | instead.
572 |
573 |
574 | -- procedure: values obj ...
575 | Delivers all of its arguments to its continuation. Except for
576 | continuations created by the `call-with-values' procedure, all
577 | continuations take exactly one value. Values might be defined as
578 | follows:
579 |
580 | (define (values . things)
581 | (call-with-current-continuation
582 | (lambda (cont) (apply cont things))))
583 |
584 |
585 | -- procedure: call-with-values producer consumer
586 | Calls its PRODUCER argument with no values and a continuation
587 | that, when passed some values, calls the CONSUMER procedure with
588 | those values as arguments. The continuation for the call to
589 | CONSUMER is the continuation of the call to call-with-values.
590 |
591 | (call-with-values (lambda () (values 4 5))
592 | (lambda (a b) b))
593 | ==> 5
594 |
595 | (call-with-values * -) ==> -1
596 |
597 |
598 | -- procedure: dynamic-wind before thunk after
599 | Calls THUNK without arguments, returning the result(s) of this
600 | call. BEFORE and AFTER are called, also without arguments, as
601 | required by the following rules (note that in the absence of calls
602 | to continuations captured using `call-with-current-continuation'
603 | the three arguments are called once each, in order). BEFORE is
604 | called whenever execution enters the dynamic extent of the call to
605 | THUNK and AFTER is called whenever it exits that dynamic extent.
606 | The dynamic extent of a procedure call is the period between when
607 | the call is initiated and when it returns. In Scheme, because of
608 | `call-with-current-continuation', the dynamic extent of a call may
609 | not be a single, connected time period. It is defined as follows:
610 |
611 | * The dynamic extent is entered when execution of the body of
612 | the called procedure begins.
613 |
614 | * The dynamic extent is also entered when execution is not
615 | within the dynamic extent and a continuation is invoked that
616 | was captured (using `call-with-current-continuation') during
617 | the dynamic extent.
618 |
619 | * It is exited when the called procedure returns.
620 |
621 | * It is also exited when execution is within the dynamic extent
622 | and a continuation is invoked that was captured while not
623 | within the dynamic extent.
624 |
625 |
626 | If a second call to `dynamic-wind' occurs within the dynamic
627 | extent of the call to THUNK and then a continuation is invoked in
628 | such a way that the AFTERs from these two invocations of
629 | `dynamic-wind' are both to be called, then the AFTER associated
630 | with the second (inner) call to `dynamic-wind' is called first.
631 |
632 | If a second call to `dynamic-wind' occurs within the dynamic
633 | extent of the call to THUNK and then a continuation is invoked in
634 | such a way that the BEFOREs from these two invocations of
635 | `dynamic-wind' are both to be called, then the BEFORE associated
636 | with the first (outer) call to `dynamic-wind' is called first.
637 |
638 | If invoking a continuation requires calling the BEFORE from one
639 | call to `dynamic-wind' and the AFTER from another, then the AFTER
640 | is called first.
641 |
642 | The effect of using a captured continuation to enter or exit the
643 | dynamic extent of a call to BEFORE or AFTER is undefined.
644 |
645 | (let ((path '())
646 | (c #f))
647 | (let ((add (lambda (s)
648 | (set! path (cons s path)))))
649 | (dynamic-wind
650 | (lambda () (add 'connect))
651 | (lambda ()
652 | (add (call-with-current-continuation
653 | (lambda (c0)
654 | (set! c c0)
655 | 'talk1))))
656 | (lambda () (add 'disconnect)))
657 | (if (< (length path) 4)
658 | (c 'talk2)
659 | (reverse path))))
660 |
661 | ==> (connect talk1 disconnect
662 | connect talk2 disconnect)
663 |
664 |
665 | 6.5 Eval
666 | ========
667 |
668 | -- procedure: eval expression environment-specifier
669 | Evaluates EXPRESSION in the specified environment and returns its
670 | value. EXPRESSION must be a valid Scheme expression represented
671 | as data, and ENVIRONMENT-SPECIFIER must be a value returned by one
672 | of the three procedures described below. Implementations may
673 | extend `eval' to allow non-expression programs (definitions) as
674 | the first argument and to allow other values as environments, with
675 | the restriction that `eval' is not allowed to create new bindings
676 | in the environments associated with `null-environment' or
677 | `scheme-report-environment'.
678 |
679 | (eval '(* 7 3) (scheme-report-environment 5))
680 | ==> 21
681 |
682 | (let ((f (eval '(lambda (f x) (f x x))
683 | (null-environment 5))))
684 | (f + 10))
685 | ==> 20
686 |
687 |
688 | 6.6 Input and output
689 | ====================
690 |
691 | 6.6.1 Ports
692 | -----------
693 |
694 | Ports represent input and output devices. To Scheme, an input port is a
695 | Scheme object that can deliver characters upon command, while an output
696 | port is a Scheme object that can accept characters.
697 |
698 | -- library procedure: call-with-input-file string proc
699 | -- library procedure: call-with-output-file string proc
700 | STRING should be a string naming a file, and PROC should be a
701 | procedure that accepts one argument. For `call-with-input-file',
702 | the file should already exist; for `call-with-output-file', the
703 | effect is unspecified if the file already exists. These procedures
704 | call PROC with one argument: the port obtained by opening the
705 | named file for input or output. If the file cannot be opened, an
706 | error is signalled. If PROC returns, then the port is closed
707 | automatically and the value(s) yielded by the PROC is(are)
708 | returned. If PROC does not return, then the port will not be
709 | closed automatically unless it is possible to prove that the port
710 | will never again be used for a read or write operation.
711 |
712 | _Rationale:_ Because Scheme's escape procedures have
713 | unlimited extent, it is possible to escape from the current
714 | continuation but later to escape back in. If implementations
715 | were permitted to close the port on any escape from the
716 | current continuation, then it would be impossible to write
717 | portable code using both `call-with-current-continuation' and
718 | `call-with-input-file' or `call-with-output-file'.
719 |
720 | -- optional procedure: with-input-from-file string thunk
721 | -- optional procedure: with-output-to-file string thunk
722 | STRING should be a string naming a file, and PROC should be a
723 | procedure of no arguments. For `with-input-from-file', the file
724 | should already exist; for `with-output-to-file', the effect is
725 | unspecified if the file already exists. The file is opened for
726 | input or output, an input or output port connected to it is made
727 | the default value returned by `current-input-port' or
728 | `current-output-port' (and is used by (read), (write OBJ), and so
729 | forth), and the THUNK is called with no arguments. When the THUNK
730 | returns, the port is closed and the previous default is restored.
731 | `With-input-from-file' and `with-output-to-file' return(s) the
732 | value(s) yielded by THUNK. If an escape procedure is used to
733 | escape from the continuation of these procedures, their behavior
734 | is implementation dependent.
735 |
736 |
737 | 6.6.2 Input
738 | -----------
739 |
740 | -- library procedure: read
741 | -- library procedure: read port
742 | `Read' converts external representations of Scheme objects into the
743 | objects themselves. That is, it is a parser for the nonterminal
744 | (see sections *note External representation:: and *note
745 | Pairs and lists::). `Read' returns the next object parsable from
746 | the given input PORT, updating PORT to point to the first
747 | character past the end of the external representation of the
748 | object.
749 |
750 | If an end of file is encountered in the input before any
751 | characters are found that can begin an object, then an end of file
752 | object is returned. The port remains open, and further attempts
753 | to read will also return an end of file object. If an end of file
754 | is encountered after the beginning of an object's external
755 | representation, but the external representation is incomplete and
756 | therefore not parsable, an error is signalled.
757 |
758 | The PORT argument may be omitted, in which case it defaults to the
759 | value returned by `current-input-port'. It is an error to read
760 | from a closed port.
761 |
762 | -- procedure: char-ready?
763 | -- procedure: char-ready? port
764 | Returns #t if a character is ready on the input PORT and returns
765 | #f otherwise. If `char-ready' returns #t then the next
766 | `read-char' operation on the given PORT is guaranteed not to hang.
767 | If the PORT is at end of file then `char-ready?' returns #t. PORT
768 | may be omitted, in which case it defaults to the value returned by
769 | `current-input-port'.
770 |
771 | _Rationale:_ `Char-ready?' exists to make it possible for a
772 | program to accept characters from interactive ports without
773 | getting stuck waiting for input. Any input editors
774 | associated with such ports must ensure that characters whose
775 | existence has been asserted by `char-ready?' cannot be rubbed
776 | out. If `char-ready?' were to return #f at end of file, a
777 | port at end of file would be indistinguishable from an
778 | interactive port that has no ready characters.
779 |
780 |
781 | 6.6.4 System interface
782 | ----------------------
783 |
784 | -- optional procedure: transcript-on filename
785 | -- optional procedure: transcript-off
786 | FILENAME must be a string naming an output file to be created. The
787 | effect of `transcript-on' is to open the named file for output,
788 | and to cause a transcript of subsequent interaction between the
789 | user and the Scheme system to be written to the file. The
790 | transcript is ended by a call to `transcript-off', which closes the
791 | transcript file. Only one transcript may be in progress at any
792 | time, though some implementations may relax this restriction. The
793 | values returned by these procedures are unspecified.
794 |
--------------------------------------------------------------------------------
/Doxyfile:
--------------------------------------------------------------------------------
1 | # Doxyfile 1.8.3.1
2 |
3 | # This file describes the settings to be used by the documentation system
4 | # doxygen (www.doxygen.org) for a project.
5 | #
6 | # All text after a hash (#) is considered a comment and will be ignored.
7 | # The format is:
8 | # TAG = value [value, ...]
9 | # For lists items can also be appended using:
10 | # TAG += value [value, ...]
11 | # Values that contain spaces should be placed between quotes (" ").
12 |
13 | #---------------------------------------------------------------------------
14 | # Project related configuration options
15 | #---------------------------------------------------------------------------
16 |
17 | # This tag specifies the encoding used for all characters in the config file
18 | # that follow. The default is UTF-8 which is also the encoding used for all
19 | # text before the first occurrence of this tag. Doxygen uses libiconv (or the
20 | # iconv built into libc) for the transcoding. See
21 | # http://www.gnu.org/software/libiconv for the list of possible encodings.
22 |
23 | DOXYFILE_ENCODING = UTF-8
24 |
25 | # The PROJECT_NAME tag is a single word (or sequence of words) that should
26 | # identify the project. Note that if you do not use Doxywizard you need
27 | # to put quotes around the project name if it contains spaces.
28 |
29 | PROJECT_NAME = "Atom"
30 |
31 | # The PROJECT_NUMBER tag can be used to enter a project or revision number.
32 | # This could be handy for archiving the generated documentation or
33 | # if some version control system is used.
34 |
35 | PROJECT_NUMBER =
36 |
37 | # Using the PROJECT_BRIEF tag one can provide an optional one line description
38 | # for a project that appears at the top of each page and should give viewer
39 | # a quick idea about the purpose of the project. Keep the description short.
40 |
41 | PROJECT_BRIEF =
42 |
43 | # With the PROJECT_LOGO tag one can specify an logo or icon that is
44 | # included in the documentation. The maximum height of the logo should not
45 | # exceed 55 pixels and the maximum width should not exceed 200 pixels.
46 | # Doxygen will copy the logo to the output directory.
47 |
48 | PROJECT_LOGO =
49 |
50 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
51 | # base path where the generated documentation will be put.
52 | # If a relative path is entered, it will be relative to the location
53 | # where doxygen was started. If left blank the current directory will be used.
54 |
55 | OUTPUT_DIRECTORY =
56 |
57 | # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
58 | # 4096 sub-directories (in 2 levels) under the output directory of each output
59 | # format and will distribute the generated files over these directories.
60 | # Enabling this option can be useful when feeding doxygen a huge amount of
61 | # source files, where putting all generated files in the same directory would
62 | # otherwise cause performance problems for the file system.
63 |
64 | CREATE_SUBDIRS = NO
65 |
66 | # The OUTPUT_LANGUAGE tag is used to specify the language in which all
67 | # documentation generated by doxygen is written. Doxygen will use this
68 | # information to generate all constant output in the proper language.
69 | # The default language is English, other supported languages are:
70 | # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
71 | # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
72 | # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
73 | # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
74 | # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
75 | # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
76 |
77 | OUTPUT_LANGUAGE = English
78 |
79 | # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
80 | # include brief member descriptions after the members that are listed in
81 | # the file and class documentation (similar to JavaDoc).
82 | # Set to NO to disable this.
83 |
84 | BRIEF_MEMBER_DESC = YES
85 |
86 | # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
87 | # the brief description of a member or function before the detailed description.
88 | # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
89 | # brief descriptions will be completely suppressed.
90 |
91 | REPEAT_BRIEF = YES
92 |
93 | # This tag implements a quasi-intelligent brief description abbreviator
94 | # that is used to form the text in various listings. Each string
95 | # in this list, if found as the leading text of the brief description, will be
96 | # stripped from the text and the result after processing the whole list, is
97 | # used as the annotated text. Otherwise, the brief description is used as-is.
98 | # If left blank, the following values are used ("$name" is automatically
99 | # replaced with the name of the entity): "The $name class" "The $name widget"
100 | # "The $name file" "is" "provides" "specifies" "contains"
101 | # "represents" "a" "an" "the"
102 |
103 | ABBREVIATE_BRIEF =
104 |
105 | # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
106 | # Doxygen will generate a detailed section even if there is only a brief
107 | # description.
108 |
109 | ALWAYS_DETAILED_SEC = NO
110 |
111 | # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
112 | # inherited members of a class in the documentation of that class as if those
113 | # members were ordinary class members. Constructors, destructors and assignment
114 | # operators of the base classes will not be shown.
115 |
116 | INLINE_INHERITED_MEMB = NO
117 |
118 | # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
119 | # path before files name in the file list and in the header files. If set
120 | # to NO the shortest path that makes the file name unique will be used.
121 |
122 | FULL_PATH_NAMES = YES
123 |
124 | # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
125 | # can be used to strip a user-defined part of the path. Stripping is
126 | # only done if one of the specified strings matches the left-hand part of
127 | # the path. The tag can be used to show relative paths in the file list.
128 | # If left blank the directory from which doxygen is run is used as the
129 | # path to strip. Note that you specify absolute paths here, but also
130 | # relative paths, which will be relative from the directory where doxygen is
131 | # started.
132 |
133 | STRIP_FROM_PATH =
134 |
135 | # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
136 | # the path mentioned in the documentation of a class, which tells
137 | # the reader which header file to include in order to use a class.
138 | # If left blank only the name of the header file containing the class
139 | # definition is used. Otherwise one should specify the include paths that
140 | # are normally passed to the compiler using the -I flag.
141 |
142 | STRIP_FROM_INC_PATH =
143 |
144 | # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
145 | # (but less readable) file names. This can be useful if your file system
146 | # doesn't support long names like on DOS, Mac, or CD-ROM.
147 |
148 | SHORT_NAMES = NO
149 |
150 | # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
151 | # will interpret the first line (until the first dot) of a JavaDoc-style
152 | # comment as the brief description. If set to NO, the JavaDoc
153 | # comments will behave just like regular Qt-style comments
154 | # (thus requiring an explicit @brief command for a brief description.)
155 |
156 | JAVADOC_AUTOBRIEF = NO
157 |
158 | # If the QT_AUTOBRIEF tag is set to YES then Doxygen will
159 | # interpret the first line (until the first dot) of a Qt-style
160 | # comment as the brief description. If set to NO, the comments
161 | # will behave just like regular Qt-style comments (thus requiring
162 | # an explicit \brief command for a brief description.)
163 |
164 | QT_AUTOBRIEF = NO
165 |
166 | # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
167 | # treat a multi-line C++ special comment block (i.e. a block of //! or ///
168 | # comments) as a brief description. This used to be the default behaviour.
169 | # The new default is to treat a multi-line C++ comment block as a detailed
170 | # description. Set this tag to YES if you prefer the old behaviour instead.
171 |
172 | MULTILINE_CPP_IS_BRIEF = NO
173 |
174 | # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
175 | # member inherits the documentation from any documented member that it
176 | # re-implements.
177 |
178 | INHERIT_DOCS = YES
179 |
180 | # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
181 | # a new page for each member. If set to NO, the documentation of a member will
182 | # be part of the file/class/namespace that contains it.
183 |
184 | SEPARATE_MEMBER_PAGES = NO
185 |
186 | # The TAB_SIZE tag can be used to set the number of spaces in a tab.
187 | # Doxygen uses this value to replace tabs by spaces in code fragments.
188 |
189 | TAB_SIZE = 4
190 |
191 | # This tag can be used to specify a number of aliases that acts
192 | # as commands in the documentation. An alias has the form "name=value".
193 | # For example adding "sideeffect=\par Side Effects:\n" will allow you to
194 | # put the command \sideeffect (or @sideeffect) in the documentation, which
195 | # will result in a user-defined paragraph with heading "Side Effects:".
196 | # You can put \n's in the value part of an alias to insert newlines.
197 |
198 | ALIASES =
199 |
200 | # This tag can be used to specify a number of word-keyword mappings (TCL only).
201 | # A mapping has the form "name=value". For example adding
202 | # "class=itcl::class" will allow you to use the command class in the
203 | # itcl::class meaning.
204 |
205 | TCL_SUBST =
206 |
207 | # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
208 | # sources only. Doxygen will then generate output that is more tailored for C.
209 | # For instance, some of the names that are used will be different. The list
210 | # of all members will be omitted, etc.
211 |
212 | OPTIMIZE_OUTPUT_FOR_C = NO
213 |
214 | # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
215 | # sources only. Doxygen will then generate output that is more tailored for
216 | # Java. For instance, namespaces will be presented as packages, qualified
217 | # scopes will look different, etc.
218 |
219 | OPTIMIZE_OUTPUT_JAVA = NO
220 |
221 | # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
222 | # sources only. Doxygen will then generate output that is more tailored for
223 | # Fortran.
224 |
225 | OPTIMIZE_FOR_FORTRAN = NO
226 |
227 | # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
228 | # sources. Doxygen will then generate output that is tailored for
229 | # VHDL.
230 |
231 | OPTIMIZE_OUTPUT_VHDL = NO
232 |
233 | # Doxygen selects the parser to use depending on the extension of the files it
234 | # parses. With this tag you can assign which parser to use for a given
235 | # extension. Doxygen has a built-in mapping, but you can override or extend it
236 | # using this tag. The format is ext=language, where ext is a file extension,
237 | # and language is one of the parsers supported by doxygen: IDL, Java,
238 | # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
239 | # C++. For instance to make doxygen treat .inc files as Fortran files (default
240 | # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
241 | # that for custom extensions you also need to set FILE_PATTERNS otherwise the
242 | # files are not read by doxygen.
243 |
244 | EXTENSION_MAPPING =
245 |
246 | # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
247 | # comments according to the Markdown format, which allows for more readable
248 | # documentation. See http://daringfireball.net/projects/markdown/ for details.
249 | # The output of markdown processing is further processed by doxygen, so you
250 | # can mix doxygen, HTML, and XML commands with Markdown formatting.
251 | # Disable only in case of backward compatibilities issues.
252 |
253 | MARKDOWN_SUPPORT = YES
254 |
255 | # When enabled doxygen tries to link words that correspond to documented classes,
256 | # or namespaces to their corresponding documentation. Such a link can be
257 | # prevented in individual cases by by putting a % sign in front of the word or
258 | # globally by setting AUTOLINK_SUPPORT to NO.
259 |
260 | AUTOLINK_SUPPORT = YES
261 |
262 | # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
263 | # to include (a tag file for) the STL sources as input, then you should
264 | # set this tag to YES in order to let doxygen match functions declarations and
265 | # definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
266 | # func(std::string) {}). This also makes the inheritance and collaboration
267 | # diagrams that involve STL classes more complete and accurate.
268 |
269 | BUILTIN_STL_SUPPORT = NO
270 |
271 | # If you use Microsoft's C++/CLI language, you should set this option to YES to
272 | # enable parsing support.
273 |
274 | CPP_CLI_SUPPORT = NO
275 |
276 | # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
277 | # Doxygen will parse them like normal C++ but will assume all classes use public
278 | # instead of private inheritance when no explicit protection keyword is present.
279 |
280 | SIP_SUPPORT = NO
281 |
282 | # For Microsoft's IDL there are propget and propput attributes to indicate
283 | # getter and setter methods for a property. Setting this option to YES (the
284 | # default) will make doxygen replace the get and set methods by a property in
285 | # the documentation. This will only work if the methods are indeed getting or
286 | # setting a simple type. If this is not the case, or you want to show the
287 | # methods anyway, you should set this option to NO.
288 |
289 | IDL_PROPERTY_SUPPORT = YES
290 |
291 | # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
292 | # tag is set to YES, then doxygen will reuse the documentation of the first
293 | # member in the group (if any) for the other members of the group. By default
294 | # all members of a group must be documented explicitly.
295 |
296 | DISTRIBUTE_GROUP_DOC = NO
297 |
298 | # Set the SUBGROUPING tag to YES (the default) to allow class member groups of
299 | # the same type (for instance a group of public functions) to be put as a
300 | # subgroup of that type (e.g. under the Public Functions section). Set it to
301 | # NO to prevent subgrouping. Alternatively, this can be done per class using
302 | # the \nosubgrouping command.
303 |
304 | SUBGROUPING = YES
305 |
306 | # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
307 | # unions are shown inside the group in which they are included (e.g. using
308 | # @ingroup) instead of on a separate page (for HTML and Man pages) or
309 | # section (for LaTeX and RTF).
310 |
311 | INLINE_GROUPED_CLASSES = NO
312 |
313 | # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
314 | # unions with only public data fields will be shown inline in the documentation
315 | # of the scope in which they are defined (i.e. file, namespace, or group
316 | # documentation), provided this scope is documented. If set to NO (the default),
317 | # structs, classes, and unions are shown on a separate page (for HTML and Man
318 | # pages) or section (for LaTeX and RTF).
319 |
320 | INLINE_SIMPLE_STRUCTS = NO
321 |
322 | # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
323 | # is documented as struct, union, or enum with the name of the typedef. So
324 | # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
325 | # with name TypeT. When disabled the typedef will appear as a member of a file,
326 | # namespace, or class. And the struct will be named TypeS. This can typically
327 | # be useful for C code in case the coding convention dictates that all compound
328 | # types are typedef'ed and only the typedef is referenced, never the tag name.
329 |
330 | TYPEDEF_HIDES_STRUCT = NO
331 |
332 | # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
333 | # determine which symbols to keep in memory and which to flush to disk.
334 | # When the cache is full, less often used symbols will be written to disk.
335 | # For small to medium size projects (<1000 input files) the default value is
336 | # probably good enough. For larger projects a too small cache size can cause
337 | # doxygen to be busy swapping symbols to and from disk most of the time
338 | # causing a significant performance penalty.
339 | # If the system has enough physical memory increasing the cache will improve the
340 | # performance by keeping more symbols in memory. Note that the value works on
341 | # a logarithmic scale so increasing the size by one will roughly double the
342 | # memory usage. The cache size is given by this formula:
343 | # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
344 | # corresponding to a cache size of 2^16 = 65536 symbols.
345 |
346 | SYMBOL_CACHE_SIZE = 0
347 |
348 | # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
349 | # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
350 | # their name and scope. Since this can be an expensive process and often the
351 | # same symbol appear multiple times in the code, doxygen keeps a cache of
352 | # pre-resolved symbols. If the cache is too small doxygen will become slower.
353 | # If the cache is too large, memory is wasted. The cache size is given by this
354 | # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
355 | # corresponding to a cache size of 2^16 = 65536 symbols.
356 |
357 | LOOKUP_CACHE_SIZE = 0
358 |
359 | #---------------------------------------------------------------------------
360 | # Build related configuration options
361 | #---------------------------------------------------------------------------
362 |
363 | # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
364 | # documentation are documented, even if no documentation was available.
365 | # Private class members and static file members will be hidden unless
366 | # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
367 |
368 | EXTRACT_ALL = NO
369 |
370 | # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
371 | # will be included in the documentation.
372 |
373 | EXTRACT_PRIVATE = NO
374 |
375 | # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
376 | # scope will be included in the documentation.
377 |
378 | EXTRACT_PACKAGE = NO
379 |
380 | # If the EXTRACT_STATIC tag is set to YES all static members of a file
381 | # will be included in the documentation.
382 |
383 | EXTRACT_STATIC = NO
384 |
385 | # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
386 | # defined locally in source files will be included in the documentation.
387 | # If set to NO only classes defined in header files are included.
388 |
389 | EXTRACT_LOCAL_CLASSES = YES
390 |
391 | # This flag is only useful for Objective-C code. When set to YES local
392 | # methods, which are defined in the implementation section but not in
393 | # the interface are included in the documentation.
394 | # If set to NO (the default) only methods in the interface are included.
395 |
396 | EXTRACT_LOCAL_METHODS = NO
397 |
398 | # If this flag is set to YES, the members of anonymous namespaces will be
399 | # extracted and appear in the documentation as a namespace called
400 | # 'anonymous_namespace{file}', where file will be replaced with the base
401 | # name of the file that contains the anonymous namespace. By default
402 | # anonymous namespaces are hidden.
403 |
404 | EXTRACT_ANON_NSPACES = NO
405 |
406 | # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
407 | # undocumented members of documented classes, files or namespaces.
408 | # If set to NO (the default) these members will be included in the
409 | # various overviews, but no documentation section is generated.
410 | # This option has no effect if EXTRACT_ALL is enabled.
411 |
412 | HIDE_UNDOC_MEMBERS = NO
413 |
414 | # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
415 | # undocumented classes that are normally visible in the class hierarchy.
416 | # If set to NO (the default) these classes will be included in the various
417 | # overviews. This option has no effect if EXTRACT_ALL is enabled.
418 |
419 | HIDE_UNDOC_CLASSES = NO
420 |
421 | # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
422 | # friend (class|struct|union) declarations.
423 | # If set to NO (the default) these declarations will be included in the
424 | # documentation.
425 |
426 | HIDE_FRIEND_COMPOUNDS = NO
427 |
428 | # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
429 | # documentation blocks found inside the body of a function.
430 | # If set to NO (the default) these blocks will be appended to the
431 | # function's detailed documentation block.
432 |
433 | HIDE_IN_BODY_DOCS = NO
434 |
435 | # The INTERNAL_DOCS tag determines if documentation
436 | # that is typed after a \internal command is included. If the tag is set
437 | # to NO (the default) then the documentation will be excluded.
438 | # Set it to YES to include the internal documentation.
439 |
440 | INTERNAL_DOCS = NO
441 |
442 | # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
443 | # file names in lower-case letters. If set to YES upper-case letters are also
444 | # allowed. This is useful if you have classes or files whose names only differ
445 | # in case and if your file system supports case sensitive file names. Windows
446 | # and Mac users are advised to set this option to NO.
447 |
448 | CASE_SENSE_NAMES = NO
449 |
450 | # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
451 | # will show members with their full class and namespace scopes in the
452 | # documentation. If set to YES the scope will be hidden.
453 |
454 | HIDE_SCOPE_NAMES = NO
455 |
456 | # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
457 | # will put a list of the files that are included by a file in the documentation
458 | # of that file.
459 |
460 | SHOW_INCLUDE_FILES = YES
461 |
462 | # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
463 | # will list include files with double quotes in the documentation
464 | # rather than with sharp brackets.
465 |
466 | FORCE_LOCAL_INCLUDES = NO
467 |
468 | # If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
469 | # is inserted in the documentation for inline members.
470 |
471 | INLINE_INFO = YES
472 |
473 | # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
474 | # will sort the (detailed) documentation of file and class members
475 | # alphabetically by member name. If set to NO the members will appear in
476 | # declaration order.
477 |
478 | SORT_MEMBER_DOCS = YES
479 |
480 | # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
481 | # brief documentation of file, namespace and class members alphabetically
482 | # by member name. If set to NO (the default) the members will appear in
483 | # declaration order.
484 |
485 | SORT_BRIEF_DOCS = NO
486 |
487 | # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
488 | # will sort the (brief and detailed) documentation of class members so that
489 | # constructors and destructors are listed first. If set to NO (the default)
490 | # the constructors will appear in the respective orders defined by
491 | # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
492 | # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
493 | # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
494 |
495 | SORT_MEMBERS_CTORS_1ST = NO
496 |
497 | # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
498 | # hierarchy of group names into alphabetical order. If set to NO (the default)
499 | # the group names will appear in their defined order.
500 |
501 | SORT_GROUP_NAMES = NO
502 |
503 | # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
504 | # sorted by fully-qualified names, including namespaces. If set to
505 | # NO (the default), the class list will be sorted only by class name,
506 | # not including the namespace part.
507 | # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
508 | # Note: This option applies only to the class list, not to the
509 | # alphabetical list.
510 |
511 | SORT_BY_SCOPE_NAME = NO
512 |
513 | # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
514 | # do proper type resolution of all parameters of a function it will reject a
515 | # match between the prototype and the implementation of a member function even
516 | # if there is only one candidate or it is obvious which candidate to choose
517 | # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
518 | # will still accept a match between prototype and implementation in such cases.
519 |
520 | STRICT_PROTO_MATCHING = NO
521 |
522 | # The GENERATE_TODOLIST tag can be used to enable (YES) or
523 | # disable (NO) the todo list. This list is created by putting \todo
524 | # commands in the documentation.
525 |
526 | GENERATE_TODOLIST = YES
527 |
528 | # The GENERATE_TESTLIST tag can be used to enable (YES) or
529 | # disable (NO) the test list. This list is created by putting \test
530 | # commands in the documentation.
531 |
532 | GENERATE_TESTLIST = YES
533 |
534 | # The GENERATE_BUGLIST tag can be used to enable (YES) or
535 | # disable (NO) the bug list. This list is created by putting \bug
536 | # commands in the documentation.
537 |
538 | GENERATE_BUGLIST = YES
539 |
540 | # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
541 | # disable (NO) the deprecated list. This list is created by putting
542 | # \deprecated commands in the documentation.
543 |
544 | GENERATE_DEPRECATEDLIST= YES
545 |
546 | # The ENABLED_SECTIONS tag can be used to enable conditional
547 | # documentation sections, marked by \if section-label ... \endif
548 | # and \cond section-label ... \endcond blocks.
549 |
550 | ENABLED_SECTIONS =
551 |
552 | # The MAX_INITIALIZER_LINES tag determines the maximum number of lines
553 | # the initial value of a variable or macro consists of for it to appear in
554 | # the documentation. If the initializer consists of more lines than specified
555 | # here it will be hidden. Use a value of 0 to hide initializers completely.
556 | # The appearance of the initializer of individual variables and macros in the
557 | # documentation can be controlled using \showinitializer or \hideinitializer
558 | # command in the documentation regardless of this setting.
559 |
560 | MAX_INITIALIZER_LINES = 30
561 |
562 | # Set the SHOW_USED_FILES tag to NO to disable the list of files generated
563 | # at the bottom of the documentation of classes and structs. If set to YES the
564 | # list will mention the files that were used to generate the documentation.
565 |
566 | SHOW_USED_FILES = YES
567 |
568 | # Set the SHOW_FILES tag to NO to disable the generation of the Files page.
569 | # This will remove the Files entry from the Quick Index and from the
570 | # Folder Tree View (if specified). The default is YES.
571 |
572 | SHOW_FILES = YES
573 |
574 | # Set the SHOW_NAMESPACES tag to NO to disable the generation of the
575 | # Namespaces page.
576 | # This will remove the Namespaces entry from the Quick Index
577 | # and from the Folder Tree View (if specified). The default is YES.
578 |
579 | SHOW_NAMESPACES = YES
580 |
581 | # The FILE_VERSION_FILTER tag can be used to specify a program or script that
582 | # doxygen should invoke to get the current version for each file (typically from
583 | # the version control system). Doxygen will invoke the program by executing (via
584 | # popen()) the command , where is the value of
585 | # the FILE_VERSION_FILTER tag, and is the name of an input file
586 | # provided by doxygen. Whatever the program writes to standard output
587 | # is used as the file version. See the manual for examples.
588 |
589 | FILE_VERSION_FILTER =
590 |
591 | # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
592 | # by doxygen. The layout file controls the global structure of the generated
593 | # output files in an output format independent way. To create the layout file
594 | # that represents doxygen's defaults, run doxygen with the -l option.
595 | # You can optionally specify a file name after the option, if omitted
596 | # DoxygenLayout.xml will be used as the name of the layout file.
597 |
598 | LAYOUT_FILE =
599 |
600 | # The CITE_BIB_FILES tag can be used to specify one or more bib files
601 | # containing the references data. This must be a list of .bib files. The
602 | # .bib extension is automatically appended if omitted. Using this command
603 | # requires the bibtex tool to be installed. See also
604 | # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
605 | # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
606 | # feature you need bibtex and perl available in the search path. Do not use
607 | # file names with spaces, bibtex cannot handle them.
608 |
609 | CITE_BIB_FILES =
610 |
611 | #---------------------------------------------------------------------------
612 | # configuration options related to warning and progress messages
613 | #---------------------------------------------------------------------------
614 |
615 | # The QUIET tag can be used to turn on/off the messages that are generated
616 | # by doxygen. Possible values are YES and NO. If left blank NO is used.
617 |
618 | QUIET = YES
619 |
620 | # The WARNINGS tag can be used to turn on/off the warning messages that are
621 | # generated by doxygen. Possible values are YES and NO. If left blank
622 | # NO is used.
623 |
624 | WARNINGS = YES
625 |
626 | # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
627 | # for undocumented members. If EXTRACT_ALL is set to YES then this flag will
628 | # automatically be disabled.
629 |
630 | WARN_IF_UNDOCUMENTED = YES
631 |
632 | # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
633 | # potential errors in the documentation, such as not documenting some
634 | # parameters in a documented function, or documenting parameters that
635 | # don't exist or using markup commands wrongly.
636 |
637 | WARN_IF_DOC_ERROR = YES
638 |
639 | # The WARN_NO_PARAMDOC option can be enabled to get warnings for
640 | # functions that are documented, but have no documentation for their parameters
641 | # or return value. If set to NO (the default) doxygen will only warn about
642 | # wrong or incomplete parameter documentation, but not about the absence of
643 | # documentation.
644 |
645 | WARN_NO_PARAMDOC = NO
646 |
647 | # The WARN_FORMAT tag determines the format of the warning messages that
648 | # doxygen can produce. The string should contain the $file, $line, and $text
649 | # tags, which will be replaced by the file and line number from which the
650 | # warning originated and the warning text. Optionally the format may contain
651 | # $version, which will be replaced by the version of the file (if it could
652 | # be obtained via FILE_VERSION_FILTER)
653 |
654 | WARN_FORMAT = "$file:$line: $text"
655 |
656 | # The WARN_LOGFILE tag can be used to specify a file to which warning
657 | # and error messages should be written. If left blank the output is written
658 | # to stderr.
659 |
660 | WARN_LOGFILE =
661 |
662 | #---------------------------------------------------------------------------
663 | # configuration options related to the input files
664 | #---------------------------------------------------------------------------
665 |
666 | # The INPUT tag can be used to specify the files and/or directories that contain
667 | # documented source files. You may enter file names like "myfile.cpp" or
668 | # directories like "/usr/src/myproject". Separate the files or directories
669 | # with spaces.
670 |
671 | INPUT = src
672 |
673 | # This tag can be used to specify the character encoding of the source files
674 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
675 | # also the default input encoding. Doxygen uses libiconv (or the iconv built
676 | # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
677 | # the list of possible encodings.
678 |
679 | INPUT_ENCODING = UTF-8
680 |
681 | # If the value of the INPUT tag contains directories, you can use the
682 | # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
683 | # and *.h) to filter out the source-files in the directories. If left
684 | # blank the following patterns are tested:
685 | # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
686 | # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
687 | # *.f90 *.f *.for *.vhd *.vhdl
688 |
689 | FILE_PATTERNS =
690 |
691 | # The RECURSIVE tag can be used to turn specify whether or not subdirectories
692 | # should be searched for input files as well. Possible values are YES and NO.
693 | # If left blank NO is used.
694 |
695 | RECURSIVE = YES
696 |
697 | # The EXCLUDE tag can be used to specify files and/or directories that should be
698 | # excluded from the INPUT source files. This way you can easily exclude a
699 | # subdirectory from a directory tree whose root is specified with the INPUT tag.
700 | # Note that relative paths are relative to the directory from which doxygen is
701 | # run.
702 |
703 | EXCLUDE =
704 |
705 | # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
706 | # directories that are symbolic links (a Unix file system feature) are excluded
707 | # from the input.
708 |
709 | EXCLUDE_SYMLINKS = NO
710 |
711 | # If the value of the INPUT tag contains directories, you can use the
712 | # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
713 | # certain files from those directories. Note that the wildcards are matched
714 | # against the file with absolute path, so to exclude all test directories
715 | # for example use the pattern */test/*
716 |
717 | EXCLUDE_PATTERNS =
718 |
719 | # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
720 | # (namespaces, classes, functions, etc.) that should be excluded from the
721 | # output. The symbol name can be a fully qualified name, a word, or if the
722 | # wildcard * is used, a substring. Examples: ANamespace, AClass,
723 | # AClass::ANamespace, ANamespace::*Test
724 |
725 | EXCLUDE_SYMBOLS =
726 |
727 | # The EXAMPLE_PATH tag can be used to specify one or more files or
728 | # directories that contain example code fragments that are included (see
729 | # the \include command).
730 |
731 | EXAMPLE_PATH =
732 |
733 | # If the value of the EXAMPLE_PATH tag contains directories, you can use the
734 | # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
735 | # and *.h) to filter out the source-files in the directories. If left
736 | # blank all files are included.
737 |
738 | EXAMPLE_PATTERNS =
739 |
740 | # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
741 | # searched for input files to be used with the \include or \dontinclude
742 | # commands irrespective of the value of the RECURSIVE tag.
743 | # Possible values are YES and NO. If left blank NO is used.
744 |
745 | EXAMPLE_RECURSIVE = NO
746 |
747 | # The IMAGE_PATH tag can be used to specify one or more files or
748 | # directories that contain image that are included in the documentation (see
749 | # the \image command).
750 |
751 | IMAGE_PATH =
752 |
753 | # The INPUT_FILTER tag can be used to specify a program that doxygen should
754 | # invoke to filter for each input file. Doxygen will invoke the filter program
755 | # by executing (via popen()) the command , where
756 | # is the value of the INPUT_FILTER tag, and is the name of an
757 | # input file. Doxygen will then use the output that the filter program writes
758 | # to standard output.
759 | # If FILTER_PATTERNS is specified, this tag will be
760 | # ignored.
761 |
762 | INPUT_FILTER =
763 |
764 | # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
765 | # basis.
766 | # Doxygen will compare the file name with each pattern and apply the
767 | # filter if there is a match.
768 | # The filters are a list of the form:
769 | # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
770 | # info on how filters are used. If FILTER_PATTERNS is empty or if
771 | # non of the patterns match the file name, INPUT_FILTER is applied.
772 |
773 | FILTER_PATTERNS =
774 |
775 | # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
776 | # INPUT_FILTER) will be used to filter the input files when producing source
777 | # files to browse (i.e. when SOURCE_BROWSER is set to YES).
778 |
779 | FILTER_SOURCE_FILES = NO
780 |
781 | # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
782 | # pattern. A pattern will override the setting for FILTER_PATTERN (if any)
783 | # and it is also possible to disable source filtering for a specific pattern
784 | # using *.ext= (so without naming a filter). This option only has effect when
785 | # FILTER_SOURCE_FILES is enabled.
786 |
787 | FILTER_SOURCE_PATTERNS =
788 |
789 | # If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
790 | # is part of the input, its contents will be placed on the main page (index.html).
791 | # This can be useful if you have a project on for instance GitHub and want reuse
792 | # the introduction page also for the doxygen output.
793 |
794 | USE_MDFILE_AS_MAINPAGE =
795 |
796 | #---------------------------------------------------------------------------
797 | # configuration options related to source browsing
798 | #---------------------------------------------------------------------------
799 |
800 | # If the SOURCE_BROWSER tag is set to YES then a list of source files will
801 | # be generated. Documented entities will be cross-referenced with these sources.
802 | # Note: To get rid of all source code in the generated output, make sure also
803 | # VERBATIM_HEADERS is set to NO.
804 |
805 | SOURCE_BROWSER = YES
806 |
807 | # Setting the INLINE_SOURCES tag to YES will include the body
808 | # of functions and classes directly in the documentation.
809 |
810 | INLINE_SOURCES = YES
811 |
812 | # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
813 | # doxygen to hide any special comment blocks from generated source code
814 | # fragments. Normal C, C++ and Fortran comments will always remain visible.
815 |
816 | STRIP_CODE_COMMENTS = YES
817 |
818 | # If the REFERENCED_BY_RELATION tag is set to YES
819 | # then for each documented function all documented
820 | # functions referencing it will be listed.
821 |
822 | REFERENCED_BY_RELATION = NO
823 |
824 | # If the REFERENCES_RELATION tag is set to YES
825 | # then for each documented function all documented entities
826 | # called/used by that function will be listed.
827 |
828 | REFERENCES_RELATION = NO
829 |
830 | # If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
831 | # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
832 | # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
833 | # link to the source code.
834 | # Otherwise they will link to the documentation.
835 |
836 | REFERENCES_LINK_SOURCE = YES
837 |
838 | # If the USE_HTAGS tag is set to YES then the references to source code
839 | # will point to the HTML generated by the htags(1) tool instead of doxygen
840 | # built-in source browser. The htags tool is part of GNU's global source
841 | # tagging system (see http://www.gnu.org/software/global/global.html). You
842 | # will need version 4.8.6 or higher.
843 |
844 | USE_HTAGS = NO
845 |
846 | # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
847 | # will generate a verbatim copy of the header file for each class for
848 | # which an include is specified. Set to NO to disable this.
849 |
850 | VERBATIM_HEADERS = YES
851 |
852 | #---------------------------------------------------------------------------
853 | # configuration options related to the alphabetical class index
854 | #---------------------------------------------------------------------------
855 |
856 | # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
857 | # of all compounds will be generated. Enable this if the project
858 | # contains a lot of classes, structs, unions or interfaces.
859 |
860 | ALPHABETICAL_INDEX = YES
861 |
862 | # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
863 | # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
864 | # in which this list will be split (can be a number in the range [1..20])
865 |
866 | COLS_IN_ALPHA_INDEX = 5
867 |
868 | # In case all classes in a project start with a common prefix, all
869 | # classes will be put under the same header in the alphabetical index.
870 | # The IGNORE_PREFIX tag can be used to specify one or more prefixes that
871 | # should be ignored while generating the index headers.
872 |
873 | IGNORE_PREFIX =
874 |
875 | #---------------------------------------------------------------------------
876 | # configuration options related to the HTML output
877 | #---------------------------------------------------------------------------
878 |
879 | # If the GENERATE_HTML tag is set to YES (the default) Doxygen will
880 | # generate HTML output.
881 |
882 | GENERATE_HTML = YES
883 |
884 | # The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
885 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be
886 | # put in front of it. If left blank `html' will be used as the default path.
887 |
888 | HTML_OUTPUT = html
889 |
890 | # The HTML_FILE_EXTENSION tag can be used to specify the file extension for
891 | # each generated HTML page (for example: .htm,.php,.asp). If it is left blank
892 | # doxygen will generate files with .html extension.
893 |
894 | HTML_FILE_EXTENSION = .html
895 |
896 | # The HTML_HEADER tag can be used to specify a personal HTML header for
897 | # each generated HTML page. If it is left blank doxygen will generate a
898 | # standard header. Note that when using a custom header you are responsible
899 | # for the proper inclusion of any scripts and style sheets that doxygen
900 | # needs, which is dependent on the configuration options used.
901 | # It is advised to generate a default header using "doxygen -w html
902 | # header.html footer.html stylesheet.css YourConfigFile" and then modify
903 | # that header. Note that the header is subject to change so you typically
904 | # have to redo this when upgrading to a newer version of doxygen or when
905 | # changing the value of configuration settings such as GENERATE_TREEVIEW!
906 |
907 | HTML_HEADER =
908 |
909 | # The HTML_FOOTER tag can be used to specify a personal HTML footer for
910 | # each generated HTML page. If it is left blank doxygen will generate a
911 | # standard footer.
912 |
913 | HTML_FOOTER =
914 |
915 | # The HTML_STYLESHEET tag can be used to specify a user-defined cascading
916 | # style sheet that is used by each HTML page. It can be used to
917 | # fine-tune the look of the HTML output. If left blank doxygen will
918 | # generate a default style sheet. Note that it is recommended to use
919 | # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
920 | # tag will in the future become obsolete.
921 |
922 | HTML_STYLESHEET =
923 |
924 | # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
925 | # user-defined cascading style sheet that is included after the standard
926 | # style sheets created by doxygen. Using this option one can overrule
927 | # certain style aspects. This is preferred over using HTML_STYLESHEET
928 | # since it does not replace the standard style sheet and is therefor more
929 | # robust against future updates. Doxygen will copy the style sheet file to
930 | # the output directory.
931 |
932 | HTML_EXTRA_STYLESHEET =
933 |
934 | # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
935 | # other source files which should be copied to the HTML output directory. Note
936 | # that these files will be copied to the base HTML output directory. Use the
937 | # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
938 | # files. In the HTML_STYLESHEET file, use the file name only. Also note that
939 | # the files will be copied as-is; there are no commands or markers available.
940 |
941 | HTML_EXTRA_FILES =
942 |
943 | # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
944 | # Doxygen will adjust the colors in the style sheet and background images
945 | # according to this color. Hue is specified as an angle on a colorwheel,
946 | # see http://en.wikipedia.org/wiki/Hue for more information.
947 | # For instance the value 0 represents red, 60 is yellow, 120 is green,
948 | # 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
949 | # The allowed range is 0 to 359.
950 |
951 | HTML_COLORSTYLE_HUE = 220
952 |
953 | # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
954 | # the colors in the HTML output. For a value of 0 the output will use
955 | # grayscales only. A value of 255 will produce the most vivid colors.
956 |
957 | HTML_COLORSTYLE_SAT = 100
958 |
959 | # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
960 | # the luminance component of the colors in the HTML output. Values below
961 | # 100 gradually make the output lighter, whereas values above 100 make
962 | # the output darker. The value divided by 100 is the actual gamma applied,
963 | # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
964 | # and 100 does not change the gamma.
965 |
966 | HTML_COLORSTYLE_GAMMA = 80
967 |
968 | # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
969 | # page will contain the date and time when the page was generated. Setting
970 | # this to NO can help when comparing the output of multiple runs.
971 |
972 | HTML_TIMESTAMP = YES
973 |
974 | # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
975 | # documentation will contain sections that can be hidden and shown after the
976 | # page has loaded.
977 |
978 | HTML_DYNAMIC_SECTIONS = NO
979 |
980 | # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
981 | # entries shown in the various tree structured indices initially; the user
982 | # can expand and collapse entries dynamically later on. Doxygen will expand
983 | # the tree to such a level that at most the specified number of entries are
984 | # visible (unless a fully collapsed tree already exceeds this amount).
985 | # So setting the number of entries 1 will produce a full collapsed tree by
986 | # default. 0 is a special value representing an infinite number of entries
987 | # and will result in a full expanded tree by default.
988 |
989 | HTML_INDEX_NUM_ENTRIES = 100
990 |
991 | # If the GENERATE_DOCSET tag is set to YES, additional index files
992 | # will be generated that can be used as input for Apple's Xcode 3
993 | # integrated development environment, introduced with OSX 10.5 (Leopard).
994 | # To create a documentation set, doxygen will generate a Makefile in the
995 | # HTML output directory. Running make will produce the docset in that
996 | # directory and running "make install" will install the docset in
997 | # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
998 | # it at startup.
999 | # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
1000 | # for more information.
1001 |
1002 | GENERATE_DOCSET = NO
1003 |
1004 | # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
1005 | # feed. A documentation feed provides an umbrella under which multiple
1006 | # documentation sets from a single provider (such as a company or product suite)
1007 | # can be grouped.
1008 |
1009 | DOCSET_FEEDNAME = "Doxygen generated docs"
1010 |
1011 | # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
1012 | # should uniquely identify the documentation set bundle. This should be a
1013 | # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
1014 | # will append .docset to the name.
1015 |
1016 | DOCSET_BUNDLE_ID = org.doxygen.Project
1017 |
1018 | # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
1019 | # identify the documentation publisher. This should be a reverse domain-name
1020 | # style string, e.g. com.mycompany.MyDocSet.documentation.
1021 |
1022 | DOCSET_PUBLISHER_ID = org.doxygen.Publisher
1023 |
1024 | # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
1025 |
1026 | DOCSET_PUBLISHER_NAME = Publisher
1027 |
1028 | # If the GENERATE_HTMLHELP tag is set to YES, additional index files
1029 | # will be generated that can be used as input for tools like the
1030 | # Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
1031 | # of the generated HTML documentation.
1032 |
1033 | GENERATE_HTMLHELP = NO
1034 |
1035 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
1036 | # be used to specify the file name of the resulting .chm file. You
1037 | # can add a path in front of the file if the result should not be
1038 | # written to the html output directory.
1039 |
1040 | CHM_FILE =
1041 |
1042 | # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
1043 | # be used to specify the location (absolute path including file name) of
1044 | # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
1045 | # the HTML help compiler on the generated index.hhp.
1046 |
1047 | HHC_LOCATION =
1048 |
1049 | # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
1050 | # controls if a separate .chi index file is generated (YES) or that
1051 | # it should be included in the master .chm file (NO).
1052 |
1053 | GENERATE_CHI = NO
1054 |
1055 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
1056 | # is used to encode HtmlHelp index (hhk), content (hhc) and project file
1057 | # content.
1058 |
1059 | CHM_INDEX_ENCODING =
1060 |
1061 | # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
1062 | # controls whether a binary table of contents is generated (YES) or a
1063 | # normal table of contents (NO) in the .chm file.
1064 |
1065 | BINARY_TOC = NO
1066 |
1067 | # The TOC_EXPAND flag can be set to YES to add extra items for group members
1068 | # to the contents of the HTML help documentation and to the tree view.
1069 |
1070 | TOC_EXPAND = NO
1071 |
1072 | # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
1073 | # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
1074 | # that can be used as input for Qt's qhelpgenerator to generate a
1075 | # Qt Compressed Help (.qch) of the generated HTML documentation.
1076 |
1077 | GENERATE_QHP = NO
1078 |
1079 | # If the QHG_LOCATION tag is specified, the QCH_FILE tag can
1080 | # be used to specify the file name of the resulting .qch file.
1081 | # The path specified is relative to the HTML output folder.
1082 |
1083 | QCH_FILE =
1084 |
1085 | # The QHP_NAMESPACE tag specifies the namespace to use when generating
1086 | # Qt Help Project output. For more information please see
1087 | # http://doc.trolltech.com/qthelpproject.html#namespace
1088 |
1089 | QHP_NAMESPACE = org.doxygen.Project
1090 |
1091 | # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
1092 | # Qt Help Project output. For more information please see
1093 | # http://doc.trolltech.com/qthelpproject.html#virtual-folders
1094 |
1095 | QHP_VIRTUAL_FOLDER = doc
1096 |
1097 | # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
1098 | # add. For more information please see
1099 | # http://doc.trolltech.com/qthelpproject.html#custom-filters
1100 |
1101 | QHP_CUST_FILTER_NAME =
1102 |
1103 | # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
1104 | # custom filter to add. For more information please see
1105 | #
1106 | # Qt Help Project / Custom Filters.
1107 |
1108 | QHP_CUST_FILTER_ATTRS =
1109 |
1110 | # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
1111 | # project's
1112 | # filter section matches.
1113 | #
1114 | # Qt Help Project / Filter Attributes.
1115 |
1116 | QHP_SECT_FILTER_ATTRS =
1117 |
1118 | # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
1119 | # be used to specify the location of Qt's qhelpgenerator.
1120 | # If non-empty doxygen will try to run qhelpgenerator on the generated
1121 | # .qhp file.
1122 |
1123 | QHG_LOCATION =
1124 |
1125 | # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
1126 | # will be generated, which together with the HTML files, form an Eclipse help
1127 | # plugin. To install this plugin and make it available under the help contents
1128 | # menu in Eclipse, the contents of the directory containing the HTML and XML
1129 | # files needs to be copied into the plugins directory of eclipse. The name of
1130 | # the directory within the plugins directory should be the same as
1131 | # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
1132 | # the help appears.
1133 |
1134 | GENERATE_ECLIPSEHELP = NO
1135 |
1136 | # A unique identifier for the eclipse help plugin. When installing the plugin
1137 | # the directory name containing the HTML and XML files should also have
1138 | # this name.
1139 |
1140 | ECLIPSE_DOC_ID = org.doxygen.Project
1141 |
1142 | # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
1143 | # at top of each HTML page. The value NO (the default) enables the index and
1144 | # the value YES disables it. Since the tabs have the same information as the
1145 | # navigation tree you can set this option to NO if you already set
1146 | # GENERATE_TREEVIEW to YES.
1147 |
1148 | DISABLE_INDEX = NO
1149 |
1150 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
1151 | # structure should be generated to display hierarchical information.
1152 | # If the tag value is set to YES, a side panel will be generated
1153 | # containing a tree-like index structure (just like the one that
1154 | # is generated for HTML Help). For this to work a browser that supports
1155 | # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
1156 | # Windows users are probably better off using the HTML help feature.
1157 | # Since the tree basically has the same information as the tab index you
1158 | # could consider to set DISABLE_INDEX to NO when enabling this option.
1159 |
1160 | GENERATE_TREEVIEW = NO
1161 |
1162 | # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
1163 | # (range [0,1..20]) that doxygen will group on one line in the generated HTML
1164 | # documentation. Note that a value of 0 will completely suppress the enum
1165 | # values from appearing in the overview section.
1166 |
1167 | ENUM_VALUES_PER_LINE = 4
1168 |
1169 | # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
1170 | # used to set the initial width (in pixels) of the frame in which the tree
1171 | # is shown.
1172 |
1173 | TREEVIEW_WIDTH = 250
1174 |
1175 | # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
1176 | # links to external symbols imported via tag files in a separate window.
1177 |
1178 | EXT_LINKS_IN_WINDOW = NO
1179 |
1180 | # Use this tag to change the font size of Latex formulas included
1181 | # as images in the HTML documentation. The default is 10. Note that
1182 | # when you change the font size after a successful doxygen run you need
1183 | # to manually remove any form_*.png images from the HTML output directory
1184 | # to force them to be regenerated.
1185 |
1186 | FORMULA_FONTSIZE = 10
1187 |
1188 | # Use the FORMULA_TRANPARENT tag to determine whether or not the images
1189 | # generated for formulas are transparent PNGs. Transparent PNGs are
1190 | # not supported properly for IE 6.0, but are supported on all modern browsers.
1191 | # Note that when changing this option you need to delete any form_*.png files
1192 | # in the HTML output before the changes have effect.
1193 |
1194 | FORMULA_TRANSPARENT = YES
1195 |
1196 | # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
1197 | # (see http://www.mathjax.org) which uses client side Javascript for the
1198 | # rendering instead of using prerendered bitmaps. Use this if you do not
1199 | # have LaTeX installed or if you want to formulas look prettier in the HTML
1200 | # output. When enabled you may also need to install MathJax separately and
1201 | # configure the path to it using the MATHJAX_RELPATH option.
1202 |
1203 | USE_MATHJAX = NO
1204 |
1205 | # When MathJax is enabled you can set the default output format to be used for
1206 | # thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
1207 | # SVG. The default value is HTML-CSS, which is slower, but has the best
1208 | # compatibility.
1209 |
1210 | MATHJAX_FORMAT = HTML-CSS
1211 |
1212 | # When MathJax is enabled you need to specify the location relative to the
1213 | # HTML output directory using the MATHJAX_RELPATH option. The destination
1214 | # directory should contain the MathJax.js script. For instance, if the mathjax
1215 | # directory is located at the same level as the HTML output directory, then
1216 | # MATHJAX_RELPATH should be ../mathjax. The default value points to
1217 | # the MathJax Content Delivery Network so you can quickly see the result without
1218 | # installing MathJax.
1219 | # However, it is strongly recommended to install a local
1220 | # copy of MathJax from http://www.mathjax.org before deployment.
1221 |
1222 | MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
1223 |
1224 | # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
1225 | # names that should be enabled during MathJax rendering.
1226 |
1227 | MATHJAX_EXTENSIONS =
1228 |
1229 | # When the SEARCHENGINE tag is enabled doxygen will generate a search box
1230 | # for the HTML output. The underlying search engine uses javascript
1231 | # and DHTML and should work on any modern browser. Note that when using
1232 | # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
1233 | # (GENERATE_DOCSET) there is already a search function so this one should
1234 | # typically be disabled. For large projects the javascript based search engine
1235 | # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
1236 |
1237 | SEARCHENGINE = YES
1238 |
1239 | # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
1240 | # implemented using a web server instead of a web client using Javascript.
1241 | # There are two flavours of web server based search depending on the
1242 | # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
1243 | # searching and an index file used by the script. When EXTERNAL_SEARCH is
1244 | # enabled the indexing and searching needs to be provided by external tools.
1245 | # See the manual for details.
1246 |
1247 | SERVER_BASED_SEARCH = NO
1248 |
1249 | # When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
1250 | # script for searching. Instead the search results are written to an XML file
1251 | # which needs to be processed by an external indexer. Doxygen will invoke an
1252 | # external search engine pointed to by the SEARCHENGINE_URL option to obtain
1253 | # the search results. Doxygen ships with an example indexer (doxyindexer) and
1254 | # search engine (doxysearch.cgi) which are based on the open source search engine
1255 | # library Xapian. See the manual for configuration details.
1256 |
1257 | EXTERNAL_SEARCH = NO
1258 |
1259 | # The SEARCHENGINE_URL should point to a search engine hosted by a web server
1260 | # which will returned the search results when EXTERNAL_SEARCH is enabled.
1261 | # Doxygen ships with an example search engine (doxysearch) which is based on
1262 | # the open source search engine library Xapian. See the manual for configuration
1263 | # details.
1264 |
1265 | SEARCHENGINE_URL =
1266 |
1267 | # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
1268 | # search data is written to a file for indexing by an external tool. With the
1269 | # SEARCHDATA_FILE tag the name of this file can be specified.
1270 |
1271 | SEARCHDATA_FILE = searchdata.xml
1272 |
1273 | # When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
1274 | # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
1275 | # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
1276 | # projects and redirect the results back to the right project.
1277 |
1278 | EXTERNAL_SEARCH_ID =
1279 |
1280 | # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
1281 | # projects other than the one defined by this configuration file, but that are
1282 | # all added to the same external search index. Each project needs to have a
1283 | # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
1284 | # of to a relative location where the documentation can be found.
1285 | # The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
1286 |
1287 | EXTRA_SEARCH_MAPPINGS =
1288 |
1289 | #---------------------------------------------------------------------------
1290 | # configuration options related to the LaTeX output
1291 | #---------------------------------------------------------------------------
1292 |
1293 | # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
1294 | # generate Latex output.
1295 |
1296 | GENERATE_LATEX = NO
1297 |
1298 | # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
1299 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1300 | # put in front of it. If left blank `latex' will be used as the default path.
1301 |
1302 | LATEX_OUTPUT = latex
1303 |
1304 | # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
1305 | # invoked. If left blank `latex' will be used as the default command name.
1306 | # Note that when enabling USE_PDFLATEX this option is only used for
1307 | # generating bitmaps for formulas in the HTML output, but not in the
1308 | # Makefile that is written to the output directory.
1309 |
1310 | LATEX_CMD_NAME = latex
1311 |
1312 | # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
1313 | # generate index for LaTeX. If left blank `makeindex' will be used as the
1314 | # default command name.
1315 |
1316 | MAKEINDEX_CMD_NAME = makeindex
1317 |
1318 | # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
1319 | # LaTeX documents. This may be useful for small projects and may help to
1320 | # save some trees in general.
1321 |
1322 | COMPACT_LATEX = NO
1323 |
1324 | # The PAPER_TYPE tag can be used to set the paper type that is used
1325 | # by the printer. Possible values are: a4, letter, legal and
1326 | # executive. If left blank a4wide will be used.
1327 |
1328 | PAPER_TYPE = a4
1329 |
1330 | # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
1331 | # packages that should be included in the LaTeX output.
1332 |
1333 | EXTRA_PACKAGES =
1334 |
1335 | # The LATEX_HEADER tag can be used to specify a personal LaTeX header for
1336 | # the generated latex document. The header should contain everything until
1337 | # the first chapter. If it is left blank doxygen will generate a
1338 | # standard header. Notice: only use this tag if you know what you are doing!
1339 |
1340 | LATEX_HEADER =
1341 |
1342 | # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
1343 | # the generated latex document. The footer should contain everything after
1344 | # the last chapter. If it is left blank doxygen will generate a
1345 | # standard footer. Notice: only use this tag if you know what you are doing!
1346 |
1347 | LATEX_FOOTER =
1348 |
1349 | # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
1350 | # is prepared for conversion to pdf (using ps2pdf). The pdf file will
1351 | # contain links (just like the HTML output) instead of page references
1352 | # This makes the output suitable for online browsing using a pdf viewer.
1353 |
1354 | PDF_HYPERLINKS = YES
1355 |
1356 | # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
1357 | # plain latex in the generated Makefile. Set this option to YES to get a
1358 | # higher quality PDF documentation.
1359 |
1360 | USE_PDFLATEX = YES
1361 |
1362 | # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
1363 | # command to the generated LaTeX files. This will instruct LaTeX to keep
1364 | # running if errors occur, instead of asking the user for help.
1365 | # This option is also used when generating formulas in HTML.
1366 |
1367 | LATEX_BATCHMODE = NO
1368 |
1369 | # If LATEX_HIDE_INDICES is set to YES then doxygen will not
1370 | # include the index chapters (such as File Index, Compound Index, etc.)
1371 | # in the output.
1372 |
1373 | LATEX_HIDE_INDICES = NO
1374 |
1375 | # If LATEX_SOURCE_CODE is set to YES then doxygen will include
1376 | # source code with syntax highlighting in the LaTeX output.
1377 | # Note that which sources are shown also depends on other settings
1378 | # such as SOURCE_BROWSER.
1379 |
1380 | LATEX_SOURCE_CODE = NO
1381 |
1382 | # The LATEX_BIB_STYLE tag can be used to specify the style to use for the
1383 | # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
1384 | # http://en.wikipedia.org/wiki/BibTeX for more info.
1385 |
1386 | LATEX_BIB_STYLE = plain
1387 |
1388 | #---------------------------------------------------------------------------
1389 | # configuration options related to the RTF output
1390 | #---------------------------------------------------------------------------
1391 |
1392 | # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
1393 | # The RTF output is optimized for Word 97 and may not look very pretty with
1394 | # other RTF readers or editors.
1395 |
1396 | GENERATE_RTF = NO
1397 |
1398 | # The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
1399 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1400 | # put in front of it. If left blank `rtf' will be used as the default path.
1401 |
1402 | RTF_OUTPUT = rtf
1403 |
1404 | # If the COMPACT_RTF tag is set to YES Doxygen generates more compact
1405 | # RTF documents. This may be useful for small projects and may help to
1406 | # save some trees in general.
1407 |
1408 | COMPACT_RTF = NO
1409 |
1410 | # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
1411 | # will contain hyperlink fields. The RTF file will
1412 | # contain links (just like the HTML output) instead of page references.
1413 | # This makes the output suitable for online browsing using WORD or other
1414 | # programs which support those fields.
1415 | # Note: wordpad (write) and others do not support links.
1416 |
1417 | RTF_HYPERLINKS = NO
1418 |
1419 | # Load style sheet definitions from file. Syntax is similar to doxygen's
1420 | # config file, i.e. a series of assignments. You only have to provide
1421 | # replacements, missing definitions are set to their default value.
1422 |
1423 | RTF_STYLESHEET_FILE =
1424 |
1425 | # Set optional variables used in the generation of an rtf document.
1426 | # Syntax is similar to doxygen's config file.
1427 |
1428 | RTF_EXTENSIONS_FILE =
1429 |
1430 | #---------------------------------------------------------------------------
1431 | # configuration options related to the man page output
1432 | #---------------------------------------------------------------------------
1433 |
1434 | # If the GENERATE_MAN tag is set to YES (the default) Doxygen will
1435 | # generate man pages
1436 |
1437 | GENERATE_MAN = NO
1438 |
1439 | # The MAN_OUTPUT tag is used to specify where the man pages will be put.
1440 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1441 | # put in front of it. If left blank `man' will be used as the default path.
1442 |
1443 | MAN_OUTPUT = man
1444 |
1445 | # The MAN_EXTENSION tag determines the extension that is added to
1446 | # the generated man pages (default is the subroutine's section .3)
1447 |
1448 | MAN_EXTENSION = .3
1449 |
1450 | # If the MAN_LINKS tag is set to YES and Doxygen generates man output,
1451 | # then it will generate one additional man file for each entity
1452 | # documented in the real man page(s). These additional files
1453 | # only source the real man page, but without them the man command
1454 | # would be unable to find the correct page. The default is NO.
1455 |
1456 | MAN_LINKS = NO
1457 |
1458 | #---------------------------------------------------------------------------
1459 | # configuration options related to the XML output
1460 | #---------------------------------------------------------------------------
1461 |
1462 | # If the GENERATE_XML tag is set to YES Doxygen will
1463 | # generate an XML file that captures the structure of
1464 | # the code including all documentation.
1465 |
1466 | GENERATE_XML = NO
1467 |
1468 | # The XML_OUTPUT tag is used to specify where the XML pages will be put.
1469 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be
1470 | # put in front of it. If left blank `xml' will be used as the default path.
1471 |
1472 | XML_OUTPUT = xml
1473 |
1474 | # The XML_SCHEMA tag can be used to specify an XML schema,
1475 | # which can be used by a validating XML parser to check the
1476 | # syntax of the XML files.
1477 |
1478 | XML_SCHEMA =
1479 |
1480 | # The XML_DTD tag can be used to specify an XML DTD,
1481 | # which can be used by a validating XML parser to check the
1482 | # syntax of the XML files.
1483 |
1484 | XML_DTD =
1485 |
1486 | # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
1487 | # dump the program listings (including syntax highlighting
1488 | # and cross-referencing information) to the XML output. Note that
1489 | # enabling this will significantly increase the size of the XML output.
1490 |
1491 | XML_PROGRAMLISTING = YES
1492 |
1493 | #---------------------------------------------------------------------------
1494 | # configuration options for the AutoGen Definitions output
1495 | #---------------------------------------------------------------------------
1496 |
1497 | # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
1498 | # generate an AutoGen Definitions (see autogen.sf.net) file
1499 | # that captures the structure of the code including all
1500 | # documentation. Note that this feature is still experimental
1501 | # and incomplete at the moment.
1502 |
1503 | GENERATE_AUTOGEN_DEF = NO
1504 |
1505 | #---------------------------------------------------------------------------
1506 | # configuration options related to the Perl module output
1507 | #---------------------------------------------------------------------------
1508 |
1509 | # If the GENERATE_PERLMOD tag is set to YES Doxygen will
1510 | # generate a Perl module file that captures the structure of
1511 | # the code including all documentation. Note that this
1512 | # feature is still experimental and incomplete at the
1513 | # moment.
1514 |
1515 | GENERATE_PERLMOD = NO
1516 |
1517 | # If the PERLMOD_LATEX tag is set to YES Doxygen will generate
1518 | # the necessary Makefile rules, Perl scripts and LaTeX code to be able
1519 | # to generate PDF and DVI output from the Perl module output.
1520 |
1521 | PERLMOD_LATEX = NO
1522 |
1523 | # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
1524 | # nicely formatted so it can be parsed by a human reader.
1525 | # This is useful
1526 | # if you want to understand what is going on.
1527 | # On the other hand, if this
1528 | # tag is set to NO the size of the Perl module output will be much smaller
1529 | # and Perl will parse it just the same.
1530 |
1531 | PERLMOD_PRETTY = YES
1532 |
1533 | # The names of the make variables in the generated doxyrules.make file
1534 | # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
1535 | # This is useful so different doxyrules.make files included by the same
1536 | # Makefile don't overwrite each other's variables.
1537 |
1538 | PERLMOD_MAKEVAR_PREFIX =
1539 |
1540 | #---------------------------------------------------------------------------
1541 | # Configuration options related to the preprocessor
1542 | #---------------------------------------------------------------------------
1543 |
1544 | # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
1545 | # evaluate all C-preprocessor directives found in the sources and include
1546 | # files.
1547 |
1548 | ENABLE_PREPROCESSING = YES
1549 |
1550 | # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
1551 | # names in the source code. If set to NO (the default) only conditional
1552 | # compilation will be performed. Macro expansion can be done in a controlled
1553 | # way by setting EXPAND_ONLY_PREDEF to YES.
1554 |
1555 | MACRO_EXPANSION = NO
1556 |
1557 | # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
1558 | # then the macro expansion is limited to the macros specified with the
1559 | # PREDEFINED and EXPAND_AS_DEFINED tags.
1560 |
1561 | EXPAND_ONLY_PREDEF = NO
1562 |
1563 | # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
1564 | # pointed to by INCLUDE_PATH will be searched when a #include is found.
1565 |
1566 | SEARCH_INCLUDES = YES
1567 |
1568 | # The INCLUDE_PATH tag can be used to specify one or more directories that
1569 | # contain include files that are not input files but should be processed by
1570 | # the preprocessor.
1571 |
1572 | INCLUDE_PATH =
1573 |
1574 | # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
1575 | # patterns (like *.h and *.hpp) to filter out the header-files in the
1576 | # directories. If left blank, the patterns specified with FILE_PATTERNS will
1577 | # be used.
1578 |
1579 | INCLUDE_FILE_PATTERNS =
1580 |
1581 | # The PREDEFINED tag can be used to specify one or more macro names that
1582 | # are defined before the preprocessor is started (similar to the -D option of
1583 | # gcc). The argument of the tag is a list of macros of the form: name
1584 | # or name=definition (no spaces). If the definition and the = are
1585 | # omitted =1 is assumed. To prevent a macro definition from being
1586 | # undefined via #undef or recursively expanded use the := operator
1587 | # instead of the = operator.
1588 |
1589 | PREDEFINED =
1590 |
1591 | # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
1592 | # this tag can be used to specify a list of macro names that should be expanded.
1593 | # The macro definition that is found in the sources will be used.
1594 | # Use the PREDEFINED tag if you want to use a different macro definition that
1595 | # overrules the definition found in the source code.
1596 |
1597 | EXPAND_AS_DEFINED =
1598 |
1599 | # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
1600 | # doxygen's preprocessor will remove all references to function-like macros
1601 | # that are alone on a line, have an all uppercase name, and do not end with a
1602 | # semicolon, because these will confuse the parser if not removed.
1603 |
1604 | SKIP_FUNCTION_MACROS = YES
1605 |
1606 | #---------------------------------------------------------------------------
1607 | # Configuration::additions related to external references
1608 | #---------------------------------------------------------------------------
1609 |
1610 | # The TAGFILES option can be used to specify one or more tagfiles. For each
1611 | # tag file the location of the external documentation should be added. The
1612 | # format of a tag file without this location is as follows:
1613 | #
1614 | # TAGFILES = file1 file2 ...
1615 | # Adding location for the tag files is done as follows:
1616 | #
1617 | # TAGFILES = file1=loc1 "file2 = loc2" ...
1618 | # where "loc1" and "loc2" can be relative or absolute paths
1619 | # or URLs. Note that each tag file must have a unique name (where the name does
1620 | # NOT include the path). If a tag file is not located in the directory in which
1621 | # doxygen is run, you must also specify the path to the tagfile here.
1622 |
1623 | TAGFILES =
1624 |
1625 | # When a file name is specified after GENERATE_TAGFILE, doxygen will create
1626 | # a tag file that is based on the input files it reads.
1627 |
1628 | GENERATE_TAGFILE =
1629 |
1630 | # If the ALLEXTERNALS tag is set to YES all external classes will be listed
1631 | # in the class index. If set to NO only the inherited external classes
1632 | # will be listed.
1633 |
1634 | ALLEXTERNALS = NO
1635 |
1636 | # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
1637 | # in the modules index. If set to NO, only the current project's groups will
1638 | # be listed.
1639 |
1640 | EXTERNAL_GROUPS = YES
1641 |
1642 | # The PERL_PATH should be the absolute path and name of the perl script
1643 | # interpreter (i.e. the result of `which perl').
1644 |
1645 | PERL_PATH = /usr/bin/perl
1646 |
1647 | #---------------------------------------------------------------------------
1648 | # Configuration options related to the dot tool
1649 | #---------------------------------------------------------------------------
1650 |
1651 | # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
1652 | # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
1653 | # or super classes. Setting the tag to NO turns the diagrams off. Note that
1654 | # this option also works with HAVE_DOT disabled, but it is recommended to
1655 | # install and use dot, since it yields more powerful graphs.
1656 |
1657 | CLASS_DIAGRAMS = YES
1658 |
1659 | # You can define message sequence charts within doxygen comments using the \msc
1660 | # command. Doxygen will then run the mscgen tool (see
1661 | # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
1662 | # documentation. The MSCGEN_PATH tag allows you to specify the directory where
1663 | # the mscgen tool resides. If left empty the tool is assumed to be found in the
1664 | # default search path.
1665 |
1666 | MSCGEN_PATH =
1667 |
1668 | # If set to YES, the inheritance and collaboration graphs will hide
1669 | # inheritance and usage relations if the target is undocumented
1670 | # or is not a class.
1671 |
1672 | HIDE_UNDOC_RELATIONS = YES
1673 |
1674 | # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
1675 | # available from the path. This tool is part of Graphviz, a graph visualization
1676 | # toolkit from AT&T and Lucent Bell Labs. The other options in this section
1677 | # have no effect if this option is set to NO (the default)
1678 |
1679 | HAVE_DOT = NO
1680 |
1681 | # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
1682 | # allowed to run in parallel. When set to 0 (the default) doxygen will
1683 | # base this on the number of processors available in the system. You can set it
1684 | # explicitly to a value larger than 0 to get control over the balance
1685 | # between CPU load and processing speed.
1686 |
1687 | DOT_NUM_THREADS = 0
1688 |
1689 | # By default doxygen will use the Helvetica font for all dot files that
1690 | # doxygen generates. When you want a differently looking font you can specify
1691 | # the font name using DOT_FONTNAME. You need to make sure dot is able to find
1692 | # the font, which can be done by putting it in a standard location or by setting
1693 | # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
1694 | # directory containing the font.
1695 |
1696 | DOT_FONTNAME = Helvetica
1697 |
1698 | # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
1699 | # The default size is 10pt.
1700 |
1701 | DOT_FONTSIZE = 10
1702 |
1703 | # By default doxygen will tell dot to use the Helvetica font.
1704 | # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
1705 | # set the path where dot can find it.
1706 |
1707 | DOT_FONTPATH =
1708 |
1709 | # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
1710 | # will generate a graph for each documented class showing the direct and
1711 | # indirect inheritance relations. Setting this tag to YES will force the
1712 | # CLASS_DIAGRAMS tag to NO.
1713 |
1714 | CLASS_GRAPH = YES
1715 |
1716 | # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
1717 | # will generate a graph for each documented class showing the direct and
1718 | # indirect implementation dependencies (inheritance, containment, and
1719 | # class references variables) of the class with other documented classes.
1720 |
1721 | COLLABORATION_GRAPH = YES
1722 |
1723 | # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
1724 | # will generate a graph for groups, showing the direct groups dependencies
1725 |
1726 | GROUP_GRAPHS = YES
1727 |
1728 | # If the UML_LOOK tag is set to YES doxygen will generate inheritance and
1729 | # collaboration diagrams in a style similar to the OMG's Unified Modeling
1730 | # Language.
1731 |
1732 | UML_LOOK = NO
1733 |
1734 | # If the UML_LOOK tag is enabled, the fields and methods are shown inside
1735 | # the class node. If there are many fields or methods and many nodes the
1736 | # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
1737 | # threshold limits the number of items for each type to make the size more
1738 | # managable. Set this to 0 for no limit. Note that the threshold may be
1739 | # exceeded by 50% before the limit is enforced.
1740 |
1741 | UML_LIMIT_NUM_FIELDS = 10
1742 |
1743 | # If set to YES, the inheritance and collaboration graphs will show the
1744 | # relations between templates and their instances.
1745 |
1746 | TEMPLATE_RELATIONS = NO
1747 |
1748 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
1749 | # tags are set to YES then doxygen will generate a graph for each documented
1750 | # file showing the direct and indirect include dependencies of the file with
1751 | # other documented files.
1752 |
1753 | INCLUDE_GRAPH = YES
1754 |
1755 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
1756 | # HAVE_DOT tags are set to YES then doxygen will generate a graph for each
1757 | # documented header file showing the documented files that directly or
1758 | # indirectly include this file.
1759 |
1760 | INCLUDED_BY_GRAPH = YES
1761 |
1762 | # If the CALL_GRAPH and HAVE_DOT options are set to YES then
1763 | # doxygen will generate a call dependency graph for every global function
1764 | # or class method. Note that enabling this option will significantly increase
1765 | # the time of a run. So in most cases it will be better to enable call graphs
1766 | # for selected functions only using the \callgraph command.
1767 |
1768 | CALL_GRAPH = NO
1769 |
1770 | # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
1771 | # doxygen will generate a caller dependency graph for every global function
1772 | # or class method. Note that enabling this option will significantly increase
1773 | # the time of a run. So in most cases it will be better to enable caller
1774 | # graphs for selected functions only using the \callergraph command.
1775 |
1776 | CALLER_GRAPH = NO
1777 |
1778 | # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
1779 | # will generate a graphical hierarchy of all classes instead of a textual one.
1780 |
1781 | GRAPHICAL_HIERARCHY = YES
1782 |
1783 | # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
1784 | # then doxygen will show the dependencies a directory has on other directories
1785 | # in a graphical way. The dependency relations are determined by the #include
1786 | # relations between the files in the directories.
1787 |
1788 | DIRECTORY_GRAPH = YES
1789 |
1790 | # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
1791 | # generated by dot. Possible values are svg, png, jpg, or gif.
1792 | # If left blank png will be used. If you choose svg you need to set
1793 | # HTML_FILE_EXTENSION to xhtml in order to make the SVG files
1794 | # visible in IE 9+ (other browsers do not have this requirement).
1795 |
1796 | DOT_IMAGE_FORMAT = png
1797 |
1798 | # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
1799 | # enable generation of interactive SVG images that allow zooming and panning.
1800 | # Note that this requires a modern browser other than Internet Explorer.
1801 | # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
1802 | # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
1803 | # visible. Older versions of IE do not have SVG support.
1804 |
1805 | INTERACTIVE_SVG = NO
1806 |
1807 | # The tag DOT_PATH can be used to specify the path where the dot tool can be
1808 | # found. If left blank, it is assumed the dot tool can be found in the path.
1809 |
1810 | DOT_PATH =
1811 |
1812 | # The DOTFILE_DIRS tag can be used to specify one or more directories that
1813 | # contain dot files that are included in the documentation (see the
1814 | # \dotfile command).
1815 |
1816 | DOTFILE_DIRS =
1817 |
1818 | # The MSCFILE_DIRS tag can be used to specify one or more directories that
1819 | # contain msc files that are included in the documentation (see the
1820 | # \mscfile command).
1821 |
1822 | MSCFILE_DIRS =
1823 |
1824 | # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
1825 | # nodes that will be shown in the graph. If the number of nodes in a graph
1826 | # becomes larger than this value, doxygen will truncate the graph, which is
1827 | # visualized by representing a node as a red box. Note that doxygen if the
1828 | # number of direct children of the root node in a graph is already larger than
1829 | # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
1830 | # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
1831 |
1832 | DOT_GRAPH_MAX_NODES = 50
1833 |
1834 | # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
1835 | # graphs generated by dot. A depth value of 3 means that only nodes reachable
1836 | # from the root by following a path via at most 3 edges will be shown. Nodes
1837 | # that lay further from the root node will be omitted. Note that setting this
1838 | # option to 1 or 2 may greatly reduce the computation time needed for large
1839 | # code bases. Also note that the size of a graph can be further restricted by
1840 | # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
1841 |
1842 | MAX_DOT_GRAPH_DEPTH = 0
1843 |
1844 | # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
1845 | # background. This is disabled by default, because dot on Windows does not
1846 | # seem to support this out of the box. Warning: Depending on the platform used,
1847 | # enabling this option may lead to badly anti-aliased labels on the edges of
1848 | # a graph (i.e. they become hard to read).
1849 |
1850 | DOT_TRANSPARENT = NO
1851 |
1852 | # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
1853 | # files in one run (i.e. multiple -o and -T options on the command line). This
1854 | # makes dot run faster, but since only newer versions of dot (>1.8.10)
1855 | # support this, this feature is disabled by default.
1856 |
1857 | DOT_MULTI_TARGETS = NO
1858 |
1859 | # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
1860 | # generate a legend page explaining the meaning of the various boxes and
1861 | # arrows in the dot generated graphs.
1862 |
1863 | GENERATE_LEGEND = YES
1864 |
1865 | # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
1866 | # remove the intermediate dot files that are used to generate
1867 | # the various graphs.
1868 |
1869 | DOT_CLEANUP = YES
1870 |
--------------------------------------------------------------------------------