[FreeVMS] new str$ routines - to NULL or not to NULL, that is the question....

Roger Tucker roger.tucker at mci.com
Ven 12 Aou 01:53:53 CEST 2005


I would like to ask a question...

Is our goal to match the real VMS (as best as possible), or to improve/make
it better along the way?

I know this question will come up over and over again, but I found an
interesting example for us to work with.  I noticed that the str$ routines
shipped with freeVMS have been bastardized to always place a null at the end
of dynamic string descriptor - see strget1_dx.c for example.  It allocates
one extra byte for the null and makes sure it's zero using calloc().  The
original code is even commented out!  It's not correct, because in the same
routine on a new string descriptor it's broke, but someone tried to change
it and that's why the strlen() was in str$copy_dx().

So, should the str$ routines work just like the ones on real VMS, or should
they try to keep a null at the end?

My vote, is that they should work just like the real VMS.  There might be a
null there, there might not be, and you may even have nulls in descriptor
type strings, but if you go past the length stored in the descriptor all
bets are off...

Overall, I think the goal should be to duplicate the real VMS as much as
reasonably possible - but that is just my vote...  That way, it's broke if
it doesn't work like the real VMS.  A new type of descriptor - like a null
terminated string descriptor could be added, but a program that used it
wouldn't be portable back to real VMS.  In other words, you can add a
feature - within reason, but do not break or fundamentally change freeVMS
from the real VMS.  The implementation is totally different, but if a
user-mode code works on freeVMS it should run on real VMS and vise versa as
much as reasonably possible.

Anyone disagree?

If everyone agrees, I'm going to fix the str$ routines to work the way they
should... and come out with a new version that fixes all the bugs in them...

Roger


-----Original Message-----
From: Roar Thronæs [mailto:roart at nvg.ntnu.no] 
Sent: Thursday, August 11, 2005 12:53 AM
To: FreeVMS mailing list
Cc: 'Roger Tucker'
Subject: Re: [FreeVMS] RE: new libgetef.c

On Wed, Aug 10, 2005 at 01:39:50PM -0600, Roger Tucker wrote:
> 
> For example, str$copy_r(), and str$copy_r_64() does a strlen() on the
> source.  VMS uses descriptors - not null terminated strings - for a
reason,
> so they have a length and a pointer and you can have a null in the string
if

I see no reason why strlen could not be replaced by
*word_integer_source_length, since in this case it is a counted string.

-- 
Regards,
Roar Thronæs





Plus d'informations sur la liste de diffusion FreeVMS