Re: [cc65] Goodbye _curunit, Hello chdir()

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-10-20 16:30:25
Hi,

> That means I'll have to carry the weight of both the CBM specific library,
> which I cannot escape, and the posix stuff too for CBM-Command.

In general calling one function from a certain area of functionality
doesn't mean you pull in _all_ the "stuff" as great care has been
taken to provide a modular design.

>  Why did
> _curunit HAVE to go away completely?

I hoped I did explain well why _curunit can't stay around: Write
access to it causes inconsistencies inside he C library.

The good news - at least I hope so - are however that there's no
reason against read access. In fact I believe one can presume that
every target with a notion of device numbers has some "current" device
number meaning that providing read access to that current device
number is possible in a target-independent way:

unsigned char getcurrentdevice (void);

There are in fact other scenarios beside yours which could benefit from this:
- dio_open(getcurrentdevice()): Open current device for low level I/O.
- getdevicedir(getcurrentdevice(), ..., ...): Find the name of the
root directory of the current device.

As getcurrentdevice() adds only 6 (?) bytes to a program I believe
that this solves your issue. I'll provide feedback here when it is
available.

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Oct 20 16:31:06 2012

This archive was generated by hypermail 2.1.8 : 2012-10-20 16:31:10 CEST