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

📄 ooc.1

📁 Object-Oriented Programming With ANSI-C这本书中的源代码!找了很久
💻 1
📖 第 1 页 / 共 2 页
字号:
.\"	ooc.1 -- 5.6 Sep 27 16:06:26 1993.\"	Copyright (c) 1993 Axel T. Schreiner.\" preprocess with tbl.TH ooc  1 "local: ats"..ds AC \s-1ANSI\s0 C.tr `\(ga..SH NAMEooc \(em preprocessor for object-oriented coding in \*(AC.SH SYNOPSIS.B ooc[option ...] [report ...] description target ....SH DESCRIPTION.I oocis an.I awkprogramwhich reads class descriptionsand performs the routine coding tasks necessaryto do object-oriented coding in \*(AC.Code generated by.I oocis controlled by reports which may be changed.This manual page describes the effects of the standard reports..PP.I descriptionis a class name..I oocloads a class description file with the name.IB description .dand recursively class description files for all superclassesback to the root class.If.B \(mihor.B \(miris specified as a.IR target ,a C header file for the public interface or the private representation of.I descriptionis written to standard output.If.IB source .dcor.B \(miis specified as a.IR target ,.B #includestatements for the.I descriptionheader files are written to standard outputand.IB source .dcor standard inputis read,preprocessed,and copied to standard output.If.B \(midcis specified as a.IR target ,a source skeleton for.I descriptionis written to standard output,which contains all possible methods..PPThe output is produced by report generation from standard report files.If.IB file .repis specified as a.IR report ,the standard files are not loaded..PPThere are some global.IR option sto control.IR ooc :.TP\f3\(miD\f2name\f1[\f3=\f2value\^\f1]defines.I valueor an empty string as replacement for\f3\(ga\f2name\f1.The.I nameshould be a single word..I oocpredefines.B \s-1GNUC\s0with value.BR 0 ..TP.B \(midarranges for debugging to follow normal processing.Debugging commands are read from standard input:.IB class .dloads a class description file;.IB report .reploads a report file;a description, report, class, or method nameproduces a dump of the appropriate information;and.BR all ,.BR classes ,.BR descriptions ,or.B reportsdump all information in the respective category..TP.B \(milproduces.B #linestamps as directed by the reports. .TP.B \(miMproduces a.I makefiledependency line between each.I descriptionand its superclass description files..TP.B \(miRmust be specified if the root class is processed.Other standard reports are loaded in this case..SS Lexical ConventionsAll input lines are processed as follows:first, a comment is removed;next, lines are glued together as long as they end with a backslash;finally, trailing white space is removed..PPA comment extends from.B //to the end of a line.It is removed together with preceding white spacebefore glueing takes place..PPIn glueing,the backslash marks the contact point and is removed.All white space around the contact point is replaced with a single space..PPIdentifiers significant to.I oocfollow the conventions of C,except that they may not use underscore characters.The underscore is used to avoid clashes between.IR ooc 'sand the user's code..PPDeclarators significant to.I oocare simplified relative to C.They may start with.B constand the type information must precede the name.The type information may use.B *but no parentheses.In general,an arbitrary declarator can be adapted for.I oocby introducing a type name with.BR typedef ..PPA line starting with.B %%acts as end of file..SS Class Description FileThe class description file has the following format:.RS.nf.I header.BI % " meta class " {.I "\&   components".B %.I "\&   methods with static linkage".B %\(mi.I "\&   methods with dynamic linkage".B %+.I "\&   class methods".BI %}\&....fi.RE.PP.I headeris arbitrary informationwhich is copied to standard output if the interface file is produced.Information following.B %protis copied to standard output if the representation file is produced..PP.I componentsare C structure component declarations with one declarator per line.They are copied into the.B structgenerated in the representation file for the class.They also determine the order of the construction parametersfor the root metaclass..PPThe first set of.I "methods"has static linkage,i.e., they are functions with at least one object as a parameter;the second set has dynamic linkageand has an object as a parameter for which the method is selected;the third set are class methods,i.e., they have a class as a parameter for which the method is selected.The selection object is always called.BR self .The method declarations define C function headers,selectors,and information for the metaclass constructor..PPThe class header line.BI % " meta class " {has one of three forms.The first form is used to introduce the root class only:.TP.BI % " meta  class " {.I classis the root class,indicated by the fact that it has no superclass.The superclass is then defined to be the root class itself..I metashould be introduced later as the root metaclass,indicated by the fact that it has itself as metaclass..TP.BI % " meta  class" : " super " {.I classis a new class with.I metaas its metaclass and.I superas its superclass.This would also be used to introduce the root metaclass,which has itself as metaclass and the root class as superclass.If.I superis undefined,.I oocwill recursively (but only once)load the class description file.IB super .dand then.I superand.I metamust have been defined so that.I classcan be defined.If this form of the class header is used,only methods with static linkage can be introduced..TP\f3%\f2 meta\f3\^: \f2supermeta  class\f3\^: \f2super\f3 {\f1This additionally defines.I metaas a new metaclass with.I supermetaas its superclass.If.I superis undefined,.I oocwill recursively (but only once)load the class description file.IB super .dand then.I superand.I supermetamust have been defined so that.I metaand.I classcan be defined..PPA method declaration line has the following form,where braces indicate zero or more occurrences andbrackets indicate an optional item:.TP[ \f2tag \f3:\f1 ] \f2declarator\f3 ( \f2declarator \f1{ \f3,\f2 declarator\f1 } [ \f3, ...\f1 ] \f3);\f1The optional.I tagis an identifier involved in locating a method with.BR respondsTo() .The first.I declaratorintroduces the method name and result type, the remaining.IR declarator sintroduce parameter names and types.Exactly one parameter name must be.B selfto indicate the receiver of the method call..PPA.I declaratoris a simplified C declarator as described above,but there are two special cases:.TP.BI _ nameintroduces.I nameas the declarator name.The type is a pointer to an instance of the current classor to the class for which a dynamically linked method is overwritten.Such a pointer will be dereferenced by.B %castsas.I namewithin a method.Therefore,.B selfmust be introduced as.BR _self ,where.B selfis the dereferenced object or class for class methods and.B _selfis the raw pointer..TP.IB class " @ " name.brintroduces.I nameas a pointer to an instance of.IR class .Such a pointer will not be dereferencedbut it will be checked by.BR %casts ..PPThe result type of a method can employ.IB class " @" .In this case, the result type is generated as a pointer to a.B struct.I classwhich is useful when implementing methods,and which cannot be used other than for assignments to.B "void *"in application code.The result type should be.B "void *"for constructors and similar methods to emphasize the generic aspectsof construction..SS PreprocessingSubject to the lexical conventions described above,an implementation file.IB source .dcis copied to standard output.Lines starting with.B %are preprocessed as follows:.TP.BI % " class method " {This is replaced by a C function header for.IR method ;the header is declared.B staticwith the name.IB class _ method,unless.I methodhas static linkage.In the latter case,.I classis optional..I oocchecks in all cases that the method can be specified for

⌨️ 快捷键说明

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