This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH] Cygwin: Provide more COM devices
Achim Gratz writes:
> Corinna Vinschen writes:
>> ttyS%(0-255) takes another 23K btw. Even that should be ok, if
>> the need arises. Alternatively we could shortcut shilka as for
>> /dev/sd*, but that involved much bigger numbers.
> I've searched for some documentation (anywhere the glob syntax %(1-128)
> would turn up, btw?) and I think Cygwin is misusing shilka a bit here.
> It's a keyword scanner, so the arithmetically coded parts of the device
> shouldn't be targeted at all. Instead, only the device path prefix
> should be searched via the shilka lexer and the rest of the conversion
> done in code.
I've stared at the code for quite some time now and I think I've come up
with something that could work. I'm chopping the device numbers and
disk names off the end of the device name before feeding into the shilka
lexer. That creates a lexer with only 29 keywords and much less entries
in the dev_storage array, so it should be much faster to search also,
although I think a hash to access the array via the major device number
would now be feasible. I think I'll have to extend the _device
structure with one or two more function pointers to deal with putting
the minor numbers back in before handing the result to the caller. In
principle that could deal with any number of devices that fit into the
device number scheme, but we can still declare certain ranges illegal.
device::parse (const char *s)
size_t len = strlen (s);
const char *t = s + len; /* points past s */
/* chop off any trailing digits and leave t pointing to the beginning of that number */
for (; isdigit (t-1); len--, t--) ;
if (len > 7 && len < 12 && s == 'd'
/* Generic check for /dev/sd[a-z] prefix */
&& strncmp (s, DISK_PREFIX, DP_LEN) == 0
&& s[DP_LEN] >= 'a' && s[DP_LEN] <= 'z')
/* /dev/sd* devices have 8192 entries, given that we support 128 disks
with up to 64 partitions. Handling them with shilka raises the size
of devices.o from ~250K to ~2 Megs. So we handle them here manually
to save this space. */
const _device *dev = KR_find_keyword (s, len);
*this = *fs_dev;
*this = *dev;
/* check and process device numbers */
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Factory and User Sound Singles for Waldorf Q+, Q and microQ: