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

📄 ooc.0

📁 Object-Oriented Programming With ANSI-C这本书中的源代码!找了很久
💻 0
📖 第 1 页 / 共 2 页
字号:
ooc(1)                                                     ooc(1)NAME       ooc -- preprocessor for object-oriented coding in ANSI CSYNOPSIS       ooc [option ...] [report ...] description target ...DESCRIPTION       ooc  is  an awk program which reads class descriptions and       performs the routine coding tasks necessary to do  object-       oriented  coding in ANSI C.  Code generated by ooc is con-       trolled by reports which may be changed.  This manual page       describes the effects of the standard reports.       description  is  a class name.  ooc loads a class descrip-       tion file with  the  name  description.d  and  recursively       class  description  files for all superclasses back to the       root class.  If -h or -r is specified as  a  target,  a  C       header file for the public interface or the private repre-       sentation of description is written  to  standard  output.       If  source.dc  or  -  is  specified  as a target, #include       statements for the description header files are written to       standard  output  and source.dc or standard input is read,       preprocessed, and copied to standard output.   If  -dc  is       specified  as  a target, a source skeleton for description       is written to standard output, which contains all possible       methods.       The  output is produced by report generation from standard       report files.  If file.rep is specified as a  report,  the       standard files are not loaded.       There are some global options to control ooc:       -Dname[=value]              defines value or an empty string as replacement for              `name.  The name should be a single word.  ooc pre-              defines GNUC with value 0.       -d     arranges for debugging to follow normal processing.              Debugging commands are read  from  standard  input:              class.d  loads a class description file; report.rep              loads a report file; a description, report,  class,              or  method  name produces a dump of the appropriate              information; and  all,  classes,  descriptions,  or              reports dump all information in the respective cat-              egory.       -l     produces #line stamps as directed by the reports.       -M     produces a makefile dependency  line  between  each              description and its superclass description files.       -R     must  be  specified if the root class is processed.              Other standard reports are loaded in this case.                            local: ats                          1ooc(1)                                                     ooc(1)   Lexical Conventions       All 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.       A  comment  extends  from  // to the end of a line.  It is       removed together with preceding white space before glueing       takes place.       In  glueing,  the backslash marks the contact point and is       removed.  All white space  around  the  contact  point  is       replaced with a single space.       Identifiers  significant  to ooc follow the conventions of       C, except that they may  not  use  underscore  characters.       The  underscore is used to avoid clashes between ooc's and       the user's code.       Declarators significant to ooc are simplified relative  to       C.   They  may  start  with const and the type information       must precede the name.  The type information may use * but       no  parentheses.   In general, an arbitrary declarator can       be adapted for ooc by introducing a type name  with  type-       def.       A line starting with %% acts as end of file.   Class Description File       The class description file has the following format:              header              % meta class {                 components              %                 methods with static linkage              %-                 methods with dynamic linkage              %+                 class methods              %}              ...       header  is  arbitrary information which is copied to stan-       dard output if the interface file is  produced.   Informa-       tion  following  %prot is copied to standard output if the       representation file is produced.       components are C structure component declarations with one       declarator per line.  They are copied into the struct gen-       erated in the representation file  for  the  class.   They       also  determine  the  order of the construction parameters       for the root metaclass.       The first set of methods has static  linkage,  i.e.,  they                            local: ats                          2ooc(1)                                                     ooc(1)       are functions with at least one object as a parameter; the       second set has dynamic linkage and  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 self.   The  method  declarations  define  C       function headers, selectors, and information for the meta-       class constructor.       The class header line % meta class  {  has  one  of  three       forms.  The first form is used to introduce the root class       only:       % meta  class {              class is the root class, indicated by the fact that              it  has  no  superclass.   The  superclass  is then              defined to be the root class itself.   meta  should              be  introduced  later  as the root metaclass, indi-              cated by the fact that it has itself as  metaclass.       % meta  class: super {              class is a new class with meta as its metaclass and              super as its superclass.  This would also  be  used              to  introduce  the root metaclass, which has itself              as metaclass and the root class as superclass.   If              super  is undefined, ooc will recursively (but only              once) load the class description file  super.d  and              then  super and meta must have been defined so that              class can be defined.  If this form  of  the  class              header  is  used,  only methods with static linkage              can be introduced.       % meta: supermeta  class: super {              This additionally defines meta as a  new  metaclass              with  supermeta  as  its  superclass.   If super is              undefined, ooc will  recursively  (but  only  once)              load  the  class  description file super.d and then              super and supermeta must have been defined so  that              meta and class can be defined.       A  method  declaration  line has the following form, where       braces indicate zero  or  more  occurrences  and  brackets       indicate an optional item:       [ tag : ] declarator ( declarator { , declarator } [ , ...       ] );              The optional  tag  is  an  identifier  involved  in              locating  a  method  with  respondsTo().  The first              declarator introduces the method  name  and  result              type, the remaining declarators introduce parameter              names and types.  Exactly one parameter  name  must              be  self  to  indicate  the  receiver of the method              call.                            local: ats                          3ooc(1)                                                     ooc(1)       A declarator is a simplified  C  declarator  as  described       above, but there are two special cases:       _name  introduces  name  as the declarator name.  The type              is a pointer to an instance of the current class or              to  the class for which a dynamically linked method              is overwritten.  Such a pointer  will  be  derefer-              enced  by  %casts  as name within a method.  There-              fore, self must be introduced as _self, where  self              is the dereferenced object or class for class meth-              ods and _self is the raw pointer.       class @ name              introduces name as a  pointer  to  an  instance  of              class.  Such a pointer will not be dereferenced but              it will be checked by %casts.       The result type of a method can employ class @.   In  this       case,  the  result  type  is  generated  as a pointer to a       struct class which is useful  when  implementing  methods,       and  which  cannot  be  used other than for assignments to       void * in application code.  The  result  type  should  be       void  *  for constructors and similar methods to emphasize       the generic aspects of construction.   Preprocessing       Subject to the lexical  conventions  described  above,  an       implementation  file  source.dc is copied to standard out-       put.  Lines starting with % are preprocessed as follows:       % class method {              This is replaced by a C function header for method;              the   header  is  declared  static  with  the  name              class_method, unless method has static linkage.  In              the  latter case, class is optional.  ooc checks in              all cases that the  method  can  be  specified  for              class.   Function names are remembered as necessary              for initialization of the description of class  and              the  corresponding  metaclass if any.  There can be              an optional tag preceding class unless  method  has              static linkage.       %casts This  is replaced by definitions of local variables              to  securely  dereference  parameter  pointers   to              objects  in  the  current  class.   For  statically              linked methods this is followed by checks to verify              the   parameters   pointing  to  objects  of  other              classes.  %casts should be used where  local  vari-              ables 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.       %init  This should be near the end of  the  implementation                            local: ats                          4

⌨️ 快捷键说明

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