httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@nueva.pvt.k12.ca.us>
Subject Re: Thoughts on Apache 2.0 API
Date Fri, 22 Aug 1997 04:54:51 GMT
On Thu, 21 Aug 1997, Alexei Kosut wrote:

Replying to my own mail, of course... Please read the previous message
before reading this one, or it'll make no sense whatsoever.

[...]

> We'd probably want to segment it, of course, so we could have something
> like r->request->puts(), or r->buff->bcreate(), or r->alloc->strdup(),

This is, of course, silly. I realized this with a sort of "duh" about
five minutes after sending the message. I mean, I did know that what I
was proposing was using C structures and function pointers to emulate
a real object-oriented language, but I forgot to apply that knowledge
to my examples.

Most Apache API functions take, as the first argument (or sometimes
the last, for some unknown reason) an API structure. These functions, of
course, should be made pointers from the structure they belong to. So
the proper versions of the examples above are r->puts(),
r->pool->bcreate() (yes, that's right... something like
r->connection->client->bwrite() is a better example) and
r->pool->strdup().

We'd have to have a "util" structure that contained the functions that
are "standalone" (work on the arguments only, no parent
structure. strcmp_match(), for example) and stick that into all the
"object" structures.

We could also put into #ifdef __cplusplus statements and inline member
functions so you could do r->puts(str) instead of r->puts(r, str) if
you were writing your module in C++, I suppose. Although unlike some
APIs (JNI comes to mind), I wouldn't want to make it so you couldn't
use the C version if you were writing C++. I think that's doable, though

-- Alexei Kosut <akosut@nueva.pvt.k12.ca.us>



Mime
View raw message