vipsi - the friendly vip script interpreter

Example Scripts

CGI Scripts

Show Beautified Folder Listings

As you may have noticed, i export most of my hard disk to Flow control: if … then
Flow control: try … then
the
web. In order to present my stuff nicely, i wrote a Modes of Operation: CGI Scripts
Example Scripts: CGI Scripts
cgi script
to Text functions: replace
Instructions: replace
replace
Flow control: if … then
Flow control: try … then
the
default folder Online Chat: Listings
Search Site: Listing
Print Environment: Listing
Online Z80 Assembler: Listing
Show Beautified Folder Listings: Listing
Sort-of-a Shell: Listing
Factorial "!": Listing
Prime Factor Factorizing: Listing
Speedometer: Listing
VIP Script Test Suite: Listing
listing
of Flow control: if … then
Flow control: try … then
the
Apache web server. Whenever you see a folder Online Chat: Listings
Search Site: Listing
Print Environment: Listing
Online Z80 Assembler: Listing
Show Beautified Folder Listings: Listing
Sort-of-a Shell: Listing
Factorial "!": Listing
Prime Factor Factorizing: Listing
Speedometer: Listing
VIP Script Test Suite: Listing
listing
on my site, with Flow control: if … then
Flow control: try … then
the
little bat in Flow control: if … then
Flow control: try … then
the
top-left corner, it is generated by List functions: thisthis Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.

Download link

index.cgi

Test link

Flow control: if … then
Flow control: try … then
The
following Text functions: link
Instructions: link
link
leads to Flow control: if … then
Flow control: try … then
the
directory with images used by List functions: thisthis documentation which should be served to you by List functions: thisthis Numeric functions: indexindex.Modes of Operation: CGI Scripts
Example Scripts: CGI Scripts
cgi script
. Depending on Flow control: if … then
Flow control: try … then
the
location Flow control: if … thenif List functions: thisthis copy of Flow control: if … then
Flow control: try … then
the
vipsi documentation List functions: thisthis may Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
be true. B-)

/cgi-bin/index.cgi

Listing

#!/home/smile77/bin/vipsi


/*  show beautified directory contents

    url:    /               -> show DOCUMENT_ROOT/Numeric functions: indexindex.ht
            /Pub/PATH       -> show DOCUMENT_ROOT/PATH
            /PATH           -> show DOCUMENT_ROOT/PATH
            /PATH/PATTERN   -> show DOCUMENT_ROOT/PATH: only Text functions: file
Instructions: file
files
matching pattern optionally Functions with varying return types: include
Instructions: include
includes
"Text functions: info
Shell Immediate Commands: info
info
.vh" to customize page */ /* ---- send http header ---------------------------------------------------- */ Instructions: putput "content-type: Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
/html; charset=utf-8\n\n" /* ---- evaluate List functions: env
Shell Immediate Commands: env
Shell Immediate Commands: env
env
data ------------------------------------------------- http_host = eden.kio.lan root_dir = /www_root/ request_uri = /Pub/RPG/Fantasy/ */ Instructions: var
How does VScript::Value() work?: Var*&
var
http_host = List functions: env
Shell Immediate Commands: env
Shell Immediate Commands: env
env
.HTTP_HOST // "eden.kio.lan" Instructions: var
How does VScript::Value() work?: Var*&
var
root_dir = List functions: env
Shell Immediate Commands: env
Shell Immediate Commands: env
env
.DOCUMENT_ROOT // "/www_root/" root_dir = Text functions: fullpathfullpath(root_dir) # "/" // resolve potential symlinks Text functions: replace
Instructions: replace
replace
root_dir,"//","/" Instructions: var
How does VScript::Value() work?: Var*&
var
request_uri = List functions: env
Shell Immediate Commands: env
Shell Immediate Commands: env
env
.REQUEST_URI # "/" // "/Pub/RPG/Fantasy/Text functions: file
Instructions: file
file
?mask*pattern" Text functions: replace
Instructions: replace
replace
request_uri,"//","/" Instructions: var
How does VScript::Value() work?: Var*&
var
dir_part_path = request_uri[2 to] // "RPG/Fantasy/" Text functions: convert
Instructions: convert
convert
dir_part_path from url // "RPG/Fantasy/" Instructions: var
How does VScript::Value() work?: Var*&
var
dir_path = root_dir # dir_part_path // "/www_root/RPG/Fantasy/" /* ==== show root: "/" ================================================== ignore pattern, show start page Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Shell Immediate Commands: exit, quit, endquit */ Flow control: if … thenif request_uri == "/" Instructions: var
How does VScript::Value() work?: Var*&
var
d = List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
( root_dir # "*Numeric functions: indexindex.ht*" ) Flow control: if … thenif Numeric functions: countcount d && d[1].dir: flagsflags[1]=="-" Instructions: var
How does VScript::Value() work?: Var*&
var
f = Text functions: file
Instructions: file
file
( root_dir # d[1].dir: fnamefname ) Text functions: convert
Instructions: convert
convert
f from utf Instructions: putput f Flow control: end
Shell Immediate Commands: exit, quit, end
end
0 Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
then
/* ==== default customization =========================================== */ Flow control: if … thenif Numeric functions: findfind(root_dir,"smile77") // ---- LITTLE-BAT.DE ---------------- Instructions: var
How does VScript::Value() work?: Var*&
var
logo = «<img alt="little bat" style="background-color:#88CC88;" \ width=128 height=128 src="/b/bat_sw_128_frei_v2.png">» Instructions: var
How does VScript::Value() work?: Var*&
var
icon_dir_url = "/b/icon/" // where are Flow control: if … then
Flow control: try … then
the
generic Text functions: file
Instructions: file
file
icons Text functions: file
Instructions: file
files
? Instructions: var
How does VScript::Value() work?: Var*&
var
temp_dir_url = "/tmp/" // where to store the thumbnails? Flow control: if … then
Flow control: try … then
else
// ---- EDEN @ HOME ---------------- Instructions: var
How does VScript::Value() work?: Var*&
var
logo = «<img alt="little bat" style="background-color:#88CC88;" \ width=128 height=128 src="/www/b/bat_sw_128_frei_v2.png">» Instructions: var
How does VScript::Value() work?: Var*&
var
icon_dir_url = "/www/b/icon/" // where are Flow control: if … then
Flow control: try … then
the
generic Text functions: file
Instructions: file
file
icons Text functions: file
Instructions: file
files
? Instructions: var
How does VScript::Value() work?: Var*&
var
temp_dir_url = "/www/tmp/" // where to store Flow control: if … then
Flow control: try … then
the
thumbnails? Flow control: if … then
Flow control: try … then
then
Instructions: var
How does VScript::Value() work?: Var*&
var
forbidden_folders = { "/cgi-bin/", "/tmp/", "/CVS/" } // actually Numeric functions: matchmatch "*/cgi-bin/*" etc. Instructions: var
How does VScript::Value() work?: Var*&
var
zip_icon = "tgz.png" // archives Instructions: var
How does VScript::Value() work?: Var*&
var
avi_icon = "video.png" // video Instructions: var
How does VScript::Value() work?: Var*&
var
mp3_icon = "sound.png" // audio Instructions: var
How does VScript::Value() work?: Var*&
var
img_icon = "images.png" // images -> replaced by image preview Instructions: var
How does VScript::Value() work?: Var*&
var
gfx_icon = "vectorgfx.png" // graphics Instructions: var
How does VScript::Value() work?: Var*&
var
src_icon = "source.gif" // sources Instructions: var
How does VScript::Value() work?: Var*&
var
txt_icon = "txt.png" // plain Glossary: text_ref, text_vartexts var icon_info = { { "/", "folder.gif"}, { ".txt", txt_icon }, { ".doc", txt_icon }, { ".rtf", txt_icon }, { ".md5", txt_icon }, { ".Numeric functions: log
Numeric functions: loge
Instructions: log
log
", txt_icon }, { ".h", src_icon }, { ".c", src_icon }, { ".cp", src_icon }, { ".cpp", src_icon }, { ".mm", src_icon }, { ".asm", src_icon }, { ".ass", src_icon }, { ".vs", "Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.gif"}, { ".vh", "Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.gif"}, { ".cgi", "Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.gif"}, { ".sh", "Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.gif"}, { ".m4", "Example Scripts: CGI Scripts
Example Scripts: Scripts
script
.gif"}, { ".htm", "html.gif" }, { ".html", "html.gif" }, { ".zip", zip_icon }, { ".sit", zip_icon }, { ".gz", zip_icon }, { ".bz2", zip_icon }, { ".tgz", zip_icon }, { ".rpm", zip_icon }, { ".arj", zip_icon }, { ".tar", zip_icon }, { ".arj", zip_icon }, { ".z", zip_icon }, { ".jpg", img_icon }, { ".jpeg", img_icon }, { ".gif", img_icon }, { ".png", img_icon }, { ".tif", img_icon }, { ".tiff", img_icon }, { ".mp3", mp3_icon }, { ".aif", mp3_icon }, { ".mod", mp3_icon }, { ".aiff", mp3_icon }, { ".wav", mp3_icon }, { ".mid", "midi2.png" }, { ".midi", "midi2.png" }, { ".avi", avi_icon }, { ".mov", avi_icon }, { ".mpeg", avi_icon }, { ".mpg", avi_icon }, { ".fli", avi_icon }, { ".exe", "kwrite.png"}, { ".Text functions: hexstrhex", "Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
.png"}, { ".bin", "Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
.png"}, { ".Text functions: sys
Instructions: sys
sys
", "Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
.png"}, { ".pdf", "pdf.png" }, { ".eps", gfx_icon }, { ".ps", gfx_icon }, { ".ai", gfx_icon }, { ".art", gfx_icon }, // Freehand's version of ".ai" { ".fh2", gfx_icon }, { ".fh3", gfx_icon }, { ".fh5", gfx_icon }, { ".fh7", gfx_icon }, { ".fh8", gfx_icon }, { ".fh9", gfx_icon }, { ".fmz", "make.png" }, { ".c4d", "make.png" }, { ".pm4", "wordprocessing.png" }, { ".pm5", "wordprocessing.png" }, { ".ppt", "ppt.gif" }, { ".pps", "ppt.gif" }, { ".sna", "sna.gif" }, { ".tap", "tap.gif" }, { ".tape", "tap.gif" }, { ".z80", "sna.gif" }, { ".scr", "scr.gif" }, { ".rom", "rom.gif" }, { "", "empty.png" } // catch all: generic Text functions: file
Instructions: file
file
} /* ---- default header Glossary: text_ref, text_vartexts -------------------------------------- */ var head_robots = "noindex,nofollow" // noindex,Numeric functions: indexindex,nofollow,follow,noarchive,archive Instructions: var
How does VScript::Value() work?: Var*&
var
head_description = "" Instructions: var
How does VScript::Value() work?: Var*&
var
head_keywords = "" Instructions: var
How does VScript::Value() work?: Var*&
var
head_title = «Verzeichnis "»#convert(request_uri from url)#«"» /* ---- default body Glossary: text_ref, text_vartexts -------------------------------------- */ var body_data = «head\nmain\nfoot\n» /* ---- Functions with varying return types: include
Instructions: include
include
List functions: localslocal customization -------------------------------- */ Flow control: if … thenif Numeric functions: existsexists Text functions: file
Instructions: file
file
(dir_path#"Text functions: info
Shell Immediate Commands: info
info
.vh") Flow control: try … thentry Functions with varying return types: include
Instructions: include
include
dir_path#"Text functions: info
Shell Immediate Commands: info
info
.vh" Flow control: if … then
Flow control: try … then
else
Text functions: convert
Instructions: convert
convert
errorstr to html body_data = «p "Text functions: info
Shell Immediate Commands: info
info
.vh" yielded an error: » # errorstr # Constants: nlnl # body_data Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
then
Instructions: var
How does VScript::Value() work?: Var*&
var
dname = Text functions: convert
Instructions: convert
convert
(request_uri from url) // url_decoded url Instructions: var
How does VScript::Value() work?: Var*&
var
icon_dir_path = root_dir # icon_dir_url[2 to] Instructions: var
How does VScript::Value() work?: Var*&
var
temp_dir_path = root_dir # temp_dir_url[2 to] # dir_path /* create hidden mirror directory tree for thumbnails */ Flow control: if … thenif !Numeric functions: existsexists List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
temp_dir_path Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo Flow control: whilewhile i = Numeric functions: findfind(temp_dir_path,"/",i+1) Flow control: if … thenif Numeric functions: existsexists List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
temp_dir_path[to i] Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Flow control: try … thentry Instructions: newnew List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
temp_dir_path[to i] Flow control: if … then
Flow control: try … then
else
temp_dir_path = "" // failed to create temp_dir_path Flow control: if … then
Flow control: try … then
then
Flow control: do … looploop Flow control: if … then
Flow control: try … then
then
/* ---- html header ---------------------------------------------------- */ Instructions: putput «<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head> <META http-equiv=Content-Type content="Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
/html; charset=UTF-8"> <title>», Text functions: convert
Instructions: convert
convert
(head_title to html), «</title>», Constants: nlnl Flow control: if … thenif head_robots!="" Instructions: putput «<meta Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
="robots" content="», head_robots, «">», Constants: nlnl Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif head_description!="" Text functions: convert
Instructions: convert
convert
head_description to html Text functions: replace
Instructions: replace
replace
head_description, "\n", "<br>" Instructions: putput «<meta Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
="description" content="», head_description, «">», Constants: nlnl Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif head_keywords!="" Text functions: convert
Instructions: convert
convert
head_keywords to html Instructions: putput «<meta Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
="keywords" content="», head_keywords, «">», Constants: nlnl Flow control: if … then
Flow control: try … then
then
Instructions: putput «<style type="Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
/css"><!-- body,div,table,tr,Flow control: if … then
Flow control: try … then
th
,td,h1,h2,h3,h4,h5,p,pre,img {padding:0px;margin:0px;font-size:12pt;} h1,h2,h3,h4,h5,h6,p,pre {padding-top:0.2em; padding-bottom:0.2em;} h1,h2,h3,h4 {text-align:center; padding-top:0.4em;} h1 {font-size:20pt;} h2 {font-size:18pt; padding-top:0.2em;} h3 {font-size:16pt;} h4 {font-size:14pt;} body {background-color:#dddddd; font-family:sans-serif;} pre {border-left-style:solid; border-left-width:2px; border-left-color:#000099; padding-left:8px;} --></style> </head><body>», Constants: nlnl Instructions: procproc icon ( dir: fnamefname ) { Instructions: var
How does VScript::Value() work?: Var*&
var
lower_fname = Text functions: lowerstrlowerstr(dir: fnamefname) Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo ++i Flow control: untiluntil Text functions: rightstrrightstr(lower_fname,Numeric functions: countcount icon_info[i,1])==icon_info[i,1] Flow control: do … looploop Instructions: var
How does VScript::Value() work?: Var*&
var
icon = icon_info[i,2] Flow control: if … thenif icon!=img_icon || temp_dir_path=="" Flow control: returnreturn «<img width=32 height=32 alt="" src="» # icon_dir_url # icon # «">» Flow control: if … then
Flow control: try … then
then
// create preview Instructions: var
How does VScript::Value() work?: Var*&
var
pname = dir: fnamefname; Flow control: if … thenif Numeric functions: findfind(".jpg/jpeg"/*".jpg/jpeg/.gif/.png"*/,Text functions: rightstrrightstr(lower_fname,4)) == 0 pname #= ".jpg" Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif !Numeric functions: existsexists Text functions: file
Instructions: file
file
(temp_dir_path#pname) Flow control: try … thentry Instructions: var
How does VScript::Value() work?: Var*&
var
n = List functions: split
Instructions: split
split
( Text functions: sys
Instructions: sys
sys
( "identify", dir_path#dir: fnamefname ) ) n = Numeric functions: countcount n>2 ? "-flatten" : {} Instructions: var
How does VScript::Value() work?: Var*&
var
para = { "-size", "160x80", dir_path#dir: fnamefname } ## n ## { "-resize", "160x80", "+profile", "*", temp_dir_path#pname } Text functions: sys
Instructions: sys
sys
"Text functions: convert
Instructions: convert
convert
", para Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
then
// Text functions: convert
Instructions: convert
convert
seems to never fail -> check for thumbnail Text functions: file
Instructions: file
file
created Flow control: if … thenif !Numeric functions: existsexists Text functions: file
Instructions: file
file
(temp_dir_path#pname) Text functions: sys
Instructions: sys
sys
"ln", icon_dir_path#icon, temp_dir_path#pname Flow control: if … then
Flow control: try … then
then
// display preview Flow control: returnreturn «<img alt="" src="» # Text functions: convert
Instructions: convert
convert
(temp_dir_url # dir_path[2 to] # pname to url) # «">» } Instructions: procproc show_file ( dpath, dirent ) { Instructions: var
How does VScript::Value() work?: Var*&
var
dir: fnamefname = dirent.dir: fnamefname Instructions: var
How does VScript::Value() work?: Var*&
var
href_link = dirent.dir: fnamefname Instructions: var
How does VScript::Value() work?: Var*&
var
visible_link = dirent.dir: fnamefname Instructions: var
How does VScript::Value() work?: Var*&
var
dir: flagsflags = dirent.dir: flagsflags Instructions: var
How does VScript::Value() work?: Var*&
var
mtime = dirent.mtime Instructions: var
How does VScript::Value() work?: Var*&
var
dir: lengthlength = dirent.dir: lengthlength // deref symlink: Flow control: if … thenif dir: flagsflags[1]=="l" { Flow control: try … thentry Instructions: var
How does VScript::Value() work?: Var*&
var
fpath = Text functions: fullpathfullpath(dpath#dir: fnamefname) Flow control: if … thenif Numeric functions: isdirisdir fpath && Text functions: rightstrrightstr(fpath,1)!="/" fpath#="/" Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif fpath[to Numeric functions: countcount root_dir] != root_dir Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
// won't be accessible // Instructions: getget Text functions: link
Instructions: link
link
target's parent List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
: Instructions: var
How does VScript::Value() work?: Var*&
var
i = Numeric functions: rfindrfind(fpath,"/",Numeric functions: countcount(fpath)-1) dir: fnamefname = fpath[i+1 to] dpath = fpath[to i] // Instructions: getget deref'ed dirent: Instructions: var
How does VScript::Value() work?: Var*&
var
ddir = List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
dpath Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo Flow control: whilewhile ++i<=Numeric functions: countcount ddir Flow control: if … thenif dir: fnamefname!=ddir[i].dir: fnamefname && dir: fnamefname!=ddir[i].dir: fnamefname#"/" Flow control: nextnext Flow control: if … then
Flow control: try … then
then
dirent = ddir[i] Flow control: exit
Shell Immediate Commands: exit, quit, end
exit
Flow control: do … looploop // dir: fnamefname = dirent.dir: fnamefname href_link = fpath[Numeric functions: countcount root_dir to] // visible_link = dirent.dir: fnamefname dir: flagsflags = dirent.dir: flagsflags mtime = dirent.mtime dir: lengthlength = dirent.dir: lengthlength Flow control: if … then
Flow control: try … then
else
Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
} Flow control: if … then
Flow control: try … then
then
// trap forbidden folders: Flow control: if … thenif dir: flagsflags[1]=="d" Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,1)!="/" dir: fnamefname #= "/" Flow control: if … then
Flow control: try … then
then
Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo Flow control: whilewhile ++i <= Numeric functions: countcount forbidden_folders Flow control: if … thenif dir: fnamefname == forbidden_folders[i,2 to] Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: do … looploop Flow control: if … then
Flow control: try … then
then
// trap About this Guide: General
Built-in operators: General
general
don't-show Text functions: file
Instructions: file
files
: Flow control: if … thenif dir: fnamefname[1]=="." Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,1)=="~" Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".alt" Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".bak" Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".cgi" Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif dir: fnamefname=="Text functions: info
Shell Immediate Commands: info
info
.vh" Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif dir: fnamefname[to 6]=="Numeric functions: indexindex." Flow control: returnreturn Flow control: if … then
Flow control: try … then
then
// finally: print it: Text functions: convert
Instructions: convert
convert
href_link to url Text functions: convert
Instructions: convert
convert
href_link to quoted Text functions: convert
Instructions: convert
convert
visible_link to escaped Text functions: convert
Instructions: convert
convert
visible_link to html mtime = Text functions: datestrdatestr(mtime)[to 16] Instructions: putput «<tr valign=middle> <td align=center style="width:32px;padding:1px;">» ,icon(dir: fnamefname), «</td> <td><a href=» ,href_link, «>» ,visible_link, «</a></td><td></td> <td align=center>» ,mtime, «</td><td></td> <td align=right>» ,dir: lengthlength, «&nbsp;</td> </tr>\n» } /* ---------- Headline ------------- */ Instructions: procproc put_backlinks ( url ) { Instructions: var
How does VScript::Value() work?: Var*&
var
Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
,i Flow control: if … thenif Text functions: rightstrrightstr(url,1)=="/" url = url[to Numeric functions: countcount url -1] Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif url=="" Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
= http_host // my.domain.net Flow control: if … thenif Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
[1]<="9" Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
= "eden.kio.lan" Flow control: if … then
Flow control: try … then
then
url = http_host // my.domain.net Flow control: if … then
Flow control: try … then
else
i = Numeric functions: rfindrfind(url,"/") put_backlinks ( url[to i-1] ) Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
= url[i+1 to] // path url = http_host # url # "/" // my.domain.net/my/partial/path/ Flow control: if … then
Flow control: try … then
then
Instructions: putput "<a href=\"http://",Text functions: convert
Instructions: convert
convert
(url to url),"\">",Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
,"</a> / \n" } Instructions: procproc put_body_head() { Instructions: putput «<table border=0 width="100%" cellpadding=0 cellspacing=0> <tr valign=top> <td style="background-color:#88CC88;width:128px;height:128px;" valign=top rowspan=2>» ,logo, «</td> <td style="background-color:#99ff99;height:64px;" valign=middle align=center><h2>» ,dname, «</h2></td> </tr> <tr valign=top> <td style="background-color:#ccff99;height=64px;" valign=middle align=center>» put_backlinks(dname) Instructions: putput «</td></tr></table>»,Constants: nlnl Instructions: putput «<div style="margin-left:10%; margin-right:10%;">» } Instructions: procproc put_body_main(dir_path,dir_part_path) { Instructions: putput «</div>»,Constants: nlnl Instructions: putput «<div align=center><table border=0 cellpadding=0 cellspacing=0 style="background-color:#cccccc;"> <tr valign=middle> <Flow control: if … then
Flow control: try … then
th
width=40 height=32></Flow control: if … then
Flow control: try … then
th
><Flow control: if … then
Flow control: try … then
th
align=left>Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
Name
</Flow control: if … then
Flow control: try … then
th
><Flow control: if … then
Flow control: try … then
th
width=16></Flow control: if … then
Flow control: try … then
th
> <Flow control: if … then
Flow control: try … then
th
align=center>Letzte Änderung</Flow control: if … then
Flow control: try … then
th
><Flow control: if … then
Flow control: try … then
th
width=32></Flow control: if … then
Flow control: try … then
th
><Flow control: if … then
Flow control: try … then
th
align=right>Länge&nbsp;</Flow control: if … then
Flow control: try … then
th
> </tr>», Constants: nlnl // Instructions: readread directory Instructions: var
How does VScript::Value() work?: Var*&
var
directory = {} Flow control: try … thentry directory = List functions: dir
Instructions: dir
Shell Immediate Commands: dir
dir
dir_path Flow control: if … then
Flow control: try … then
then
Instructions: sortsort directory // Flow control: if … thenif List functions: thisthis is a forbidden directory, Flow control: if … then
Flow control: try … then
then
just clear Flow control: if … then
Flow control: try … then
the
Glossary: list_ref, list_varlist var i=0 Flow control: do … loopdo Flow control: whilewhile ++i <= Numeric functions: countcount forbidden_folders Flow control: untiluntil Numeric functions: findfind(dir_part_path,forbidden_folders[i]) Flow control: do … looploop Flow control: if … thenif i <= Numeric functions: countcount forbidden_folders directory = {} Flow control: if … then
Flow control: try … then
then
Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo Flow control: whilewhile ++i <= Numeric functions: countcount directory show_file( dir_path, directory[i] ) Flow control: do … looploop Instructions: putput "</table></p>",Constants: nlnl Instructions: putput «<div style="margin-left:10%; margin-right:10%;">» } Instructions: procproc put_body_foot() { Instructions: putput «<p style="margin-top:0.5em; text-align:center; font-size:9pt;"> powered by <a href="http://vipsi.sourceforge.net">vipsi</a> - your friendly VIP Example Scripts: CGI Scripts
Example Scripts: Scripts
Script
Interpreter </p>» Instructions: putput «</div>»,Constants: nlnl } Instructions: procproc put_tagged(tag,Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
) { Text functions: convert
Instructions: convert
convert
Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
to html Instructions: putput "<",tag,">", Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
, "</",tag,">",Constants: nlnl } List functions: split
Instructions: split
split
body_data Instructions: var
How does VScript::Value() work?: Var*&
var
i=0 Flow control: do … loopdo Flow control: whilewhile ++i <= Numeric functions: countcount body_data Instructions: var
How does VScript::Value() work?: Var*&
var
zeile = body_data[i] Flow control: if … thenif zeile=="" Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif zeile[1]<=" " Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif zeile=="head" Instructions: putput Constants: nlnl,"<!--head-->",Constants: nlnl put_body_head() Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif zeile=="foot" Instructions: putput Constants: nlnl,"<!--foot-->",Constants: nlnl put_body_foot() Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Flow control: if … thenif zeile=="main" Instructions: putput Constants: nlnl,"<!--main-->",Constants: nlnl put_body_main(dir_path,dir_part_path) Flow control: nextnext Flow control: if … then
Flow control: try … then
then
Instructions: var
How does VScript::Value() work?: Var*&
var
j=0 Flow control: do … loopdo Flow control: whilewhile ++j<=Numeric functions: countcount zeile && zeile[j]>" " Flow control: do … looploop Instructions: var
How does VScript::Value() work?: Var*&
var
k=j Flow control: do … loopdo Flow control: whilewhile ++k<=Numeric functions: countcount zeile && zeile[k]<=" " Flow control: do … looploop Flow control: if … thenif k>Numeric functions: countcount zeile Flow control: nextnext Flow control: if … then
Flow control: try … then
then
put_tagged( zeile[to j-1], zeile[k to] ) Flow control: do … looploop Instructions: putput" </body></html> "

Valid HTML   Valid CSS