Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

God is real, unless declared integer.


devel / comp.lang.c / Re: Baby X resource compiler nearly ready

SubjectAuthor
* Baby X resource compiler nearly readyMalcolm McLean
+* Re: Baby X resource compiler nearly readyfir
|+* Re: Baby X resource compiler nearly readyfir
||`- Re: Baby X resource compiler nearly readyMalcolm McLean
|`* Re: Baby X resource compiler nearly readyMalcolm McLean
| +* Re: Baby X resource compiler nearly readyfir
| |`* Re: Baby X resource compiler nearly readyMalcolm McLean
| | `* Re: Baby X resource compiler nearly readyfir
| |  `- Re: Baby X resource compiler nearly readyfir
| +- Re: Baby X resource compiler nearly readyfir
| `* Re: Baby X resource compiler nearly readyBen Bacarisse
|  `- Re: Baby X resource compiler nearly readyMalcolm McLean
+* Re: Baby X resource compiler nearly readyBen Bacarisse
|`* Re: Baby X resource compiler nearly readyMalcolm McLean
| `* Re: Baby X resource compiler nearly readyBen Bacarisse
|  +* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |`* Re: Baby X resource compiler nearly readyBen Bacarisse
|  | `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |  `* Re: Baby X resource compiler nearly readyKenny McCormack
|  |   `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |    +* Re: Baby X resource compiler nearly readySpiros Bousbouras
|  |    |+* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |    ||+* Re: Baby X resource compiler nearly readyKenny McCormack
|  |    |||`* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |    ||| +* Re: Baby X resource compiler nearly readyKenny McCormack
|  |    ||| |+- Re: Baby X resource compiler nearly readyBart
|  |    ||| |`- Re: Baby X resource compiler nearly readyKaz Kylheku
|  |    ||| +* Re: Baby X resource compiler nearly readyDavid Brown
|  |    ||| |`* Re: Baby X resource compiler nearly readyKeith Thompson
|  |    ||| | +- Re: Baby X resource compiler nearly readyKeith Thompson
|  |    ||| | `- Re: Baby X resource compiler nearly readyMalcolm McLean
|  |    ||| `* Re: Baby X resource compiler nearly readyRichard Damon
|  |    |||  `- Re: Baby X resource compiler nearly readyTim Rentsch
|  |    ||`* Re: Baby X resource compiler nearly readyBen Bacarisse
|  |    || `* Re: Baby X resource compiler nearly readyDavid Brown
|  |    ||  +- Re: Baby X resource compiler nearly readyScott Lurndal
|  |    ||  `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |    ||   `- Re: Baby X resource compiler nearly readyScott Lurndal
|  |    |`- Re: Baby X resource compiler nearly readyTim Rentsch
|  |    +- Re: Baby X resource compiler nearly readyBen Bacarisse
|  |    `* Re: Baby X resource compiler nearly readyKeith Thompson
|  |     `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |      `* Re: Baby X resource compiler nearly readyjak
|  |       `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |        `* Re: Baby X resource compiler nearly readyjak
|  |         `* Re: Baby X resource compiler nearly readyMalcolm McLean
|  |          `- Re: Baby X resource compiler nearly readyMalcolm McLean
|  `* Re: Baby X resource compiler nearly readyBart
|   `- Re: Baby X resource compiler nearly readyBen Bacarisse
+* Re: Baby X resource compiler nearly readyScott Lurndal
|`* Re: Baby X resource compiler nearly readyKenny McCormack
| `* Re: Baby X resource compiler nearly readyScott Lurndal
|  `- Blah, blah, blah (Was: Baby X resource compiler nearly ready)Kenny McCormack
`- Re: Baby X resource compiler nearly readyBen Bacarisse

Pages:123
Re: Baby X resource compiler nearly ready

<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27112&group=comp.lang.c#27112

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:15ce:b0:40f:f2e0:af7c with SMTP id d14-20020a05622a15ce00b0040ff2e0af7cmr25124qty.13.1691327095532;
Sun, 06 Aug 2023 06:04:55 -0700 (PDT)
X-Received: by 2002:a05:6808:114b:b0:3a4:1082:9e5 with SMTP id
u11-20020a056808114b00b003a4108209e5mr10223636oiu.2.1691327095210; Sun, 06
Aug 2023 06:04:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 6 Aug 2023 06:04:54 -0700 (PDT)
In-Reply-To: <LntMHk8YCfUSQ6SmB@bongo-ra.co>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:b480:2fcc:38b4:7d80;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:b480:2fcc:38b4:7d80
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Sun, 06 Aug 2023 13:04:55 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4135
 by: Malcolm McLean - Sun, 6 Aug 2023 13:04 UTC

On Sunday, 6 August 2023 at 13:53:05 UTC+1, Spiros Bousbouras wrote:
> On Sun, 6 Aug 2023 04:36:47 -0700 (PDT)
> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
> > The a basic problem was that I am using a MP3 decoder written by someone else.
> > They wrote a file called clib.h which has various efficiency and portability hacks.
> > It includes this
> >
> > #if !NEED_MINILIBC
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #endif
> > #include <math.h>
> >
> > #ifndef __int8_t_defined
> > #define __int8_t_defined
> > typedef unsigned char uint8_t;
> > typedef signed char int8_t;
> > typedef unsigned short uint16_t;
> > typedef signed short int16_t;
> > typedef unsigned int uint32_t;
> > typedef signed int int32_t;
> > #ifdef _MSC_VER
> > typedef unsigned __int64 uint64_t;
> > typedef signed __int64 int64_t;
> > #else
> > typedef unsigned long long uint64_t;
> > typedef signed long long int64_t;
> > #endif
> > #endif
> >
> > Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> > So this breaks when compiled on Linux. By trying to be portable, they
> > managed to produce something which wasn't portable.
> >
> > It really confirms my view that it's best to write in a conservative subset
> > of C90 and the subsequent standards. otherwise you just get endless
> > trouble.
> My view is that it's best not to use code which has so many issues unless you
> fix them first. First , the code above has undefined behaviour because it
> uses reserved identifiers. Second , using __ in the beginning of
> identifiers with the hope of avoiding clashes is a bad design decision
> because so many C libraries make the same bad decision so it does not reduce
> the chances of having clashes. It is best to start identifiers in libraries
> which are for public usage with a prefix which isn't reserved by the standard
> and has a reasonable chance of being unique. So for example an MP3 decoder
> written by John Smith could start all public identifiers with JSMD_ (John
> Smith MP3 decoder).
>
It's hard to write an MP3 decoder and, if someone has already made a working
version available for free which fits in a single file, it's not a good use of my time.
But these relatively trivial problems break whole programs. Some Linux users
who download the Baby X resource compiler will be able to fix the compile errors
quite quickly. But may will say "Oh, it doesn't compile, obviously it doesn't work
on Linux".
The whole point of portable programming is that it should work on an unknown
target platform. But that's hard to achieve.

Re: Baby X resource compiler nearly ready

<87zg34jnsu.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27113&group=comp.lang.c#27113

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 06 Aug 2023 14:36:01 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <87zg34jnsu.fsf@bsb.me.uk>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="20f14672c700598f69b26a878904f633";
logging-data="2406486"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EldogHgJ5vRY8AilUT6k+PJ5fBmPqCIc="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:nM3UxAri4O54VeoMqRWiSMBIhc4=
sha1:fTBhBR6pUg/L9HDgQ6xHDUen8ws=
X-BSB-Auth: 1.27de548aaed89be9cfbe.20230806143601BST.87zg34jnsu.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 6 Aug 2023 13:36 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> The a basic problem was that I am using a MP3 decoder written by someone else.
> They wrote a file called clib.h which has various efficiency and
> portability hacks. It includes this
>
> #if !NEED_MINILIBC
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #endif
> #include <math.h>
>
> #ifndef __int8_t_defined
> #define __int8_t_defined

This would be a big red flag for me. I would be very cautious of using
this decoder.

> typedef unsigned char uint8_t;
> typedef signed char int8_t;
> typedef unsigned short uint16_t;
> typedef signed short int16_t;
> typedef unsigned int uint32_t;
> typedef signed int int32_t;
> #ifdef _MSC_VER
> typedef unsigned __int64 uint64_t;
> typedef signed __int64 int64_t;
> #else
> typedef unsigned long long uint64_t;
> typedef signed long long int64_t;
> #endif
> #endif
>
> Linux include <stdint.h> from the system headers.

I can't understand what you mean here. I see nothing here that includes
stdint.h. "Linux" doesn't.

> Windows and Mac doesn't. So this breaks when compiled on Linux. By
> trying to be portable, they managed to produce something which wasn't
> portable.

The code uses __int8_t_defined which has no predictable or well-defined
meaning.

> It really confirms my view that it's best to write in a conservative
> subset of C90 and the subsequent standards.

The above code looks to be using a conservative subset of C90. It's
guessing about __int8_t_defined but it's not using C99 or above.

You have not shown where the problem really comes from, other than some
code that is guessing on what __int8_t_defined might mean.

--
Ben.

Re: Baby X resource compiler nearly ready

<uao8iq$37ai9$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27114&group=comp.lang.c#27114

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 6 Aug 2023 13:52:26 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <uao8iq$37ai9$1@news.xmission.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co> <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
Injection-Date: Sun, 6 Aug 2023 13:52:26 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3385929"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sun, 6 Aug 2023 13:52 UTC

In article <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>,
Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
....
>It's hard to write an MP3 decoder and, if someone has already made a
>working version available for free which fits in a single file, it's not a
>good use of my time. But these relatively trivial problems break whole
>programs. Some Linux users who download the Baby X resource compiler will
>be able to fix the compile errors quite quickly. But may will say "Oh, it
>doesn't compile, obviously it doesn't work on Linux".
>
>The whole point of portable programming is that it should work on an unknown
>target platform. But that's hard to achieve.

I have to admit that I haven't dug deeply enough into it to know (or care),
but it seems like if you can say "It should be easy enough for the user to
be able to fix the compile errors quite quickly", then it should be easy
enough for you, the developer, to fix it so that they don't have to. Am I
wrong?

You should not have to re-write the whole MP3 decoder in order to
accomplish this (so that's kind of a red herring).

--
Adderall, pseudoephed, teleprompter

Re: Baby X resource compiler nearly ready

<9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27115&group=comp.lang.c#27115

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7d02:0:b0:40f:f509:3a75 with SMTP id g2-20020ac87d02000000b0040ff5093a75mr23228qtb.7.1691330868679;
Sun, 06 Aug 2023 07:07:48 -0700 (PDT)
X-Received: by 2002:a05:6808:1890:b0:3a3:c495:afdb with SMTP id
bi16-20020a056808189000b003a3c495afdbmr10867318oib.11.1691330868272; Sun, 06
Aug 2023 07:07:48 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 6 Aug 2023 07:07:47 -0700 (PDT)
In-Reply-To: <uao8iq$37ai9$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:b480:2fcc:38b4:7d80;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:b480:2fcc:38b4:7d80
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com> <uao8iq$37ai9$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Sun, 06 Aug 2023 14:07:48 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Sun, 6 Aug 2023 14:07 UTC

On Sunday, 6 August 2023 at 14:52:40 UTC+1, Kenny McCormack wrote:
> In article <2f89490d-af9a-4cc8...@googlegroups.com>,
> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
> ...
> >It's hard to write an MP3 decoder and, if someone has already made a
> >working version available for free which fits in a single file, it's not a
> >good use of my time. But these relatively trivial problems break whole
> >programs. Some Linux users who download the Baby X resource compiler will
> >be able to fix the compile errors quite quickly. But may will say "Oh, it
> >doesn't compile, obviously it doesn't work on Linux".
> >
> >The whole point of portable programming is that it should work on an unknown
> >target platform. But that's hard to achieve.
> I have to admit that I haven't dug deeply enough into it to know (or care),
> but it seems like if you can say "It should be easy enough for the user to
> be able to fix the compile errors quite quickly", then it should be easy
> enough for you, the developer, to fix it so that they don't have to. Am I
> wrong?
>
> You should not have to re-write the whole MP3 decoder in order to
> accomplish this (so that's kind of a red herring).
>
I hacked it. It's possible to write an MP3 decoder without using any fixed-width
type (though you can forgive uint64_t). But to go through the code taking out
all the fixed width dependencies would be quite an undertaking and likely to
create errors. So I just included stdint.h and set the define. But it's not ideal.

The problem is that the preprocessor doesn't understand typedefs. And no-one
thought to make stdint.h's include guard part of its public specification.
So there's no way of knowing whether the types have been defined or not.

Re: Baby X resource compiler nearly ready

<uaobqe$37cgl$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27117&group=comp.lang.c#27117

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 6 Aug 2023 14:47:42 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <uaobqe$37cgl$1@news.xmission.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com> <uao8iq$37ai9$1@news.xmission.com> <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
Injection-Date: Sun, 6 Aug 2023 14:47:42 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3387925"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sun, 6 Aug 2023 14:47 UTC

In article <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>,
Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
....
>The problem is that the preprocessor doesn't understand typedefs. And
>no-one thought to make stdint.h's include guard part of its public
>specification. So there's no way of knowing whether the types have been
>defined or not.

The big boys use autoconf. Have you considered that?

--
If the automobile had followed the same development cycle as the
computer, a Rolls-Royce today would cost $100, get a million miles to
the gallon, and explode once every few weeks, killing everyone inside.

Re: Baby X resource compiler nearly ready

<87tttcjk9y.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27119&group=comp.lang.c#27119

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 06 Aug 2023 15:52:09 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <87tttcjk9y.fsf@bsb.me.uk>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="20f14672c700598f69b26a878904f633";
logging-data="2439448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iSMtOLw/QiaaXPPL8S+RrSr99P85BOsE="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:OyBCDSZg7wQSTJa9G0Eous6FOZg=
sha1:77vxBgUOolqkiP+nmw+f4EeJ9eY=
X-BSB-Auth: 1.24779a01bf7de1cbc3a5.20230806155209BST.87tttcjk9y.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 6 Aug 2023 14:52 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> I've been working on the Baby X resource compiler for some time
> now. I've added in support for audio, unicode, and dataframes, plus a
> few minor enhancements such as the ability to add comments and write
> out a header as well as a C source file.
>
> I'm thinking of declaring a version shortly. Then I'll probably rest
> from my labours. Anything else anyone would want to see?
>
> I don't have a Linux machine. If someone would be kind enough to
> valgrind it to check for memory leaks or worse bugs, that would be a
> help.

The build now works, but the instructions don't work for me. I just
unzipped the code, changed to the created directory and ran cmake . and
the make. I see you fixed the "\n" for '\n' typo.

Audio test has memory write errors.

minimp3.c uses shifts recklessly giving undefined behaviour. These were
reported by compiling with gcc's -fsanitize=undefined option.

With strings.xml, valgrind reports memory access errors.

freetype/ttcalc.c has shift and negation errors.

nanosvgrast.h also shifts signed integers in a way undefined by C.

Valgrind reports that all the tests leak at least 8 bytes. I think this
is probably the first XML node allocation or something like that.
Trivial, but annoying if you want none.

The amino acid test leaks "2,536 bytes in 23 blocks".

Sorry for not posting the details, but I imagine you'll want to run
these tests yourself. I had to run each one by hand as there is no
automatic test script and there would be masses of copying and pasting of
text to give you all the details.

> The code is at
> https://github.com/MalcolmMcLean/babyxrc

--
Ben.

Re: Baby X resource compiler nearly ready

<87o7jkjjt0.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27120&group=comp.lang.c#27120

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 06 Aug 2023 16:02:19 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <87o7jkjjt0.fsf@bsb.me.uk>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="20f14672c700598f69b26a878904f633";
logging-data="2439448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UEBXraIieGRfPTMWWoD7hVBOxsY1lRGs="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:1Lo9/QgrkrX2xQBxGNwcxB3GKGI=
sha1:IzNBQc/8XB0UUSAaz+hmY6XHp3w=
X-BSB-Auth: 1.0f9ceb5c1a755e513211.20230806160219BST.87o7jkjjt0.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 6 Aug 2023 15:02 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

> It's hard to write an MP3 decoder and, if someone has already made a
> working version available for free which fits in a single file, it's
> not a good use of my time.

Just a side note... Packing all sorts of decoders and so on into one
program is probably a Windows thing. A Linux developer, using the Baby
X resource compiler, would, most likely, expect the various images and
sounds to be read, byte for byte, from a file already in the right
format. Linux offers all sorts of command-line conversion tools that
will be more capable, and offer more fine-grained control over the
conversion, than anything you can hope to keep up with. One more "make"
rule and the conversion becomes part of the build process.

--
Ben.

Re: Baby X resource compiler nearly ready

<uaodkv$2b42o$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27121&group=comp.lang.c#27121

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 6 Aug 2023 16:18:56 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uaodkv$2b42o$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
<uao8iq$37ai9$1@news.xmission.com>
<9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
<uaobqe$37cgl$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 6 Aug 2023 15:18:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="afbf40f2299f42f36068b306942e6f34";
logging-data="2461784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+degvr6xIgiaXP29HeyNrK64BYXqSe2Y8="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:Z2zheVRGXPbgxIGCg09Xaso8wZc=
In-Reply-To: <uaobqe$37cgl$1@news.xmission.com>
 by: Bart - Sun, 6 Aug 2023 15:18 UTC

On 06/08/2023 15:47, Kenny McCormack wrote:
> In article <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>,
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> ...
>> The problem is that the preprocessor doesn't understand typedefs. And
>> no-one thought to make stdint.h's include guard part of its public
>> specification. So there's no way of knowing whether the types have been
>> defined or not.
>
> The big boys use autoconf. Have you considered that?
>

I've considered that it needs to be taken out and shot.

I've seen autoconf-generated scripts of 30,000 lines, taking minutes to
process, dwarfing the time it takes to build the actual app or library
(that's just an unimportant detail compared to its real work!).

It runs endless tests such as checking whether 'printf' is supported by
the C compiler. (And if it isn't, then what?)

Because, of course, C is so portable that you need to do 100 different
tests to see whether various features are supported by a particular
implementation

But even if all this was justified, you'd think such tests only need to
be done once when you install the compiler to be used, and not every
time you build a new program.

Worse than any of that, however, is when the autoconf-generated code,
which is a Bash script, is expected to be run under Windows. Then it is
your responsibility to create a Linux environment on your machine to
make it possible.

Re: Baby X resource compiler nearly ready

<uaof42$2bk7i$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27122&group=comp.lang.c#27122

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 6 Aug 2023 16:44:03 +0100
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <uaof42$2bk7i$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<87jzu9u4ah.fsf@bsb.me.uk>
<e0e3623f-a74f-4111-9059-af24639b961fn@googlegroups.com>
<878rapthbn.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 6 Aug 2023 15:44:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="afbf40f2299f42f36068b306942e6f34";
logging-data="2478322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pbqRkt+IGXxVWVF8bIdZapJkNmc231CI="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:hKuTlkWkUcBZmK3Ob0u42/8awO4=
In-Reply-To: <878rapthbn.fsf@bsb.me.uk>
 by: Bart - Sun, 6 Aug 2023 15:44 UTC

On 05/08/2023 20:33, Ben Bacarisse wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>
>> On Saturday, 5 August 2023 at 12:17:46 UTC+1, Ben Bacarisse wrote:
>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>
>>>> I've been working on the Baby X resource compiler for some time now.
>>> ...
>>>> I don't have a Linux machine. If someone would be kind enough to
>>>> valgrind it to check for memory leaks or worse bugs, that would be a
>>>> help.
>>> The README has no build instructions. I'm happy to guess, but other
>>> users might not be.
>>>
>> Thanks.
>> Yes, one problem is that when you are both the developer and doumenter,
>> you're so close to the project that it's eay to miss the obvious.
>
> I get compile errors, but maybe this is not the right place to debug a
> build system...
>

I had a look to see what I could make of it. I did see build
instructions (maybe these have since been added), where it first
mentions Cmake (and here I thought, oh-oh!).

But then it said you can just do:

gcc *.c freetype/*.c samplerate/*.c -lm

from inside ./src. Translated to Windows (use \ not /, and forget -lm)
this worked.

I then tried it in WSL, and that worked too (or did after I added -lm -
one more annoyingly pointless and time-wasting detail of gcc).

The sources were days old so presumably these were the same ones you tried.

So I'd say the build system is one of the simplest I've seen,
considering that it produces a 2MB binary, a quite substantial program.

Re: Baby X resource compiler nearly ready

<20230806092649.138@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27128&group=comp.lang.c#27128

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 6 Aug 2023 16:29:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <20230806092649.138@kylheku.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
<uao8iq$37ai9$1@news.xmission.com>
<9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
<uaobqe$37cgl$1@news.xmission.com>
Injection-Date: Sun, 6 Aug 2023 16:29:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8cfc75365922a18c54795bf707c63d9f";
logging-data="2494315"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CcZcyYATNsnM/zz3Lj/SR8fYvOb+41rE="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:RbkR70BOy97hsvCYWvfsUWZau6E=
 by: Kaz Kylheku - Sun, 6 Aug 2023 16:29 UTC

On 2023-08-06, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> In article <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>,
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> ...
>>The problem is that the preprocessor doesn't understand typedefs. And
>>no-one thought to make stdint.h's include guard part of its public
>>specification. So there's no way of knowing whether the types have been
>>defined or not.
>
> The big boys use autoconf. Have you considered that?

Autoconf is more or less just a way of injecting a massive amount of
grotesque technical debt into your codebase for almost no benefit.

Any other way of achieving automated build configuration is better,
including:

- writing a script by hand.

- using canned configurations.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Baby X resource compiler nearly ready

<877cq8jeiv.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27131&group=comp.lang.c#27131

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 06 Aug 2023 17:56:24 +0100
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <877cq8jeiv.fsf@bsb.me.uk>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<87jzu9u4ah.fsf@bsb.me.uk>
<e0e3623f-a74f-4111-9059-af24639b961fn@googlegroups.com>
<878rapthbn.fsf@bsb.me.uk> <uaof42$2bk7i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="20f14672c700598f69b26a878904f633";
logging-data="2523746"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/A+uWYUv52JaP8UN9SbspeVtUsEwSG490="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:ui1i26p/RM7P3kZHs+F8GjAuyOA=
sha1:xbb7L9Z083I3BnKbVBYvhzeOqyI=
X-BSB-Auth: 1.e319d2dc4cccbddb5acc.20230806175624BST.877cq8jeiv.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 6 Aug 2023 16:56 UTC

Bart <bc@freeuk.com> writes:

> On 05/08/2023 20:33, Ben Bacarisse wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>
>>> On Saturday, 5 August 2023 at 12:17:46 UTC+1, Ben Bacarisse wrote:
>>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>>
>>>>> I've been working on the Baby X resource compiler for some time now.
>>>> ...
>>>>> I don't have a Linux machine. If someone would be kind enough to
>>>>> valgrind it to check for memory leaks or worse bugs, that would be a
>>>>> help.
>>>> The README has no build instructions. I'm happy to guess, but other
>>>> users might not be.
>>>>
>>> Thanks.
>>> Yes, one problem is that when you are both the developer and doumenter,
>>> you're so close to the project that it's eay to miss the obvious.
>>
>> I get compile errors, but maybe this is not the right place to debug a
>> build system...
>>
>
> I had a look to see what I could make of it. I did see build instructions
> (maybe these have since been added), where it first mentions Cmake (and
> here I thought, oh-oh!).
>
> But then it said you can just do:
>
> gcc *.c freetype/*.c samplerate/*.c -lm
>
> from inside ./src. Translated to Windows (use \ not /, and forget -lm) this
> worked.
>
> I then tried it in WSL, and that worked too (or did after I added -lm - one
> more annoyingly pointless and time-wasting detail of gcc).
>
> The sources were days old so presumably these were the same ones you
> tried.

Maybe. There's no version number that I can see but since I got compile
errors using the direct gcc command as well, I don't know what's going
on. Maybe my running cmake /broke/ the sources.

Anyway, it's fixed now. Running "cmake .; make" and the direct compile
build the binary, but there are a few things that need to be looked at.

--
Ben.

Re: Baby X resource compiler nearly ready

<87h6pbkhoa.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27136&group=comp.lang.c#27136

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Sun, 06 Aug 2023 14:03:01 -0700
Organization: None to speak of
Lines: 75
Message-ID: <87h6pbkhoa.fsf@nosuchdomain.example.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="830c5a3513b463a7e27469d828a9b02f";
logging-data="2611076"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rdWcpsSlGWa46Es3NAoUR"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:vm9mOuH+l6ilOv8yF3/FHLZAZTs=
sha1:1f0VIkzREGZzDDpxi3AcgQVwmps=
 by: Keith Thompson - Sun, 6 Aug 2023 21:03 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> The a basic problem was that I am using a MP3 decoder written by someone else.
> They wrote a file called clib.h which has various efficiency and portability hacks.
> It includes this
>
> #if !NEED_MINILIBC
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #endif
> #include <math.h>
>
> #ifndef __int8_t_defined
> #define __int8_t_defined
> typedef unsigned char uint8_t;
> typedef signed char int8_t;
> typedef unsigned short uint16_t;
> typedef signed short int16_t;
> typedef unsigned int uint32_t;
> typedef signed int int32_t;
> #ifdef _MSC_VER
> typedef unsigned __int64 uint64_t;
> typedef signed __int64 int64_t;
> #else
> typedef unsigned long long uint64_t;
> typedef signed long long int64_t;
> #endif
> #endif

This code assumes that the macro __int8_t_defined is defined if and only
if the fixed-width types from <stdint.h> are defined. There's no basis
for that assumption -- *unless* there's some other code we haven't seen
that sets __int8_t_defined appropriately. For example, there might be a
build step that write a small C source file that uses int8_t, then
writes a C header file whose contents depend on whether that source file
compiles or not. Perhaps the code that does that breaks on Linux.

Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
Some implementations might do so, but it's a bad assumption.

It's not guaranteed that int8_t exists even if <stdint.h> exists (if
CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
for that with `#ifdef INT8_MAX`.

