PB Interpreter » Use PB instead of PHP or Perl for websites!

Developed or developing a new product in PureBasic? Tell the world about it.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Update!!
Now version 1.5 provides MULTILINE SYNTAX and some minor enhancements.

To activate the parsing mode, please set the -p or --param parameter. Parsing takes much time, so only activate it, if neccessary.

There are 3 parsing modes:
  1. Multiline with (CR)LF replacement. Each (CR)LF in the code will be replaced with +#CRLF$+. You can either enforce CRLFs, LFs or let the interpreter choose automatically. Depending on the OS (Linux or Windows) it will select CRLF or LF.
    Possible starting token: <<multi, <<multiline, <<here, <<crlf (enforces newlines to be CRLFs), <<lf (enforces LFs only
  2. Multiline without newline replacement: Simply sticks multiple lines together. Hint: Append a trailing space, if you want to normal text over multiple lines.
    Possible starting token: <<
  3. Insert an external file at the current position and handle it like mode 1, i. e. with CRLF-replacement.
    Possible staring token: <<include, <<file
Syntax:
Multiline code is started end ended with the token << (like the PB bit shift operator). It is inserted at where the starting token is located. Note that the first newline (directly after <<) and the last newline (directly before <<) do not count! If you need prepending/trailing newlines, you must hardcode them yourself.



Example mode 1:

Code: Select all

OpenConsole()
Print("<<multiline
<html>
<head>
	<title>My Website</title>
</head>
<body>
	This is HTML code
</body>
</html>
<<")
Note that you can put code after the ending token!! This code is being included when transforming multiline code to a single line of code.
Result wrote:OpenConsole()
Print("<html>"+#LF$+"<head>"+#LF$+" <title>My Website</title>"+#LF$+"</head>"+#LF$+"<body>"+#LF$+" This is HTML code"+#LF$+"</body>"+#LF$+"</html>")

Example mode 2:

Code: Select all

name$="Homer"
OpenConsole()
Print("<<
To do: 
feed pets,
 housework, 
meet "+name$+".
<<") : Debug "This should be on the same line"
Note: Don't forget to append a space (" ") after each line (feed pets) or before the next line (housework), if you want normal, readable text.
Result wrote:name$="Homer"
OpenConsole()
Print("To do: feed pets, housework, meet "+name$".") : Debug "This should be on the same line"
Note that you can interrupt multi line code and you can insert any variables or expressions - just like you can do with single line code. This also applies to mode 1.


Example mode 3:
File hello.txt

Code: Select all

Hello from an external file! My address is:

File address.dat

Code: Select all

Homer Simpson
Evergreen Terrace 13
Springfield
Sytnax:

Code: Select all

OpenConsole()
Print("<<file
/hello.txt
/gaga.tmp
/address.dat
<<")
Note that files that can't be read or that don't exist, are skipped.
Result wrote:OpenConsole()
Print("Hello from an external file! My address is:

Homer Simpson
Evergreen Terrace 13
Springfield
PB 4.30

Code: Select all

onErrorGoto(?Fred)
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

I can't seem to extract the zip files for Vs 1.5
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

I used 7-Zip with LZMA compression. With 7-Zip I can open the zip file without any problems.
I created a new package with Deflate compression, try this. Link is the same as usual.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

I can unzip it now.

I even got it to run once with the free Windows based Abyss server software available here. http://www.aprelium.com/abyssws/

After that it hasn't run again.

I've run Abyss for several years quite successfully. Never tried using PB in any way with it though. Really would be nice to have PB programs working with it.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Don't forget that the PB Interpreter was invented & developed on Linux with Apache!
I got no experience with other OS's or other Webservers!
But it doesn't use any API, so you can adjust it for Windows easily. You just have to go along the code lines and change it where neccessary, e. g. change all frontslahes / by backslashes \ etc.
Just read this whole topic, to get more hints on what you could change.
For example, when the executable filname is being built, all frontslashes / are removed; however, on Windows you must also remove the : colon (the line with Define exe$=...).


> I've run Abyss for several years quite successfully.
CGI (Common Gateway Interface) is a worldwide standard for webservers interact with third party programs. You could even use every other language (C, C++, Delphi, ...) as long as they can read from STDIN and write to STDOUT. Actually, Perl and PHP are also external interpreters working via CGI, using the stdin/stdout-system.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: PB Interpreter » Use PB instead of PHP or Perl for websites!

Post by blueznl »

Any new develoments for this one?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
X
Enthusiast
Enthusiast
Posts: 311
Joined: Tue Apr 04, 2006 6:27 am

Re: PB Interpreter » Use PB instead of PHP or Perl for websites!

Post by X »

Interested as well, looks like it died.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by DoubleDutch »

The link on the first thread comment (to the latest version) is bad. Does anyone have a valid link?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
cybergeek
User
User
Posts: 33
Joined: Sat Jul 03, 2010 11:11 am

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by cybergeek »

dead links :cry: :cry: :cry:
i really want this
PUREBASIC is AWSUM
cybergeek
User
User
Posts: 33
Joined: Sat Jul 03, 2010 11:11 am

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by cybergeek »

no good links?
PUREBASIC is AWSUM
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by AND51 »

Hello,

I've paused the developement of this project. The link you are requesting is just a Zip file containing the source code (version 1.5, see first page) plus the source compiled as linux-binary and windows-exe. Nothing more.
So if you take the source code from page one, you have exactly the same version as the dead link. I have no newer version, otherwise I would have published it here.

Sorry for the inconvenience. If I continue the work on this project, I'll let you know. :)

:idea: In the meantime, you could post links to your PureBasic-websites here to demonstrate the people, what you've made from this project.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
cybergeek
User
User
Posts: 33
Joined: Sat Jul 03, 2010 11:11 am

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by cybergeek »

ok....

now i have uploaded my PB win32 installation with the interpreter.exe


and here is a pb file: http://umar.sitefrost.com/junk/hello.pb

it doesnt work


server runs Cpanel with linux and apache
Last edited by cybergeek on Tue Aug 24, 2010 12:38 pm, edited 1 time in total.
PUREBASIC is AWSUM
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by cas »

cybergeek wrote:ok....

now i have uploaded my PB win32 installation to http://umar.sitefrost.com/pb/ with the interpreter.exe


and here is a pb file: http://umar.sitefrost.com/junk/hello.pb

it doesnt work


server runs Cpanel with linux and apache
I think that You are violating PureBasic license because now anyone can download paid version of PureBasic compiler from your site for free. Please remove that directory from public_html and put it somewhere else where it will not be accessible by browser, or at least protect it with .htaccess.
cybergeek
User
User
Posts: 33
Joined: Sat Jul 03, 2010 11:11 am

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by cybergeek »

you edit your post and remove the link of my website
PUREBASIC is AWSUM
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by srod »

That must still be illegal. Placing the PB compiler on a publicly accessible website...
I may look like a mule, but I'm not a complete ass.
Post Reply