There are basically three Modes of Operationmodes of operation: Modes of Operation: Interactive Shellinteractive shell, running a Modes of Operation: Shell Scriptsshell script Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and running a Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi script.
Flow control: if … thenIf vipsi is launched without any command line Vipsi command syntax: Arguments Glossary: Argumentsarguments, it starts in interactive mode. First it prints a greeting Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and how to Instructions: getget help:
[localhost:~] kio% vipsi
vipsi - VIP Example Scripts: CGI Scripts Example Scripts: ScriptsScript Interpreter 0.8.3 (c) 2001-2003 kio@little-bat.de
development release. please set your terminal to utf-8 Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and vt100.
see <vipsi.sourceforge.net> for latest documentation.
vipsi is waiting for your commands.
type an Vipsi command syntax: Expressions Glossary: Expressionexpression to calculate Flow control: if … then Flow control: try … thenthe result.
type «List functions: words Shell Immediate Commands: wordswords» for a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist of List functions: words Shell Immediate Commands: wordswords.
type «Text functions: info Shell Immediate Commands: infoinfo "foo"» for Text functions: info Shell Immediate Commands: infoinfo on List functions: words Shell Immediate Commands: wordsword «foo».
use «pd_up» Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and «pd_dn» for Interactive Shell: Historyhistory.
type ctrl-D to Shell Immediate Commands: exit, quit, endquit.
vipsi>
Flow control: if … then Flow control: try … thenThen it Instructions: readreads Vipsi command syntax: Instructions Instructions Glossary: Instructioninstructions line by line Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and executes Flow control: if … then Flow control: try … thenthem in turn.
vipsi> List functions: dir Instructions: dir Shell Immediate Commands: dirdir ""
Host: localhost; User: kio(staff); SysLoad: 0.38,0.35,0.33
Time: 2002-04-24 20:00:28; Booted: 2002-04-24 17:57:33 (2h:2m:55s);
volume Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername dir: flagsflags free modified
------------------------------- ---- ---------- -------------------
/ drwx 7.688 GB 2002-04-24 18:00:00
/Volumes/HD40 drwx 1.507 GB 2002-04-22 15:29:14
vipsi>
Standard input is bold Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or colored by vipsi Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and error messages are inverted Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and red. You can set List functions: thisthis in a Appendix: Preferences Filespreferences file.
Flow control: if … thenIf an error occurs Flow control: whilewhile executing your command, Flow control: if … then Flow control: try … thenthe appropriate message is displayed inverted Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and red Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe bogus line is offered for input again, with Flow control: if … then Flow control: try … thenthe cursor positioned to to location where Flow control: if … then Flow control: try … thenthe parser stalled.
vipsi> Numeric functions: sinsin("apfelkuchen")*22
***** Operators: Bitwise Not "~" Operators: Boolean Negation "!"not a Glossary: number, num_valnumber
vipsi> Numeric functions: sinsin("apfelkuchen")*22
Flow control: if … then Flow control: if … thenIf the Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction typed in is an Vipsi command syntax: Expressions Glossary: Expressionexpression which returned a result, List functions: thisthis result is automagically printed for your convenience:
vipsi> 998.00 * 1.18 = 1177.64
vipsi>
Results are automagically printed only in Modes of Operation: Interactive Shellinteractive shell mode, Operators: Bitwise Not "~" Operators: Boolean Negation "!"not when running a Example Scripts: CGI Scripts Example Scripts: Scriptsscript.
Interactive Shell: PreferencesPreferences are Instructions: readread from /usr/local/lib/vipsi/shell.prefs Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or, Flow control: if … thenif existent, from Text functions: file Instructions: filefile ~/.vipsi/shell.prefs. Flow control: if … then Flow control: try … thenThe Appendix: Preferences Filespreferences file contains a Literals: List literals Lists and arrays: List literalslist literal according to Flow control: if … then Flow control: try … thenthe vip Example Scripts: CGI Scripts Example Scripts: Scriptsscript language Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and is evaluated similar to Functions with varying return types: eval Instructions: evaleval. Operators: Bitwise Not "~" Operators: Boolean Negation "!"Not much Interactive Shell: Preferencespreferences can be set yet, most useful is setting colors for Constants: stdinstdin, Constants: stdoutstdout Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Constants: stderrstderr Flow control: if … thenif you have problems with Flow control: if … then Flow control: try … thenthe default magic.
Flow control: if … then Flow control: try … thenThe Interactive Shell: Historyhistory of typed-in commands is available with <pd_up> Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and <pd_dn>.
When vipsi is started with a filename as command line Vipsi command syntax: Arguments Glossary: Argumentsargument, Flow control: if … then Flow control: try … thenthen it loads that Text functions: file Instructions: filefile Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and executes it.
[localhost:~] kio% vipsi test.vs
List functions: thisThis runs Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript test.vs.
Flow control: if … thenIf all is set up properly, a Example Scripts: CGI Scripts Example Scripts: Scriptsscript can also be started like a program:
[localhost:~] kio% ./test.vs
List functions: thisThis Instructions: requirerequires that vipsi is installed Operators: Make Identifier "@"at Flow control: if … then Flow control: try … thenthe recommended position in /usr/bin/ Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or that a Text functions: link Instructions: linklink is placed there, Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and that Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript Text functions: file Instructions: filefile starts with Flow control: if … then Flow control: try … thenthe line #!/usr/local/bin/vipsi telling Flow control: if … then Flow control: try … thenthe system which interpreter to start Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and that Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript Text functions: file Instructions: filefile is tagged as executable with chmod a+x test.vs Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and that Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript is in Flow control: if … then Flow control: try … thenthe system's command search path Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or that you type in Flow control: if … then Flow control: try … thenthe full path to Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript.
You may pass Vipsi command syntax: Arguments Glossary: Argumentsarguments to a Example Scripts: CGI Scripts Example Scripts: Scriptsscript:
[localhost:~] kio% vipsi test.vs anton bärbel cicero
Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or
[localhost:~] kio% ./test.vs anton bärbel cicero
These command line Vipsi command syntax: Arguments Glossary: Argumentsarguments are stored into List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables. Because Flow control: if … then Flow control: try … thenthe passed data has no Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername on it's own, these List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables remain unnamed. How Flow control: if … then Flow control: try … thenthe Data Types: Text Item selector "[]": Text Glossary: text, text_valtext appended to Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername as command line Vipsi command syntax: Arguments Glossary: Argumentsarguments is mixed up depends on your shell, but as a first rule of thumb expect that white space separates individual Vipsi command syntax: Arguments Glossary: Argumentsarguments.
So Flow control: if … then Flow control: try … thenthe examples above result in 3 Vipsi command syntax: Arguments Glossary: Argumentsarguments with Flow control: if … then Flow control: try … thenthe Glossary: Valuevalue "anton", "bärbel" Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and "cicero".
Flow control: if … then Flow control: try … thenThe following code snipped from a Example Scripts: CGI Scripts Example Scripts: Scriptsscript shows how to access Flow control: if … then Flow control: try … thenthem:
#!/usr/local/bin/vipsi
Syntax Cave-ats: var argc = count globals - 1var argc = count globals - 1;
Instructions: putput Constants: nlnl, "test Example Scripts: CGI Scripts Example Scripts: Scriptsscript", Constants: nlnl
Instructions: putput Constants: nlnl, "you passed ", argc, " Vipsi command syntax: Arguments Glossary: Argumentsarguments:", Constants: nlnl
Instructions: var How does VScript::Value() work?: Var*&var i = 0
Flow control: do … loopdo
Flow control: whilewhile ++i <= argc
Instructions: putput "arg[", i, "] = ", List functions: globals Shell Immediate Commands: globalsglobals[i], Constants: nlnl
Flow control: do … looploop
Flow control: end Shell Immediate Commands: exit, quit, endend
It's just that simple: all List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables are stored in a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist Glossary: Variable, var_refvariable which is called List functions: globals Shell Immediate Commands: globalsglobals. You can access all List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables which you defined with Instructions: newnew Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Instructions: var How does VScript::Value() work?: Var*&var either by their Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or by their position in Flow control: if … then Flow control: try … thenthe List functions: globals Shell Immediate Commands: globalsglobals Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist Glossary: Variable, var_refvariable, whichever suits best. For command line Vipsi command syntax: Arguments Glossary: Argumentsarguments it's clearly better to access Flow control: if … then Flow control: try … thenthem by position, because they are unnamned. B-)
You may ask, why 1 was subtracted when calculating Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber of Vipsi command syntax: Arguments Glossary: Argumentsarguments:
Vipsi command syntax: Expressions Glossary: ExpressionExpressions are always evaluated from left to right. Vipsi command syntax: Functions Functions Glossary: FunctionFunctions Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Vipsi command syntax: Operators Operators Glossary: Operatoroperators as soon as their Vipsi command syntax: Arguments Glossary: Argumentsarguments are complete. Numeric functions: countcount List functions: globals Shell Immediate Commands: globalsglobals is executed after Instructions: var How does VScript::Value() work?: Var*&var argc, Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and therefore Flow control: if … then Flow control: try … thenthe Glossary: Variable, var_refvariable argc already Numeric functions: existsexists when Numeric functions: countcount Numeric functions: countcounts Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber of List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables. So Flow control: if … then Flow control: try … thenthe Numeric functions: countcount will Functions with varying return types: include Instructions: includeinclude Glossary: Variable, var_refvariable argc Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and we Operators: Subtract from Variable "-=" Operators: Subtract "-"subtract 1 for that fact.
Flow control: if … thenIf an error occurs, Flow control: if … then Flow control: try … thenthe execution of Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript is aborted Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and an error message is printed indicating Flow control: if … then Flow control: try … thenthe error Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and position in Flow control: if … then Flow control: try … thenthe Text functions: file Instructions: filefile. Flow control: if … then Flow control: try … thenThe indicated position may be slightly behind Flow control: if … then Flow control: try … thenthe error. Flow control: if … then Flow control: if … thenIf the error occured in a Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure, Flow control: if … then Flow control: try … thenthe position in Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure is indicated (Flow control: if … thenif possible) Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Flow control: if … then Flow control: try … thenthe position, where Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure was called. Flow control: if … then Flow control: try … thenThe error message contains a stack trace:
vipsi> Instructions: procproc a(w) { Flow control: if … thenif w a(w-1) Flow control: if … then Flow control: try … thenelse fsdfsfj Flow control: if … then Flow control: try … thenthen }
vipsi> a(3)
***** Glossary: Variable, var_refVariable "fsdfsfj" Operators: Bitwise Not "~" Operators: Boolean Negation "!"not found
in: a()
in: a()
in: a()
in: a()
vipsi> a(3)
A Example Scripts: CGI Scripts Example Scripts: Scriptsscript may optionally Flow control: returnreturn a result Glossary: Valuevalue. Whether it is expected so Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and which Glossary: Valuevalues are acceptable depends on Flow control: if … then Flow control: try … thenthe Functions with varying return types: call Instructions: callcaller.
- Flow control: if … thenIf invoked from Flow control: if … then
Flow control: try … thenthe bash Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or similar, Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript Instructions: getgets called via Flow control: if … then Flow control: try … thenthe unix process forking mechanism. Flow control: if … then Flow control: try … thenThen you can Flow control: returnreturn only tiny little integers in range [0 to 255]. List functions: thisThis Shell Scripts: Return values Appendix: Return valuesreturn value is expected to be some kind of error code, Operators: Bitwise Not "~" Operators: Boolean Negation "!"not Flow control: if … then Flow control: try … thenthe "result" of Flow control: if … then Flow control: try … thenthe program. 0 typically means 'success' any other Glossary: Valuevalue indicates an error. Flow control: if … thenIf a Example Scripts: CGI Scripts Example Scripts: Scriptsscript Flow control: do … loopdoes Operators: Bitwise Not "~" Operators: Boolean Negation "!"not Flow control: returnreturn a result, that is, Flow control: if … thenif it executes Flow control: end Shell Immediate Commands: exit, quit, endend with no Vipsi command syntax: Arguments Glossary: Argumentsargument Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or runs beyond Flow control: if … then Flow control: try … thenthe Text functions: file Instructions: filefile Flow control: end Shell Immediate Commands: exit, quit, endend, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe Shell Scripts: Return values Appendix: Return valuesreturn value is set to 0, which is likely to indicate 'no error'. Don't rely on Flow control: if … then Flow control: try … thenthe exact Glossary: Valuevalue of Flow control: if … then Flow control: try … thenthe Flow control: returnreturn code! Flow control: if … then Flow control: try … thenThe bash itself Flow control: returnreturns 126 Flow control: if … thenif a command was found but Operators: Bitwise Not "~" Operators: Boolean Negation "!"not executable, 127 Flow control: if … thenif a command was Operators: Bitwise Not "~" Operators: Boolean Negation "!"not found, 128+N Flow control: if … then Flow control: if … thenif the command crashed with exception N Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and possibly any other error code for other Flow controlconditions. In Operators: Add "+"addition vipsi Flow control: returnreturns 125 in Flow control: if … then Flow control: try … thenthe following cases: Flow control: if … then Flow control: if … thenif the Example Scripts: CGI Scripts Example Scripts: Scriptsscript crashes with an error Flow control: if … then Flow control: try … thenthen List functions: thisthis error code is returned Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or 125 Flow control: if … then Flow control: if … thenif the error code was too high. Flow control: if … then Flow control: if … thenIf the Example Scripts: CGI Scripts Example Scripts: Scriptsscript Flow control: returnreturns a non-numeric Glossary: Valuevalue Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or a numeric Glossary: Valuevalue out of range, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe result is substituted with 125 too.
- Flow control: if … thenIf invoked 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 Flow control: if … then Flow control: try … thenthe vipsi command line using Text functions: sys Instructions: syssys Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript Instructions: getgets called in Flow control: if … then Flow control: try … thenthe same way as from Flow control: if … then Flow control: try … thenthe bash shell. All said there is true here too, except for Flow control: if … then Flow control: try … thenthe additional result codes used by Flow control: if … then Flow control: try … thenthe bash. Flow control: if … then Flow control: try … thenThe Shell Scripts: Return values Appendix: Return valuesreturn value from Flow control: if … then Flow control: try … thenthe invoked Example Scripts: CGI Scripts Example Scripts: Scriptsscript is Operators: Bitwise Not "~" Operators: Boolean Negation "!"not returned to Flow control: if … then Flow control: try … thenthe Functions with varying return types: call Instructions: callcaller, Flow control: if … then Flow control: try … thenthe Functions with varying return types: call Instructions: callcaller Instructions: getgets Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript output to Constants: stdoutstdout instead. Flow control: if … thenIf an error in Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript occurs Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Flow control: if … then Flow control: if … thenif the Example Scripts: CGI Scripts Example Scripts: Scriptsscript Flow control: returnreturns a non-zero Glossary: Valuevalue, Flow control: if … then Flow control: try … thenthen an error is triggered in Flow control: if … then Flow control: try … thenthe Functions with varying return types: call Instructions: callcaller Example Scripts: CGI Scripts Example Scripts: Scriptsscript which must be handled with Flow control: try … thentry. errorstr Flow control: if … then Flow control: try … thenthen contains some useful error message.
- Flow control: if … thenIf invoked 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 Flow control: if … then Flow control: try … thenthe vipsi command line using Functions with varying return types: call Instructions: callcall Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or Functions with varying return types: include Instructions: includeinclude, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript can Flow control: returnreturn a result of any type Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or optionally no result Operators: Make Identifier "@"at all. Flow control: if … then Flow control: if … thenIf the Functions with varying return types: call Instructions: callcaller Instructions: requirerequires a result Flow control: if … then Flow control: try … thenthen it will assume 0 Flow control: if … thenif Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: returnreturns no result.
- Flow control: if … then
Flow control: if … thenIf the Example Scripts: CGI Scripts Example Scripts: Scriptsscript is a Glossary: text, text_valtext value which is executed with Functions with varying return types: eval Instructions: evaleval, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript can Flow control: returnreturn a result of any type Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or optionally no result Operators: Make Identifier "@"at all. Flow control: if … then Flow control: if … thenIf the Functions with varying return types: call Instructions: callcaller Instructions: requirerequires a result Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: end Shell Immediate Commands: exit, quit, endend Flow control: returnreturns no result, Flow control: if … then Flow control: try … thenthen an error is generated.
vip Example Scripts: CGI Scripts Example Scripts: Scriptsscripts may be used to handle cgi requests. In order to be successfully called by Flow control: if … then Flow control: try … thenthe http server, Example Scripts: CGI Scripts Example Scripts: Scriptsscripts must be tagged as executable, must reside in a directory where Flow control: if … then Flow control: try … thenthe http server is willing to execute Example Scripts: CGI Scripts Example Scripts: Scriptsscripts Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and must of course start with Flow control: if … then Flow control: try … thenthe interpreter path in line 1:
#!/usr/local/bin/vipsi
Flow control: if … thenIf you decide to Instructions: putput Flow control: if … then Flow control: try … thenthe vipsi interpreter into another location on your web server, Flow control: if … then Flow control: try … thenthen your Example Scripts: CGI Scripts Example Scripts: Scriptsscripts must start with that according path.
Flow control: if … thenIf all that is done, your Example Scripts: CGI Scripts Example Scripts: Scriptsscripts can be called from your web browser, either directly Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or from a form.
Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi scripts are passed Vipsi command syntax: Arguments Glossary: Argumentsarguments from Flow control: if … then Flow control: try … thenthe URL Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or form data either with method Instructions: getGET Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or method POST. both are already handled Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and decoded for you by vipsi when Flow control: if … then Flow control: try … thenthe Example Scripts: CGI Scripts Example Scripts: Scriptsscript is started. Data passed to a Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi script is typically named. These Vipsi command syntax: Arguments Glossary: Argumentsarguments are stored in List functions: globals Shell Immediate Commands: globalsglobal Glossary: Variable, var_refvariables which are named according to those cgi parameter Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiernames.
Flow control: nextNext, Example Scripts: CGI Scripts Example Scripts: Scriptsscripts are supposed to send a proper html page (Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or any other proper formatted data) by simply printing to Constants: stdoutstdout. First come two lines of http header (thereof Flow control: if … then Flow control: try … thenthe second is empty) Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe html page; Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or a gif Text functions: file Instructions: filefile, Flow control: if … thenif you decided so.
Flow control: if … then Flow control: try … thenThe following example shows a simple Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi script, which presents it's cgi parameters in a table:
#!/usr/local/bin/vipsi
// http header:
Instructions: putput "content-type: Data Types: Text Item selector "[]": Text Glossary: text, text_valtext/html; charset=utf-8\n\n"
// html page, header etc.:
Instructions: putput «<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html><head><title>vipsi cgi test Example Scripts: CGI Scripts Example Scripts: Scriptsscript</title></head>
<body style="font-family:sans-serif;">
<h2>passed cgi parameters</h2>»
Instructions: var How does VScript::Value() work?: Var*&var argc = Numeric functions: countcount globals-1
Instructions: putput "<table><tr><td><b>Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername</b></td><td><b>Glossary: Valuevalue</b></td></tr>\n"
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 Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName = Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername List functions: globals Shell Immediate Commands: globalsglobals[i]
Text functions: convert Instructions: convertconvert Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName to printable
Text functions: convert Instructions: convertconvert Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName to html
Instructions: var How does VScript::Value() work?: Var*&var Glossary: ValueValue = List functions: globals Shell Immediate Commands: globalsglobals[i]
Text functions: convert Instructions: convertconvert Glossary: ValueValue to quoted
Text functions: convert Instructions: convertconvert Glossary: ValueValue to html
Instructions: putput "<tr><td>", Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, IdentifierName, "</td><td>", Glossary: ValueValue, "</td></tr>"
Flow control: do … looploop
Instructions: putput "</table></body></html>\n"
Flow control: end Shell Immediate Commands: exit, quit, endend
Flow control: if … thenIf your Example Scripts: CGI Scripts Example Scripts: Scriptsscript contains an error, vipsi Flow control: do … loopdoes it's best to display Flow control: if … then Flow control: try … thenthe error Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and position in Flow control: if … then Flow control: try … thenthe Modes of Operation: CGI Scripts Example Scripts: CGI Scriptscgi script in a html Text functions: file Instructions: filefile:
|