Posts
Search
Contact
Cookies
About
RSS

C-Script, C scripting on the web

Added 2 Oct 2022, 12:38 p.m. edited 18 Jun 2023, 1:12 a.m.
C-Script

I've previously experimented with creating a module for Apache, this time I've added scripting support to it, as the module encounters C source files, it compiles them on the fly and executes them (server side). With a small API for these scripts you can create content using a Document Object Model.

Before going further here's a quick video showing some example scripts...

https://www.youtube.com/watch?v=t1cNOCE-Lc8

As you can see there is rudimentary support for a number of useful web activities, as this project is in very early days there is loads to add but it's always good to get things out early, some interested party might just provide some interesting insight or improvement (you never know!)

You can take a look at the project here I've only really used the database stuff with sqlite as there appears to be a bug with the mysql DB driver for Apache, but like I say early days... (Update: tested with pgsql (postgresql) works!)

I decided to use a DOM for content creation as I've found it to be a convenient, and you can't start one tag inside a tag and accidentally close it outside its parent tag. While you are limited to a single source file, you can always include other source and still separate your code into logical units.

It should be noted that although I'm calling this scripting, technically the source is compiled on the fly each time the "script" is executed. However it is akin to scripting in that you can modify the source and immediately refresh the page to see the result of your changes, without need of running make or even restarting your whole web server.

I hope you check out the source and have a play with it yourself, as it is an interesting experience writing C code and seeing it come to life inside a webserver...

Enjoy!