Pointwise Plugin SDK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apiPWP.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * PWP Plugin example
4  *
5  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
6  *
7  ***************************************************************************/
8 
9 #include <string.h>
10 
11 // Define this on the build command line for verbose build messages
12 // #define SHOW_PWP_MESSAGES
13 #include "apiPWP.h"
14 #include "apiPWPUtils.h"
15 #include "apiUtils.h"
16 
17 //************************* COMPILE TIME SANITY CHECKS *************************
18 // PWP_INT and PWP_UINT are must be sizeof(void*) for the target machine
21 
22 
23 //************************************************
24 // impl-defined plugin version values
25 //************************************************
26 #include "rtPwpVersions.h"
27 
28 /*------------------------------------*/
30 
31 // include the impl-defined PWP runtime item array data
32 #include "rtPwpInitItems.h"
33 
34  // special items NOT returned bt PwpEnumAPIs() - always LAST!
35  /*............................*/
36  {
37  {PWP_MESSAGECB_DEFAULT, {0,0}},
38  0,
39  },
40  /*............................*/
41  {
42  {PWP_MESSAGECB_SPY, {0,0}},
43  0,
44  },
45 };
46 
49 
50 
51 /**************************************/
53 {
54  PWP_BOOL ret = PWP_TRUE;
55  return ret;
56 }
57 
58 /**************************************/
59 PWP_BOOL PwpActivateAPI(const char api[])
60 {
61  return PwuFindPublishedAPI(api) ? PWP_TRUE : PWP_FALSE;
62 }
63 
64 /**************************************/
66 {
67 }
68 
69 /**************************************/
70 const char* PwpEnumAPIs(PWP_UINT32 ndx, PWP_APIINFO *pInfo)
71 {
72  const char* ret = (ndx < publishedApiCnt) ? pwpRtItem[ndx].apiInfo.name : 0;
73  if (ret && pInfo) {
74  *pInfo = pwpRtItem[ndx].apiInfo;
75  }
76  return ret;
77 }
78 
79 /**************************************/
81 {
82  return publishedApiCnt;
83 }
84 
85 /**************************************/
87 {
88  return PwuFindApiMsgCB(api);
89 }
90 
91 /**************************************/
93 {
95  PWP_PLUGININFO info = {
96 # include "rtPwpPluginInfo.h"
97  };
98 
102 
103  if (pInfo) {
104  *pInfo = info;
105  }
106  return ret;
107 }
108 
109 /**************************************/
110 PWP_BOOL PwpIsLicensed(const char api[], const PWP_LICENSEDATA *pLicenseData)
111 {
112  return (pLicenseData && PwuFindPublishedAPI(api)) ? PWP_TRUE : PWP_FALSE;
113 }
114 
115 /**************************************/
116 PWP_MESSAGECB PwpSetMessageCallback(const char api[], PWP_MESSAGECB msgCallback)
117 {
118  PWP_MESSAGECB ret = 0;
119  PWU_RTITEM *pApiItem = PwuFindTotalAPI(api);
120  if (pApiItem) {
121  ret = pApiItem->msgCB;
122  //PwuSendDebugMsg(api, "removing callback", 0);
123  pApiItem->msgCB = msgCallback;
124  //PwuSendDebugMsg(api, "adding callback", 1);
125  }
126  return ret;
127 }
128 
129 /**************************************/
130 PWP_VOID PwpSetLanguage(const char language[])
131 {
132  if (language && language[0]) {
133  }
134 }
135 
136 
137 /**************************************/
138 PWP_BOOL PwpGetValue(const char group[], const char key[], PWP_HVALUE hVal)
139 {
140  PWP_BOOL ret = PWP_FALSE;
141  if (group && key && PWP_HVALUE_ISVALID(hVal)) {
142  ret = PwuGetValue(group, key, hVal);
143  }
144  return ret;
145 }
#define PWP_MESSAGECB_DEFAULT
Special API name used to register the default message handler.
Definition: apiPWP.h:568
PWP_UINT32 PwpGetAPICount()
Get the number of APIs supported by this plugin.
Definition: apiPWP.cxx:80
PWP_MESSAGECB msgCB
The API&#39;s assigned message callback.
Definition: apiPWPUtils.h:55
const char * PwpEnumAPIs(PWP_UINT32 ndx, PWP_APIINFO *pInfo)
Enumerates the APIs supported by this plugin.
Definition: apiPWP.cxx:70
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
Pointwise Plugin API (PWP-API)
void PWP_VOID
no value
Definition: apiPWP.h:317
#define ARRAYSIZE(arrname)
Calculates the size of a statically declared array.
Definition: apiUtils.h:164
PWP_MESSAGECB PwpGetMessageCallback(const char api[])
Gets the current message callback.
Definition: apiPWP.cxx:86
PWP_VOID PwpDestroy()
Called by framework just before plugin library is closed.
Definition: apiPWP.cxx:65
Static Initialization Data for the PWP_PLUGININFO structure.
Defines Implementation Version Information.
#define VERIFY_EXPLICIT_CAST(from, to)
Helper macro that verifies the sizes of two objects are the same.
Definition: apiUtils.h:251
#define PWP_TRUE
PWP_BOOL logical &quot;true&quot; value.
Definition: apiPWP.h:309
PWP_UINT32 totalApiCnt
The total # of published and unpublished entries in pwpRtItem[].
Definition: apiPWP.cxx:47
PWP_BOOL PwuGetValue(const char group[], const char name[], PWP_HVALUE hVal)
Implementation of the PwpGetValue() API function.
PWP_UINT32 apiCount
number of APIs implemented by this plugin
Definition: apiPWP.h:682
PWP_VOID PwpSetLanguage(const char language[])
Sets the active language.
Definition: apiPWP.cxx:130
PWU_RTITEM pwpRtItem[]
The runtime array of PWU_RTITEM items.
Definition: apiPWP.cxx:29
Installation&#39;s license data. NOT IMPLEMENTED YET.
Definition: apiPWP.h:491
Base plugin utilities.
PWP_BOOL PwpInitialize()
Initializes the plugin.
Definition: apiPWP.cxx:52
PWP_MESSAGECB PwuFindApiMsgCB(const char api[])
Search pwpRtItem[] for an API&#39;s messageCB.
Definition: apiPWPUtils.cxx:54
PWP_BOOL PwpIsLicensed(const char api[], const PWP_LICENSEDATA *pLicenseData)
Determines if plugin api is licensed for use on this machine.
Definition: apiPWP.cxx:110
The API information returned by plugins for each supported API.
Definition: apiPWP.h:652
PWP_UINT32(* PWP_MESSAGECB)(const char api[], PWP_ENUM_MSGID id, void *pMsg)
Message handler callback function signature.
Definition: apiPWP.h:555
int PWP_BOOL
logical value
Definition: apiPWP.h:303
PWP_UINT32 publishedApiCnt
The total # of published entries in pwpRtItem[].
Definition: apiPWP.cxx:48
PWP_MESSAGECB PwpSetMessageCallback(const char api[], PWP_MESSAGECB msgCallback)
Sets the message callback function for the given api.
Definition: apiPWP.cxx:116
The runtime data representing a PWP-API suported by a plugin.
Definition: apiPWPUtils.h:42
#define VERSION_PWP_MAJOR
The PWP-API major version value.
Definition: rtPwpVersions.h:19
#define PWP_HVALUE_ISVALID(h)
returns non-zero value if handle is valid
Definition: apiPWP.h:447
Static Initialization Data for the PWU_RTITEM Array.
PWP_UINT32 PWP_VERSIONVAL
Version data component value.
Definition: apiPWP.h:469
#define PWP_MESSAGECB_SPY
Special API name used to register the spy message handler.
Definition: apiPWP.h:581
PWU_RTITEM * PwuFindPublishedAPI(const char api[])
Find a published api in pwpRtItem[].
Definition: apiPWPUtils.cxx:47
PWP_UINT32 PWP_UINT
unsigned integer same size as void*
Definition: apiPWP.h:285
PWP_MESSAGECB defCB
assigned default message callback
Definition: apiPWP.h:685
PWP_INT32 PWP_INT
integer same size as void*
Definition: apiPWP.h:282
PWP_BOOL PwpGetValue(const char group[], const char key[], PWP_HVALUE hVal)
Get the value for a grouped key.
Definition: apiPWP.cxx:138
PWP_BOOL PwpActivateAPI(const char api[])
Activates the plugin for a given API spec.
Definition: apiPWP.cxx:59
PWP_PROTOTYPE_DECL PWP_VERSIONVAL PwpGetPluginInfo(PWP_PLUGININFO *pInfo)
Get information about this plugin.
PWP_APIINFO apiInfo
The PWP-API instance information.
Definition: apiPWPUtils.h:48
#define PWP_FALSE
PWP_BOOL logical &quot;false&quot; value.
Definition: apiPWP.h:306
Provides general information about a plugin.
Definition: apiPWP.h:664
PWP_MESSAGECB spyCB
assigned spy message callback
Definition: apiPWP.h:688
PWU_RTITEM * PwuFindTotalAPI(const char api[])
Find any api in pwpRtItem[].
Definition: apiPWPUtils.cxx:40
Data and functions useful to PWP-API compliant plugins.