Skip to content

Commit 718bb73

Browse files
gh-14: Replace code note char.
1 parent 700bd55 commit 718bb73

File tree

14 files changed

+596
-596
lines changed

14 files changed

+596
-596
lines changed

docs/SPECIFICATION.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@
7474
7575
Whitespace consists of the space character (`U+0020`), horizontal tab, carriage return, and line feed. It may appear freely between tokens and is otherwise ignored, except that newlines delimit top-level statements (see Section 5.1).
7676
77-
A comment begins with the `#` character and continues to the end of the current line. Comments have no effect on execution.
77+
A comment begins with the `!` character and continues to the end of the current line. Comments have no effect on execution.
7878
7979
Line separator alias: The semicolon character (`;`) is treated by the lexer as a newline-token alias. Whenever a `;` appears in source code outside of a string literal, the lexer emits a `NEWLINE` token (equivalent to a physical newline), so `;` can be used to separate statements on a single physical line.
8080
8181
The program text is divided into several token kinds: binary integer literals (Section 3.1); string literals delimited by double or single quotation marks (`"`, `'`, Section 3.2); identifiers for variable names and user-defined function names (Section 2.5); keywords and built-ins (control-flow keywords, built-in operators and functions; see Sections 5 and 13); and delimiters, namely `(`, `)`, `{`, `}`, `[`, `]`, `,`, `:`, and `=`.
8282

8383
Keywords: The language's reserved keywords (for example, `IF`, `WHILE`, `FUNC`, etc.) are matched by the lexer exactly as listed in this specification and are case-sensitive. Programs must use the keywords in their canonical uppercase form; otherwise the token will be recognized as an identifier. Built-in operator names such as `INPUT`, `PRINT`, and `IMPORT` follow the same case-sensitive matching rules.
8484

85-
Line continuation: The character `^` serves as a line-continuation marker. When a caret `^` appears in the source and is followed immediately by a newline, both the `^` and the newline are ignored by the lexer (that is, the logical line continues on the next physical line). The lexer also accepts a caret immediately before a code note (a comment beginning with `#`); in this case the `^`, the comment text up to the line terminator, and the terminating newline are treated as if they were not present. If a `^` is present in a string, it does not count as a line continuation. If a caret appears and is not immediately followed by a newline, a code note, or the platform's single-character newline sequence, the lexer must raise a syntax error.
85+
Line continuation: The character `^` serves as a line-continuation marker. When a caret `^` appears in the source and is followed immediately by a newline, both the `^` and the newline are ignored by the lexer (that is, the logical line continues on the next physical line). The lexer also accepts a caret immediately before a code note (a comment beginning with `!`); in this case the `^`, the comment text up to the line terminator, and the terminating newline are treated as if they were not present. If a `^` is present in a string, it does not count as a line continuation. If a caret appears and is not immediately followed by a newline, a code note, or the platform's single-character newline sequence, the lexer must raise a syntax error.
8686

8787
The character `-` primarily serves as the leading sign of a numeric literal (Section 3.1). When `-` appears immediately before optional whitespace and then binary digits, it is parsed as part of the numeric literal (that is, a signed literal). In other contexts (for example inside an index expression) a single `-` token is recognized as a dash used for slice notation `lo-hi`. If `-` appears in any other unsupported context the lexer must raise a syntax error.
8888

89-
Identifiers denote variables and user-defined functions. They must be non-empty and case-sensitive. An identifier must not contain non-ASCII characters, nor any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `#`. The first character of an identifier must not be the digit `0` or `1` (these digits are used to begin binary integer literals). However, the characters `0` and `1` are permitted in subsequent positions within an identifier (for example, `a01` and `X10Y` are valid identifiers, while `0foo` and `1bar` are not). The namespace is flat: variables and functions share a single identifier space, so a given name cannot simultaneously denote both. A user-defined function name must not conflict with the name of any built-in operator or function (see Section 13).
89+
Identifiers denote variables and user-defined functions. They must be non-empty and case-sensitive. An identifier must not contain non-ASCII characters, nor any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `!`. The first character of an identifier must not be the digit `0` or `1` (these digits are used to begin binary integer literals). However, the characters `0` and `1` are permitted in subsequent positions within an identifier (for example, `a01` and `X10Y` are valid identifiers, while `0foo` and `1bar` are not). The namespace is flat: variables and functions share a single identifier space, so a given name cannot simultaneously denote both. A user-defined function name must not conflict with the name of any built-in operator or function (see Section 13).
9090

