libs-base/Documentation/readme.texi
mccallum d7e9dc143c Various text fixes and updates.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1461 72102866-910b-0410-8b05-ffd578937521
1996-04-18 00:37:51 +00:00

203 lines
8.2 KiB
Text

@chapter Gnustep Base Library README
@c set the vars GNUSTEP_BASE_VERSION and GCC_VERSION
@include version.texi
@include base-desc.texi
Here is some introductory info to get you started:
@section Initial reading
The file @samp{ANNOUNCE} contains a very brief overview of the library.
It also tells you where to get the most recent version.
The file @samp{NEWS} has the library's feature history.
The file @samp{INSTALL} gives instructions for installing the library.
@section Preparing to write code
Preliminary documentation is available via @samp{texinfo} in the files
@samp{gnustep-base.info} and @samp{gnustep-base.texi}. Because texinfo
doesn't yet handle @code{@@deftypemethod}, this documentation cannot yet
be compiled into more readable forms.
The documentation isn't much to speak of so far. Better documentation
will be forthcoming, but the library needs to settle first. For now I
recommend skipping @file{gnustep-base.info} and reading the header files
instead. The headers for the classes are in @file{./src/include} and
@file{./src/objc}.
The Gnustep FAQ also contains much useful information, including an
outline of the class heirarchy. The FAQ can be found in
@file{./doc/Gnustep-FAQ}.
@section Overview of the classes
[This section needs updating -mccallum Apr 17 1996.]
The GNU classes included in this version of the library fall into six
categories: collections, strings, magnitudes, streams, coders and
distributed object support.
@c There are several GNU protocols also. You can recognize the protocols
@c by their name: they all end with ``ing''.
@itemize @bullet
@item The collection objects all conform to the @samp{Collecting}
protocol. Reading @samp{./objects/Collecting.h} is a good place to
start. Protocols for collections that store their contents with keys
and with indices can be found in @samp{./objects/KeyedCollecting.h} and
@samp{./objects/IndexedCollecting.h} respectively. Examples of generic
collections are @samp{Set} and @samp{Bag}. The keyed collections are
@samp{Dictionary} and @samp{MappedCollector}. The classes @samp{Array},
@samp{Queue}, @samp{GapArray}, @samp{LinkedList}, @samp{BinaryTree},
@samp{RBTree} and @samp{SplayTree} are all indexed collections.
@item The string objects... [unfinished].
@item The public magnitude classes are @samp{Time} and @samp{Random}.
The @samp{Random} class works in conjunction with pseudo-random number
generators that conform to the @samp{RandomGenerating} protocol. The
conforming class @samp{RNGBerkeley} provides identical behavior to the
BSD random() function. The class @samp{RNGAdditiveCongruential} is an
implementation of the additive congruential method.
@item Stream objects provide a consistent interface for reading and
writing bytes. Read @samp{./objects/Stream.h} to get the general idea.
@samp{StdioStream} objects work with files, file descriptors, FILE
pointers and pipes to/from executables. @samp{MemoryStream} objects
work with memory buffers.
@item Coders provide a formatted way of writing to Streams. After a
coder is initialized with a stream, the coder can encode/decode
Objective C objects and C types in an architecture-independent way. See
@samp{./objects/Coder.h} for the abstract superclass interface; see
@samp{./objects/Coding.h} for the protocol adopted by objects that read
and write themselves using coders. The currently available concrete
coder classes are @samp{BinaryCoder}, for reading and writing a compact
stream of illegible bytes, and @samp{TextCoder}, for reading and writing
human-readable text (which you can also process with @samp{perl},
@samp{awk}, or whatever scripting language you like).
Coders and streams can be mixed and matched so that programmers can
choose the destination and the format separately.
Neither the stream or coder class heirarchies are very mature yet. I
threw them together because I needed them for distributed objects.
@item The distributed object support classes are @samp{Connection},
@samp{Proxy}, @samp{ConnectedCoder}, @samp{Port} and @samp{SocketPort}.
This version of the distributed objects only works with sockets. A Mach
port back-end should be on the way.
[NOTE: The GNU distributed object facilities have the same ease-of-use
as NeXT's; be warned, however, that they are not compatible with each
other. They have different class heirarchies, different instance
variables, different method names, different implementation strategies
and different network message formats. You cannot communicate with a
NeXT NXConnection using a GNU Connection. The GNU distributed object
code does not work with the NeXT Objective C runtime. NXConnection
creates NXProxy objects for local objects as well as remote objects; GNU
Connection doesn't need and doesn't create proxies for local objects.
NXProxy asks it's remote target for the method encoding types and caches
the results; GNU Proxy gets the types directly from the local GNU "typed
selector" mechanism and has no need for querying the remote target or
caching encoding types. The NXProxy for the remote root object always
has name 0 and, once set, you cannot change the root object of a
NXConnection; the GNU Proxy for the remote root object has a target
address value just like all other Proxy's, and you can change the root
object as many times as you like. See the "lacking-capabilities" list
below for a partial list of things that NXConnection can do that GNU
Connection cannot.]
To begin using distributed objects, you only need to know about
@samp{Connection} class. You can see the full interface in
@samp{./objects/Connection.h}. The long list of methods may be a little
daunting, but actually, a lot can be done with just a few key methods:
@smallexample
- (Connection*) newRegisteringAtName: name
withRootObject: anObj;
For registering your server object with the network.
- (void) runConnection;
For running the connection object returned by the above
method, so that your server can start handling requests from
clients.
- (Proxy*) rootProxyAtName: name
onHost: host;
For connecting to a remote server. You get a proxy object for
the remote server object, which, for messaging purposes, you
can treat as if it were local.
@end smallexample
@section Where else to look
@subsection Examples
A few simple example programs can be found in @samp{./examples}.
Read and enjoy. To compile them (after having compiled the library),
type @samp{make} in the @samp{examples} directory.
@itemize @bullet
@item @samp{dictionary.m} demonstrates the basic features of the
Dictionary object.
@item @samp{stdio-stream.m} creates a StdioStream object that points to
a file, writes to the file, then reads from the file.
@item @samp{textcoding.m} shows how you can archive an object to a file
in a human-readable text format, and then read it back in again. This
format is handy for editing archived objects with a text editor, and is
great when you want to modify/create an archive using a scripting
language like @samp{perl} or @samp{awk}.
@item @samp{first-server.m} and @samp{first-client.m} show the
distributed object version of ``Hello, world''.
@item @samp{second-server.m} and @samp{second-client.m} contain a more
complex demonstration of distributed objects, with multiple clients,
connection delegates, and invalidation notification.
@item @samp{tcpport-server.m} and @samp{tcpport-client.m} show a simple
use of TcpPort objects.
@end itemize
@subsection Test Programs
Some of the programs I've used to test the library are in
@samp{./checks}. Many of them are pretty messy, (desperately trying to
tickle that late night bug), but at least they show some code that works
when the library compiles correctly. I'm looking for a volunteer to
write some nicely organized test cases using @samp{dejagnu}. Any
takers?
@section How can you help?
@itemize @bullet
@item Read the projects and questions in the @samp{TODO} file. If you
can volunteer for any of the projects, or if you have any useful
comments send me email! <mccallum@@gnu.ai.mit.edu>
@item
Give me feedback! Tell me what you like; tell me what you think
could be better. Send me bug reports.
@item
Donate classes. If you write classes that fit in the libgnustep-base
framework, I'd be happy to include them.
@end itemize
@example
Happy hacking!
Andrew McCallum
mccallum@@gnu.ai.mit.edu
@end example