I'm investigating the start/server loop. The Insi de Postscript book explains the /start procedure. One part of that procedure is the control loop:
...
{
//serverdict /server get exec
//serverdict begin
setstreams
setnulldevice
/execjob
load
end
exec
} loop
...
Now i'm trying to find out what /server exactly does and how it might look like (in its most simple form).
//serverdict /server get exec
This line above gets the server procedure and executes it immediately.
Now I have a server loop like this:
/server {
{ % server loop
(i'm in a server loop) print flush
(%stdin) run
}
loop
} def
but i'm stuck in an infinite loop. How and when can the server loop ever go to the next step (//serverdict begin setstreams etc...) as it is currently in an infinite loop?
答案 0 :(得分:1)
在您显示的控制循环中,绑定到名称server
的对象似乎不会像您的代码那样循环。它似乎做了一些初始化然后返回。表达式/execjob load
似乎运行当前作业。除此之外,{ ... } loop
表达式似乎是您实现的服务器循环。
如果要将自己的服务器代码插入到提供的循环中,则需要使用解释程序提供的//serverdict
内容。如果你想编写自己的服务器循环,似乎你需要走出一个级别,并替换整个{ ... } loop
表达式,也可能//serverdict
。
如果你想“找出/服务器究竟做了什么以及它看起来如何......”,那么看它呢?道德等同于:
//serverdict /server get == flush