home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / toolkt21 / c / samples / tp / suep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-12  |  1.9 KB  |  62 lines

  1. #ifndef lint
  2. static char *sccsid = "@(#)suep.c 1.3 1/22/92 16:11:05 [1/26/92] (c)IBM Corp. 1992";
  3. #endif
  4.  
  5. /*
  6.  * This class is adapted from the book
  7.  *   Class Construction in C and C++, Object Oriented Fundamentals
  8.  *   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  9.  * Reprinted with permission.
  10.  */
  11.  
  12. #define setUpEnvProcessor_Class_Source
  13. #include "suep.ih"
  14.  
  15. /* ************************************************************ */
  16. SOM_Scope void SOMLINK suProcessOptions(setUpEnvProcessor * somSelf)
  17. {
  18.     int n = 0;
  19.     fileMgr *myfm;
  20.     page *thisPage;
  21.     TPWord *thisWord;
  22.  
  23.     setUpEnvProcessorMethodDebug("setUpEnvProcessor", "suProcessOptions");
  24.     thisPage = _epGetPage(somSelf);
  25.     myfm = _epGetFileMgr(somSelf);
  26.  
  27.     for (;;) {
  28.     thisWord = readToken(myfm);
  29. /*  _print(thisWord, stdout); */
  30.     if (_tpwType(thisWord) == TP_EOF) {
  31.         _somFree(thisWord);
  32.         break;
  33.     }
  34.     else if (_tpwType(thisWord) == TP_TOKEN)
  35.         _epStartUpNewEnvironment(somSelf, thisWord);
  36.     else if (_match(thisWord, "width"))
  37.         _pgSetWidth(thisPage, _suReadIntWord(somSelf));
  38.     else if (_match(thisWord, "height"))
  39.         _pgSetHeight(thisPage, _suReadIntWord(somSelf));
  40.     else if (_match(thisWord, "columns"))
  41.         _pgSetNumberOfColumns(thisPage, _suReadIntWord(somSelf));
  42.     _somFree(thisWord);
  43.     }
  44.     thisPage = _epGetPage(somSelf);
  45.     _pgPrint(thisPage, stdout);
  46. }
  47.  
  48. /* ************************************************************ */
  49. SOM_Scope int SOMLINK suReadIntWord(setUpEnvProcessor * somSelf)
  50. {
  51.     TPWord *thisWord;
  52.     int returnValue;
  53.     setUpEnvProcessorMethodDebug("setUpEnvProcessor", "suReadIntWord");
  54.  
  55.     thisWord = readToken(_epGetFileMgr(somSelf));  /* Blank */
  56.     _somFree(thisWord);
  57.     thisWord = readToken(_epGetFileMgr(somSelf));  /* Number */
  58.     returnValue = _wordToInt(thisWord);
  59.     _somFree(thisWord);
  60.     return returnValue;
  61. }
  62.