shithub: femtolisp

Download patch

ref: 0b985dfc7f234dd1b61b817e510ddaeac38e0de7
parent: b0833420dc549b790af34f2bcf83d4340fc951e5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Nov 12 22:54:01 EST 2024

remove "dump" builtin

--- a/dump.c
+++ /dev/null
@@ -1,35 +1,0 @@
-#include "llt.h"
-
-static char hexdig[] = "0123456789abcdef";
-
-/*
-  display a given number of bytes from a buffer, with the first
-  address label being startoffs
-*/
-void
-hexdump(ios_t *dest, const uint8_t *buffer, size_t len, size_t startoffs)
-{
-	size_t offs = 0;
-	size_t i, pos;
-	char ch, linebuffer[16], hexc[4];
-	static const char *spc50 = "                                                  ";
-
-	hexc[2] = hexc[3] = ' ';
-	do{
-		ios_printf(dest, "%.8x  ", offs+startoffs);
-		pos = 10;
-		for(i = 0; i < 16 && offs < len; i++, offs++){
-			ch = buffer[offs];
-			linebuffer[i] = (ch < 32 || ch >= 0x7f) ? '.' : ch;
-			hexc[0] = hexdig[((uint8_t)ch)>>4];
-			hexc[1] = hexdig[ch & 0x0f];
-			pos += ios_write(dest, hexc, (i == 7 || i == 15) ? 4 : 3);
-		}
-		for(; i < 16; i++)
-			linebuffer[i] = ' ';
-		ios_write(dest, spc50, 60-pos);
-		ios_putc('|', dest);
-		ios_write(dest, linebuffer, 16);
-		ios_write(dest, "|\n", 2);
-	}while(offs < len);
-}
--- a/iostream.c
+++ b/iostream.c
@@ -301,23 +301,6 @@
 	return size_wrap(ios_write(s, data, nb));
 }
 
-BUILTIN("dump", dump)
-{
-	if(nargs < 1 || nargs > 3)
-		argcount(nargs, 1);
-	ios_t *s = toiostream(symbol_value(FL(outstrsym)));
-	uint8_t *data;
-	size_t sz, offs = 0;
-	to_sized_ptr(args[0], &data, &sz);
-	size_t nb = sz;
-	if(nargs > 1){
-		get_start_count_args(args, nargs, sz, &offs, &nb);
-		data += offs;
-	}
-	hexdump(s, data, nb, offs);
-	return FL(t);
-}
-
 static uint8_t
 get_delim_arg(value_t arg)
 {
--- a/meson.build
+++ b/meson.build
@@ -60,7 +60,6 @@
 	'bitvector.c',
 	'builtins.c',
 	'cvalues.c',
-	'dump.c',
 	'equal.c',
 	'equalhash.c',
 	'flisp.c',
--- a/mkfile
+++ b/mkfile
@@ -16,7 +16,6 @@
 	bitvector.$O\
 	builtins.$O\
 	cvalues.$O\
-	dump.$O\
 	equal.$O\
 	equalhash.$O\
 	flisp.$O\