Skip to content

Commit

Permalink
Singkong Programming Language (v9.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
nopri committed Jul 28, 2024
1 parent d81353d commit 7fedf68
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 40 deletions.
Binary file modified Singkong-help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Singkong.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion Singkong.jar.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
694078f1370ef230652cab0faa984477 Singkong.jar
c81daadb99a639ff0ea7eb67db10c3b2 Singkong.jar
76 changes: 46 additions & 30 deletions Singkong.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Singkong Programming Language Interpreter
(c) Noprianto <[email protected]>, 2019-2024
Website: nopri.github.io
License: Free to use or redistribute, no warranty
Version: 9.7 (2024-May-31 +07:00)
Version: 9.8 (2024-July-28 +07:00)

Singkong is based on Monkey.java: an open source, simple implementation of
Monkey programming language interpreter in Java.
Expand Down Expand Up @@ -101,7 +101,7 @@ built-in functions, please set -DDISABLE=-.
- No command line argument: interactive
java -jar Singkong.jar

Singkong 9.7
Singkong 9.8
Press ENTER to quit
> var hello = "Hello World"
> hello
Expand Down Expand Up @@ -881,30 +881,30 @@ To get a list of built-in functions, please call builtins()
"IS_UPDATE_AVAILABLE", "ISALNUM", "ISALPHA", "ISDIGIT", "ISLOWER", "ISUPPER",
"JOIN", "KEYS", "KEYWORDS", "LAST", "LEFT", "LEFT_SHIFT", "LEN", "LF", "LOAD",
"LOAD_FILE_OR_RESOURCE", "LOAD_MODULE", "LOAD_RESOURCE", "LOG", "LOG10",
"LOGIN_DIALOG", "LOWER", "MATCHES", "MAX", "MD5", "MD5_FILE", "MENUBAR",
"MESSAGE", "MIN", "MINUTE", "MKDIR", "MODULES", "MONTH", "NEWLINE", "NUMBER",
"NUMBER_AND", "NUMBER_BOOLEAN", "NUMBER_GROUP", "NUMBER_NOT", "NUMBER_OR",
"NUMBER_SCALE", "NUMBER_TO_BYTE", "NUMBER_TO_BYTE_ARRAY", "NUMBER_XOR", "OPEN",
"ORD", "PANEL_ADD", "PANEL_CLEAR", "PANEL_DIALOG", "PANEL_REMOVE", "PARAM",
"PARSE_ARRAY", "PARSE_HASH", "PARSE_STRING", "PART", "PARTS", "PASSWORD",
"PLAY_SOUND", "POP", "POPUP_COMPONENT", "POPUP_HIDE", "POPUP_SHOW", "PRINT",
"PRINTER", "PRINTLN", "PROPERTIES_READ", "PROPERTIES_WRITE", "PUSH", "PUTS",
"QUERY", "QUOTE", "RADIO_GROUP", "RANDOM", "RANDOM_STRING", "RANGE", "READ",
"READ_BYTE", "RECT_ARRAY_SIZE", "RECT_ARRAY_SIZE_OF", "REMOVE", "REMOVE_E",
"REMOVE_N", "REMOVE_S", "REMOVE_W", "RENAME", "REPLACE", "REQUIRE", "RESET",
"RESIZABLE", "REST", "REVERSE", "RIGHT", "RIGHT_SHIFT", "ROUND",
"RUNTIME_VERSION", "SAVE", "SCREEN", "SECOND", "SEPARATOR", "SET", "SHA1",
"SHA1_FILE", "SHA256", "SHA256_FILE", "SHA384", "SHA384_FILE", "SHA512",
"SHA512_FILE", "SHOW", "SHUFFLE", "SIN", "SINGKONG", "SINGKONG_INTERPRETER",
"SINH", "SIZE", "SLICE", "SORT_ARRAY", "SORT_BOOLEAN", "SORT_DATE", "SORT_HASH",
"SORT_NUMBER", "SORT_STRING", "SPLIT", "SQRT", "START", "START_TIMER",
"STARTSWITH", "STAT", "STATUSBAR", "STDIN", "STOP", "STOP_TIMER", "STRING",
"STRING_FROM_BYTE_ARRAY", "STRING_TO_BYTE_ARRAY", "SUM", "SYSTEM", "TAB",
"TAB_ADD", "TAB_CLEAR", "TAB_REMOVE", "TABLE_ADD", "TABLE_BOTTOM",
"TABLE_CENTER", "TABLE_COLUMN", "TABLE_COLUMN_COUNT", "TABLE_COLUMN_INFO",
"TABLE_COLUMN_NAME", "TABLE_GET_VALUE", "TABLE_LEFT", "TABLE_MIDDLE",
"TABLE_PRINT", "TABLE_REMOVE", "TABLE_RIGHT", "TABLE_ROW_COUNT", "TABLE_SCROLL",
"TABLE_SET_COLOR", "TABLE_SET_RENDERER", "TABLE_SET_ROW_HEIGHT",
"LOGIN_DIALOG", "LOWER", "MAIN_RESOURCE", "MATCHES", "MAX", "MD5", "MD5_FILE",
"MENUBAR", "MESSAGE", "MIN", "MINUTE", "MKDIR", "MODULES", "MONTH", "NEWLINE",
"NUMBER", "NUMBER_AND", "NUMBER_BOOLEAN", "NUMBER_GROUP", "NUMBER_NOT",
"NUMBER_OR", "NUMBER_SCALE", "NUMBER_TO_BYTE", "NUMBER_TO_BYTE_ARRAY",
"NUMBER_XOR", "OPEN", "ORD", "PANEL_ADD", "PANEL_CLEAR", "PANEL_DIALOG",
"PANEL_REMOVE", "PARAM", "PARSE_ARRAY", "PARSE_HASH", "PARSE_STRING", "PART",
"PARTS", "PASSWORD", "PLAY_SOUND", "POP", "POPUP_COMPONENT", "POPUP_HIDE",
"POPUP_SHOW", "PRINT", "PRINTER", "PRINTLN", "PROPERTIES_READ",
"PROPERTIES_WRITE", "PUSH", "PUTS", "QUERY", "QUOTE", "RADIO_GROUP", "RANDOM",
"RANDOM_STRING", "RANGE", "READ", "READ_BYTE", "RECT_ARRAY_SIZE",
"RECT_ARRAY_SIZE_OF", "REMOVE", "REMOVE_E", "REMOVE_N", "REMOVE_S", "REMOVE_W",
"RENAME", "REPLACE", "REQUIRE", "RESET", "RESIZABLE", "REST", "REVERSE",
"RIGHT", "RIGHT_SHIFT", "ROUND", "RUNTIME_VERSION", "SAVE", "SCREEN", "SECOND",
"SEPARATOR", "SET", "SHA1", "SHA1_FILE", "SHA256", "SHA256_FILE", "SHA384",
"SHA384_FILE", "SHA512", "SHA512_FILE", "SHOW", "SHUFFLE", "SIN", "SINGKONG",
"SINGKONG_INTERPRETER", "SINH", "SIZE", "SLICE", "SORT_ARRAY", "SORT_BOOLEAN",
"SORT_DATE", "SORT_HASH", "SORT_NUMBER", "SORT_STRING", "SPLIT", "SQRT",
"START", "START_TIMER", "STARTSWITH", "STAT", "STATUSBAR", "STDIN", "STOP",
"STOP_TIMER", "STRING", "STRING_FROM_BYTE_ARRAY", "STRING_TO_BYTE_ARRAY", "SUM",
"SYSTEM", "TAB", "TAB_ADD", "TAB_CLEAR", "TAB_REMOVE", "TABLE_ADD",
"TABLE_BOTTOM", "TABLE_CENTER", "TABLE_COLUMN", "TABLE_COLUMN_COUNT",
"TABLE_COLUMN_INFO", "TABLE_COLUMN_NAME", "TABLE_GET_VALUE", "TABLE_LEFT",
"TABLE_MIDDLE", "TABLE_PRINT", "TABLE_REMOVE", "TABLE_RIGHT", "TABLE_ROW_COUNT",
"TABLE_SCROLL", "TABLE_SET_COLOR", "TABLE_SET_RENDERER", "TABLE_SET_ROW_HEIGHT",
"TABLE_SET_VALUE", "TABLE_TOP", "TAN", "TANH", "TEMP_FILE", "THREAD",
"THREAD_ALIVE", "THREAD_JOIN", "TIMER", "TIMER_RUNNING", "TITLE", "TO_BIN",
"TO_DEGREES", "TO_HEX", "TO_OCT", "TO_RADIANS", "TRIM", "TYPE", "TYPES",
Expand All @@ -913,7 +913,7 @@ To get a list of built-in functions, please call builtins()
"X_BASE64_DECODE_FILE", "X_BASE64_ENCODE_FILE", "X_EDIT_PRINT", "YEAR"]

> len(builtins())
347
348

Note: a built-in function may be disabled when the interpreter is run. In such
case, an error will be returned when the function is called.
Expand Down Expand Up @@ -1033,9 +1033,9 @@ Functions in module: util:

Functions in module: web:
["HEADER_LOCATION", "HEADER_SESSION", "HEADER_SESSION_", "HEADER_SESSION_DELETE",
"HEADER_SESSION_DELETE_", "HEADER_SESSION_SECURE", "REQUEST_METHOD",
"SESSION_FILE_DELETE", "SESSION_FILE_GET", "SESSION_FILE_GET_",
"SESSION_FILE_SET", "SESSION_NEW"]
"HEADER_SESSION_DELETE_", "HEADER_SESSION_SECURE", "QUERY_STRING_ARRAY",
"QUERY_STRING_HASH", "REQUEST_METHOD", "SESSION_FILE_DELETE",
"SESSION_FILE_GET", "SESSION_FILE_GET_", "SESSION_FILE_SET", "SESSION_NEW"]


-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1775,6 +1775,18 @@ To keep it as simple as possible:

add_n([t, c])
show()
- To show simple progress popup, please use functions popup_show_progress_ or
popup_show_progress from built-in module ui_util.
- Using popup_show_progress:
load_module("ui_util")
reset()
show()
var p = popup_show_progress()
- Using popup_show_progress_:
load_module("ui_util")
reset()
show()
var p = popup_show_progress_(20, 10, "Please wait...")
- Clipboard: to set clipboard contents, please use built-in function
clipboard_set. To get clipboard contents, built-in function clipboard_get
can be used.
Expand Down Expand Up @@ -3002,6 +3014,8 @@ Interface (CGI).
Singkong comes with simple HTTP client.
- Default user agent: Singkong <version>
- Encode or decode: please use built-in functions url_encode or url_decode
- URL-encoded query string from ARRAY or HASH: please use functions
query_string_array or query_string_hash from built-in module web.
- Base64: please use built-in functions base64_decode, base64_encode,
x_base64_decode_file, or x_base64_encode_file
- Read timeout can be set for each request (default: 60 seconds)
Expand Down Expand Up @@ -3759,6 +3773,8 @@ To bundle application file with Singkong interpreter:

