Deutsch   English   Français   Italiano  
<v3lk0g$3d35$1@dont-email.me>

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

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Malcolm McLean <malcolm.arthur.mclean@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Writing own source disk
Date: Tue, 4 Jun 2024 00:35:44 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <v3lk0g$3d35$1@dont-email.me>
References: <v3hmha$3banl$1@dont-email.me> <87sexvm1lr.fsf@bsb.me.uk>
 <v3iu4n$3i607$1@dont-email.me> <87mso2mky5.fsf@bsb.me.uk>
 <v3k49t$3rdhi$1@dont-email.me> <87bk4ime5r.fsf@bsb.me.uk>
 <v3kde3$3stdb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 04 Jun 2024 01:35:44 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="afe06429c6ecaf11a4c578de8ecf1837";
	logging-data="111717"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/kU1IuYiBKYDTomQyKBREmwkNCnAskZZU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:NFQwoxz7uTIjCwga6zPZAKrsrQM=
In-Reply-To: <v3kde3$3stdb$1@dont-email.me>
Content-Language: en-GB
Bytes: 2715

On 03/06/2024 13:37, bart wrote:
> On 03/06/2024 12:58, Ben Bacarisse wrote:
>> 
> That it is not very interesting. Using #embed applied to a program's 
> only source code I think opens up some intriguing possibilities.
> 
> Whereas a pure quine, which can require ingenuity, to me is just a puzzle.
> 
> 
No, it' not that hard, nce you now the trick.

The program babyfs_dirtoxml, which seem to be stable and works, writes a 
directory as a FileSystem XML file. So the nautral thing to do is to use 
it ot packaage up the souce, and include in inthe ptoram as a string. 
However of course the string cannot include itself.

So what you do is say that there is a special file called source.c which 
defines a global character pointer called "source", which points to the 
source. However when you package up the directory, of course you delete 
the real source.c and replace it with a small placeholder. Then you 
generte the real source.c from the FileSystem XML file you havt just 
created. And then you compile.

And of currsethere are tfunctions t parse an XML fileSystem file, 
mnipulate the hieraxty, and write it back out.

So what you do is replace the placeholder source.c with the real one. 
And then, on command, you write the source out. And it's a quine. And a 
really powerful and easy to make quine. Ih's just a bit fiddly at the 
moment, but I have got things working.

-- 
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm