OLD | NEW |
1 #ifndef SMALL_SMOBS_HH | 1 #ifndef SMALL_SMOBS_HH |
2 #define SMALL_SMOBS_HH | 2 #define SMALL_SMOBS_HH |
3 | 3 |
4 #include "smobs.hh" | 4 #include "smobs.hh" |
5 | 5 |
6 #if GUILEV2 | 6 #if GUILEV2 |
7 // Fix the APIs of GUILE2.x, broken in 2009--2014 | 7 // Fix the APIs of GUILE2.x, broken in 2009--2014 |
8 #undef SCM_SMOB_OBJECT_LOC | 8 #undef SCM_SMOB_OBJECT_LOC |
9 #undef SCM_SMOB_OBJECT_2_LOC | 9 #undef SCM_SMOB_OBJECT_2_LOC |
10 #undef SCM_SMOB_OBJECT_3_LOC | 10 #undef SCM_SMOB_OBJECT_3_LOC |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 scm_gc_mark (scm3 ()); | 93 scm_gc_mark (scm3 ()); |
94 scm_gc_mark (scm2 ()); | 94 scm_gc_mark (scm2 ()); |
95 return scm1 (); | 95 return scm1 (); |
96 } | 96 } |
97 static Super *unchecked_unsmob (SCM s) | 97 static Super *unchecked_unsmob (SCM s) |
98 { | 98 { |
99 return reinterpret_cast<Super *> (SCM_UNPACK (s)); | 99 return reinterpret_cast<Super *> (SCM_UNPACK (s)); |
100 } | 100 } |
101 }; | 101 }; |
102 | 102 |
| 103 // This is the smallest smob of all: none. It's just a wrapper around |
| 104 // native SCM. You need to define a proper is_smob function for it as |
| 105 // a type checker. |
| 106 |
| 107 template <class Super> |
| 108 class Smob0 |
| 109 { |
| 110 Smob0 () = delete; |
| 111 Smob0 (const Smob0 &) = delete; |
| 112 Smob0 &operator = (const Smob0 &) = delete; |
| 113 public: |
| 114 SCM self_scm () const { return SCM_PACK (this); } |
| 115 static Super *unchecked_unsmob (SCM s) |
| 116 { |
| 117 return reinterpret_cast<Super *> (SCM_UNPACK (s)); |
| 118 } |
| 119 }; |
| 120 |
103 #endif | 121 #endif |
OLD | NEW |