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

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler.
  4.  *  Generated using:
  5.  *     SOM incremental update: 10.9
  6.  */
  7.  
  8.  
  9. #ifndef lint
  10. static char *sccsid = "%Z% %I% %W% %G% %U% [%H% %T%] (c)IBM Corp. 1992";
  11. #endif
  12.  
  13. /*
  14.  * This class is adapted from the book
  15.  *   Class Construction in C and C++, Object Oriented Fundamentals
  16.  *   by Roger Sessions, Copyright (c) 1992 Prentice Hall.
  17.  * Reprinted with permission.
  18.  */
  19. #include "msgid.h"
  20. #include "nlsutil.h"
  21.  
  22. #define envProcessor_Class_Source
  23. #if defined(_WIN32)
  24. #include "statcls.h"
  25. #endif
  26.  
  27. #include <stdlib.h>
  28.  
  29. #include "helper.h"
  30. #include "tpword.h"
  31. #include "page.h"
  32.  
  33. #include "txtep.h"
  34. #include "header.h"
  35. #include "footer.h"
  36. #include "ipep.h"
  37. #include "blep.h"
  38.  
  39. #include "ep.ih"
  40.  
  41. /* ************************************************************ */
  42. /*
  43.  *  Used to initialize a new environment from an
  44.  *  existing environment.
  45.  */
  46.  
  47. SOM_Scope void SOMLINK epInit1(envProcessor * somSelf,
  48.                 envProcessor * lastEnv)
  49. {
  50.     envProcessorData *somThis = envProcessorGetData(somSelf);
  51.     envProcessorMethodDebug("envProcessor", "epInit1");
  52.  
  53.     _previousEnv = lastEnv;
  54.     _thisFile = _epGetFileMgr(_previousEnv);
  55.     _thisPage = _epGetPage(_previousEnv);
  56.  
  57. }
  58.  
  59. /* ************************************************************ */
  60. /*
  61.  *  Defines what it means to process a given
  62.  *  environment.  This method MUST be overridden in
  63.  *  derived classes.
  64.  */
  65.  
  66. SOM_Scope void SOMLINK epProcessEnvironment(envProcessor * somSelf)
  67. {
  68.     envProcessorData *somThis = envProcessorGetData(somSelf);
  69.     envProcessorMethodDebug("envProcessor", "epProcessEnvironment");
  70.     shouldHaveOverridden(somSelf, "epProcessEnvironment");
  71. }
  72.  
  73. /* ************************************************************ */
  74. /*
  75.  *  Defines what steps need to be taken at the start
  76.  *  of this environment.
  77.  */
  78.  
  79. SOM_Scope void SOMLINK epStartUpNewEnvironment(envProcessor * somSelf,
  80.                         TPWord * envName)
  81. {
  82.     envProcessorData *somThis = envProcessorGetData(somSelf);
  83.     envProcessor *nextEnv;
  84.     envProcessorMethodDebug("envProcessor", "epStartUpNewEnvironment");
  85.  
  86.     if (_match(envName, "[[standard_text]]")) {
  87.     nextEnv = txtEnvProcessorNew();
  88.     _epInit1(nextEnv, somSelf);
  89.     }
  90.     else if (_match(envName, "[[header]]")) {
  91.     nextEnv = headerNew();
  92.     _epInit1(nextEnv, somSelf);
  93.     }
  94.     else if (_match(envName, "[[footer]]")) {
  95.     nextEnv = footerNew();
  96.     _epInit1(nextEnv, somSelf);
  97.     }
  98.     else if (_match(envName, "[[standard_text]]")) {
  99.     nextEnv = txtEnvProcessorNew();
  100.     _epInit1(nextEnv, somSelf);
  101.     }
  102.     else if (_match(envName, "[[indent_paragraphs]]")) {
  103.     nextEnv = indentedParagraphsNew();
  104.     _epInit1(nextEnv, somSelf);
  105.     }
  106.     else if (_match(envName, "[[bulleted_list]]")) {
  107.     nextEnv = bulletedListNew();
  108.     _epInit1(nextEnv, somSelf);
  109.     }
  110.     else {
  111.     printf(NlsMsgGet(UnknownEnvironmentId));
  112.     _print(envName, stdout);
  113.     exit(2);
  114.     }
  115.  
  116.     _epPrepareForNewEnvironment(somSelf);
  117.     _epProcessEnvironment(nextEnv);
  118.     _somFree(nextEnv);
  119. }
  120.  
  121. /* ************************************************************ */
  122. /*
  123.  *  Defines what steps need to be taken to initialize
  124.  *  a given environment.
  125.  */
  126.  
  127. SOM_Scope void SOMLINK epInitializeEnvironment(envProcessor * somSelf)
  128. {
  129.     envProcessorData *somThis = envProcessorGetData(somSelf);
  130.     envProcessorMethodDebug("envProcessor", "epInitializeEnvironment");
  131. }
  132.  
  133. /* ************************************************************ */
  134. /*
  135.  *  Defines what steps need to be taken to shutdown this
  136.  *  environment.
  137.  */
  138.  
  139. SOM_Scope void SOMLINK epShutdownEnvironment(envProcessor * somSelf)
  140. {
  141.     envProcessorData *somThis = envProcessorGetData(somSelf);
  142.     envProcessorMethodDebug("envProcessor", "epShutdownEnvironment");
  143. }
  144.  
  145. /* ************************************************************ */
  146. /*
  147.  *  Defines what steps this environment should take as it
  148.  *  prepares to transfer control to a new environment.
  149.  */
  150.  
  151. SOM_Scope void SOMLINK epPrepareForNewEnvironment(envProcessor * somSelf)
  152. {
  153.     envProcessorData *somThis = envProcessorGetData(somSelf);
  154.     envProcessorMethodDebug("envProcessor", "epPrepareForNewEnvironment");
  155. }
  156.  
  157. /* ************************************************************ */
  158. /*
  159.  *  Get the indentation for a new paragraph for this environment.
  160.  */
  161.  
  162. SOM_Scope long  SOMLINK epGetParagraphIndentation(envProcessor *somSelf)
  163. {
  164.     envProcessorData *somThis = envProcessorGetData(somSelf);
  165.     envProcessorMethodDebug("envProcessor", "epGetParagraphIndentation");
  166.     return (0);
  167. }
  168.  
  169. /* ************************************************************ */
  170. /*
  171.  *  Get the indentation for a new line for this environment.
  172.  */
  173.  
  174. SOM_Scope long  SOMLINK epGetLineIndentation(envProcessor *somSelf)
  175. {
  176.     envProcessorData *somThis = envProcessorGetData(somSelf);
  177.     envProcessorMethodDebug("envProcessor", "epGetLineIndentation");
  178.     return (0);
  179. }
  180.  
  181. /* ************************************************************ */
  182. SOM_Scope page *SOMLINK epGetPage(envProcessor * somSelf)
  183. {
  184.     envProcessorData *somThis = envProcessorGetData(somSelf);
  185.     envProcessorMethodDebug("envProcessor", "epGetPage");
  186.     return _thisPage;
  187. }
  188.  
  189. /* ************************************************************ */
  190. SOM_Scope fileMgr *SOMLINK epGetFileMgr(envProcessor * somSelf)
  191. {
  192.     envProcessorData *somThis = envProcessorGetData(somSelf);
  193.     envProcessorMethodDebug("envProcessor", "epGetFileMgr");
  194.     return _thisFile;
  195. }
  196.  
  197. /* ************************************************************ */
  198. SOM_Scope envProcessor *SOMLINK epGetPreviousEnv(envProcessor * somSelf)
  199. {
  200.     envProcessorData *somThis = envProcessorGetData(somSelf);
  201.     envProcessorMethodDebug("envProcessor", "epGetPreviousEnv");
  202.     return _previousEnv;
  203. }
  204.  
  205. /* ************************************************************ */
  206. SOM_Scope string  SOMLINK epGetClassName(envProcessor *somSelf)
  207. {
  208.     envProcessorData *somThis = envProcessorGetData(somSelf);
  209.     static char *myClass = "envProcessor";
  210.     envProcessorMethodDebug("envProcessor", "epGetClassName");
  211.     return myClass;
  212. }
  213.  
  214. /* ************************************************************ */
  215. SOM_Scope void SOMLINK epSetPage(envProcessor * somSelf,
  216.                   page * newPage)
  217. {
  218.     envProcessorData *somThis = envProcessorGetData(somSelf);
  219.     envProcessorMethodDebug("envProcessor", "epSetPage");
  220.     _thisPage = newPage;
  221. }
  222.  
  223. /* ************************************************************ */
  224. SOM_Scope void SOMLINK epSetFileMgr(envProcessor * somSelf,
  225.                      fileMgr * newFileMgr)
  226. {
  227.     envProcessorData *somThis = envProcessorGetData(somSelf);
  228.     envProcessorMethodDebug("envProcessor", "epSetFileMgr");
  229.     _thisFile = newFileMgr;
  230. }
  231.  
  232. /* ************************************************************ */
  233. SOM_Scope void SOMLINK somInit(envProcessor * somSelf)
  234. {
  235.     envProcessorData *somThis = envProcessorGetData(somSelf);
  236.     envProcessorMethodDebug("envProcessor", "somInit");
  237.  
  238.     parent_somInit(somSelf);
  239.     _previousEnv = 0;
  240.     _thisFile = 0;
  241.     _thisPage = 0;
  242. }
  243.  
  244. /* ************************************************************ */
  245. SOM_Scope void SOMLINK somUninit(envProcessor * somSelf)
  246. {
  247.     envProcessorData *somThis = envProcessorGetData(somSelf);
  248.     envProcessorMethodDebug("envProcessor", "somUninit");
  249.  
  250.     if (!_previousEnv) {
  251.     _somFree(_thisFile);
  252.     _somFree(_thisPage);
  253.     printf("\n");                  /* Last line feed for document. */
  254.     }
  255.     parent_somUninit(somSelf);
  256. }
  257.  
  258. /* ************************************************************ */
  259.  
  260. /*
  261.  * SOM_Scope void SOMLINK somDumpSelfInt(envProcessor * somSelf,
  262.  *                        int level)
  263.  */
  264.  
  265. /*
  266.  * The prototype for somDumpSelfInt was replaced by the following prototype:
  267.  */
  268. SOM_Scope void  SOMLINK somDumpSelfInt(envProcessor *somSelf,
  269.         long level)
  270. {
  271.     envProcessorData *somThis = envProcessorGetData(somSelf);
  272.     envProcessorMethodDebug("envProcessor", "somDumpSelfInt");
  273.  
  274.     parent_somDumpSelfInt(somSelf, level);
  275. }
  276.