home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / som / somd / cpp / animal / dldog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-24  |  1.8 KB  |  79 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.  
  14. /* %Z% %I% %W% %G% %U% [%H% %T%] */
  15. /*
  16.  *  This file was generated by the SOM Compiler and Emitter Framework.
  17.  *  Generated using: 
  18.  *      SOM Emitter emitxtm: 2.37
  19.  */
  20.  
  21.  
  22.  
  23. #ifndef SOM_Module_dldog_Source
  24. #define SOM_Module_dldog_Source
  25. #endif
  26. #define dLittleDog_Class_Source
  27.  
  28. #include <stdio.h>
  29. #include <string.h>
  30. #include <windows.h>
  31. #include "dldog.xih"
  32. #if (_WIN32)
  33. #include "nlsutil.h"
  34. #include "animal.h"
  35. #endif
  36.  
  37. /* WIN16PORT */
  38. #ifdef _WIN16
  39. #include <stdlib.h>
  40. #define sprintf wsprintf
  41. #endif
  42.  
  43.  
  44. SOM_Scope void SOMLINK somDefaultInit(dLittleDog *somSelf, somInitCtrl* ctrl)
  45. {
  46.     dLittleDogData *somThis; /* set in BeginInitializer */
  47.     somInitCtrl globalCtrl;
  48.     somBooleanVector myMask;
  49.     dLittleDogMethodDebug("dLittleDog","somDefaultInit");
  50.     dLittleDog_BeginInitializer_somDefaultInit;
  51.  
  52.     dLittleDog_Init_dDog_somDefaultInit(somSelf,ctrl);
  53.     somSelf->_set_noise(somGetGlobalEnvironment(), "woof, woof");
  54. }
  55.  
  56. SOM_Scope string  SOMLINK display(dLittleDog *somSelf,  Environment *ev)
  57. {
  58.     string mybuff, bp;
  59.  
  60.     dLittleDogData *somThis = dLittleDogGetData(somSelf);
  61.     dLittleDogMethodDebug("dLittleDog","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 ounces.\n", gcvt(somThis->LDweight,10,buf));
  71. }
  72. #else
  73.   sprintf(bp, NlsMsgGet(IWeighFloatId),somThis->LDweight);
  74. #endif
  75.   return mybuff;
  76.  
  77. }
  78.  
  79.