show-class-graph.tcl

Show an XOTcl class or object

Location:
/packages/xotcl-core/www/show-class-graph.tcl
Author:
Gustaf Neumann
CVS ID:
$Id: show-class-graph.tcl,v 1.12.2.6 2022/11/26 17:00:30 gustafn Exp $

Related Files

[ hide source ] | [ make this the default ]

File Contents

ad_page_contract {
  Show an XOTcl class or object

  @author Gustaf Neumann
  @cvs-id $Id: show-class-graph.tcl,v 1.12.2.6 2022/11/26 17:00:30 gustafn Exp $
} -query {
  {classes:token}
  {documented_only:boolean 1}
  {with_children:boolean 0}
  {dpi:integer 96}
  {format:word png}
}


set dot_code [::xo::dotcode -dpi $dpi \
                  -with_children $with_children -documented_methods $documented_only \
                  $classes]
set dot [::util::which dot]

if {$dot eq ""} {
  ns_return 404 plain/text "dot not found"
  ad_script_abort
}


try {
  set F [ad_opentmpfile dotfile dot]
  puts $F $dot_code
  close $F

  exec $dot -T$format -O $dotfile
  set outfile $dotfile.$format
  
} on error {errorMsg} {
  catch {close $F}
  ns_log warning "show-class-graph: dot returned $errorMsg"
  ad_return_error "dot error" $errorMsg
} on ok {result} {
  ns_returnfile 200 [ns_guesstype $outfile$outfile
  file delete -- $outfile
} finally {
  file delete -- $dotfile
}

#
# Local variables:
#    mode: tcl
#    tcl-indent-level: 2
#    indent-tabs-mode: nil
# End: