[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[9599] trunk/Headers/lang/PyrSlot.h
Revision: 9599
http://supercollider.svn.sourceforge.net/supercollider/?rev=9599&view=rev
Author: timblech
Date: 2009-12-15 15:16:35 +0000 (Tue, 15 Dec 2009)
Log Message:
-----------
assertions
Modified Paths:
--------------
trunk/Headers/lang/PyrSlot.h
Modified: trunk/Headers/lang/PyrSlot.h
===================================================================
--- trunk/Headers/lang/PyrSlot.h 2009-12-15 15:16:18 UTC (rev 9598)
+++ trunk/Headers/lang/PyrSlot.h 2009-12-15 15:16:35 UTC (rev 9599)
@@ -31,6 +31,8 @@
#include "SC_Endian.h"
#include "PyrSymbol.h"
+#include <cassert>
+
/*
Pyrite slots are the size of an 8 byte double. If the upper bits
indicate that the double is a 'Not-A-Number' then the upper 32
@@ -166,11 +168,6 @@
inline void SetFloat(PyrSlot* slot, double val) { (slot)->utag = s_float; (slot)->uf = (val); }
#endif
-inline void SetRawChar(PyrSlot* slot, int val) { slot->uc = val; }
-inline void SetRaw(PyrSlot* slot, int val) { slot->ui = val; }
-inline void SetRaw(PyrSlot* slot, PyrObject * val) { slot->uo = val; }
-inline void SetRaw(PyrSlot* slot, PyrSymbol * val) { slot->us = val; }
-inline void SetRaw(PyrSlot* slot, double val) { SetFloat(slot, val); }
inline void SetTagRaw(PyrSlot* slot, int tag) { slot->utag = tag; }
@@ -200,6 +197,12 @@
inline bool IsPtr(PyrSlot* slot) { return ((slot)->utag == tagPtr); }
+inline void SetRawChar(PyrSlot* slot, int val) { assert(IsChar(slot)); slot->uc = val; }
+inline void SetRaw(PyrSlot* slot, int val) { assert(IsInt(slot)); slot->ui = val; }
+inline void SetRaw(PyrSlot* slot, PyrObject * val) { assert(IsObj(slot)); slot->uo = val; }
+inline void SetRaw(PyrSlot* slot, PyrSymbol * val) { assert(IsSym(slot)); slot->us = val; }
+inline void SetRaw(PyrSlot* slot, double val) { assert(IsFloat(slot)); SetFloat(slot, val); }
+
void dumpPyrSlot(PyrSlot* slot);
void slotString(PyrSlot *slot, char *str);
void slotOneWord(PyrSlot *slot, char *str);
@@ -269,6 +272,7 @@
inline void* slotRawPtr(PyrSlot *slot)
{
+ assert(IsPtr(slot));
return slot->s.u.ptr;
}
@@ -329,26 +333,31 @@
inline PyrSymbol* slotRawSymbol(PyrSlot *slot)
{
+ assert(IsSym(slot));
return slot->s.u.s;
}
inline int slotRawChar(PyrSlot *slot)
{
+ assert(IsChar(slot));
return slot->s.u.c;
}
inline int slotRawInt(PyrSlot *slot)
{
+ assert(IsInt(slot));
return slot->s.u.i;
}
inline double slotRawFloat(PyrSlot *slot)
{
+ assert(IsFloat(slot));
return slot->s.u.f;
}
inline PyrObject* slotRawObject(PyrSlot *slot)
{
+ assert(IsObj(slot));
return slot->s.u.o;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/