9191
Identifier character set (clarification): The (non-empty) sequence of characters that forms an identifier is determined by the following rules, which match the reference lexer implementation:
9292

@@ -99,7 +99,7 @@
9999
- Decimal digits `2`-`9`
100100

101101
- The punctuation and symbol characters
102-
`/ ! $ % & ~ _ + | ?`
102+
`/ $ % & ~ _ + | ?`
103103

104104
- Subsequent characters in an identifier may be any of the following:
105105

@@ -110,9 +110,9 @@
110110
- Decimal digits `0`-`9`
111111

112112
- The punctuation and symbol characters
113-
`/ ! $ % & ~ _ + | ?`
113+
`/ $ % & ~ _ + | ?`
114114

115-
As noted above, non-ASCII characters remain disallowed, and the delimiter characters `{`, `}`, `(`, `)`, `=`, `,`, and `#` are never permitted inside identifiers.
115+
As noted above, non-ASCII characters remain disallowed, and the delimiter characters `{`, `}`, `(`, `)`, `=`, `,`, and `!` are never permitted inside identifiers.
116116

117117
This deliberately-permissive identifier character set preserves an unambiguous lexical distinction between binary integer literals (which must begin with `0` or `1`) and identifiers, while allowing module-qualified names and other symbolic conventions to be expressed directly as plain identifiers in source code.
118118

@@ -420,7 +420,7 @@
420420

421421
- A Python extension is a `.py` file that defines `PREFIX_EXTENSION_API_VERSION = 1` (optional; defaults to 1) and a callable `prefix_register(ext)` entrypoint.
422422

423-
- A pointer file is a `.prex` text file containing one extension path per line. Lines are trimmed; blank lines are ignored; lines beginning with `#` are comments. Relative paths are resolved relative to the `.prex` file's directory; when a referenced path is not found there the interpreter will also try the current working directory and, as a final fallback, the interpreter's own `ext/` subdirectory.
423+
- A pointer file is a `.prex` text file containing one extension path per line. Lines are trimmed; blank lines are ignored; lines beginning with `!` are comments. Relative paths are resolved relative to the `.prex` file's directory; when a referenced path is not found there the interpreter will also try the current working directory and, as a final fallback, the interpreter's own `ext/` subdirectory.
424424

425425
- If a `.prex` file is supplied as an argument, all of the linked extensions are loaded.
426426

lib/csprng.pre

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
# ChaCha20-based cryptographically secure pseudorandom number generator
2-
#
3-
# API:
4-
# SEED(INT: seed) -> INT
5-
# NEXT() -> INT
6-
# RANGE(INT: max) -> INT
7-
# RANGE_MIN_MAX(INT: min, INT: max) -> INT
1+
! ChaCha20-based cryptographically secure pseudorandom number generator
2+
!
3+
! API:
4+
! SEED(INT: seed) -> INT
5+
! NEXT() -> INT
6+
! RANGE(INT: max) -> INT
7+
! RANGE_MIN_MAX(INT: min, INT: max) -> INT
88

9-
INT: MASK32 = SUB( POW(10,100000), 1 ) # 2^32-1
9+
INT: MASK32 = SUB( POW(10,100000), 1 ) ! 2^32-1
1010

11-
# ChaCha20 constants ("expand 32-byte k")
11+
! ChaCha20 constants ("expand 32-byte k")
1212
MAP: CH_CONST = < ^
1313
0 = 01100001011100000111000001100101, ^
1414
1 = 00110011001000000110010001101110, ^
1515
10 = 01111001011000100010110100110010, ^
1616
11 = 01101011001000000110010101110100 ^
1717
>
1818

19-
TNS: ch_key = TNS([1000], 0) # 8 words
20-
TNS: ch_nonce = [0, 0, 0] # use literals for short TNS
19+
TNS: ch_key = TNS([1000], 0) ! 8 words
20+
TNS: ch_nonce = [0, 0, 0] ! use literals for short TNS
2121
INT: ch_counter = 0
22-
TNS: ch_buf = TNS([10000], 0) # 16 words
23-
INT: ch_buf_pos = TLEN(ch_buf, 1) # set to buffer length to force refill
22+
TNS: ch_buf = TNS([10000], 0) ! 16 words
23+
INT: ch_buf_pos = TLEN(ch_buf, 1) ! set to buffer length to force refill
2424

