#!/usr/local/bin/tops -p -s /usr/local/tops/sys -u /opt/mytops/usr/
#!../src/tops -s ../sys -u ../usr

{ File mrtim

  March 2008

  This file is adapted from /usr/local/tops/usr/tiny to run an
  interactive prompt when file mobius.n is used to display real 
  time markets.

  Copyright (c) 2011   D. R. Williamson
}

{ GNU General Public License

Program Tops - a stack-based computing environment
Copyright (C) 1999-2011  Dale R. Williamson

Author: Dale R. Williamson <dale.williamson@prodigy.net>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

------------------------------------------------------------------------

  File: tiny  December 2003
  Copyright (C) 2003  D. R. Williamson

  This script runs the program interactively in a minimal style, 
  like Forth.

  Use .s to display the stack.

---------------------------------------------------------------------- }

\ Starting a keyboard.

no catmsg
"key.v" "Keyboard words" msource
keyboard
keyboard_finish
ok off \ no auto stack display; .s shows the stack

\-----------------------------------------------------------------------

\ Defining word tinyc, tiny console.

CATMSG (f) push no catmsg

inline: cprompt ( --- qS) \ the console prompt
   [ "% " "prompt" book ] prompt ;

inline: tinyc (qS --- f) \ prompter runs this word
   [ "tout chars 0> IF nl THEN" "NL" macro ]

   (qS) "bye" over = IF drop "exit" THEN (qS) \ no Good-bye
   (qS) "sp" over = IF drop "spx" THEN (qS) 

   nl (qS) main \ run text S
   NL           \ run NL macro
   yes (f)      \ keep prompter running
end

pull (f) catmsg
fence

\-----------------------------------------------------------------------

\ Defining new words (new words can be added here, or sourced later
\ from a file).

CATMSG (f) push no catmsg

\"movs.nv" filefound IF source ELSE "movs.n" psource THEN
\"movs.n" psource

\"mobius.n" psource
"mobius.nv" filefound IF yes source ELSE no "mobius.n" psource THEN
(f) "NV" book

pull (f) catmsg

\-----------------------------------------------------------------------

\ Running tinyc with prompter().

clear
"tinyc" ptr (ptrRun) \ ptr to tinyc

"Electronic Market Console" . nl
NV IF "Using mobius.nv" . nl THEN
"Enter ? for help, exit to quit" . nl 
"Enter a market symbol to connect to the real time data server: " . nl
tracklist1 lowercase vol2str 2 indent . nl

cprompt (qPrompt)    \ prompt to show
prompter 
exit




