home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / filestat.zip / filestat.ih < prev    next >
Text File  |  1993-09-20  |  12KB  |  441 lines

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: filestat.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.60
  8.  */
  9.  
  10. /*
  11.  * 
  12.  * 
  13.  *      File Statistics: Displays statistics about files dropped on it
  14.  *      Written by : Ghassan Salem
  15.  *      Inspired by : Gregory Czaja (black Hole's originator)
  16.  */
  17.  
  18.  
  19. #ifndef FileStat_ih
  20. #define FileStat_ih
  21.  
  22.  
  23. /*
  24.  * Passthru lines: File: "C.ih", "before"
  25.  */
  26. /* implementation defs for FileState */
  27.  
  28.  /* PM definitions */
  29.    #define INCL_WIN
  30.    #define INCL_DOS
  31.    #define INCL_GPIBITMAPS
  32.    #include <os2.h>
  33.  
  34.    #define INCL_WPCLASS
  35.    #define INCL_WPFOLDER
  36.    #include <pmwp.h>
  37.  
  38.  /* internal definitions */
  39.    #define MYSTR_CLASSNAME      "FileState"
  40.  
  41. #include "FileStat.h"
  42.  
  43. /*
  44.  * Set the scope of methods functions
  45.  */
  46. #ifndef SOM_Scope
  47. #ifdef __cplusplus
  48. #define SOM_Scope extern "C"
  49. #else
  50. #define SOM_Scope extern
  51. #endif
  52. #endif
  53.  
  54. #ifndef SOM_CurrentClass
  55. #define SOM_CurrentClass FileStateCClassData.parentMtab
  56. #endif
  57.  
  58. #define FileState_MaxNoMethods 0
  59.  
  60. /*
  61.  * Instance data
  62.  */
  63. typedef struct {
  64.     PSZ pszMyHeader;
  65. } FileStateData;
  66.  
  67. /*
  68.  * Instance variable access macros
  69.  */
  70. #define _pszMyHeader (somThis->pszMyHeader)
  71.  
  72. /*
  73.  * Getdata macro
  74.  */
  75. #define FileStateGetData(somSelf) \
  76.     ((FileStateData *) \
  77.         SOM_DataResolve(somSelf, FileStateCClassData.instanceDataToken))
  78.  
  79. /*
  80.  * Trace/Debug macro
  81.  */
  82. #ifndef FileStateMethodDebug
  83. #define FileStateMethodDebug(c,m) SOMMethodDebug(c,m)
  84. #endif
  85.  
  86. /*
  87.  * Begin stuff that only goes in the primary file
  88.  */
  89. #ifdef FileState_Class_Source
  90.  
  91. /*
  92.  * Current class macros for Instance and Meta classes.
  93.  */
  94. #undef SOMMeta
  95. #define SOMMeta M_FileStateCClassData.parentMtab
  96. #undef SOMInstance
  97. #define SOMInstance FileStateCClassData.parentMtab
  98.  
  99. #ifndef M_FileState_Class_Source
  100. #define M_FileState_Class_Source
  101. #endif    /* M_FileState_Class_Source */
  102.  
  103. /*
  104.  * Generate the Apply Stubs.
  105.  */
  106.  
  107. /*
  108.  * Overridden method: wpDragOver
  109.  */
  110. #pragma linkage(FileStatX_wpDragOver, system)
  111. SOM_Scope MRESULT   SOMLINK FileStatX_wpDragOver(FileState *somSelf,
  112.         HWND hwndCnr,
  113.         PDRAGINFO pdrgInfo);
  114. #ifndef parent_wpDragOver
  115. static char *somMN_wpDragOver = "wpDragOver";
  116. static somId somId_wpDragOver = &somMN_wpDragOver;
  117. #define parent_wpDragOver(somSelf,hwndCnr,pdrgInfo) \
  118.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpDragOver)) \
  119.      (somSelf,hwndCnr,pdrgInfo))
  120. #endif
  121. #define FileStateParent_wpDragOver parent_wpDragOver
  122.  
  123. /*
  124.  * Overridden method: wpDrop
  125.  */
  126. #pragma linkage(FileStatX_wpDrop, system)
  127. SOM_Scope MRESULT   SOMLINK FileStatX_wpDrop(FileState *somSelf,
  128.         HWND hwndCnr,
  129.         PDRAGINFO pdrgInfo,
  130.         PDRAGITEM pdrgItem);
  131. #ifndef parent_wpDrop
  132. static char *somMN_wpDrop = "wpDrop";
  133. static somId somId_wpDrop = &somMN_wpDrop;
  134. #define parent_wpDrop(somSelf,hwndCnr,pdrgInfo,pdrgItem) \
  135.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpDrop)) \
  136.      (somSelf,hwndCnr,pdrgInfo,pdrgItem))
  137. #endif
  138. #define FileStateParent_wpDrop parent_wpDrop
  139.  
  140. /*
  141.  * Temporary class data structure used only in class creation
  142.  */
  143. static somClassDataStructure FileStatetempClassData;
  144.  
  145. /*
  146.  * Initialize the class data structure
  147.  */
  148. struct FileStateClassDataStructure FileStateClassData = {(SOMAny *) NULL};
  149.  
  150. /*
  151.  * Define the C class data structure
  152.  */
  153. struct FileStateCClassDataStructure FileStateCClassData = {(somMethodTab *) NULL};
  154.  
  155. /*
  156.  * Routines to create the class object
  157.  */
  158.  
  159. /*
  160.  * Declare the Override Methods table.
  161.  */
  162. static somOverrideMethod_t FileStateOM[] = {
  163.     {    &somId_wpDragOver,
  164.          (somMethodProc *) FileStatX_wpDragOver    },
  165.     {    &somId_wpDrop,
  166.          (somMethodProc *) FileStatX_wpDrop    },
  167. };
  168.  
  169. static void FileStatesomInitializeClass (void)
  170. {
  171.     int i;
  172.     somOverrideMethod_t *omp;
  173.  
  174. /*
  175.  * Override methods.
  176.  */
  177.     for (omp = FileStateOM, i = 0; i < 2; omp++, i++)
  178.         _somOverrideSMethod (FileStatetempClassData.classObject,
  179.             *(omp->methodId), omp->method);
  180.  
  181. }
  182.  
  183. #pragma linkage(FileStatesomCreateClass, system)
  184. static void SOMLINK FileStatesomCreateClass(SOMClass *pClsObj,
  185.                            SOMClass *mClsObj)
  186. {
  187.     FileStatetempClassData.classObject = _somNew (mClsObj);
  188.     _somInitClass (FileStatetempClassData.classObject,
  189.         "FileState",
  190.         pClsObj,
  191.         sizeof(FileStateData),
  192.         FileState_MaxNoMethods,
  193.         FileState_MajorVersion,
  194.         FileState_MinorVersion);
  195.     FileStateCClassData.instanceDataToken = 
  196.     _somGetInstanceToken(FileStatetempClassData.classObject);
  197.     FileStatesomInitializeClass();
  198.     FileStateCClassData.parentMtab =
  199.     _somGetPClsMtab(FileStatetempClassData.classObject);
  200.     _somSetClassData(FileStatetempClassData.classObject, (somClassDataStructure *)&FileStateClassData);
  201.     _somClassReady(FileStatetempClassData.classObject);
  202.     /* make newly created class object visible */
  203.     FileStateClassData.classObject = FileStatetempClassData.classObject;
  204. }
  205.  
  206. FileState * SOMLINK FileStateNewClass (integer4 scemajorVersion,
  207.         integer4 sceminorVersion)
  208. {
  209.     SOMClass *pClsObj;
  210.     SOMClass *mClsObj;
  211.  
  212.     /* Check the version numbers */
  213.     if (((scemajorVersion != 0) && 
  214.          (scemajorVersion != FileState_MajorVersion)) ||
  215.         ((sceminorVersion != 0) && 
  216.          (sceminorVersion > FileState_MinorVersion))) {
  217.     somPrintf("FileStateNewClass: Error, bad version numbers.\n");
  218.     SOM_Error(SOMERROR_BadVersion);
  219.     }
  220.     /* Don't do anything if class object is already created. */
  221.     if (FileStateClassData.classObject != (SOMAny *) NULL)
  222.     return(FileStateClassData.classObject);
  223.  
  224.     /* Make sure the environment is initialized. */
  225.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  226.     if (SOMClassMgrObject == (SOMAny *) NULL)
  227.     SOM_Error(SOMERROR_CouldNotStartup);
  228.  
  229.     /* Get the parent class object. */
  230.     WPAbstractNewClass(1,1);    /* static reference */
  231.     pClsObj = _somFindClass(SOMClassMgrObject,
  232.         SOM_IdFromString("WPAbstract"), 1, 1);
  233.     if (pClsObj == (SOMClass *) NULL)
  234.     SOM_Error(SOMERROR_NoParentClass);
  235.  
  236.     /* Explicit metaclass, so get it */ 
  237.     M_FileStateNewClass(0,0);    /* static reference */
  238.     mClsObj = _somFindClass(SOMClassMgrObject,
  239.         SOM_IdFromString("M_FileState"), 0, 0);
  240.     if (mClsObj == (SOMClass *) NULL)
  241.     SOM_Error(SOMERROR_NoMetaClass);
  242.  
  243.     somConstructClass(FileStatesomCreateClass, pClsObj, mClsObj,
  244.              &FileStatetempClassData);
  245.     return (FileStateClassData.classObject);
  246. }
  247.  
  248. #endif                   /* FileState_Class_Source */
  249.  
  250. #endif       /* FileStat_ih */
  251.  
  252. /*
  253.  * This file was generated by the SOM Compiler.
  254.  * FileName: filestat.ih.
  255.  * Generated using:
  256.  *     SOM Precompiler spc: 1.22
  257.  *     SOM Emitter emitih: 1.60
  258.  */
  259.  
  260. #ifndef FileStat_mih
  261. #define FileStat_mih
  262.  
  263.  
  264. /*
  265.  * Set the scope of methods functions
  266.  */
  267. #ifndef SOM_Scope
  268. #ifdef __cplusplus
  269. #define SOM_Scope extern "C"
  270. #else
  271. #define SOM_Scope extern
  272. #endif
  273. #endif
  274.  
  275. #ifndef SOM_CurrentClass
  276. #define SOM_CurrentClass M_FileStateCClassData.parentMtab
  277. #endif
  278.  
  279. #define M_FileState_MaxNoMethods 0
  280.  
  281. /*
  282.  * Instance data
  283.  */
  284. typedef void M_FileStateData;
  285.  
  286. /*
  287.  * Trace/Debug macro
  288.  */
  289. #ifndef M_FileStateMethodDebug
  290. #define M_FileStateMethodDebug(c,m) SOMMethodDebug(c,m)
  291. #endif
  292.  
  293. /*
  294.  * Begin stuff that only goes in the primary file
  295.  */
  296. #ifdef M_FileState_Class_Source
  297.  
  298. /*
  299.  * Current class macros for Instance and Meta classes.
  300.  */
  301.  
  302. /*
  303.  * Generate the Apply Stubs.
  304.  */
  305.  
  306. /*
  307.  * Overridden method: wpclsInitData
  308.  */
  309. #pragma linkage(FileStatC_wpclsInitData, system)
  310. SOM_Scope void   SOMLINK FileStatC_wpclsInitData(M_FileState *somSelf);
  311. #ifndef parent_wpclsInitData
  312. static char *somMN_wpclsInitData = "wpclsInitData";
  313. static somId somId_wpclsInitData = &somMN_wpclsInitData;
  314. #define parent_wpclsInitData(somSelf) \
  315.     ((SOM_ParentResolveE(M_WPObject, SOM_CurrentClass, wpclsInitData)) \
  316.      (somSelf))
  317. #endif
  318. #define M_FileStateParent_wpclsInitData parent_wpclsInitData
  319.  
  320. /*
  321.  * Overridden method: wpclsUnInitData
  322.  */
  323. #pragma linkage(FileStatC_wpclsUnInitData, system)
  324. SOM_Scope void   SOMLINK FileStatC_wpclsUnInitData(M_FileState *somSelf);
  325. #ifndef parent_wpclsUnInitData
  326. static char *somMN_wpclsUnInitData = "wpclsUnInitData";
  327. static somId somId_wpclsUnInitData = &somMN_wpclsUnInitData;
  328. #define parent_wpclsUnInitData(somSelf) \
  329.     ((SOM_ParentResolveE(M_WPObject, SOM_CurrentClass, wpclsUnInitData)) \
  330.      (somSelf))
  331. #endif
  332. #define M_FileStateParent_wpclsUnInitData parent_wpclsUnInitData
  333.  
  334. /*
  335.  * Temporary class data structure used only in class creation
  336.  */
  337. static somClassDataStructure M_FileStatetempClassData;
  338.  
  339. /*
  340.  * Initialize the class data structure
  341.  */
  342. struct M_FileStateClassDataStructure M_FileStateClassData = {(SOMAny *) NULL};
  343.  
  344. /*
  345.  * Define the C class data structure
  346.  */
  347. struct M_FileStateCClassDataStructure M_FileStateCClassData = {(somMethodTab *) NULL};
  348.  
  349. /*
  350.  * Routines to create the class object
  351.  */
  352.  
  353. /*
  354.  * Declare the Override Methods table.
  355.  */
  356. static somOverrideMethod_t M_FileStateOM[] = {
  357.     {    &somId_wpclsInitData,
  358.          (somMethodProc *) FileStatC_wpclsInitData    },
  359.     {    &somId_wpclsUnInitData,
  360.          (somMethodProc *) FileStatC_wpclsUnInitData    },
  361. };
  362.  
  363. static void M_FileStatesomInitializeClass (void)
  364. {
  365.     int i;
  366.     somOverrideMethod_t *omp;
  367.  
  368. /*
  369.  * Override methods.
  370.  */
  371.     for (omp = M_FileStateOM, i = 0; i < 2; omp++, i++)
  372.         _somOverrideSMethod (M_FileStatetempClassData.classObject,
  373.             *(omp->methodId), omp->method);
  374.  
  375. }
  376.  
  377. #pragma linkage(M_FileStatesomCreateClass, system)
  378. static void SOMLINK M_FileStatesomCreateClass(SOMClass *pClsObj,
  379.                            SOMClass *mClsObj)
  380. {
  381.     M_FileStatetempClassData.classObject = _somNew (mClsObj);
  382.     _somInitClass (M_FileStatetempClassData.classObject,
  383.         "M_FileState",
  384.         pClsObj,
  385.         0,
  386.         M_FileState_MaxNoMethods,
  387.         M_FileState_MajorVersion,
  388.         M_FileState_MinorVersion);
  389.     M_FileStateCClassData.instanceDataToken = 
  390.     _somGetInstanceToken(M_FileStatetempClassData.classObject);
  391.     M_FileStatesomInitializeClass();
  392.     M_FileStateCClassData.parentMtab =
  393.     _somGetPClsMtab(M_FileStatetempClassData.classObject);
  394.     _somSetClassData(M_FileStatetempClassData.classObject, (somClassDataStructure *)&M_FileStateClassData);
  395.     _somClassReady(M_FileStatetempClassData.classObject);
  396.     /* make newly created class object visible */
  397.     M_FileStateClassData.classObject = M_FileStatetempClassData.classObject;
  398. }
  399.  
  400. M_FileState * SOMLINK M_FileStateNewClass (integer4 scemajorVersion,
  401.         integer4 sceminorVersion)
  402. {
  403.     SOMClass *pClsObj;
  404.     SOMClass *mClsObj;
  405.  
  406.     /* Check the version numbers */
  407.     if (((scemajorVersion != 0) && 
  408.          (scemajorVersion != M_FileState_MajorVersion)) ||
  409.         ((sceminorVersion != 0) && 
  410.          (sceminorVersion > M_FileState_MinorVersion))) {
  411.     somPrintf("M_FileStateNewClass: Error, bad version numbers.\n");
  412.     SOM_Error(SOMERROR_BadVersion);
  413.     }
  414.     /* Don't do anything if class object is already created. */
  415.     if (M_FileStateClassData.classObject != (SOMAny *) NULL)
  416.     return(M_FileStateClassData.classObject);
  417.  
  418.     /* Make sure the environment is initialized. */
  419.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  420.     if (SOMClassMgrObject == (SOMAny *) NULL)
  421.     SOM_Error(SOMERROR_CouldNotStartup);
  422.  
  423.     /* Get the parent class object. */
  424.     M_WPAbstractNewClass(1,1);    /* static reference */
  425.     pClsObj = _somFindClass(SOMClassMgrObject,
  426.         SOM_IdFromString("M_WPAbstract"), 1, 1);
  427.     if (pClsObj == (SOMClass *) NULL)
  428.     SOM_Error(SOMERROR_NoParentClass);
  429.  
  430.     /* Use parent's metaclass */ 
  431.     mClsObj = SOM_GetClass(pClsObj);
  432.  
  433.     somConstructClass(M_FileStatesomCreateClass, pClsObj, mClsObj,
  434.              &M_FileStatetempClassData);
  435.     return (M_FileStateClassData.classObject);
  436. }
  437.  
  438. #endif                   /* M_FileState_Class_Source */
  439.  
  440. #endif       /* FileStat_ih */
  441.