home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.sources
- Path: sparky!uunet!spool.mu.edu!news.cs.indiana.edu!umn.edu!csus.edu!netcom.com!thinman
- From: thinman@netcom.com (Technically Sweet)
- Subject: COOL: C Object-Oriented Library: part 0 of 4
- Message-ID: <1992Dec23.191426.10202@netcom.com>
- Organization: International Foundation for Internal Freedom
- Date: Wed, 23 Dec 1992 19:14:26 GMT
- Lines: 128
-
-
- Second public release.
-
-
- COOL - C Object-Oriented Library
-
- COOL is: Copyright 1991 by Lance Norskog - ABANDONED
-
- I'm writing a large software project [1] and need something better
- than C. Something which is absolutely as portable as C. After looking
- at C++, SmallTalk, and Objective C, I gave up and wrote COOL instead.
-
- It adds objects to C with a minimum of code-junk and no preprocessing.
- The implementation is as simple as is reasonable. Object messaging,
- creation, and deletion are reasonably streamlined. Little attempt has
- been made for high performance. If you design for performance,
- you usually get software that's fast but useless.
-
- See the man page for more information and a rudimentary coding example.
- See the tst?.c programs for info on exercising features.
-
- This is released to the net for general interest, information on
- how a rudimentary object system works internally, and to serve
- as a vehicle for prototyping new OO styles. Instead of conducting
- gedanken experiments about how objects should work, or spending
- years designing new languages & compilers, now you can implement
- your variant and play around with it coding up your favorite examples.
-
- Inheritance:
- Multiple inheritance is implemented. No ambiguous methods are
- allowed in a class definition. Inheritance is implemented
- essentially as multiple objects with one name; these objects
- can call SELF with methods they themselves don't implement.
-
- Porting:
-
- Objects are methods are given as strings or magic ID numbers.
- The library contains routines which transform strings to IDs.
- The object and method ID spaces are both segmented into two
- pieces. Object numbers are an array index and a generation
- number. Method numbers are an array index and a parent index.
-
- These number spaces will have to resegmented for your computer.
- The release includes macros for 386 UNIX, and assumes that
- string addresses are in the data segment or in the stack
- local area. The object and method spaces pack their two numbers
- avoiding these bit addresses, so that the library can distinguish
- between a string and pre-cached ID on the fly.
-
- This implementation is mostly bogus. Instead, it should
- have a magic marker (I prefer 0xdeadbeef) at the beginning
- of an object. But, encoding the generation number in
- the object is still worthwhile.
-
- Also, the exception system uses setjmp and longjmp. If yours
- don't work, you don't get catchable exceptions. The object
- library uses exceptions, but doesn't catch them, so it will
- work anyway.
-
- Beyond that, any 32-bit machine should be able to run COOL.
- With the above magic marker trick, it should run under DOS
- and Windows also.
-
- Benchmarks:
-
- 'bench.c' makes counts an integer from 0 to a very large number
- in 6 different ways. The first way uses canonical safe message
- calls. The second way uses unsafe cached messaging. The remaining
- ways use native C in various ways. A case statement and a
- procedure call is used as a standard against which to measure
- messaging performance.
-
- 'benchall' compiles the benchmark and the library with the
- native C compiler and with GCC, both with and without optimization,
- and runs the benchmark.
-
- The files out.unix386 and out.xenix contain the benchmark results
- on those operating systems.
-
- Ports also included for 68020 and SPARC SUNs, and VMS.
- These ports, and some bug fixes, where contributed by Henk
- Davids from Germany and Nicolas ?? from France.
-
- This is the fourth release, patchlevel 4. Patchlevel 2 was
- Nicolas' port to SUNs and bug fixes, which he posted to
- alt.sources. These changes have been incorporated.
- Patchlevel 4 didn't do grandparent classes right,
- and I've added components, overloading,
- and the Scheme interface files. Cool_elk.c allows
- ELK Scheme to use COOL as an extension interface.
- Cool_scm.c does likewise with SCM Scheme. The beauty
- part is that you just write your extensions in C
- as classes, test them, then link them with Scheme.
- You don't have to write any custom code to bridge the two.
-
- Cool_scm.c implements overloaded operators. Cool_elk
- does not. Overloaded operators are not well documented,
- and the implementation is of necessity iffy because
- of the coruscating plasticity of C's calling sequence.
-
- Please send me all updates, ports, and benchmark results you can.
- COOL is a basic technology for my VR window system project,
- and I am the maintenence person. I may rewrite it for
- efficiency at some point.
-
- Acknowledgements:
- Nicolas ?? at Electricite De France <nicolas@cli52or.edf.fr>
- for SUN-3 & SUN-4 ports and bug fixes
- Henk Davids <hdavids@mswe.dnet.ms.philips.nl>
- for SUN-4 port and bug fixes
- David L. Williams <dlw@atherton.com>
- for NeXT port
-
- Enjoy!
-
- Lance Norskog
- thinman@netcom.com
-
- [1] A Virtual Reality window system based on Scheme & C extensions.
- Something like NeWS...
-
- p.s. tst4 is supposed to cause a core dump. That's how
- exceptions work.
- --
-
- Lance Norskog
-
- Data is not information is not knowledge is not wisdom.
-