- Singkong.jar must be renamed to another name (which does not contain
"Singkong").
- To get information whether main.singkong was loaded, please use
built-in function main_resource.
- Optional: another packages (Java class) may be added along with application
file
- Optional: to add resource files:
Expand Down
2 changes: 1 addition & 1 deletion Singkong.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.7
9.8
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ <h3>Dr. Noprianto</h3>
</p>

<p>
Download (4.3 MB, version 9.7, 2024-May-31):
Download (4.3 MB, version 9.8, 2024-July-28):
<a href="https://nopri.github.io/Singkong.jar">Singkong.jar</a>,
<a href="https://nopri.github.io/Singkong.jar.md5">Singkong.jar.md5</a> (checksum),
<a href="https://nopri.github.io/Singkong.txt">Singkong.txt</a> (documentation, also included in Singkong.jar).
</p>

<p>
Singkong book in Bahasa Indonesia (316 pages):
Singkong book in Bahasa Indonesia (318 pages):
<a href="https://nopri.github.io/singkong.pdf">singkong.pdf</a>
</p>

Expand Down Expand Up @@ -315,7 +315,7 @@ <h3><a href='#menu'>Books</a></h3>
<tr>
<td><a href="https://nopri.github.io/singkong.pdf">PDF</a></td>
<td>Mengenal dan Menggunakan Bahasa Pemrograman Singkong (ISBN: 978-602-52770-1-6)</td>
<td>316 pages, published in 2020 (updated 2024) by PT. Stabil Standar Sinergi</td>
<td>318 pages, published in 2020 (updated 2024) by PT. Stabil Standar Sinergi</td>
</tr>

<tr>
Expand Down Expand Up @@ -926,7 +926,7 @@ <h3><a href='#menu'>Classes (2019-2023)</a></h3>

<hr>
<div>
<p>Last updated on: 2024-May-31 +07:00</p>
<p>Last updated on: 2024-July-28 +07:00</p>
</div>
</body>
</html>
Expand Down
Binary file modified kolaborasi.pdf
Binary file not shown.
Binary file modified monkeyinterpreter.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions singkong.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ <h3><a href="https://nopri.github.io">Dr. Noprianto</a></h3>
</p>

<p>
Download (4.3 MB, version 9.7, 2024-May-31):
Download (4.3 MB, version 9.8, 2024-July-28):
<a href="https://nopri.github.io/Singkong.jar">Singkong.jar</a>,
<a href="https://nopri.github.io/Singkong.jar.md5">Singkong.jar.md5</a> (checksum),
<a href="https://nopri.github.io/Singkong.txt">Singkong.txt</a> (documentation, also included in Singkong.jar).
</p>

<p>
Singkong book in Bahasa Indonesia (316 pages):
Singkong book in Bahasa Indonesia (318 pages):
<a href="https://nopri.github.io/singkong.pdf">singkong.pdf</a>
</p>

Expand Down
Binary file modified singkong.pdf
Binary file not shown.
41 changes: 40 additions & 1 deletion ui_util.singkong
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
load_module("ui_util")
;

require(9.4)
require(9.8)

var table_to_text = fn(a, b)
"
Expand Down Expand Up @@ -294,3 +294,42 @@ return value: NUMBER (thread id) or NULL (error)
{
return thread_timer_(100, func, progress, done, intrinsic_lock)
}

var popup_show_progress_ = fn(w, h, m)
"
[ui_util] function: popup_show_progress_: shows progress popup.
arguments: 3: NUMBER (width, percent), NUMBER (height, percent), and STRING (message).
return value: NUMBER (popup index, >= 0)
"
{
var p = component("progress", "")
config(p, "active", true)
var g = component("grid", "")
grid_add(g, p, 0, 0, 1, 1, 1, 1, 1, 0)
if (!empty(m)) {
var lbl = component("label", m)
grid_add(g, lbl, 0, 1, 1, 1, 1, 1, 0, 0)
}
var f = frame()
var z = true
if (f == null) {
var f = screen()
var z = false
}
var ww = integer(f[0] * (abs(w) / 100))
var hh = integer(f[1] * (abs(h) / 100))
var x = integer((f[0] - ww) / 2)
var y = integer((f[1] - hh) / 2)
return popup_show(g, ww, hh, x, y, z)
}

var popup_show_progress = fn()
"
[ui_util] function: popup_show_progress: shows progress popup (default).
arguments:
return value: NUMBER (popup index, >= 0)
"
{
return popup_show_progress_(20, 10, "")
}

51 changes: 50 additions & 1 deletion web.singkong
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
load_module("web")
;

require(9.4)
require(9.8)

load_module("json")

Expand Down Expand Up @@ -281,4 +281,53 @@ return value: STRING (in uppercase) or NULL (error)
return upper(string(m))
}

var query_string_hash = fn(h)
"
[web] function: query_string_hash: returns URL-encoded query string from HASH.
arguments: 1: HASH
return value: STRING (empty: error)
"
{
if (!is(h, "HASH")) {
return ""
}
var r = []
var k = keys(h)
each(k, fn(e, i) {
var kk = url_encode(string(e))
var v = h[e]
var vv = url_encode(string(v))
var q = kk + "=" + vv
r + q
})
return join("&", r)
}

var query_string_array = fn(a)
"
[web] function: query_string_array: returns URL-encoded query string from ARRAY (of ARRAY).
arguments: 1: ARRAY (of [key, value] or [key])
return value: STRING (empty: error)
"
{
if (!is(a, "ARRAY")) {
return ""
}
if (!is_array_of(a, "ARRAY")) {
return ""
}
var r = []
each(a, fn(e, i) {
if (len(e) > 0) {
var kk = url_encode(string(e[0]))
var vv = ""
if (len(e) > 1) {
var vv = url_encode(string(e[1]))
}
var q = kk + "=" + vv
r + q
}
})
return join("&", r)
}

0 comments on commit 7fedf68

Please sign in to comment.