Re: [cc65] scratch files on C64 or file spec and drive numbers

From: Greg King <greg.king41verizon.net>
Date: 2008-09-26 20:50:33
From: "Spiro Trikaliotis"; at Thursday, September 25, 2008, 04:09 AM -0400
>
> * On Wed, Sep 24, 2008 at 06:10:55PM -0400, Greg King wrote:
> > From: "Groepaz"; on Wednesday, September 24, 2008; at 11:31 AM -0400
>
> > > I:/the/path/file
> > >
> > > That's almost trivial to parse, with little overhead.
> [...]
>
> > "k:2//8/:my/file.prg"
> >
> > (In case anybody is wonderring,  the first slash says, "this is a path."
> > The second one says, "the path starts at the root directory."  The third
> > one separates the path from the file-name.  And, the fourth one is
> > a part of the file-name [that second colon tells the DOS what
> > the slashes are doing]!)
>
> I ask myself if GPZ' comment in the sense of "this is easier to parse
> than doing a _curunit = 11; in C" (done in IRC) still holds true.  In
> fact, I even doubt it, for GPZ' original proposal.

It isn't easier than the current "_curunit" method -- when the program
_already_ knows which device you want to use.  But, when a program must ask
you about the device, at the same time that it is asking about the file,
then embedding the unit-number in a path-name is easier -- and more
portable.  Groepaz's method is better than other proposals.

The name-parser in CC65's library already looks for a colon (if it doesn't
find one, then it prepends "0:").  These steps could be done before that
code:
1. Scan the string argument, if a colon is found, then look at the _single_
character on its left side.
2. If that character is a letter, then use it to compute a unit-number; and
then, ignore that colon and everything on its left side.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Sep 26 21:14:06 2008

This archive was generated by hypermail 2.1.8 : 2008-09-26 21:14:09 CEST