home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / os2tk20 / c / samples / tp / word.cs_ / WORD.CSC
Encoding:
Text File  |  1992-07-15  |  1.5 KB  |  65 lines

  1. #   @(#)word.csc 1.3 1/22/92 16:12:12 [1/26/92] (c)IBM Corp. 1992
  2.  
  3. -- This class is adapted from the book
  4. --   Class Construction in C and C++, Object Oriented Fundamentals
  5. --   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  6. -- Reprinted with permission.
  7.  
  8. include "bt.sc"
  9.  
  10. class: word,
  11.   local;
  12.  
  13. parent: baseType;
  14.  
  15. /*
  16. ----------------------------------------------------
  17.   Class: word
  18.  
  19. Purpose: This is a generalized concept of a word,
  20.      meaning a string of characters.
  21. ---------------------------------------------------- */
  22.  
  23.  
  24. passthru: C.h;
  25. void showWordStats();
  26. endpassthru;
  27.  
  28. data:
  29.   char *storage;
  30.   int length;
  31.  
  32. methods:
  33.  
  34. group: newMethods;
  35.  
  36.    word *wordInit1(char *newWord);
  37.    -- Initialize a word with a character string.
  38.  
  39.    word *wordInit2(char newChar, int count);
  40.    -- Initialize a word with a character and
  41.    -- count.  The new word will contain a null
  42.    -- terminated buffer containing count number of
  43.    -- newChars.
  44.  
  45.    int getLength();
  46.    -- Get the length of a word.
  47.  
  48.    int wordToInt();
  49.    -- Translate a word to an integer, such as "123" to 123.
  50.  
  51.    void wrdReplace(char *newWord);
  52.    -- Replace the contents of a word by another word.
  53.  
  54. group: baseTypeOverrides;
  55.    override match;
  56.    -- See the definition of baseType for more information.
  57.  
  58.    override print;
  59.    -- See the definition of baseType for more information.
  60.  
  61. group: SystemMethodOverrides;
  62.    override somInit;
  63.    override somUninit;
  64.    override somDumpSelfInt;
  65.