Skip to content

Commit 301174d

Browse files
authored
Merge pull request #69 from chrisws/0_12_13
0 12 13
2 parents 6356661 + 8c300a5 commit 301174d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3199
-4331
lines changed

ChangeLog

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
2018-08-08 (0.12.13)
2+
ANDROID: remove hardcoded references to "/sdcard" path
3+
4+
2018-07-15 (0.12.13)
5+
ANDROID: migrate build from eclispe to android studio
6+
ANDROID: fix issue #66
7+
8+
2018-07-15 (0.12.13)
9+
SDL: Added window.setSize function
10+
11+
2018-07-07 (0.12.13)
12+
SDL: Added solarized color schemes
13+
F11 key in editor now toggles fullscreen
14+
15+
2018-07-07 (0.12.13)
16+
SDL: Implemented live edit mode
17+
18+
2018-03-08 (0.12.13)
19+
COMMON: Fix trailing spaces with LOCAL command when terminated with comma
20+
21+
2018-03-08 (0.12.13)
22+
COMMON: Fix TLOAD input error handling
23+
24+
2018-02-03 (0.12.13)
25+
COMMON: UNITPATH replaced with SBASICPATH which also works for modules
26+
27+
2018-02-03 (0.12.13)
28+
COMMON: modules refresh
29+
130
2018-02-03 (0.12.12)
231
COMMON: restore 6d array handling
332
COMMON: increase default stack size

configure.ac

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [0.12.12])
10+
AC_INIT([smallbasic], [0.12.13])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -202,15 +202,14 @@ function buildSDL() {
202202
dnl preconfigured values for SDL build
203203
AC_DEFINE(_SDL, 1, [Defined when building SDL version])
204204
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
205-
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
206205
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
207206
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
208207
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
209208
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
210209

211210
BUILD_SUBDIRS="src/common src/platform/sdl"
212211
AC_SUBST(BUILD_SUBDIRS)
213-
(cd ide/android/assets && xxd -i main.bas > ../../../src/platform/sdl/main_bas.h)
212+
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/sdl/main_bas.h)
214213
(cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
215214
}
216215

@@ -221,7 +220,6 @@ function buildAndroid() {
221220

222221
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
223222
AC_DEFINE(_ANDROID, 1, [Defined for Android build.])
224-
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
225223
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
226224
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
227225
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
@@ -261,7 +259,6 @@ function buildConsole() {
261259
dnl preconfigured values for cygwin console build (depends on cygwin.dll)
262260
TARGET="Building Cygwin console version."
263261
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
264-
AC_DEFINE(DEV_EVENTS_OSD, 0, [dev_events() implemented using osd_events().])
265262
AC_DEFINE(_CygWin, 1, [Building a minimal dev_null based command-line version.])
266263
AC_DEFINE(__CYGWIN__, 1, [as above])
267264
AC_DEFINE(INET_UNSUP, 1, [inet not supported.])
@@ -280,7 +277,6 @@ function buildConsole() {
280277
dnl preconfigured values for unix console build
281278
TARGET="Building Unix console version."
282279
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
283-
AC_DEFINE(DEV_EVENTS_OSD, 0, [dev_events() implemented using osd_events().])
284280
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread"
285281
BUILD_SUBDIRS="src/common src/platform/console"
286282
TEST_DIR="src/platform/console"
@@ -306,7 +302,6 @@ function buildWeb() {
306302
BUILD_SUBDIRS="src/common src/platform/web"
307303
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
308304
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
309-
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
310305
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
311306
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
312307
AC_DEFINE(USE_TERM_IO, 0, [dont use the termios library.])
@@ -330,6 +325,7 @@ checkDebugMode
330325
checkProfiling
331326
checkForWindows
332327

328+
CFLAGS="${CFLAGS} -std=gnu11"
333329
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Wno-unused-result"
334330
BUILD_DATE=`date +"%a, %d %b %Y"`
335331
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
smallbasic (0.12.13) unstable; urgency=low
2+
* Various see web site
3+
4+
-- Chris Warren-Smith <cwarrensmith@gmail.com> Sat, 10 Feb 2018 09:45:25 +1000
5+
16
smallbasic (0.12.12) unstable; urgency=low
27
* Various see web site
38

documentation/mkpage.bas

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#
2+
# generates a SmallBASIC program from an input template
3+
#
4+
# loosely based on https://jekyllrb.com/docs/variables/
5+
#
6+
# {% REM code %}
7+
# {{ variable-to-print }}
8+
#
9+
10+
rem ----------(%----%)-------
11+
rem ^ ^ ^
12+
rem sIndex p1 p2
13+
14+
func is_code(c2, c4)
15+
if (c2 == 0) then return false
16+
return iff(c4 == 0 or c2 < c4, true, false)
17+
end
18+
19+
func is_var(c2, c4)
20+
if (c4 == 0) then return false
21+
return iff(c2 == 0 or c4 < c2, true, false)
22+
end
23+
24+
sub text_lines(s)
25+
local lines, num_lines, i, semi, st
26+
27+
split s, chr(10), lines
28+
num_lines = len(lines) - 1
29+
for i = 0 to num_lines
30+
semi = iff(i == num_lines, ";", "")
31+
st = translate(lines[i], "\"", "\\\"")
32+
st = translate(st, chr(13), "")
33+
if (len(trim(st)) > 0) then
34+
print "print (\"" + st + "\")" + semi
35+
endif
36+
next i
37+
end
38+
39+
sub process(filename)
40+
local s, sEnd, sIndex, c1, c2, c3, c4
41+
local file, code
42+
43+
tload filename, s, 1
44+
sEnd = len(s)
45+
sIndex = 1
46+
47+
func get_pair(pair1, pair2)
48+
local p1, p2
49+
p1 = instr(sIndex, s, pair1)
50+
p2 = 0
51+
if (p1 > 0) then
52+
p2 = instr(p1 + len(pair1), s, pair2)
53+
endif
54+
return [p1, p2]
55+
end
56+
57+
while 1
58+
[c1, c2] = get_pair("{%", "%}")
59+
[c3, c4] = get_pair("{{", "}}")
60+
if (is_code(c2, c4)) then
61+
text_lines(mid(s, sIndex, c1 - sIndex))
62+
code = trim(mid(s, c1 + 2, c2 - c1 - 2))
63+
if (instr(code, "include ") == 1) then
64+
process("_includes/" + rightof(code, "include "))
65+
else
66+
print code
67+
endif
68+
sIndex = c2 + 2
69+
else if (is_var(c2, c4)) then
70+
text_lines(mid(s, sIndex, c3 - sIndex))
71+
print "print (" + mid(s, c3 + 2, c4 - c3 - 2) + ");"
72+
sIndex = c4 + 2
73+
else
74+
exit loop
75+
endif
76+
wend
77+
78+
if (sIndex < sEnd) then
79+
text_lines(mid(s, sIndex, sEnd))
80+
endif
81+
end
82+
83+
print "import site"
84+
print "if (exist(command)) then tload command, content, 1"
85+
process(trim(command))
86+

documentation/mkref.bas

Lines changed: 150 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ elif (len(args) == 2 && args(1) == "bas") then
3232
mk_bas(in_map)
3333
elif (len(args) == 2 && args(1) == "jekyll") then
3434
mk_jekyll(in_map)
35+
elif (len(args) == 2 && args(1) == "markdown") then
36+
mk_markdown(in_map)
3537
elif (len(args) == 2 && args(1) == "test") then
3638
mk_test(in_map)
3739
else
@@ -76,6 +78,23 @@ func fix_comments_jekyll(comments, keyword)
7678
fix_comments_jekyll = comments
7779
end
7880

81+
func fix_comments_pandoc(comments, keyword)
82+
comments = translate(comments, "<code>", chr(10) + "~~~" + chr(10))
83+
comments = translate(comments, "<?code>", chr(10) + "~~~" + chr(10))
84+
comments = translate(comments, "</code>", chr(10) + "~~~" + chr(10))
85+
comments = translate(comments, "<strong>", "**")
86+
comments = translate(comments, "</strong", "**")
87+
comments = translate(comments, "<cite>", "")
88+
comments = translate(comments, "</cite", "")
89+
comments = translate(comments, "<blockquote>", "> ")
90+
comments = translate(comments, "</blockquote>", "")
91+
comments = translate(comments, "</blockqoute>", "")
92+
comments = translate(comments, "p. ", "")
93+
comments = translate(comments, "bc. ", "> ")
94+
comments = fix_comments(comments, keyword)
95+
return comments
96+
end
97+
7998
sub mk_bas(byref in_map)
8099
local i, row, group, keyword
81100
local in_map_len = len(in_map) - 1
@@ -166,7 +185,7 @@ end
166185
' local test: $ bundle exec jekyll serve
167186
'
168187
sub mk_jekyll(byref in_map)
169-
local i, row, group, type, keyword, syntax, brief, comments, buffer, fname
188+
local i, row, group, type, keyword, syntax, brief, comments, buffer, filename
170189
local in_map_len = len(in_map) - 1
171190
local end_block = "<!-- end heading block -->"
172191
dim buffer
@@ -203,8 +222,136 @@ sub mk_jekyll(byref in_map)
203222
i++
204223
buffer << fix_comments_jekyll(in_map(i).comment_body_value, keyword)
205224
wend
206-
fname = "2016-06-04-" + lower(group) + "-" + lower(keyword) + ".markdown"
207-
tsave fname, buffer
225+
filename = "2016-06-04-" + lower(group) + "-" + lower(keyword) + ".markdown"
226+
tsave filename, buffer
227+
next i
228+
end
229+
230+
'
231+
' must contain at least 3 | chars
232+
'
233+
func is_table(s)
234+
local z
235+
z = instr(0, s, "|")
236+
if (z!=1) then return false
237+
238+
z = instr(z, s, "|")
239+
if (z==0) then return false
240+
241+
z = instr(z, s, "|")
242+
if (z==0) then return false
243+
244+
return true
245+
end
246+
247+
'
248+
' generate the table pattern
249+
'
250+
func table_markdown(s)
251+
local result = ""
252+
local s_len = len(s)
253+
local i
254+
for i = 1 to s_len
255+
if (mid(s, i, 1) == "|") then
256+
result += " "
257+
else
258+
result += "-"
259+
endif
260+
next i
261+
return result
262+
end
263+
264+
'
265+
' convert textile to markdown
266+
'
267+
func table_row(table_md, s)
268+
local out = trim(leftoflast(rightof(s, "|"), "|"))
269+
local j = instr(table_md, " ")
270+
local x = instr(out, "|")
271+
local n = max(1, j - x)
272+
return translate(out, "|", space(n))
273+
end
274+
275+
'
276+
' convert textile to markdown
277+
'
278+
func update_tables(byref in_str)
279+
local in_table = false
280+
local table_md = ""
281+
local out = ""
282+
local row, rows
283+
284+
split in_str, chr(10), rows
285+
for row in rows
286+
if (is_table(row)) then
287+
if (!in_table) then
288+
table_md = ltrim(table_markdown(row))
289+
in_table = true
290+
out += table_md
291+
out += chr(10)
292+
endif
293+
out += table_row(table_md, row)
294+
else
295+
if (in_table) then
296+
out += table_md
297+
out += chr(10)
298+
in_table = false
299+
endif
300+
out += row
301+
endif
302+
out += chr(10)
303+
next row
304+
return out
305+
end
306+
307+
'
308+
' make post files for smallbasic.github.io
309+
'
310+
sub mk_markdown(byref in_map)
311+
local i, row, group, type, keyword, syntax, brief, comments, buffer, filename
312+
local in_map_len = len(in_map) - 1
313+
local end_block = "<!-- end heading block -->"
314+
315+
sub append_buf(s)
316+
buffer += s
317+
buffer += chr(10)
318+
end
319+
320+
for i = 0 to in_map_len
321+
buffer=""
322+
row = in_map(i).body_value
323+
group = get_field(row, "group=", false)
324+
type = get_field(row, "type=", false)
325+
keyword = get_field(row, "keyword=", false)
326+
syntax = get_field(row, "syntax=", false)
327+
brief = get_field(row, "brief=", false)
328+
append_buf("# " + keyword)
329+
append_buf("")
330+
append_buf("> " + syntax)
331+
append_buf("")
332+
append_buf(brief)
333+
append_buf("")
334+
pos = instr(row, end_block) + len(end_block)
335+
if (pos < len(row)) then
336+
append_buf(fix_comments_pandoc(mid(row, pos), keyword))
337+
endif
338+
comments = in_map(i).comment_body_value
339+
if (comments != "NULL") then
340+
append_buf(fix_comments_pandoc(comments, keyword))
341+
endif
342+
while (i + 1 < in_map_len && in_map(i).entity_id == in_map(i + 1).entity_id)
343+
i++
344+
append_buf(fix_comments_pandoc(in_map(i).comment_body_value, keyword))
345+
wend
346+
347+
filename = in_map(i).entity_id + "-" + lower(group) + "-" + lower(keyword) + ".markdown"
348+
filename = translate(filename, " ", "")
349+
buffer = update_tables(buffer)
350+
351+
if (len(filename) > 200) then
352+
filename = in_map(i).entity_id + ".markdown"
353+
endif
354+
tsave filename, buffer
208355
next i
209356
end
210357

0 commit comments

Comments
 (0)