Update of /cvsroot/win32forth/win32forth/apps/Internet/WebServer
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28259/apps/Internet/WebServer
Modified Files:
WebServer.F
Log Message:
Made the WebServer a turnkey application.
Index: WebServer.F
===================================================================
RCS file: /cvsroot/win32forth/win32forth/apps/Internet/WebServer/WebServer.F,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WebServer.F 13 Jun 2007 13:00:44 -0000 1.1
--- WebServer.F 13 Jun 2007 17:38:15 -0000 1.2
***************
*** 2,16 ****
\ Tom Dixon
needs http
needs httpecho
needs httpmime
needs httpfile
- \ Setup Server
80 httpserver http
! http setup-http
! http serv-init
! \ Run the Server
! : www-server begin http serv-poll 10 ms key? until ;
--- 2,103 ----
\ Tom Dixon
+ anew -WebServer.f
+
+ true value create-turnkey? \ set to false when you don't want a turnkey app
+
needs http
needs httpecho
needs httpmime
needs httpfile
+ needs browsefld
80 httpserver http
! \ *G our http-server instance
! : server-set-title ( -- )
! \ *G set title of the console window
! Z" Win32Forth - HTTP Web Server" conHndl call SetWindowText drop ;
!
! s" doc\" Prepend<home>\ webpath place
! \ *G the path to the web content
!
! : server-choose-path { \ $path -- }
! \ *G chosse the path for the folder with the web content
! z" Choose the web content folder."
! MAXSTRING LocalAlloc: $path webpath count $path place
! $path conHndl BrowseForFolder
! if $path count webpath place
! webpath ?+\
! then ;
!
! : server-init ( -- )
! \ *G init the server
! http setup-http http serv-init ;
!
! : server-run ( -- )
! \ *G run the server
! begin http serv-poll 10 ms key? until ;
!
! : server-exit ( -- )
! \ *G close the server
! http serv-close
!
! create-turnkey?
! if bye
! else cr ." Type 'www-server <cr>' to restart the server."
! then ;
!
! : www-server
! \ *G main
! server-set-title
!
! cls ." The Win32Forth HTTP Web Server is running." cr
!
! server-choose-path
!
! cr ." webpath = " webpath count type cr
! cr ." Press any key to stop the server."
!
! server-init
! server-run
! server-exit
! ;
!
! \ create a turnkey application
! create-turnkey? [IF]
!
! also hidden
!
! : www-server-hello ( -- ) \ startup stuff
!
! \ default initialization (needed for all turnkey apps)
! init-console
! if initialization-chain do-chain then
! exception@ if bye then
!
! \ our own initialization
! menu-off \ close menubar
! ['] _interpret is interpret \ close the statusbar
! Destroy: ConsoleStatusbar
! init-screen \ show console
!
! get-commandline \ copy commandline to SOURCE
! default-application \ and run our app
! ;
!
! previous
!
! \ override default-hello with our own one
! ' www-server-hello is default-hello
!
! \ and create the application
! &forthdir count &appdir place
! 0 0 ' www-server APPLICATION WebServer.exe
! 1 pause-seconds bye
!
! [else]
!
! www-server
!
! [then]
|