📄 ooc.0
字号:
ooc(1) ooc(1) file. If the description introduced a new meta- class, a constructor for the metaclass, selectors for the class, and initializations for the meta- class are generated. In either case, an initial- ization for the class is generated. If a method m does not have static linkage, there are two selectors: m with the same parameters as the method selecting the method defined for self, and super_m with an explicit class description as an additional first parame- ter. The second selector is used to pass a method call to the superclass of the class where the method is defined. If a dynamically linked or class method has a variable argument list, the selector passes va_list * app to the actual method. If a selector recognizes that it cannot be applied to its object, it calls forward and 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. forward should be a dynamically linked method in the root class; it can be used to forward a message from one object to another. Tags respondsTo() is a method in the root class which takes an object and a tag, i.e., a C string containing an identi- fier, and returns either a null pointer or a selector which will accept the object and other parameters and call the method corresponding to the tag. The tag under which a class or dynamically linked method can be found is defined as follows. The default is either the method name or tag in the method header in the class description file: [ tag : ] declarator ( declarator { , declarator } [ , ... ] ); The method header in the implementation may overwrite the tag: % mtag: class method { The effective tag is mtag if specified, or tag if not. If mtag or tag is empty but the colon is specified, respond- sTo() cannot find the method. Report File ooc uses report files containing all code fragments which ooc will generate. Names such as app for an argument list pointer can be changed in the report file. Only self is built into ooc itself. A report file contains one or more reports. The usual local: ats 5ooc(1) ooc(1) lexical conventions apply. Each report is preceded by a line starting with % and containing the report name which may be enclosed by white space. The report name is arbi- trary text but it must be unique. A report consists of lines of words separated by single blanks or tabs, called spaces. An empty word results between any two adjacent spaces or if a space starts or ends a line. An 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 report represent a single blank to be printed. Any word not starting with a back quote ` is printed as is. A word starting with `% causes a report to be printed. The report name is the remainder of the word. `#line followed by a word causes a line stamp to be printed if option -l is specified; the phrase is ignored otherwise. If the word is a class, method, or class com- ponent 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. A word starting with `{ starts a group. The group is ter- minated with a word starting with `}. All other words starting with a back quote ` 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. Groups are either loops over parts of the database col- lected by ooc or they are conditionals based on a compari- son. Words inside a group are printed under control of the loop or the comparison. Afterwards, printing contin- ues 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: cen- ter; Lb L. `{% static methods for the current `class `{%- dynamic methods for the current `class `{%+ class methods for the current `class `{() parameters for the current `method `{dcl class headers in the `desc description file `{pub public lines in the `desc description file `{prot protected lines in the `desc description file `{links class dynamic and class methods defined for class `{struct class components for class `{super `desc and all its superclasses back to `root A loop is terminated with a word starting with `}. If the terminating word is `}, in the loop over parameters, and if the loop will continue for more parameters, a comma local: ats 6ooc(1) ooc(1) followed by a blank is printed for this word. If the ter- minating word is `}n and if the group has produced any output, a newline is printed for this word. Otherwise, nothing is printed for termination. A conditional group starts with `{if or `{ifnot followed by two words. The words are replaced if necessary and compared. If they are equal, the group starting with `{if is executed; if they are not equal, the group starting with `{ifnot is executed. If either group is not executed and if it is followed by a group starting with `{else, this group is executed. Otherwise the `{else group is skipped. In general it is best if the `} terminating the `{if group immediately precedes `{else on the same line of the report. Here is a table of replaced words together with the events that set up the replacements: center; Li S Ab L. set up globally ` no text (empty string) `` ` (back quote) `t tab `n newline (limited to one blank line) Li S Ab L. set up once class descriptions are loaded `desc last description from command line `root root class' name `metaroot root's metaclass name Liz Rb Ab L. set up for a class % %- %+ `{dcl `{prot `{pub `{super `class class' name `super class' superclass name `meta class' metaclass name `supermeta metaclass' superclass name Liz Rb Ab L. set up for a method `{% `{%- `{%+ `{links class `method method's name `result method's result type `linkage method's linkage: %, %-, or %+ `tag method's tag `,... , ... if variable arguments are declared, empty if not `_last last parame- ter's name if variable arguments, undefined if not Liz Rb Ab L. set up for a declarator `{() `{struct class `name name in declarator `const const followed by a blank, if so declared `type void * for objects, declared type otherwise `_ _ if used in declaration, empty otherwise `cast object's class name, empty oth- erwise Liz Rb Ab 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 1 if new metaclass is defined, 0 if not A description on the command line of ooc sets up for a class. Requesting a method header in a source file sets up for a class and a method. The loops `{dcl, `{prot, and `{pub set up for lines from a class description file. The loops `{%, `{%-, `{%+, and `{links class set up for a method. The loop `{() sets up for a parameter declarator. The loop `{struct class sets up for the declarator of a local: ats 7ooc(1) ooc(1) component of a class. The loop `{super runs from descrip- tion through all its superclasses. Environment OOCPATH is a colon-separated list of paths. If a file name does not contain path delimiters, ooc looks for the file (class descriptions, sources, and report files) by prefixing each entry of OOCPATH to the required file name. By default, OOCPATH consists of the working directory and a standard place.FILES class.d description for class class.dc implementation for class report.rep report file AWKPATH/*.awk modules AWKPATH/*.dbg debugger modules OOCPATH/c.rep implementation file reports OOCPATH/dc.rep implementation thunks report OOCPATH/etc.rep common reports OOCPATH/h.rep interface file report OOCPATH/header.rep common reports OOCPATH/m.rep makefile dependency report OOCPATH/r.rep representation file reports OOCPATH/va.rep common reports OOCPATH/[chr]-R.rep root class versionsBUGS The C preprocessor is applied to the output of ooc, not to the input, i.e., conditional compilation should not be applied to ooc controls. local: ats 8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -