📄 ooc.1
字号:
.IR class .Function names are remembered as necessary for initialization of the description of.I classand the corresponding metaclass if any.There can be an optional tag preceding.I classunless.I methodhas static linkage..TP.BI %castsThis is replaced by definitions of local variablesto securely dereference parameter pointers to objects in the current class.For statically linked methods this isfollowed by checks to verify the parameters pointing to objectsof other classes..B %castsshould be used where local variables can be defined;for statically linked methods it must be the last definition.Note that null pointers flunk the checks and terminate the calling program..TP.BI %initThis should be near the end of the implementation file.If the.I descriptionintroduced a new metaclass,a constructor for the metaclass,selectors for the class,and initializations for the metaclass are generated.In either case,an initialization for the class is generated..PPIf a method.I mdoes not have static linkage,there are two selectors:.I mwith the same parameters as the methodselecting the method defined for.BR self ,and.BI super_ mwith an explicit class description as an additional first parameter.The second selector is used to pass a method call tothe superclass of the class where the method is defined..PPIf a dynamically linked or class method has a variable argument list,the selector passes.B va_list * appto the actual method..PPIf a selector recognizes that it cannot be applied to its object,it calls.B forwardand passes its object,a pointer to a result area, or a null pointer,its own address,its name as a string,and its entire argument list..B forwardshould be a dynamically linked method in the root class;it can be used to forward a message from one object to another..SS Tags.B respondsTo()is a method in the root class whichtakes an object and a tag, i.e., a C stringcontaining an identifier,and returns either a null pointer or a selectorwhich will accept the object and other parametersand call the method corresponding to the tag..PPThe tag under which a class or dynamically linked method can be foundis defined as follows.The default is either the method name or.I tagin the method header in the class description file:.RS[ \f2tag \f3:\f1 ] \f2declarator\f3 ( \f2declarator \f1{ \f3,\f2 declarator\f1 } [ \f3, ...\f1 ] \f3);\f1.RE.PPThe method header in the implementation may overwrite the tag:.RS.BI % " mtag" : " class method " {.RE.PPThe effective tag is.I mtagif specified, or.I tagif not.If.I mtagor.I tagis empty but the colon is specified,.B respondsTo()cannot find the method..SS Report File.I oocuses report files containing all code fragmentswhich.I oocwill generate.Names such as.B appfor an argument list pointercan be changed in the report file.Only.B selfis built into.I oocitself..PPA report file contains one or more reports.The usual lexical conventions apply.Each report is preceded by a line starting with.B %and containing the report namewhich may be enclosed by white space.The report name is arbitrary textbut it must be unique..PPA report consists of lines of words separated by single blanks or tabs,called spaces.An empty word results between any two adjacent spacesor if a space starts or ends a line..PPAn empty word,not at the beginning of an output line,is printed as a blank.In particular,this means that two successive spaces in a reportrepresent a single blank to be printed.Any word not starting with a back quote.B `is printed as is..PPA word starting with.B `%causes a report to be printed.The report name is the remainder of the word..PP.B `#linefollowed by a wordcauses a line stamp to be printedif option.B \(milis specified;the phrase is ignored otherwise.If the word is a class, method, or class component name,the line stamp refers to its position in a class description file.Otherwise,and in particular for empty words,the line stamp refers to the current input file position..PPA word starting with.B `{starts a group.The group is terminated with a word starting with.BR `} .All other words starting with a back quote.B `are replaced during printing.Some replacements are globally defined,others are set up by certain groups.A table of replacements follows at the end of this section..PPGroups are either loops over parts of the databasecollected by.I oocor they are conditionals based on a comparison.Words inside a group are printed under control of the loopor the comparison.Afterwards, printing continues with the word following the group.Groups can be nested,but that may not make sense for some parts of the database.Here is a table of words starting a loop:.TScenter;Lb L.`{% static methods for the current \f3`class\fP`{%\(mi dynamic methods for the current \f3`class\fP`{%+ class methods for the current \f3`class\fP`{() parameters for the current \f3`method\fP`{dcl class headers in the \f3`desc\fP description file`{pub public lines in the \f3`desc\fP description file`{prot protected lines in the \f3`desc\fP description file`{links\f2\& class\fP dynamic and class methods defined for \f2class\fP`{struct\f2\& class\fP components for \f2class\fP`{super \f3`desc\fP and all its superclasses back to \f3`root\fP.TE.PPA loop is terminated with a word starting with.BR `} .If the terminating word is.B `},in the loop over parameters,and if the loop will continue for more parameters,a comma followed by a blank is printed for this word.If the terminating word is.B `}nand if the group has produced any output,a newline is printed for this word.Otherwise, nothing is printed for termination..PPA conditional group starts with.B `{ifor.B `{ifnotfollowed by two words.The words are replaced if necessary and compared.If they are equal,the group starting with.B `{ifis executed;if they are not equal,the group starting with.B `{ifnotis executed.If either group is not executedand if it is followed by a group starting with.BR `{else ,this group is executed.Otherwise the.B `{elsegroup is skipped..PPIn general it is best if the.B `}terminating the.B `{ifgroup immediately precedes.B `{elseon the same line of the report..PPHere is a table of replaced wordstogether with the events that set up the replacements:.TScenter;Li SAb L.set up globally` no text (empty string)`` ` (back quote)`t tab`n newline (limited to one blank line).sp .5v.T&Li SAb L.set up once class descriptions are loaded`desc last \f2description\fP from command line`root root class' name`metaroot root's metaclass name.sp .5v.T&Liz RbAb L.set up for a class % %\(mi %+ `{dcl `{prot `{pub `{super`class class' name`super class' superclass name`meta class' metaclass name`supermeta metaclass' superclass name.sp .5v.T&Liz RbAb L.set up for a method `{% `{%\(mi `{%+ `{links\f2\& class\fP`method method's name`result method's result type`linkage method's linkage: \f3%\fP, \f3%\(mi\fP, or \f3%+\fP`tag method's tag`,... \f3, ...\fP if variable arguments are declared,\^ empty if not`_last last parameter's name if variable arguments,\^ undefined if not.sp .5v.T&Liz RbAb L.set up for a declarator `{() `{struct\f2\& class\fP`name name in declarator`const \f3const\fP followed by a blank, if so declared`type \f3void *\fP for objects, declared type otherwise`_ \f3_\fP if used in declaration, empty otherwise`cast object's class name, empty otherwise.sp .5v.T&Liz RbAb L.set up for lines from the description file `{dcl `{prot `{pub`class set up for a class description, empty otherwise`line line's text if not class description, undefined otherwise`newmeta \f3\&1\fP if new metaclass is defined, \f3\&0\fP if not.TE.PPA.I descriptionon the command line of.I oocsets up for a class.Requesting a method header in a source filesets up for a class and a method.The loops.BR `{dcl ,.BR `{prot ,and.B `{pubset up for lines from a class description file.The loops.BR `{% ,.BR `{%\(mi ,.BR `{%+ ,and.B `{links.I classset up for a method.The loop.B `{()sets up for a parameter declarator.The loop.B `{struct.I classsets up for the declarator of a component of a class.The loop.B `{superruns from.I descriptionthrough all its superclasses..SS Environment.B OOCPATHis a colon-separated list of paths.If a file name does not contain path delimiters,.I ooclooks for the file (class descriptions, sources, and report files)by prefixing each entry of.B OOCPATHto the required file name.By default,.B OOCPATHconsists of the working directory and a standard place..SH FILES. nf. ta 30n\f2class\f3.d\f1 description for \f2class\fP \f2class\f3.dc\f1 implementation for \f2class\fP \f2report\f3.rep\f1 report file\f2\s-1AWKPATH\s0\^/\|*\fP\f3.awk\fP modules\f2\s-1AWKPATH\s0\^/\|*\fP\f3.dbg\fP debugger modules\f2\s-1OOCPATH\s0\^/\|\fP\f3c.rep\fP implementation file reports\f2\s-1OOCPATH\s0\^/\|\fP\f3dc.rep\fP implementation thunks report\f2\s-1OOCPATH\s0\^/\|\fP\f3etc.rep\fP common reports\f2\s-1OOCPATH\s0\^/\|\fP\f3h.rep\fP interface file report\f2\s-1OOCPATH\s0\^/\|\fP\f3header.rep\fP common reports\f2\s-1OOCPATH\s0\^/\|\fP\f3m.rep\fP \f2makefile\fP dependency report\f2\s-1OOCPATH\s0\^/\|\fP\f3r.rep\fP representation file reports\f2\s-1OOCPATH\s0\^/\|\fP\f3va.rep\fP common reports\f2\s-1OOCPATH\s0\^/\|\fP\f3[chr]-R.rep\fP root class versions. fi.SH BUGSThe C preprocessor is applied to the output of.IR ooc ,not to the input,i.e., conditional compilation should not be applied to.I ooccontrols..tr ``
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -