Skip to content

Commit

Permalink
Regenerate examples
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenthuberdeau committed Oct 18, 2024
1 parent ec81a0c commit 76cea41
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 72 deletions.
19 changes: 7 additions & 12 deletions examples/compiled/c4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1626,11 +1626,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))
IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1
# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -1698,9 +1695,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -1725,7 +1722,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -1735,9 +1732,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down
19 changes: 7 additions & 12 deletions examples/compiled/cat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))

IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1

# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -178,9 +175,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -205,7 +202,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -215,9 +212,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down
19 changes: 7 additions & 12 deletions examples/compiled/cp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))

IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1

# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -162,9 +159,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -189,7 +186,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -199,9 +196,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down
19 changes: 7 additions & 12 deletions examples/compiled/repl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))
IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1
# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -1071,9 +1068,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -1098,7 +1095,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -1108,9 +1105,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down
19 changes: 7 additions & 12 deletions examples/compiled/sha256sum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))
IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1
# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -401,9 +398,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -428,7 +425,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -438,9 +435,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down
19 changes: 7 additions & 12 deletions examples/compiled/wc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@ refill_buffer() { # $1: fd
__buffer=$((__buffer_fd$__fd))

IFS=
if read -r __temp_buf <&$__fd ; then # read next line into $__temp_buf
__ends_with_eof=0
else
__ends_with_eof=1
fi
__ends_with_eof=0
read -r __temp_buf <&$__fd || __ends_with_eof=1

# Check that the buffer is large enough to unpack the line
__buflen=$((__buflen_fd$__fd - 2)) # Minus 2 to account for newline and \0
Expand Down Expand Up @@ -203,9 +200,9 @@ _open() { # $2: filename, $3: flags, $4: mode
# is read and then unpacked in the buffer.
_malloc __addr 1000 # Allocate buffer
: $((_$__addr = 0)) # Init buffer to ""
: $((__buffer_fd$__fd = __addr)) # Save buffer address
: $((__cursor_fd$__fd = 0)) # Make buffer empty
: $((__buflen_fd$__fd = 1000)) # Init buffer length
: $((__buffer_fd$__fd = __addr)) # Buffer address
: $((__cursor_fd$__fd = 0)) # Buffer cursor
: $((__buflen_fd$__fd = 1000)) # Buffer length
: $((__state_fd$__fd = $3)) # Mark the fd as opened
__res=$(_put_pstr __ $2)
if [ $3 = 0 ] ; then
Expand All @@ -230,7 +227,7 @@ _open() { # $2: filename, $3: flags, $4: mode
9) exec 9>> "$__res" ;;
esac
else
echo "Unknow file mode" ; exit 1
echo "Unknown file mode" ; exit 1
fi
fi
: $(($1 = __fd))
Expand All @@ -240,9 +237,7 @@ _read() { : $((__fd = $2)) $((__buf = $3)) $((__count = $4))
: $((__i = 0))
while [ $__i -lt $__count ] ; do
read_byte __byte $__fd
if [ $__byte -lt 0 ] ; then
break
fi
if [ $__byte -lt 0 ] ; then break; fi
: $((_$((__buf + __i)) = __byte))
: $((__i += 1))
done
Expand Down

0 comments on commit 76cea41

Please sign in to comment.