3 * Copyright 2006,2009 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
27 #include <gruel/pmt.h>
30 #include <gruel/pmt_pool.h>
35 static const int CACHE_LINE_SIZE = 64; // good guess
37 # if (PMT_LOCAL_ALLOCATOR)
39 static pmt_pool global_pmt_pool(sizeof(pmt_pair), CACHE_LINE_SIZE);
42 pmt_base::operator new(size_t size)
44 void *p = global_pmt_pool.malloc();
46 // fprintf(stderr, "pmt_base::new p = %p\n", p);
47 assert((reinterpret_cast<intptr_t>(p) & (CACHE_LINE_SIZE - 1)) == 0);
52 pmt_base::operator delete(void *p, size_t size)
54 global_pmt_pool.free(p);
59 void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
60 void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
64 // nop -- out of line virtual destructor
67 ////////////////////////////////////////////////////////////////////////////
69 ////////////////////////////////////////////////////////////////////////////
71 pmt_exception::pmt_exception(const std::string &msg, pmt_t obj)
72 : logic_error(msg + ": " + pmt_write_string(obj))
76 pmt_wrong_type::pmt_wrong_type(const std::string &msg, pmt_t obj)
77 : pmt_exception(msg + ": wrong_type ", obj)
81 pmt_out_of_range::pmt_out_of_range(const std::string &msg, pmt_t obj)
82 : pmt_exception(msg + ": out of range ", obj)
86 pmt_notimplemented::pmt_notimplemented(const std::string &msg, pmt_t obj)
87 : pmt_exception(msg + ": notimplemented ", obj)
91 ////////////////////////////////////////////////////////////////////////////
93 ////////////////////////////////////////////////////////////////////////////
98 return dynamic_cast<pmt_symbol*>(x.get());
104 return dynamic_cast<pmt_integer*>(x.get());
110 return dynamic_cast<pmt_real*>(x.get());
116 return dynamic_cast<pmt_complex*>(x.get());
122 return dynamic_cast<pmt_pair*>(x.get());
128 return dynamic_cast<pmt_vector*>(x.get());
134 return dynamic_cast<pmt_tuple*>(x.get());
137 static pmt_uniform_vector *
138 _uniform_vector(pmt_t x)
140 return dynamic_cast<pmt_uniform_vector*>(x.get());
146 return dynamic_cast<pmt_dict*>(x.get());
152 return dynamic_cast<pmt_any*>(x.get());
155 ////////////////////////////////////////////////////////////////////////////
157 ////////////////////////////////////////////////////////////////////////////
159 const pmt_t PMT_T = pmt_t(new pmt_bool()); // singleton
160 const pmt_t PMT_F = pmt_t(new pmt_bool()); // singleton
161 const pmt_t PMT_NIL = pmt_t(new pmt_null()); // singleton
162 const pmt_t PMT_EOF = pmt_cons(PMT_NIL, PMT_NIL); // singleton
164 ////////////////////////////////////////////////////////////////////////////
166 ////////////////////////////////////////////////////////////////////////////
168 pmt_bool::pmt_bool(){}
171 pmt_is_true(pmt_t obj)
177 pmt_is_false(pmt_t obj)
183 pmt_is_bool(pmt_t obj)
185 return obj->is_bool();
189 pmt_from_bool(bool val)
191 return val ? PMT_T : PMT_F;
195 pmt_to_bool(pmt_t val)
201 throw pmt_wrong_type("pmt_to_bool", val);
204 ////////////////////////////////////////////////////////////////////////////
206 ////////////////////////////////////////////////////////////////////////////
208 static const unsigned int SYMBOL_HASH_TABLE_SIZE = 701;
209 static std::vector<pmt_t> s_symbol_hash_table(SYMBOL_HASH_TABLE_SIZE);
211 pmt_symbol::pmt_symbol(const std::string &name) : d_name(name){}
215 hash_string(const std::string &s)
220 for (std::string::const_iterator p = s.begin(); p != s.end(); ++p){
221 h = (h << 4) + (*p & 0xff);
232 pmt_is_symbol(const pmt_t& obj)
234 return obj->is_symbol();
238 pmt_string_to_symbol(const std::string &name)
240 unsigned hash = hash_string(name) % SYMBOL_HASH_TABLE_SIZE;
242 // Does a symbol with this name already exist?
243 for (pmt_t sym = s_symbol_hash_table[hash]; sym; sym = _symbol(sym)->next()){
244 if (name == _symbol(sym)->name())
245 return sym; // Yes. Return it
248 // Nope. Make a new one.
249 pmt_t sym = pmt_t(new pmt_symbol(name));
250 _symbol(sym)->set_next(s_symbol_hash_table[hash]);
251 s_symbol_hash_table[hash] = sym;
257 pmt_intern(const std::string &name)
259 return pmt_string_to_symbol(name);
263 pmt_symbol_to_string(const pmt_t& sym)
265 if (!sym->is_symbol())
266 throw pmt_wrong_type("pmt_symbol_to_string", sym);
268 return _symbol(sym)->name();
273 ////////////////////////////////////////////////////////////////////////////
275 ////////////////////////////////////////////////////////////////////////////
278 pmt_is_number(pmt_t x)
280 return x->is_number();
283 ////////////////////////////////////////////////////////////////////////////
285 ////////////////////////////////////////////////////////////////////////////
287 pmt_integer::pmt_integer(long value) : d_value(value) {}
290 pmt_is_integer(pmt_t x)
292 return x->is_integer();
297 pmt_from_long(long x)
299 return pmt_t(new pmt_integer(x));
305 pmt_integer* i = dynamic_cast<pmt_integer*>(x.get());
309 throw pmt_wrong_type("pmt_to_long", x);
312 ////////////////////////////////////////////////////////////////////////////
314 ////////////////////////////////////////////////////////////////////////////
316 pmt_real::pmt_real(double value) : d_value(value) {}
325 pmt_from_double(double x)
327 return pmt_t(new pmt_real(x));
331 pmt_to_double(pmt_t x)
334 return _real(x)->value();
336 return _integer(x)->value();
338 throw pmt_wrong_type("pmt_to_double", x);
341 ////////////////////////////////////////////////////////////////////////////
343 ////////////////////////////////////////////////////////////////////////////
345 pmt_complex::pmt_complex(std::complex<double> value) : d_value(value) {}
348 pmt_is_complex(pmt_t x)
350 return x->is_complex();
354 pmt_make_rectangular(double re, double im)
356 return pmt_t(new pmt_complex(std::complex<double>(re, im)));
360 pmt_to_complex(pmt_t x)
363 return _complex(x)->value();
365 return _real(x)->value();
367 return _integer(x)->value();
369 throw pmt_wrong_type("pmt_to_complex", x);
372 ////////////////////////////////////////////////////////////////////////////
374 ////////////////////////////////////////////////////////////////////////////
376 pmt_null::pmt_null() {}
377 pmt_pair::pmt_pair(const pmt_t& car, const pmt_t& cdr) : d_car(car), d_cdr(cdr) {}
380 pmt_is_null(const pmt_t& x)
386 pmt_is_pair(const pmt_t& obj)
388 return obj->is_pair();
392 pmt_cons(const pmt_t& x, const pmt_t& y)
394 return pmt_t(new pmt_pair(x, y));
398 pmt_car(const pmt_t& pair)
400 pmt_pair* p = dynamic_cast<pmt_pair*>(pair.get());
404 throw pmt_wrong_type("pmt_car", pair);
408 pmt_cdr(const pmt_t& pair)
410 pmt_pair* p = dynamic_cast<pmt_pair*>(pair.get());
414 throw pmt_wrong_type("pmt_cdr", pair);
418 pmt_set_car(pmt_t pair, pmt_t obj)
421 _pair(pair)->set_car(obj);
423 throw pmt_wrong_type("pmt_set_car", pair);
427 pmt_set_cdr(pmt_t pair, pmt_t obj)
430 _pair(pair)->set_cdr(obj);
432 throw pmt_wrong_type("pmt_set_cdr", pair);
435 ////////////////////////////////////////////////////////////////////////////
437 ////////////////////////////////////////////////////////////////////////////
439 pmt_vector::pmt_vector(size_t len, pmt_t fill)
442 for (size_t i = 0; i < len; i++)
447 pmt_vector::ref(size_t k) const
450 throw pmt_out_of_range("pmt_vector_ref", pmt_from_long(k));
455 pmt_vector::set(size_t k, pmt_t obj)
458 throw pmt_out_of_range("pmt_vector_set", pmt_from_long(k));
463 pmt_vector::fill(pmt_t obj)
465 for (size_t i = 0; i < length(); i++)
470 pmt_is_vector(pmt_t obj)
472 return obj->is_vector();
476 pmt_make_vector(size_t k, pmt_t fill)
478 return pmt_t(new pmt_vector(k, fill));
482 pmt_vector_ref(pmt_t vector, size_t k)
484 if (!vector->is_vector())
485 throw pmt_wrong_type("pmt_vector_ref", vector);
486 return _vector(vector)->ref(k);
490 pmt_vector_set(pmt_t vector, size_t k, pmt_t obj)
492 if (!vector->is_vector())
493 throw pmt_wrong_type("pmt_vector_set", vector);
494 _vector(vector)->set(k, obj);
498 pmt_vector_fill(pmt_t vector, pmt_t obj)
500 if (!vector->is_vector())
501 throw pmt_wrong_type("pmt_vector_set", vector);
502 _vector(vector)->fill(obj);
505 ////////////////////////////////////////////////////////////////////////////
507 ////////////////////////////////////////////////////////////////////////////
509 pmt_tuple::pmt_tuple(size_t len)
515 pmt_tuple::ref(size_t k) const
518 throw pmt_out_of_range("pmt_tuple_ref", pmt_from_long(k));
523 pmt_is_tuple(pmt_t obj)
525 return obj->is_tuple();
529 pmt_tuple_ref(const pmt_t &tuple, size_t k)
531 if (!tuple->is_tuple())
532 throw pmt_wrong_type("pmt_tuple_ref", tuple);
533 return _tuple(tuple)->ref(k);
536 // for (i=0; i < 10; i++)
537 // make_constructor()
542 return pmt_t(new pmt_tuple(0));
546 pmt_make_tuple(const pmt_t &e0)
548 pmt_tuple *t = new pmt_tuple(1);
554 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1)
556 pmt_tuple *t = new pmt_tuple(2);
563 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
565 pmt_tuple *t = new pmt_tuple(3);
573 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
575 pmt_tuple *t = new pmt_tuple(4);
584 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
586 pmt_tuple *t = new pmt_tuple(5);
596 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5)
598 pmt_tuple *t = new pmt_tuple(6);
609 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6)
611 pmt_tuple *t = new pmt_tuple(7);
623 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7)
625 pmt_tuple *t = new pmt_tuple(8);
638 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8)
640 pmt_tuple *t = new pmt_tuple(9);
654 pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
656 pmt_tuple *t = new pmt_tuple(10);
671 pmt_to_tuple(const pmt_t &x)
673 if (x->is_tuple()) // already one
676 size_t len = pmt_length(x);
677 pmt_tuple *t = new pmt_tuple(len);
681 for (size_t i = 0; i < len; i++)
682 t->_set(i, _vector(x)->ref(i));
688 for (size_t i = 0; i < len; i++){
689 t->_set(i, pmt_car(y));
695 throw pmt_wrong_type("pmt_to_tuple", x);
700 ////////////////////////////////////////////////////////////////////////////
701 // Uniform Numeric Vectors
702 ////////////////////////////////////////////////////////////////////////////
705 pmt_is_uniform_vector(pmt_t x)
707 return x->is_uniform_vector();
711 pmt_uniform_vector_elements(pmt_t vector, size_t &len)
713 if (!vector->is_uniform_vector())
714 throw pmt_wrong_type("pmt_uniform_vector_elements", vector);
715 return _uniform_vector(vector)->uniform_elements(len);
719 pmt_uniform_vector_writable_elements(pmt_t vector, size_t &len)
721 if (!vector->is_uniform_vector())
722 throw pmt_wrong_type("pmt_uniform_vector_writable_elements", vector);
723 return _uniform_vector(vector)->uniform_writable_elements(len);
726 ////////////////////////////////////////////////////////////////////////////
728 ////////////////////////////////////////////////////////////////////////////
736 pmt_dict::set(pmt_t key, pmt_t value)
738 pmt_t p = pmt_assv(key, d_alist); // look for (key . value) pair
739 if (pmt_is_pair(p)){ // found existing pair...
740 pmt_set_cdr(p, value); // overrwrite cdr with new value
742 else { // not in the dict
743 d_alist = pmt_cons(pmt_cons(key, value), d_alist); // add new (key . value) pair
748 pmt_dict::ref(pmt_t key, pmt_t not_found) const
750 pmt_t p = pmt_assv(key, d_alist); // look for (key . value) pair
758 pmt_dict::has_key(pmt_t key) const
760 return pmt_is_pair(pmt_assv(key, d_alist));
764 pmt_dict::items() const
770 pmt_dict::keys() const
772 return pmt_map(pmt_car, d_alist);
776 pmt_dict::values() const
778 return pmt_map(pmt_cdr, d_alist);
782 pmt_is_dict(pmt_t obj)
784 return obj->is_dict();
790 return pmt_t(new pmt_dict());
794 pmt_dict_set(pmt_t dict, pmt_t key, pmt_t value)
796 pmt_dict* d = _dict(dict);
798 throw pmt_wrong_type("pmt_dict_set", dict);
804 pmt_dict_has_key(pmt_t dict, pmt_t key)
806 pmt_dict* d = _dict(dict);
808 throw pmt_wrong_type("pmt_dict_has_key", dict);
810 return d->has_key(key);
814 pmt_dict_ref(pmt_t dict, pmt_t key, pmt_t not_found)
816 pmt_dict* d = _dict(dict);
818 throw pmt_wrong_type("pmt_dict_ref", dict);
820 return d->ref(key, not_found);
824 pmt_dict_items(pmt_t dict)
826 if (!dict->is_dict())
827 throw pmt_wrong_type("pmt_dict_items", dict);
829 return _dict(dict)->items();
833 pmt_dict_keys(pmt_t dict)
835 if (!dict->is_dict())
836 throw pmt_wrong_type("pmt_dict_keys", dict);
838 return _dict(dict)->keys();
842 pmt_dict_values(pmt_t dict)
844 if (!dict->is_dict())
845 throw pmt_wrong_type("pmt_dict_values", dict);
847 return _dict(dict)->values();
850 ////////////////////////////////////////////////////////////////////////////
852 ////////////////////////////////////////////////////////////////////////////
854 pmt_any::pmt_any(const boost::any &any) : d_any(any) {}
857 pmt_is_any(pmt_t obj)
859 return obj->is_any();
863 pmt_make_any(const boost::any &any)
865 return pmt_t(new pmt_any(any));
869 pmt_any_ref(pmt_t obj)
872 throw pmt_wrong_type("pmt_any_ref", obj);
873 return _any(obj)->ref();
877 pmt_any_set(pmt_t obj, const boost::any &any)
880 throw pmt_wrong_type("pmt_any_set", obj);
884 ////////////////////////////////////////////////////////////////////////////
886 ////////////////////////////////////////////////////////////////////////////
889 pmt_eq(const pmt_t& x, const pmt_t& y)
895 pmt_eqv(const pmt_t& x, const pmt_t& y)
900 if (x->is_integer() && y->is_integer())
901 return _integer(x)->value() == _integer(y)->value();
903 if (x->is_real() && y->is_real())
904 return _real(x)->value() == _real(y)->value();
906 if (x->is_complex() && y->is_complex())
907 return _complex(x)->value() == _complex(y)->value();
913 pmt_equal(const pmt_t& x, const pmt_t& y)
918 if (x->is_pair() && y->is_pair())
919 return pmt_equal(pmt_car(x), pmt_car(y)) && pmt_equal(pmt_cdr(x), pmt_cdr(y));
921 if (x->is_vector() && y->is_vector()){
922 pmt_vector *xv = _vector(x);
923 pmt_vector *yv = _vector(y);
924 if (xv->length() != yv->length())
927 for (unsigned i = 0; i < xv->length(); i++)
928 if (!pmt_equal(xv->_ref(i), yv->_ref(i)))
934 if (x->is_tuple() && y->is_tuple()){
935 pmt_tuple *xv = _tuple(x);
936 pmt_tuple *yv = _tuple(y);
937 if (xv->length() != yv->length())
940 for (unsigned i = 0; i < xv->length(); i++)
941 if (!pmt_equal(xv->_ref(i), yv->_ref(i)))
947 if (x->is_uniform_vector() && y->is_uniform_vector()){
948 pmt_uniform_vector *xv = _uniform_vector(x);
949 pmt_uniform_vector *yv = _uniform_vector(y);
950 if (xv->length() != yv->length())
954 if (memcmp(xv->uniform_elements(len_x),
955 yv->uniform_elements(len_y),
962 // FIXME add other cases here...
968 pmt_length(const pmt_t& x)
971 return _vector(x)->length();
973 if (x->is_uniform_vector())
974 return _uniform_vector(x)->length();
977 return _tuple(x)->length();
984 pmt_t it = pmt_cdr(x);
985 while (pmt_is_pair(it)){
993 throw pmt_wrong_type("pmt_length", x);
996 // FIXME dictionary length (number of entries)
998 throw pmt_wrong_type("pmt_length", x);
1002 pmt_assq(pmt_t obj, pmt_t alist)
1004 while (pmt_is_pair(alist)){
1005 pmt_t p = pmt_car(alist);
1006 if (!pmt_is_pair(p)) // malformed alist
1009 if (pmt_eq(obj, pmt_car(p)))
1012 alist = pmt_cdr(alist);
1018 pmt_assv(pmt_t obj, pmt_t alist)
1020 while (pmt_is_pair(alist)){
1021 pmt_t p = pmt_car(alist);
1022 if (!pmt_is_pair(p)) // malformed alist
1025 if (pmt_eqv(obj, pmt_car(p)))
1028 alist = pmt_cdr(alist);
1034 pmt_assoc(pmt_t obj, pmt_t alist)
1036 while (pmt_is_pair(alist)){
1037 pmt_t p = pmt_car(alist);
1038 if (!pmt_is_pair(p)) // malformed alist
1041 if (pmt_equal(obj, pmt_car(p)))
1044 alist = pmt_cdr(alist);
1050 pmt_map(pmt_t proc(const pmt_t&), pmt_t list)
1054 while(pmt_is_pair(list)){
1055 r = pmt_cons(proc(pmt_car(list)), r);
1056 list = pmt_cdr(list);
1059 return pmt_reverse_x(r);
1063 pmt_reverse(pmt_t listx)
1068 while(pmt_is_pair(list)){
1069 r = pmt_cons(pmt_car(list), r);
1070 list = pmt_cdr(list);
1072 if (pmt_is_null(list))
1075 throw pmt_wrong_type("pmt_reverse", listx);
1079 pmt_reverse_x(pmt_t list)
1081 // FIXME do it destructively
1082 return pmt_reverse(list);
1086 pmt_nth(size_t n, pmt_t list)
1088 pmt_t t = pmt_nthcdr(n, list);
1096 pmt_nthcdr(size_t n, pmt_t list)
1098 if (!(pmt_is_pair(list) || pmt_is_null(list)))
1099 throw pmt_wrong_type("pmt_nthcdr", list);
1102 if (pmt_is_pair(list)){
1103 list = pmt_cdr(list);
1107 if (pmt_is_null(list))
1110 throw pmt_wrong_type("pmt_nthcdr: not a LIST", list);
1116 pmt_memq(pmt_t obj, pmt_t list)
1118 while (pmt_is_pair(list)){
1119 if (pmt_eq(obj, pmt_car(list)))
1121 list = pmt_cdr(list);
1127 pmt_memv(pmt_t obj, pmt_t list)
1129 while (pmt_is_pair(list)){
1130 if (pmt_eqv(obj, pmt_car(list)))
1132 list = pmt_cdr(list);
1138 pmt_member(pmt_t obj, pmt_t list)
1140 while (pmt_is_pair(list)){
1141 if (pmt_equal(obj, pmt_car(list)))
1143 list = pmt_cdr(list);
1149 pmt_subsetp(pmt_t list1, pmt_t list2)
1151 while (pmt_is_pair(list1)){
1152 pmt_t p = pmt_car(list1);
1153 if (pmt_is_false(pmt_memv(p, list2)))
1155 list1 = pmt_cdr(list1);
1161 pmt_list1(const pmt_t& x1)
1163 return pmt_cons(x1, PMT_NIL);
1167 pmt_list2(const pmt_t& x1, const pmt_t& x2)
1169 return pmt_cons(x1, pmt_cons(x2, PMT_NIL));
1173 pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3)
1175 return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, PMT_NIL)));
1179 pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4)
1181 return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, PMT_NIL))));
1185 pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5)
1187 return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, PMT_NIL)))));
1191 pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6)
1193 return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, pmt_cons(x5, pmt_cons(x6, PMT_NIL))))));
1197 pmt_list_add(pmt_t list, const pmt_t& item)
1199 return pmt_reverse(pmt_cons(item, pmt_reverse(list)));
1203 pmt_caar(pmt_t pair)
1205 return (pmt_car(pmt_car(pair)));
1209 pmt_cadr(pmt_t pair)
1211 return pmt_car(pmt_cdr(pair));
1215 pmt_cdar(pmt_t pair)
1217 return pmt_cdr(pmt_car(pair));
1221 pmt_cddr(pmt_t pair)
1223 return pmt_cdr(pmt_cdr(pair));
1227 pmt_caddr(pmt_t pair)
1229 return pmt_car(pmt_cdr(pmt_cdr(pair)));
1233 pmt_cadddr(pmt_t pair)
1235 return pmt_car(pmt_cdr(pmt_cdr(pmt_cdr(pair))));
1239 pmt_is_eof_object(pmt_t obj)
1241 return pmt_eq(obj, PMT_EOF);
1247 printf("sizeof(pmt_t) = %3zd\n", sizeof(pmt_t));
1248 printf("sizeof(pmt_base) = %3zd\n", sizeof(pmt_base));
1249 printf("sizeof(pmt_bool) = %3zd\n", sizeof(pmt_bool));
1250 printf("sizeof(pmt_symbol) = %3zd\n", sizeof(pmt_symbol));
1251 printf("sizeof(pmt_integer) = %3zd\n", sizeof(pmt_integer));
1252 printf("sizeof(pmt_real) = %3zd\n", sizeof(pmt_real));
1253 printf("sizeof(pmt_complex) = %3zd\n", sizeof(pmt_complex));
1254 printf("sizeof(pmt_null) = %3zd\n", sizeof(pmt_null));
1255 printf("sizeof(pmt_pair) = %3zd\n", sizeof(pmt_pair));
1256 printf("sizeof(pmt_vector) = %3zd\n", sizeof(pmt_vector));
1257 printf("sizeof(pmt_dict) = %3zd\n", sizeof(pmt_dict));
1258 printf("sizeof(pmt_uniform_vector) = %3zd\n", sizeof(pmt_uniform_vector));
1261 } /* namespace pmt */