⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ic.4

📁 Object-Oriented Programming With ANSI-C这本书中的源代码!找了很久
💻 4
字号:
.\"	Ic.4 -- 1.2 Sep 30 06:38:13 1993.\"	Copyright (c) 1993 Axel T. Schreiner.TH Ic 4 "local: ats".SH NAME\f3IcClass: Class  Ic: Objct\fP \(em basic input/output/transput objects.SH SYNOPSIS.nfObjct    \f3Ic\fP        Button        Calc        LineOut        Mux.sp .5.B new(Ic());\f3new(Button(), "\f2text\f3");\f1.B new(Calc());.B new(LineOut());.B new(Mux());.sp .5.B %\(mi.BI "void wire (Objct @ " to ", " self ).BI "enum { reject, accept } gate (" self ", const void * " item ).fi.SH DESCRIPTIONAn.B Icobject has an output pin and an input action..B wire()connects the output to some other object.If an.B Icobject is sent a data.I itemwith.BR gate() ,it will perform some action and send some result to its output pin;some.B Icobjects only create output and others only consume input..B gate()returns.B acceptif the receiver accepts the data..PP.B Icis a base class.Subclasses overwrite.B gate()to implement their own processing..B Ic_gate()takes.I itemand uses.B gate()to send it on to the output pin,i.e.,a subclass will use.B super_gate()to send something to its output pin..PPA.B Buttonobject contains a text which is sent out in response to certain inputs.It expects an.B Eventobject as input.If the.B Eventcontains a matching text or a null pointeror other data, the.B Buttonaccepts the input and sends its own text on.A non-matching text is rejected..PP.B Buttonis designed as a base class.Subclasses should match mouse positions, etc., and use.B super_gate()to send out the appropriate text..PPA.B Calcobject receives a string,computes a result, and sends the current result on as a string.The first character of the input string is processed:digits are assembled into a non-negative decimal number;.BR + ,.BR \(mi ,.BR * ,and.B /perform arithmetic operations on two operands;.B =completes an arithmetic operation;.B Cresets the calculator; and.B Qquits the application.The calculator is a simple, precedence-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 received,the saved operator is executed and the new operator is saved.Invalid inputs are accepted and silently ignored..PPA.B LineOutobject accepts a string and displays it..PPA.B Muxobject can be wired to a list of outputs.It sends its input to each of these outputsuntil one of them accepts the input.The list is built and searched in order of the.B wire()calls..SH SEE ALSOCrt(4), Event(4), Xt(4)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -