Skip to content

Commit 954c5fb

Browse files
committed
Use Incless, Inravina and Invistra as the printer stack
1 parent f422559 commit 954c5fb

46 files changed

Lines changed: 1091 additions & 5538 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/clasp/core/core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,31 @@ namespace core {
5151
#ifdef USE_SHORT_FLOAT
5252
#define CLASP_SHORT_FLOAT
5353
#define CLASP_SHORT_FLOAT_BINARY16
54+
#define SYM_SHORT_FLOAT_IMPL cl::_sym_short_float
5455
typedef _Float16 short_float_t;
5556
#else
57+
#define SYM_SHORT_FLOAT_IMPL cl::_sym_single_float
5658
typedef float short_float_t;
5759
#endif
5860

61+
#define SYM_SINGLE_FLOAT_IMPL cl::_sym_single_float
5962
typedef float single_float_t;
6063

64+
#define SYM_DOUBLE_FLOAT_IMPL cl::_sym_double_float
6165
typedef double double_float_t;
6266

6367
#if defined(USE_LONG_FLOAT) && LDBL_MANT_DIG == 64
6468
#define CLASP_LONG_FLOAT
6569
#define CLASP_LONG_FLOAT_BINARY80
70+
#define SYM_LONG_FLOAT_IMPL cl::_sym_long_float
6671
typedef long double long_float_t;
6772
#elif defined(USE_LONG_FLOAT) && LDBL_MANT_DIG == 113
6873
#define CLASP_LONG_FLOAT
6974
#define CLASP_LONG_FLOAT_BINARY128
75+
#define SYM_LONG_FLOAT_IMPL cl::_sym_long_float
7076
typedef long double long_float_t;
7177
#else
78+
#define SYM_LONG_FLOAT_IMPL cl::_sym_double_float
7279
typedef double long_float_t;
7380
#endif
7481
};

include/clasp/core/float_util.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ template <uint16_t ExponentWidth, uint16_t SignificandWidth> struct float_traits
2020
std::conditional_t<storage_width <= 32, uint32_t,
2121
std::conditional_t<storage_width <= 64, uint64_t, __uint128_t>>>>;
2222
static constexpr uint_t hidden_bit = has_hidden_bit ? uint_t{1} << (significand_width - 1) : uint_t{0};
23+
static constexpr uint_t non_hidden_bit = (!has_hidden_bit) ? uint_t{1} << (significand_width - 1) : uint_t{0};
2324
static constexpr uint16_t exponent_shift = storage_width - sign_width - exponent_width;
2425
static constexpr uint16_t sign_shift = storage_width - sign_width;
2526
static constexpr uint_t significand_mask = (uint_t{1} << (significand_width + ((has_hidden_bit) ? -1 : 0))) - uint_t{1};
@@ -78,7 +79,7 @@ template <typename Float> struct float_convert {
7879
q.significand = q.significand << shift;
7980
q.exponent = 1 - Traits::exponent_bias - shift;
8081
}
81-
} else if (q.significand == 0) {
82+
} else if (q.significand == Traits::non_hidden_bit) {
8283
q.category = category::infinity;
8384
} else if (q.significand & Traits::nan_type_mask) {
8485
q.category = category::quiet_nan;
@@ -99,7 +100,7 @@ template <typename Float> struct float_convert {
99100

100101
switch (q.category) {
101102
case category::infinity:
102-
b |= Traits::exponent_mask;
103+
b |= Traits::exponent_mask | Traits::non_hidden_bit;
103104
break;
104105
case category::quiet_nan:
105106
b |= Traits::exponent_mask | Traits::nan_type_mask | (q.significand & Traits::payload_mask);
@@ -149,7 +150,7 @@ template <typename Float> struct float_convert {
149150
if (exponent > Traits::max_exponent) {
150151
feraiseexcept(FE_OVERFLOW);
151152
// Return +/- infinity if traps masked.
152-
return b | Traits::exponent_mask;
153+
return b | Traits::exponent_mask | Traits::non_hidden_bit;
153154
}
154155

155156
if (std::bit_width(significand) < Traits::significand_width) {

repos.sexp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,18 @@
207207
(:name :incless
208208
:directory "src/lisp/kernel/contrib/Incless/"
209209
:repository "https://github.com/s-expressionists/Incless.git"
210-
:branch "main"
211-
:commit "3a8ace620f1042a54ecbba04a05c816e89aa8eab"
212-
:pin 1)
210+
:branch "host"
211+
:pin o)
213212
(:name :inravina
214213
:directory "src/lisp/kernel/contrib/Inravina/"
215214
:repository "https://github.com/s-expressionists/Inravina.git"
216-
:branch "main"
217-
:commit "a1c98c87efee5a8b5d244d116a8520981c252fff"
218-
:pin 1)
215+
:branch "host"
216+
:pin 0)
219217
(:name :invistra
220218
:directory "src/lisp/kernel/contrib/Invistra/"
221219
:repository "https://github.com/s-expressionists/Invistra.git"
222-
:branch "main"
223-
:commit "33758cc91db36ebec46df51da7235ffcf2482b0b"
224-
:pin 1)
220+
:branch "alt-parse-3"
221+
:pin 0)
225222
(:name :khazern
226223
:directory "src/lisp/kernel/contrib/Khazern/"
227224
:repository "https://github.com/s-expressionists/Khazern.git"
@@ -271,9 +268,8 @@
271268
(:name :nontrivial-gray-streams
272269
:directory "src/lisp/kernel/contrib/nontrivial-gray-streams/"
273270
:repository "https://github.com/yitzchak/nontrivial-gray-streams.git"
274-
:branch "main"
275-
:commit "0f7ba9e3018eafe03c521961183a126a2a9c0c4f"
276-
:pin 1)
271+
:branch "host"
272+
:pin 0)
277273
(:name :parser.common-rules
278274
:extension :cando
279275
:directory "src/lisp/kernel/contrib/parser.common-rules/"
@@ -296,11 +292,10 @@
296292
:commit "47a70ba1e32362e03dad6ef8e6f36180b560f86a"
297293
:pin 1)
298294
(:name :quaviver
299-
:directory "src/lisp/kernel/contrib/quaviver/"
300-
:repository "https://github.com/s-expressionists/quaviver.git"
301-
:branch "main"
302-
:commit "6d0ee719fef9dca72b4da8dd48d99c66feb317f3"
303-
:pin 1)
295+
:directory "src/lisp/kernel/contrib/Quaviver/"
296+
:repository "https://github.com/s-expressionists/Quaviver.git"
297+
:branch "host"
298+
:pin 0)
304299
(:name :quicklisp-client
305300
:directory "dependencies/quicklisp-client/"
306301
:repository "https://github.com/quicklisp/quicklisp-client.git"

src/core/bignum.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,9 @@ template <typename Float> Float limbs_to_float(mp_size_t len, const mp_limb_t* l
836836

837837
short_float_t Bignum_O::as_short_float_() const { return limbs_to_float<short_float_t>(this->length(), this->limbs()); }
838838

839-
single_float_t Bignum_O::as_single_float_() const { return limbs_to_float<float>(this->length(), this->limbs()); }
839+
single_float_t Bignum_O::as_single_float_() const { return limbs_to_float<single_float_t>(this->length(), this->limbs()); }
840840

841-
double_float_t Bignum_O::as_double_float_() const { return limbs_to_float<double>(this->length(), this->limbs()); }
841+
double_float_t Bignum_O::as_double_float_() const { return limbs_to_float<double_float_t>(this->length(), this->limbs()); }
842842

843843
long_float_t Bignum_O::as_long_float_() const { return limbs_to_float<long_float_t>(this->length(), this->limbs()); }
844844

src/core/commonLispPackage.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ SYMBOL_EXPORT_SC_(ClPkg, character);
126126
SYMBOL_EXPORT_SC_(ClPkg, characterp);
127127
SYMBOL_EXPORT_SC_(ClPkg, class);
128128
SYMBOL_EXPORT_SC_(ClPkg, class_name);
129+
SYMBOL_EXPORT_SC_(ClPkg, close);
129130
SYMBOL_EXPORT_SC_(ClPkg, compilation_speed);
130131
SYMBOL_EXPORT_SC_(ClPkg, compile);
131132
SYMBOL_EXPORT_SC_(ClPkg, compileFile);
@@ -310,6 +311,7 @@ SYMBOL_EXPORT_SC_(ClPkg, stream);
310311
SYMBOL_EXPORT_SC_(ClPkg, streamError);
311312
SYMBOL_EXPORT_SC_(ClPkg, stream_element_type);
312313
SYMBOL_EXPORT_SC_(ClPkg, stream_external_format);
314+
SYMBOL_EXPORT_SC_(ClPkg, streamp);
313315
SYMBOL_EXPORT_SC_(ClPkg, string);
314316
SYMBOL_EXPORT_SC_(ClPkg, stringp);
315317
SYMBOL_EXPORT_SC_(ClPkg, structure_object);

src/core/corePackage.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ SYMBOL_EXPORT_SC_(CorePkg, unquote_nsplice);
274274
SYMBOL_EXPORT_SC_(CorePkg, unquote_splice);
275275
SYMBOL_EXPORT_SC_(CorePkg, valist);
276276
SYMBOL_EXPORT_SC_(CorePkg, wrongNumberOfArguments);
277+
SYMBOL_SC_(CorePkg, PERCENTwrite_object);
278+
SYMBOL_SC_(CorePkg, PERCENTcircle_check);
277279
SYMBOL_SC_(CorePkg, DOT);
278280
SYMBOL_SC_(CorePkg, STARPATHSTAR);
279281
SYMBOL_SC_(CorePkg, STARargsSTAR);

src/core/debugger2.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,11 @@ struct DebuggerLevelRAII {
234234
};
235235

236236
T_mv early_debug(T_sp condition, bool can_continue) {
237+
if (condition.notnilp()) {
238+
clasp_write_string(fmt::format("Debugger entered with condition: {}\n", _rep_(condition)));
239+
}
237240
if (!isatty(0)) {
238-
printf("The low-level debugger was entered but there is no terminal on fd0 - aboring\n");
241+
printf("The low-level debugger was entered but there is no terminal on fd0 - aborting\n");
239242
abort();
240243
}
241244
if (global_options->_DebuggerDisabled) {
@@ -246,14 +249,14 @@ T_mv early_debug(T_sp condition, bool can_continue) {
246249
if (globals_->_DebuggerLevel > 10) {
247250
printf("The low-level debugger was recursively entered too many times - exiting\n");
248251
}
249-
if (condition.notnilp()) {
250-
clasp_write_string(fmt::format("Debugger entered with condition: {}\n", _rep_(condition)));
251-
}
252252
DynamicScopeManager scope(core::_sym_STARdebugConditionSTAR, condition);
253253
return call_with_frame([=](auto frame) { return early_debug_inner(frame, can_continue); });
254254
}
255255

256256
DOCGROUP(clasp);
257257
CL_DEFUN T_mv core__early_debug(T_sp condition) { return early_debug(condition, true); }
258258

259+
DOCGROUP(clasp);
260+
CL_DEFUN T_mv cl__invoke_debugger(T_sp condition) { return early_debug(condition, true); }
261+
259262
}; // namespace core

src/core/float_to_digits.cc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,35 @@ CL_DEFUN T_mv core__float_to_digits(T_sp tdigits, Float_sp number, T_sp position
110110

111111
SYMBOL_EXPORT_SC_(CorePkg, float_to_digits);
112112

113+
CL_DEFUN List_sp core__float_traits() {
114+
return Cons_O::createList(
115+
Cons_O::create(
116+
cl::_sym_short_float,
117+
Cons_O::createList(
118+
Cons_O::create(kw::_sym_exponent_size, clasp_make_fixnum(schubfach::float_traits<short_float_t>::exponent_width)),
119+
Cons_O::create(kw::_sym_significand_size,
120+
clasp_make_fixnum(schubfach::float_traits<short_float_t>::significand_width)),
121+
Cons_O::create(kw::_sym_implementation_type, SYM_SHORT_FLOAT_IMPL))),
122+
Cons_O::create(
123+
cl::_sym_single_float,
124+
Cons_O::createList(
125+
Cons_O::create(kw::_sym_exponent_size, clasp_make_fixnum(schubfach::float_traits<single_float_t>::exponent_width)),
126+
Cons_O::create(kw::_sym_significand_size,
127+
clasp_make_fixnum(schubfach::float_traits<single_float_t>::significand_width)),
128+
Cons_O::create(kw::_sym_implementation_type, SYM_SINGLE_FLOAT_IMPL))),
129+
Cons_O::create(
130+
cl::_sym_double_float,
131+
Cons_O::createList(
132+
Cons_O::create(kw::_sym_exponent_size, clasp_make_fixnum(schubfach::float_traits<double_float_t>::exponent_width)),
133+
Cons_O::create(kw::_sym_significand_size,
134+
clasp_make_fixnum(schubfach::float_traits<double_float_t>::significand_width)),
135+
Cons_O::create(kw::_sym_implementation_type, SYM_DOUBLE_FLOAT_IMPL))),
136+
Cons_O::create(cl::_sym_long_float,
137+
Cons_O::createList(Cons_O::create(kw::_sym_exponent_size,
138+
clasp_make_fixnum(schubfach::float_traits<long_float_t>::exponent_width)),
139+
Cons_O::create(kw::_sym_significand_size,
140+
clasp_make_fixnum(schubfach::float_traits<long_float_t>::significand_width)),
141+
Cons_O::create(kw::_sym_implementation_type, SYM_LONG_FLOAT_IMPL))));
142+
}
143+
113144
}; // namespace core

src/core/grayPackage.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,7 @@ SYMBOL_EXPORT_SC_(GrayPkg, stream_write_byte);
6565
SYMBOL_EXPORT_SC_(GrayPkg, stream_write_char);
6666
SYMBOL_EXPORT_SC_(GrayPkg, stream_write_sequence);
6767
SYMBOL_EXPORT_SC_(GrayPkg, stream_write_string);
68-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, close);
69-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, input_stream_p);
70-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, open_stream_p);
71-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, output_stream_p);
72-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, pathname);
73-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, stream_element_type);
74-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, stream_external_format);
7568
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, streamp);
76-
SYMBOL_SHADOW_EXPORT_SC_(GrayPkg, truename);
7769

7870
void initialize_grayPackage() {
7971
list<string> lnicknames;

src/core/keywordPackage.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ THE SOFTWARE.
3636

3737
namespace kw {
3838

39+
SYMBOL_EXPORT_SC_(KeywordPkg, significand_size);
40+
SYMBOL_EXPORT_SC_(KeywordPkg, exponent_size);
41+
SYMBOL_EXPORT_SC_(KeywordPkg, implementation_type);
3942
SYMBOL_EXPORT_SC_(KeywordPkg, FullDebug);
4043
SYMBOL_EXPORT_SC_(KeywordPkg, LineTablesOnly);
4144
SYMBOL_EXPORT_SC_(KeywordPkg, UnsignedByte);

0 commit comments

Comments
 (0)