#---------------------------------------------------------------- # # An attempt to emulate a FORK for Windows # # Usage: # First line of your program should load this context. # The fork command looks like: (winfork '(func)) # # The 'PRODCONS.LSP' also runs on Windows now. # # June 4, 2005 - idea by PvE. # # Version 1.0: # -Initial version # # Version 1.1: # -Improved on suggestions by Lutz Mueller. # # Version 1.11: # -Small change because of changed behaviour in 'source' #---------------------------------------------------------------- (context 'winfork) # Capture newLisp internal symbols (constant 'winfork_SYMBOLS (symbols 'MAIN)) # Setup environment for FORK (define (winfork:winfork winfork_ARG) # Let the total result start with 'silent' (set 'winfork_ENV "(silent ") # Get all the user-defined symbols (context 'MAIN) ; only required for v.8.8.0 for 'source' (dolist (winfork_VAR (difference (symbols MAIN) winfork_SYMBOLS)) (write-buffer winfork_ENV (source winfork_VAR))) # Append the actual forked function (set 'winfork_ENV (append winfork_ENV ")" (string winfork_ARG))) # Replace existing double-quotes (replace {"} winfork_ENV {\"}) # Now start new process (process (append {newlisp -e "} winfork_ENV {"})) ) (context 'MAIN) #---------------------------