Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. A tale in 3 pictures.

A tale in 3 pictures.

Scheduled Pinned Locked Moved Uncategorized
programming
103 Posts 56 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • schaf@netzkms.deS schaf@netzkms.de

    @citizen428 old and busted: php as a c preprocessor¹

    hot and new: c preprocessor as a php

    ¹ https://stackoverflow.com/questions/396644/replacements-for-the-c-preprocessor/16256052#16256052

    Edit: Originalquelle verlinkt

    citizen428@chaos.socialC This user is from outside of this forum
    citizen428@chaos.socialC This user is from outside of this forum
    citizen428@chaos.social
    wrote last edited by
    #67

    @schaf That's exactly what the lolsob emoji is for.

    1 Reply Last reply
    0
    • joe@f.duriansoftware.comJ joe@f.duriansoftware.com

      @jrose @citizen428 to their credit, they did say it was a bad idea

      citizen428@chaos.socialC This user is from outside of this forum
      citizen428@chaos.socialC This user is from outside of this forum
      citizen428@chaos.social
      wrote last edited by
      #68

      @joe @jrose I thought it was rather obvious that this is not a serious suggestion, then I added the cartoon just in case.

      jrose@social.belkadan.comJ 1 Reply Last reply
      0
      • citizen428@chaos.socialC citizen428@chaos.social

        @joe @jrose I thought it was rather obvious that this is not a serious suggestion, then I added the cartoon just in case.

        jrose@social.belkadan.comJ This user is from outside of this forum
        jrose@social.belkadan.comJ This user is from outside of this forum
        jrose@social.belkadan.com
        wrote last edited by
        #69

        @citizen428 @joe Yeah, sorry, I didn’t mean it as a mark against you either! It just rang a bell, having run into people attempting to do even a less silly thing.

        1 Reply Last reply
        0
        • ics@tau-ceti.spaceI ics@tau-ceti.space

          @citizen428 @eniko Impressive! 😳😍

          citizen428@chaos.socialC This user is from outside of this forum
          citizen428@chaos.socialC This user is from outside of this forum
          citizen428@chaos.social
          wrote last edited by
          #70

          @ics @eniko

          Not the first word I’d use 😂

          ics@tau-ceti.spaceI 1 Reply Last reply
          0
          • citizen428@chaos.socialC citizen428@chaos.social

            @ics @eniko

            Not the first word I’d use 😂

            ics@tau-ceti.spaceI This user is from outside of this forum
            ics@tau-ceti.spaceI This user is from outside of this forum
            ics@tau-ceti.space
            wrote last edited by
            #71

            @citizen428 @eniko The first words were "WTF????" - that's why the first emoji 😂😂

            1 Reply Last reply
            0
            • citizen428@chaos.socialC citizen428@chaos.social

              @necrophcodr Funny you'd say that, because this (`clang -I. -P -E`) but in another context is how this little side quest started.

              necrophcodr@layer8.spaceN This user is from outside of this forum
              necrophcodr@layer8.spaceN This user is from outside of this forum
              necrophcodr@layer8.space
              wrote last edited by
              #72

              @citizen428 I mean it has simple uses too, like adding simple include statements in any file, or, as you've shown, macros.

              I've used it to make a lockfile for my Containerfile, and I'd just build using cpp -E <file> | docker build -f- <...>

              1 Reply Last reply
              0
              • citizen428@chaos.socialC citizen428@chaos.social

                The horrors:

                Link Preview Image
                C preprocessor abuse

                C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.

                favicon

                Gist (gist.github.com)

                ryanc@infosec.exchangeR This user is from outside of this forum
                ryanc@infosec.exchangeR This user is from outside of this forum
                ryanc@infosec.exchange
                wrote last edited by
                #73

                @citizen428 I highly recommend combining this with a MAP macro.

                citizen428@chaos.socialC 1 Reply Last reply
                0
                • ryanc@infosec.exchangeR ryanc@infosec.exchange

                  @citizen428 I highly recommend combining this with a MAP macro.

                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.social
                  wrote last edited by
                  #74

                  @ryanc Please don’t give me ideas 😂

                  ryanc@infosec.exchangeR 1 Reply Last reply
                  0
                  • citizen428@chaos.socialC citizen428@chaos.social

                    The horrors:

                    Link Preview Image
                    C preprocessor abuse

                    C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.

                    favicon

                    Gist (gist.github.com)

                    siguza@infosec.spaceS This user is from outside of this forum
                    siguza@infosec.spaceS This user is from outside of this forum
                    siguza@infosec.space
                    wrote last edited by
                    #75

                    @citizen428 omg, you even serve it right from C code?! God, I want to unsee this...

                    citizen428@chaos.socialC 1 Reply Last reply
                    0
                    • citizen428@chaos.socialC citizen428@chaos.social

                      A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

                      #c #programming

                      fx@chaos.socialF This user is from outside of this forum
                      fx@chaos.socialF This user is from outside of this forum
                      fx@chaos.social
                      wrote last edited by
                      #76

                      @citizen428 finally, webdev in C

                      citizen428@chaos.socialC 1 Reply Last reply
                      0
                      • citizen428@chaos.socialC citizen428@chaos.social

                        @ryanc Please don’t give me ideas 😂

                        ryanc@infosec.exchangeR This user is from outside of this forum
                        ryanc@infosec.exchangeR This user is from outside of this forum
                        ryanc@infosec.exchange
                        wrote last edited by
                        #77

                        @citizen428 Fine. I will not inflict further ideas upon you, but why do you hate fun?

                        citizen428@chaos.socialC 1 Reply Last reply
                        0
                        • citizen428@chaos.socialC citizen428@chaos.social

                          A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

                          #c #programming

                          endlessmason@hachyderm.ioE This user is from outside of this forum
                          endlessmason@hachyderm.ioE This user is from outside of this forum
                          endlessmason@hachyderm.io
                          wrote last edited by
                          #78

                          @citizen428
                          Finally somebody's optimised CGI.pm's html functions

                          Link Preview Image
                          CGI::HTML::Functions

                          Documentation for CGI.pm Legacy HTML Functionality

                          favicon

                          MetaCPAN (metacpan.org)

                          1 Reply Last reply
                          0
                          • citizen428@chaos.socialC citizen428@chaos.social

                            A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

                            #c #programming

                            hirunatan@xarxa.cloudH This user is from outside of this forum
                            hirunatan@xarxa.cloudH This user is from outside of this forum
                            hirunatan@xarxa.cloud
                            wrote last edited by
                            #79

                            @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

                            It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

                            Link Preview Image
                            GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

                            Penpot: The open-source design tool for design and code collaboration - penpot/penpot

                            favicon

                            GitHub (github.com)

                            So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... 😅

                            hirunatan@xarxa.cloudH citizen428@chaos.socialC 2 Replies Last reply
                            0
                            • hirunatan@xarxa.cloudH hirunatan@xarxa.cloud

                              @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

                              It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

                              Link Preview Image
                              GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

                              Penpot: The open-source design tool for design and code collaboration - penpot/penpot

                              favicon

                              GitHub (github.com)

                              So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... 😅

                              hirunatan@xarxa.cloudH This user is from outside of this forum
                              hirunatan@xarxa.cloudH This user is from outside of this forum
                              hirunatan@xarxa.cloud
                              wrote last edited by
                              #80

                              @citizen428 this is a real example of the code in the app:

                              [:div {:class (stl/css :modal-overlay)}
                              [:div {:class (stl/css :modal-dialog)
                              :data-testid "token-theme-update-create-modal"}
                              [:> icon-button* {:class (stl/css :close-btn)
                              :on-click modal/hide!
                              :aria-label (tr "labels.close")
                              :variant "action"
                              :icon i/close}]
                              [:> themes-modal-body*]]]

                              1 Reply Last reply
                              0
                              • citizen428@chaos.socialC citizen428@chaos.social

                                The horrors:

                                Link Preview Image
                                C preprocessor abuse

                                C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.

                                favicon

                                Gist (gist.github.com)

                                dragonfi@social.jsteuernagel.deD This user is from outside of this forum
                                dragonfi@social.jsteuernagel.deD This user is from outside of this forum
                                dragonfi@social.jsteuernagel.de
                                wrote last edited by
                                #81

                                @citizen428 Thanks for sharing the code.

                                In a weird way, this is exactly what the C preprocessor is designed to do.

                                I still don't want to debug a bigger website though.

                                citizen428@chaos.socialC 1 Reply Last reply
                                0
                                • dragonfi@social.jsteuernagel.deD dragonfi@social.jsteuernagel.de

                                  @citizen428 Thanks for sharing the code.

                                  In a weird way, this is exactly what the C preprocessor is designed to do.

                                  I still don't want to debug a bigger website though.

                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.social
                                  wrote last edited by
                                  #82

                                  @dragonfi@jsteuernagel.de $DEITY no, I'd never want to actually work with this outside of a little late-night hack session.

                                  1 Reply Last reply
                                  0
                                  • ryanc@infosec.exchangeR ryanc@infosec.exchange

                                    @citizen428 Fine. I will not inflict further ideas upon you, but why do you hate fun?

                                    citizen428@chaos.socialC This user is from outside of this forum
                                    citizen428@chaos.socialC This user is from outside of this forum
                                    citizen428@chaos.social
                                    wrote last edited by
                                    #83

                                    @ryanc I'm just trying to avoid getting nerd sniped into spending any more time on this. I have a much bigger preprocessor abuse planned 😄

                                    1 Reply Last reply
                                    0
                                    • citizen428@chaos.socialC citizen428@chaos.social

                                      @wonka @Lemmus I did (do?) have a soft spot for Perl 🙂

                                      stefanct@chaos.socialS This user is from outside of this forum
                                      stefanct@chaos.socialS This user is from outside of this forum
                                      stefanct@chaos.social
                                      wrote last edited by
                                      #84

                                      @citizen428 @wonka @Lemmus that's exactly the place where it stabs you with a rusty spoon.

                                      1 Reply Last reply
                                      0
                                      • siguza@infosec.spaceS siguza@infosec.space

                                        @citizen428 omg, you even serve it right from C code?! God, I want to unsee this...

                                        citizen428@chaos.socialC This user is from outside of this forum
                                        citizen428@chaos.socialC This user is from outside of this forum
                                        citizen428@chaos.social
                                        wrote last edited by
                                        #85

                                        @siguza Maximum cursed is what I was going for, so yes. If you prefer CGI and another web server you could use kcgi:

                                        Link Preview Image
                                        kcgi: minimal CGI and FastCGI library for C/C++

                                        A C/C++ library for security-oriented web applications.

                                        favicon

                                        (kristaps.bsd.lv)

                                        1 Reply Last reply
                                        0
                                        • hirunatan@xarxa.cloudH hirunatan@xarxa.cloud

                                          @citizen428 this is funny, because this idea is real (more or less). The https://penpot.app is made this way!

                                          It's written in Clojure language, that also has a feature of creating macros (although with better syntax checks). We use the `rumext` framework, that defines macros that are expanded in compile time into HTML, react style.

                                          Link Preview Image
                                          GitHub - penpot/penpot: Penpot: The open-source design tool for design and code collaboration

                                          Penpot: The open-source design tool for design and code collaboration - penpot/penpot

                                          favicon

                                          GitHub (github.com)

                                          So here is your idea working in a hugely complex application, with the (little) issue that it's in a language with good macros... 😅

                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.social
                                          wrote last edited by
                                          #86

                                          @hirunatan Yeah, there are plenty of versions of this in all kinds of languages. But most of them have actual syntactic macros working on an AST, not just simple text replacement.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups