Index: openacs-4/packages/xotcl-core/xotcl-core.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/xotcl-core.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xotcl-core/xotcl-core.info 11 Oct 2005 08:41:17 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
$html" + } + + + + +::xotcl::Object instproc __api_make_doc {inst proc_name} { + upvar doc doc private private public public deprecated deprecated + if {$doc eq ""} { + set doc_elements(main) "" + } else { + ad_parse_documentation_string $doc doc_elements + } + set defaults [list] + foreach a [my info ${inst}args $proc_name] { + if {[my info ${inst}default $proc_name $a d]} {lappend defaults $a $d} + } + set public [expr {$private ? false : true}] + set doc_elements(public_p) $public + set doc_elements(private_p) $private + set doc_elements(deprecated_p) $deprecated + set doc_elements(varargs_p) [expr {[lsearch args [my info ${inst}args $proc_name]]>-1}] + set doc_elements(flags) [list] + set doc_elements(switches) [list] + foreach f [my info ${inst}nonposargs $proc_name] { + set pair [split [lindex $f 0 0] :] + set sw [string range [lindex $pair 0] 1 end] + lappend doc_elements(switches) $sw + lappend doc_elements(flags) $sw [lindex $pair 1] + #my log "default_value $proc_name: $sw -> '[lindex $f 1]' <$pair/$f>" + if {[lindex $pair 1] eq "switch" && [lindex $f 1] eq ""} { + set default "false" + } else { + set default [lindex $f 1] + } + #my log "default_value $proc_name: $sw -> 'default' <$pair/$f>" + lappend defaults $sw $default + } + set doc_elements(default_values) $defaults + set doc_elements(positionals) [my info ${inst}args $proc_name] + # argument documentation finished + set scope [::xotcl::api scope] + set doc_elements(script) [::xotcl::api script_name $scope] + set proc_index [::xotcl::api proc_index $scope [self] ${inst}proc $proc_name] + if {![nsv_exists api_proc_doc $proc_index]} { + nsv_lappend api_proc_doc_scripts $doc_elements(script) $proc_index + } + #my log "doc_elements=[array get doc_elements]" + #my log "SETTING api_proc_doc '$proc_index'" + nsv_set api_proc_doc $proc_index [array get doc_elements] +} + +::xotcl::Object instproc ad_proc { + {-private:switch false} + {-deprecated:switch false} + {-warn:switch false} + {-debug:switch false} +} {proc_name args} { + ::xotcl::api split_arguments + uplevel [list [self] proc $proc_name $arguments $body] + my __api_make_doc "" $proc_name +} + +::xotcl::Class instproc ad_instproc { + {-private:switch false} + {-deprecated:switch false} + {-warn:switch false} + {-debug:switch false} +} {proc_name args} { + ::xotcl::api split_arguments + uplevel [list [self] instproc $proc_name $arguments $body] + my __api_make_doc inst $proc_name +} + +::xotcl::Object instproc ad_doc {doc_string} { + ad_parse_documentation_string $doc_string doc_elements + set scope [::xotcl::api scope] + set doc_elements(script) [::xotcl::api script_name $scope] + set proc_index [::xotcl::api object_index $scope [self]] + + #if {![nsv_exists api_proc_doc $proc_index]} { + # nsv_lappend api_proc_doc_scripts $doc_elements(script) $proc_index + #} + set doc_elements(public_p) true + set doc_elements(private_p) false + set doc_elements(varargs_p) false + set doc_elements(deprecated_p) false + set doc_elements(default_values) "" + set doc_elements(switches) "" + set doc_elements(positionals) "" + set doc_elements(flags) "" + nsv_set api_proc_doc $proc_index [array get doc_elements] + nsv_set api_library_doc \ + $proc_index \ + [array get doc_elements] + + set file_index $doc_elements(script) + if {[nsv_exists api_library_doc $file_index]} { + array set elements [nsv_get api_library_doc $file_index] + } + set oldDoc [expr {[info exists elements(main)] ? \ + [lindex $elements(main) 0] : ""}] + set prefix "This file defines the following Objects and Classes" + set entry [::xotcl::api object_link $scope [self]] + if {![string match *$prefix* $oldDoc]} { + append oldDoc "
$prefix: $entry"
+ } else {
+ append oldDoc ", $entry"
+ }
+ set elements(main) [list $oldDoc]
+ #my log "elements = [array get elements]"
+ nsv_set api_library_doc $file_index [array get elements]
+}
+
+
+Class ::Test -ad_doc {
+ Test Class for the documentation of
+ Classes
,
+ Objects
,
+ instprocs
, and
+ procs
.
+ @author Gustaf Neumann
+ @cvs-id $Id: 05-doc-procs.tcl,v 1.1 2005/10/11 08:41:18 gustafn Exp $
+}
+::Test ad_proc my-class-specific-proc {x y} {
+ This is a proc of Class Test merely for testing purposes...
+ @param x First Operand
+ @param y Second Operand
+} {
+ ns_log notice "hello world $x $y"
+}
+
+::Test ad_instproc my-method {-id:required} {
+ This is an instproc of Class Test merely for testing purposes...
+ @param id Some Id
+} {
+ ns_log notice "hello world $id"
+}
+::Test ad_instproc my-method2 {-id:required {-flag:boolean true}} {
+ This is an instproc of Class Test merely for testing purposes...
+ @param id Some Id
+ @param flag Some flag
+} {
+ ns_log notice "hello world $id"
+}
+::Test ad_instproc -private my-method3 {-id:required {-flag:boolean true} -switch:switch x {y 1}} {
+ This is an instproc of Class Test merely for testing purposes...
+ @param id Some Id
+ @param flag Some flag
+ @param switch Switch to turn on or off depending on default
+ @param x First Operand
+ @param y Second Operand
+} {
+ ns_log notice "hello world $id"
+}
+
+Class ::SpecializedTest -superclass ::Test -ad_doc {
+ A Class defined as a subclass of ::Test for testing the
+ documentation stuff...
+}
Index: openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl 11 Oct 2005 08:41:18 -0000 1.1
@@ -0,0 +1,161 @@
+ad_library {
+ Support for the recreation of classes objects without
+ destroying foreign references. Normally, when a class
+ definition is reloaded, the class is destroyed and created
+ again with the same name. During the destruction of a class
+ several references to this class are removed (e.g. in a
+ class hierarchy, the relation from instances to this class, etc.).
+ XOTcl provides support for altering this behavior through
+ the recreate method.
+
+ @author Gustaf Neumann
+ @creation-date 2005-05-13
+ @cvs-id $Id: 10-recreation-procs.tcl,v 1.1 2005/10/11 08:41:18 gustafn Exp $
+}
+
+if {![::xotcl::Object isclass ::xotcl::RecreationClass]} {
+ ::xotcl::Class create ::xotcl::RecreationClass -ad_doc {
+
This meta-class controlls the behavior of classes (and optionally + their instances), when the classes (or their instances) are + overwritten by same named new objects; we call this situation + a recreate of an object.
+ +Normally, when files with e.g. class definitions are sourced, + the classes and objects are newly defined. When e.g. class + definitions exists already in this file, these classes are + deleted first before they are newly created. When a class is + deleted, the instances of this class are changed into + instances of class ::xotcl::Object.
+ +This can be a problem when the class instances are not + reloaded and when they should survife the redefintion with the + same class relationships. Therefore we define a + meta class RecreationClass, which can be used to parameterize + the behavior on redefinitions. Alternatively, Classes or objects + could provide their own recreate methods.
+ +Per default, this meta-class handles only the class redefintion + case and does only a reconfigure on the class object (in order + to get e.g. ad_doc updated).
+ The following parameters are defined: +The meta class CrClass serves for a class of applications that mostly + store information in the content repository and that use a few + attributes adjoining this information. The class handles the open + acs object_type creation and the automatic creation of the + necessary tables based on instances of this meta-class.
+ +The definition of new types is handled in the constructor of + CrType through the method + create_object_type, + the removal of the + object type is handled through the method + drop_object_type + (requires that + all instances of this type are deleted).
+ +Each content item is retrieved though the method + get, + added through the method + add, + edited (updated) throught the + method + edit, + and deleted though the the method + delete.
+ +This Class provides generic methods for these purposes. For more + complex applications, these methods will be most probably overwritten + by defining subclasses with (some of) these methods or by object + specific methods.
+ } + + CrClass instproc unknown { obj args } { + my log "unknown called with $obj $args" + } + + CrClass set query_atts { + item_id creation_user creation_date last_modified object_type + } + CrClass set insert_atts {title description mime_type nls_language text} + + CrClass instproc object_types { + {-subtypes_first:boolean false} + } { + my instvar object_type_key + set order_clause [expr {$subtypes_first ? "order by tree_sortkey desc":""}] + return [db_list get_object_types " + select object_type from acs_object_types where + tree_sortkey between :object_type_key and tree_right(:object_type_key) + $order_clause + "] + } + + CrClass instproc edit_atts {} { + concat [[self class] set insert_atts] [my atts] + } + CrClass instproc atts {} { + set atts [list [my id_column]] + if {[my exists sql_attributes]} { + foreach att [my sql_attributes] { + lappend atts [lindex $att 0] + } + } + return $atts + } + + + CrClass instproc object_type_exists {} { + my instvar object_type + expr {$object_type eq [db_list select_type { + select object_type from acs_object_types where + object_type = :object_type + }]} + } + + CrClass ad_instproc create_object_type {} { + Create an oacs object_type and a table for keeping the + additional attributes. + } { + my instvar object_type supertype pretty_name pretty_plural \ + table_name id_column name_method + + my log "[self proc] $object_type" + set st [my info superclass] + if {$st ne "::xotcl::Object"} { + set supertype [string trimleft $st :] + } + db_transaction { + if {[my exists sql_attributes]} { + set sql_atts [list] + lappend sql_atts "$id_column integer primary key \ + references cr_revisions(revision_id)" + foreach {att spec} [my sql_attributes] { + lappend sql_atts "$att $spec" + } + + db_dml table_add "create table $table_name (\n[join $sql_atts ,\n])" + my log "adding table explicitely" + } + db_1row create_type { + select content_type__create_type(:object_type,:supertype, + :pretty_name, :pretty_plural, + :table_name, :id_column, :name_method) + } + db_1row register_type { + select content_folder__register_content_type(-100,:object_type,'t') + } + } + } + + CrClass ad_instproc drop_object_type {} { + Delete the object type and remove the table for the attributes. + This method should be called when all instances are deleted. It + undoes everying what create_object_type has produced. + } { + my instvar object_type table_name + db_transaction { + db_1row unregister_type { + select content_folder__unregister_content_type(-100,:object_type,'t') + } + db_1row drop_type { + select content_type__drop_type(:object_type,'t','t') + } + } + } + + CrClass instproc init {} { + my instvar object_type + set object_type [string trimleft [self] :] + if {[my info superclass] ne "::xotcl::Object"} { + my set superclass [[my info superclass] set object_type] + } + if {![my object_type_exists]} { + my create_object_type + } + my set object_type_key [db_list get_tree_sortkey { + select tree_sortkey from acs_object_types + where object_type = :object_type + }] + next + } + + CrClass ad_instproc get { + -item_id:required + } { + Retrieve the live revision of a content item with all attributes. + The retrieved attributes are strored in the instance variables in + class representing the object_type. + + @param item_id id of the item to be retreived. + } { + my instvar title table_name + set raw_atts [concat [[self class] set query_atts] [my edit_atts]] + set atts [list data] + foreach v $raw_atts { + catch {my instvar $v} + lappend atts n.$v + } + + db_1row note_select " + select [join $atts ,] from cr_items ci, ${table_name}i n + where ci.item_id = :item_id + and n.[my id_column] = ci.live_revision + " + my set text $data + my set item_id $item_id + } + + CrClass ad_instproc add { + form + } { + Insert a new item to the content repository and makes + it the live revision. This method obtains the values of + the new content item from the specified form. + + @param form form-object (instance of ::Generic::Form) from where the values are obtained + @return item_id of the new note. + } { + my instvar object_type table_name storage_type + + set atts [list item_id revision_id] + foreach v [[self class] set insert_atts] { + my instvar $v + lappend atts $v + } + + set form_vars [list] + foreach var [$form form_vars] {lappend form_vars $var [uplevel set $var]} + foreach var [$form form_vars] {set $var [uplevel set $var]} + + db_transaction { + set item_id [db_exec_plsql note_insert { + select content_item__new(:title,-100,null,null,null,null,null,null, + 'content_item',:object_type,:title, + :description,:mime_type, + :nls_language,:text,:storage_type) + }] + + set revision_id [db_nextval acs_object_id_seq] + + db_dml revision_add " + insert into ${table_name}i ([join $atts ,]) + values (:[join $atts ,:])" + + my update_main_table -revision_id $revision_id -form_vars $form_vars + + db_exec_plsql make_live { + select content_item__set_live_revision(:revision_id) + } + } + return $item_id + } + + CrClass instproc update_main_table { + -revision_id + -form_vars + } { + my instvar table_name + if {[llength [my atts]]>1} { + set vars [list] + foreach a [lrange [my atts] 1 end] {lappend vars $a} + catch {my instvar $vars} + foreach {att val} $form_vars {set $att $val} + if {[llength $vars]>1} { + db_dml main_table_update " + update $table_name set ([join $vars ,]) = (:[join $vars ,:]) + where [my id_column] = :revision_id" + } else { + db_dml main_table_update " + update $table_name set $vars = :$vars + where [my id_column] = :revision_id" + } + } + } + + CrClass ad_instproc edit { + form + } { + Updates an item in the content repository and makes + it the live revision. We insert a new revision instead of + changing the current revision. + + @param form form-object (instance of ::Generic::Form) from where the values are obtained + } { + my instvar table_name item_id + + set atts [concat [list item_id revision_id] [[self class] set insert_atts]] + catch {eval my instvar $atts} + + set form_vars [list] + foreach var [$form form_vars] {lappend form_vars $var [uplevel set $var]} + foreach var [$form form_vars] {set $var [uplevel set $var]} + + db_transaction { + set revision_id [db_nextval acs_object_id_seq] + + db_dml revision_add " + insert into ${table_name}i ([join $atts ,]) + values (:[join $atts ,:])" + + db_exec_plsql make_live { + select content_item__set_live_revision(:revision_id) + } + my update_main_table -revision_id $revision_id -form_vars $form_vars + } + } + + CrClass ad_instproc delete { + -item_id:required + } { + Delete a content item from the content repository. + @param item_id id of the item to be deleted + } { + db_exec_plsql note_delete { + select content_item__delete(:item_id) + } + } + + CrClass ad_instproc instance_select_query { + {-select_attributes ""} + {-order_clause ""} + {-with_subtypes:boolean true} + {-count:boolean false} + } { + returns the SQL-query to select the CrItems of the specified object_type + @select_attributes attributes for the sql query to be retrieved, in addion + to ci.item_id acs_objects.object_type + @param order_clause clause for ordering the solution set + @return sql query + } { + my instvar object_type_key + set attributes [list ci.item_id acs_objects.object_type] + foreach a $select_attributes { + if {$a eq "title"} {set a cr.title} + lappend attributes $a + } + set type_selection [expr {$with_subtypes ? + "acs_object_types.tree_sortkey between \ + '$object_type_key' and tree_right('$object_type_key')" : + "acs_object_types.tree_sortkey = '$object_type_key'"}] + set attribute_selection [expr {$count ? "count(*)" : [join $attributes ,]}] + return "select $attribute_selection + from acs_object_types, acs_objects, cr_items ci, cr_revisions cr + where $type_selection + and acs_object_types.object_type = ci.content_type + and ci.live_revision = cr.revision_id and + acs_objects.object_id = cr.revision_id $order_clause" + } + + # + # Form template class + # + + Class Form -parameter { + fields + object_type + {name {[namespace tail [self]]}} + add_page_title + edit_page_title + {with_categories false} + } -ad_doc { + Class for the simplified generation of forms. This class was designed + together with the content repository class + ::Generic::CrClass. + This class can be parameterized with ++ The class THREAD is used to create, initialize + and destroy threads and to pass commands to these + threads. It is designed in a way to create threads + lazyly such that thread definitions can be included + in the modules directory of the aolserver and + therefore be part of the aolserver blueprints. + When an instance of THREAD is created (e.g. t1), + an init-command is provided. e.g.: +
+ THREAD create t1 { + Class Counter -parameter {{value 1}} + Counter instproc ++ {} {my incr value} + Counter c1 + Counter c2 + } ++ Commands are sent to the thread via the + "do" method, which returns the result of the + command evaluated in the specified thread. + When the first command is sent to a + non-initialized thread, such as +
+ set x [t1 do c1 ++] ++ the actual thread is created and the thread + ID is remembered in a tsv array. When a + THREAD object is destroyed, the associated + thread is terminated as well. + + Notice that according to the aol-server behavior it + is possible to create **persistent threads** + (when the thread object is created during + startup and provided to all request threads + through the blueprint, or to create **volatile + threads** that are created during a request + and which are deleted when the thread cleanup + is called after some timeout. Volatile threads can + shared as well (when different request-threads + create the same-named thread objects) and can + be used for caching proposes. Flushing the cache + can be done in the thread's exitHandler. + + The Proxy class can be used to simplify + the interaction with a thread and to + hide the fact, that certain classes/objects + are part of a thread. The following command + creates a Proxy for an object c1 in thread t1. + After this, c1 can be used like an local object. +
+ THREAD::Proxy c1 -attach t1 + set x [c1 ++] ++ The Proxy forwards all commands to the + attached thread except the methods attatch, filter, + detachAll and destroy. The attach method can be used + to reattach a proxy instance to a different thread, such as +
+ c1 attach t2 ++ A proxy can be (temporarily) detachted from a thread via +
+ c1 filter "" ++ Later forwarding to the thread can be re-enabled via +
+ c1 filter forward ++ When a proxy is attached to a thread and + receives a destroy command, both the proxy + and the corresponding object in the thread + are deleted. If only the proxy object is to be + destroyed, the proxy must be detachted at first. + The class method detatchAll is provided to detach + all proxies from their objects. + + @author Gustaf Neumann + @creation-date 2005-05-13 + @cvs-id $Id: thread_mod-procs.tcl,v 1.1 2005/10/11 08:41:18 gustafn Exp $ +} + +::xotcl::Object setExitHandler { + #my log "EXITHANDLER of request thread [pid]" + if {[catch {Proxy detachAll} m]} { + #my log "EXITHANDLER error in detachAll $m" + } +} + +::Serializer exportObjects { + ::xotcl::THREAD + ::xotcl::THREAD::Client + ::xotcl::THREAD::Proxy +} + +################## main thread support ################## +::xotcl::RecreationClass create ::xotcl::THREAD \ + -instrecreate 1 \ + -parameter {{persistent 0}} + +::xotcl::THREAD instproc check_blueprint {} { + if {![[self class] exists __blueprint_checked]} { + if {[string first ::xotcl::THREAD [ns_ictl get]] == -1} { + _ns_savenamespaces + } + [self class] set __blueprint_checked 1 + } +} + +::xotcl::THREAD instproc init cmd { + my instvar initcmd + set initcmd { + ::xotcl::Object setExitHandler { + #my log "EXITHANDLER of slave thread SELF [pid]" + } + } + regsub -all SELF $initcmd [self] initcmd + append initcmd \n\ + "set ::xotcl::currentScript [info script]" \n\ + "set ::xotcl::currentThread [self]" \n\ + $cmd + my set mutex [thread::mutex create] + next +} + +::xotcl::THREAD ad_proc recreate {obj args} { + # this method catches recreation of THREADs in worker threads + # it reinitializes the thread according to the new definition. +} { + my log "recreating [self] $obj, tid [$obj exists tid]" + if {![string match ::* $obj]} { set obj ::$obj } + $obj set recreate 1 + next + $obj init [lindex $args 0] + if {[nsv_exists [self] $obj]} { + set tid [nsv_get [self] $obj] + ::thread::send $tid [$obj set initcmd] + $obj set tid $tid + my log "+++ content of thread $obj ($tid) redefined" + } +} + +::xotcl::THREAD instproc destroy {} { + my log "destroy called" + if {![my persistent] && + [nsv_exists [self class] [self]]} { + set tid [nsv_get [self class] [self]] + set refcount [::thread::release $tid] + my log "destroying thread object tid=$tid cnt=$refcount" + if {$refcount == 0} { + my log "thread terminated" + nsv_unset [self class] [self] + } + } + thread::mutex destroy [my set mutex] + next +} +::xotcl::THREAD instproc do {o args} { + if {![nsv_exists [self class] [self]]} { + # lazy creation of a new slave thread + + thread::mutex lock [my set mutex] + my check_blueprint + #my log "after lock" + if {![nsv_exists [self class] [self]]} { + set tid [::thread::create] + nsv_set [self class] [self] $tid + if {[my persistent]} { + my log "created new persistent [self class] as $tid pid=[pid]" + } else { + my log "created new [self class] as $tid pid=[pid]" + } + ::thread::send $tid [my set initcmd] + } else { + set tid [nsv_get [self class] [self]] + } + #my log "doing unlock" + thread::mutex unlock [my set mutex] + } else { + # target thread is already up and running + set tid [nsv_get [self class] [self]] + } + if {![my exists tid]} { + # this is the first call + if {![my persistent] && ![my exists recreate]} { + # for a shared thread, we do ref-counting through preseve + my log "must preserve for sharing request-thread [pid]" + set tid [nsv_get [self class] [self]] + ::thread::preserve $tid + } + my set tid $tid + } + #my log "calling [self class] ($tid, [pid]) $o $args" + return [thread::send $tid "$o $args"] +} + +# create a sample persistent thread that can be acessed +# via request threads +#THREAD create t0 { +# Class Counter -parameter {{value 1}} +# Counter instproc ++ {} {my incr value} +# +# Counter c1 +# Counter c2 +#} -persistent 1 +# + +################## forwarding proxy ################## +Class ::xotcl::THREAD::Proxy -parameter {attach} +::xotcl::THREAD::Proxy configure \ + -instproc forward args { + set cp [self calledproc] + if { [string equal $cp attach] + || [string equal $cp filter] + || [string equal $cp detachAll]} { + next + } elseif {[string equal $cp destroy]} { + eval [my attach] do [self] $cp $args + my log "destroy" + next + } else { + my log "forwarding [my attach] do [self] $cp $args" + eval [my attach] do [self] $cp $args + } + } -instproc init args { + my filter forward + } -proc detachAll {} { + foreach i [my info instances] {$i filter ""} + } +# the following does not work yet +#::xotcl::THREAD::Proxy proc create {obj args} { +# my log "[self proc] $obj" +# my filter "" +# next +#} + +# sample Thread client routine, calls a same named object in the server thread +Class create ::xotcl::THREAD::Client -parameter server +::xotcl::THREAD::Client instproc do args { + eval [my server] do [self] $args +} + Index: openacs-4/packages/xotcl-core/www/ad-instproc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/www/Attic/ad-instproc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xotcl-core/www/ad-instproc.tcl 11 Oct 2005 08:41:18 -0000 1.1 @@ -0,0 +1,23 @@ + + +Object o +o ad_proc t1 {{-a 1} -b:required x {y 4}} {} { + expr {$a + $b + $x + $y} +} + + +ad_proc t2 {{-a 1} -b:required x {y 4}} {} { + expr {$a + $b + $x + $y} +} + +set v1 [o t1 -b 2 3] +set v2 [t2 -b 2 3] + + +ns_return 200 text/plain " +xotcl ad_proc t1=$v1 [time {time {o t1 -b 2 3} 10000}] +ad_proc t2=$v2 [time {time {t2 -b 2 3} 10000}] +xotcl ad_proc t1=$v1 [time {time {o t1 -b 2 3} 10000}] +ad_proc t2=$v2 [time {time {t2 -b 2 3} 10000}] +" + Index: openacs-4/packages/xotcl-core/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xotcl-core/www/index.adp 11 Oct 2005 08:41:18 -0000 1.1 @@ -0,0 +1,16 @@ +
\n" + +if {[nsv_exists api_library_doc $index]} { + array set doc_elements [nsv_get api_library_doc $index] + append output [lindex $doc_elements(main) 0] + append output "\n" + +if {$show_source} { + append output [::xotcl::api source_to_html $obj_create_source] \n +} + +if {$show_methods} { + append output "\n" + if { [info exists doc_elements(creation-date)] } { + append output "
\n" + + set url "/api-doc/procs-file-view?path=[ns_urlencode $doc_elements(script)]" + append output "Defined in $doc_elements(script)- Created:\n
- [lindex $doc_elements(creation-date) 0]\n" + } + if { [info exists doc_elements(author)] } { + append output "
- Author[ad_decode [llength $doc_elements(author)] 1 "" "s"]:\n" + foreach author $doc_elements(author) { + append output "
- [api_format_author $author]\n" + } + } + if { [info exists doc_elements(cvs-id)] } { + append output "
- CVS Identification:\n
- \ +
[ns_quotehtml [lindex $doc_elements(cvs-id) 0]]
\n" + } + append output "" + + array unset doc_elements +} +set my_class [DO $object info class] +set obj_create_source "$my_class create $object" +set title "[::xotcl::api object_link $scope $my_class] $object" +set class_references "" + +if {$isclass} { + append obj_create_source \ + [info_option $scope $object superclass] \ + [info_option $scope $object parameter] \ + [info_option $scope $object instmixin] + info_option $scope $object subclass +} + +append obj_create_source \ + [info_option $scope $object mixin] + +if {$class_references ne ""} { + append output "
Class Relations
\n$class_references
\n" +} +append output "
" \ + [api_tcl_to_html [::xotcl::api proc_index $scope $object proc $m]] \ ++ } + } + } + if {$isclass} { + set cls [lsort [DO $object info instprocs]] + foreach m $cls { + set out [api_documentation $scope $object instproc $m] + if {$out ne ""} { + append output "
" \ + [api_tcl_to_html [::xotcl::api proc_index $scope $object instproc $m]] \ ++ } + } + } + } + append output
\n \ + $instances \ +\n + } +} + + +DO $s destroy