_Ficl Update_
by John Sadler (with thanks to Randy Leberknight)

: signum ( x -- sign )
  dup 0< if  drop  -1
  else
    0= if 0  else 1 endif
  endif
;


_Myopic About File Names_
by Joe Sam Shirah


<HTML>
<TITLE>Files from a URL</TITLE>

<BODY>
<P></P>
<P></P>
<P></P>

<APPLET CODE=urlfilea.class WIDTH=300 HEIGHT=300>
</APPLET>

</BODY>

</HTML>


//  urlfilea.java - test URL/File entries
//  Compiled under JDK 1.1.7B
//  System: Win98; JVM: Sun ( from JDK )

/* --------------------------------------------
        Expects a file URL of the general form:
        file.ext  ( can have optional dir/ )

        otherwise expects a valid file of form:
        root:/dir/file.ext
----------------------------------------------- */

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;

public class urlfilea   extends    Applet
                              implements ActionListener
{
  URL myURL;
  File myFile;

  String sNL = System.getProperty("line.separator");

  TextField tfEntry;
  TextArea  taResult;
  Checkbox cbURL;
  Button    bOK;

  public void init()
  {
    cbURL = new Checkbox( "URL", true );
    bOK = new Button( "OK" );
    bOK.addActionListener(this);

    tfEntry = new TextField( "", 15 );
    taResult = new TextArea( 10, 40 );

    add( new Label( "URL/File Name:" ) );
    add( tfEntry );
    add( cbURL );
    add( bOK );
    add( taResult );

    return;
  }  // end init


// ActionListener Event
  public void actionPerformed(ActionEvent event)
  {
    Object source = event.getSource();

    if ( (source == bOK) )
    {
      taResult.setText( "" );
      if( cbURL.getState() == true )
      {
        try
        {
           myURL = new URL( getCodeBase()
                       + tfEntry.getText() );
           taResult.append( "CodeBase is "
                   + getCodeBase() + "." + sNL );
           taResult.append( "DocBase is "
                   + getDocumentBase() + "." + sNL );
           taResult.append( "myURL is "
                   + myURL + "." + sNL );
           myFile = new File( myURL.getFile() );
        }
        catch( MalformedURLException e )
        {
           taResult.append( "Invalid URL." + sNL );
           return;
        }
      } // end if cbURL...
      else
      {
         myFile = new File( tfEntry.getText() );
      } // end assumed file entry

      taResult.append( "myFile is " + myFile + "." + sNL );
      try
      {
        taResult.append( "pathSep is: " +
                 myFile.pathSeparator + sNL );
        taResult.append( "Sep is: " +
                 myFile.separator + sNL );
        taResult.append( "Canonical: " +
                 myFile.getCanonicalPath() + sNL );
        taResult.append( "Absolute: " +
                 myFile.getAbsolutePath() + sNL );
        taResult.append( "Path: " +
                 myFile.getPath() + sNL );
      }
      catch( Exception e)
      {
        taResult.append( e.toString() );
      }
      return;
    }  // end if source is bOK
  }  // end actionPerformed

}  // End Class urlfilea

