[mod.computers.vax] Converting Whitesmiths C to DEC

MANSFIELD@DHDEMBL5.BITNET (Niall Mansfield) (02/27/86)

Re: Brent Sterner's migration, Whitesmiths C --> DEC C

I converted about 3000 lines of code from Whitesmiths to DEC C.
By and large there were no real problems, but a lot of irritation
because Whitesmiths went their own way as to what they wanted to
put in the function libraries, what they called the functions
(e.g. printf is called "putfmt"), and how the functions worked.
It's a while now since I did it, so I may not have got all the
function names and things 100%, but here is an outline of
what to do:-

1. You can get over the obvious thing of the Whitesmiths "pseudo-types" of
        INT, BYTES, etc., by setting up your own <std.h> and putting the
        definitions in.

2. Many functions just have different names, so you can do automatic
        substitution. E.g. to compare strings  W's function is called
        cmpstr as far as I remember, but the UNIX/DEC one is strcmp.

3. In general DEC don't have direct analogues of the *buf* functions, e.g.
        cpybuf, cmpbuf: with some of these you may have to jiggle the code
        to do things in a slightly different way.

4. There are no analogues for the very useful W's functions like
        getflags, getfiles, getfnames and so on, which make writing
        filters and other programs (and ensuring that they have a
        standard style of user interface) very easy. (PRAISE TO
        WHITESMITHS). I have implemented any of these that I couldn't
        do without - you can have them if you want.

5. Not only have W's changed printf to putfmt, but they changed the
        format argument - e.g. to print a decimal no. and a string
        W's want "%i%p" whereas everyone else in the world wants "%d%s".
        I found this one gave some quite insidious bugs.
        Do a semi-automatic search and replace.

6. The "standard" i/o functions have different names and take different
        types of argument. Also, whereas most Unix functions have the
        file pointer as the last arg, W's often have it first.

7. DEC don't have a lint program (for this they ought to be kicked hard
        in the rectum), so if you are also changing from a 16 to 32 bit
        machine as well as W's to DEC, you may run into some nasties on
        types of arguments to functions etc., if you are a bit
        loose with variable types, and you won't be told about it.