home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************
- * *
- * draw.object Library GCW 27/12/94 *
- * *
- *******************************************************/
-
- /* ------------ object class -------------------- */
-
- /* Base class for storing data in string arrays */
-
- class object
- {
- obj_end, obj_start,obj_string, p;
- }
-
- /* ----------- Object methods ----------------- */
-
- object::object(size)
- {
- if (!typeof(p))
- {
- p = obj_start = @(obj_string = newstring(size)); // first object
- obj_end = obj_start + size;
- }
- return this;
- }
-
- object::start()
- { return obj_start; }
-
- object::str()
- { return obj_string; }
-
- object::here()
- { return p; }
-
- object::push_word(w)
- {
- ££(p,w);
- p += 4;
- if (p >= obj_end)
- quit("overflow\n");
- }
-
- object::push_byte(c)
- {
- ``(p++,c);
- if (p >= obj_end)
- quit("overflow\n");
- }
-
- object::push_string(s)
- {
- local len;
- if (p + (len = sizeof(s)) >= obj_end)
- quit("overflow\n");
- $$(p,s); p += len;
- }
-
- object::read(offset)
- { return £(obj_start+offset); }
-
- object::write(offset,data)
- { ££(obj_start+offset,data); }
-
- /* ------------ end of object definitions ------------- */
-