Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Server Overhaul (was Re: Re: Split patch)
Home

[Freeciv-Dev] Server Overhaul (was Re: Re: Split patch)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Server Overhaul (was Re: Re: Split patch)
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Thu, 18 Oct 2001 18:26:55 -0400 (EDT)

   I'm in the process of doing a pretty major overhaul on the server
infrastructure in order to make the code more reasonable and slightly
easier to maintain or modify.  The patches are pretty sizeable, but pretty
much all of that is due to code being rearranged, not necessarily
modified.  So please don't freak when you see single patches of 1K+ lines.
:) I'm posting the README here, and putting the actual patch into
incoming/.  Below are some comments about split() (which will eventually
make its way into the patches).

-jdm

> >    I'll comment split to indicate that is has strtok-like changing of the
> > buffer you pass to it.  As for the whitespace issue, for sake of speed and
> > coding simplicity, I'm going with Raimar's suggestion for enums that get
> > passed to split.  Hence, the current (final) API is:
> >
> > int split(const char *toks, char *buf, char *args[], int max_args,
> >           int handle_whitespace);
>
> s/toks/delimeters/
> s/args/tokens/ or s/args/items/

Done.

> > where handle_whitespace could be
> >
> > #define REMOVE_NO_WHITESPACE      0x0
> > #define REMOVE_PADDING_WHITESPACE 0x1
>
> > #define REMOVE_SPLIT_WHITESPACE   0x2
>
> REMOVE and SPLIT? Isn't this SPLIT_ON_WHITESPACE?
>
> Overall it isn't a true enum.

/* How do we handle whitespace within a split? */
enum whitespace_handle {
  LEAVE_WHITESPACE = 1,          /* Don't bother with it */
  REMOVE_SURROUNDING_WHITESPACE, /* Get rid of it around tokens */
  SPLIT_WHITESPACE               /* Whitespace is a token */
};

> >    I'll work on the server parsing stuff when I get a chance.  I plan to
> > overhaul the basic framework, and people can take it from there as to how
> > specific functions will be implemented.
>
> I will wait with the inclusion of the split method till there is a
> user.

   The user will be here as soon as he can code it (as long as his advisor
isn't looking over his shoulder :)).

-jdm

Department of Computer Science, Duke University, Durham, NC 27708-0129
Email:  justin@xxxxxxxxxxx

Attachment: Server-Cleanup-0.README
Description: Cleanup README


[Prev in Thread] Current Thread [Next in Thread]