Skip to content

Commit aa7ed9d

Browse files
committed
Fix documents and hsp3cl print feature
1 parent 2ef5e32 commit aa7ed9d

File tree

3 files changed

+49
-36
lines changed

3 files changed

+49
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Use “setup.sh” for install the library and build or or try make from command
5959
The necessary tools have been compiled and HSP3 is ready for use.
6060

6161

62-
# Regacy Raspberry Pi installation
62+
# Legacy Raspberry Pi installation
6363

6464
It runs on RaspberryPi OS.
6565
Please use it with Raspbian running and a keyboard and mouse connected in advance.

doclib_en/hspprog.htm

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,14 +1251,16 @@ <h3 id="STRING">String</h3>
12511251
<code>"VALUE="+val</code> is <code>"VALUE=5"</code> (if the variable val is 5).
12521252
</p>
12531253
<p>
1254-
"\" is interpreted as a character with a special meaning.
1254+
As with many other programming languages, the backslash (<tt>\</tt>) is a
1255+
metacharacter in HSP strings and is used to start an escape sequence which is
1256+
interpreted as below:
12551257
</p>
12561258
<ul>
1257-
<li>"\n" means to start a new line.</li>
1258-
<li>"\t" represents the TAB code.</li>
1259-
<li>"\r" represents the return code (0x0d).</li>
1260-
<li>"\"" represents a double quote (").</li>
1261-
<li>"\\" is just a "\".</li>
1259+
<li><tt>"\n"</tt> produces a string containing a new line character (i.e. ASCII 0x0A)</li>
1260+
<li><tt>"\t"</tt> produces a string containing a horizontal tab character (i.e. ASCII 0x09)</li>
1261+
<li><tt>"\r"</tt> produces a string containing the carriage return character (i.e. ASCII 0x0d)</li>
1262+
<li><tt>"\""</tt> produces a string containing double quotes (i.e. ASCII 0x22)</li>
1263+
<li><tt>"\\"</tt> produces a string containing a single backslash (i.e. ASCII 0x5C)</li>
12621264
</ul>
12631265
<p>
12641266
Therefore, a string to indicate a directory, such as <code>"C:\WINDOWS\SYSTEM"</code>,
@@ -1267,10 +1269,10 @@ <h3 id="STRING">String</h3>
12671269
<p>
12681270
It is also possible to write long strings that do not fit on one line collectively.
12691271
</p>
1270-
<pre> mes {"
1272+
<code> mes {"
12711273
Here, you can write a message directly
12721274
on the entire line.
1273-
"}</pre>
1275+
"}</code>
12741276
<p>
12751277
In this way, everything between "{" and "}" is interpreted as a string.
12761278
When spanning multiple lines, a line feed code is inserted at the end of each line.
@@ -1301,7 +1303,7 @@ <h3 id="STRING">String</h3>
13011303
<tr><td>noteload</td><td>Load target buffer</td></tr>
13021304
</table>
13031305
<p>
1304-
In addition, many support is provided by extension plugins and modules.
1306+
Additionally, there are many more commands and functions provided by extension plugins and modules.
13051307
</p>
13061308

13071309

@@ -3040,17 +3042,43 @@ <h4>while〜wend macro</h4>
30403042
mes "a="+a
30413043
wend ; Repeats while and below only while a is 5 or less</pre>
30423044
<h4>for〜next macro</h4>
3043-
<pre>for variable name, initial value(0), final value(0), increment(1)</pre>
3045+
<code>for <em>variable</em>, <em>initial</em>, <em>final</em>, <em>increment</em></code>
30443046
<p>
3045-
By specifying as a parameter, the for〜next section is repeated the specified number of times.
3046-
Values in parentheses are values when omitted. The variable name cannot be omitted.
3047-
The specified variable is used as a counter, starting from the initial value,
3048-
and the increment is added each time it is repeated. When the final value is reached,
3049-
it exits the loop (the final value is not included in the loop).
3047+
The for〜next macro allows repeating execution of a sequence of statements.
30503048
</p>
30513049
<p>
3052-
If the final value condition is met from the beginning, the repetition will not be executed.
3053-
You can also restart from the beginning of the loop with _continue, and escape the loop with _break.
3050+
The variable name is mandatory and may not be omitted. Other parameters to the for〜next
3051+
macro may be omitted, but only if the parameters preceding it have already been specified (e.g.
3052+
not omitted).
3053+
3054+
The specified <em>variable</em> is used as a counter, starting with the <em>initial</em> value
3055+
and ending with the <em>final</em> value; after each iteraction, the value of <em>increment</em>
3056+
will be added to the counter <em>variable</em>, and the value of <em>variable</em> will be
3057+
compared against <em>final</em>. Upon <em>variable</em> reaching the <em>final</em>
3058+
value, the loop will be terminated (e.g. the loop will not execute with <em>variable</em> set to the
3059+
<em>final</em> value), and program execution continues after the loop.
3060+
3061+
<ul>
3062+
<li>If omitted, the initial value defaults to 0.</li>
3063+
<li>If omitted, the final value defaults to 0.</li>
3064+
<li>If omitted, the increment value defaults to 1.</li>
3065+
</ul>
3066+
</p>
3067+
<p>
3068+
The <em>initial</em>, <em>final</em>, and <em>increment</em> values must all evaluate to integer
3069+
expressions.
3070+
</p>
3071+
<p>
3072+
If the <em>initial</em> value is the same as the <em>final</em> value, the entire body of the
3073+
for〜next macro will not be executed.
3074+
3075+
The <code>_continue</code> macro skips execution of the remainder of the current iteration of this loop;
3076+
however, <em>increment</em> is still added to <em>variable</em>, and <em>variable</em> is still compared
3077+
to <em>final</em> to determine if the next iteration of the loop should run.
3078+
3079+
The <code>_break</code> macro terminates any remaining iterations of the loop, as if <em>variable</em>
3080+
were equal to <em>final</em>; however, <em>variable</em> retains the value it had before
3081+
the <code>_break</code> macro.
30543082
</p>
30553083
<pre>; Example
30563084
for a,0,5,1

src/hsp3/linux/hsp3gr_linux.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -237,25 +237,10 @@ static int cmdfunc_extcmd( int cmd )
237237

238238
case 0x0f: // mes,print
239239
{
240-
//char stmp[1024];
241240
char *ptr;
242-
int chk;
243-
chk = code_get();
244-
if ( chk<=PARAM_END ) {
245-
printf( "\n" );
246-
break;
247-
}
248-
ptr = (char *)(HspVarCorePtr(mpval));
249-
if ( mpval->flag != HSPVAR_FLAG_STR ) {
250-
ptr = (char *)HspVarCoreCnv( mpval->flag, HSPVAR_FLAG_STR, ptr ); // 型が一致しない場合は変換
251-
}
252-
printf( "%s\n",ptr );
253-
//strsp_ini();
254-
//while(1) {
255-
// chk = strsp_get( ptr, stmp, 0, 1022 );
256-
// printf( "%s\n",stmp );
257-
// if ( chk == 0 ) break;
258-
//}
241+
ptr = code_getdsi( "" );
242+
fputs(ptr, stdout);
243+
if (code_getdi(0) == 0) fputs("\n", stdout);
259244
break;
260245
}
261246

0 commit comments

Comments
 (0)