On Dec 20, 10:27*am, ImpalerCore <jadil...@gmail.com> wrote:
> On Dec 19, 6:44*am, luserXtrog <mijo...@yahoo.com> wrote:
>
>
>
> > I feel I need a fresh perspective (or many, ideally)
> > on my program. It's grown to where I can't quite keep
> > it all in my head and making new additions has become
> > a game of "how did I do this elsewhere?"
>
> > A zip file containing c and postscript source and a makefile
> > are available at:http://code.google.com/p/xpost/downloads/list
> <snip>
>
> I think you're getting to the point where you're going to need a
> documentation system. *First off, browsing for functionality in a
> browser is much easier than grepping files. *You forget things like
> order of arguments, semantics for elements in a struct, or the meaning
> of return values. *I recommend spending some time learning and
> creating some documentation in Doxygen (or similar) to get a feel for
> what's possible. *Without a good system of documentation, you will
> likely spend lots of additional time rereading code to learn how to
> use the functions you've created months ago. *
Agreed. One of my dreams for the project is to make it a self-
documenting
literate program (the uber-quine) producing a pdf book describing
itself.
But I really should learn some sort of documenting system now to get
the
whole process started.
>Here's an example of
> some doxygenated comments from my list library.
>
<snip very nice example for space>
> In my documentation, I describe the parameters, return values,
> semantic details if needed, and provide an example that demonstrates
> its usage with expected results.
I've tried to avoid the need for this level of detail in comments
by building, as directly as I could, a mapping between the published
standard and the semantics of the program. Hence parameters and return
values for the O* functions are directly from the Adobe book.
But, of course, that has the drawback that anyone who doesn't own
the book can't make as much sense of the program.
Point taken. Each function should have some description.
> The drawback of this is that it is a *lot* more work, especially if
> you want to create (non-boring) examples that demonstrate something
> interesting about the semantics of the function. *The payoff is that
> you can go back at a later time and grok the function much easier than
> having to reread code you wrote months or years ago. *And if you make
> the time to go through the documentation, any semantic quirks that pop
> up (like NULL pointers) will be addressed in the documentation, and
> hopefully won't bite you again or someone that follows you. *Again let
> me re-emphasize, doing what I do is a *lot* of extra work, and may not
> be compatible in some work environments.
>
> Second, I think you may want to look at partitioning functionality
> into a couple of libraries. *Library is the basic component of reuse
> in C, and if or when you do something new, the work you put into the
> functionality for the postscript parser will be easier to apply to
> something else if pertinent pieces are nicely encapsulated in a
> library.
Indeed. I've been trying to build up the graphics functionality as
a library. It's a lot of work just to track down the sources (texts
and journals from 70s-80s), let alone understanding and implementing
the algorithms. (I've lost count of how many times I've read about
the Bresenham line drawing algorithm; I'm still not sure I "get it.")
As for this project, I'm having some trouble envisioning which pieces
should be partitioned off. They all seem so interrelated! The parser
(just a scanner, really; I think there's one point where it recurses
and that's only for scanning literal procedures) has to know about
the object types and how to create each of them.
I think the virtual memory store for composite objects (dictionaries,
arrays,
and strings) might be the best thing to break off first. I've just
discovered
in another thread that my simplistic implementation (with each save-
level
as an anonymous mmap) doesn't duplicate a legacy quirk of the original
Adobe implementation (restoring an earlier save-level doesn't rollback
string contents) which all other interpreters have followed.
So I need to modify the implentation of this part without disturbing
the
rest of the program. "Modularity to the rescue?"
> That's all I got for now.
Much obliged.