Texis Web Script source code for: /texis/site/demos/dox.vs
Note: Click on links to view the documentation for HTML tags which are special to the Vortex compiler.
<script language=vortex>

<uses demonav=demonav>
<putmsg log on>

<!-- 
     This script is very useful, but rather convoluted.
     
     We maintain a Webinator database index to the HTML documentation.
     This script scans this database for function descriptions and
     then uses this information to automatically create hyperlinks
     in the source of a Texis Web Script code example to the documentation
     for any of the referenced functions.
     
     It certainly shows off the power of its ability to fetch and
     edit other documents on the Web.

-->

<a name=dox>                              <!-- common document header -->
<block>
<!-- /site/demos/gbwr may set $target: -->
<if "_top" neq $target><$target = ></if>
<demolook title="Texis Web Script Source Viewer" baseTarget=$target>
</a>

<a name=/dox>                              <!-- common document footer -->
</span>
<h6 align=right>Copyright © 1992-1999 Thunderstone Software</h6>
</look>
</a>

<!-- ----------------------------------------------------------------- -->

<a name=init> <!-- Get function name information from quickref  -->
<sum "%s" $SERVER_ROOT "/texis"><db = $ret>
<apicp allinear 1>
<sql "select $SiteUrlPrefix + '/site/' + Link docurl,
             '<' + Title titles from quick
      where Cat = 'TEXIS WEBSCRIPT' and
            Body like '/<pre><tt>'"/>
  <!-- `<pre><tt>' typical for functions, directives -->
<rex ">><=[^\-,]+" $titles /> <!-- Build list of search REX expressions -->
<sandr "\space+\-=" "" $ret>
<sandr "," "\x00" $ret>
<sandr ">>\alpha=\alnum*" "\1\2=\\F[=& ]" $ret>
<sandr ">>\\\RF=!\\\RF+\\\RF" "\1\2" $ret><!-- remove extra \F's -->
<sandr "<" "<=/\\P\?" $ret>
<$searchset = $ret>
<loop $docurl>          <!-- Build list of <sandr> replace expressions -->
<$t= "<a href=" $docurl ">\3</a>" > 
<sum "%s" $t>
<$t = $replace>
<$replace = $t $ret>
</loop>
</a>

<!-- ----------------------------------------------------------------- -->

<a name=gettitles>  <!-- Display manual page table of contents entries -->
<init>

<rex ">><=[^\-]+\-" $titles />
<sandr "\space+\-=" ">" $ret>
<sandr ", " ">,<" $ret>
<$names=$ret>

<rex ">><=[^\-]+-\P=.+"  $titles /> 
<$purposes = $ret>             
<rex ">><=[^\-]+-\P=.+"  $titles /> 
<$purposes = $ret>
<center>
<table border=1>
   <tr><th colspan=2>Overview of Available Texis Web Script Tags</th></tr>
   <tr><th align=left>Operation</th><th>Purpose</th></tr>
   <sort $names $purposes $docurl>
   <loop $docurl $names $purposes>
      <tr><td><a href="$docurl"><b>$names</b></a></td><td>$purposes</td></tr>
   </loop>
</table>
</center>
</a>

<!-- ----------------------------------------------------------------- -->


<a name=hysource>             <!-- hyperlink the html source to a demo -->
<init>
<urlcp maxpgsize 1500000>
<rex "[^/]+:" $demo />
<if $ret eq "">
  <sum "%s" $SiteUrlPrefix "/site" $demo $demoext>
<else>
  <$ret = $demo>
</if>
<fetch urls=$ret />
<$res = $ret>
<sandr "<" "<" $res>
<sandr ">" ">" $ret>
<sandr $searchset $replace $ret> 
<sandr ">><\!--=!-->+-->=" '<b><span style\="color: \#003300">\1\2\3</span></b>' $ret>
<pre>
<send $ret>
</pre>
</a>


<!-- ----------------------------------------------------------------- -->

<a name=main public runlink="y">
<local f>
<dox>
<if $demo="">
  <gettitles>
<else>
  <!-- Generate URL to execute given demo: -->
  <rex ">>=http=s?://" $demo />
  <if $ret ne "">
    <rex "/texis/" $demo />
    <if $ret neq "">
      <sandr "[^/\.]+\.=[^\.]+>>=" "" $demo>
    <else>
      <sandr ">>http=s?://=[^/]+.+" "\1\2\3/texis\4" $demo>
    </if>
  <else>
    <sandr ">>/site" "" $demo><$demo = $ret><!-- wtf -->
    <sum "%s" $DOCUMENT_ROOT "/site">
    <$demourl = $ret $demo>
    <$demoext="">
    <sum "%s" $demourl $demoext><$f = $ret>
    <stat $f />
    <if $ret.err ne ''>
       <$demoext=".vs">
       <sum "%s" $demourl $demoext><$f = $ret>
       <stat $f />
       <if $ret.err ne ''>
          No such code example.<p>
          <a href="/texis/site/pages/Code_Examples.html">All Code Examples</a>
          <exit 1>
       </if>
    </if>
    <!-- Do not give a link to run it if there is no <main> (eg. module): -->
    <read $f>
    <rex ">><a=\space+name=\space*\==\space*main" $ret />
    <if "" eq $ret><$runlink = "n"></if>
    <$demourl = "/texis/site" $demo>
    <sum "%s" $demourl>
  </if>
  <!-- KNG 990611 may have .vor extension: -->
  <sandr "\.vor=>>=" "" $ret>
  <!-- KNG 20061106 add trailing slash for "dirs", for consistency: -->
  <sandr "/=\alnum+>>=" "\1\2/" $ret>
  <$demourl = $ret>
  <b> <a href=/site/vortexman/>Texis Web Script</a> source code for:
  <if "y" eq $runlink>
    <a href="$demourl" target=_top>$demourl</a>
  <else>
    $demourl
  </if>
  </b><br>
  <small><b>Note:</b> Click on links to view the documentation for HTML tags
   which are special to the Vortex compiler.</small>
  </small>
  <hr>
  <hysource>
  <hr>
  <h4 align=right><a href="/texis/site/pages/Code_Examples.html">Back to the Code Example List</a></h4>
  <h5 align=center> The Source Viewer is also a Code Example.<br>
    <a href="/texis/site/demos/dox/?demo=/demos/dox.vs"> Click Here </a>to see its source.
  </h5>
</if>
</dox>
</a>

<!-- ----------------------------------------------------------------- -->

<a name=block>
<rex "webtv" $HTTP_USER_AGENT />
<if $ret neq "">
  <fetch urls=$demo />

  <html><head><title>Thunderstone's WebTV Source Viewer</title></head>
  <body bgcolor=white>
  <b><a href=/>THUNDERSTONE</a>'s WebTV Source Viewer</b><br>
  <pre>
  $ret
  </pre>
  </body>
  </html>
  <exit>
</if>
</a>

<!-- ----------------------------------------------------------------- -->

<a name=putmsg>
  <LOOP $errmsg $errnum $errfunc $errscript $errline>
    <substr $errmsg 0 21>
    <IF $ret eq "Unknown access method">
      This application does not understand the given URL.
    </IF>
    <send "<!-- ">$errnum $errscript:$errline: $errmsg in the function $errfunc<send " -->">

  </LOOP>
</A>

</script>

Back to the Code Example List

The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software
Copyright © 2024 Thunderstone Software LLC. All rights reserved.