If the code is intended to cater to pre-C99 implementations, the problem
is that the <stdint.h> header may not exist, and there's no way in C to
test whether a given header exists or not. (C23 adds __has_include(),
but of course if you have __has_include() you have <stdint.h> anyway.)

These days, it's likely safe enough to just assume that you have
<stdint.h>. Even a pre-C99 implementation is likely to provide it as an
extension. Or, if you really need it, you can look at Doug Gwyn's old
q8, which provides some C99 headers for use with C90 implementations:
https://www.lysator.liu.se/c/q8/index.html
Or you can check that __STDC_VERSION__ >= 199901L.

> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> So this breaks when compiled on Linux. By trying to be portable, they managed
> to produce something which wasn't portable.

What does that mean?

> It really confirms my view that it's best to write in a conservative subset of C90
> and the subsequent standards. otherwise you just get endless trouble. But writing
> my own MP3 decoder would be a huge job (I've written one before, but it was for
> work so of course I can't put it on the web).

It's likely that just assuming C99 or later would have avoided this
problem in the first place.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Baby X resource compiler nearly ready

<199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27148&group=comp.lang.c#27148

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:b4c2:0:b0:767:55c4:572b with SMTP id d185-20020a37b4c2000000b0076755c4572bmr26335qkf.3.1691397695753;
Mon, 07 Aug 2023 01:41:35 -0700 (PDT)
X-Received: by 2002:a05:6870:5aaf:b0:1ba:906f:b067 with SMTP id
dt47-20020a0568705aaf00b001ba906fb067mr10750228oab.1.1691397695385; Mon, 07
Aug 2023 01:41:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 7 Aug 2023 01:41:35 -0700 (PDT)
In-Reply-To: <87h6pbkhoa.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:60a0:ae4:1d6:52b8;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:60a0:ae4:1d6:52b8
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <87h6pbkhoa.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 07 Aug 2023 08:41:35 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 5079
 by: Malcolm McLean - Mon, 7 Aug 2023 08:41 UTC

On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> [...]
> > The a basic problem was that I am using a MP3 decoder written by someone else.
> > They wrote a file called clib.h which has various efficiency and portability hacks.
> > It includes this
> >
> > #if !NEED_MINILIBC
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #endif
> > #include <math.h>
> >
> > #ifndef __int8_t_defined
> > #define __int8_t_defined
> > typedef unsigned char uint8_t;
> > typedef signed char int8_t;
> > typedef unsigned short uint16_t;
> > typedef signed short int16_t;
> > typedef unsigned int uint32_t;
> > typedef signed int int32_t;
> > #ifdef _MSC_VER
> > typedef unsigned __int64 uint64_t;
> > typedef signed __int64 int64_t;
> > #else
> > typedef unsigned long long uint64_t;
> > typedef signed long long int64_t;
> > #endif
> > #endif
> This code assumes that the macro __int8_t_defined is defined if and only
> if the fixed-width types from <stdint.h> are defined. There's no basis
> for that assumption -- *unless* there's some other code we haven't seen
> that sets __int8_t_defined appropriately. For example, there might be a
> build step that write a small C source file that uses int8_t, then
> writes a C header file whose contents depend on whether that source file
> compiles or not. Perhaps the code that does that breaks on Linux.
>
> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
> Some implementations might do so, but it's a bad assumption.
>
> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
> for that with `#ifdef INT8_MAX`.
>
> If the code is intended to cater to pre-C99 implementations, the problem
> is that the <stdint.h> header may not exist, and there's no way in C to
> test whether a given header exists or not. (C23 adds __has_include(),
> but of course if you have __has_include() you have <stdint.h> anyway.)
>
> These days, it's likely safe enough to just assume that you have
> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
> extension. Or, if you really need it, you can look at Doug Gwyn's old
> q8, which provides some C99 headers for use with C90 implementations:
> https://www.lysator.liu.se/c/q8/index.html
> Or you can check that __STDC_VERSION__ >= 199901L.
> > Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> > So this breaks when compiled on Linux. By trying to be portable, they managed
> > to produce something which wasn't portable.
> What does that mean?
> > It really confirms my view that it's best to write in a conservative subset of C90
> > and the subsequent standards. otherwise you just get endless trouble. But writing
> > my own MP3 decoder would be a huge job (I've written one before, but it was for
> > work so of course I can't put it on the web).
> It's likely that just assuming C99 or later would have avoided this
> problem in the first place.
>
Yes, but it's hard to write a MP3 decoder. So if someone makes one available
on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
(of course it is GNU LGPLed so Baby X can use it legally) which was back in
the days when Microsoft only supported C90, despite C99 having been out for
some time. So code written in 2013 does sometimes have to call code written
maybe a very long time ago.

Re: Baby X resource compiler nearly ready

<uaqje0$2r3fg$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27151&group=comp.lang.c#27151

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Mon, 7 Aug 2023 13:09:53 +0200
Organization: A noiseless patient Spider
Lines: 82
Message-ID: <uaqje0$2r3fg$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<87h6pbkhoa.fsf@nosuchdomain.example.com>
<199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 7 Aug 2023 11:09:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e1f6eae4a12bf1f340f4e8e03685e30d";
logging-data="2985456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QQEe9ml+H7vHdjUmYZYo9"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:F8SXl3Qt/HKIJ6s0mJT6KufGCkI=
In-Reply-To: <199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com>
 by: jak - Mon, 7 Aug 2023 11:09 UTC

Malcolm McLean ha scritto:
> On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>> [...]
>>> The a basic problem was that I am using a MP3 decoder written by someone else.
>>> They wrote a file called clib.h which has various efficiency and portability hacks.
>>> It includes this
>>>
>>> #if !NEED_MINILIBC
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>> #include <string.h>
>>> #endif
>>> #include <math.h>
>>>
>>> #ifndef __int8_t_defined
>>> #define __int8_t_defined
>>> typedef unsigned char uint8_t;
>>> typedef signed char int8_t;
>>> typedef unsigned short uint16_t;
>>> typedef signed short int16_t;
>>> typedef unsigned int uint32_t;
>>> typedef signed int int32_t;
>>> #ifdef _MSC_VER
>>> typedef unsigned __int64 uint64_t;
>>> typedef signed __int64 int64_t;
>>> #else
>>> typedef unsigned long long uint64_t;
>>> typedef signed long long int64_t;
>>> #endif
>>> #endif
>> This code assumes that the macro __int8_t_defined is defined if and only
>> if the fixed-width types from <stdint.h> are defined. There's no basis
>> for that assumption -- *unless* there's some other code we haven't seen
>> that sets __int8_t_defined appropriately. For example, there might be a
>> build step that write a small C source file that uses int8_t, then
>> writes a C header file whose contents depend on whether that source file
>> compiles or not. Perhaps the code that does that breaks on Linux.
>>
>> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
>> Some implementations might do so, but it's a bad assumption.
>>
>> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
>> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
>> for that with `#ifdef INT8_MAX`.
>>
>> If the code is intended to cater to pre-C99 implementations, the problem
>> is that the <stdint.h> header may not exist, and there's no way in C to
>> test whether a given header exists or not. (C23 adds __has_include(),
>> but of course if you have __has_include() you have <stdint.h> anyway.)
>>
>> These days, it's likely safe enough to just assume that you have
>> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
>> extension. Or, if you really need it, you can look at Doug Gwyn's old
>> q8, which provides some C99 headers for use with C90 implementations:
>> https://www.lysator.liu.se/c/q8/index.html
>> Or you can check that __STDC_VERSION__ >= 199901L.
>>> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
>>> So this breaks when compiled on Linux. By trying to be portable, they managed
>>> to produce something which wasn't portable.
>> What does that mean?
>>> It really confirms my view that it's best to write in a conservative subset of C90
>>> and the subsequent standards. otherwise you just get endless trouble. But writing
>>> my own MP3 decoder would be a huge job (I've written one before, but it was for
>>> work so of course I can't put it on the web).
>> It's likely that just assuming C99 or later would have avoided this
>> problem in the first place.
>>
> Yes, but it's hard to write a MP3 decoder. So if someone makes one available
> on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
> (of course it is GNU LGPLed so Baby X can use it legally) which was back in
> the days when Microsoft only supported C90, despite C99 having been out for
> some time. So code written in 2013 does sometimes have to call code written
> maybe a very long time ago.
>

Many programs use 'ffmpeg' asking it to unpack the audio file and
broadcast it on the stream, then they take the raw data from the same
stream. You can find 'ffmpeg' for almost all systems.

Re: Baby X resource compiler nearly ready

<e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27154&group=comp.lang.c#27154

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:8682:0:b0:76c:c5bf:6af5 with SMTP id i124-20020a378682000000b0076cc5bf6af5mr28520qkd.14.1691409556754;
Mon, 07 Aug 2023 04:59:16 -0700 (PDT)
X-Received: by 2002:a05:6808:2086:b0:3a3:c78e:d863 with SMTP id
s6-20020a056808208600b003a3c78ed863mr16513153oiw.0.1691409556354; Mon, 07 Aug
2023 04:59:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 7 Aug 2023 04:59:15 -0700 (PDT)
In-Reply-To: <uaqje0$2r3fg$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <87h6pbkhoa.fsf@nosuchdomain.example.com>
<199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com> <uaqje0$2r3fg$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 07 Aug 2023 11:59:16 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 6190
 by: Malcolm McLean - Mon, 7 Aug 2023 11:59 UTC

On Monday, 7 August 2023 at 12:10:06 UTC+1, jak wrote:
> Malcolm McLean ha scritto:
> > On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
> >> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> >> [...]
> >>> The a basic problem was that I am using a MP3 decoder written by someone else.
> >>> They wrote a file called clib.h which has various efficiency and portability hacks.
> >>> It includes this
> >>>
> >>> #if !NEED_MINILIBC
> >>> #include <stdio.h>
> >>> #include <stdlib.h>
> >>> #include <string.h>
> >>> #endif
> >>> #include <math.h>
> >>>
> >>> #ifndef __int8_t_defined
> >>> #define __int8_t_defined
> >>> typedef unsigned char uint8_t;
> >>> typedef signed char int8_t;
> >>> typedef unsigned short uint16_t;
> >>> typedef signed short int16_t;
> >>> typedef unsigned int uint32_t;
> >>> typedef signed int int32_t;
> >>> #ifdef _MSC_VER
> >>> typedef unsigned __int64 uint64_t;
> >>> typedef signed __int64 int64_t;
> >>> #else
> >>> typedef unsigned long long uint64_t;
> >>> typedef signed long long int64_t;
> >>> #endif
> >>> #endif
> >> This code assumes that the macro __int8_t_defined is defined if and only
> >> if the fixed-width types from <stdint.h> are defined. There's no basis
> >> for that assumption -- *unless* there's some other code we haven't seen
> >> that sets __int8_t_defined appropriately. For example, there might be a
> >> build step that write a small C source file that uses int8_t, then
> >> writes a C header file whose contents depend on whether that source file
> >> compiles or not. Perhaps the code that does that breaks on Linux.
> >>
> >> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
> >> Some implementations might do so, but it's a bad assumption.
> >>
> >> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
> >> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
> >> for that with `#ifdef INT8_MAX`.
> >>
> >> If the code is intended to cater to pre-C99 implementations, the problem
> >> is that the <stdint.h> header may not exist, and there's no way in C to
> >> test whether a given header exists or not. (C23 adds __has_include(),
> >> but of course if you have __has_include() you have <stdint.h> anyway.)
> >>
> >> These days, it's likely safe enough to just assume that you have
> >> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
> >> extension. Or, if you really need it, you can look at Doug Gwyn's old
> >> q8, which provides some C99 headers for use with C90 implementations:
> >> https://www.lysator.liu.se/c/q8/index.html
> >> Or you can check that __STDC_VERSION__ >= 199901L.
> >>> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> >>> So this breaks when compiled on Linux. By trying to be portable, they managed
> >>> to produce something which wasn't portable.
> >> What does that mean?
> >>> It really confirms my view that it's best to write in a conservative subset of C90
> >>> and the subsequent standards. otherwise you just get endless trouble. But writing
> >>> my own MP3 decoder would be a huge job (I've written one before, but it was for
> >>> work so of course I can't put it on the web).
> >> It's likely that just assuming C99 or later would have avoided this
> >> problem in the first place.
> >>
> > Yes, but it's hard to write a MP3 decoder. So if someone makes one available
> > on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
> > (of course it is GNU LGPLed so Baby X can use it legally) which was back in
> > the days when Microsoft only supported C90, despite C99 having been out for
> > some time. So code written in 2013 does sometimes have to call code written
> > maybe a very long time ago.
> >
> Many programs use 'ffmpeg' asking it to unpack the audio file and
> broadcast it on the stream, then they take the raw data from the same
> stream. You can find 'ffmpeg' for almost all systems.
>
What happens is that you produce the project. Then you ship it and development
stops. But you don't throw it away. You archive it. Some years later, you might
need to dust it off. The people who worked on it might have left. And life will
have moved on. A lot of the dependencies might have broken. It might no longer
be true that most machines run ffmpeg. Or the interfaces might have changed.

So you lose most of the benefits of a resource compiler as soon as you start
using it as glue application for other applications.

Re: Baby X resource compiler nearly ready

<uar0hf$2t93m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27162&group=comp.lang.c#27162

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Mon, 7 Aug 2023 16:53:35 +0200
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <uar0hf$2t93m$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<87h6pbkhoa.fsf@nosuchdomain.example.com>
<199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com>
<uaqje0$2r3fg$1@dont-email.me>
<e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 7 Aug 2023 14:53:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e1f6eae4a12bf1f340f4e8e03685e30d";
logging-data="3056758"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+97SPitu8Ab34Jk/SMzMTi"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:ntm0ux2tvx5xRtfzkolQvaQPC8Q=
In-Reply-To: <e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com>
 by: jak - Mon, 7 Aug 2023 14:53 UTC

Malcolm McLean ha scritto:
> On Monday, 7 August 2023 at 12:10:06 UTC+1, jak wrote:
>> Malcolm McLean ha scritto:
>>> On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
>>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>>>> [...]
>>>>> The a basic problem was that I am using a MP3 decoder written by someone else.
>>>>> They wrote a file called clib.h which has various efficiency and portability hacks.
>>>>> It includes this
>>>>>
>>>>> #if !NEED_MINILIBC
>>>>> #include <stdio.h>
>>>>> #include <stdlib.h>
>>>>> #include <string.h>
>>>>> #endif
>>>>> #include <math.h>
>>>>>
>>>>> #ifndef __int8_t_defined
>>>>> #define __int8_t_defined
>>>>> typedef unsigned char uint8_t;
>>>>> typedef signed char int8_t;
>>>>> typedef unsigned short uint16_t;
>>>>> typedef signed short int16_t;
>>>>> typedef unsigned int uint32_t;
>>>>> typedef signed int int32_t;
>>>>> #ifdef _MSC_VER
>>>>> typedef unsigned __int64 uint64_t;
>>>>> typedef signed __int64 int64_t;
>>>>> #else
>>>>> typedef unsigned long long uint64_t;
>>>>> typedef signed long long int64_t;
>>>>> #endif
>>>>> #endif
>>>> This code assumes that the macro __int8_t_defined is defined if and only
>>>> if the fixed-width types from <stdint.h> are defined. There's no basis
>>>> for that assumption -- *unless* there's some other code we haven't seen
>>>> that sets __int8_t_defined appropriately. For example, there might be a
>>>> build step that write a small C source file that uses int8_t, then
>>>> writes a C header file whose contents depend on whether that source file
>>>> compiles or not. Perhaps the code that does that breaks on Linux.
>>>>
>>>> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
>>>> Some implementations might do so, but it's a bad assumption.
>>>>
>>>> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
>>>> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
>>>> for that with `#ifdef INT8_MAX`.
>>>>
>>>> If the code is intended to cater to pre-C99 implementations, the problem
>>>> is that the <stdint.h> header may not exist, and there's no way in C to
>>>> test whether a given header exists or not. (C23 adds __has_include(),
>>>> but of course if you have __has_include() you have <stdint.h> anyway.)
>>>>
>>>> These days, it's likely safe enough to just assume that you have
>>>> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
>>>> extension. Or, if you really need it, you can look at Doug Gwyn's old
>>>> q8, which provides some C99 headers for use with C90 implementations:
>>>> https://www.lysator.liu.se/c/q8/index.html
>>>> Or you can check that __STDC_VERSION__ >= 199901L.
>>>>> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
>>>>> So this breaks when compiled on Linux. By trying to be portable, they managed
>>>>> to produce something which wasn't portable.
>>>> What does that mean?
>>>>> It really confirms my view that it's best to write in a conservative subset of C90
>>>>> and the subsequent standards. otherwise you just get endless trouble. But writing
>>>>> my own MP3 decoder would be a huge job (I've written one before, but it was for
>>>>> work so of course I can't put it on the web).
>>>> It's likely that just assuming C99 or later would have avoided this
>>>> problem in the first place.
>>>>
>>> Yes, but it's hard to write a MP3 decoder. So if someone makes one available
>>> on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
>>> (of course it is GNU LGPLed so Baby X can use it legally) which was back in
>>> the days when Microsoft only supported C90, despite C99 having been out for
>>> some time. So code written in 2013 does sometimes have to call code written
>>> maybe a very long time ago.
>>>
>> Many programs use 'ffmpeg' asking it to unpack the audio file and
>> broadcast it on the stream, then they take the raw data from the same
>> stream. You can find 'ffmpeg' for almost all systems.
>>
> What happens is that you produce the project. Then you ship it and development
> stops. But you don't throw it away. You archive it. Some years later, you might
> need to dust it off. The people who worked on it might have left. And life will
> have moved on. A lot of the dependencies might have broken. It might no longer
> be true that most machines run ffmpeg. Or the interfaces might have changed.
>
> So you lose most of the benefits of a resource compiler as soon as you start
> using it as glue application for other applications.
>

I absolutely agree with you. Maybe I hurt the thread, where I believed
that the basic idea was to make the resource compiler available quickly.
For this reason I suggested this idea that it would be faster than
writing a decoder which can be done later.

Re: Baby X resource compiler nearly ready

<cfdf391f-00da-4e6b-878c-e1e08b82adc5n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27165&group=comp.lang.c#27165

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:19a1:b0:405:5657:2510 with SMTP id u33-20020a05622a19a100b0040556572510mr32977qtc.0.1691422052734; Mon, 07 Aug 2023 08:27:32 -0700 (PDT)
X-Received: by 2002:a05:6808:178d:b0:3a7:3a2e:e49a with SMTP id bg13-20020a056808178d00b003a73a2ee49amr17224021oib.4.1691422052358; Mon, 07 Aug 2023 08:27:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.14.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 7 Aug 2023 08:27:31 -0700 (PDT)
In-Reply-To: <uar0hf$2t93m$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24; posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk> <a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com> <da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <87h6pbkhoa.fsf@nosuchdomain.example.com> <199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com> <uaqje0$2r3fg$1@dont-email.me> <e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com> <uar0hf$2t93m$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cfdf391f-00da-4e6b-878c-e1e08b82adc5n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 07 Aug 2023 15:27:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 103
 by: Malcolm McLean - Mon, 7 Aug 2023 15:27 UTC

On Monday, 7 August 2023 at 15:53:50 UTC+1, jak wrote:
> Malcolm McLean ha scritto:
> > On Monday, 7 August 2023 at 12:10:06 UTC+1, jak wrote:
> >> Malcolm McLean ha scritto:
> >>> On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
> >>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> >>>> [...]
> >>>>> The a basic problem was that I am using a MP3 decoder written by someone else.
> >>>>> They wrote a file called clib.h which has various efficiency and portability hacks.
> >>>>> It includes this
> >>>>>
> >>>>> #if !NEED_MINILIBC
> >>>>> #include <stdio.h>
> >>>>> #include <stdlib.h>
> >>>>> #include <string.h>
> >>>>> #endif
> >>>>> #include <math.h>
> >>>>>
> >>>>> #ifndef __int8_t_defined
> >>>>> #define __int8_t_defined
> >>>>> typedef unsigned char uint8_t;
> >>>>> typedef signed char int8_t;
> >>>>> typedef unsigned short uint16_t;
> >>>>> typedef signed short int16_t;
> >>>>> typedef unsigned int uint32_t;
> >>>>> typedef signed int int32_t;
> >>>>> #ifdef _MSC_VER
> >>>>> typedef unsigned __int64 uint64_t;
> >>>>> typedef signed __int64 int64_t;
> >>>>> #else
> >>>>> typedef unsigned long long uint64_t;
> >>>>> typedef signed long long int64_t;
> >>>>> #endif
> >>>>> #endif
> >>>> This code assumes that the macro __int8_t_defined is defined if and only
> >>>> if the fixed-width types from <stdint.h> are defined. There's no basis
> >>>> for that assumption -- *unless* there's some other code we haven't seen
> >>>> that sets __int8_t_defined appropriately. For example, there might be a
> >>>> build step that write a small C source file that uses int8_t, then
> >>>> writes a C header file whose contents depend on whether that source file
> >>>> compiles or not. Perhaps the code that does that breaks on Linux.
> >>>>
> >>>> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
> >>>> Some implementations might do so, but it's a bad assumption.
> >>>>
> >>>> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
> >>>> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
> >>>> for that with `#ifdef INT8_MAX`.
> >>>>
> >>>> If the code is intended to cater to pre-C99 implementations, the problem
> >>>> is that the <stdint.h> header may not exist, and there's no way in C to
> >>>> test whether a given header exists or not. (C23 adds __has_include(),
> >>>> but of course if you have __has_include() you have <stdint.h> anyway.)
> >>>>
> >>>> These days, it's likely safe enough to just assume that you have
> >>>> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
> >>>> extension. Or, if you really need it, you can look at Doug Gwyn's old
> >>>> q8, which provides some C99 headers for use with C90 implementations:
> >>>> https://www.lysator.liu.se/c/q8/index.html
> >>>> Or you can check that __STDC_VERSION__ >= 199901L.
> >>>>> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> >>>>> So this breaks when compiled on Linux. By trying to be portable, they managed
> >>>>> to produce something which wasn't portable.
> >>>> What does that mean?
> >>>>> It really confirms my view that it's best to write in a conservative subset of C90
> >>>>> and the subsequent standards. otherwise you just get endless trouble. But writing
> >>>>> my own MP3 decoder would be a huge job (I've written one before, but it was for
> >>>>> work so of course I can't put it on the web).
> >>>> It's likely that just assuming C99 or later would have avoided this
> >>>> problem in the first place.
> >>>>
> >>> Yes, but it's hard to write a MP3 decoder. So if someone makes one available
> >>> on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
> >>> (of course it is GNU LGPLed so Baby X can use it legally) which was back in
> >>> the days when Microsoft only supported C90, despite C99 having been out for
> >>> some time. So code written in 2013 does sometimes have to call code written
> >>> maybe a very long time ago.
> >>>
> >> Many programs use 'ffmpeg' asking it to unpack the audio file and
> >> broadcast it on the stream, then they take the raw data from the same
> >> stream. You can find 'ffmpeg' for almost all systems.
> >>
> > What happens is that you produce the project. Then you ship it and development
> > stops. But you don't throw it away. You archive it. Some years later, you might
> > need to dust it off. The people who worked on it might have left. And life will
> > have moved on. A lot of the dependencies might have broken. It might no longer
> > be true that most machines run ffmpeg. Or the interfaces might have changed.
> >
> > So you lose most of the benefits of a resource compiler as soon as you start
> > using it as glue application for other applications.
> >
> I absolutely agree with you. Maybe I hurt the thread, where I believed
> that the basic idea was to make the resource compiler available quickly.
> For this reason I suggested this idea that it would be faster than
> writing a decoder which can be done later.
>
I want to declare a version of the Baby X resource compiler quite quickly.
That means a feature freeze to get the bugs out. Unfortunately the MP3 decoder
appears to be a buggy component - it works fine on Mac and Windows, but
Linux is reporting errors. It's also hard to debug - I didn't write it myself which
makes things harder, and it's quite dense code that does a lot of low level
bit manipulation. So I'm not quite sure what to do, but the obvious thing is to
have a go at it. If that isn't sucessful, it's a bit of a hard decision. Whilst it
appears to work fine on Windows, that might be an illusion.

Re: Baby X resource compiler nearly ready

<4de56962-c719-47a2-b37f-e57cc994d263n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27171&group=comp.lang.c#27171

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:946:b0:636:3fbd:84e with SMTP id dn6-20020a056214094600b006363fbd084emr33306qvb.5.1691426684207;
Mon, 07 Aug 2023 09:44:44 -0700 (PDT)
X-Received: by 2002:a05:6830:1394:b0:6b9:a422:9f with SMTP id
d20-20020a056830139400b006b9a422009fmr11123510otq.1.1691426683969; Mon, 07
Aug 2023 09:44:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 7 Aug 2023 09:44:43 -0700 (PDT)
In-Reply-To: <cfdf391f-00da-4e6b-878c-e1e08b82adc5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a8a8:f1d8:b1d8:bd24
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <87h6pbkhoa.fsf@nosuchdomain.example.com>
<199d7e0c-7fef-48f0-ba67-705267b452e9n@googlegroups.com> <uaqje0$2r3fg$1@dont-email.me>
<e32c94f1-7b24-43f0-9b4d-fc4c63bbc0c2n@googlegroups.com> <uar0hf$2t93m$1@dont-email.me>
<cfdf391f-00da-4e6b-878c-e1e08b82adc5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4de56962-c719-47a2-b37f-e57cc994d263n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 07 Aug 2023 16:44:44 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 7966
 by: Malcolm McLean - Mon, 7 Aug 2023 16:44 UTC

On Monday, 7 August 2023 at 16:27:41 UTC+1, Malcolm McLean wrote:
> On Monday, 7 August 2023 at 15:53:50 UTC+1, jak wrote:
> > Malcolm McLean ha scritto:
> > > On Monday, 7 August 2023 at 12:10:06 UTC+1, jak wrote:
> > >> Malcolm McLean ha scritto:
> > >>> On Sunday, 6 August 2023 at 22:03:21 UTC+1, Keith Thompson wrote:
> > >>>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> > >>>> [...]
> > >>>>> The a basic problem was that I am using a MP3 decoder written by someone else.
> > >>>>> They wrote a file called clib.h which has various efficiency and portability hacks.
> > >>>>> It includes this
> > >>>>>
> > >>>>> #if !NEED_MINILIBC
> > >>>>> #include <stdio.h>
> > >>>>> #include <stdlib.h>
> > >>>>> #include <string.h>
> > >>>>> #endif
> > >>>>> #include <math.h>
> > >>>>>
> > >>>>> #ifndef __int8_t_defined
> > >>>>> #define __int8_t_defined
> > >>>>> typedef unsigned char uint8_t;
> > >>>>> typedef signed char int8_t;
> > >>>>> typedef unsigned short uint16_t;
> > >>>>> typedef signed short int16_t;
> > >>>>> typedef unsigned int uint32_t;
> > >>>>> typedef signed int int32_t;
> > >>>>> #ifdef _MSC_VER
> > >>>>> typedef unsigned __int64 uint64_t;
> > >>>>> typedef signed __int64 int64_t;
> > >>>>> #else
> > >>>>> typedef unsigned long long uint64_t;
> > >>>>> typedef signed long long int64_t;
> > >>>>> #endif
> > >>>>> #endif
> > >>>> This code assumes that the macro __int8_t_defined is defined if and only
> > >>>> if the fixed-width types from <stdint.h> are defined. There's no basis
> > >>>> for that assumption -- *unless* there's some other code we haven't seen
> > >>>> that sets __int8_t_defined appropriately. For example, there might be a
> > >>>> build step that write a small C source file that uses int8_t, then
> > >>>> writes a C header file whose contents depend on whether that source file
> > >>>> compiles or not. Perhaps the code that does that breaks on Linux.
> > >>>>
> > >>>> Or perhaps it assume that <stdint.h> defines a macro __int8_t_defined.
> > >>>> Some implementations might do so, but it's a bad assumption.
> > >>>>
> > >>>> It's not guaranteed that int8_t exists even if <stdint.h> exists (if
> > >>>> CHAR_BIT==8 or signed char doesn't use two's-complement). You can check
> > >>>> for that with `#ifdef INT8_MAX`.
> > >>>>
> > >>>> If the code is intended to cater to pre-C99 implementations, the problem
> > >>>> is that the <stdint.h> header may not exist, and there's no way in C to
> > >>>> test whether a given header exists or not. (C23 adds __has_include(),
> > >>>> but of course if you have __has_include() you have <stdint.h> anyway.)
> > >>>>
> > >>>> These days, it's likely safe enough to just assume that you have
> > >>>> <stdint.h>. Even a pre-C99 implementation is likely to provide it as an
> > >>>> extension. Or, if you really need it, you can look at Doug Gwyn's old
> > >>>> q8, which provides some C99 headers for use with C90 implementations:
> > >>>> https://www.lysator.liu.se/c/q8/index.html
> > >>>> Or you can check that __STDC_VERSION__ >= 199901L.
> > >>>>> Linux include <stdint.h> from the system headers. Windows and Mac doesn't.
> > >>>>> So this breaks when compiled on Linux. By trying to be portable, they managed
> > >>>>> to produce something which wasn't portable.
> > >>>> What does that mean?
> > >>>>> It really confirms my view that it's best to write in a conservative subset of C90
> > >>>>> and the subsequent standards. otherwise you just get endless trouble. But writing
> > >>>>> my own MP3 decoder would be a huge job (I've written one before, but it was for
> > >>>>> work so of course I can't put it on the web).
> > >>>> It's likely that just assuming C99 or later would have avoided this
> > >>>> problem in the first place.
> > >>>>
> > >>> Yes, but it's hard to write a MP3 decoder. So if someone makes one available
> > >>> on the web for free, it makes sense to use it. The bulk of it is copyright 2001,
> > >>> (of course it is GNU LGPLed so Baby X can use it legally) which was back in
> > >>> the days when Microsoft only supported C90, despite C99 having been out for
> > >>> some time. So code written in 2013 does sometimes have to call code written
> > >>> maybe a very long time ago.
> > >>>
> > >> Many programs use 'ffmpeg' asking it to unpack the audio file and
> > >> broadcast it on the stream, then they take the raw data from the same
> > >> stream. You can find 'ffmpeg' for almost all systems.
> > >>
> > > What happens is that you produce the project. Then you ship it and development
> > > stops. But you don't throw it away. You archive it. Some years later, you might
> > > need to dust it off. The people who worked on it might have left. And life will
> > > have moved on. A lot of the dependencies might have broken. It might no longer
> > > be true that most machines run ffmpeg. Or the interfaces might have changed.
> > >
> > > So you lose most of the benefits of a resource compiler as soon as you start
> > > using it as glue application for other applications.
> > >
> > I absolutely agree with you. Maybe I hurt the thread, where I believed
> > that the basic idea was to make the resource compiler available quickly.
> > For this reason I suggested this idea that it would be faster than
> > writing a decoder which can be done later.
> >
> I want to declare a version of the Baby X resource compiler quite quickly.
> That means a feature freeze to get the bugs out. Unfortunately the MP3 decoder
> appears to be a buggy component - it works fine on Mac and Windows, but
> Linux is reporting errors. It's also hard to debug - I didn't write it myself which
> makes things harder, and it's quite dense code that does a lot of low level
> bit manipulation. So I'm not quite sure what to do, but the obvious thing is to
> have a go at it. If that isn't sucessful, it's a bit of a hard decision. Whilst it
> appears to work fine on Windows, that might be an illusion.
>
I managed to find the bug reported by Ben, and it's in my own code, not the MP3
decoder itself. Which is a big relief.

Re: Baby X resource compiler nearly ready

<86edkdbsag.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27219&group=comp.lang.c#27219

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Tue, 08 Aug 2023 06:03:03 -0700
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <86edkdbsag.fsf@linuxsc.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk> <a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com> <da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="996336b78d58b8cbe9ae682ecb3e6882";
logging-data="3580797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xnWbrolA99tdx3Hu2a5ahbIyEcHibdzU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:K7Doku8llowf9Iv+ePvcPiySaxE=
sha1:zUBUjcfwOoEdI6mfLxVvyLrxGho=
 by: Tim Rentsch - Tue, 8 Aug 2023 13:03 UTC

Spiros Bousbouras <spibou@gmail.com> writes:

> On Sun, 6 Aug 2023 04:36:47 -0700 (PDT)
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

>> #ifndef __int8_t_defined
>> #define __int8_t_defined
>> typedef unsigned char uint8_t;
>> typedef signed char int8_t;
>> typedef unsigned short uint16_t;
>> typedef signed short int16_t;
>> typedef unsigned int uint32_t;
>> typedef signed int int32_t;
>> #ifdef _MSC_VER
>> typedef unsigned __int64 uint64_t;
>> typedef signed __int64 int64_t;
>> #else
>> typedef unsigned long long uint64_t;
>> typedef signed long long int64_t;
>> #endif
>> #endif

> [...] the code above has undefined behaviour because it uses
> reserved identifiers. [...]

This code does have undefined behavior, but only because it
/defines/ a reserved identifier. Simply /using/ a reserved
identifier is not undefined behavior, only declaring or
defining one.

Re: Baby X resource compiler nearly ready

<uatkqt$3egu8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27231&group=comp.lang.c#27231

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Tue, 8 Aug 2023 16:52:13 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uatkqt$3egu8$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
<uao8iq$37ai9$1@news.xmission.com>
<9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 8 Aug 2023 14:52:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="512f07d8c41584f35ecc4f03b0b34350";
logging-data="3621832"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18C1V9EpVRN/vNwnkMJkIn60xVr06rfqcU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
Cancel-Lock: sha1:Y+9f+OsFH1M91wZRHvOYRD89BPE=
Content-Language: en-GB
In-Reply-To: <9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
 by: David Brown - Tue, 8 Aug 2023 14:52 UTC

On 06/08/2023 16:07, Malcolm McLean wrote:
> The problem is that the preprocessor doesn't understand typedefs. And no-one
> thought to make stdint.h's include guard part of its public specification.
> So there's no way of knowing whether the types have been defined or not.
>

There is an extremely simple answer to all this:

#include <stdint.h>

There. Done. All your <stdint.h> types are defined and ready to use.

Re: Baby X resource compiler nearly ready

<uatl4t$3em79$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27233&group=comp.lang.c#27233

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Tue, 8 Aug 2023 16:57:32 +0200
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uatl4t$3em79$1@dont-email.me>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com>
<87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com>
<uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
<87o7jkjjt0.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 8 Aug 2023 14:57:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="512f07d8c41584f35ecc4f03b0b34350";
logging-data="3627241"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LOzoIZxthaIZqX7cMJtT5ixeI19WfFrc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.6.1
Cancel-Lock: sha1:9EWajpg/LitL43zqNO4Xw6VvOuU=
Content-Language: en-GB
In-Reply-To: <87o7jkjjt0.fsf@bsb.me.uk>
 by: David Brown - Tue, 8 Aug 2023 14:57 UTC

On 06/08/2023 17:02, Ben Bacarisse wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>
>> It's hard to write an MP3 decoder and, if someone has already made a
>> working version available for free which fits in a single file, it's
>> not a good use of my time.
>
> Just a side note... Packing all sorts of decoders and so on into one
> program is probably a Windows thing. A Linux developer, using the Baby
> X resource compiler, would, most likely, expect the various images and
> sounds to be read, byte for byte, from a file already in the right
> format. Linux offers all sorts of command-line conversion tools that
> will be more capable, and offer more fine-grained control over the
> conversion, than anything you can hope to keep up with. One more "make"
> rule and the conversion becomes part of the build process.
>

Of course. But that is surely so obvious that Malcolm has thought about
it. Presumably his users find it helpful to be able to convert from a
few formats using a decoder of unknown quality, rather than using
high-quality and flexible tools like ImageMagick, FFmpeg, or others to
convert to standard uncompressed formats.

Re: Baby X resource compiler nearly ready

<bVsAM.351938$xMqa.245603@fx12.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27235&group=comp.lang.c#27235

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Baby X resource compiler nearly ready
Newsgroups: comp.lang.c
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk> <a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com> <da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co> <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com> <87o7jkjjt0.fsf@bsb.me.uk> <uatl4t$3em79$1@dont-email.me>
Lines: 50
Message-ID: <bVsAM.351938$xMqa.245603@fx12.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 08 Aug 2023 15:09:59 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 08 Aug 2023 15:09:59 GMT
X-Received-Bytes: 3227
 by: Scott Lurndal - Tue, 8 Aug 2023 15:09 UTC

David Brown <david.brown@hesbynett.no> writes:
>On 06/08/2023 17:02, Ben Bacarisse wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>
>>> It's hard to write an MP3 decoder and, if someone has already made a
>>> working version available for free which fits in a single file, it's
>>> not a good use of my time.
>>
>> Just a side note... Packing all sorts of decoders and so on into one
>> program is probably a Windows thing. A Linux developer, using the Baby
>> X resource compiler, would, most likely, expect the various images and
>> sounds to be read, byte for byte, from a file already in the right
>> format. Linux offers all sorts of command-line conversion tools that
>> will be more capable, and offer more fine-grained control over the
>> conversion, than anything you can hope to keep up with. One more "make"
>> rule and the conversion becomes part of the build process.
>>
>
>Of course. But that is surely so obvious that Malcolm has thought about
>it. Presumably his users find it helpful to be able to convert from a
>few formats using a decoder of unknown quality, rather than using
>high-quality and flexible tools like ImageMagick, FFmpeg, or others to
>convert to standard uncompressed formats.
>

Indeed, it is not uncommon to see sequences like this:

FILE *infile = NULL;
char buffer[PATH_MAX];
if (strstr(argv[1], ".lzo")) {
snprintf(buffer, sizeof(buffer), "lzop -d < %s", argv[1]);
buffer[sizeof(buffer)-1] = '\0';
infile = popen(buffer, "r");
} else if (strstr(argv[1], ".gz")) {
snprintf(buffer, sizeof(buffer), "zcat %s", argv[1]);
buffer[sizeof(buffer)-1] = '\0';
infile = popen(buffer, "r");
} else if (strstr(argv[1], ".xz")) {
snprintf(buffer, sizeof(buffer), "xz -d < %s", argv[1]);
buffer[sizeof(buffer)-1] = '\0';
infile = popen(buffer, "r");
} else {
infile = fopen(argv[1], "r");
}

if (infile == NULL) {
fprintf(stderr, "%s: Unable to open '%s': %s\n", argv[0], argv[1], strerror(errno));
return false;
}
....

Re: Baby X resource compiler nearly ready

<502bd765-94c7-490f-abe1-a9aa8f8f97a4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27238&group=comp.lang.c#27238

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:5641:b0:63d:557f:b4c9 with SMTP id mh1-20020a056214564100b0063d557fb4c9mr661qvb.3.1691508405520;
Tue, 08 Aug 2023 08:26:45 -0700 (PDT)
X-Received: by 2002:a05:6871:4f81:b0:1bf:802f:83a1 with SMTP id
zv1-20020a0568714f8100b001bf802f83a1mr15910417oab.0.1691508405204; Tue, 08
Aug 2023 08:26:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 8 Aug 2023 08:26:44 -0700 (PDT)
In-Reply-To: <uatl4t$3em79$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:3061:372d:59ca:e7b2;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:3061:372d:59ca:e7b2
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk>
<a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com> <87o7jkjjt0.fsf@bsb.me.uk>
<uatl4t$3em79$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <502bd765-94c7-490f-abe1-a9aa8f8f97a4n@googlegroups.com>
Subject: Re: Baby X resource compiler nearly ready
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 08 Aug 2023 15:26:45 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3605
 by: Malcolm McLean - Tue, 8 Aug 2023 15:26 UTC

On Tuesday, 8 August 2023 at 15:57:48 UTC+1, David Brown wrote:
> On 06/08/2023 17:02, Ben Bacarisse wrote:
> > Malcolm McLean <malcolm.ar...@gmail.com> writes:
> >
> >> It's hard to write an MP3 decoder and, if someone has already made a
> >> working version available for free which fits in a single file, it's
> >> not a good use of my time.
> >
> > Just a side note... Packing all sorts of decoders and so on into one
> > program is probably a Windows thing. A Linux developer, using the Baby
> > X resource compiler, would, most likely, expect the various images and
> > sounds to be read, byte for byte, from a file already in the right
> > format. Linux offers all sorts of command-line conversion tools that
> > will be more capable, and offer more fine-grained control over the
> > conversion, than anything you can hope to keep up with. One more "make"
> > rule and the conversion becomes part of the build process.
> >
> Of course. But that is surely so obvious that Malcolm has thought about
> it. Presumably his users find it helpful to be able to convert from a
> few formats using a decoder of unknown quality, rather than using
> high-quality and flexible tools like ImageMagick, FFmpeg, or others to
> convert to standard uncompressed formats.
>
The MP3 decoder I am using was written by Fabrice Bellard, who is the same
person who wrote the ffmpeg audio decoder. Things might have forked
since, but basically its the same decoder as in ffmpeg.

But I think you're confusing an MP3 decoder with an MP3 encoder. MP3 is
designed so that the decoder is relatively simple to write. It fits in a single
C source file, after all. Writing an encoder is a different proposition, and
encoder can vary a food deal in quality.

I want an MP3 encoder in the Baby X resource compiler so that people can
store raw resources as .wavs and embed them as MP3. But getting one that
integrates nicely is hard, and not for v1.2. However if anyone wants to help
out, this is high on the wishlist.

Re: Baby X resource compiler nearly ready

<uztAM.103869$X02a.73548@fx46.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27245&group=comp.lang.c#27245

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx46.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Baby X resource compiler nearly ready
Newsgroups: comp.lang.c
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com> <644ac909-d6b9-42b9-88c0-1442b6fd227an@googlegroups.com> <87wmy9rwi8.fsf@bsb.me.uk> <a4b1ffc5-2ec6-463e-8c69-bb41c6f4f38cn@googlegroups.com> <uanuhp$3770n$1@news.xmission.com> <da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com> <LntMHk8YCfUSQ6SmB@bongo-ra.co> <2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com> <87o7jkjjt0.fsf@bsb.me.uk> <uatl4t$3em79$1@dont-email.me> <502bd765-94c7-490f-abe1-a9aa8f8f97a4n@googlegroups.com>
Lines: 43
Message-ID: <uztAM.103869$X02a.73548@fx46.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 08 Aug 2023 15:55:06 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 08 Aug 2023 15:55:06 GMT
X-Received-Bytes: 3330
 by: Scott Lurndal - Tue, 8 Aug 2023 15:55 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>On Tuesday, 8 August 2023 at 15:57:48 UTC+1, David Brown wrote:
>> On 06/08/2023 17:02, Ben Bacarisse wrote:
>> > Malcolm McLean <malcolm.ar...@gmail.com> writes:
>> >
>> >> It's hard to write an MP3 decoder and, if someone has already made a
>> >> working version available for free which fits in a single file, it's
>> >> not a good use of my time.
>> >
>> > Just a side note... Packing all sorts of decoders and so on into one
>> > program is probably a Windows thing. A Linux developer, using the Baby
>> > X resource compiler, would, most likely, expect the various images and
>> > sounds to be read, byte for byte, from a file already in the right
>> > format. Linux offers all sorts of command-line conversion tools that
>> > will be more capable, and offer more fine-grained control over the
>> > conversion, than anything you can hope to keep up with. One more "make"
>> > rule and the conversion becomes part of the build process.
>> >
>> Of course. But that is surely so obvious that Malcolm has thought about
>> it. Presumably his users find it helpful to be able to convert from a
>> few formats using a decoder of unknown quality, rather than using
>> high-quality and flexible tools like ImageMagick, FFmpeg, or others to
>> convert to standard uncompressed formats.
>>
>The MP3 decoder I am using was written by Fabrice Bellard, who is the same
>person who wrote the ffmpeg audio decoder. Things might have forked
>since, but basically its the same decoder as in ffmpeg.
>
>But I think you're confusing an MP3 decoder with an MP3 encoder. MP3 is
>designed so that the decoder is relatively simple to write. It fits in a single
>C source file, after all. Writing an encoder is a different proposition, and
>encoder can vary a food deal in quality.
>
>I want an MP3 encoder in the Baby X resource compiler so that people can
>store raw resources as .wavs and embed them as MP3. But getting one that
>integrates nicely is hard, and not for v1.2. However if anyone wants to help
>out, this is high on the wishlist.

char buffer[PATH_MAX];
snprintf(buffer, sizeof(buffer), "lame -b 320 -m s -h %s -", mp3filename);
FILE *encoded_mp3 = popen(buffer, "r");

Re: Baby X resource compiler nearly ready

<87350tqf5f.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=27288&group=comp.lang.c#27288

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Baby X resource compiler nearly ready
Date: Tue, 08 Aug 2023 16:37:48 -0700
Organization: None to speak of
Lines: 37
Message-ID: <87350tqf5f.fsf@nosuchdomain.example.com>
References: <1c2d0b65-3e37-4534-966f-d039a655773cn@googlegroups.com>
<da68fd88-8d75-4601-bd7d-71d4109bf416n@googlegroups.com>
<LntMHk8YCfUSQ6SmB@bongo-ra.co>
<2f89490d-af9a-4cc8-ab08-80365edd6b52n@googlegroups.com>
<uao8iq$37ai9$1@news.xmission.com>
<9c9dee88-2625-4589-a85f-c2b03666a96an@googlegroups.com>
<uatkqt$3egu8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3774181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197eF5MhBnLWeEKM/7pO0D0"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:OF+L8J4ybaYR319BodzsQnVFa0U=
sha1:oofrQWv+JtG7RgYFMkvnyms1qMs=
 by: Keith Thompson - Tue, 8 Aug 2023 23:37 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 06/08/2023 16:07, Malcolm McLean wrote:
>> The problem is that the preprocessor doesn't understand typedefs. And no-one
>> thought to make stdint.h's include guard part of its public specification.
>> So there's no way of knowing whether the types have been defined or not.
>>
>
> There is an extremely simple answer to all this:
>
> #include <stdint.h>
>
> There. Done. All your <stdint.h> types are defined and ready to use.

Which is basically what Malcolm did to fix the problem. Here's the
relevant change he made (commit 51f9819 in
https://github.com/MalcolmMcLean/babyxrc):

#if !NEED_MINILIBC
+ #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #define __int8_t_defined
#endif

Defining __int8_t_defined causes the code that conditionally defines
int8_t et al to skip those definitions.

Apparently src/libc.h was copied from some other project. I can't tell
where it came from.

Malcolm, can you tell us where that code originated?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */


devel / comp.lang.c / Re: Baby X resource compiler nearly ready

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor