Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Executing skill code from the shell

3,067 views
Skip to first unread message

Suresh J

unread,
Jun 10, 2003, 8:30:08 AM6/10/03
to
Hi,

I want the runnig ICFB to execute a set of skill codes from the
shell.Just like the netscape -remote 'openURL(...)' command which has
been discussed in the newsgroup recently.
(eg. icfb -remote 'myProcedure() printf("Hi")' )

One way to do this is to have a UNIX file scanned regularly by the ICFB
and if it has some contents just 'load()' the file and remove the
contents. The applications ( say a C program) will write the skill codes
into this file.
procedure( abcScan()
let(
(
)
when(isFile("~/.icfb_remote")
loadi("~/.icfb_remote")
deleteFile("~/.icfb_remote")
)
ipcBeginProcess("sleep 1",nil,"sdfsdf", "sfdsdf", "scan()")
;Recursive call
)
)
But I dont like this solution because it makes icfb slow down.

regards,
Suresh J.

snmi...@xxxhotyyypop.com

unread,
Jun 10, 2003, 10:30:32 AM6/10/03
to
>>>>> "Suresh" == Suresh J <Suresh> writes:

Suresh> Hi, I want the runnig ICFB to execute a set of skill codes
Suresh> from the shell.Just like the netscape -remote 'openURL(...)'
Suresh> command which has been discussed in the newsgroup recently.

Suresh> (eg. icfb -remote 'myProcedure() printf("Hi")' )

Suresh> One way to do this is to have a UNIX file scanned
Suresh> regularly by the ICFB and if it has some contents just
Suresh> 'load()' the file and remove the contents. The applications
Suresh> ( say a C program) will write the skill codes into this
Suresh> file.

Suresh> procedure( abcScan() let( ( )
Suresh> when(isFile("~/.icfb_remote") loadi("~/.icfb_remote")
Suresh> deleteFile("~/.icfb_remote") ) ipcBeginProcess("sleep
Suresh> 1",nil,"sdfsdf", "sfdsdf", "scan()") ;Recursive call ) ) But
Suresh> I dont like this solution because it makes icfb slow down.

Suresh> regards, Suresh J.

Why not use 'ipc' functions?

Satya

--
Remove XXX and YYY to get my address

Ronald

unread,
Jun 10, 2003, 5:07:35 PM6/10/03
to
Running icfb from shell:

icfb -replay myfile.skill -log mylog.log

You could also use
skill command or dbAccess command.

example:
skill << EOF | tail -1
(load "a.il")
(runfunction)
EOF

dbAccess << EOF
(or (progn
(load "a.il")
(runfunction)
)
(exit -1)
)
EOF

thanks,
ronald


Suresh J <sures...@hotmail.com> wrote in message news:<3EE5CF50...@hotmail.com>...

Suresh J

unread,
Jun 11, 2003, 9:47:04 AM6/11/03
to
Ronald wrote:
> Running icfb from shell:
>
> icfb -replay myfile.skill -log mylog.log

This invokes a new icfb session and loads the skill file. But what I
want to do is to load a skill file in the 'running' icfb from the terminal.

(for example typing xmms --fwd in the command line wont invoke a new
xmms but will forward the playlist in the running xmms. I want something
like this.)

Thanks for the response.

regards,
Suresh J

Andrew Beckett

unread,
Jun 13, 2003, 9:15:10 AM6/13/03
to
OK, I had some fun with this. There is an internal (private) mechanism to do
this, but as it's not public and supported, I came up with an alternative
approach.

It uses Tcl, although it could equally well be done with perl, C or other
languages.

First of all, there is the server which handles the incoming SKILL requests:

=================cut below ===============================
#!/usr/local/bin/tclsh
#
# Author A.D.Beckett
# Group Custom IC, Cadence Design Systems Ltd
# Machine SUN
# Date Jun 13, 2003
# Modified
# By
#
# Simple server interface. Is started by DFII, using ipcBeginProcess(),
# see skillServer.il.
#
# Opens a server socket, and listens for incoming connections.
# When data comes in on that incoming connection, it passes it through
# to DFII (via this process's stdout). Then DFII sends back the result
# to this process's stdin. The protocol is that the Tcl channel ID is
# sent as the first word on the data sent to DFII, and also, the channel
# ID is the first word of the result. This allows us to know where to send
# the result back to if multiple channels are open
#
# the UNIX env var $SKILLSERVPORT defines the port number, and defaults
# to 8123.
#

if [info exists env(SKILLSERVPORT)] {
set port $env(SKILLSERVPORT)
} else {
set port 8123
}

proc listener {channel addr port} {
puts "$channel abSkillServerConnection(\"$addr\" \"$port\")"
flush stdout
fconfigure $channel -buffering line
fileevent $channel readable [list sendToDFII $channel]
}

proc sendToDFII {channel} {
if {[eof $channel] || [catch {gets $channel line}]} {
# end of file
close $channel
} else {
puts "$channel $line"
flush stdout
}

proc sendBack {} {
gets stdin line
regsub {^(\w+) .*$} $line {\1} channel
regsub {^\w+ (.*)$} $line {\1} result

if {![eof $channel]} {
puts $channel $result
}
}

fconfigure stdin -buffering line
fileevent stdin readable sendBack

socket -server listener $port
vwait forever

==============cut above ==================================

This should be placed in an executable script called "skillServer", which
is in your UNIX path.

Then you'll need some SKILL code:


==============cut below ==================================
abSkillServerDebug=nil
procedure(abSkillServerConnection(addr port)
printf("Connection received from address %s, port %s\n" addr port)
)

procedure(abSkillServerListener(ipcId data)
let((channel command result)
rexCompile("^\\([^ ]*\\) \\(.*\\)$")
channel=rexReplace(data "\\1" 1)
command=rexReplace(data "\\2" 1)
when(abSkillServerDebug
printf("COMMAND: %L\n" command)
)
unless(errset(result=evalstring(command))
when(abSkillServerDebug
printf("ERROR: %L\n" errset.errset)
)
ipcWriteProcess(ipcId sprintf(nil "%s ERROR %L\n"
channel errset.errset))
) ; unless
when(abSkillServerDebug
printf("RESULT: %L\n" result)
)
ipcWriteProcess(ipcId sprintf(nil "%s %L\n" channel result))
)
)

==============cut above ==================================

I put this in a file called "skillServer.il"

To use it, load the SKILL code in a DFII session:

load("skillServer.il")

Then in a UNIX window, you can do:

telnet machineName 8123
println(12345)
1024*56

Note, it returns in the telnet window the return value of the expression.

Or you could use a simple client script, which I called skillClient:


==============cut below ==================================
#!/usr/local/bin/tclsh
#
# Author A.D.Beckett
# Group Custom IC, Cadence Design Systems Ltd
# Machine SUN
# Date Jun 13, 2003
# Modified
# By
#
# simple command interface which allows me to say
#
# skillClient machineName 8123 "skillFunction()"
#

set hostname [lindex $argv 0]
set port [lindex $argv 1]
set command [lindex $argv 2]

set sock [socket $hostname $port]
puts $sock $command

==============cut above ==================================

And then I did things like:

skillClient mymachine 8123 "deOpen()"

Note, I've only done limited testing of this, but it generally hangs together
OK. Would need some work to productionize. It handles multiple connections,
and the return values should be sent back to the right connection.

The port number used can be set with $SKILLSERVPORT UNIX env var.
Of course, you'd need to be careful if you have multiple sessions running on
the same machine, because they must have distinct ports.

Beware, there's nothing to stop someone else doing:

skillClient yourmachine 8123 "exit()"

Have fun!

Andrew.

--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd

shasha...@gmail.com

unread,
Sep 4, 2015, 6:39:00 AM9/4/15
to
Can anyone tell me how to run a SKILL code using crontab? Is it possible?

Regards,
Shashank
0 new messages