about summary refs log tree commit diff stats
path: root/dev/c/datatypes.html
diff options
context:
space:
mode:
Diffstat (limited to 'dev/c/datatypes.html')
-rw-r--r--dev/c/datatypes.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/dev/c/datatypes.html b/dev/c/datatypes.html
index a5e1efd..9ebb7db 100644
--- a/dev/c/datatypes.html
+++ b/dev/c/datatypes.html
@@ -173,9 +173,9 @@
         </dl>
 
         <a href="index.html">C Index</a>
-        <p>This is part of the Hive System Documentation.
-        Copyright (C) 2019
-        Hive Team.
+        <p>This is part of the Tribu System Documentation.
+        Copyright (C) 2020
+        Tribu Team.
         See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
         for copying conditions.</p>
 
#n70'>70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
to format :from :to
openread :from
openwrite :to
setread :from
setwrite :to
init.vars
loop
setread []
setwrite []
close :from
close :to
end

to init.vars
make "pageheight 66
make "topmar 6
make "lines 54
make "leftmar 7
make "width 65
make "filltab 5
make "nofilltab 0
make "parskip 1
make "spacing 1
make "started "false
make "filling "true
make "printed 0
make "inline []
end

to loop
forever [if process nextword [stop]]
end

;; Add a word to the output file, starting a new line if necessary

to process :word
if listp :word [output "true]
if not :started [start]
if (:linecount+1+count :word) > :width [putline]
addword :word
output "false
end

to addword :word
if not emptyp :line [make "linecount :linecount+1]
make "line lput :word :line
make "linecount :linecount+count :word
end

to putline
repeat :leftmar+:indent [type "| |]
putwords :line ((count :line)-1) (:width-:linecount)
newline
skip :spacing
end

to putwords :line :spaces :filler
local "perword
if emptyp :line [stop]
type first :line
make "perword ifelse :spaces > 0 [int ((:filler+:spaces-1)/:spaces)] [0]
if :filler > 0 [repeat :perword [type "| |]]
type "| |
putwords (butfirst :line) (:spaces-1) (:filler-:perword)
end

;; Get the next input word, reading a new line if necessary

to nextword
if not emptyp :inline [output extract.word]
if not :filling [break]
make "inline readword
if listp :inline [break output []]
if emptyp :inline [break output nextword]
if equalp first :inline "|*| ~
   [run butfirst :inline
    make "inline "]
make "inline skipspaces :inline
output nextword
end

to extract.word
local "result
make "result firstword :inline
make "inline skipfirst :inline
output :result
end

to firstword :word
if emptyp :word [output "]
if equalp first :word "| | [output "]
output word (first :word) (firstword butfirst :word)
end

to skipfirst :word
if emptyp :word [output "]
if equalp first :word "| | [output skipspaces :word]
output skipfirst butfirst :word
end

to skipspaces :word
if emptyp :word [output "]
if equalp first :word "| | [output skipspaces butfirst :word]
output :word
end

;; Formatting helpers

to start
make "started "true
repeat :topmar [print []]
newindent
end

to newindent
newline
make "indent ifelse :filling [:filltab] [:nofilltab]
make "linecount :indent
end

to newline
make "line []
make "indent 0
make "linecount 0
end

to break
if emptyp :line [stop]
make "linecount :width
putline
newindent
if :filling [skip :parskip]
end

;; Formatting commands to be invoked by the user

to skip :howmany
break
repeat :howmany [print []]
make "printed :printed+:howmany
if :printed < :lines [stop]
repeat :pageheight-:printed [print []]
make "printed 0
end

to nofill
break
make "filling "false
newindent
end

to yesfill
break
if not :filling [skip :parskip]
make "filling "true
newindent
end