Capturing Compile-time Error Messages

Note that some errors may be generated before the script begins running (e.g. compile warnings): in Vortex version 4.00.1018000000 20020405 and later these messages are saved until the script runs (if possible) and thus may cause <putmsg> to be called even before the normal start function. Programmers should thus call any header-HTML type function in <putmsg> as well as their start function (with a one-time-call check variable) to ensure such header HTML is printed before any <putmsg> output. E.g.:

<A NAME=look PRIVATE>
<!-- Our header HTML for every page -->
  <!-- First ensure we only call this function once: -->
  <varinfo type "didlook"><if "double" eq $ret><return></if>
  <sum "%g" 0><$didlook = $ret>
  <!-- Ok, first time called.  Now print our header HTML: -->
  <BODY BGCOLOR=white>
</A>

<A NAME=putmsg PRIVATE>
<LOCAL saveret=$ret saveloop=$loop savenext=$next>
  <look>                <!-- print header HTML first -->
  <LOOP $errmsg>
    <fmt "Error: %s\n" $errmsg>
  </LOOP>
  <$ret = $saveret><$loop = $saveloop><$next = $savenext>
</A>

<A NAME=main PUBLIC>
  <look>                <!-- print header HTML first -->
  This is our main script function.
  ...
</A>

In this example, we call the <look> function to print our header HTML. We call it in any function that may start execution, in this case both the <main> function - for normal operations - and the <putmsg> function - in case errors occur before the script starts.


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.