2525
FUNC ROTL32(INT: x, INT: n):INT{
2626
INT: x32 = BAND(x, MASK32)
2727
INT: left = BAND(SHL(x32, n), MASK32)
28-
INT: right = SHR(x32, SUB(100000, n)) # 32 - n
28+
INT: right = SHR(x32, SUB(100000, n)) ! 32 - n
2929
RETURN( BAND(BOR(left, right), MASK32) )
3030
}
3131

@@ -36,13 +36,13 @@ FUNC QR(TNS: s, INT: ia, INT: ib, INT: ic, INT: id):INT{
3636
INT: d = s[id]
3737

3838
a = BAND( ADD(a, b), MASK32 )
39-
d = ROTL32( BXOR(d, a), 10000 ) # 16
39+
d = ROTL32( BXOR(d, a), 10000 ) ! 16
4040
c = BAND( ADD(c, d), MASK32 )
41-
b = ROTL32( BXOR(b, c), 1100 ) # 12
41+
b = ROTL32( BXOR(b, c), 1100 ) ! 12
4242
a = BAND( ADD(a, b), MASK32 )
43-
d = ROTL32( BXOR(d, a), 1000 ) # 8
43+
d = ROTL32( BXOR(d, a), 1000 ) ! 8
4444
c = BAND( ADD(c, d), MASK32 )
45-
b = ROTL32( BXOR(b, c), 111 ) # 7
45+
b = ROTL32( BXOR(b, c), 111 ) ! 7
4646

4747
s[ia] = a
4848
s[ib] = b
@@ -72,7 +72,7 @@ FUNC CHACHA_BLOCK():INT{
7272
n[10], ^
7373
n[11] ^
7474
]
75-
FOR(i, 1010){ # 10 double-rounds
75+
FOR(i, 1010){ ! 10 double-rounds
7676
QR(state, 1, 101, 1001, 1101)
7777
QR(state, 10, 110, 1010, 1110)
7878
QR(state, 11, 111, 1011, 1111)
@@ -113,15 +113,15 @@ FUNC REFILL_BUF():INT{
113113

114114
FUNC DERIVE_KEY_AND_NONCE(INT: seed):INT{
115115
INT: s = BAND(seed, MASK32)
116-
FOR(i, 1000){ # 8 key words (1000 == 8)
116+
FOR(i, 1000){ ! 8 key words (1000 == 8)
117117
s = BAND( ADD( MUL(s, ^
118118
01000001110001100100111001101101), ^
119119
00000000000000000011000000111001 ), ^
120120
MASK32 ^
121121
)
122122
ch_key[i] = s
123123
}
124-
FOR(j, 11){ # 3 nonce words (11 == 3)
124+
FOR(j, 11){ ! 3 nonce words (11 == 3)
125125
s = BAND( ADD( MUL(s, ^
126126
01000001110001100100111001101101), ^
127127
00000000000000000011000000111001 ), ^
@@ -136,12 +136,12 @@ FUNC SEED(INT: seed):INT{
136136
DERIVE_KEY_AND_NONCE(seed)
137137
ch_counter = 0
138138
ch_buf = TNS([10000], 0)
139-
ch_buf_pos = TLEN(ch_buf, 1) # set to buffer length to force refill
139+
ch_buf_pos = TLEN(ch_buf, 1) ! set to buffer length to force refill
140140
RETURN(ch_counter)
141141
}
142142

143143
FUNC NEXT():INT{
144-
IF( GTE(ch_buf_pos, TLEN(ch_buf, 1)) ){ # buffer length
144+
IF( GTE(ch_buf_pos, TLEN(ch_buf, 1)) ){ ! buffer length
145145
REFILL_BUF()
146146
}
147147
INT: v = ch_buf[ ADD(ch_buf_pos, 1) ]

lib/diff.pre

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# diff utilities for Prefix
2-
#
3-
# API:
4-
# UNIFIED(modified: STR, source: STR):STR
5-
# CONTEXT(modified: STR, source: STR):STR
6-
# SIDE_BY_SIDE(modified: STR, source: STR):STR
1+
! diff utilities for Prefix
2+
!
3+
! API:
4+
! UNIFIED(modified: STR, source: STR):STR
5+
! CONTEXT(modified: STR, source: STR):STR
6+
! SIDE_BY_SIDE(modified: STR, source: STR):STR
77

88
FUNC _append_line(STR: acc, STR: line):STR{
99
IF( EQ(acc, "") ){ RETURN(line) } ELSE { RETURN( JOIN(acc, "\n", line) ) }
@@ -42,10 +42,10 @@ FUNC UNIFIED(STR: mod, STR: src):STR{
4242
}
4343

4444
FUNC CONTEXT(STR: mod, STR: src):STR{
45-
# For simplicity, use the same output as UNIFIED but with a ' ' prefix
45+
! For simplicity, use the same output as UNIFIED but with a ' ' prefix
4646
STR: u = UNIFIED(mod, src)
4747
IF( EQ(u, "") ){ RETURN("") }
48-
# Prepend a simple header to resemble context diff
48+
! Prepend a simple header to resemble context diff
4949
RETURN( JOIN("*** a", "\n", u) )
5050
}
5151

lib/gui/init.pre

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# `image`-interoperable GUI operations for Prefix
2-
#
3-
# API:
4-
# CREATE_WINDOW(STR: type, INT: width, INT: height, STR: title, INT: scale_to_fit=1):INT returns handle
5-
# SHOW_IMAGE(INT: window_handle, TNS: img):INT `1` on success
6-
# CLOSE_WINDOW(INT: window_handle):INT `1` on success
7-
# SCREEN():TNS returns dimensions of screen.
8-
# SCREEN_WIDTH():INT
9-
# SCREEN_HEIGHT():INT
10-
# SCREENSHOT():TNS image of the entire screen
11-
# MINIMIZE(INT: window_handle):INT `1` on success
12-
# MAXIMIZE(INT: window_handle):INT `1` on success
13-
# TO_FRONT(INT: window_handle):INT `1` on success
14-
# TO_BACK(INT: window_handle):INT `1` on success
15-
# WINDOW(INT: handle):TNS returns [width, height] of the given window handle
16-
# WINDOW_WIDTH(INT: handle):INT
17-
# WINDOW_HEIGHT(INT: handle):INT
1+
! `image`-interoperable GUI operations for Prefix
2+
!
3+
! API:
4+
! CREATE_WINDOW(STR: type, INT: width, INT: height, STR: title, INT: scale_to_fit=1):INT returns handle
5+
! SHOW_IMAGE(INT: window_handle, TNS: img):INT `1` on success
6+
! CLOSE_WINDOW(INT: window_handle):INT `1` on success
7+
! SCREEN():TNS returns dimensions of screen.
8+
! SCREEN_WIDTH():INT
9+
! SCREEN_HEIGHT():INT
10+
! SCREENSHOT():TNS image of the entire screen
11+
! MINIMIZE(INT: window_handle):INT `1` on success
12+
! MAXIMIZE(INT: window_handle):INT `1` on success
13+
! TO_FRONT(INT: window_handle):INT `1` on success
14+
! TO_BACK(INT: window_handle):INT `1` on success
15+
! WINDOW(INT: handle):TNS returns [width, height] of the given window handle
16+
! WINDOW_WIDTH(INT: handle):INT
17+
! WINDOW_HEIGHT(INT: handle):INT
1818

1919
FUNC SCREEN_WIDTH():INT{
2020
RETURN(gui.SCREEN()[1])

lib/image/init.pre

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
# Image loading helpers for Prefix
2-
# Backed by ext/image.py (stdlib-only, prefers Windows GDI+).
3-
#
4-
# API (operators provided by the model/extension):
5-
# LOAD_PNG(STR: path):TNS[width,height,[r,g,b,a]]
6-
# LOAD_JPEG(STR: path):TNS[width,height,[r,g,b,a]]
7-
# LOAD_BMP(STR: path):TNS[width,height,[r,g,b,a]]
8-
# LOAD(STR: path):TNS[height,width,[r,g,b,a]] # auto-detects format by extension
9-
# SAVE_PNG(TNS: img, STR: path, INT: compression_level)
10-
# SAVE_JPEG(TNS: img, STR: path, INT: compression_level)
11-
# SAVE_BMP(TNS: img, STR: path)
12-
# POLYGON(TNS:img, TNS:points[[x,y]...], TNS:color[r,g,b,a], INT:fill=1, INT:thickness=1):TNS
13-
# RECT(TNS: img, INT: x, INT: y, INT: width, INT: height, TNS: color[r,g,b,a], INT: fill = 1, INT: thickness = 1):TNS # wraps POLYGON
14-
# ELLIPSE(TNS: img, TNS: center, INT: rx, INT: ry, TNS: color[r,g,b,a], INT: fill = 1, INT: thickness = 1):TNS
15-
# SQUARE(TNS: img, INT: x, INT: y, INT: size, TNS: color, INT: fill, INT: thickness):TNS
16-
# CIRCLE(TNS: img, TNS: center, INT: radius, TNS: color, INT: fill, INT: thickness):TNS
17-
# WIDTH(TNS: img):INT
18-
# HEIGHT(TNS: img):INT
19-
# CHANNELS(TNS: img):INT
20-
# R(TNS: img):TNS
21-
# G(TNS: img):TNS
22-
# B(TNS: img):TNS
23-
# A(TNS: img):TNS
24-
# PIXEL(TNS: img, INT: x, INT: y):TNS
25-
# PIXEL_R(TNS: img, INT: x, INT: y):INT
26-
# PIXEL_G(TNS: img, INT: x, INT: y):INT
27-
# PIXEL_B(TNS: img, INT: x, INT: y):INT
28-
# PIXEL_A(TNS: img, INT: x, INT: y):INT
29-
# THRESHHOLD_A(TNS:img, INT:a, TNS:color=[0,0,0,0]):TNS
30-
# THRESHHOLD_R(TNS:img, INT:r, TNS:color=[0,0,0,0]):TNS
31-
# THRESHHOLD_G(TNS:img, INT:g, TNS:color=[0,0,0,0]):TNS
32-
# THRESHHOLD_B(TNS:img, INT:b, TNS:color=[0,0,0,0]):TNS
33-
# FLIP_V(TNS: img):TNS
34-
# FLIP_H(TNS: img):TNS
35-
# INVERT(TNS: img):TNS
36-
# SCALE(TNS: src, FLT: scale_x, FLT: scale_y, INT: antialiasing = 1):TNS
37-
# RESIZE(TNS: img, INT: new_width, INT: new_height, INT: antialiasing = 1):TNS
38-
# CROP(TNS:img, TNS:corners[[tl_x,tl_y],[tr_x,tr_y],[bl_x,bl_y],[br_x,br_y]]):TNS
39-
# ROTATE(TNS: img, FLT: degrees):TNS
40-
# BLIT(TNS: src, TNS: dest, INT: x, INT: y, INT: mixalpha = 1):TNS
41-
# GRAYSCALE(TNS: img):TNS # three-channel grayscale (rgb=luminance, alpha preserved)
42-
# REPLACE_COLOR(TNS: img, TNS: target_color, TNS: replacement_color):TNS
43-
# BLUR(TNS: img, INT: radius):TNS # gaussian blur with integer radius
44-
# EDGE(TNS: img):TNS # difference-of-gaussians edge detector
45-
# CELLSHADE(TNS: img, TNS: colors):TNS # map pixels to nearest palette color
46-
# SHOW(TNS: img):INT # saves to temp file and opens with default viewer (Windows only)
47-
#
48-
# The returned tensor layout is [column][row][channel] (width, height, channel)
49-
# in user code. Channels are ordered r,g,b,a and values are 0..255.
1+
! Image loading helpers for Prefix
2+
! Backed by ext/image.py (stdlib-only, prefers Windows GDI+).
3+
!
4+
! API (operators provided by the model/extension):
5+
! LOAD_PNG(STR: path):TNS[width,height,[r,g,b,a]]
6+
! LOAD_JPEG(STR: path):TNS[width,height,[r,g,b,a]]
7+
! LOAD_BMP(STR: path):TNS[width,height,[r,g,b,a]]
8+
! LOAD(STR: path):TNS[height,width,[r,g,b,a]] ! auto-detects format by extension
9+
! SAVE_PNG(TNS: img, STR: path, INT: compression_level)
10+
! SAVE_JPEG(TNS: img, STR: path, INT: compression_level)
11+
! SAVE_BMP(TNS: img, STR: path)
12+
! POLYGON(TNS:img, TNS:points[[x,y]...], TNS:color[r,g,b,a], INT:fill=1, INT:thickness=1):TNS
13+
! RECT(TNS: img, INT: x, INT: y, INT: width, INT: height, TNS: color[r,g,b,a], INT: fill = 1, INT: thickness = 1):TNS ! wraps POLYGON
14+
! ELLIPSE(TNS: img, TNS: center, INT: rx, INT: ry, TNS: color[r,g,b,a], INT: fill = 1, INT: thickness = 1):TNS
15+
! SQUARE(TNS: img, INT: x, INT: y, INT: size, TNS: color, INT: fill, INT: thickness):TNS
16+
! CIRCLE(TNS: img, TNS: center, INT: radius, TNS: color, INT: fill, INT: thickness):TNS
17+
! WIDTH(TNS: img):INT
18+
! HEIGHT(TNS: img):INT
19+
! CHANNELS(TNS: img):INT
20+
! R(TNS: img):TNS
21+
! G(TNS: img):TNS
22+
! B(TNS: img):TNS
23+
! A(TNS: img):TNS
24+
! PIXEL(TNS: img, INT: x, INT: y):TNS
25+
! PIXEL_R(TNS: img, INT: x, INT: y):INT
26+
! PIXEL_G(TNS: img, INT: x, INT: y):INT
27+
! PIXEL_B(TNS: img, INT: x, INT: y):INT
28+
! PIXEL_A(TNS: img, INT: x, INT: y):INT
29+
! THRESHHOLD_A(TNS:img, INT:a, TNS:color=[0,0,0,0]):TNS
30+
! THRESHHOLD_R(TNS:img, INT:r, TNS:color=[0,0,0,0]):TNS
31+
! THRESHHOLD_G(TNS:img, INT:g, TNS:color=[0,0,0,0]):TNS
32+
! THRESHHOLD_B(TNS:img, INT:b, TNS:color=[0,0,0,0]):TNS
33+
! FLIP_V(TNS: img):TNS
34+
! FLIP_H(TNS: img):TNS
35+
! INVERT(TNS: img):TNS
36+
! SCALE(TNS: src, FLT: scale_x, FLT: scale_y, INT: antialiasing = 1):TNS
37+
! RESIZE(TNS: img, INT: new_width, INT: new_height, INT: antialiasing = 1):TNS
38+
! CROP(TNS:img, TNS:corners[[tl_x,tl_y],[tr_x,tr_y],[bl_x,bl_y],[br_x,br_y]]):TNS
39+
! ROTATE(TNS: img, FLT: degrees):TNS
40+
! BLIT(TNS: src, TNS: dest, INT: x, INT: y, INT: mixalpha = 1):TNS
41+
! GRAYSCALE(TNS: img):TNS ! three-channel grayscale (rgb=luminance, alpha preserved)
42+
! REPLACE_COLOR(TNS: img, TNS: target_color, TNS: replacement_color):TNS
43+
! BLUR(TNS: img, INT: radius):TNS ! gaussian blur with integer radius
44+
! EDGE(TNS: img):TNS ! difference-of-gaussians edge detector
45+
! CELLSHADE(TNS: img, TNS: colors):TNS ! map pixels to nearest palette color
46+
! SHOW(TNS: img):INT ! saves to temp file and opens with default viewer (Windows only)
47+
!
48+
! The returned tensor layout is [column][row][channel] (width, height, channel)
49+
! in user code. Channels are ordered r,g,b,a and values are 0..255.
5050

5151
IMPORT(path)
5252

@@ -151,12 +151,12 @@ FUNC CIRCLE(TNS: img, TNS: center, INT: radius, TNS: color, INT: fill, INT: thic
151151
}
152152

153153
FUNC SHOW(TNS: img):INT{
154-
# Save the image to the provided path and open it with the system default
155-
# viewer on Windows. `img_path` is treated as the target file path.
154+
! Save the image to the provided path and open it with the system default
155+
! viewer on Windows. `img_path` is treated as the target file path.
156156
STR: img_path = "C:/Windows/Temp/tmp_img.png"
157157
image.SAVE_PNG(img, img_path, 0)
158-
# ShellExecuteW(hwnd, operation, file, params, dir, showcmd)
159-
# Use NULL hwnd (0), operation "open", empty params and dir, showcmd=1
158+
! ShellExecuteW(hwnd, operation, file, params, dir, showcmd)
159+
! Use NULL hwnd (0), operation "open", empty params and dir, showcmd=1
160160
win32.WIN_CALL("shell32", "ShellExecuteW", "PSSSSI", "P", 0, "open", img_path, "", "", 1)
161161
DEL(img_path)
162162
RETURN(0)

0 commit comments

Comments
 (0)