home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / ObjectTcl-1.1 / CdlRtn.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  6.0 KB  |  168 lines

  1. #ifndef CDL_RTN_H
  2. #define CDL_RTN_H
  3.  
  4. /*  _ __ ___ _
  5.  * | |\ /  /| |  $Id: CdlRtn.H,v 1.6 1995/05/09 16:14:12 deans Exp $
  6.  * | | /  / | |  Copyright (C) 1995 IXI Limited.
  7.  * |_|/__/_\|_|  IXI Limited, Cambridge, England.
  8.  *
  9.  * Component   : CdlRtn.H
  10.  *
  11.  * Author      : Dean Sheehan (deans@x.co.uk)
  12.  *  
  13.  * Description : Header file for CdlRtn class and subclasses. CdlRtn's model
  14.  *               the return types of CdlMethod's.
  15.  *
  16.  * License     :
  17.             Object Tcl License & Copyright
  18.             -----------------------------
  19.  
  20. IXI Object Tcl software, both binary and source (hereafter, Software) is copyrighted by IXI Limited (IXI), and ownership remains with IXI. 
  21.  
  22. IXI grants you (herafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if required) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies. 
  23.  
  24. Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify IXI regarding its distribution of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original IXI Object Tcl distributed by IXI. IXI strongly recommends that Licensee provide IXI the right to incorporate such modifications into future releases of the Software under these license terms. 
  25.  
  26. Any Licensee wishing to make commercial use of the Software should contact IXI, to negotiate an appropriate license for such commercial use. Commercial use includes (1) integration of all or part of the source code into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the binary code or source code to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee. 
  27.  
  28. IXI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IXI SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER SUFFERED BY THE USERS OF THIS SOFTWARE. 
  29.  
  30. Copyright (C) 1995, IXI Limited 
  31.  
  32. By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of England and the U.S., including, but not limited to, export control laws, and the terms of this license. IXI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license. 
  33.  
  34. Comments and questions are welcome and can be sent to
  35. otcl@x.co.uk 
  36.  
  37. For more information on copyright and licensing issues, contact: 
  38. Legal Department, IXI Limited, Vision Park, Cambridge CB4 4ZR,
  39. ENGLAND. 
  40.  
  41.  *
  42.  */
  43.  
  44. // System Inccludes
  45. #include <fstream.h>
  46.  
  47. // Local Includes
  48. #include "CdlItem.H"
  49.  
  50. #define CDL_RTN_DEC(a)      \
  51. a (int e = 0);              \
  52. char *giveCommand (void);   \
  53. CdlRtn *instantiate (void); \
  54. static a exemplar;
  55.  
  56. #define CDL_RTN_DEF(a,b) \
  57. a a :: exemplar(1); \
  58. a :: a (int e) : CdlRtn(e) {} \
  59. char * a :: giveCommand (void) { \
  60.    return #b; \
  61. } \
  62. CdlRtn *a :: instantiate (void) \
  63. { \
  64.    return new a; \
  65. }
  66.  
  67. class CdlRtn
  68. {
  69. public:
  70.  
  71.    CdlRtn (int exemplar = 0);
  72.    virtual ~CdlRtn ();
  73.    virtual char *giveCommand (void) = 0;
  74.    virtual CdlRtn *instantiate (void) = 0;
  75.  
  76.    virtual int setArgs (int argc, char *argv[]);
  77.    virtual void genPrototype (ofstream &) = 0;
  78.    virtual void declareLocal (ofstream &, CdlIndent) = 0;
  79.    virtual void localName (ofstream &) = 0;
  80.    virtual void postProcess (ofstream &, CdlIndent) = 0;
  81.    virtual void returnFromTclInterp (char *interpName, ofstream &of,
  82.                                      CdlIndent) = 0;
  83.    static CdlRtn *exemplarHead;
  84.    static CdlRtn *exemplarTail;
  85.    CdlRtn *nextExemplar;
  86. };
  87.  
  88. class CdlIntRtn : public CdlRtn
  89. {
  90. public:
  91.    CDL_RTN_DEC(CdlIntRtn)
  92.    ~CdlIntRtn ();
  93.    void genPrototype (ofstream &);
  94.    void declareLocal (ofstream &, CdlIndent);
  95.    void localName (ofstream &);
  96.    void postProcess (ofstream &, CdlIndent);
  97.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  98. };
  99.  
  100. class CdlFloatRtn : public CdlRtn
  101. {
  102. public:
  103.    CDL_RTN_DEC(CdlFloatRtn)
  104.    ~CdlFloatRtn ();
  105.    void genPrototype (ofstream &);
  106.    void declareLocal (ofstream &, CdlIndent);
  107.    void localName (ofstream &);
  108.    void postProcess (ofstream &, CdlIndent);
  109.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  110. };
  111.  
  112. class CdlDoubleRtn : public CdlRtn
  113. {
  114. public:
  115.    CDL_RTN_DEC(CdlDoubleRtn)
  116.    ~CdlDoubleRtn ();
  117.    void genPrototype (ofstream &);
  118.    void declareLocal (ofstream &, CdlIndent);
  119.    void localName (ofstream &);
  120.    void postProcess (ofstream &, CdlIndent);
  121.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  122. };
  123.  
  124. class CdlStrRtn : public CdlRtn
  125. {
  126. public:
  127.    CDL_RTN_DEC(CdlStrRtn)
  128.    ~CdlStrRtn ();
  129.    void genPrototype (ofstream &);
  130.    void declareLocal (ofstream &, CdlIndent);
  131.    void localName (ofstream &);
  132.    void postProcess (ofstream &, CdlIndent);
  133.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  134. };
  135.  
  136. class CdlObptrRtn : public CdlRtn
  137. {
  138. public:
  139.    CDL_RTN_DEC(CdlObptrRtn)
  140.    int setArgs (int, char *[]);
  141.    ~CdlObptrRtn ();
  142.    void genPrototype (ofstream &);
  143.    void declareLocal (ofstream &, CdlIndent);
  144.    void localName (ofstream &);
  145.    void postProcess (ofstream &, CdlIndent);
  146.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  147. private:
  148.    char *className;
  149. };
  150.  
  151. class CdlObrefRtn : public CdlRtn
  152. {
  153. public:
  154.    CDL_RTN_DEC(CdlObrefRtn)
  155.    int setArgs (int, char *[]);
  156.    ~CdlObrefRtn ();
  157.    void genPrototype (ofstream &);
  158.    void declareLocal (ofstream &, CdlIndent);
  159.    void localName (ofstream &);
  160.    void postProcess (ofstream &, CdlIndent);
  161.    void returnFromTclInterp (char *interpName, ofstream &of, CdlIndent);
  162. private:
  163.    char *className;
  164.    int shouldNew;
  165. };
  166.  
  167. #endif // CDL_RTN_H
  168.