home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somk / c / tp / suep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  2.1 KB  |  80 lines

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler.
  4.  *  Generated using:
  5.  *     SOM incremental update: 6.34
  6.  */
  7.  
  8. #ifndef lint
  9. static char *sccsid = "%Z% %I% %W% %G% %U% [%H% %T%] (c)IBM Corp. 1992";
  10. #endif
  11.  
  12. /*
  13.  * This class is adapted from the book
  14.  *   Class Construction in C and C++, Object Oriented Fundamentals
  15.  *   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  16.  * Reprinted with permission.
  17.  */
  18.  
  19. #define setUpEnvProcessor_Class_Source
  20. #if defined(_WIN32)
  21. #include "statcls.h"
  22. #endif
  23. #include "suep.ih"
  24.  
  25. /* ************************************************************ */
  26. /*
  27.  *  Used to process set up options.
  28.  */
  29.  
  30. SOM_Scope void SOMLINK suProcessOptions(setUpEnvProcessor * somSelf)
  31. {
  32.     int n = 0;
  33.     fileMgr *myfm;
  34.     page *thisPage;
  35.     TPWord *thisWord;
  36.  
  37.     setUpEnvProcessorMethodDebug("setUpEnvProcessor", "suProcessOptions");
  38.     thisPage = _epGetPage(somSelf);
  39.     myfm = _epGetFileMgr(somSelf);
  40.  
  41.     for (;;) {
  42.     thisWord = readToken(myfm);
  43. /*  _print(thisWord, stdout); */
  44.     if (_tpwType(thisWord) == TP_EOF) {
  45.         _somFree(thisWord);
  46.         break;
  47.     }
  48.     else if (_tpwType(thisWord) == TP_TOKEN)
  49.         _epStartUpNewEnvironment(somSelf, thisWord);
  50.     else if (_match(thisWord, "width"))
  51.         _pgSetWidth(thisPage, _suReadIntWord(somSelf));
  52.     else if (_match(thisWord, "height"))
  53.         _pgSetHeight(thisPage, _suReadIntWord(somSelf));
  54.     else if (_match(thisWord, "columns"))
  55.         _pgSetNumberOfColumns(thisPage, _suReadIntWord(somSelf));
  56.     _somFree(thisWord);
  57.     }
  58.     thisPage = _epGetPage(somSelf);
  59.     _pgPrint(thisPage, stdout);
  60. }
  61.  
  62. /* ************************************************************ */
  63. /*
  64.  *  Used to read an integer word.
  65.  */
  66.  
  67. SOM_Scope long  SOMLINK suReadIntWord(setUpEnvProcessor *somSelf)
  68. {
  69.     TPWord *thisWord;
  70.     int returnValue;
  71.     setUpEnvProcessorMethodDebug("setUpEnvProcessor", "suReadIntWord");
  72.  
  73.     thisWord = readToken(_epGetFileMgr(somSelf));  /* Blank */
  74.     _somFree(thisWord);
  75.     thisWord = readToken(_epGetFileMgr(somSelf));  /* Number */
  76.     returnValue = _wordToInt(thisWord);
  77.     _somFree(thisWord);
  78.     return returnValue;
  79. }
  80.