|
As you may have noticed, i export most of my hard disk to Flow control: if … then Flow control: try … thenthe web. In order to present my stuff nicely, i wrote a Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi script to Text functions: replace Instructions: replacereplace Flow control: if … then Flow control: try … thenthe 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: Listinglisting of Flow control: if … then Flow control: try … thenthe 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: Listinglisting on my site, with Flow control: if … then Flow control: try … thenthe little bat in Flow control: if … then Flow control: try … thenthe top-left corner, it is generated by List functions: thisthis Example Scripts: CGI Scripts Example Scripts: Scriptsscript.
index.cgi
Flow control: if … then Flow control: try … thenThe following Text functions: link Instructions: linklink leads to Flow control: if … then Flow control: try … thenthe 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 Scriptscgi script. Depending on Flow control: if … then Flow control: try … thenthe location Flow control: if … thenif List functions: thisthis copy of Flow control: if … then Flow control: try … thenthe vipsi documentation List functions: thisthis may Operators: Bitwise Not "~" Operators: Boolean Negation "!"not be true. B-)
/cgi-bin/index.cgi
#!/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: filefiles matching pattern
optionally Functions with varying return types: include Instructions: includeincludes "Text functions: info Shell Immediate Commands: infoinfo.vh" to customize page
*/
/* ---- send http header ----------------------------------------------------
*/
Instructions: putput "content-type: Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=utf-8\n\n"
/* ---- evaluate List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv 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: envenv.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: envenv.DOCUMENT_ROOT // "/www_root/"
root_dir = Text functions: fullpathfullpath(root_dir) # "/" // resolve potential symlinks
Text functions: replace Instructions: replacereplace root_dir,"//","/"
Instructions: var How does VScript::Value() work?: Var*&var request_uri = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv.REQUEST_URI # "/" // "/Pub/RPG/Fantasy/Text functions: file Instructions: filefile?mask*pattern"
Text functions: replace Instructions: replacereplace request_uri,"//","/"
Instructions: var How does VScript::Value() work?: Var*&var dir_part_path = request_uri[2 to] // "RPG/Fantasy/"
Text functions: convert Instructions: convertconvert 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: dirdir( 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: filefile ( root_dir # d[1].dir: fnamefname )
Text functions: convert Instructions: convertconvert f from utf
Instructions: putput f
Flow control: end Shell Immediate Commands: exit, quit, endend 0
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
/* ==== 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 … thenthe generic Text functions: file Instructions: filefile icons Text functions: file Instructions: filefiles?
Instructions: var How does VScript::Value() work?: Var*&var temp_dir_url = "/tmp/" // where to store Flow control: if … then Flow control: try … thenthe thumbnails?
Flow control: if … then Flow control: try … thenelse
// ---- 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 … thenthe generic Text functions: file Instructions: filefile icons Text functions: file Instructions: filefiles?
Instructions: var How does VScript::Value() work?: Var*&var temp_dir_url = "/www/tmp/" // where to store Flow control: if … then Flow control: try … thenthe thumbnails?
Flow control: if … then Flow control: try … thenthen
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: loglog", 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: Scriptsscript.gif"},
{ ".vh", "Example Scripts: CGI Scripts Example Scripts: Scriptsscript.gif"},
{ ".cgi", "Example Scripts: CGI Scripts Example Scripts: Scriptsscript.gif"},
{ ".sh", "Example Scripts: CGI Scripts Example Scripts: Scriptsscript.gif"},
{ ".m4", "Example Scripts: CGI Scripts Example Scripts: Scriptsscript.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: binstrbinary.png"},
{ ".bin", "Integer numbers: Binary Floating point: Binary Text functions: binstrbinary.png"},
{ ".Text functions: sys Instructions: syssys", "Integer numbers: Binary Floating point: Binary Text functions: binstrbinary.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: filefile
}
/* ---- 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: includeinclude List functions: localslocal customization --------------------------------
*/
Flow control: if … thenif Numeric functions: existsexists Text functions: file Instructions: filefile(dir_path#"Text functions: info Shell Immediate Commands: infoinfo.vh")
Flow control: try … thentry
Functions with varying return types: include Instructions: includeinclude dir_path#"Text functions: info Shell Immediate Commands: infoinfo.vh"
Flow control: if … then Flow control: try … thenelse
Text functions: convert Instructions: convertconvert errorstr to html
body_data = «p "Text functions: info Shell Immediate Commands: infoinfo.vh" yielded an error: » # errorstr # Constants: nlnl # body_data
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var dname = Text functions: convert Instructions: convertconvert(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: dirdir 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: dirdir temp_dir_path[to i] Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: try … thentry
Instructions: newnew List functions: dir Instructions: dir Shell Immediate Commands: dirdir temp_dir_path[to i]
Flow control: if … then Flow control: try … thenelse
temp_dir_path = "" // failed to create temp_dir_path
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Flow control: if … then Flow control: try … thenthen
/* ---- 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_valtext/html; charset=UTF-8">
<title>», Text functions: convert Instructions: convertconvert(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, Identifiername="robots" content="», head_robots, «">», Constants: nlnl
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif head_description!=""
Text functions: convert Instructions: convertconvert head_description to html
Text functions: replace Instructions: replacereplace head_description, "\n", "<br>"
Instructions: putput «<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername="description" content="», head_description, «">», Constants: nlnl
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif head_keywords!=""
Text functions: convert Instructions: convertconvert head_keywords to html
Instructions: putput «<meta Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername="keywords" content="», head_keywords, «">», Constants: nlnl
Flow control: if … then Flow control: try … thenthen
Instructions: putput
«<style type="Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/css"><!--
body,div,table,tr,Flow control: if … then Flow control: try … thenth,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 … thenthen
// 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 … thenthen
Flow control: if … thenif !Numeric functions: existsexists Text functions: file Instructions: filefile(temp_dir_path#pname)
Flow control: try … thentry
Instructions: var How does VScript::Value() work?: Var*&var n = List functions: split Instructions: splitsplit( Text functions: sys Instructions: syssys( "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: syssys "Text functions: convert Instructions: convertconvert", para
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
// Text functions: convert Instructions: convertconvert seems to never fail -> check for thumbnail Text functions: file Instructions: filefile created
Flow control: if … thenif !Numeric functions: existsexists Text functions: file Instructions: filefile(temp_dir_path#pname)
Text functions: sys Instructions: syssys "ln", icon_dir_path#icon, temp_dir_path#pname
Flow control: if … then Flow control: try … thenthen
// display preview
Flow control: returnreturn «<img alt="" src="» # Text functions: convert Instructions: convertconvert(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 … thenthen
Flow control: if … thenif fpath[to Numeric functions: countcount root_dir] != root_dir Flow control: returnreturn Flow control: if … then Flow control: try … thenthen // won't be accessible
// Instructions: getget Text functions: link Instructions: linklink target's parent List functions: dir Instructions: dir Shell Immediate Commands: dirdir:
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: dirdir 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 … thenthen
dirent = ddir[i]
Flow control: exit Shell Immediate Commands: exit, quit, endexit
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 … thenelse
Flow control: returnreturn
Flow control: if … then Flow control: try … thenthen
}
Flow control: if … then Flow control: try … thenthen
// 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 … thenthen
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 … thenthen
Flow control: do … looploop
Flow control: if … then Flow control: try … thenthen
// trap About this Guide: General Built-in operators: Generalgeneral don't-show Text functions: file Instructions: filefiles:
Flow control: if … thenif dir: fnamefname[1]=="." Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,1)=="~" Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".alt" Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".bak" Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Text functions: rightstrrightstr(dir: fnamefname,4)==".cgi" Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif dir: fnamefname=="Text functions: info Shell Immediate Commands: infoinfo.vh" Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif dir: fnamefname[to 6]=="Numeric functions: indexindex." Flow control: returnreturn Flow control: if … then Flow control: try … thenthen
// finally: print it:
Text functions: convert Instructions: convertconvert href_link to url
Text functions: convert Instructions: convertconvert href_link to quoted
Text functions: convert Instructions: convertconvert visible_link to escaped
Text functions: convert Instructions: convertconvert 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, « </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_valtext,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 … thenthen
Flow control: if … thenif url==""
Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = http_host // my.domain.net
Flow control: if … thenif Data Types: Text Item selector "[]": Text Glossary: text, text_valtext[1]<="9" Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = "eden.kio.lan" Flow control: if … then Flow control: try … thenthen
url = http_host // my.domain.net
Flow control: if … then Flow control: try … thenelse
i = Numeric functions: rfindrfind(url,"/")
put_backlinks ( url[to i-1] )
Data Types: Text Item selector "[]": Text Glossary: text, text_valtext = url[i+1 to] // path
url = http_host # url # "/" // my.domain.net/my/partial/path/
Flow control: if … then Flow control: try … thenthen
Instructions: putput "<a href=\"http://",Text functions: convert Instructions: convertconvert (url to url),"\">",Data Types: Text Item selector "[]": Text Glossary: text, text_valtext,"</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 … thenth width=40 height=32></Flow control: if … then Flow control: try … thenth><Flow control: if … then Flow control: try … thenth align=left>Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName</Flow control: if … then Flow control: try … thenth><Flow control: if … then Flow control: try … thenth width=16></Flow control: if … then Flow control: try … thenth>
<Flow control: if … then Flow control: try … thenth align=center>Letzte Änderung</Flow control: if … then Flow control: try … thenth><Flow control: if … then Flow control: try … thenth width=32></Flow control: if … then Flow control: try … thenth><Flow control: if … then Flow control: try … thenth align=right>Länge </Flow control: if … then Flow control: try … thenth>
</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: dirdir dir_path Flow control: if … then Flow control: try … thenthen
Instructions: sortsort directory
// Flow control: if … thenif List functions: thisthis is a forbidden directory, Flow control: if … then Flow control: try … thenthen just clear Flow control: if … then Flow control: try … thenthe 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 … thenthen
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: ScriptsScript Interpreter
</p>»
Instructions: putput «</div>»,Constants: nlnl
}
Instructions: procproc put_tagged(tag,Data Types: Text Item selector "[]": Text Glossary: text, text_valtext)
{
Text functions: convert Instructions: convertconvert Data Types: Text Item selector "[]": Text Glossary: text, text_valtext to html
Instructions: putput "<",tag,">", Data Types: Text Item selector "[]": Text Glossary: text, text_valtext, "</",tag,">",Constants: nlnl
}
List functions: split Instructions: splitsplit 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 … thenthen
Flow control: if … thenif zeile[1]<=" " Flow control: nextnext Flow control: if … then Flow control: try … thenthen
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 … thenthen
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 … thenthen
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 … thenthen
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 … thenthen
put_tagged( zeile[to j-1], zeile[k to] )
Flow control: do … looploop
Instructions: putput"
</body></html>
"
| |