Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v320am$1km5$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v320am$1km5$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Mon, 27 May 2024 14:03:16 +0100
Organization: A noiseless patient Spider
Lines: 149
Message-ID: <v320am$1km5$1@dont-email.me>
References: <v2l828$18v7f$1@dont-email.me>
 <00297443-2fee-48d4-81a0-9ff6ae6481e4@gmail.com>
 <v2lji1$1bbcp$1@dont-email.me> <87msoh5uh6.fsf@nosuchdomain.example.com>
 <f08d2c9f-5c2e-495d-b0bd-3f71bd301432@gmail.com>
 <v2nbp4$1o9h6$1@dont-email.me> <v2ng4n$1p3o2$1@dont-email.me>
 <87y18047jk.fsf@nosuchdomain.example.com>
 <87msoe1xxo.fsf@nosuchdomain.example.com> <v2sh19$2rle2$2@dont-email.me>
 <87ikz11osy.fsf@nosuchdomain.example.com> <v2v59g$3cr0f$1@dont-email.me>
 <v30l15$3mcj6$1@dont-email.me> <v30lls$3mepf$1@dont-email.me>
 <v30sai$3rilf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 May 2024 15:03:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="9970b47dfd04b6361c017b36cc1405b4";
	logging-data="53957"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18DEH8rd4KkRr05X+77czMf"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:FJPjhZODBdGzBen/MlL3c7sXyCI=
In-Reply-To: <v30sai$3rilf$1@dont-email.me>
Content-Language: en-GB
Bytes: 5457

On 27/05/2024 03:48, Lawrence D'Oliveiro wrote:
> On Mon, 27 May 2024 01:55:24 +0100, bart wrote:
> 
>> On 27/05/2024 01:44, Lawrence D'Oliveiro wrote:

> Nothing “unwieldy” about it. It’s a bunch of temporary intermediate build
> products, generated from suitable source files like everything else in the
> build.
> 
>>> It only solves the easy part: including that binary data in the build.
>>
>> Apparently that is not so easy as you seem to think.
> 
> Yes, it is as easy as I think. I’ve done this sort of thing, using
> suitable build scripts.

Show me.

This is how I show help text, which is maintained in an ordinary text 
file, from within my C compiler:

     println sinclude("help.txt")

Just one line directly in the source code. The text is baked in to the 
executable so there is no discrete file in the installation.

What would it look like in your build system, and what does it look like 
in the source code of your app?

I mean, it's not as though this stuff is impossible without such a 
feature; the idea is to make it much simpler to do.

If your method is simpler, I'll get rid of my feature and use your way.

BTW here is the entire build process for the compiler:

   C:\cx>mm cc
   Compiling cc.m to cc.exe

'cc' is cc.m, the lead module. It incorporates 42 embedded files in all. 
Your method can't be any more elaborate than that.

I don't use build scripts; I don't need them.

Here is another example using C (using an older compiler that supported 
embedded text files; this is not standard C, but it could be, and I 
think will be using #embed).

It is a program posted by Michael S, but with an extra 'puts' line at 
the beginning so that it first prints out its own source code.

It works by embedded the text for itself within the binary. I'd be 
interested in how your build process manages this.


----------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(int argz, char** argv)
{
   puts(strinclude(__FILE__));

   if (argz > 1) {
     FILE* fp = fopen(argv[1], "wb");
     if (fp) {
       char buf[2048];
       _Bool look_for_comma = 0;
       for (;;) {
         if (fgets(buf, sizeof(buf), stdin) != buf)
           break;

         char* p = buf;
         for (;;) {
           char c = *p;
           if (isgraph(c)) {
             if (look_for_comma) {
               if (c == ',') {
                 look_for_comma = 0;
                 ++p;
               } else {
                 goto done;
               }
             } else {
               char* endp;
               long val = strtol(p, &endp, 0);
               if (endp==p) // not a number
                 goto done;
               fputc((unsigned char)val, fp);
               p = endp;
               look_for_comma = 1;
             }
           } else {
             if (c == 0)
               break; // end of line
             ++p; // skip space or control character
           }
         }
       }
       done:
       fclose(fp);
     } else {
       perror(argv[1]);
       return 1;
     }
   }
   return 0;
}

----------------------------------

C:\c>bcc c.c
Compiling c.c to c.exe

C:\c>c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(int argz, char** argv)
{
   puts(strinclude(__FILE__));

   if (argz > 1) {
     FILE* fp = fopen(argv[1], "wb");
     if (fp) {
     .....







> 
>> Or maybe you think
>> that 'embedding a file' just means adding it to a zip file?
> 
> It’s whatever “including it in the build” means. It might indeed be a zip
> component, as with resources for an Android app. Or it might be converted
> into an object file with a tool like objcopy, to be integrated into the
> executable.
> 
>> Embedding applies also to text files not just binaries.
> 
> Same principle applies.