Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,3 +1,3 @@
mov x5, #0
ldrb w5, [x0]
cmp x5, #0
mov x5, #0
ldrb w5, [x0]
cmp x5, #0

View file

@ -6,51 +6,51 @@
.global _start
_start:
stp x29, x30, [sp, -16]!
ldr x0, =str1
mov x29, sp
bl str_empty // str_empty("");
ldr x0, =str2
bl str_empty // str_empty("non-empty");
ldp x29, x30, [sp], 16
mov x0, #0
b _exit
stp x29, x30, [sp, -16]!
ldr x0, =str1
mov x29, sp
bl str_empty // str_empty("");
ldr x0, =str2
bl str_empty // str_empty("non-empty");
ldp x29, x30, [sp], 16
mov x0, #0
b _exit
str1: .asciz ""
str2: .asciz "non-empty"
str1: .asciz ""
str2: .asciz "non-empty"
.align 4
// void str_empty(const char *s) - print "String is empty" if s is empty, "String is not empty" otherwise
str_empty:
mov x5, #0
ldrb w5, [x0]
ldr x1, =msg_empty
ldr x3, =msg_not_empty
mov x2, #16
mov x4, #20
cmp x5, #0
csel x1, x1, x3, eq // msg = s[0] == 0 ? msg_empty : msg_not_empty;
csel x2, x2, x4, eq // len = s[0] == 0 ? 16 : 20;
mov x0, #STDOUT
b _write // write(stdout, msg, len);
mov x5, #0
ldrb w5, [x0]
ldr x1, =msg_empty
ldr x3, =msg_not_empty
mov x2, #16
mov x4, #20
cmp x5, #0
csel x1, x1, x3, eq // msg = s[0] == 0 ? msg_empty : msg_not_empty;
csel x2, x2, x4, eq // len = s[0] == 0 ? 16 : 20;
mov x0, #STDOUT
b _write // write(stdout, msg, len);
msg_empty:
.ascii "String is empty\n"
.ascii "String is empty\n"
msg_not_empty:
.ascii "String is not empty\n"
.ascii "String is not empty\n"
.align 4
//////////////// system call wrappers
// ssize_t _write(int fd, void *buf, size_t count)
_write:
stp x29, x30, [sp, -16]!
mov x8, #SVC_WRITE
mov x29, sp
svc #0
ldp x29, x30, [sp], 16
ret
stp x29, x30, [sp, -16]!
mov x8, #SVC_WRITE
mov x29, sp
svc #0
ldp x29, x30, [sp], 16
ret
// void _exit(int retval)
_exit:
mov x8, #SVC_EXIT
svc #0
mov x8, #SVC_EXIT
svc #0

View file

@ -34,7 +34,7 @@ main: /* entry of program */
ldr r0,iAdrszNotEmptyString
bl affichageMess
/* second string */
/* second string */
2:
@ load string 1
ldr r1,iAdrszString1
@ -64,20 +64,19 @@ iAdrszEmptyString: .int szEmptyString
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {fp,lr} /* save registres */
push {r0,r1,r2,r7} /* save others registers */
mov r2,#0 /* counter length */
1: /* loop length calculation */
ldrb r1,[r0,r2] /* read octet start position + index */
cmp r1,#0 /* if 0 its over */
addne r2,r2,#1 /* else add 1 in the length */
bne 1b /* and loop */
push {fp,lr} /* save registres */
push {r0,r1,r2,r7} /* save others registers */
mov r2,#0 /* counter length */
1: /* loop length calculation */
ldrb r1,[r0,r2] /* read octet start position + index */
cmp r1,#0 /* if 0 its over */
addne r2,r2,#1 /* else add 1 in the length */
bne 1b /* and loop */
/* so here r2 contains the length of the message */
mov r1,r0 /* address message in r1 */
mov r0,#STDOUT /* code to write to the standard output Linux */
mov r1,r0 /* address message in r1 */
mov r0,#STDOUT /* code to write to the standard output Linux */
mov r7, #WRITE /* code call system "write" */
swi #0 /* call systeme */
pop {r0,r1,r2,r7} /* restaur others registers */
pop {fp,lr} /* restaur des 2 registres */
bx lr /* return */
pop {r0,r1,r2,r7} /* restaur others registers */
pop {fp,lr} /* restaur des 2 registres */
bx lr /* return */

View file

@ -3,8 +3,8 @@ BEGIN {
# Demonstrate how to assign an empty string to a variable.
a="";
b="XYZ";
print "a = ",a;
print "b = ",b;
print "a = ",a;
print "b = ",b;
print "length(a)=",length(a);
print "length(b)=",length(b);
# Demonstrate how to check that a string is empty.

View file

@ -1,15 +0,0 @@
procedure Empty_String is
function Is_Empty(S: String) return Boolean is
begin
return S = ""; -- test that S is empty
end Is_Empty;
Empty: String := ""; -- Assign empty string
XXXXX: String := "Not Empty";
begin
if (not Is_Empty(Empty)) or Is_Empty(XXXXX) then
raise Program_Error with "something went wrong very very badly!!!";
end if;
end Empty_String;

View file

@ -4,27 +4,27 @@ set str to ""
-- check if string is empty
if str is "" then
-- str is empty
-- str is empty
end if
-- or
if id of str is {} then
-- str is empty
-- str is empty
end if
-- or
if (count of str) is 0 then
-- str is empty
-- str is empty
end if
-- check if string is not empty
if str is not "" then
-- string is not empty
-- string is not empty
end if
-- or
if id of str is not {} then
-- str is not empty
-- str is not empty
end if
-- or
if (count of str) is not 0 then
-- str is not empty
-- str is not empty
end if

View file

@ -1,11 +1,11 @@
string c; //implicitly assigned an empty string
string c; //implicitly assigned an empty string
if (length(c) == 0) {
write("Empty string");
} else {
write("Non empty string");
}
string s = ""; //explicitly assigned an empty string
string s = ""; //explicitly assigned an empty string
if (s == "") {
write("Empty string");
}

View file

@ -1,11 +1,11 @@
subroutine IsEmpty (s$)
if length(s$) = 0 then
print "String is empty"
else
print "String is not empty"
end if
if s$ = "" then print "yes, the string is empty"
if s$ <> "" then print "no, the string is not empty"
if length(s$) = 0 then
print "String is empty"
else
print "String is not empty"
end if
if s$ = "" then print "yes, the string is empty"
if s$ <> "" then print "no, the string is not empty"
end subroutine
t$ = ""

View file

@ -1,23 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. EMPTYSTR.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 str PIC X(10).
PROCEDURE DIVISION.
Begin.
* * Assign an empty string.
INITIALIZE str.
* * Or
MOVE " " TO str.
IF (str = " ")
DISPLAY "String is empty"
ELSE
DISPLAY "String is not empty"
END-IF.
STOP RUN.

View file

@ -3,17 +3,17 @@ IMPORT StdLog;
PROCEDURE Do*;
VAR
s: ARRAY 64 OF CHAR;
(* s := "" <=> s[0] := 0X => s isEmpty*)
s: ARRAY 64 OF CHAR;
(* s := "" <=> s[0] := 0X => s isEmpty*)
BEGIN
s := "";
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = "");StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # "");StdLog.Ln;
StdLog.Ln;
(* Or *)
s := 0X;
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = 0X);StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # 0X);StdLog.Ln;
StdLog.Ln;
s := "";
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = "");StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # "");StdLog.Ln;
StdLog.Ln;
(* Or *)
s := 0X;
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = 0X);StdLog.Ln;
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # 0X);StdLog.Ln;
StdLog.Ln;
END Do;
END EmptyString.

View file

@ -1,7 +1,3 @@
a$ = ""
if a$ = ""
print "empty"
.
if a$ <> ""
print "no empty"
.
if a$ = "" : print "empty"
if a$ <> "" : print "not empty"

View file

@ -1,6 +1,6 @@
import extensions;
public program()
public Program()
{
auto s := emptyString;

View file

@ -1,6 +0,0 @@
(setq str "") ;; empty string literal
(if (= 0 (length str))
(message "string is empty"))
(if (/= 0 (length str))
(message "string is not empty"))

View file

@ -1,5 +0,0 @@
(defvar str "" "An empty string")
(if (length= str 0)
(message "string is empty")
(message "string is not empty"))

View file

@ -1,15 +0,0 @@
sequence s
-- assign an empty string
s = ""
-- another way to assign an empty string
s = {} -- "" and {} are equivalent
if not length(s) then
-- string is empty
end if
if length(s) then
-- string is not empty
end if

View file

@ -1,23 +1,23 @@
package main
import (
"fmt"
"fmt"
)
func test(s string) {
if len(s) == 0 {
fmt.Println("empty")
} else {
fmt.Println("not empty")
}
if len(s) == 0 {
fmt.Println("empty")
} else {
fmt.Println("not empty")
}
}
func main() {
// assign an empty string to a variable.
str1 := ""
str2 := " "
// check if a string is empty.
test(str1) // prt empty
// check that a string is not empty.
test(str2) // prt not empty
// assign an empty string to a variable.
str1 := ""
str2 := " "
// check if a string is empty.
test(str1) // prt empty
// check that a string is not empty.
test(str2) // prt not empty
}

View file

@ -1,13 +1,13 @@
software {
s = ""
s = ""
// Can either compare the string to an empty string or
// test if the length is zero.
if s = "" or #s = 0
print("Empty string!")
end
// Can either compare the string to an empty string or
// test if the length is zero.
if s = "" or #s = 0
print("Empty string!")
end
if s - "" or #s - 0
print("Not an empty string!")
end
if s - "" or #s - 0
print("Not an empty string!")
end
}

View file

@ -3,10 +3,10 @@ local(str = string)
local(str = '')
//Demonstrate how to check that a string is empty.
#str->size == 0 // true
not #str->size // true
#str->size == 0 // true
not #str->size // true
//Demonstrate how to check that a string is not empty.
local(str = 'Hello, World!')
#str->size > 0 // true
#str->size // true
#str->size > 0 // true
#str->size // true

View file

@ -9,12 +9,12 @@ BEGIN
Str := "";
(* Check if Str is empty *)
IF Text.Empty(Str) THEN
IO.Put("Str is empty!\n");
IO.Put("Str is empty!\n");
END;
(* Same as above: *)
IF Text.Length(Str) = 0 THEN
IO.Put("Str is empty!\n");
IO.Put("Str is empty!\n");
END;
(* To check for a non-empty string, negate any of the above
conditions with NOT *)
conditions with NOT *)
END EmptyString.

View file

@ -1,24 +1,24 @@
program emptyString(output);
var
s: string(20);
s: string(20);
begin
{ assigning an empty string }
s := '';
{ checking for an empty string }
writeLn( 'EQ(s, '''') :':20, EQ(s, ''):6);
writeLn( 'length(s) = 0 :':20, length(s) = 0:6);
{ checking that a string is not empty }
writeLn( 'NE(s, '''') :':20, NE(s, ''):6);
writeLn( 'length(s) > 0 :':20, length(s) > 0:6);
{ Beware: Only the string comparison functions (`EQ`, `NE`, etc.) take }
{ the strings length into account. The symbolic `=` equal comparison }
{ operator, however, will pad operands with blanks to the same common }
{ length, and _subsequently_ compare individual string components. }
writeLn('!!! s = '' '' :':20, s = ' ':6);
{ If you want to perform the empty string check with an `=` comparison, }
{ you will need to call `trim` (remove trailing blanks) first. }
writeLn('trim(s) = '''' :':20, trim(s) = '':6)
{ assigning an empty string }
s := '';
{ checking for an empty string }
writeLn( 'EQ(s, '''') :':20, EQ(s, ''):6);
writeLn( 'length(s) = 0 :':20, length(s) = 0:6);
{ checking that a string is not empty }
writeLn( 'NE(s, '''') :':20, NE(s, ''):6);
writeLn( 'length(s) > 0 :':20, length(s) > 0:6);
{ Beware: Only the string comparison functions (`EQ`, `NE`, etc.) take }
{ the strings length into account. The symbolic `=` equal comparison }
{ operator, however, will pad operands with blanks to the same common }
{ length, and _subsequently_ compare individual string components. }
writeLn('!!! s = '' '' :':20, s = ' ':6);
{ If you want to perform the empty string check with an `=` comparison, }
{ you will need to call `trim` (remove trailing blanks) first. }
writeLn('trim(s) = '''' :':20, trim(s) = '':6)
end.

View file

@ -1,12 +1,12 @@
int main() {
string s;
string s;
if (!s == 1 || sizeof(s) == 0 || s == "") {
write("String is empty\n");
}
else {
write("String not empty\n");
}
if (!s == 1 || sizeof(s) == 0 || s == "") {
write("String is empty\n");
}
else {
write("String not empty\n");
}
return 0;
return 0;
}

View file

@ -1,4 +0,0 @@
[string]$alpha = "abcdefghijklmnopqrstuvwxyz"
[string]$empty = ""
# or...
[string]$empty = [String]::Empty

View file

@ -1,2 +0,0 @@
[String]::IsNullOrEmpty($alpha)
[String]::IsNullOrEmpty($empty)

View file

@ -1,10 +1,10 @@
SUB IsEmpty (s AS STRING)
IF LEN(s) = 0 THEN
PRINT "String is empty"
PRINT "String is empty"
ELSE
PRINT "String is not empty"
PRINT "String is not empty"
END IF
IF s = "" THEN PRINT "yes, the string is empty"
IF s = "" THEN PRINT "yes, the string is empty"
IF s <> "" THEN PRINT "no, the string is not empty"
END SUB

View file

@ -1,39 +1,20 @@
/*REXX program shows how to assign an empty string, & then check for empty/not-empty str*/
-- 8 Nov 2025
include Setting
/*─────────────── 3 simple ways to assign an empty string to a variable.*/
auk='' /*uses two single quotes (also called apostrophes); easier to peruse. */
ide="" /*uses two quotes, sometimes called a double quote. */
doe= /*··· nothing at all (which in this case, a null value is assigned. */
say 'EMPTY STRING'
say version
say
a=''; b='string'
if a='' then
say 'a is empty'
if length(a)=0 then
say 'a is empty'
if b<>'' then
say 'b is not empty'
if \(b='') then
say 'b is not empty'
if length(b)>0 then
say 'b is not empty'
exit
/*─────────────── assigning multiple null values to vars, 2 methods are:*/
parse var doe emu pug yak nit moa owl pas jay koi ern ewe fae gar hob
/*where emu, pug, yak, ··· (and the rest) are all set to a null value.*/
/*───or─── (with less clutter ─── or more, depending on your perception)*/
parse value 0 with . ant ape ant imp fly tui paa elo dab cub bat ayu
/*where the value of zero is skipped, and the rest are set to null,*/
/*which is the next value AFTER the 0 (zero): nothing (or a null).*/
/*─────────────── how to check that a string is empty, several methods: */
if cat=='' then say "the feline is not here."
if pig=="" then say 'no ham today.'
if length(gnu)==0 then say "the wildebeest's stomach is empty and hungry."
if length(ips)=0 then say "checking with == instead of = is faster"
if length(hub)<1 then method = "this is rather obtuse, don't do as I do ···"
nit='' /*assign an empty string to a lice egg.*/
if cow==nit then say 'the cow has no milk today.'
/*─────────────── how to check that a string isn't empty, several ways: */
if dog\=='' then say "the dogs are out!"
/*most REXXes support the ¬ character. */
if fox¬=='' then say "and the fox is in the henhouse."
if length(rat)>0 then say "the rat is singing" /*an obscure-ish (or ugly) way to test.*/
if elk=='' then nop; else say "long way obtuse for an elk to be tested."
if length(eel)\==0 then fish=eel /*a fast compare (than below), & quick.*/
if length(cod)\=0 then fish=cod /*a not-as-fast compare. */
/*────────────────────────── anyway, as they say: "choose your poison." */
include Abend

View file

@ -2,10 +2,10 @@ var$ = ""
' --------------
'empty string
' -------------
if var$="" then print "String is Empty"
if len(var$)=0 then print "String is Empty"
if var$="" then print "String is Empty"
if len(var$)=0 then print "String is Empty"
' -------------
'not empty string
' -------------
if var$<>"" then print "String Not empty."
if len(var$)>0 then print "String Not empty."
if var$<>"" then print "String Not empty."
if len(var$)>0 then print "String Not empty."

View file

@ -2,7 +2,7 @@ decl string s
set s ""
if (= s "")
out "empty" endl console
out "empty" endl console
else
out "not empty" endl console
out "not empty" endl console
end if

View file

@ -1,17 +1,17 @@
fn test(s string) {
if s.len() == 0 {
println("empty")
} else {
println("not empty")
}
if s.len() == 0 {
println("empty")
} else {
println("not empty")
}
}
fn main() {
// assign an empty string to a variable.
str1 := ""
str2 := " "
// check if a string is empty.
test(str1) // prt empty
// check that a string is not empty.
test(str2) // prt not empty
// assign an empty string to a variable.
str1 := ""
str2 := " "
// check if a string is empty.
test(str1) // prt empty
// check that a string is not empty.
test(str2) // prt not empty
}

View file

@ -4,7 +4,7 @@ sub IsEmpty (s$)
else
print "String is not empty"
endif
if s$ = "" print "yes, the string is empty"
if s$ = "" print "yes, the string is empty"
if s$ <> "" print "no, the string is not empty"
end sub

View file

@ -1,15 +1,15 @@
ld hl,MyString
GetStringLength:
ld b,0 ;zero the length counter
ld b,0 ;zero the length counter
loop_getStringLength:
ld a,(hl)
or a ;compare A to zero
ret z ;exit if zero
ld a,(hl)
or a ;compare A to zero
ret z ;exit if zero
inc hl ;next char
inc b ;add 1 to length counter
jr loop_getStringLength
inc hl ;next char
inc b ;add 1 to length counter
jr loop_getStringLength
ld a,b ;load B into A
or a ;compare A to zero (effectively comparing B to zero)

View file

@ -1,7 +1,7 @@
var string
string = ""
if eq string ""
print "The string is empty."
print "The string is empty."
else
print "The string is not empty."
print "The string is not empty."
endif