Clean up contrib/vim and contrib/process
parent
618a680556
commit
f0bfc94261
|
@ -37,7 +37,7 @@ Available libraries:
|
||||||
- math -- extended math library (Doug Coleman, Slava Pestov)
|
- math -- extended math library (Doug Coleman, Slava Pestov)
|
||||||
- parser-combinators -- Haskell-style parser combinators (Chris Double)
|
- parser-combinators -- Haskell-style parser combinators (Chris Double)
|
||||||
- postgresql -- PostgreSQL binding (Doug Coleman)
|
- postgresql -- PostgreSQL binding (Doug Coleman)
|
||||||
- process -- Run external programs (Slava Pestov)
|
- process -- Run external programs (Slava Pestov, Doug Coleman)
|
||||||
- random-tester -- Random compiler tester (Doug Coleman)
|
- random-tester -- Random compiler tester (Doug Coleman)
|
||||||
- rss -- Code to retrieve and parse an RSS2 file (Chris Double)
|
- rss -- Code to retrieve and parse an RSS2 file (Chris Double)
|
||||||
- sequences -- Non-core sequence words (Eduardo Cavazos)
|
- sequences -- Non-core sequence words (Eduardo Cavazos)
|
||||||
|
|
|
@ -3,5 +3,4 @@ USING: kernel ;
|
||||||
PROVIDE: contrib/process {
|
PROVIDE: contrib/process {
|
||||||
{ "os-unix.factor" [ unix? ] }
|
{ "os-unix.factor" [ unix? ] }
|
||||||
{ "os-windows.factor" [ windows? ] }
|
{ "os-windows.factor" [ windows? ] }
|
||||||
"process.factor"
|
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
IN: process
|
IN: process
|
||||||
USING: compiler io io-internals kernel parser generic ;
|
USING: compiler io io-internals kernel parser generic
|
||||||
|
sequences ;
|
||||||
|
|
||||||
LIBRARY: libc
|
LIBRARY: libc
|
||||||
FUNCTION: int system ( char* command ) ;
|
FUNCTION: int system ( char* command ) ;
|
||||||
|
@ -9,6 +10,8 @@ FUNCTION: int pclose ( void* file ) ;
|
||||||
: run-process ( string -- ) system io-error ;
|
: run-process ( string -- ) system io-error ;
|
||||||
: run-detached ( string -- ) " &" append run-process ;
|
: run-detached ( string -- ) " &" append run-process ;
|
||||||
|
|
||||||
|
! Help me implement the equivalent feature on Windows, please...
|
||||||
|
|
||||||
TUPLE: process-stream pipe ;
|
TUPLE: process-stream pipe ;
|
||||||
|
|
||||||
C: process-stream ( command mode -- stream )
|
C: process-stream ( command mode -- stream )
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
IN: process
|
IN: process
|
||||||
USING: alien compiler io io-internals kernel math parser generic win32-api ;
|
USING: alien compiler io io-internals kernel math parser generic
|
||||||
|
win32-api ;
|
||||||
|
|
||||||
: (run-process) ( string flag -- )
|
: (run-process) ( string flag -- )
|
||||||
>r f swap
|
>r f swap f f 0 r> f f
|
||||||
f f 0 r> f f
|
"STARTUPINFO" <c-object>
|
||||||
"STARTUPINFO" <c-object> "STARTUPINFO" c-size over set-STARTUPINFO-cb
|
"STARTUPINFO" c-size over set-STARTUPINFO-cb
|
||||||
"PROCESS_INFORMATION" <c-object> CreateProcess zero? [ win32-error ] when ;
|
"PROCESS_INFORMATION" <c-object> CreateProcess
|
||||||
|
win32-error=0 ;
|
||||||
|
|
||||||
: run-process
|
: run-process ( string -- )
|
||||||
0 (run-process) ;
|
0 (run-process) ;
|
||||||
|
|
||||||
: run-detached ( string -- )
|
: run-detached ( string -- )
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
IN: process
|
|
||||||
USING: compiler io io-internals kernel parser generic ;
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
! Generate a new factor.vim file for syntax highlighting
|
||||||
|
REQUIRES: contrib/httpd ;
|
||||||
|
|
||||||
|
IN: vim
|
||||||
|
|
||||||
|
USING: embedded io ;
|
||||||
|
|
||||||
|
"contrib/vim/factor.vim.fgen" resource-path
|
||||||
|
"contrib/vim/factor.vim" resource-path
|
||||||
|
embedded-convert
|
|
@ -1,4 +1,4 @@
|
||||||
REQUIRES: contrib/httpd contrib/process ;
|
REQUIRES: contrib/process ;
|
||||||
PROVIDE: contrib/vim {
|
PROVIDE: contrib/vim {
|
||||||
"vim.factor"
|
"vim.factor"
|
||||||
"vim.facts"
|
"vim.facts"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
IN: vim
|
IN: vim
|
||||||
USING: definitions embedded io kernel namespaces parser prettyprint process
|
USING: definitions io kernel namespaces parser prettyprint
|
||||||
sequences ;
|
process sequences ;
|
||||||
|
|
||||||
SYMBOL: vim-path
|
SYMBOL: vim-path
|
||||||
|
SYMBOL: vim-detach
|
||||||
|
|
||||||
"vim" vim-path set-global
|
"vim" vim-path set-global
|
||||||
|
|
||||||
|
@ -10,15 +11,11 @@ SYMBOL: vim-path
|
||||||
[ "\"" % vim-path get % "\" \"" % swap % "\" +" % # ] "" make ;
|
[ "\"" % vim-path get % "\" \"" % swap % "\" +" % # ] "" make ;
|
||||||
|
|
||||||
: vim-location ( file line -- )
|
: vim-location ( file line -- )
|
||||||
vim-command run-process ;
|
vim-command
|
||||||
|
vim-detach get-global
|
||||||
|
[ run-detached ] [ run-process ] if ;
|
||||||
|
|
||||||
: vim ( spec -- )
|
: vim ( spec -- )
|
||||||
#! Edit the file in vim. Rerun the file if the timestamp is changed.
|
|
||||||
where first2 vim-location ;
|
where first2 vim-location ;
|
||||||
|
|
||||||
[ vim-location ] edit-hook set-global
|
[ vim-location ] edit-hook set-global
|
||||||
|
|
||||||
: vim-syntax
|
|
||||||
#! Generate a new factor.vim file for syntax highlighting
|
|
||||||
"contrib/vim/factor.vim.fgen" "factor.vim" embedded-convert ;
|
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,16 @@ IN: vim
|
||||||
USING: definitions help io words ;
|
USING: definitions help io words ;
|
||||||
|
|
||||||
ARTICLE: { "vim" "vim" } "Vim support"
|
ARTICLE: { "vim" "vim" } "Vim support"
|
||||||
"This module makes the " { $link edit } " word work with Vim. The "
|
"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is " { $snippet "\"vim\"" } "."
|
||||||
{ $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is \"vim\". For Windows, place the following example .factor-boot-rc in the directory returned by " { $link home } ":"
|
$terpri
|
||||||
|
"If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":"
|
||||||
{ $code
|
{ $code
|
||||||
"USING: modules namespaces ;"
|
"USING: modules namespaces ;"
|
||||||
"REQUIRES: contrib/vim ;"
|
"REQUIRES: contrib/vim ;"
|
||||||
"USE: vim"
|
"USE: vim"
|
||||||
"\"d:\\program files\\vim\\vim70\\gvim\" vim-path set-global"
|
"\"d:\\program files\\vim\\vim70\\gvim\" vim-path set-global"
|
||||||
} ;
|
}
|
||||||
|
"On Unix, you may omit the last line if " { $snippet "\"vim\"" } " is in your " { $snippet "$PATH" } "."
|
||||||
|
$terpri
|
||||||
|
"If you are running the terminal version of Vim, you want it to block Factor until exiting, but for GVim the opposite is desired, so that one can work in Factor and GVim concurrently. The " { $link vim-detach } " global variable can be set to " { $link t } " to detach the Vim process. The default is " { $link f } "." ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue