📄 ic.0
字号:
Ic(4) Ic(4)NAME IcClass: Class Ic: Objct -- basic input/output/transput objectsSYNOPSIS Objct Ic Button Calc LineOut Mux new(Ic()); new(Button(), "text"); new(Calc()); new(LineOut()); new(Mux()); %- void wire (Objct @ to, self) enum { reject, accept } gate (self, const void * item)DESCRIPTION An Ic object has an output pin and an input action. wire() connects the output to some other object. If an Ic object is sent a data item with gate(), it will perform some action and send some result to its output pin; some Ic objects only create output and others only consume input. gate() returns accept if the receiver accepts the data. Ic is a base class. Subclasses overwrite gate() to imple- ment their own processing. Ic_gate() takes item and uses gate() to send it on to the output pin, i.e., a subclass will use super_gate() to send something to its output pin. A Button object contains a text which is sent out in response to certain inputs. It expects an Event object as input. If the Event contains a matching text or a null pointer or other data, the Button accepts the input and sends its own text on. A non-matching text is rejected. Button is designed as a base class. Subclasses should match mouse positions, etc., and use super_gate() to send out the appropriate text. A Calc object receives a string, computes a result, and sends the current result on as a string. The first char- acter of the input string is processed: digits are assem- bled into a non-negative decimal number; +, -, *, and / perform arithmetic operations on two operands; = completes an arithmetic operation; C resets the calculator; and Q quits the application. The calculator is a simple, prece- dence-free, finite state machine: the first set of digits defines a first operand; the first operator is saved; more digits define another operand; if another operator is local: ats 1Ic(4) Ic(4) received, the saved operator is executed and the new oper- ator is saved. Invalid inputs are accepted and silently ignored. A LineOut object accepts a string and displays it. A Mux object can be wired to a list of outputs. It sends its input to each of these outputs until one of them accepts the input. The list is built and searched in order of the wire() calls.SEE ALSO Crt(4), Event(4), Xt(4) local: ats 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -