[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
newlispfanclub.alh.net • View topic - (link'ing and (!'ing Example

(link'ing and (!'ing Example

Q&A's, tips, howto's

(link'ing and (!'ing Example

Postby CaveGuy » Sat Nov 02, 2002 3:06 am

The following example should provide some clue to
building and (!'ing newLISP executables.

We will use the link.lsp example from the source distribution set to link DoTest-p and SoTest-c into standalone EXEs.

DoTest-p is a parent task that (!s' DoTest-c.exe as a child task.
DoTest-c (loads' DoTest-0.dat which (sets' a return list to pass back to its parent, DoTest-p using an intermediate file DoTest-1.Dat.
Upon return to DoTest-p's control DoTest-1.dat is (loaded.

(link "newlisp.exe" "DoTest-p.exe" "DoTest-p.lsp")
(link "newlisp.exe" "DoTest-c.exe" "DoTest-c.lsp")

;; dolist-0.dat
(set 'done '(X 1 Y 2 Z 3))

;; dotest-p.lsp
(define (run)
(time (if (= (! "DoTest-c.exe") 2) (load "DoTest-1.dat")))
(print return))
(run)
;; eof

;; Dotest-c.lsp
(load "DoTest-0.dat") ; get and set a value for 'done to return.
(set 'fh (open "DoTest-1.dat" "write"))
(write-line (append "(set 'return '" (string done) ")") fh)
(close fh)
(exit 2)
;; eof

;; link.lsp example included in the source distribution set.
;;
(define (link orgExe newExeName lispSourceName)
(set 'size (first (file-info orgExe)))

;; copy newLISP.exe to the newExeName
(copy-file orgExe newExeName)

;; get the binary representation of size
(set 'buff (pack "ld" size))

;; open the new exe for update
(set 'handle (open newExeName "u"))
(search handle "@@@@@@@@")

;; this field gets read by the newLISP startup
(write-buffer handle 'buff 4)
(set 'buff (trim (read-file lispSourceName)))
(set 'keylen (pack "ld" (length buff)))
(write-buffer handle 'keylen 4)

;; append lisp source at the end
(seek handle size)
(set 'buff (encrypt buff (string (length buff))))
(write-buffer handle 'buff (length buff))
(close handle))
;; eof


I have a vague memory of seeing somewhere mention of how to eliminate the flashing black window to nowhere. I can not seem to find it again :(

At one point in my testing I built a feedback loop that flash a window every 300ms till I got it stopped :)

This example and the one that this will evolve into in real life need to pass the file name of the return data to avoid collision with other processes.

Wish List Item:
(get-tmp-filename) returns a unique temp filename using the system call.
CaveGuy
 
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio

Postby HPW » Sat Nov 02, 2002 1:05 pm

To avoid the flicker:

From newlisp-tk help:

In the file newlisp-tk.config include the following line:

set Ide(initCommand) "wm withdraw ."
HPW
 
Posts: 1376
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany

Postby CaveGuy » Sat Nov 02, 2002 3:02 pm

That is a problem, I am linking stand-alone EXE's using newLISP.exe and newLISP-TK is not running. These EXEs are created by the hundreds and stored in USER space with no access to newLISP. A command line parameter would be just OK. A first line in the source that was loaded into the EXE would be much better.
That should be the same as putting it in init.lsp.

These inteligent storage orbs, need to save their context back into themselves and go back to sleep after they have been accessed. Thanks for the info, I had not thought to look back in the TK doc as I was not using any TK for this project. I understand it is hard to keep track without a score card :)
CaveGuy
 
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio

Postby Lutz » Sun Nov 03, 2002 12:28 am

I am not sure that the TK anti-flicker mechanism will help you. If I understand you well, you are running a newlisp.exe (linked with source) and want to get rid of the popping up black dos box? Your linked "DoTest.exe" does some processing and reads/writes files, but doesn't do any console I/O and shouldn't need the DOS console window?

I have tried the following: I created a little batch file "batch.bat" , which contains:

---- cut here -----
dir > listing.txt
---- cut here -----

So when I doubleclick on "batch.bat" the black DOS box pops up quickly, but it also creates a file "listings.txt" which contains a directory listing.

Now I did the following: I created a link on the desktop and in the properties window (right click the file) I changed in the "shortcut" tab the setting of the "run:" option from "normal window" to "minimized".

Now I only see a little icon appearing and disappearing on the status bar.

Does this help?
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Postby CaveGuy » Sun Nov 03, 2002 2:40 am

CaveGuy
 
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio

Postby Lutz » Sun Nov 03, 2002 5:39 am

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron