rivet-3.2.4/doc/html/rivet.css 000644 001750 001751 00000017240 14560012766 017011 0 ustar 00manghi manghi 000000 000000 BODY
{
font-family: verdana;
background-color: #fbfcfc;
}
DIV.ABSTRACT
{
border: solid 2px;
padding-left: 10pt;
padding-right: 10pt;
}
PRE.SCREEN
{
font-family:monospace;
white-space: pre;
width: 100%;
background-color: #ffffcc;
border:solid;
color: #000000;
border-color: #009999;
border-left: solid #009999 2px;
border-right: solid #009999 2px;
border-top: solid #009999 2px;
border-bottom: solid #009999 2px;
padding-left: 15pt;
}
PRE.PROGRAMLISTING
{
font-family: monospace;
white-space: pre;
width: 95%;
background-color: #e8ecf2;
border: solid;
color: #000000;
border-color: #a3b1bc;
border-left: solid #a3b1bc 1px;
border-right: solid #a3b1bc 1px;
border-top: solid #a3b1bc 1px;
border-bottom: solid #a3b1bc 1px;
font-size: normal;
padding-top: 1em;
padding-left: 1em;
padding-bottom: 1em;
font-size: 0.9em;
}
H1
{
color: #ffffff;
border: solid 3px #1d252b;
background-color: #a3b1bc;
font-variant: small-caps;
width: 100%;
}
H1.TITLE
{
color: #ffffff;
border: solid 3px #1d252b;
background-color: #a3b1bc;
font-variant: small-caps;
width: 100%;
}
.TITLE a {
color: #ffffff;
text-decoration: none;
}
.TITLE a:active {
color: #ffffff;
text-decoration: none;
}
.TITLE a:visited {
color: #ffffff;
text-decoration: none;
}
H2
{
COLOR: #ffffff ;
font-style: italic;
border: solid 3px #1d252b;
background-color: #a3b1bc;
PADDING: 0.5em;
}
TABLE.IMPORTANT
{
font-style:italic;
border: solid 2px #ff0000;
width: 70%;
margin-left: 15%;
}
TABLE.CAUTION
{
font-style:italic;
border: ridge 2px #ffff00;
width: 70%;
margin-left: 15%;
}
TABLE.NOTE
{
font-style:italic;
border: solid 1px #000000;
width: 70%;
margin-left: 15%;
}
TABLE.TIP
{
font-style:italic;
border: solid 1px #000000;
width: 70%;
margin-left: 15%;
}
TABLE.WARNING
{
font-style:italic;
font-weight: bold;
border: ridge 4px #ff0000;
width: 70%;
margin-left: 15%;
}
DIV.VARIABLELIST {
font-family: sans-serif;
font-style: normal;
font-weight: normal;
padding-left: 20px;
font-size: small;
}
.VARLISTENTRY {
font-weight: bold;
margin-top: 10px;
color: #ffffff ;
background-color: #e8ecf2;
border: solid 1px #a3b1bc;
padding: 1px
}
/*
* See http://diveintoaccessibility.org/day_26_using_relative_font_sizes.html
* for an explanation of the following few commands.
* They are really too complicated to explain here in all depth. ;-)
*/
P {
font-size: 12px;
}
/*
A{
color: maroon;
}
A:visited {
color: darkgreen;
}
*/
BODY P {
/* font-size: x-small; */
voice-family: "\"}\"";
voice-family: inherit;
font-size: normal;
}
HTML>BODY P {
font-size: normal;
}
/* */
/* Add an external-link icon to absolute links */
a[href^="http:"] {
background: url(images/remote.png) right center no-repeat;
padding-right: 12px;
}
a[href^="http:"]:hover {
background: url(images/remote.png) right center no-repeat;
}
/* Add a note icon to footnote links */
a[href^="#FTN"] {
background: url(images/qbullet-note.png) right center no-repeat;
padding-right: 12px;
}
a[href^="#FTN"]:hover {
background: url(images/qbullet-note.png) right center no-repeat;
}
/* ...and a back icon to the backlinks in the footnotes themselves */
a[name^="FTN"] {
background: url(images/scrollup.png) right center no-repeat;
padding-right: 12px;
}
a[name^="FTN"]:hover {
background: url(images/scrollup.png) right center no-repeat;
}
/* Add a download icon to .gz links */
a[href$=".gz"],a[href$=".tar"],a[href$=".zip"] {
background: url(images/disk.png) right center no-repeat;
padding-right: 12px;
}
/* Add an Acrobat Reader icon to PDF links */
a[href$=".pdf"] {
background: url(images/acrobat.png) right center no-repeat;
padding-right: 12px;
}
a[href$=".pdf"]:hover {
background: url(images/acrobat.png) right center no-repeat;
}
/* Add a Word icon to RTF links */
a[href$=".rtf"] {
background: url(images/word.png) right center no-repeat;
padding-right: 12px;
}
/* ...but not to absolute links in this domain... */
a[href^="http://www.karakas-online.de"] {
background: transparent;
padding-right: 0px;
}
a[href^="http://www.karakas-online.de"]:hover {
background: transparent;
}
/* ...or to the translation links on each page */
DIV.translatelink > a[href^="http:"] {
background: transparent;
padding-right: 0px;
}
DIV.translatelink > a[href^="http:"]:hover {
background: transparent;
}
/* ...or to any images */
DIV.imagelink a[href^="http:"] {
background: transparent;
padding-right: 0px;
}
DIV.imagelink a[href^="http:"]:hover {
background: transparent;
}
P.C2 {
COLOR: #ffffff ;
BACKGROUND-color: #a0a0d0;
BORDER: solid 1px #606090;
PADDING: 1px
}
DIV.NAVFOOTER {
color: #000000;
background-color: #e8ecf2;
padding: 5px;
margin-top: 10px;
width: 100%;
border: 2px solid #a3b1bc;
}
DIV.NUKEFOOTER {
color: #000000;
background-color: #e8ecf2;
padding: 5px;
margin-top: 10px;
width: 100%;
border: thin solid #a3b1bc;
}
DIV.NAVHEADER {
color: #000000;
background-color: #e8ecf2;
padding: 5px;
margin-bottom: 10px;
width: 100%;
border: 2px solid #a3b1bc;
}
DIV.SECT1,DIV.SECT2,DIV.SECT3 {
margin-left: 20px;
}
DIV.EXAMPLE,DIV.TOC {
border: thin dotted #4e5f6e;
padding-left: 10px;
padding-right: 10px;
color: #000000;
background-color: #e8ecf2;
}
DIV.EXAMPLE {
border: thin dotted #22AA22;
background-color: #EEE;
}
DIV.TOC {
margin-left: 20px;
margin-right: 20px;
width: 95%;
}
UL {
/* list-style: url("images/tux-bullet.png") disc; */
}
.namespaces {
border: 1px solid black;
}
.namespaces td {
padding: 0.2em 1em;
/* font-weight: bold; */
}
.namespaces thead {
background-color: #aaf;
}
.namespaces tr.init {
background-color: #e88;
}
.namespaces tr.childinit {
background-color: #eee;
}
.namespaces tr.processing {
background-color: #e88;
}
.namespaces tr.childexit {
background-color: #eee;
}
table.directives {
border-collapse: collapse;
}
.directives thead {
background-color: #bbf;
font-size: 1em;
text-decoration: none;
}
.directives thead td {
padding: 8px;
}
.directives tbody tr > :first-child {
background-color: #eee;
padding-left: 2em;
padding-right: 2em;
text-align: left;
}
.directives tbody tr > :last-child {
text-decoration: none;
font-weight: normal;
font-size: small;
border-left: 1px solid black;
text-align: left;
}
.directives tbody tr td {
text-align: center;
text-decoration: none;
font-weight: normal;
padding-left: 1em;
padding-right: 1em;
padding-bottom: 4px;
padding-top: 4px;
border-bottom: 1px solid black;
}
.note td {
font-size: small;
}
li.listitem {
font-size: small;
}
rivet-3.2.4/rivet/packages/dio/dio.tcl 000644 001750 001751 00000066675 14560150664 020416 0 ustar 00manghi manghi 000000 000000 # dio.tcl -- implements a database abstraction layer.
# Copyright 2002-2004 The Apache Software Foundation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catch {package require Tclx}
package require Itcl
##set auto_path [linsert $auto_path 0 [file dirname [info script]]]
namespace eval ::DIO {
proc handle {interface args} {
set obj \#auto
set first [lindex $args 0]
if {![::rivet::lempty $first] && [string index $first 0] != "-"} {
set obj [lindex $args 0]
set args [lreplace $args 0 0]
}
uplevel \#0 package require dio_$interface
return [uplevel \#0 ::DIO::$interface $obj $args]
}
##
# DATABASE CLASS
##
::itcl::class Database {
constructor {args} {
eval configure $args
}
destructor {
close
}
#
# result - generate a new DIO result object for the specified database
# interface, with key-value pairs that get configured into the new
# result object.
#
protected method result {interface args} {
return [eval uplevel \#0 ::DIO::${interface}Result \#auto $args]
}
#
# quote - given a string, return the same string with any single
# quote characters preceded by a backslash
#
method quote {string} {
regsub -all {'} $string {\'} string
return $string
}
#
# build_select_query - build a select query based on given arguments,
# which can include a table name, a select statement, switches to
# turn on boolean AND or OR processing, and possibly
# some key-value pairs that cause the where clause to be
# generated accordingly
#
protected method build_select_query {args} {
set bool AND
set first 1
set req ""
set myTable $table
set what "*"
# for each argument passed us...
# (we go by integers because we mess with the index based on
# what we find)
for {set i 0} {$i < [llength $args]} {incr i} {
# fetch the argument we're currently processing
set elem [lindex $args $i]
switch -- [::string tolower $elem] {
"-and" {
# -and -- switch to AND-style processing
set bool AND
}
"-or" {
# -or -- switch to OR-style processing
set bool OR
}
"-table" {
# -table -- identify which table the query is about
set myTable [lindex $args [incr i]]
}
"-select" {
# -select -
set what [lindex $args [incr i]]
}
default {
# it wasn't -and, -or, -table, or -select...
# if the first character of the element is a dash,
# it's a field name and a value
if {[::string index $elem 0] == "-"} {
set field [::string range $elem 1 end]
set elem [lindex $args [incr i]]
# if it's the first field being processed, append
# WHERE to the SQL request we're generating
if {$first} {
append req " WHERE"
set first 0
} else {
# it's not the first variable in the comparison
# expression, so append the boolean state, either
# AND or OR
append req " $bool"
}
# convert any asterisks to percent signs in the
# value field
regsub -all {\*} $elem {%} elem
# if there is a percent sign in the value
# field now (having been there originally or
# mapped in there a moment ago), the SQL aspect
# is appended with a "field LIKE value"
if {[::string first {%} $elem] != -1} {
append req " $field LIKE [makeDBFieldValue $myTable $field $elem]"
} elseif {[regexp {^([<>]) *([0-9.]*)$} $elem _ fn val]} {
# value starts with <, or >, then space,
# and a something
append req " $field$fn$val"
} elseif {[regexp {^([<>]=) *([0-9.]*)$} $elem _ fn val]} {
# value starts with <= or >=, space, and something.
append req " $field$fn$val"
} else {
# otherwise it's a straight key=value comparison
append req " $field=[makeDBFieldValue $myTable $field $elem]"
}
continue
}
append req " $elem"
}
}
}
return "select $what from $myTable $req"
}
#
# build_insert_query -- given an array name, a list of fields, and
# possibly a table name, return a SQL insert statement inserting
# into the named table (or the object's table variable, if none
# is specified) for all of the fields specified, with their values
# coming from the array
#
protected method build_insert_query {arrayName fields {myTable ""}} {
upvar 1 $arrayName array
if {[::rivet::lempty $myTable]} { set myTable $table }
set vals [::list]
set vars [::list]
foreach field $fields {
if {![info exists array($field)]} { continue }
lappend vars "$field"
lappend vals "[makeDBFieldValue $myTable $field $array($field)]"
}
return "insert into $myTable ([join $vars {,}]) VALUES ([join $vals {,}])"
}
#
# build_update_query -- given an array name, a list of fields, and
# possibly a table name, return a SQL update statement updating
# the named table (or using object's table variable, if none
# is named) for all of the fields specified, with their values
# coming from the array
#
# note that after use a where clause still neds to be added or
# you might update a lot more than you bargained for
#
protected method build_update_query {arrayName fields {myTable ""}} {
upvar 1 $arrayName array
if {[::rivet::lempty $myTable]} { set myTable $table }
set string [::list]
foreach field $fields {
if {![info exists array($field)]} { continue }
lappend string "$field=[makeDBFieldValue $myTable $field $array($field)]"
}
return "UPDATE $myTable SET [join $string {,}]"
}
#
# lassign_array - given a list, an array name, and a variable number
# of arguments consisting of variable names, assign each element in
# the list, in turn, to elements corresponding to the variable
# arguments, into the named array. From TclX.
#
protected method lassign_array {list arrayName args} {
upvar 1 $arrayName array
foreach elem $list field $args {
set array($field) $elem
}
}
#
# configure_variable - given a variable name and a string, if the
# string is empty return the variable name, otherwise set the
# variable to the string.
#
protected method configure_variable {varName string} {
if {[::rivet::lempty $string]} { return [cget -$varName] }
configure -$varName $string
}
#
# build_where_key_clause - given a list of one or more key fields and
# a corresponding list of one or more key values, construct a
# SQL where clause that boolean ANDs all of the key-value pairs
# together.
#
protected method build_key_where_clause {myKeyfield myKey} {
## If we're not using multiple keyfields, just return a simple
## where clause.
if {[llength $myKeyfield] < 2} {
return " WHERE $myKeyfield = [makeDBFieldValue $table $myKeyfield $myKey]"
}
# multiple fields, construct it as a where-and
set req " WHERE 1 = 1"
foreach field $myKeyfield key $myKey {
append req " AND $field = [makeDBFieldValue $table $field $key]"
}
return $req
}
##
## makekey -- Given an array containing a key-value pairs and
# an optional list of key fields (we use the object's keyfield
# if none is specified)...
#
# if we're doing auto keys, create and return a new key,
# otherwise if it's a single key, just return its value
# from the array, else if it's multiple keys, return all their
# values as a list
##
method makekey {arrayName {myKeyfield ""}} {
if {[::rivet::lempty $myKeyfield]} { set myKeyfield $keyfield }
if {[::rivet::lempty $myKeyfield]} {
return -code error "No -keyfield specified in object"
}
upvar 1 $arrayName array
## If we're not using multiple keyfields, we want to check and see
## if we're using auto keys. If we are, create a new key and
## return it. If not, just return the value of the single keyfield
## in the array.
if {[llength $myKeyfield] < 2} {
if {$autokey} {
set array($myKeyfield) [$this nextkey]
} else {
if {![info exists array($myKeyfield)]} {
return -code error \
"${arrayName}($myKeyfield) does not exist"
}
}
return $array($myKeyfield)
}
## We're using multiple keys. Return a list of all the keyfield
## values.
foreach field $myKeyfield {
if {![info exists array($field)]} {
return -code error "$field does not exist in $arrayName"
}
lappend key $array($field)
}
return $key
}
method destroy {} {
::itcl::delete object $this
}
#
# string - execute a SQL request and only return a string of one row.
#
method string {req} {
set res [exec $req]
$res next -list val
$res destroy
return $val
}
#
# list - execute a request and return a list of the first element of each
# row returned.
#
method list {req} {
set res [exec $req]
set list ""
$res forall -list line {
lappend list [lindex $line 0]
}
$res destroy
return $list
}
#
# array - execute a request and setup an array containing elements
# with the field names as the keys and the first row results as
# the values
#
method array {req arrayName} {
upvar 1 $arrayName $arrayName
set res [exec $req]
set ret [$res next -array $arrayName]
$res destroy
return $ret
}
#
# forall - execute a SQL select and iteratively fill the named array
# with elements named with the matching field names, containing the
# matching values, executing the specified code body for each, in turn.
#
method forall {req arrayName body} {
upvar 1 $arrayName $arrayName
set res [exec $req]
$res forall -array $arrayName {
uplevel 1 $body
}
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
set ret [$res numrows]
$res destroy
return $ret
}
#
# table_check - internal method to populate the data array with
# a -table element containing the table name, a -keyfield element
# containing the key field or list of key fields, and a list of
# key-value pairs to get set into the data table.
#
# afterwards, it's an error if -table or -keyfield hasn't somehow been
# determined.
#
protected method table_check {list {tableVar myTable} {keyVar myKeyfield}} {
upvar 1 $tableVar $tableVar $keyVar $keyVar
set data(-table) $table
set data(-keyfield) $keyfield
::array set data $list
if {[::rivet::lempty $data(-table)]} {
return -code error -errorcode missing_table "-table not specified in DIO object"
}
set $tableVar $data(-table)
if {[::rivet::lempty $data(-keyfield)]} {
return -code error -errorcode missing_keyfield "-keyfield not specified in DIO object"
}
set $keyVar $data(-keyfield)
}
#
# key_check - given a list of key fields and a list of keys, it's
# an error if there aren't the same number of each, and if it's
# autokey, there can't be more than one key.
#
protected method key_check {myKeyfield myKey} {
if {[llength $myKeyfield] < 2} { return }
if {$autokey} {
return -code error "Cannot have autokey and multiple keyfields"
}
if {[llength $myKeyfield] != [llength $myKey]} {
return -code error "Bad key length."
}
}
#
# fetch - given a key (or list of keys) an array name, and some
# extra key-value arguments like -table and -keyfield, fetch
# the key into the array
#
method fetch {key arrayName args} {
table_check $args
key_check $myKeyfield $key
upvar 1 $arrayName $arrayName
set req "select * from $myTable"
append req [build_key_where_clause $myKeyfield $key]
set res [$this exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
set rows_found [expr [$res numrows] > 0]
$res next -array $arrayName
$res destroy
return $rows_found
}
#
# store - given an array containing key-value pairs and optional
# arguments like -table and -keyfield, insert or update the
# corresponding table entry.
#
method store {arrayName args} {
table_check $args
upvar 1 $arrayName $arrayName $arrayName array
if {[llength $myKeyfield] > 1 && $autokey} {
return -code error "Cannot have autokey and multiple keyfields"
}
set key [makekey $arrayName $myKeyfield]
set req "select * from $myTable"
append req [build_key_where_clause $myKeyfield $key]
set res [exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
set numrows [$res numrows]
$res destroy
if {$numrows} {
$this update $arrayName {*}$args
} else {
$this insert $myTable $arrayName
}
return 1
}
#
# update - a pure update, without store's somewhat clumsy
# efforts to see if it needs to be an update rather than
# an insert
#
method update {arrayName args} {
table_check $args
upvar 1 $arrayName $arrayName $arrayName array
set key [makekey $arrayName $myKeyfield]
set fields [::array names array]
set req [build_update_query array $fields $myTable]
append req [build_key_where_clause $myKeyfield $key]
set res [exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
# this doesn't work on postgres, you've got to use cmdRows,
# we need to figure out what to do with this
set numrows [$res numrows]
$res destroy
return $numrows
}
#
# update_with_explicit_key - an update where the key is specified
# as an argument to the proc rather than being dug out of the array
#
# this is a kludge until we come up with a better way to
# solve the problem of updating a row where we actually
# want to change the value of a key field
#
method update_with_explicit_key {key arrayName args} {
table_check $args
key_check $myKeyfield $key
upvar 1 $arrayName $arrayName $arrayName array
set fields [::array names array]
set req [build_update_query array $fields $myTable]
append req [build_key_where_clause $myKeyfield $key]
set res [exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
# this doesn't work on postgres, you've got to use cmdRows,
# we need to figure out what to do with this
set numrows [$res numrows]
$res destroy
return $numrows
}
#
# insert - a pure insert, without store's somewhat clumsy
# efforts to see if it needs to be an update rather than
# an insert -- this shouldn't require fields, it's broken
#
method insert {table arrayName} {
upvar 1 $arrayName $arrayName $arrayName array
set req [build_insert_query array [::array names array] $table]
set res [exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
$res destroy
return 1
}
#
# delete - delete matching record from the specified table
#
method delete {key args} {
table_check $args
set req "DELETE FROM $myTable"
append req [build_key_where_clause $myKeyfield $key]
set res [exec $req]
if {[$res error]} {
set errinf [$res errorinfo]
$res destroy
return -code error "Got '$errinf' executing '$req'"
}
set n_deleted_rows [$res numrows]
$res destroy
return $n_deleted_rows
}
#
# keys - return all keys in a table
#
method keys {args} {
table_check $args
set req "select * from $myTable"
set obj [$this exec $req]
set keys ""
$obj forall -array a {
lappend keys [makekey a $myKeyfield]
}
$obj destroy
return $keys
}
#
# search - construct and execute a SQL select statement using
# build_select_query style and return the result handle.
#
method search {args} {
set req [eval build_select_query $args]
return [exec $req]
}
#
# count - return a count of the specified (or current) table.
#
method count {args} {
# table_check returns an error if either a keyfield or a table were not set.
# In order to count the rows in a table we don't need a keyfield, so we check
# if table_check is returning missing_table and in case we rethrow the error,
# otherwise we continue
if {[catch {table_check $args} e]} {
if {$e != "missing_keyfield"} {
return -code error -errorcode $e "error in table_check ($e)"
}
}
return [string "select count(*) from $myTable"]
}
method makeDBFieldValue {table_name field_name val} {
return "'[quote $val]'"
}
method registerSpecialField {table_name field_name type} {
set specialFields(${table_name}@${field_name}) $type
}
##
## These are methods which should be defined by each individual database
## interface class.
##
method open {args} {}
method close {args} {}
method exec {args} {}
method nextkey {args} {}
method lastkey {args} {}
method now {} {}
method last_inserted_rec {} {}
##
## Functions to get and set public variables.
##
method interface {{string ""}} { return [configure_variable interface $string] }
method errorinfo {{string ""}} { return [configure_variable errorinfo $string] }
method db {{string ""}} { return [configure_variable db $string] }
method table {{string ""}} { return [configure_variable table $string] }
method keyfield {{string ""}} { return [configure_variable keyfield $string] }
method autokey {{string ""}} { return [configure_variable autokey $string] }
method sequence {{string ""}} { return [configure_variable sequence $string] }
method user {{string ""}} { return [configure_variable user $string] }
method pass {{string ""}} { return [configure_variable pass $string] }
method host {{string ""}} { return [configure_variable host $string] }
method port {{string ""}} { return [configure_variable port $string] }
protected variable specialFields
public variable interface ""
public variable errorinfo ""
public variable db ""
public variable table ""
public variable sequence ""
public variable user ""
public variable pass ""
public variable host ""
public variable port ""
protected method handle_client_arguments {cargs} { }
public variable clientargs "" {
handle_client_arguments $clientargs
}
public variable keyfield "" {
if {[llength $keyfield] > 1 && $autokey} {
return -code error "Cannot have autokey and multiple keyfields"
}
}
public variable autokey 0 {
if {[llength $keyfield] > 1 && $autokey} {
return -code error "Cannot have autokey and multiple keyfields"
}
}
} ; ## ::itcl::class Database
#
# DIO Result object
#
::itcl::class Result {
constructor {args} {
eval configure $args
}
destructor { }
method destroy {} {
::itcl::delete object $this
}
#
# configure_variable - given a variable name and a string, if the
# string is empty return the variable name, otherwise set the
# variable to the string.
#
protected method configure_variable {varName string} {
if {[::rivet::lempty $string]} { return [cget -$varName] }
configure -$varName $string
}
#
# lassign_array - given a list, an array name, and a variable number
# of arguments consisting of variable names, assign each element in
# the list, in turn, to elements corresponding to the variable
# arguments, into the named array. From TclX.
#
protected method lassign_array {list arrayName args} {
upvar 1 $arrayName array
foreach elem $list field $args {
set array($field) $elem
}
}
#
# seek - set the current row ID (our internal row cursor, if you will)
# to the specified row ID
#
method seek {newrowid} {
set rowid $newrowid
}
method cache {{size "all"}} {
set cacheSize $size
if {$size == "all"} { set cacheSize $numrows }
## Delete the previous cache array.
catch {unset cacheArray}
set autostatus $autocache
set currrow $rowid
set autocache 1
seek 0
set i 0
while {[next -list list]} {
if {[incr i] >= $cacheSize} { break }
}
set autocache $autostatus
seek $currrow
set cached 1
}
#
# forall -- walk the result object, executing the code body over it
#
method forall {type varName body} {
upvar 1 $varName $varName
set currrow $rowid
seek 0
while {[next $type $varName]} {
uplevel 1 $body
}
set rowid $currrow
return
}
method next {type {varName ""}} {
set return 1
if {![::rivet::lempty $varName]} {
upvar 1 $varName var
set return 0
}
catch {unset var}
set list ""
## If we have a cached result for this row, use it.
if {[info exists cacheArray($rowid)]} {
set list $cacheArray($rowid)
} else {
set list [$this nextrow]
if {[::rivet::lempty $list]} {
if {$return} { return }
set var ""
return 0
}
if {$autocache} { set cacheArray($rowid) $list }
}
incr rowid
switch -- $type {
"-list" {
if {$return} {
return $list
} else {
set var $list
}
}
"-array" {
if {$return} {
foreach field $fields elem $list {
lappend var $field $elem
}
return $var
} else {
eval lassign_array [list $list] var $fields
}
}
"-keyvalue" {
foreach field $fields elem $list {
lappend var -$field $elem
}
if {$return} { return $var }
}
"-dict" {
foreach field $fields elem $list {
lappend var $field $elem
}
if {$return} { return [dict create {*}$var] }
}
default {
incr rowid -1
return -code error \
"In-valid type: must be -list, -array, -dict or -keyvalue"
}
}
return [expr [::rivet::lempty $list] == 0]
}
public method mkdict {key} {
set query_res_d [dict create]
# we check on the first row a value
# for the corresponding key exists
if {[$this next -dict d] > 0} {
if {[dict exists $d $key]} {
set keyvalue [dict get $d $key]
dict unset d $key
dict set query_res_d $keyvalue $d
} else {
return -code error \
"Value for key '$key' not existing in the query results"
}
}
# then we proceed with the remaining rows to
# be processed
while {[$this next -dict d]} {
set keyvalue [dict get $d $key]
dict unset d $key
dict set query_res_d $keyvalue $d
}
return $query_res_d
}
method resultid {{string ""}} { return [configure_variable resultid $string] }
method fields {{string ""}} { return [configure_variable fields $string] }
method rowid {{string ""}} { return [configure_variable rowid $string] }
method numrows {{string ""}} { return [configure_variable numrows $string] }
method error {{string ""}} { return [configure_variable error $string] }
method errorcode {{string ""}} { return [configure_variable errorcode $string] }
method errorinfo {{string ""}} { return [configure_variable errorinfo $string] }
method autocache {{string ""}} { return [configure_variable autocache $string] }
public variable resultid ""
public variable fields ""
public variable rowid 0
public variable numrows 0
public variable error 0
public variable errorcode 0
public variable errorinfo ""
public variable autocache 1
protected variable cached 0
protected variable cacheSize 0
protected variable cacheArray
} ; ## ::itcl::class Result
} ; ## namespace eval DIO
package provide DIO 1.1
rivet-3.2.4/rivet/README 000644 001750 001751 00000000732 14560150664 015444 0 ustar 00manghi manghi 000000 000000 ###
## rivet/ - Initialization code for the Rivet Apache module.
##
###
init.tcl - Contains the initialization routines for Rivet in a
::Rivet namespace.
packages - Contains packages for use with Rivet. Place any new packages or
procedure libraries in this directory.
rivet-tcl - Contains .tcl files for procedures in Rivet. Place new commands
to Rivet in this directory.
packages-local - If it exists, a directory of local packages.
rivet-3.2.4/tests/headers.rvt 000644 001750 001751 00000000647 14560150664 016752 0 ustar 00manghi manghi 000000 000000
::rivet::load_headers hdrs
parray hdrs
?>
David N. Welton
Last modified: Tue Sep 30 17:55:07 CEST 2003
rivet-3.2.4/rivet/packages/session/session-create-mysql.sql 000644 001750 001751 00000001773 14560150664 024643 0 ustar 00manghi manghi 000000 000000 --
-- Define SQL tables for session management code
--
-- Author: Arnulf (minor changes by Massimo Manghi)
--
-- 02 May 2006
--
DROP TABLE IF EXISTS `rivet_session`;
create table rivet_session (
ip_address varchar(16) default NULL,
session_start_time datetime default NULL,
session_update_time datetime default NULL,
session_id varchar(64) NOT NULL default '',
PRIMARY KEY (session_id)
) ENGINE=INNODB;
DROP TABLE IF EXISTS `rivet_session_cache`;
create table rivet_session_cache(
session_id varchar(128) default NULL,
package_ varchar(128) default NULL,
key_ varchar(256) default NULL,
data varchar(4096) default NULL,
UNIQUE KEY riv_sess_cache_ix( session_id, package_, key_ ),
KEY rivet_session_cache_idx (session_id),
FOREIGN KEY (session_id) REFERENCES rivet_session(session_id) ON DELETE CASCADE
) ENGINE=INNODB;
-- create index rivet_session_cache_idx ON rivet_session_cache( session_id );
rivet-3.2.4/doc/html/import_keyvalue_pairs.html 000644 001750 001751 00000006255 14560150767 022461 0 ustar 00manghi manghi 000000 000000 import_keyvalue_pairs
import_keyvalue_pairs
Rivet Tcl Commands and Variables
Name
import_keyvalue_pairs — Import an argument list into the named array
rivet-3.2.4/src/mod_rivet_ng/rivetChannel.h 000644 001750 001751 00000002627 14560150664 021476 0 ustar 00manghi manghi 000000 000000 /* rivetChannel.h - definitions for the Rivet Tcl channel */
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#ifndef _RIVET_CHANNEL_H_
#define _RIVET_CHANNEL_H_
/* Functions for mod_dtcl Tcl output channel .*/
extern int closeproc(ClientData, Tcl_Interp *);
extern int inputproc(ClientData, char *, int, int *);
extern int outputproc(ClientData, char *, int, int *);
extern int setoptionproc(ClientData, Tcl_Interp *, char *, char *);
/* extern int getoptionproc(ClientData, Tcl_Interp *, char *, Tcl_DString *); */
extern void watchproc(ClientData, int);
extern int gethandleproc(ClientData, int, ClientData *);
extern Tcl_ChannelType RivetChan;
#endif
rivet-3.2.4/doc/html/catch.html 000644 001750 001751 00000012136 14560150767 017121 0 ustar 00manghi manghi 000000 000000 catch
::rivet::catch wraps the core language catch
command adding some extra error handling needed by mod_rivet design.
The rationale for Rivet to have its own ::rivet::catch reads
as follows: within mod_rivet a script execution can be interrupted by either calling
::rivet::exit (not recommended) or ::rivet::abort_page.
These commands implement a simple internal exception mechanism by
returning a special error code so that execution is in turn handed down to the
AbortScript and eventually to AfterEveryScript
(if any of them is defined). Any code calling one of these commands which runs under
control of the ::catch command would need to do this chore itself,
checking the error info and in case throw the error again if it had been originated
by one of mod_rivet's exceptions calls. This is what ::rivet::catch
does by hiding the implementation details and providing a better and more compatibile way to
handle this condition.
Note
This command is not meant to replace the core command, thus it's not exported from the
::rivet namespace and therefore has to be fully qualified.
rivet-3.2.4/rivet/packages/commserver/server.tcl 000644 001750 001751 00000002511 14560150664 022533 0 ustar 00manghi manghi 000000 000000 # server.tcl --
# This is a server that is detached from the main Apache process, in
# order to provide inter-process comunication via tcllib's comm
# package.
# Copyright 2003-2004 The Apache Software Foundation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# $Id$
# TODO:
# Add some code for serializing variables between sessions.
# Possibilities for keeping sync'ed include: catching signals and
# shutting down gracefully, or periodically saving to disk.
package require comm
if {![info exists argv]} { return }
set Port [lindex $argv 0]
if { [catch {
comm::comm config -port $Port
} err] } {
# Ok, something failed. This should mean that another copy is
# already running.
puts stderr "Could not launch commserver on port $Port, exiting"
exit 1
} else {
puts stderr "Launched commserver on port $Port"
vwait forever
}
rivet-3.2.4/rivet/rivet-tcl/debug.tcl 000644 001750 001751 00000005770 14560150664 020276 0 ustar 00manghi manghi 000000 000000 ###
## debug ?-option value? ?-option value?...
## A command to make debugging more convenient. Print strings, arrays
## and the values of variables as specified by the arguments.
##
## Also allows the setting of an array called debug which will pick up
## options for all debug commands.
##
## We create this command in the ::request namespace because we want the
## user to be able to use the debug array without actually having to set
## it at the global level.
##
## Options:
##
## -subst - Each word should be considered a variable and subst'd.
## -separator - A text string that goes between each variable.
## -ip - A list of IP addresses to display to.
##
## $Id$
##
###
namespace eval ::rivet {
proc debug {args} {
# starting with 2.1.0 ::RivetUserConf can be created on demand (see ::rivet::inspect)
array set ::RivetUserConf [dict get [::rivet::inspect] user]
## If they've turned off debugging, we don't do anything.
if {[info exists ::RivetUserConf(Debug)] && !$::RivetUserConf(Debug)} {
return
}
## We want to save the REMOTE_ADDR for any subsequent calls to debug.
if {![info exists ::RivetUserConf(REMOTE_ADDR)]} {
set REMOTE_ADDR [env REMOTE_ADDR]
set ::RivetUserConf(REMOTE_ADDR) $REMOTE_ADDR
}
## Set some defaults for the options.
set data(subst) 0
set data(separator)
## Check RivetUserConf for globally set options.
if {[info exists ::RivetUserConf(DebugIp)]} {
set data(ip) $::RivetUserConf(DebugIp)
}
if {[info exists ::RivetUserConf(DebugSubst)]} {
set data(subst) $::RivetUserConf(DebugSubst)
}
if {[info exists ::RivetUserConf(DebugSeparator)]} {
set data(separator) $::RivetUserConf(DebugSeparator)
}
import_keyvalue_pairs data $args
if {[info exists data(ip)]} {
set can_see 0
foreach ip $data(ip) {
if {[string match $data(ip)* $::RivetUserConf(REMOTE_ADDR)]} {
set can_see 1
break
}
}
if {!$can_see} { return }
}
if {[string tolower $data(subst)] != "on"} {
::rivet::html [join $data(args)]
return
}
set lastWasArray 0
foreach varName $data(args) {
upvar $varName var
if {[array exists var]} {
parray $varName
set lastWasArray 1
} elseif {[info exists var]} {
if {!$lastWasArray} {
::rivet::html $data(separator)
}
::rivet::html $var
set lastWasArray 0
} else {
if {!$lastWasArray} {
::rivet::html $data(separator)
}
::rivet::html $varName
set lastWasArray 0
}
}
}
}
rivet-3.2.4/rivet/packages/formbroker/ 000755 001750 001751 00000000000 14560150664 020510 5 ustar 00manghi manghi 000000 000000 rivet-3.2.4/configure.ac 000644 001750 001751 00000100402 14560150664 015714 0 ustar 00manghi manghi 000000 000000 #!/bin/sh
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run when building Rivet
dnl to configure the system for the local environment.
dnl
dnl You need at least autoconf 2.59
dnl
#
#-----------------------------------------------------------------------
# Sample configure.in for Tcl Extensions. The only places you should
# need to modify this file are marked by the string __CHANGE__
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided. These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------
AC_INIT([Rivet],[m4_esyscmd_s([cat VERSION])],[rivet-dev@tcl.apache.org])
TEA_INIT([3.9])
# we are storing here the configure command line, as recursive
# invocations change the value of the shell variables $0 $*
CONFIGURE_CMD="$0 $*"
AC_CONFIG_AUX_DIR(tclconfig)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# AX_PREFIX_CONFIG_H is a macro taken from the autotools macro archive.
# The typical configure generated 'config.h' can be renamed and
# preprocessor symbols in it can be prefixed in order to avoid clashes
# with Apache's config.h
#
# As of today (27 Sept 2008) this macro is not part of autotools and
# it's in the 'm4' directory
#
AX_PREFIX_CONFIG_H([rivet_config.h],[rivet])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------
#
# Init automake stuff
#
AC_DISABLE_STATIC
AM_INIT_AUTOMAKE([foreign subdir-objects])
# establishing a landmark in the directory hierarchy as per
# autotools design. This is what AC_CONFIG_SRCDIR is meant to do
# I arbitrarily choose src/rivet.h as landmark, moving this file
# to a different directory or deleting it implies this line has to
# change
AC_CONFIG_SRCDIR([src/rivet.h])
#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------
TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG
#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------
#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG
#-----------------------------------------------------------------------
# Handle the --prefix=... option by defaulting to what Tcl gave.
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
#-----------------------------------------------------------------------
TEA_PREFIX
#-----------------------------------------------------------------------
# Standard compiler checks.
# This sets up CC by using the CC env var, or looks for gcc otherwise.
# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
# the basic setup necessary to compile executables.
#-----------------------------------------------------------------------
TEA_SETUP_COMPILER
#
# For automake to be happy, we also need LT_INIT
#
# the LIBTOOL_DEPS macro sets up for automatic updating of the
# libtool script if it becomes out of date, as per libtool docs
#
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------
# Unused: src/TclWeb.c
#TEA_ADD_SOURCES([src/TclWebcgi.c src/TclWebapache.c src/apache_multipart_buffer.c src/apache_request.c src/mod_rivet.c src/parserPkgInit.c src/rivetChannel.c src/rivetCore.c src/rivetCrypt.c src/rivetList.c src/rivetParser.c src/rivetPkgInit.c src/rivetWWW.c win/nmakehlp.c src/testing.c])
#TEA_ADD_HEADERS([src/TclWeb.h src/apache_multipart_buffer.h src/apache_request.h src/mod_rivet.h src/rivet.h src/rivetChannel.h src/rivetParser.h])
TEA_ADD_INCLUDES([])
TEA_ADD_LIBS([])
TEA_ADD_CFLAGS([])
TEA_ADD_STUB_SOURCES([])
TEA_ADD_TCL_SOURCES([])
#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_sample in this case) so
# that we create the export library with the dll.
#
# Windows creates a few extra files that need to be cleaned up.
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------
# removed AC_DEFINE(BUILD_rivet....) as per TEA 3.9 (Massimo Manghi 20100825)
if test "${TEA_PLATFORM}" = "windows" ; then
# AC_DEFINE(BUILD_rivet,1,[Define to define the BUILD_rivet define (?)])
CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
# #TEA_ADD_SOURCES([win/winFile.c])
# #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
CLEANFILES="pkgIndex.tcl"
# #TEA_ADD_SOURCES([unix/unixFile.c])
# #TEA_ADD_LIBS([-lsuperfly])
fi
AC_SUBST(CLEANFILES)
#--------------------------------------------------------------------
# __CHANGE__
# Choose which headers you need. Extension authors should try very
# hard to only rely on the Tcl public header files. Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
#--------------------------------------------------------------------
TEA_PUBLIC_TCL_HEADERS
#TEA_PRIVATE_TCL_HEADERS
#TEA_PUBLIC_TK_HEADERS
#TEA_PRIVATE_TK_HEADERS
#TEA_PATH_X
#--------------------------------------------------------------------
# Check whether --enable-threads or --disable-threads was given.
# This auto-enables if Tcl was compiled threaded.
#--------------------------------------------------------------------
TEA_ENABLE_THREADS
#--------------------------------------------------------------------
# The statement below defines a collection of symbols related to
# building as a shared library instead of a static library.
#--------------------------------------------------------------------
TEA_ENABLE_SHARED
#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects. This information
# can be taken from the tclConfig.sh file, but this figures it all out.
#--------------------------------------------------------------------
TEA_CONFIG_CFLAGS
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------
TEA_ENABLE_SYMBOLS
#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library. If you
# can't for some reason, remove this definition. If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library. Add Tk too if necessary.
#--------------------------------------------------------------------
#
# stubs are causing segmentation violations when mod_rivet is getting
# loaded into apache. it would be nice if we did no stubs for this and
# still did stubs for librivet and librivetparser, which seem to be OK.
#
#AC_DEFINE(USE_TCL_STUBS,1,[Define to link against the Tcl stub library])
#AC_DEFINE(USE_TK_STUBS)
#--------------------------------------------------------------------
# This macro generates a line to use when building a library. It
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
# and TEA_LOAD_TCLCONFIG macros above.
#--------------------------------------------------------------------
TEA_MAKE_LIB
#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process. Don't run the TCLSH_PROG through
# ${CYGPATH} because it's being used directly by make.
# Require that we use a tclsh shell version 8.2 or later since earlier
# versions have bugs in the pkg_mkIndex routine.
# Add WISH as well if this is a Tk extension.
#--------------------------------------------------------------------
# We have to either find a working tclsh or be told where it is
# using --with-tclsh
AC_ARG_WITH(tclsh, [ --with-tclsh=FILE location of a working tclsh executable], with_tclsh=${withval})
#
# allow them to override the tclsh we think we found
#
if test x"${with_tclsh}" != x ; then
AC_MSG_CHECKING([for tclsh])
if test -f "${with_tclsh}" ; then
TCLSH_PROG=${with_tclsh}
AC_MSG_RESULT([manually set by --with-tclsh=$TCLSH_PROG])
else
AC_MSG_ERROR([No tclsh at place specified by --with-tclsh (${with_tclsh})])
fi
AC_SUBST(TCLSH_PROG)
else
TEA_PROG_TCLSH
fi
#TEA_PROG_WISH
# apache base directory
AC_DEFUN([APACHE],[
AC_MSG_CHECKING(for Apache base)
AC_ARG_WITH(
apache,
[ --with-apache[=DIR] Apache server base directory],,
[with_apache="/usr/local/apache2"]
)
apache_base="${with_apache}"
AC_MSG_RESULT([$apache_base])
])
#
# We have to either find apxs or be told where it is using --with-apxs
#
AC_DEFUN([CHECK_APXS],[
AC_MSG_CHECKING(for Apache apxs)
AC_ARG_WITH(
apxs,
[ --with-apxs=FILE location of Apache apxs tool],
[if test -x "${with_apxs}" ; then
apxs_found="${with_apxs}"
AC_MSG_RESULT([$apxs_found])
fi]
,
[
APXS_NAMES=apxs
for apxs_file in ${APXS_NAMES}; do
for apxs_path in bin sbin; do
if test -x "${apache_base}"/"${apxs_path}"/"${apxs_file}"; then
apxs_found="${apache_base}"/"${apxs_path}"/"${apxs_file}"
break 2
fi
done
done
if test x"$apxs_found" = x; then
AC_PATH_PROGS(with_apxs, apxs)
if test "${with_apxs+set}" = set ; then
apxs_found="${with_apxs}"
fi
fi
if test x"${apxs_found}" = x; then
AC_MSG_ERROR([Could not find apxs. apxs must be in your PATH or you must specify the location of the apxs script using --with-apxs])
else
AC_MSG_RESULT([$apxs_found])
fi
]
)
if test "${apxs_found+set}" = set ; then
dnl At this point we already have apr sorted out
export PATH=$PATH:`dirname $apxs_found`
APXS_CPPFLAGS=`${apxs_found} -q CFLAGS`
AC_SUBST(APXS_CPPFLAGS)
APXS_LDFLAGS=`${apxs_found} -q LDFLAGS_SHLIB`
AC_SUBST(APXS_LDFLAGS)
APXS_LIBS=`${apxs_found} -q LIBS_SHLIB`
AC_SUBST(APXS_LIBS)
APXS_INCLUDES=-I`${apxs_found} -q INCLUDEDIR`
AC_SUBST(APXS_INCLUDES)
APXS_CPPFLAGS_SHLIB=`${apxs_found} -q CFLAGS_SHLIB`
AC_SUBST(APXS_CPPFLAGS_SHLIB)
APXS_LD_SHLIB=`${apxs_found} -q LD_SHLIB`
AC_SUBST(APXS_LD_SHLIB)
APXS_LIBEXECDIR=`${apxs_found} -q LIBEXECDIR`
AC_SUBST(APXS_LIBEXECDIR)
APXS_SYSCONFDIR=`${apxs_found} -q SYSCONFDIR`
AC_SUBST(APXS_SYSCONFDIR)
APXS_PREFIX=`${apxs_found} -q PREFIX`
AC_SUBST(APXS_PREFIX)
else
AC_MSG_ERROR([Could not find apxs. apxs must be in your PATH or you must specify the location of the apxs script using --with-apxs])
fi
])
AC_DEFUN([APACHE_INCLUDES],[
AC_ARG_WITH(
apache_include,
[ --with-apache-include[=DIR] Apache server directory],
[apache_include="${with_apache_include}"]
,[apache_include="${APXS_INCLUDES}"]
)
AC_SUBST(apache_include)
])
AC_DEFUN([APR_HANDLING],[
AC_MSG_CHECKING(for Apache apr)
AC_ARG_WITH(
apr_config,
[ --with-apr-config=FILE apr portable apr-1-config path],
[if test -x "${with_apr_config}"; then
apr_found="${with_apr_config}"
fi]
,
[if test -x "${apache_base}/bin/apr-1-config" ; then
apr_found="${apache_base}/bin/apr-1-config"
elif test -x "${apache_base}/sbin/apr-1-config" ; then
apr_found="${apache_base}/sbin/apr-1-config"
elif test "${apache_base+set}" = set; then
AC_PATH_PROGS(with_apr_config, apr-1-config)
if test "${with_apr_config+set}" = set ; then
apr_found="${with_apr_config}"
fi
else
AC_MSG_ERROR( Specify the apr-1-config path using --with-apr-config, 1)
fi]
)
if test "${apr_found+set}" = set ; then
AC_MSG_RESULT([$apr_found])
dnl At this point we already have apr sorted out
dnl It actually calls another script, so the PATH needs to be set.
export PATH=$PATH:`dirname ${apr_found}`
APR_CPPFLAGS=`${apr_found} --cppflags`
AC_SUBST(APR_CPPFLAGS)
APR_INCLUDES=`${apr_found} --includes`
AC_SUBST(APR_INCLUDES)
APR_LDLFAGS=`${apr_found} --link-libtool --libs`
AC_SUBST(APR_LDFLAGS)
else
AC_MSG_ERROR([Could not find apr-1-config. apr-1-config must be in your PATH or you must specify the location of the apr script using --with-apr-config])
fi
])
# -- APU_HANDLING
#
# calling apu-1-config to determine where apr-utils includes
# and library are
#
AC_DEFUN([APU_HANDLING],[
AC_MSG_CHECKING(for Apache apu)
AC_ARG_WITH(
apu_config,
[ --with-apu-config=FILE apu portable apu-1-config path],
[if "${with_apu_config}" --version; then
apu_found="${with_apu_config}"
fi]
,
[if apu-1-config --version; then
apu_found=apu-1-config
elif test -x "${apache_base}/bin/apu-1-config" ; then
apu_found="${apache_base}/bin/apu-1-config"
elif test -x "${apache_base}/sbin/apu-1-config" ; then
apu_found="${apache_base}/sbin/apu-1-config"
elif test "${apache_base+set}" = set; then
AC_PATH_PROGS(with_apu_config, apu-1-config)
if test "${with_apu_config+set}" = set ; then
apu_found="${with_apu_config}"
fi
else
AC_MSG_ERROR( Specify the apu-1-config path or program name using --with-apu-config, 1)
fi]
)
if test "${apu_found+set}" = set ; then
AC_MSG_RESULT([$apu_found_])
dnl At this point we already have apu sorted out
dnl It actually calls another script, so the PATH needs to be set.
export PATH=$PATH:`dirname ${apu_found}`
APU_INCLUDES=`${apu_found} --includes`
AC_SUBST(APU_INCLUDES)
APU_LDLFAGS=`${apu_found} --link-libtool --libs`
AC_SUBST(APU_LDFLAGS)
else
AC_MSG_ERROR([Could not find apu-1-config. apu-1-config must be in your PATH or you must specify the location of the apu script using --with-apu-config])
fi
])
#--------------------------------------------------------------------
# 6-Dec-2011: Introducing new ::rivet namespace. Some components
# (namely RivetTcl, providing Tcl level initialization) are required
# within mod_rivet.c. Unfortunalely Tcl < 8.5.10 shared
# libs exporting names could clash with Apache's binary own names.
# Hence we have to make sure we are running a Tcl compatible version.
# (See Tcl bug #3216070).
#
# Effect: If you're running Tcl < 8.5.10 we refuse to build Rivet...
AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.10],[
AC_MSG_ERROR([Rivet 2.1 requires Tcl > 8.5.10 (current is $TCL_VERSION$TCL_PATCH_LEVEL)])
] , [
AC_MSG_NOTICE([we are building Rivet with Tcl $TCL_VERSION$TCL_PATCH_LEVEL])
])
print_fileevent_msg="0"
AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.15],[
print_fileevent_msg="1"
] , )
AX_COMPARE_VERSION([$TCL_VERSION],[eq],[8.6],[
if test "$TCL_PATCH_LEVEL" = ".0" ; then
print_fileevent_msg="1"
fi
] , )
# MOD_RIVET_CORE
#
# Determining the path to the mod_rivet.* source files
#
AC_DEFUN([MOD_RIVET_CORE],[
AC_ARG_WITH(
rivet_core,
[ --with-rivet-core[=path] mod_rivet core directory],,
[with_rivet_core="mod_rivet_ng"]
)
AC_MSG_CHECKING([mod_rivet core])
#if [[ -d "src/${with_rivet_core}" ]]; then
# rivet_core=$(pwd)/src/${with_rivet_core}
#else
# rivet_core=${with_rivet_core}
#fi
rivet_core=${with_rivet_core}
# by default we search the channel and core commands
# implementation in the same directory. This can
# be superseded by other macros
default_rivet_commands=${rivet_core}
default_rivet_channel=${rivet_core}
#AC_CONFIG_FILES([src/${rivet_core}/Makefile])
AC_SUBST(rivet_core)
AC_MSG_RESULT([$rivet_core])
])
#
AC_DEFUN([HANDLE_TCL_PACKAGE_PATH],[
# shamelessly stolen from TEA_LOAD_TCLCONFIG
AC_MSG_CHECKING([Debian TCL_PACKAGE_PATH workaround])
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
AC_MSG_RESULT([loading])
. "${TCL_BIN_DIR}/tclConfig.sh"
else
AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
fi
# If we have multiple paths, pull the first one, add end slash if needed
res=`echo ${TCL_PACKAGE_PATH} | \
grep '[[^\]] ' | \
sed -e 's/\([[^\]]\)\( \)\(.*\)$/\1/' -e 's/\([[^\/]]\)$/\1\//' `
if test x"${res}" != x; then
TCL_PACKAGE_PATH=${res}
AC_SUBST(TCL_PACKAGE_PATH)
fi
])
AC_DEFUN([GET_RIVET_BASE], [
RIVET_BASE_INCLUDE=`pwd`/src
AC_SUBST(RIVET_BASE_INCLUDE)
RIVET_SOURCE_BASE=`pwd`/src
AC_SUBST(RIVET_SOURCE_BASE)
])
# APACHE_REQUEST
#
# Choosing where is located the code for handling Apache request data (like
# form data etc). Default: 'request'
AC_DEFUN([APACHE_REQUEST],[
AC_ARG_WITH(
apache_request,
[ --with-apache-request=DIR path to rivet HTML form and urlencoded data handler],,
[with_apache_request="request"]
)
AC_MSG_CHECKING([code for HTML form and urlencoded data handling])
apache_request=${with_apache_request}
AC_SUBST(apache_request)
AC_MSG_RESULT([$apache_request])
])
# RIVET_CORE_CMDS
#
# selecting non default directory for Rivet code commands core
#
AC_DEFUN([RIVET_CORE_CMDS],[
AC_ARG_WITH(
rivet_commands,
[ --with-rivet-commands[=dir] path to Rivet core commands code],,
[with_rivet_commands=$default_rivet_commands]
)
AC_MSG_CHECKING([for Rivet core commands code])
rivet_commands=${with_rivet_commands}
AC_SUBST(rivet_commands)
AC_MSG_RESULT([$rivet_commands])
])
# RIVET_CHANNEL
#
# selecting the Rivet channel code directory
AC_DEFUN([RIVET_CHANNEL],[
AC_ARG_WITH(
rivet_channel,
[ --with-rivet-channel=DIR Rivet channel code path ],,
[with_rivet_channel=$default_rivet_channel]
)
AC_MSG_CHECKING([for Rivet channel code path])
rivet_channel=${with_rivet_channel}
AC_SUBST(rivet_channel)
AC_MSG_RESULT([$rivet_channel])
])
# RIVET_TCL_LIB
#
#
AC_DEFUN([RIVET_TCL_LIB],[
AC_ARG_WITH(
rivet_target_dir,
[ --with-rivet-target-dir=DIR Rivet tcl and binary libraries target dir ],,
with_rivet_target_dir="${apache_base}/lib/rivet${PACKAGE_VERSION}"
)
AC_MSG_CHECKING([for Rivet libraries target])
RIVET_TCL_TARGET=${with_rivet_target_dir}
AC_SUBST(RIVET_TCL_TARGET)
AC_MSG_RESULT([$with_rivet_target_dir])
])
# DISPLAY_RIVET_VERSION
#
# --enable-version-display=[yes|no] (default: no)
# switches on version number display in Apache's signature.
#
AC_DEFUN([DISPLAY_RIVET_VERSION],[
AC_ARG_ENABLE(
version_display,
[ --enable-version-display Display Rivet version in Apache signature],
[ signature_version_display=$enable_version_display ],
[ signature_version_display="no" ]
)
AC_MSG_CHECKING([whether rivet version is printed in Apache signature])
if test "$signature_version_display" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(DISPLAY_VERSION,1,[Display Rivet version in Apache signature])
else
AC_MSG_RESULT([no, Rivet version will be hidden])
AC_DEFINE(DISPLAY_VERSION,0,[Display Rivet version in Apache signature])
fi
])
# UPLOAD_DIRECTORY
#
# Adds '--with-upload-dir=DIR' to configure's arguments
#
# let's make configuration of the upload directory more flexible for windows builds
# (in case someone steps forward and takes up the Windows port)
# The upload directory can be changed in the configuration, but we give the
# user/packager the chance to set a default at compile time.
# Default: /tmp
AC_DEFUN([UPLOAD_DIRECTORY],[
AC_ARG_WITH(
upload_dir,
[ --with-upload-dir=DIR Default directory for uploads],,
with_upload_dir="/tmp"
)
AC_MSG_CHECKING(where Rivet will save uploads)
RIVET_UPLOAD_DIR=${with_upload_dir}
AC_SUBST(RIVET_UPLOAD_DIR)
AC_MSG_RESULT([$with_upload_dir])
])
# HONOR_HEAD_REQUESTS (--enable-head-requests)
# Rivet answers to HEAD requests with a standard response to avoid the whole workload
# of generating the content of a page with to the sole purpose of returning the HTTP
# headers.To test the configuration or scripts that manipulate the headers it
# can be useful to let Rivet honor a HEAD request as if the whole content was
# generated so that the real headers are returned (this can be set in configuration
# by adding "RivetServerConf HonorHeaderOnlyRequests yes" to the server configuration)
#
# Default: no
AC_DEFUN([HONOR_HEAD_REQUESTS],[
AC_ARG_ENABLE(
head_requests,
[ --enable-head-requests Returns real headers in response to a HEAD request],
[ honor_head_requests=$enable_head_requests ],
[ honor_head_requests="yes"]
)
AC_MSG_CHECKING([if Rivet has to honor HEAD requests])
if test "$honor_head_requests" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(HEAD_REQUESTS,1,[Honor HEAD requests])
else
AC_MSG_RESULT([no, Rivet will shunt HEAD requests])
AC_DEFINE(HEAD_REQUESTS,0,[Honor HEAD requests])
fi
])
# SINGLE_WORKER_TCL_THREAD
#
# This options is used by the worker MPM bridge for debugging.
# When enabled rivet_worker_bridge will create a single Tcl interp thread instead
# of the a whole pool of them
#
# Defautl: no
AC_DEFUN([SINGLE_WORKER_TCL_THREAD],[
AC_ARG_ENABLE(
single_thread,
[ --enable-single-thread forces the worker brigde to create a single thread (debug)],
[ single_thread=$enable_single_thread ],
[ single_thread="no"]
)
AC_MSG_CHECKING([if the worker MPM bridge will run in single thread mode])
if test "$single_thread" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(MPM_SINGLE_TCL_THREAD,1,[yes, MPM worker single thread])
else
AC_MSG_RESULT([no, maximal number of Tcl threads])
fi
])
# -- SERIALIZE_HTTP_REQUEST
#
# The macro defines the symbol SERIALIZE_HTTP_REQUESTS and cooperates
# with macro HTTP_REQUESTS_PROC. This option is useful only
# for debugging (avoids threads concurrency). See the code of the
# worker bridge to see the preprocessor macros cooperating to
# attain this feature
#
# Default: no
AC_DEFUN([HTTP_REQUESTS_MUTEX],[
AC_ARG_ENABLE(
requests_serialization,
[ --enable-requests-serialization Forces HTTP requests serialization among threads(debug)],
[ requests_serialization=$enable_requests_serialization ],
[ requests_serialization="no" ]
)
AC_MSG_CHECKING([if we want the worker bridge to serialize HTTP requests])
if test "$requests_serialization" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(SERIALIZE_HTTP_REQUESTS,1,[requests will be serialized])
else
AC_MSG_RESULT([no, HTTP requests will not be serialized])
fi
])
# -- RIVET_DEBUG_BUILD
#
# Defining a symbol for conditional inclusion of code for debugging purposes
#
# Default: no
#
AC_DEFUN([BUILD_DEBUG_CODE],[
AC_ARG_ENABLE(
rivet_debug_build,
[ --enable-rivet-debug-build Includes optional debugging code],
[ rivet_debug_build=$enable_rivet_debug_build ],
[ rivet_debug_build="no" ]
)
AC_MSG_CHECKING([if we are building mod_rivet for debugging])
if test "$rivet_debug_build" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(DEBUG_BUILD,1,[we are building mod_rivet with optional code])
else
AC_MSG_RESULT([no, ordinary build])
fi
])
# RIVET_COMMANDS_EXPORT (--enable-rivet-commands-export).
# Enable export of commands in Rivet's namespace. Definining this symbols
# sets the boolean configuration variable rivet_commands_export
# Default: yes
AC_DEFUN([RIVET_COMMANDS_EXPORT],[
AC_ARG_ENABLE(
rivet-commands-export,
[ --disable-rivet-commands-export to prevent export from ::rivet namespace],
[ rivet_commands_export=$enable_rivet_commands_export ],
[ rivet_commands_export="yes"]
)
AC_MSG_CHECKING([if the commands in ::rivet namespace will be exported])
if test "$rivet_commands_export" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(NAMESPACE_EXPORT,1,[commands will be exported])
else
AC_MSG_RESULT([no])
AC_DEFINE(NAMESPACE_EXPORT,0,[commands will not be exported])
fi
])
# IMPORT_RIVET_COMMANDS (--enable-import-rivet-commands).
# For compatibility the module can be compiled and installed forcing rivet
# to import commands from ::rivet into the global namespace.
# Default: no
AC_DEFUN([IMPORT_RIVET_COMMANDS],[
AC_ARG_ENABLE(
import-rivet-commands,
[ --enable-import-rivet-commands requires explicit namespace import],
[ import_rivet_commands=$enable_import_rivet_commands],
[ import_rivet_commands="no"]
)
AC_MSG_CHECKING([if ::rivet namespace will be automatically imported for compatibility])
if test "$import_rivet_commands" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(NAMESPACE_IMPORT,1,[commands will be imported into the global namespace])
else
AC_MSG_RESULT([no])
AC_DEFINE(NAMESPACE_IMPORT,0,[good, no automatic import will be done])
fi
])
# SEPARATE_VIRTUAL_INTERPS (--enable-virtual-interps-separation)
# Virtual hosts get their own interpreter and configuration. Different
# applications running on different virtual hosts don't mix up variables
# and namespaces, avoiding conflicts.
# Default: no
AC_DEFUN([VIRTUAL_INTERPS_SEPARATION],[
AC_ARG_ENABLE(
virtual-interps-separation,
[ --enable-virtual-interps-separation to turn on virtual host separation],
[ separate_virtual_interps=$enable_virtual_interps_separation ],
[ separate_virtual_interps="no"]
)
AC_MSG_CHECKING([whether Rivet will create an interpreter for each virtual host])
if test "$separate_virtual_interps" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(SEPARATE_VIRTUAL_INTERPS,1,[virtual hosts will have their own interp])
else
AC_MSG_RESULT([no])
AC_DEFINE(SEPARATE_VIRTUAL_INTERPS,0,[one interpreter per child])
fi
])
# POST_MAX_SIZE (--with-post-max)
# Maximum size of data posted by a form
# Default: 0=unlimited
AC_DEFUN([POST_MAX_SIZE],[
AC_ARG_WITH(
post_max,
[ --with-post-max=BYTES Maximum size of data to be sent with a POST],,
with_post_max=0
)
AC_MSG_CHECKING([maximum size of a POST])
MAX_POST=${with_post_max}
AC_SUBST(MAX_POST)
if test $with_post_max = 0; then
AC_MSG_RESULT([unlimited size])
else
AC_MSG_RESULT([$with_post_max])
fi
])
# UPLOAD_TO_VAR (--enable-upload-var)
# Enables upload of files into Tcl variables
# Default: 1=enabled
AC_DEFUN([UPLOAD_TO_VAR],[
AC_ARG_ENABLE(
upload-var,
[ --disable-upload-var to disable automatic upload to variables ],
[ upload_var=$enable_upload_var ],
[ upload_var="yes"]
)
AC_MSG_CHECKING([whether files are uploaded to Tcl variables])
if test "$upload_var" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(UPLOAD_FILES_TO_VAR,1,[Files are uploaded to Tcl variables])
else
AC_MSG_RESULT([no])
AC_DEFINE(UPLOAD_FILES_TO_VAR,0,[uploads go to files])
fi
])
#APACHE_VERSION
MOD_RIVET_CORE
GET_RIVET_BASE
APACHE
CHECK_APXS
APACHE_INCLUDES
APR_HANDLING
APU_HANDLING
RIVET_TCL_LIB
DISPLAY_RIVET_VERSION
UPLOAD_DIRECTORY
HONOR_HEAD_REQUESTS
VIRTUAL_INTERPS_SEPARATION
POST_MAX_SIZE
UPLOAD_TO_VAR
IMPORT_RIVET_COMMANDS
APACHE_REQUEST
RIVET_CORE_CMDS
RIVET_CHANNEL
SINGLE_WORKER_TCL_THREAD
HTTP_REQUESTS_MUTEX
BUILD_DEBUG_CODE
AC_HEADER_STDBOOL
# Let's separate the point version from the major and minor version
# to build a Rivet version to be substituted as basic version for
# package Rivet, central initialization of the Tcl environment
VERSION=${PACKAGE_VERSION}
AX_SPLIT_VERSION
AC_DEFINE_UNQUOTED(INIT_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}",[Rivet Tcl package version])
AC_MSG_NOTICE([Rivet package version is ${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}])
AC_SUBST(INIT_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}")
AC_SUBST(RIVETLIB_PACKAGE,"rivetlib",[rivetlib package name])
AC_SUBST(RIVETLIB_PACKAGE_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}")
if test $import_rivet_commands = "yes"; then
AC_MSG_NOTICE([forcing Rivet to export commands from ::rivet namespace])
AC_DEFINE(NAMESPACE_EXPORT,1,[commands will be exported])
else
RIVET_COMMANDS_EXPORT
fi
AC_C_INLINE
#AC_SUBST(apache_version_dir)
AC_SUBST(MOD_RIVET_INCLUDES)
AC_DEFINE_UNQUOTED(RIVETLIB_DESTDIR,"${RIVET_TCL_TARGET}",[The path to the rivet tcl library])
AC_DEFINE_UNQUOTED(NAMEOFEXECUTABLE,"${TCLSH_PROG}",[The path to a working tclsh executable])
AC_DEFINE_UNQUOTED(UPLOAD_DIR,"${RIVET_UPLOAD_DIR}",[Path to the disk directory where uploads are saved])
AC_DEFINE_UNQUOTED(MAX_POST,[$MAX_POST],[Max size of data in POST operations])
AC_DEFINE_UNQUOTED(SEPARATE_CHANNELS,0,[Separate Channels for virtual hosts])
AC_DEFINE_UNQUOTED(CONFIGURE_CMD,"${CONFIGURE_CMD}",[configure command string])
AC_DEFINE_UNQUOTED(RIVET_CORE,"${rivet_core}",[mod_rivet core])
# We need to use the package path for the installation procedure. On
#Debian linux TCL_PACKAGE_PATH may have more than one path in the
#TCL_PACKAGE_PATH variable, so we have to handle this
HANDLE_TCL_PACKAGE_PATH
AC_SUBST(TCL_PACKAGE_PATH)
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting the AC variables in. Include these here.
#--------------------------------------------------------------------
AC_CONFIG_FILES([Makefile src/Makefile rivet/init.tcl doc/Makefile doc/convert_examples.tcl doc/rivet.xml])
#case $apache_version_dir in
# apache-1) AC_CONFIG_FILES([Makefile src/Makefile src/apache-1/Makefile doc/Makefile]) ;;
# apache-2) AC_CONFIG_FILES([Makefile src/Makefile src/apache-2/Makefile doc/Makefile]) ;;
#esac
AC_OUTPUT
if test "$print_fileevent_msg" = "1"; then
AC_MSG_NOTICE([========================================================================])
AC_MSG_NOTICE([ WARNING!])
AC_MSG_NOTICE([========================================================================])
AC_MSG_NOTICE([The Tcl notifier (and consequently the event loop) does not work with])
AC_MSG_NOTICE([Rivet running Tcl $TCL_VERSION$TCL_PATCH_LEVEL and the 'prefork' MPM of Apache.])
AC_MSG_NOTICE([In order to have asynchronous I/O working the required versions are:])
AC_MSG_NOTICE([ - threaded builds: Tcl >= 8.5.15 (8.5 version) or Tcl >= 8.6.1])
AC_MSG_NOTICE([ - any non-threaded build of Tcl >= 8.5.10])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Nonetheless Rivet scripts work with Tcl >= 8.5.10 provided])
AC_MSG_NOTICE([you do not have to rely on the event loop to do I/O (e.g. you])
AC_MSG_NOTICE([cannot use the 'fileevent' command to set up callbacks)])
AC_MSG_NOTICE([see https://issues.apache.org/bugzilla/show_bug.cgi?id=55153])
AC_MSG_NOTICE([========================================================================])
fi
rivet-3.2.4/src/rivet.h 000644 001750 001751 00000007243 14560150664 015530 0 ustar 00manghi manghi 000000 000000 /* rivet.h: */
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#ifndef _RIVET_H_
#define _RIVET_H_
#include
#include "rivet_types.h"
typedef int rivet_req_ctype;
/* This is for windows. */
#ifdef BUILD_rivet
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
#endif /* BUILD_rivet */
#define MINSTRLEN(s1,s2) strlen(s1) < strlen(s2) ? strlen(s1) : strlen(s2)
#define STREQU(s1,s2) (s1[0] == s2[0] && strcmp(s1, s2) == 0)
#define STRNEQU(s1,s2) (s1[0] == s2[0] && strncmp(s1, s2, strlen(s2)) == 0)
#define RIVET_NS "::rivet"
#define RIVET_TCL_PACKAGE "rivet"
#define RIVETLIB_TCL_PACKAGE "rivetlib"
#define RIVET_MSG_BUFFER_SIZE 512
/* Macros to access and check thread private data */
#define RIVET_PRIVATE_DATA(thread_key,private_p) \
ap_assert (apr_threadkey_private_get ((void **)&private_p,thread_key) == APR_SUCCESS);
#define RIVET_PRIVATE_DATA_NOT_NULL(thread_key,private_p) \
RIVET_PRIVATE_DATA(thread_key,private_p) \
ap_assert (private_p != NULL);
/* macros defining Tcl commands */
#define TCL_CMD_HEADER(cmd) \
static int cmd(\
ClientData clientData,\
Tcl_Interp *interp,\
int objc,\
Tcl_Obj *CONST objv[])
#define TCL_OBJ_CMD( name, func ) \
Tcl_CreateObjCommand( interp, /* Tcl interpreter */\
name, /* Function name in Tcl */\
func, /* C function name */\
NULL, /* Client Data */\
(Tcl_CmdDeleteProc *)NULL /* Tcl Delete Prov */)
/* RIVET_OBJ_CMD creates a command in the RIVET_NS namespace. Commands
* are exported from the RIVET_NS (::rivet) namespace in the init.tcl
* script accordingly to configuration switches passed to ./configure
* (see configure.ac)
*/
/* We now pass the thread private data to the
* Tcl command's ClientData
*/
#define RIVET_OBJ_CMD( name, func, private_p) \
Tcl_CreateObjCommand( interp, /* Tcl interpreter */\
RIVET_NS "::" name, /* Function name in Tcl */\
func, /* C function name */\
private_p, /* Client Data */\
(Tcl_CmdDeleteProc *)NULL /* Tcl Delete Prov */);
#define RIVET_EXPORT_CMD(interp,ns,cmdname) Tcl_Export(interp,ns,cmdname,0);
/*
* Pointer in r is checked and in case Rivet_NoRequestRec is
* called returning TCL_ERROR. This macro is used (and often
* is the first code like) in commands that must ascertain
* the request_rec object pointer in globals is valid
* (when a request processing ends it's set to NULL)
*/
#define CHECK_REQUEST_REC(p,cmd_name) \
if (p == NULL) return TCL_OK;\
if (p->r == NULL)\
{\
Rivet_NoRequestRec(interp,Tcl_NewStringObj(cmd_name,-1));\
return TCL_ERROR;\
}
EXTERN int Rivet_Init(Tcl_Interp *interp);
EXTERN int Rivet_InitList(Tcl_Interp *interp);
EXTERN int Rivet_InitCrypt(Tcl_Interp *interp);
EXTERN int Rivet_InitWWW(Tcl_Interp *interp);
#endif
/* _RIVET_H_ */
rivet-3.2.4/doc/examples-sgml/hello1.rvt 000644 001750 001751 00000000045 14560150664 020674 0 ustar 00manghi manghi 000000 000000 <?= "Hello World" ?>
rivet-3.2.4/doc/html/formbroker.html 000644 001750 001751 00000006673 14560150767 020220 0 ustar 00manghi manghi 000000 000000 The Form Broker
The Form Broker
The Form Broker
Introduction
The FormBroker package creates instances of
form data description objects. These objects instances have
a simple set of methods to validate and control data
as typically posted by HTML forms,
thus data represented as the map of form variables
to their values. In Rivet this association can be obtained either
calling load_response or
var, (form variables can be selectively
read also calling ::rivet::var_post or
::rivet::var_qs)
Note
The FormBroker package is still experimental.
Basic functionalities and interface are not likely to change but
internal details and implementation could be redesigned
in future releases. More specifically the external validator mechanism
will likely need design improvements.
rivet-3.2.4/tests/apachetest/template.conf.1.tcl 000644 001750 001751 00000001216 14560150664 022316 0 ustar 00manghi manghi 000000 000000
# Minimal config file for testing
# Parsed by makeconf.tcl
ServerRoot "$CWD"
PidFile "$CWD/httpd.pid"
ResourceConfig "$CWD/srm.conf"
AccessConfig "$CWD/access.conf"
Timeout 300
MaxRequestsPerChild 0
$LOADMODULES
Port 8081
ServerName localhost
DocumentRoot "$CWD"
Options All MultiViews
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html
AccessFileName .htaccess
HostnameLookups Off
ErrorLog $CWD/error_log
LogLevel debug
LogFormat "%h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined
CustomLog "$CWD/access_log" combined
rivet-3.2.4/doc/images/toc-plus.png 000644 001750 001751 00000000410 14560150664 017712 0 ustar 00manghi manghi 000000 000000 PNG
IHDR ) bKGD #2 #IDATxch` #@ C"ԣj? RJld:4 CtEXtSoftware @(#)ImageMagick 4.2.8 99/08/01 cristy@mystic.es.dupont.com! *tEXtSignature ab17802e1ddae3211b1ce6bc3b08aec7{(
tEXtPage 15x9+0+07v IENDB` rivet-3.2.4/tests/shorthand.test 000644 001750 001751 00000000373 14560150664 017471 0 ustar 00manghi manghi 000000 000000 # $Id: $
::tcltest::test shorthand-1.1 {shorthand expression for simple output} {
set page [::http::geturl "${urlbase}shorthand.rvt"]
set match [::http::data $page]
set match
} {