473,624 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c++ web scripting

Has anyone ever heard of a c++ web 'scripting' engine? I think it
would be fairly easy to make one. All that is needed is an
intermediary that compiles the code on demand and caches the executables.

For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles
the code on the fly and serves the output over http. It would work
just like CGI, except the compilation is automatic.
Jul 22 '05 #1
19 1755

"Shailesh Humbad" <no*****@nowher e.com> wrote in message
news:RO******** *******@fe2.col umbus.rr.com...
Has anyone ever heard of a c++ web 'scripting' engine? I think it would
be fairly easy to make one. All that is needed is an intermediary that
compiles the code on demand and caches the executables.

For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles the
code on the fly and serves the output over http. It would work just like
CGI, except the compilation is automatic.


It would be easy to setup a web server to do that. Your 'scripting engine'
is just the compiler followed by running the program.

john
Jul 22 '05 #2
Shailesh Humbad wrote:
Has anyone ever heard of a c++ web 'scripting' engine?
cgicc. It works great.
I think it
would be fairly easy to make one. All that is needed is an
intermediary that compiles the code on demand and caches the executables.


Wha? What's wrong with just configuring your CGI to call your .EXE or
binary? I done all this, last millenium.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces

Jul 22 '05 #3
Shailesh Humbad wrote:
Has anyone ever heard of a c++ web 'scripting' engine? I think it would
be fairly easy to make one. All that is needed is an intermediary that
compiles the code on demand and caches the executables.

For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles the
for CGI, it won't work this way for your above code.
code on the fly and serves the output over http. It would work just
like CGI, except the compilation is automatic.


C++ cgi code can already work with C/C++ interpreter Ch.
Jul 22 '05 #4
On Sat, 11 Sep 2004 07:34:40 +0000, Phlip wrote:
Shailesh Humbad wrote:
Has anyone ever heard of a c++ web 'scripting' engine?


cgicc. It works great.


Seconded. cgicc works way better if you want it to output compliant HTML
than if you want "normal" (nonstandard, table-driven, or otherwise
silly) HTML, though. IMO this is a feature, though from the mailing list I
seem to be in the minority.

--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.

Jul 22 '05 #5
Shailesh Humbad wrote:
Has anyone ever heard of a c++ web 'scripting' engine? I think it
would be fairly easy to make one. All that is needed is an
intermediary that compiles the code on demand and caches the executables.

For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles
the code on the fly and serves the output over http. It would work
just like CGI, except the compilation is automatic.


Hi,

I have written a webapplications erver in c++, which supports c++. I defined
a template-language like PHP, JSP or Mason for c++, so you can embed
c++-code in HTML-pages. It much faster than cgi, because there is no need
to start a process for each request. Even dynamic pages with this system
are faster than static pages in apache.

Here is a example of a dynamic web-page:

<%args>
some_text // define query-parameter here
</%args>
<html>
<body>
<# this is a comment, which is precompiled away #>
<{
// do some c++-coding here:
for (unsigned i = 0; i < 10; ++i)
{
// output the value of the query-param "some_text" 10 times:
}>
<p> <$ i $> : <$ some_text $> </p>
<{
} // end of for-loop
}>
</body>
</html>
__END__

The tags <$ ... $> outputs a c++-expression. Everything here is written to a
std::ostream, so you can output every object which has a
"operator<<(std ::ostream&)" defined.

There are many more features like embedding other c++-components or special
tags for initialization or support for i18n.

I would like to release it under the GPL, but it lacks documentation yet.
What I have is a short introduction as a word-document written in german.
If someone is interested in helping, let me know.

It would be also nice to hear comments.
Tommi Mäkitalo
Jul 22 '05 #6
Tommi Mäkitalo wrote:
Shailesh Humbad wrote:

Has anyone ever heard of a c++ web 'scripting' engine? I think it
would be fairly easy to make one. All that is needed is an
intermediar y that compiles the code on demand and caches the executables.

For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles
the code on the fly and serves the output over http. It would work
just like CGI, except the compilation is automatic.

Hi,

I have written a webapplications erver in c++, which supports c++. I defined
a template-language like PHP, JSP or Mason for c++, so you can embed
c++-code in HTML-pages. It much faster than cgi, because there is no need
to start a process for each request. Even dynamic pages with this system
are faster than static pages in apache.

Here is a example of a dynamic web-page:

<%args>
some_text // define query-parameter here
</%args>
<html>
<body>
<# this is a comment, which is precompiled away #>
<{
// do some c++-coding here:
for (unsigned i = 0; i < 10; ++i)
{
// output the value of the query-param "some_text" 10 times:
}>
<p> <$ i $> : <$ some_text $> </p>
<{
} // end of for-loop
}>
</body>
</html>
__END__

The tags <$ ... $> outputs a c++-expression. Everything here is written to a
std::ostream, so you can output every object which has a
"operator<<(std ::ostream&)" defined.

There are many more features like embedding other c++-components or special
tags for initialization or support for i18n.

I would like to release it under the GPL, but it lacks documentation yet.
What I have is a short introduction as a word-document written in german.
If someone is interested in helping, let me know.

It would be also nice to hear comments.
Tommi Mäkitalo


Hi Tommi,

This is exactly what I was looking for. I'm so surprised nothing like
this already exists. If you think about it, .Net's "new and improved"
approach toward web applications is to compile the code on request,
and keep the compiled object code in a cache. However, .Net does not
compile to native code, but to an intermediate language, which adds
overhead. We were so busy with ASP, PHP, and other scripting
languages, that we only now realized we can use C++ directly and just
have the server compile it on the fly.

I understand that CGI is slow because of the need to create new
processes. I'd be interested to understand your implementation and
try it out.

My initial comment is that you have three different kinds of
delimeters, <{, <#, and <$. ASP uses <% while PHP uses <?. I think
the easiest to type is the last one, <?, because it only involves the
left-shift key with the left hand, and the lower, easily-reachable "?"
key with the right hand. Also, I'm not sure there is a need for
multiple kinds of delimeters. In ASP, when you want to print out a
value, you write <% =some_var %>, and it has no equivalent shortcut
for comments. PHP has no equivalent for either comments or printing
values, although you can leave out the semicolon for single line
statements, e.g. <?php print "hello" ?>. Now by default in PHP, the
opening tag is required to be <?php. Maybe you can use something like
this for your engine, like <?tomi ?>, and use standard commenting
paradigms for comments and values, like <?tomi /* this is comments */
?> and <?tomi cout << "hello"; ?>. These are just suggestions.

Shailesh
Jul 22 '05 #7
Owen Jacobson wrote:
On Sat, 11 Sep 2004 07:34:40 +0000, Phlip wrote:

Shailesh Humbad wrote:

Has anyone ever heard of a c++ web 'scripting' engine?


cgicc. It works great.

Seconded. cgicc works way better if you want it to output compliant HTML
than if you want "normal" (nonstandard, table-driven, or otherwise
silly) HTML, though. IMO this is a feature, though from the mailing list I
seem to be in the minority.

(I posted this a few days ago, but it went to alt.html by accident.)

I tried cgicc prior to posting. The difference is the application
development cycle. I assume there are three steps with cgicc: edit
the code, run the compiler, and then reload the browser. When I say
scripting engine, I mean that there are only two steps: edit the code,
and reload the browser.

I see ch is an interpreter for a superset of C (with classes from
C++), but not full C++. Not only that, but I don't want
interpretation, I want cached, natively-compiled executables.

Like another poster said, it would be fairly easy to implement such a
thing. I'm just surprised it hasn't yet. Why use .Net for your web
projects when you can use C++, and skip the extra layer of complexity?

Jul 22 '05 #8
Shailesh Humbad wrote:
I tried cgicc prior to posting. The difference is the application
development cycle. I assume there are three steps with cgicc: edit
the code, run the compiler, and then reload the browser. When I say
scripting engine, I mean that there are only two steps: edit the code,
and reload the browser.

I see ch is an interpreter for a superset of C (with classes from
C++), but not full C++. Not only that, but I don't want
interpretation, I want cached, natively-compiled executables.

Like another poster said, it would be fairly easy to implement such a
thing. I'm just surprised it hasn't yet. Why use .Net for your web
projects when you can use C++, and skip the extra layer of complexity?
Why should C++ recompile between two page hits?

You need to think about routing data strictly thru XML and XSLT in XHTML
output mode. Then, regardless of the language substrate, you have templates
in a widely supported template language. Not a system that lets you couple
HTML to C++ in elaborate ways.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces


Jul 22 '05 #9
"Shailesh Humbad" <no*****@nowher e.com> wrote in message
news:Qm******** **********@fe1. columbus.rr.com ...
Tommi Mäkitalo wrote:
Shailesh Humbad wrote:

Has anyone ever heard of a c++ web 'scripting' engine? I think it
would be fairly easy to make one. All that is needed is an
intermediar y that compiles the code on demand and caches the executables.
For example, I put a file like hello.cpp:

#include <iostream>
int main(void) {
cout << "<h1>hello world</h1>";
}

in the web server directory, and when I point my browser to
http://localhost/hello.cpp, the c++ web 'scripting' engine compiles
the code on the fly and serves the output over http. It would work
just like CGI, except the compilation is automatic.

Hi,

I have written a webapplications erver in c++, which supports c++. I defined a template-language like PHP, JSP or Mason for c++, so you can embed
c++-code in HTML-pages. It much faster than cgi, because there is no need to start a process for each request. Even dynamic pages with this system
are faster than static pages in apache.

Here is a example of a dynamic web-page:

<%args>
some_text // define query-parameter here
</%args>
<html>
<body>
<# this is a comment, which is precompiled away #>
<{
// do some c++-coding here:
for (unsigned i = 0; i < 10; ++i)
{
// output the value of the query-param "some_text" 10 times:
}>
<p> <$ i $> : <$ some_text $> </p>
<{
} // end of for-loop
}>
</body>
</html>
__END__

The tags <$ ... $> outputs a c++-expression. Everything here is written to a std::ostream, so you can output every object which has a
"operator<<(std ::ostream&)" defined.

There are many more features like embedding other c++-components or special tags for initialization or support for i18n.

I would like to release it under the GPL, but it lacks documentation yet. What I have is a short introduction as a word-document written in german. If someone is interested in helping, let me know.

It would be also nice to hear comments.
Tommi Mäkitalo


Hi Tommi,

This is exactly what I was looking for. I'm so surprised nothing like
this already exists. If you think about it, .Net's "new and improved"
approach toward web applications is to compile the code on request,
and keep the compiled object code in a cache. However, .Net does not
compile to native code, but to an intermediate language, which adds
overhead. We were so busy with ASP, PHP, and other scripting
languages, that we only now realized we can use C++ directly and just
have the server compile it on the fly.

<snip>

Doesn't .Net provide one or two good ways to use C++ code inside a .Net
application? If not P/Invoke, then at least using "unsafe"? Then, if you
go with .Net, you could choose between higher-level languages and C++
depending on your needs.

--
David Hilsee
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3782
by: The_Incubator | last post by:
As the subject suggests, I am interested in using Python as a scripting language for a game that is primarily implemented in C++, and I am also interested in using generators in those scripts... Initially I was justing looking at using Python for some event scripting. So basically an event would trigger an object to run the appropriate Python script, which would be run in it's entirety and return control to the C++ code. After looking...
41
2781
by: Richard James | last post by:
Are we looking at the scripting world through Python colored glasses? Has Python development been sleeping while the world of scripting languages has passed us Pythonista's by? On Saturday Slashdot ran this article on the "best" scripting languages. http://developers.slashdot.org/developers/04/06/12/2125229.shtml?tid=126&tid=156 "Folks at the Scriptometer conducted a practical survey of which scripting language is the best. While...
33
2713
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting language was available. However, I want to code this application in Python, and I have not yet heard of an implementation of another scripting language into Python. An example of what I mean is this (an implementation of Lua into Ruby -- which I'd...
9
9981
by: What-a-Tool | last post by:
Dim MyMsg Set MyMsg = server.createObject("Scripting.Dictionary") MyMsg.Add "KeyVal1", "My Message1" MyMsg.Add "KeyVal2", "My Message2" MyMsg.Add "KeyVal3", "My Message3" for i = 1 To MyMsg.Count Response.Write(MyMsg.Item(i)) next
0
1571
by: fiona | last post by:
Catalyst Releases Scripting Editions of SocketTools Client and server-side development for Active Server Pages and PHP. Yucca Valley, CA, May 25, 2005 - Catalyst Development Corp (www.catalyst.com) - with over 10 years experience developing Internet components announced that Scripting and Secure Scripting Editions have been added to the SocketTools family of products. The Scripting Editions were designed specifically for client and...
8
2571
by: rmacias | last post by:
I am maintaining an application that was writting in VB6 and has VBA 6.2 integrated into it. The VBA SDK allows the users of the application to generate VBA projects and scripts to gain access to the application and perform product specific functions. This provides maximum flexiability for our users. We are about to convert this application into .NET. In doing some proof of concepts, we were able to integrate VBA 6.4 into a .NET...
6
3573
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database interface. Applications that I know of (that they exist) are: MS Excel Quattro
1
5623
by: andrewcw | last post by:
I have used System.Management in the past to extract and walk thru drives & check their type. I can also do it with COM's FileSystemObject. Here I am trying to just use the Management Object after using the Directory class... There seems to be a way to load the System Management Object with string path ( 8 overloads ), but every time I try a variation it crashes. Any ideas ? Thanks Scripting.FileSystemObject FSO = new
2
2034
by: James | last post by:
Are there any classes in c# for this or am I left to use the com interface, which I'm not sure how. And if I have this will it work on a machine that someone has disabled scripting? Finally, if I have MyClass objectA can I give it functions like MakeBigger that would be available from the script? I'm new to this so thanks for any info!!
7
8829
ADezii
by: ADezii | last post by:
The next series of Tips will involve the Microsoft Scripting Runtime Library (Scrrun.dll). This Library is, in my humble opinion, one of the most useful and practical Libraries ever created. With the Scripting Runtime Library, you can retrieve information related to Drives, Folders, Files, and Text Files and set/retrieve certain Attributes of Drives, Folders, Files, and Text Files. Through Methods exposed by this Library, you can also manipulate...
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.