Aztec C (1.06) problem ? - CP/M

This is a discussion on Aztec C (1.06) problem ? - CP/M ; Hi everybody, I was trying to port a CRC32 C-source to CP/M, and I was able to compile the source error free ... but the result wasn't as expected. One problem was to declare a different return value type of ...

+ Reply to Thread
Results 1 to 15 of 15

Thread: Aztec C (1.06) problem ?

  1. Aztec C (1.06) problem ?

    Hi everybody,

    I was trying to port a CRC32 C-source to CP/M, and I was able to compile
    the source error free ... but the result wasn't as expected.
    One problem was to declare a different return value type of a function,
    means I was trying to declare a return value of a function as unsigned
    long, but Aztec C compiler always says no to it, only "int" as a return
    value was accepted.

    What I want to have:

    unsigned long crc32file(name)
    char *name;
    {
    .....
    }

    What is only accepted:

    int crc32file(name)
    char *name;
    {
    .....
    }

    Any hints ?
    The full source code can be found at http://www.z80.eu/downloads/crc32.c ...

    Regards
    Peter

    --
    * More infos about vintage computers and CP/M - http://www.z80.eu

  2. Re: Aztec C (1.06) problem ?

    On Fri, 03 Oct 2008 11:39:07 +0200, Peter Dassow wrote:

    > Hi everybody,
    >
    > I was trying to port a CRC32 C-source to CP/M, and I was able to compile
    > the source error free ... but the result wasn't as expected.
    > One problem was to declare a different return value type of a function,
    > means I was trying to declare a return value of a function as unsigned
    > long, but Aztec C compiler always says no to it, only "int" as a return
    > value was accepted.
    >
    > What I want to have:
    >
    > unsigned long crc32file(name)
    > char *name;
    > {
    > ....
    > }
    >
    > What is only accepted:
    >
    > int crc32file(name)
    > char *name;
    > {
    > ....
    > }
    >
    > Any hints ?
    > The full source code can be found at http://www.z80.eu/downloads/crc32.c ...
    >
    > Regards
    > Peter


    I'm wondering a bit about that one, all the seek functions e.g. from the
    standard library return longs, even under CP/M. So I just tried to compile
    this:

    unsigned long func()
    {
    return(1L);
    }

    Sure works. The compiler I used is:
    C Vers. 1.06D Z80 (C) 1982 1983 1984 by Manx Software Systems
    as included on disk drive I, user area 2 that comes with z80pack.

    Udo Munk
    --
    The real fun is building it and then using it...


  3. Re: Aztec C (1.06) problem ?

    Udo Munk schrieb:
    >> What I want to have:
    >>
    >> unsigned long crc32file(name)
    >> char *name;
    >> {
    >> ....
    >> }
    >>
    >> What is only accepted:
    >>
    >> int crc32file(name)
    >> char *name;
    >> {
    >> ....
    >> }
    >>
    >> Any hints ?
    >> The full source code can be found at http://www.z80.eu/downloads/crc32.c ...
    >>

    >
    > I'm wondering a bit about that one, all the seek functions e.g. from the
    > standard library return longs, even under CP/M. So I just tried to compile
    > this:
    >
    > unsigned long func()
    > {
    > return(1L);
    > }
    >
    > Sure works. The compiler I used is:
    > C Vers. 1.06D Z80 (C) 1982 1983 1984 by Manx Software Systems
    > as included on disk drive I, user area 2 that comes with z80pack.
    >

    Udo,

    please try to compile the given source code (see above for d/l link)
    with my suggested change for the function crc32file(), you will see it
    will not work.

    Regards
    Peter

    --
    * More infos about vintage computers and CP/M - http://www.z80.eu

  4. Re: Aztec C (1.06) problem ?

    On Fri, 03 Oct 2008 15:48:46 +0200, Peter Dassow wrote:

    > Udo Munk schrieb:
    >>> What I want to have:
    >>>
    >>> unsigned long crc32file(name)
    >>> char *name;
    >>> {
    >>> ....
    >>> }
    >>>
    >>> What is only accepted:
    >>>
    >>> int crc32file(name)
    >>> char *name;
    >>> {
    >>> ....
    >>> }
    >>>
    >>> Any hints ?
    >>> The full source code can be found at http://www.z80.eu/downloads/crc32.c ...
    >>>

    >>
    >> I'm wondering a bit about that one, all the seek functions e.g. from the
    >> standard library return longs, even under CP/M. So I just tried to compile
    >> this:
    >>
    >> unsigned long func()
    >> {
    >> return(1L);
    >> }
    >>
    >> Sure works. The compiler I used is:
    >> C Vers. 1.06D Z80 (C) 1982 1983 1984 by Manx Software Systems
    >> as included on disk drive I, user area 2 that comes with z80pack.
    >>

    > Udo,
    >
    > please try to compile the given source code (see above for d/l link)
    > with my suggested change for the function crc32file(), you will see it
    > will not work.
    >
    > Regards
    > Peter


    OK, I had a look at that source. It is a myth to me, why you want this
    function to return a long instead an int, in main() you use the return
    value as exit code from main() and that is supposed to be an int.

    However, this is K&R C, so anything not int must be declared before usage.
    If you add a forward declaration for the function at the top of the
    source after the #defines, then it will compile:

    unsigned long crc32file();

    Otherwise is is supposed to return int, because it is used in main()
    before declaration.

    You also should declare the return defines like OK as 0L, but as far as I
    remember the compiler does implicit casting correct.

    Udo Munk
    --
    The real fun is building it and then using it...


  5. Re: Aztec C (1.06) problem ?

    Udo Munk wrote:
    >
    > OK, I had a look at that source. It is a myth to me, why you want this
    > function to return a long instead an int, in main() you use the return
    > value as exit code from main() and that is supposed to be an int.
    >
    > However, this is K&R C, so anything not int must be declared before usage.
    > If you add a forward declaration for the function at the top of the
    > source after the #defines, then it will compile:
    >
    > unsigned long crc32file();
    >
    > Otherwise is is supposed to return int, because it is used in main()
    > before declaration.
    >
    > You also should declare the return defines like OK as 0L, but as far as I
    > remember the compiler does implicit casting correct.
    >

    Thanks, Udo.
    May be was a bit too tired at that day and I didn't realize that I don't
    need it. But anyway, the forward declaration is only needed if I declare
    functions as "non"-int, right ?

    Regards
    Peter

    --
    * More infos about vintage computers and CP/M - http://www.z80.eu

  6. Re: Aztec C (1.06) problem ?

    Peter Dassow schrieb:
    > Thanks, Udo.
    > May be was a bit too tired at that day and I didn't realize that I don't
    > need it. But anyway, the forward declaration is only needed if I declare
    > functions as "non"-int, right ?
    >
    > Regards
    > Peter
    >

    You already gave me an answer :-( It's needed only for Non-Int.
    Have to be a bit slower before typing anything I guess.
    Btw is this behaviour standard for ALL Non-ANSI C-Compiler ?

    Regards
    Peter
    --
    * More infos about vintage computers and CP/M - http://www.z80.eu

  7. Re: Aztec C (1.06) problem ?

    On Sat, 04 Oct 2008 10:15:36 +0200, Peter Dassow wrote:

    > Peter Dassow schrieb:
    >> Thanks, Udo.
    >> May be was a bit too tired at that day and I didn't realize that I don't
    >> need it. But anyway, the forward declaration is only needed if I declare
    >> functions as "non"-int, right ?
    >>
    >> Regards
    >> Peter
    >>

    > You already gave me an answer :-( It's needed only for Non-Int.
    > Have to be a bit slower before typing anything I guess.
    > Btw is this behaviour standard for ALL Non-ANSI C-Compiler ?
    >
    > Regards
    > Peter


    This is behavior of any C compiler, but ANSI C compiler give a warning
    that a function is implicit declared, while K&R compiler silently do and
    later show errors like you got. So one either programs bottom up:

    int func1(...)
    {
    ...
    }

    int main(...)
    {
    ...
    func1();
    }

    Or one programs top down and uses forward declarations for functions,
    before they are used. With K&R C you can be lazy with that, sometimes
    resulting in obscure problems, because the compiler makes silent
    assumptions. So it is a good idea to declare everything before using it
    for any C compiler.

    Udo Munk
    --
    The real fun is building it and then using it...


  8. Re: Aztec C (1.06) problem ?

    Hello Peter,

    On Fri, 03 Oct 2008 11:39:07 +0200, Peter Dassow wrote:

    >Hi everybody,
    >
    >I was trying to port a CRC32 C-source to CP/M, and I was able to compile
    >the source error free ... but the result wasn't as expected.
    >One problem was to declare a different return value type of a function,
    >means I was trying to declare a return value of a function as unsigned
    >long, but Aztec C compiler always says no to it, only "int" as a return
    >value was accepted.
    >
    >What I want to have:
    >
    >unsigned long crc32file(name)
    >char *name;
    >{
    >....
    >}
    >
    >What is only accepted:
    >
    >int crc32file(name)
    >char *name;
    >{
    >....
    >}


    try this

    #define ulong unsigned long int

    Functions this!

    Rolf


  9. Re: Aztec C (1.06) problem ?

    Peter Dassow wrote:
    > Peter Dassow schrieb:
    >
    >> May be was a bit too tired at that day and I didn't realize that
    >> I don't need it. But anyway, the forward declaration is only
    >> needed if I declare functions as "non"-int, right ?

    >
    > You already gave me an answer :-( It's needed only for Non-Int.
    > Have to be a bit slower before typing anything I guess.
    > Btw is this behaviour standard for ALL Non-ANSI C-Compiler ?


    Any non-ANSI (actually ISO) compiler dates from before the issuance
    of the C standard, and thus does not have to adhere to anything.
    Most stick to K&R1 or K&RII, but no guarantees.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]:
    Try the download section.

  10. Re: Aztec C (1.06) problem ?

    "CBFalconer" wrote in message
    news:48E80D6A.F5AF8D32@yahoo.com...
    >Any non-ANSI (actually ISO) compiler dates from before the issuance of the
    >C standard, and thus does not have to adhere to anything. Most stick to
    >K&R1 or K&RII, but no guarantees.


    On this compiler there is a guarantee on this. Also thanks to Al Kossow,
    this compiler is fully documented. I am in the process of updating the Aztec
    C website. Manuals for Aztec C's CP/M 80 and CP/M 86 versions are one of my
    priorities. Here's the feature list for this compiler:

    http://www.aztecmuseum.ca/docs/Aztec...heet_Mar83.pdf

    Here's the Manual:

    http://www.aztecmuseum.ca/docs/Aztec...nual_Mar84.pdf

    I was a little surprised by Peter's omission of the forward declaration
    because I know him to be most capable and I am happy that his understanding
    is complete on this. Those of us who programmed in C through the 80's and
    early 90's knew the differences between K&R and ANSI/ISO (aka Standard C).
    The youngsters did not have this advantage so I shouldn't have been
    surprised. However to me this is analoguous to using function prototypes and
    headers in Standard C.

    I am not happy about the title of this thread since it would suggest that
    there is some problem with this compiler and avoided replying initially for
    this reason but now I have recovered from my temper-tantrum and can be my
    usual barely civil self again.

    Aztec C 1.06 is a full implementation of the C Programming Language. It has
    full standard support for C as defined by Dennis M. Ritchie and Brian W.
    Kernighan in their book "The C Programming Language". This should still be
    rquired reading IMO and Peter should track-down a copy.

    Robert Sherry represented Manx Software Systems on the ANSI C89 comittee.

    http://en.wikipedia.org/wiki/ANSI_C

    Although Manx produced Aztec C ANSI C89 compliant versions 5.X for the
    IBM-PC (under MS-DOS) and Amiga and probably some of the embedded systems
    compilers before their demise, the last Z80 compiler they produced as far as
    I know was version 1.X.

    This particular compiler was written by Thomas Fenwick and Jim Goodnow.
    Harry Suckow, the owner of Manx Software insisted on floating point support
    and they argued about the need for such a thing. As it turned out, this
    feature made their compiler the commerical success it became, out-selling
    other CP/M 80 C compilers. Surprisingly, their native mode Apple II ProDOS
    compiler did not support double precision floating point in version 3.2
    although the cross-compiler version did and the shell version did. I wonder
    what was up with that?

    CP/M 86 support in Aztec C stopped in version 4.X Fenwick was gone and so
    was Goodnow. Mike Spille worked on the ANSI C versions until Manx closed.
    My wikipedia article tells a little about some of this. There is alot that I
    won't say because Aztec C's former partners deserve their privacy. But I
    will say this... Microsoft targetted Aztec C and successfully brought them
    down.
    Otherwise we may have had a Z80 ANSI compliant compler. The source code has
    vanished so I can't attempt a rewrite although if it turns-up Mike Spille
    may be able to give me some expert help. I am not hopeful at this point
    though.

    http://en.wikipedia.org/wiki/Aztec-C

    Bill



  11. Re: Aztec C (1.06) problem ?

    On Sun, 05 Oct 2008 04:47:20 -0500, Bill Buckels wrote:

    ....
    > Otherwise we may have had a Z80 ANSI compliant compler. The source code
    > has vanished so I can't attempt a rewrite although if it turns-up Mike
    > Spille may be able to give me some expert help. I am not hopeful at this
    > point though.
    >
    > http://en.wikipedia.org/wiki/Aztec-C
    >
    > Bill


    We have at least one ANSI compliant C compiler for the Z80, HI-TECH C.
    Also several C compilers are available with full sources, so it doesn't
    have to be this one, that could be worked on. One more example why
    software should be open sourced, it will survive then even if abandoned.

    Udo Munk
    --
    The real fun is building it and then using it...


  12. Re: Aztec C (1.06) problem ?

    Bill Buckels wrote:
    >
    > I was a little surprised by Peter's omission of the forward declaration
    > because I know him to be most capable and I am happy that his understanding
    > is complete on this. Those of us who programmed in C through the 80's and
    > early 90's knew the differences between K&R and ANSI/ISO (aka Standard C).
    > The youngsters did not have this advantage so I shouldn't have been
    > surprised. However to me this is analoguous to using function prototypes and
    > headers in Standard C.
    >


    Bill,

    you have to understand that I was really falling due for making holidays ;-)
    My current job isn't any more related with C programming, instead, with
    service management, ITIL, CoBIT a.s.o. ... and before that I was
    programming a lot of things already in Object Pascal ;-)
    So I guess, meanwhile I forgot my 10 years of UNIX expirience almost.
    Have to refresh it... I will show this in a Norton commander clone for
    CP/M, promised

    Regards
    Peter
    --
    * More infos about vintage computers and CP/M - http://www.z80.eu

  13. Re: Aztec C (1.06) problem ?

    "Udo Munk" wrote in message
    newsan.2008.10.05.11.36.50.429022@unix4fun.org...
    >We have at least one ANSI compliant C compiler for the Z80, HI-TECH C. Also
    >several C compilers are available with full sources, so it doesn't have to
    >be this one, that could be worked on. One more example why software should
    >be open sourced, it will survive then even if abandoned.


    I can give you several reasons why some software should not be open-sourced
    beginning with large-scale applications that represent years of development
    work and investment which can alternately be covered by escrowe agreements
    to ensure that the both the client and developer are protected.

    However I won't debate the issue since I don't want to start a religious
    war I have written at least a million or so lines of shareware and
    freeware and this earns me the right to my opinion. There's no universal
    panacea. One size does not fit all so one can't make a blanket statement
    IMO.

    Anyway...

    Harry Suckow and Jim Goodnow had at one point discussed open-sourcing this,
    and Harry indicated to me earlier this year that he would like to do so.
    However, when he looked for the source, it had been discarded to make room
    for a family member.

    Aztec C was not so much abandoned. It was stolen and beaten to death, but as
    it turns-out it would be better for us at this point in time if this had
    been open-sourced. Back then the families that were fed would have starved.

    Bill




  14. Re: Aztec C (1.06) problem ?

    "Peter Dassow" wrote in message
    news:48e928c2$0$28903$9b4e6d93@newsspool1.arcor-online.net...
    >you have to understand that I was really falling due for making holidays
    >;-)


    I know the feeling well. I do this vintage stuff to escape the reality of my
    consulting work which encompasses the plethora of what modern software
    development is. The closest I ever get to C is occasional matenenance on
    legacy handheld device applcations and the rest is C++ and onward from
    there.

    >So I guess, meanwhile I forgot my 10 years of UNIX expirience almost.Have
    >to refresh it... I will show this in a Norton commander clone for CP/M,
    >promised


    My favorite MS-DOS shell was 1DIRPLUS by Bourbaki. I couldn't have survived
    without it. Mike T. (phoenyx) comp.sys.apple2 started a Commander in Aztec C
    for ProDOS on the Apple //e. I have it on my CF drive.

    I am looking forward to getting a CP/M box together. Then I can give yours a
    try

    Bill



  15. Re: Aztec C (1.06) problem ?

    On Sun, 05 Oct 2008 19:16:50 -0500, Bill Buckels wrote:

    > "Udo Munk" wrote in message
    > newsan.2008.10.05.11.36.50.429022@unix4fun.org...
    >>We have at least one ANSI compliant C compiler for the Z80, HI-TECH C. Also
    >>several C compilers are available with full sources, so it doesn't have to
    >>be this one, that could be worked on. One more example why software should
    >>be open sourced, it will survive then even if abandoned.

    >
    > I can give you several reasons why some software should not be open-sourced
    > beginning with large-scale applications that represent years of development
    > work and investment which can alternately be covered by escrowe agreements
    > to ensure that the both the client and developer are protected.


    No problem, I can agree with this in that far, that releasing sources
    won't un-protect the developer or anyone. Open source doesn't mean public
    domain necessarily. If one wants to steal software one doesn't need the
    sources for that. It is the work and the ideas behind the work that can be
    copyright protected.

    > However I won't debate the issue since I don't want to start a religious
    > war I have written at least a million or so lines of shareware and
    > freeware and this earns me the right to my opinion. There's no universal
    > panacea. One size does not fit all so one can't make a blanket statement
    > IMO.


    Correct. Operating Systems and development software should be open source
    to make real use out of systems. Well, nowadays this is the case anyway,
    so nothing to argue about.

    > Anyway...
    >
    > Harry Suckow and Jim Goodnow had at one point discussed open-sourcing
    > this, and Harry indicated to me earlier this year that he would like to
    > do so. However, when he looked for the source, it had been discarded to
    > make room for a family member.


    Too bad.

    > Aztec C was not so much abandoned. It was stolen and beaten to death,
    > but as it turns-out it would be better for us at this point in time if
    > this had been open-sourced. Back then the families that were fed would
    > have starved.
    >
    > Bill


    Abandoned by the driving force of a monopolist, like all the others too.
    I have some doubts about starved families, other compilers were
    distributed with all sources, and as far as I know the fact that sources
    were available just killed no one. It is only that I still can use this
    sources on nowadays systems, back then we bought a license for using the
    stuff as cross compiler.

    Udo Munk
    --
    The real fun is building it and then using it...


+ Reply to Thread