aboutsummaryrefslogtreecommitdiff
path: root/builtins/range.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-02 18:47:39 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-02 18:47:39 -0400
commit61e482f6f36aee6f72392a6188f2ec5c858b88fd (patch)
treebea4123fcc62dd834405ae89ce9fe260e90a0023 /builtins/range.c
parentf0f8f218703ebb4512b3cd3f9e06b86a7d9861b0 (diff)
Initial WIP first past
Diffstat (limited to 'builtins/range.c')
-rw-r--r--builtins/range.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtins/range.c b/builtins/range.c
index 840397b9..9b5af8cd 100644
--- a/builtins/range.c
+++ b/builtins/range.c
@@ -4,15 +4,15 @@
#include <err.h>
#include <gmp.h>
#include <gc.h>
-#include <gc/cord.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/param.h>
-#include "types.h"
#include "integers.h"
+#include "text.h"
+#include "types.h"
#include "util.h"
@@ -32,15 +32,15 @@ static bool Range$equal(const Range_t *x, const Range_t *y, const TypeInfo *type
return Int$equal(&x->first, &y->first, &$Int) && Int$equal(&x->last, &y->last, &$Int) && Int$equal(&x->step, &y->step, &$Int);
}
-static CORD Range$as_text(const Range_t *r, bool use_color, const TypeInfo *type)
+static Text_t Range$as_text(const Range_t *r, bool use_color, const TypeInfo *type)
{
(void)type;
- if (!r) return "Range";
+ if (!r) return Text$from_str("Range");
- return CORD_asprintf(use_color ? "\x1b[0;1mRange\x1b[m(first=%r, last=%r, step=%r)"
- : "Range(first=%r, last=%r, step=%r)",
- Int$as_text(&r->first, use_color, &$Int), Int$as_text(&r->last, use_color, &$Int),
- Int$as_text(&r->step, use_color, &$Int));
+ return Text$format(use_color ? "\x1b[0;1mRange\x1b[m(first=%r, last=%r, step=%r)"
+ : "Range(first=%r, last=%r, step=%r)",
+ Int$as_text(&r->first, use_color, &$Int), Int$as_text(&r->last, use_color, &$Int),
+ Int$as_text(&r->step, use_color, &$Int));
}
public Range_t Range$reversed(Range_t r)