home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somd / cpp / animal / dbdog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  1.8 KB  |  78 lines

  1. //
  2. //   COMPONENT_NAME: somx
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  14. /*
  15.  *  This file was generated by the SOM Compiler and Emitter Framework.
  16.  *  Generated using: 
  17.  *      SOM Emitter emitxtm: 2.37
  18.  */
  19.  
  20.  
  21.  
  22. #ifndef SOM_Module_dbdog_Source
  23. #define SOM_Module_dbdog_Source
  24. #endif
  25. #define dBigDog_Class_Source
  26.  
  27. #include <stdio.h>
  28. #include <string.h>
  29. #include <windows.h>
  30. #include "dbdog.xih"
  31. #if (_WIN32)
  32. #include "nlsutil.h"
  33. #include "animal.h"
  34. #endif
  35.  
  36. /* WIN16PORT */
  37. #ifdef _WIN16
  38. #include <stdlib.h>
  39. #define sprintf wsprintf
  40. #endif
  41.  
  42.  
  43. SOM_Scope void SOMLINK somDefaultInit(dBigDog *somSelf, somInitCtrl* ctrl)
  44. {
  45.     dBigDogData *somThis; /* set in BeginInitializer */
  46.     somInitCtrl globalCtrl;
  47.     somBooleanVector myMask;
  48.     dBigDogMethodDebug("dBigDog","somDefaultInit");
  49.     dBigDog_BeginInitializer_somDefaultInit;
  50.  
  51.     dBigDog_Init_dDog_somDefaultInit(somSelf,ctrl);
  52.     somSelf->_set_noise(somGetGlobalEnvironment(), "WOOF, WOOF");
  53. }
  54.  
  55.  
  56. SOM_Scope string  SOMLINK display(dBigDog *somSelf,  Environment *ev)
  57. {
  58.     string mybuff, bp;
  59.  
  60.     dBigDogData *somThis = dBigDogGetData(somSelf);
  61.     dBigDogMethodDebug("dBigDog","display");
  62.  
  63.     mybuff = parent_display(somSelf, ev);
  64.     bp = mybuff;
  65.     bp += strlen(mybuff);
  66.     /* wsprintf does not support floats */
  67. #ifdef _WIN16
  68. {
  69.   char buf[20];
  70.   sprintf(bp, "I weigh %s pounds.\n", gcvt(somThis->BDweight,10,buf));
  71. }
  72. #else
  73.   sprintf(bp, NlsMsgGet(IWeighFloatId), somThis->BDweight);
  74. #endif
  75.   return mybuff;
  76. }
  77.  
  78.