• Re: Writing own source disk

    From bart@21:1/5 to Ben Bacarisse on Mon Jun 3 00:10:15 2024
    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.

    A quine must also not process any input.

    No input at compile-time or runtime?

    A compiler necessarily has to have the source code of the program as
    input, so what are the limitations? A C program can use #include; does
    that extend to directives like #embed, or is that considered cheating?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Sun Jun 2 23:17:04 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.

    A quine must also not process any input.

    And I have achieved a
    quine. But a serious quine. Not contrived special purpose code, but serious codde which can be used to package up source for real.

    You XML-producing program may be very useful, but it's not really a
    quine, serious or otherwise.

    And it's completely
    portable ANSI C. So of course it can't write output to disk - that is impossible to achive portably. Instead it writes its own source to standard output using a simle XML format called FileSystem, which represents the source tree.

    That sounds as if the program reads input (but it's not explicitly
    stated) as well as not producing the program text but some XML
    representation of the program text. That would make it not a quine for
    two reasons.

    How do you process a source tree in completely portable ANSI C?

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Malcolm McLean on Sun Jun 2 23:19:25 2024
    On Mon, 3 Jun 2024 00:09:15 +0100, Malcolm McLean wrote:

    It's also a very superior quine, and it spits out images and binaries.

    Like a self-building Linux distro does?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Malcolm McLean on Sun Jun 2 23:18:49 2024
    On Sun, 2 Jun 2024 12:54:17 +0100, Malcolm McLean wrote:

    But a serious quine. Not contrived special purpose code, but
    serious codde which can be used to package up source for real.

    apt source apt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to bart on Mon Jun 3 10:31:30 2024
    bart <bc@freeuk.com> writes:

    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.
    A quine must also not process any input.

    No input at compile-time or runtime?

    The program isn't running at compile time.

    A compiler necessarily has to have the source code of the program as input, so what are the limitations?

    The compiler can do what it likes!

    A C program can use #include; does that extend
    to directives like #embed, or is that considered cheating?

    There's nothing wrong with using either, but a C quine that uses #embed
    relies on knowing the name of the file in which it is stored. It is a
    "fixed point of the execution environment", but it's probably the least interesting C quine possible -- much like

    1

    is a quine in languages that evaluate and print an expression.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Ben Bacarisse on Mon Jun 3 11:01:34 2024
    On 03/06/2024 10:31, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.
    A quine must also not process any input.

    No input at compile-time or runtime?

    The program isn't running at compile time.

    A compiler necessarily has to have the source code of the program as input, >> so what are the limitations?

    The compiler can do what it likes!

    A C program can use #include; does that extend
    to directives like #embed, or is that considered cheating?

    There's nothing wrong with using either, but a C quine that uses #embed relies on knowing the name of the file in which it is stored.

    I assume you can use __FILE__ with #embed? (I can do that with my
    version of it).

    Then it doesn't need to know the actual name of the file.


    It is a
    "fixed point of the execution environment", but it's probably the least interesting C quine possible -- much like

    1

    is a quine in languages that evaluate and print an expression.

    Not really. I've just added this line:

    puts(strinclude(__FILE__));

    to the main function of a program called sql.c (combines sqlite3.c and shell.c). When I run it (after building with my 'bcc' compiler), it
    first prints 235,577 lines of its source code.

    (By making this optional, it has some real use-cases.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Mon Jun 3 13:11:24 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.
    A quine must also not process any input.

    And I have achieved a
    quine. But a serious quine. Not contrived special purpose code, but serious >>> codde which can be used to package up source for real.
    You XML-producing program may be very useful, but it's not really a
    quine, serious or otherwise.

    And it's completely
    portable ANSI C. So of course it can't write output to disk - that is
    impossible to achive portably. Instead it writes its own source to standard >>> output using a simle XML format called FileSystem, which represents the
    source tree.
    That sounds as if the program reads input (but it's not explicitly
    stated) as well as not producing the program text but some XML
    representation of the program text. That would make it not a quine for
    two reasons.
    How do you process a source tree in completely portable ANSI C?

    The FileSystem XML fie is embedded with the program. It is a genuine
    quine. Compile it and see.

    No need; I'll take your word for it.

    It's also a very superior quine, and it spits out images and binaries.

    If it's a quine (and I don't doubt you) then is spits out its own source
    code. That can, of course, include source code encodings of images.
    I'm not sure why you consider that superior, but that is, after all, a
    rather subjective assessment.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to bart on Mon Jun 3 12:58:08 2024
    bart <bc@freeuk.com> writes:

    On 03/06/2024 10:31, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a >>>>> standard programming problem. It's called a quine.
    A quine must also not process any input.

    No input at compile-time or runtime?
    The program isn't running at compile time.

    A compiler necessarily has to have the source code of the program as input, >>> so what are the limitations?
    The compiler can do what it likes!

    A C program can use #include; does that extend
    to directives like #embed, or is that considered cheating?
    There's nothing wrong with using either, but a C quine that uses #embed
    relies on knowing the name of the file in which it is stored.

    I assume you can use __FILE__ with #embed? (I can do that with my version
    of it).

    Then it doesn't need to know the actual name of the file.

    I don't know if that is guaranteed by the standard as I've not really
    looked at C23, but if is it, that would be a way to write a (rather
    boring) quine in C23.

    It is a
    "fixed point of the execution environment", but it's probably the least
    interesting C quine possible -- much like
    1
    is a quine in languages that evaluate and print an expression.

    Not really.

    What part are you objecting to? That the above (a C quine using #embed)
    in not a fixed point of the execution environment? That it's not an uninteresting quine? Or that it's not "much like" self-evaluating
    expression quines?

    You said "not really" in reply to a moderately complex paragraph.

    I've just added this line:

    puts(strinclude(__FILE__));

    I think I'm missing your point. That does input at run-time (if my
    guess about strinclude is correct).

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Ben Bacarisse on Mon Jun 3 13:37:25 2024
    On 03/06/2024 12:58, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    On 03/06/2024 10:31, Ben Bacarisse wrote:

    There's nothing wrong with using either, but a C quine that uses #embed
    relies on knowing the name of the file in which it is stored.

    I assume you can use __FILE__ with #embed? (I can do that with my version
    of it).

    Then it doesn't need to know the actual name of the file.

    I don't know if that is guaranteed by the standard as I've not really
    looked at C23, but if is it, that would be a way to write a (rather
    boring) quine in C23.



    It is a
    "fixed point of the execution environment", but it's probably the least
    interesting C quine possible -- much like
    1
    is a quine in languages that evaluate and print an expression.

    Not really.

    What part are you objecting to?

    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.


    That the above (a C quine using #embed)
    in not a fixed point of the execution environment? That it's not an uninteresting quine? Or that it's not "much like" self-evaluating
    expression quines?

    You said "not really" in reply to a moderately complex paragraph.

    I've just added this line:

    puts(strinclude(__FILE__));

    I think I'm missing your point. That does input at run-time (if my
    guess about strinclude is correct).

    'strinclude' is the equivalent of #embed. It does textual inclusion at compile-time.

    Without that line, the sql.exe executable is about 1MB. With that line
    added, it's just over 9MB because that source file is just over 8MB.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Malcolm McLean on Mon Jun 3 16:04:57 2024
    On Sun, 2 Jun 2024 12:54:17 +0100
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.

    Is it named after Willard Van Orman Quine?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Michael S on Mon Jun 3 14:47:08 2024
    Michael S <already5chosen@yahoo.com> writes:

    On Sun, 2 Jun 2024 12:54:17 +0100
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.

    Is it named after Willard Van Orman Quine?

    In honour of rather than after since "after" is usually used for
    discoverers. It was Douglas Hofstadter who coined the term.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to bart on Mon Jun 3 14:50:10 2024
    On 03/06/2024 13:37, bart wrote:
    On 03/06/2024 12:58, Ben Bacarisse wrote:

    What part are you objecting to?

    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.

    If I look at examples on sites like this:

    https://rosettacode.org/wiki/Quine

    then a common characteristic is that the a lot of source code ends up
    being written twice. To me that is undesirable.

    It's also not clear how easily arbitrary code (ie. that performs some
    useful task) can be added.

    This is one that /I/ would consider cheating:

    #include <stdio.h>
    main(void){printf(__FILE__);}

    Here, the source must be put into a file with the same name as the
    source code, that is, called:

    #include <stdio.h>\nmain(void){printf(__FILE__);}

    But this is also writing it twice: once inside the file, again as the
    filename.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to bart on Mon Jun 3 14:55:27 2024
    bart <bc@freeuk.com> writes:

    On 03/06/2024 12:58, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    On 03/06/2024 10:31, Ben Bacarisse wrote:

    There's nothing wrong with using either, but a C quine that uses #embed >>>> relies on knowing the name of the file in which it is stored.

    I assume you can use __FILE__ with #embed? (I can do that with my version >>> of it).

    Then it doesn't need to know the actual name of the file.
    I don't know if that is guaranteed by the standard as I've not really
    looked at C23, but if is it, that would be a way to write a (rather
    boring) quine in C23.



    It is a
    "fixed point of the execution environment", but it's probably the least >>>> interesting C quine possible -- much like
    1
    is a quine in languages that evaluate and print an expression.

    Not really.
    What part are you objecting to?

    That it is not very interesting.

    Ah, OK.

    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.

    In fact, I didn't say it wasn't interesting, only that it's not an
    interesting quine. Saying more about what you see as those intriguing possibilities would be topical here.

    puts(strinclude(__FILE__));

    I think I'm missing your point. That does input at run-time (if my
    guess about strinclude is correct).

    'strinclude' is the equivalent of #embed.

    So this is not C. In comp.lang.c, when a line is very C-like, the fact
    that it's not C should be flagged.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Ben Bacarisse on Mon Jun 3 15:34:39 2024
    On 03/06/2024 14:55, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    puts(strinclude(__FILE__));

    I think I'm missing your point. That does input at run-time (if my
    guess about strinclude is correct).

    'strinclude' is the equivalent of #embed.

    So this is not C. In comp.lang.c, when a line is very C-like, the fact
    that it's not C should be flagged.

    I mentioned that particular extension of mine quite a few times in the
    thread. And here I said it was processed with my 'bcc' compiler, after
    I'd also mentioned my version of #embed, both in connection with __FILE__.

    So, it's not standard C, but I'd normally say 'not C' for examples like
    this:

    print strinclude($filename)

    (At the moment I have one practical C compiler that supports
    'strinclude', but zero that support #embed.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to bart on Mon Jun 3 19:36:52 2024
    bart <bc@freeuk.com> writes:

    On 03/06/2024 14:55, Ben Bacarisse wrote:
    bart <bc@freeuk.com> writes:

    puts(strinclude(__FILE__));

    I think I'm missing your point. That does input at run-time (if my
    guess about strinclude is correct).

    'strinclude' is the equivalent of #embed.
    So this is not C. In comp.lang.c, when a line is very C-like, the fact
    that it's not C should be flagged.

    I mentioned that particular extension of mine quite a few times in the thread.

    I don't read all of your posts.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Ben Bacarisse on Mon Jun 3 23:56:43 2024
    On Mon, 03 Jun 2024 10:31:30 +0100, Ben Bacarisse wrote:

    The program isn't running at compile time.

    That would depend on the language.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Tue Jun 4 09:30:53 2024
    On 04/06/2024 02:35, Keith Thompson wrote:
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    bart <bc@freeuk.com> writes:
    [...]
    I assume you can use __FILE__ with #embed? (I can do that with my
    version of it).

    Yes, but not reliably.

    __FILE__ expands to "The presumed name of the current source file (a
    character string literal)". That's rather vague.

    With gcc and clang, it expands to the file name argument given to the
    compiler, or to the argument of the #include directive. The running
    program may or may not be able to access the source file using that
    name. The source file might not even exist when the program runs.

    I was thinking of using __FILE__ to access the source file at run time. #embed is of course handled at compile time. It's very likely, but
    still not quite guaranteed, that `#embed __FILE__` will be able to
    access the source file.


    The key question for that will be directory handling. If everything is
    being done within the same directory, than I'd expect "#embed __FILE__"
    to work fine. But if you are calling the compiler from a different
    directory, specifying a path for the source file, that might not be
    reflected in __FILE__. The result could vary between compilers.

    There is also the possibility that the search path for #embed might
    result in finding a different file with the same name. But I think that
    would probably need specific command-line switches to specify the #embed
    search path (again, this will be compiler-specific).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Lawrence D'Oliveiro on Tue Jun 4 12:10:12 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Mon, 03 Jun 2024 10:31:30 +0100, Ben Bacarisse wrote:

    The program isn't running at compile time.

    That would depend on the language.

    I think you are trolling. Look as the question you cut to which I was replying.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Tue Jun 4 14:33:39 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 14:47, Ben Bacarisse wrote:
    Michael S <already5chosen@yahoo.com> writes:

    On Sun, 2 Jun 2024 12:54:17 +0100
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

    Writing a prgram which writes its own source to standard output is a
    standard programming problem. It's called a quine.

    Is it named after Willard Van Orman Quine?
    In honour of rather than after since "after" is usually used for
    discoverers. It was Douglas Hofstadter who coined the term.


    /* source for a quine */

    There seems to be loads missing. How big it the program when it's all
    there or, since it's a quine, what is the size of text it outputs?

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Tue Jun 4 14:40:24 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 13:11, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 02/06/2024 23:17, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    Writing a prgram which writes its own source to standard output is a >>>>> standard programming problem. It's called a quine.
    A quine must also not process any input.

    And I have achieved a
    quine. But a serious quine. Not contrived special purpose code, but serious
    codde which can be used to package up source for real.
    You XML-producing program may be very useful, but it's not really a
    quine, serious or otherwise.

    And it's completely
    portable ANSI C. So of course it can't write output to disk - that is >>>>> impossible to achive portably. Instead it writes its own source to standard
    output using a simle XML format called FileSystem, which represents the >>>>> source tree.
    That sounds as if the program reads input (but it's not explicitly
    stated) as well as not producing the program text but some XML
    representation of the program text. That would make it not a quine for >>>> two reasons.
    How do you process a source tree in completely portable ANSI C?

    The FileSystem XML fie is embedded with the program. It is a genuine
    quine. Compile it and see.
    No need; I'll take your word for it.

    It's also a very superior quine, and it spits out images and binaries.
    If it's a quine (and I don't doubt you) then is spits out its own source
    code. That can, of course, include source code encodings of images.
    I'm not sure why you consider that superior, but that is, after all, a
    rather subjective assessment.

    It's not therortically interesting from a computer science perspective.
    You can encode images as source.

    But from a practical point of view, yes my quine is massively
    powerful. Most graphical programs do have images as source. And they just
    get zipped up into the FileSystem XML file. So any binary data can be included. Easily, Using exactly the same system.

    I'm not getting it. Why do I want a quine in connection to a graphical program? I want a way to include everything in the distribution, but
    we've had that for ages. Why is having a program that outputs something
    you already have (by defintion!) of any use?

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Malcolm McLean on Tue Jun 4 19:23:06 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
    On 04/06/2024 14:40, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:


    I'm not getting it. Why do I want a quine in connection to a graphical
    program? I want a way to include everything in the distribution, but
    we've had that for ages. Why is having a program that outputs something
    you already have (by defintion!) of any use?

    Because you've got the binary, but not the source.

    The binary is not portable, its limited to a specific processor
    and operating system version.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Ben Bacarisse on Tue Jun 4 20:57:31 2024
    On 04/06/2024 14:40, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 13:11, Ben Bacarisse wrote:

    But from a practical point of view, yes my quine is massively
    powerful. Most graphical programs do have images as source. And they just
    get zipped up into the FileSystem XML file. So any binary data can be
    included. Easily, Using exactly the same system.

    I'm not getting it. Why do I want a quine in connection to a graphical program? I want a way to include everything in the distribution, but
    we've had that for ages. Why is having a program that outputs something
    you already have (by defintion!) of any use?



    My C compiler embeds the the standard headers it uses within the
    executable. That makes for a tidy, run-anywhere application as it is a
    single file.

    Most users will not need to see or use the discrete headers. But if
    somebody does, there is an option to extract them:

    mcc -writeheaders

    I suppose this could have been widened to include its own source, but
    that would be less useful.

    In either case, I don't think 'quine' is a good term for it. Nor for
    what it sounds like Malcolm has achieved.

    AFAICS, pure quines are not intended to have any practical use at all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Malcolm McLean on Tue Jun 4 21:04:30 2024
    On 04/06/2024 19:41, Malcolm McLean wrote:
    On 04/06/2024 14:33, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 14:47, Ben Bacarisse wrote:
    Michael S <already5chosen@yahoo.com> writes:

    On Sun, 2 Jun 2024 12:54:17 +0100
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

    Writing a prgram which writes its own source to standard output is a >>>>>> standard programming problem. It's called a quine.

    Is it named after Willard Van Orman Quine?
    In honour of rather than after since "after" is usually used for
    discoverers.  It was Douglas Hofstadter who coined the term.


    /* source for a quine */

    There seems to be loads missing.  How big it the program when it's all
    there or, since it's a quine, what is the size of text it outputs?

    Yes. Tht's the heart of it.

    I'll start a quine project. But I need to get the babyxfs_shell to a
    rather more developed state first to really give bbx_filesystem a good
    test and stabilise it.

    The power of BabyXFS quines is that you can just package an arbitrary
    program as a quine. Because babyxfs_dirtoxml will simply package up any source directory for passing to bbx_filesystem_quine.

    So the idea is that when you have BabyXFS incorporated, it is trivially
    easy to make your program into a quine, and, for open source, that is
    exactly what you need.


    Sorry, but I just can't see the point. Seems like you're going tp bloat
    your app just to add the quine thing.

    If you want to distribute source, then there's tar, there's git clone, etc.

    --
    This email has been checked for viruses by AVG antivirus software.
    www.avg.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to bart on Wed Jun 5 11:13:24 2024
    On 2024-06-04 19:57:31 +0000, bart said:

    On 04/06/2024 14:40, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 13:11, Ben Bacarisse wrote:

    But from a practical point of view, yes my quine is massively
    powerful. Most graphical programs do have images as source. And they just >>> get zipped up into the FileSystem XML file. So any binary data can be
    included. Easily, Using exactly the same system.

    I'm not getting it. Why do I want a quine in connection to a graphical
    program? I want a way to include everything in the distribution, but
    we've had that for ages. Why is having a program that outputs something
    you already have (by defintion!) of any use?



    My C compiler embeds the the standard headers it uses within the
    executable. That makes for a tidy, run-anywhere application as it is a
    single file.

    There are not run-anywhere applications. Each computer only runs
    applications that are written in a language that it understands.
    Many computers only understand one language and no language is
    understood by every computer.

    --
    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Mikko on Wed Jun 5 09:23:21 2024
    On 05/06/2024 09:13, Mikko wrote:
    On 2024-06-04 19:57:31 +0000, bart said:

    On 04/06/2024 14:40, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 13:11, Ben Bacarisse wrote:

    But from a practical point of view, yes my quine is  massively
    powerful. Most graphical programs do have images as source. And they
    just
    get zipped up into the FileSystem XML file. So any binary data can be
    included. Easily, Using exactly the same system.

    I'm not getting it.  Why do I want a quine in connection to a graphical >>> program?  I want a way to include everything in the distribution, but
    we've had that for ages.  Why is having a program that outputs something >>> you already have (by defintion!) of any use?



    My C compiler embeds the the standard headers it uses within the
    executable. That makes for a tidy, run-anywhere application as it is a
    single file.

    There are not run-anywhere applications. Each computer only runs
    applications that are written in a language that it understands.
    Many computers only understand one language and no language is
    understood by every computer.


    I mean run anywhere within a computer's file system: any folder, any
    drive, any memory stick.

    For a run-anywhere cross-platform version of my C compiler, I can supply
    a single .c file instead of .exe file.

    Then it'll need a local build process in order to produce a suitable
    binary. (But since it still targets Win64 ABI, that is not so useful for
    that application.)

    Alternately I can supply a IL (intermediate language) version, which can
    be cross-platform with an interpreter. Then you will need a suitable interpreter, so it's back to square one, however the interpreter is a
    1/4 the size of the compiler, and it will also run multiple different applications once ported.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to Keith Thompson on Wed Jun 5 11:19:36 2024
    On 2024-06-04 00:35:25 +0000, Keith Thompson said:

    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    bart <bc@freeuk.com> writes:
    [...]
    I assume you can use __FILE__ with #embed? (I can do that with my
    version of it).

    Yes, but not reliably.

    __FILE__ expands to "The presumed name of the current source file (a
    character string literal)". That's rather vague.

    With gcc and clang, it expands to the file name argument given to the
    compiler, or to the argument of the #include directive. The running
    program may or may not be able to access the source file using that
    name. The source file might not even exist when the program runs.

    I was thinking of using __FILE__ to access the source file at run time. #embed is of course handled at compile time. It's very likely, but
    still not quite guaranteed, that `#embed __FILE__` will be able to
    access the source file.

    An operating system might refuse to open an already opened file.
    There is no good reason to refuse when all accesses are for read-only
    but a supid operating system might think otherwise.

    --
    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Mikko on Wed Jun 5 08:29:56 2024
    On Wed, 5 Jun 2024 11:19:36 +0300, Mikko wrote:

    An operating system might refuse to open an already opened file.

    Only one in common use might do that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Keith Thompson on Wed Jun 5 18:23:20 2024
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    Mikko <mikko.levanto@iki.fi> writes:
    On 2024-06-04 00:35:25 +0000, Keith Thompson said:
    [...]
    #embed is of course handled at compile time. It's very likely, but
    still not quite guaranteed, that `#embed __FILE__` will be able to
    access the source file.

    An operating system might refuse to open an already opened file.
    There is no good reason to refuse when all accesses are for read-only
    but a supid operating system might think otherwise.

    That seems unlikely, and would be a concern only if some real-world OS >actually behaved that way.

    IIRC windows has some restrictions on when a file can be opened vis
    a vis other processes also having it open.

    But I don't do windows and my recollection could be faulty.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Wed Jun 5 21:27:19 2024
    On 05/06/2024 20:26, Keith Thompson wrote:
    scott@slp53.sl.home (Scott Lurndal) writes:
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    Mikko <mikko.levanto@iki.fi> writes:
    On 2024-06-04 00:35:25 +0000, Keith Thompson said:
    [...]
    #embed is of course handled at compile time. It's very likely, but
    still not quite guaranteed, that `#embed __FILE__` will be able to
    access the source file.

    An operating system might refuse to open an already opened file.
    There is no good reason to refuse when all accesses are for read-only
    but a supid operating system might think otherwise.

    That seems unlikely, and would be a concern only if some real-world OS
    actually behaved that way.

    IIRC windows has some restrictions on when a file can be opened vis
    a vis other processes also having it open.

    But I don't do windows and my recollection could be faulty.

    My understanding is that there can be one writer or multiple readers.

    Yes. It's more restrictive than on *nix systems (also on directory
    deletion or renaming), but it's not unreasonable.

    That wouldn't affect `#embed __FILE__`. Allowing only one reader would
    break a *lot* of functionality.


    The only realistic issues I could imagine with "#embed __FILE__" is the possibility of directory handling (i.e., if you compiled it as "cc
    xxx/yyy.c", would __FILE__ expand to "yyy.c" or "xxx/yyy.c", and would
    the correct file then be found?) or if your source was from a pipe or
    shell redirection. "cat xxx.c > gcc -x c -", for example.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Thu Jun 6 18:00:29 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 04/06/2024 14:33, Ben Bacarisse wrote:
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    On 03/06/2024 14:47, Ben Bacarisse wrote:
    Michael S <already5chosen@yahoo.com> writes:

    On Sun, 2 Jun 2024 12:54:17 +0100
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:

    Writing a prgram which writes its own source to standard output is a >>>>>> standard programming problem. It's called a quine.

    Is it named after Willard Van Orman Quine?
    In honour of rather than after since "after" is usually used for
    discoverers. It was Douglas Hofstadter who coined the term.


    /* source for a quine */
    There seems to be loads missing. How big it the program when it's all
    there or, since it's a quine, what is the size of text it outputs?

    Yes. Tht's the heart of it.

    I'll start a quine project.

    I am just more confused now. Presumably that does not matter since I
    don't think you need me to know what's going on. And I am pretty sure
    that whatever purpose your quine serves, it is intended to benefit users
    who are not at all like me.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Malcolm McLean on Fri Jun 7 20:04:14 2024
    Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

    I don't know what you are interested in, but a pure ANSI C shell would be right up your street, I would have thought.

    I wonder how you got that impression! I am happy with the wide range of
    shells available to me (I've gone back to bash from zsh), and a pure C
    shell is bound to be rather limited so not much fun either to use or to
    write. And ANSI C (if you mean C90) has been out of date for decades.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)