|
List functions: thisThis Example Scripts: CGI Scripts Example Scripts: Scriptsscript calculates Flow control: if … then Flow control: try … thenthe Easy Example Scripts: Factorial "!"factorial n! of Flow control: if … then Flow control: try … thenthe passed Vipsi command syntax: Arguments Glossary: Argumentsargument n.
List functions: thisThis is an easy example for a Example Scripts: CGI Scripts Example Scripts: Scriptsscript, which can be called in two different ways:
- as shell command
- Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or called from another vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript.
Flow control: if … thenIf invocated in Flow control: if … then Flow control: try … thenthe traditional way, either from Flow control: if … then Flow control: try … thenthe bash shell Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or from a vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript with Vipsi command syntax: Functions Functions Glossary: Functionfunction Text functions: sys Instructions: syssys(), Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe passed Vipsi command syntax: Arguments Glossary: Argumentsargument is a Data Types: Text Item selector "[]": Text Glossary: text, text_valtext. No chance for anything Flow control: if … then Flow control: try … thenelse. So we Text functions: convert Instructions: convertconvert Flow control: if … then Flow control: try … thenthe Data Types: Text Item selector "[]": Text Glossary: text, text_valtext to a Glossary: number, num_valnumber Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and... hm, print Flow control: if … then Flow control: try … thenthe result to Constants: stdoutstdout. No other way Flow control: if … then Flow control: try … thenelse.
Flow control: if … thenIf invovated from another vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or from Flow control: if … then Flow control: try … thenthe vipsi shell with Functions with varying return types: call Instructions: callcall(), Flow control: if … then Flow control: try … thenthen we can pass Vipsi command syntax: Arguments Glossary: Argumentsarguments of any type Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and can Flow control: returnreturn a Glossary: Valuevalue of any type. So, Flow control: if … thenif we detect a numeric Vipsi command syntax: Arguments Glossary: Argumentsargument, we Flow control: do … loopdo it just like List functions: thisthis.
fak.vs
#!/usr/local/bin/vipsi
/*
Example Scriptsexample script for Text functions: sys Instructions: syssys() Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Functions with varying return types: call Instructions: callcall()
Flow control: if … thenif called with «Functions with varying return types: call Instructions: callcall("fak.vs",Glossary: number, num_valnumber)» it Flow control: returnreturns a numeric Glossary: Valuevalue
Flow control: if … thenif called with «Text functions: sys Instructions: syssys("fak.vs",numberstring)» it prints Flow control: if … then Flow control: try … thenthe result
both cases are distinguished by examining Flow control: if … then Flow control: try … thenthe type of Flow control: if … then Flow control: try … thenthe passed Vipsi command syntax: Arguments Glossary: Argumentsargument:
Flow control: if … thenif it is numeric Flow control: if … then Flow control: try … thenthen it must be Functions with varying return types: call Instructions: callcall()
Flow control: if … thenif it is a Data Types: Text Item selector "[]": Text Glossary: text, text_valtext Flow control: if … then Flow control: try … thenthen we assume it was Text functions: sys Instructions: syssys()
*/
Flow control: if … thenif Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals != 1
Numeric functions: log Numeric functions: loge Instructions: loglog "error: Example Scripts: CGI Scripts Example Scripts: Scriptsscript 'fak.vs' takes exactly one Vipsi command syntax: Arguments Glossary: Argumentsargument",Constants: nlnl
Instructions: var How does VScript::Value() work?: Var*&var i = 1
Flow control: do … loopdo
Flow control: whilewhile i<Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals
Numeric functions: log Numeric functions: loge Instructions: loglog "arg[",i,"] = ",List functions: globals Shell Immediate Commands: globalsglobals[i],Constants: nlnl
i++
Flow control: do … looploop
Flow control: end Shell Immediate Commands: exit, quit, endend 1
Flow control: if … then Flow control: try … thenthen
Instructions: renamerename List functions: globals Shell Immediate Commands: globalsglobals[1] = "n"
Instructions: var How does VScript::Value() work?: Var*&var is_num = Numeric functions: isnumberisnumber(n)
Instructions: var How does VScript::Value() work?: Var*&var is_text = Numeric functions: istextistext(n) Flow control: if … thenif is_text n=Functions with varying return types: eval Instructions: evaleval(n) Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var result = 1;
Flow control: if … thenif (!is_num && !is_text)
Numeric functions: log Numeric functions: loge Instructions: loglog "error: Example Scripts: CGI Scripts Example Scripts: Scriptsscript 'fak.vs' Instructions: requirerequires a numeric Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Data Types: Text Item selector "[]": Text Glossary: text, text_valtext Vipsi command syntax: Arguments Glossary: Argumentsargument",Constants: nlnl
Flow control: end Shell Immediate Commands: exit, quit, endend 1
Flow control: if … then Flow control: try … thenthen
Flow control: do … loopdo
Flow control: whilewhile n>1
result *= n--
Flow control: do … looploop
Flow control: if … thenif (is_num) // Flow control: if … thenif called with "Functions with varying return types: call Instructions: callcall"
Flow control: returnreturn result // Flow control: if … then Flow control: try … thenthen we can Flow control: returnreturn real data
Flow control: if … then Flow control: try … thenelse
Instructions: putput result,Constants: nlnl // Flow control: if … thenif called with "Text functions: sys Instructions: syssys"
Flow control: end Shell Immediate Commands: exit, quit, endend 0 // we can only print to Constants: stdoutstdout
Flow control: if … then Flow control: try … thenthen // Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: returnreturn "ok"
Of course an interpreter language is Operators: Bitwise Not "~" Operators: Boolean Negation "!"not suitable for Glossary: number, num_valnumber crunching, but for testing an algorithm it is Shell Immediate Commands: exit, quit, endquite conveniant.
When i worked on factorizing of large Data Types: Numbersnumbers i Instructions: writewrite List functions: thisthis Example Scripts: CGI Scripts Example Scripts: Scriptsscript to test Flow control: if … then Flow control: try … thenthe first thoughts. You can just Functions with varying return types: call Instructions: callcall it w/o parameters to run a test on a automatically generated Glossary: number, num_valnumber, which is secretly calculated by multiplying two primes of Flow control: if … then Flow control: try … thenthe preset size, Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or supply Glossary: Valuevalues for Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber of test Flow control: do … looploops, size of prime A, size of prime factor B Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or pass an own Glossary: number, num_valnumber to factorize.
Operators: Bitwise Not "~" Operators: Boolean Negation "!"note: accuracy of 8 byte float arithmetic is 53 bits. You'll Numeric functions: findfind List functions: thisthis Glossary: number, num_valnumber in Flow control: if … then Flow control: try … thenthe 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.
Vipsi command syntax: CommentsComments in Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript are German.
prime.vs
#!/usr/local/bin/vipsi
Instructions: var How does VScript::Value() work?: Var*&var argc; argc = Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals -1
Instructions: var How does VScript::Value() work?: Var*&var testloops = 1
Instructions: var How does VScript::Value() work?: Var*&var quiet = 0
Instructions: var How does VScript::Value() work?: Var*&var testzahl = 0
Instructions: var How does VScript::Value() work?: Var*&var bits_a = 15 // a<b
Instructions: var How does VScript::Value() work?: Var*&var bits_b = 25 // und a+b <= 53
Instructions: var How does VScript::Value() work?: Var*&var i=0
Flow control: do … loopdo
Flow control: whilewhile++i<=argc
Instructions: var How does VScript::Value() work?: Var*&var arg = List functions: globals Shell Immediate Commands: globalsglobals[i]
Flow control: if … thenif arg=="-h" || arg=="--help"
Instructions: var How does VScript::Value() work?: Var*&var msg = «
Zerlege Testzahl in zwei (Prim-)faktoren
Erzeugt entweder eine Testzahl aus zwei generierten Testzahlen
oder zerlegt die übergebene Testzahl in 2 Faktoren.
-q --quiet Ohne Zwischenmeldungen
-n <zahl> --Flow control: do … looploops Anzahl Testläufe (dflt: 1)
-a <bits> --bits_a Größenordnung für erste Primzahl: 2..51
-b <bits> --bits_b Größenordnung für zweite Primzahl: 2..51
<zahl> Eigene statt generierter Testzahl
» Text functions: convert Instructions: convertconvert msg from tab4
Instructions: putput msg
Flow control: end Shell Immediate Commands: exit, quit, endend 0
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif arg=="-q" || arg=="--quiet" quiet=1 Flow control: nextnext Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif arg=="-n" || arg=="--tests" || arg=="--Flow control: do … looploops"
Flow control: if … thenif ++i>argc Flow control: nextnext Flow control: if … then Flow control: try … thenthen
testloops=List functions: globals Shell Immediate Commands: globalsglobals[i]
Flow control: if … thenif !Numeric functions: isnumberisnumber testloops
Flow control: try … thentry testloops=Functions with varying return types: eval Instructions: evaleval testloops Flow control: if … then Flow control: try … thenelse testloops=1 Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif arg=="-a" || arg=="--bits_a"
Flow control: if … thenif ++i>argc Flow control: nextnext Flow control: if … then Flow control: try … thenthen
arg=List functions: globals Shell Immediate Commands: globalsglobals[i]
Flow control: if … thenif !Numeric functions: isnumberisnumber arg
Flow control: try … thentry arg=Functions with varying return types: eval Instructions: evaleval arg bits_a=arg Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
bits_a=arg
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif bits_a<2||bits_a>51 bits_a=40-bits_b Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif bits_a>bits_b { Instructions: var How does VScript::Value() work?: Var*&var z=bits_a bits_a=bits_b bits_b=z } Flow control: if … then Flow control: try … thenthen
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif arg=="-b" || arg=="--bits_b"
Flow control: if … thenif ++i>argc Flow control: nextnext Flow control: if … then Flow control: try … thenthen
arg=List functions: globals Shell Immediate Commands: globalsglobals[i]
Flow control: if … thenif !Numeric functions: isnumberisnumber arg
Flow control: try … thentry arg=Functions with varying return types: eval Instructions: evaleval arg bits_b=arg Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
bits_b=arg
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif bits_b<2||bits_b>51 bits_b=40-bits_a Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif bits_a>bits_b { Instructions: var How does VScript::Value() work?: Var*&var z=bits_a bits_a=bits_b bits_b=z } Flow control: if … then Flow control: try … thenthen
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif testloops!=1 || testzahl!=0
Instructions: putput Constants: nlnl,"Unerwartete Testzahl wird ignoriert."
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Flow control: try … thentry
testzahl = arg
Flow control: if … thenif !Numeric functions: isnumberisnumber testzahl testzahl = Functions with varying return types: eval Instructions: evaleval testzahl Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var z = testloops
testloops = 0
Flow control: if … thenif testzahl<3 || Numeric functions: fractfract(testzahl>>1)!=0.5 || testzahl+1==testzahl || testzahl-1==testzahl
Instructions: putput Constants: nlnl,"Testzahl außerhalb der Rechengenauigkeit.",
Constants: nlnl,"Starte ersatzweise Test.", Constants: nlnl
testloops = z
testzahl = 0
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenelse
Instructions: putput Constants: nlnl,"Parameter war nicht numerisch.",
Constants: nlnl,"Starte ersatzweise Test.", Constants: nlnl
testloops = z
testzahl = 0
Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
/* ==== TOOLS ===================================================
*/
Instructions: procproc NewPrime(bits)
{
Flow control: do … loopdo
Instructions: var How does VScript::Value() work?: Var*&var n = (0.5+Numeric functions: randomrandom(0.5)) << bits
n = Numeric functions: intint(n>>1) << 1 +1
Instructions: var How does VScript::Value() work?: Var*&var e = Numeric functions: intint Numeric functions: sqrtsqrt n
Instructions: var How does VScript::Value() work?: Var*&var q = 1
Flow control: do … loopdo
Flow control: if … thenif (q+=2)>e Flow control: returnreturn n Flow control: if … then Flow control: try … thenthen
Flow control: untiluntil Numeric functions: fractfract(n/q)==0
Flow control: do … looploop
Flow control: do … looploop
}
Instructions: procproc PrüfeRechengenauigkeit( prime_a, prime_b )
{
Instructions: var How does VScript::Value() work?: Var*&var n = prime_a * prime_b
Flow control: if … thenif n / prime_a != prime_b Flow control: returnreturn "failed (1)" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif n / prime_b != prime_a Flow control: returnreturn "failed (1a)" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif n-1+1 != n Flow control: returnreturn "failed (2)" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif n-1 == n Flow control: returnreturn "failed (2a)" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif n+1 == n Flow control: returnreturn "failed (2b)" Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var a0 = Numeric functions: intint(Numeric functions: sqrtsqrt(n)) Instructions: var How does VScript::Value() work?: Var*&var da = 2 a0 -= Numeric functions: fractfract(a0>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var b0 = Numeric functions: intint(n/a0) Instructions: var How does VScript::Value() work?: Var*&var db = 2 b0 -= Numeric functions: fractfract(b0>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var r0 = n - a0 * b0
Instructions: var How does VScript::Value() work?: Var*&var z0 = 2*(b0-a0+da) Instructions: var How does VScript::Value() work?: Var*&var dz = 2*(da+db)
Flow control: if … thenif a0*b0+r0 != n Flow control: returnreturn "failed (3)" Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn "ok"
}
Instructions: procproc PrüfeAlgorithmus ( prime_a, prime_b )
{
Instructions: var How does VScript::Value() work?: Var*&var n = prime_a * prime_b
Instructions: var How does VScript::Value() work?: Var*&var a0 = Numeric functions: intint(Numeric functions: sqrtsqrt(n)) Instructions: var How does VScript::Value() work?: Var*&var da = 2 a0 -= Numeric functions: fractfract(a0>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var b0 = Numeric functions: intint(n/a0) Instructions: var How does VScript::Value() work?: Var*&var db = 2 b0 -= Numeric functions: fractfract(b0>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var r0 = n - a0 * b0
Instructions: var How does VScript::Value() work?: Var*&var z0 = 2*(b0-a0+da) Instructions: var How does VScript::Value() work?: Var*&var dz = 2*(da+db)
Instructions: var How does VScript::Value() work?: Var*&var a = a0-da
Instructions: var How does VScript::Value() work?: Var*&var b = b0+db
Instructions: var How does VScript::Value() work?: Var*&var r = r0+z0
Instructions: var How does VScript::Value() work?: Var*&var z = z0+dz
Flow control: if … thenif a*b+r != n Flow control: returnreturn "failed (4)" Flow control: if … then Flow control: try … thenthen
a-=da b+=db r+=z z+=dz
Flow control: if … thenif a*b+r != n Flow control: returnreturn "failed (5)" Flow control: if … then Flow control: try … thenthen
a-=da b+=db r+=z z+=dz
Flow control: if … thenif a*b+r != n Flow control: returnreturn "failed (6)" Flow control: if … then Flow control: try … thenthen
Flow control: returnreturn "ok"
}
/* ==========================================================
a_prime * b_prime = n
a * b + r = n a < b, a--, b++
a' = a-da; da = 2
b' = b+db; db = 2; wird erhöht, wenn dr>=2*a
r = n -a*b
r' = n -a'*b' = n-(a-da)*(b+db)
= n -a*b -a*db +b*da +da*db
= r -a*db +b*da +da*db
dr = r' - r = r -a*db +b*da +da*db -r
= -a*db +b*da +da*db
r" = n -a"*b" = n-(a-2da)*(b+2db)
= n -a*b -2*a*db +2*b*da +4*da*db
= r' -a*db +b*da +3*da*db
dr' = r" - r' = r' -a*db +b*da +3*da*db -r'
= -a*db +b*da +3*da*db
= dr +2*da*db
ddr = dr' - dr = dr +2*da*db - dr
= 2*da*db
Zur Steigung db/da:
b = f(a) = n/a = n * a⁻¹
db/da = f'(a) = n/a² = n * a⁻²
db muss auf 4 erhöht werden, bei:
f'(a) = n/a² = 4/2
<=> n = 2*a²
a = Numeric functions: sqrtsqrt(n/2)
a = Numeric functions: sqrtsqrt(n) / Numeric functions: sqrtsqrt(2)
wobei Numeric functions: sqrtsqrt(n) ja der startwert für a ist.
allgemein: db muss immer auf das nächste db erhöht werden bei
a = Numeric functions: sqrtsqrt(n) / Numeric functions: sqrtsqrt(db/da)
bei a = Numeric functions: sqrtsqrt(n)/2 wird db/da also gerade auf 8/2 erhöht.
Dann ist der halbe Wertebereich für a abgearbeitet!
Wann muss db zum ersten Mal um mehr als 2 (also 4) erhöht werden?
wenn dr' = dr+ddr >= 4*a
Wann muss b zum ersten Mal um mehr als 2 (also 4) zusätzlich gesteppt werden?
wenn r' = r+dr >= 4*a
*/
Instructions: procproc FindPrimes(n)
{
Instructions: var How does VScript::Value() work?: Var*&var a = Numeric functions: intint(Numeric functions: sqrtsqrt(n)) a -= Numeric functions: fractfract(a>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var b = Numeric functions: intint(n/a) b -= Numeric functions: fractfract(b>>1)==0
Instructions: var How does VScript::Value() work?: Var*&var r = n - a * b
Instructions: var How does VScript::Value() work?: Var*&var da = 2
Instructions: var How does VScript::Value() work?: Var*&var db = 2
Instructions: var How does VScript::Value() work?: Var*&var dr = -a*db +b*da +da*db
Instructions: var How does VScript::Value() work?: Var*&var ddr = 2*da*db
Instructions: var How does VScript::Value() work?: Var*&var f
Flow control: if … thenif r==0 Flow control: returnreturn List functions: localslocals Flow control: if … then Flow control: try … thenthen
Flow control: do … loopdo
// Flow control: whilewhile a*b+r == n // check
Flow control: if … thenif r>=2*a
Flow control: if … thenif dr>=2*a
f = Numeric functions: intint(dr/(2*a))*2
// Flow control: if … thenif (f>2) Numeric functions: log Numeric functions: loge Instructions: loglog " dr/2a=",f," " Flow control: if … then Flow control: try … thenthen
db += f
dr -= (a-da)*f //Flow control: if … thenif(dr!=-a*db +b*da +da*db) Numeric functions: log Numeric functions: loge Instructions: loglog" (1)" Flow control: exit Shell Immediate Commands: exit, quit, endexit Flow control: if … then Flow control: try … thenthen
ddr += f*2*da //Flow control: if … thenif(ddr!=2*da*db) Numeric functions: log Numeric functions: loge Instructions: loglog" (2)" Flow control: exit Shell Immediate Commands: exit, quit, endexit Flow control: if … then Flow control: try … thenthen
// Instructions: putput Constants: nlnl, List functions: localslocals, " db incremented"
Flow control: if … thenif r>=4*a
f = Numeric functions: intint(r/(2*a))*2
b += f
r -= f*a //Flow control: if … thenif(r!=n-a*b) Numeric functions: log Numeric functions: loge Instructions: loglog"(3)" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
dr += f*2 //Flow control: if … thenif(dr!=-a*db +b*da +da*db) Numeric functions: log Numeric functions: loge Instructions: loglog"(4)" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Flow control: untiluntil r==0 // found ((Flow control: if … thenif n was prime Flow control: if … then Flow control: try … thenthen List functions: thisthis triggers when a==1))
Flow control: nextnext
Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
f = Numeric functions: intint(r/(2*a))*2
Flow control: if … thenif (f>2) Numeric functions: log Numeric functions: loge Instructions: loglog " r/2a=",f," " Flow control: if … then Flow control: try … thenthen
b += f
r -= f*a //Flow control: if … thenif(r!=n-a*b) Numeric functions: log Numeric functions: loge Instructions: loglog"(5)" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
dr += f*2 //Flow control: if … thenif(dr!=-a*db +b*da +da*db) Numeric functions: log Numeric functions: loge Instructions: loglog"(6)" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Flow control: untiluntil r==0 // found ((Flow control: if … thenif n was prime Flow control: if … then Flow control: try … thenthen List functions: thisthis triggers when a==1))
// Flow control: untiluntil a<2 // no prime factor found! ((no need: a==1 is always found))
// Flow control: whilewhile a*b+r == n // check
Flow control: if … then Flow control: try … thenthen
a-=da
b+=db
r+=dr
dr+=ddr
Flow control: do … looploop
Flow control: returnreturn List functions: localslocals
}
Instructions: procproc ZerlegeZahl ( n )
{
Flow control: if … thenif !quiet
Instructions: putput Constants: nlnl, "---- start ----"
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var zeit = Numeric functions: nownow
Instructions: var How does VScript::Value() work?: Var*&var r = FindPrimes(n)
zeit = now-zeit
Flow control: if … thenif quiet
Instructions: putput Constants: nlnl, n, " = ", r.a, " * ", r.b, " + ", r.r
Flow control: if … then Flow control: try … thenelse
Instructions: putput Constants: nlnl, n, " = ", r.a, " * ", r.b, " + ", r.r
Instructions: putput Constants: nlnl,"Zeit = ", Numeric functions: intint(zeit*1000)/1000
Instructions: putput Constants: nlnl,"Tests/s = ", Numeric functions: intint((Numeric functions: intint(Numeric functions: sqrtsqrt(n))-r.a+2)/2/zeit+0.5)
Instructions: putput Constants: nlnl,"--- finished ----",Constants: nlnl
Flow control: if … then Flow control: try … thenthen
}
Instructions: procproc RunTest ( prime_a, prime_b )
{
Flow control: if … thenif !quiet
Instructions: putput Constants: nlnl, "---- start ----"
Flow control: if … then Flow control: try … thenthen
Instructions: var How does VScript::Value() work?: Var*&var n = prime_a*prime_b
Instructions: var How does VScript::Value() work?: Var*&var zeit = Numeric functions: nownow
Instructions: var How does VScript::Value() work?: Var*&var r = FindPrimes(n)
zeit = now-zeit
Flow control: if … thenif quiet
Instructions: putput Constants: nlnl, n, " = ", r.a, " * ", r.b, " + ", r.r
Flow control: if … then Flow control: try … thenelse
Instructions: putput Constants: nlnl,"faktor a = ", r.a, {" (ok)"," ("#prime_a #")"}[1+(r.a!=prime_a)]
Instructions: putput Constants: nlnl,"faktor b = ", r.b, {" (ok)"," ("#prime_b #")"}[1+(r.b!=prime_b)]
Instructions: putput Constants: nlnl,"rest r = ", r.r, {" (ok)"," ("#n-r.a*r.b#")"}[1+(r.r!=n-r.a*r.b)]
Instructions: putput Constants: nlnl,"produkt = ", r.a*r.b, {" (ok)"," ("#n #")"}[1+(r.a*r.b!=n)]
Instructions: putput Constants: nlnl,"Zeit = ", Numeric functions: intint(zeit*1000)/1000
Instructions: putput Constants: nlnl,"Tests/s = ", Numeric functions: intint((Numeric functions: intint(Numeric functions: sqrtsqrt(n))-r.a+2)/2/zeit+0.5)
Instructions: putput Constants: nlnl,"--- finished ----",Constants: nlnl
Flow control: if … then Flow control: try … thenthen
}
Flow control: if … thenif !quiet Instructions: putput Constants: nlnl, "Primzahlzerlegung" Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif testloops==0
ZerlegeZahl(testzahl);
Flow control: end Shell Immediate Commands: exit, quit, endend 0
Flow control: if … then Flow control: try … thenthen
Flow control: do … loopdo
Flow control: whilewhile testloops--
Flow control: do … loopdo // erzeuge zwei Primzahlen
Instructions: var How does VScript::Value() work?: Var*&var prime_a = NewPrime( bits_a )
Instructions: var How does VScript::Value() work?: Var*&var prime_b = NewPrime( bits_b )
Flow control: untiluntil prime_a < prime_b
Flow control: do … looploop
Flow control: if … thenif !quiet
Instructions: var How does VScript::Value() work?: Var*&var n = prime_a * prime_b
Instructions: putput Constants: nlnl, "Prime a = ",prime_a, " (", Numeric functions: intint(Numeric functions: log2log2(prime_a+1))+1, " Bit)"
Instructions: putput Constants: nlnl, "Prime b = ",prime_b, " (", Numeric functions: intint(Numeric functions: log2log2(prime_b+1))+1, " Bit)"
Instructions: putput Constants: nlnl, "Produkt n = ",n, " (", Numeric functions: intint(Numeric functions: log2log2(n+1))+1, " Bit)"
Instructions: putput Constants: nlnl, "Wurzel n = ",Numeric functions: sqrtsqrt n
Instructions: putput Constants: nlnl, "Faktor b/a = ",Numeric functions: intint(prime_b/prime_a*100)/100
Instructions: putput Constants: nlnl, "Prüfe Rechengenauigkeit ... "
Instructions: var How does VScript::Value() work?: Var*&var t1 = PrüfeRechengenauigkeit(prime_a,prime_b)
Instructions: putput t1
Instructions: putput Constants: nlnl, "Prüfe Algorithmus ... "
Instructions: var How does VScript::Value() work?: Var*&var t2 = PrüfeAlgorithmus(prime_a,prime_b)
Instructions: putput t2
Flow control: if … thenif t1#t2 != "okok" Flow control: end Shell Immediate Commands: exit, quit, endend 1 Flow control: if … then Flow control: try … thenthen
Flow control: if … then Flow control: try … thenthen
RunTest(prime_a,prime_b);
Flow control: do … looploop
Flow control: end Shell Immediate Commands: exit, quit, endend
List functions: thisThis is a simple Appendix: Speedspeed test i wrote in Flow control: if … then Flow control: try … thenthe early days of vipsi. It Flow control: do … loopdoes some fancy stuff Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Numeric functions: countcounts, how often it can Flow control: do … loopdo it in 10 seconds. Flow control: if … then Flow control: try … thenThen Flow control: if … then Flow control: try … thenthe result is normalized to a Glossary: Valuevalue i got Flow control: if … then Flow control: try … thenthen on my P4@2.53GHz. That result i called one megaboogie.
I ran it right Numeric functions: nownow again Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and i got 0.86 megaboogies. Hm, either a donkey sucks Flow control: if … then Flow control: try … thenthe water from my water cooling, Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or some added error checkings slow it down. Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"Or, dare Operators: Bitwise Not "~" Operators: Boolean Negation "!"not believe it, it's got slower since.
Flow control: if … thenIf you think that 710 Flow control: do … looploops in 10 seconds, which i obviously achieved on my P4, are poor: ok, it's Operators: Bitwise Not "~" Operators: Boolean Negation "!"not dread fast. But Flow control: if … then Flow control: try … thenthe Flow control: do … looploop also contains a Functions with varying return types: call Instructions: callcall to fak(100), that means a 100 times recursive Functions with varying return types: call Instructions: callcalls to Flow control: if … then Flow control: try … thenthe Easy Example Scripts: Factorial "!"factorial Instructions: procproc, Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and it's doing some heavy Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist operations. Operators: Bitwise Not "~" Operators: Boolean Negation "!"Not that bad.
Update: With version 0.8.8 introduced Glossary: Variable, var_refvariable Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername hashing my P4 runs Operators: Make Identifier "@"at 1.70 megaboogies. Impressive Appendix: Speedspeed bump. B-)
Just take a look Operators: Make Identifier "@"at Flow control: if … then Flow control: try … thenthe source to Instructions: getget a feeling for Flow control: if … then Flow control: try … thenthe vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript language.
speedometer.vs
#!/usr/local/bin/vipsi
// Appendix: Speedspeed test
// calibrated to yield approx. 1.00 on my P4
Instructions: putput Constants: nlnl, "hi, i'm vipsi!"
Instructions: putput Constants: nlnl, "Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and i'm incredibly fast! ..."
Instructions: waitwait 1
Instructions: putput Constants: nlnl
Instructions: putput Constants: nlnl, "let's make Flow control: if … then Flow control: try … thenthe test."
Instructions: putput Constants: nlnl, "calculating... "
Instructions: deldel *
Instructions: var How does VScript::Value() work?: Var*&var ta = Numeric functions: nownow
Instructions: var How does VScript::Value() work?: Var*&var dt = 10
Instructions: var How does VScript::Value() work?: Var*&var te = Numeric functions: nownow + dt
Instructions: var How does VScript::Value() work?: Var*&var z,l,i,j
Instructions: var How does VScript::Value() work?: Var*&var s = "|/-\\", si = 1, st=ta
Instructions: procproc fak(n) { Flow control: if … thenif n<=1 Flow control: returnreturn 1 Flow control: if … then Flow control: try … thenelse Flow control: returnreturn fak(n-1)*n Flow control: if … then Flow control: try … thenthen }
i=0
Flow control: do … loopdo
Flow control: whilewhile Numeric functions: nownow < te
i++
Flow control: if … thenif Numeric functions: nownow>st st+=0.100 Instructions: putput s[1+si++%4],"\b" Flow control: if … then Flow control: try … thenthen
fak(100)
l = {0,1,2,3,4,5,6,7,8,9}
l ##= l+10
l ##= l+20
l ##= l+40
l ##= l+80 l=l[to 100]
Flow control: if … thenif Numeric functions: minmin(l)!=0 Numeric functions: log Numeric functions: loge Instructions: loglog "booboo1",Constants: nlnl Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif Numeric functions: maxmax(l)!=99 Numeric functions: log Numeric functions: loge Instructions: loglog "booboo2",Constants: nlnl Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
z = l;
j=0 Flow control: do … loopdo Flow control: whilewhile ++j<=100 Instructions: swapswap z[1+Numeric functions: randomrandom 100], z[1+Numeric functions: randomrandom 100] Flow control: do … looploop
Instructions: sortsort z
Flow control: if … thenif z!=l Numeric functions: log Numeric functions: loge Instructions: loglog "booboo3",Constants: nlnl Numeric functions: log Numeric functions: loge Instructions: loglog z,Constants: nlnl Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
z = ""
j=0 Flow control: do … loopdo Flow control: whilewhile ++j<=100 z#=l[j] Flow control: do … looploop
Flow control: if … thenif z[to 20]!="01234567891011121314" Numeric functions: log Numeric functions: loge Instructions: loglog "booboo4",Constants: nlnl Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Flow control: do … looploop
Instructions: putput " ",Constants: nlnl
Instructions: putput "yeah! i made ",i," Flow control: do … looploops in ",dt," seconds!",Constants: nlnl
Instructions: putput "that's nearly ",i/dt/710," megaboogies!",Constants: nlnl
Instructions: putput "unbelievable...",Constants: nlnl
Flow control: returnreturn i/dt/710 # " megaboogies"
Flow control: end Shell Immediate Commands: exit, quit, endend
List functions: thisThis is Flow control: if … then Flow control: try … thenthe primary test suite used to test Flow control: if … then Flow control: try … thenthe interpreter. Lots of test are missing. Yes, i know. Send in what ever you like...
Flow control: if … then Flow control: try … thenThe test suite is part of every distribution Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and List functions: thisthis 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 may Operators: Bitwise Not "~" Operators: Boolean Negation "!"not be up to date.
test_suite/
#!/usr/local/bin/vipsi
/* ---- vipsi test Example Scripts: CGI Scripts Example Scripts: Scriptsscript ----------------------------
test a lot of vipsi functionality
Operators: Add to Variable "+=" Operators: Add "+"add more tests as you like ...
demonstrates syntax Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and capabilities as well
kio 2001-08-24
kio 2002-03-09
kio 2002-03-31
kio 2003-08-14
kio 2004-06-21 List functions: split Instructions: splitsplit into Functions with varying return types: include Instructions: includeinclude Text functions: file Instructions: filefiles
*/
Instructions: putput Constants: nlnl,Constants: nlnl,"test Example Scripts: CGI Scripts Example Scripts: Scriptsscript for vipsi",Constants: nlnl
Flow control: if … thenif Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl, Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals, " List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariable", "s"[Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals>1],
" already defined:", Constants: nlnl
{
Instructions: var How does VScript::Value() work?: Var*&var i=1;
Flow control: do … loopdo
Flow control: whilewhile i<Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals // List functions: globals Shell Immediate Commands: globalsglobals[Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals] = List functions: localslocal { … }
Flow control: if … thenif Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername List functions: globals Shell Immediate Commands: globalsglobals[i]!="" Numeric functions: log Numeric functions: loge Instructions: loglog Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername List functions: globals Shell Immediate Commands: globalsglobals[i], " = "
Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog "unnamed Glossary: Variable, var_refvariable: " Flow control: if … then Flow control: try … thenthen
Numeric functions: log Numeric functions: loge Instructions: loglog List functions: globals Shell Immediate Commands: globalsglobals[i], Constants: nlnl
i=i+1
Flow control: do … looploop
}
Flow control: if … then Flow control: try … thenthen
Instructions: deldel *
Instructions: var How does VScript::Value() work?: Var*&var a,b,c,d
Instructions: var How does VScript::Value() work?: Var*&var err = 0;
Instructions: var How does VScript::Value() work?: Var*&var errors = 0
Instructions: var How does VScript::Value() work?: Var*&var e,f,g,h,n
err=0
// ----------------------------------------------------------
Instructions: putput Constants: nlnl,"basic test requirements "
Instructions: putput ".", 47+2; // just execute it
Instructions: putput ".", "123";
Instructions: putput "." n=1 Flow control: if … thenif 0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=2 a=4 Flow control: if … thenif a!=4 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=3 a++ Flow control: if … thenif a!=5 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=4 a-- Flow control: if … thenif a!=4 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=5 a=1 b=2 a=b Flow control: if … thenif a!=2||b!=2 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=6 a=3 Instructions: var How does VScript::Value() work?: Var*&var z=a Flow control: if … thenif a!=3||z!=3 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=7 Flow control: if … thenif 0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenelse ; Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=8 Flow control: if … thenif 0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=9 Flow control: if … thenif 1 ; Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=11 Flow control: if … thenif err!=0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=12 err++; Flow control: if … thenif err!=1 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=13 err--; Flow control: if … thenif err!=0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=14 Instructions: procproc trap(f) { Flow control: if … thenif f err++ Flow control: if … then Flow control: try … thenthen }
Instructions: putput "." n=15 trap(0) Flow control: if … thenif err!=0 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
Instructions: putput "." n=16 trap(1) Flow control: if … thenif err!=1 Numeric functions: log Numeric functions: loge Instructions: loglog "test ",n," failed" Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen err--
/* trap()
*/
Instructions: putput "." n=17 Instructions: procproc trap(f) { Instructions: putput "."; Flow control: if … thenif f err++ Numeric functions: log Numeric functions: loge Instructions: loglog "#",n," failed" Flow control: if … then Flow control: try … thenthen }
n=18 trap(0) Flow control: if … thenif err!=0 Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
/* assert()
*/
Instructions: putput "." n=19 Instructions: procproc assert(f) { Instructions: putput "."; Flow control: if … thenif !f; Numeric functions: log Numeric functions: loge Instructions: loglog "#",n," failed"; err++; Flow control: if … then Flow control: try … thenthen; }
n=20 assert(1) Flow control: if … thenif err Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
/* NaN
*/
Instructions: putput "." n=21 Instructions: var How does VScript::Value() work?: Var*&var nan = 0/0
n=22 Instructions: procproc IsNan(n){Flow control: returnreturn n!=n}
/* inf
*/
Instructions: putput "." n=24 Instructions: var How does VScript::Value() work?: Var*&var inf = 1e99999 /* > 18 bit exponent */
n=25 Instructions: procproc IsInf(n){Flow control: returnreturn n+1==n-1 }
Instructions: putput " passed",Constants: nlnl
Instructions: putput Constants: nlnl,"inf, nan, +0, -0 "
Flow control: try … thentry
n=1 assert(IsNan(nan))
n=2 assert(IsInf(inf))
n=3 assert(inf==inf+1) Flow control: if … thenif err Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
n=4 assert(inf==inf-1) Flow control: if … thenif err Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: if … then Flow control: try … thenthen
n=5 assert(inf*-1==-inf)
n=6 assert(IsNan(inf/inf))
n=10 Instructions: putput"." Flow control: try … thentry a=1e777777777 Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog"#10 failed" err++ Flow control: if … then Flow control: try … thenthen
n=11 Instructions: putput"." Flow control: try … thentry a=-1e777777777 Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog"#11 failed" err++ Flow control: if … then Flow control: try … thenthen
n=12 Instructions: putput"." Flow control: try … thentry a=1e-777777777 Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog"#12 failed" err++ Flow control: if … then Flow control: try … thenthen
n=13 Instructions: putput"." Flow control: try … thentry a=-1e-777777777 Flow control: if … then Flow control: try … thenelse Numeric functions: log Numeric functions: loge Instructions: loglog"#13 failed" err++ Flow control: if … then Flow control: try … thenthen
n=14 assert( 1e-77777777 == -1e-77777777 ) // +0 == -0
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog "test#",n," bummered: ", error.message
err++
Flow control: if … then Flow control: try … thenthen
Flow control: if … thenif !err Instructions: putput " passed" Flow control: if … then Flow control: try … thenelse errors+=err err=0 Flow control: if … then Flow control: try … thenthen
//Instructions: cd Shell Immediate Commands: cdcd (Text functions: fullpathfullpath(".") # "00_test.vs")[to Numeric functions: rfindrfind(Text functions: fullpathfullpath(".") # "00_test.vs","/")]
//Instructions: var How does VScript::Value() work?: Var*&var d = List functions: env Shell Immediate Commands: env Shell Immediate Commands: envenv._
//Instructions: cd Shell Immediate Commands: cdcd d[to Numeric functions: rfindrfind(d,"/")]
Instructions: cd Shell Immediate Commands: cdcd job.Example Scripts: CGI Scripts Example Scripts: Scriptsscript[to Numeric functions: rfindrfind(job.Example Scripts: CGI Scripts Example Scripts: Scriptsscript,"/")] // own Functions with varying return types: include Instructions: includeincludes
Functions with varying return types: include Instructions: includeinclude "each_and_every.vs"
a=0
Functions with varying return types: include Instructions: includeinclude "operators_compare.vs"
b=0
Functions with varying return types: include Instructions: includeinclude "operators_numeric.vs"
Functions with varying return types: include Instructions: includeinclude "operators_text.vs"
Functions with varying return types: include Instructions: includeinclude "operators_pruning.vs"
Functions with varying return types: include Instructions: includeinclude "functions_text.vs"
Functions with varying return types: include Instructions: includeinclude "functions_numeric.vs"
Functions with varying return types: include Instructions: includeinclude "functions_list.vs"
Functions with varying return types: include Instructions: includeinclude "Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiernames.vs"
Functions with varying return types: include Instructions: includeinclude "instructions_branching.vs"
Functions with varying return types: include Instructions: includeinclude "Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedures.vs"
Functions with varying return types: include Instructions: includeinclude "variable_protection.vs"
Instructions: var How does VScript::Value() work?: Var*&var wdir = Text functions: fullpathfullpath "."
Functions with varying return types: include Instructions: includeinclude "include_sys_call.vs"
Instructions: cd Shell Immediate Commands: cdcd wdir
Functions with varying return types: include Instructions: includeinclude "files_etc.vs"
Instructions: cd Shell Immediate Commands: cdcd wdir
Flow control: try … thentry
Functions with varying return types: include Instructions: includeinclude "old_bugs.vs"
Flow control: if … then Flow control: try … thenelse
Numeric functions: log Numeric functions: loge Instructions: loglog Constants: nlnl,«Functions with varying return types: include Instructions: includeinclude "old_bugs.vs" bummered: »,error.message err++
Flow control: if … then Flow control: try … thenthen
// ----------------------------------------------------------
Flow control: if … thenif errors
Instructions: putput Constants: nlnl," ",Constants: nlnl
Numeric functions: log Numeric functions: loge Instructions: loglog "--- ",errors," errors total ---"
Instructions: putput Constants: nlnl
Flow control: if … then Flow control: try … thenelse
Instructions: putput Constants: nlnl," ",Constants: nlnl,"+++ all tests passed +++",Constants: nlnl,Constants: nlnl
Flow control: if … then Flow control: try … thenthen
Flow control: end Shell Immediate Commands: exit, quit, endend
| |