ActionCa.sgm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!-- $XConsortium: ActionCa.sgm /main/10 1996/09/08 20:02:03 rws $ -->
  2. <!-- (c) Copyright 1995 Digital Equipment Corporation. -->
  3. <!-- (c) Copyright 1995 Hewlett-Packard Company. -->
  4. <!-- (c) Copyright 1995 International Business Machines Corp. -->
  5. <!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
  6. <!-- (c) Copyright 1995 Novell, Inc. -->
  7. <!-- (c) Copyright 1995 FUJITSU LIMITED. -->
  8. <!-- (c) Copyright 1995 Hitachi. -->
  9. <![ %CDE.C.CDE; [<RefEntry Id="CDEMX.XCDI.MAN8.rsml.1">]]>
  10. <![ %CDE.C.XO; [<RefEntry Id="XCDI.MAN8.rsml.1">]]>
  11. <RefMeta>
  12. <RefEntryTitle>DtActionCallbackProc</RefEntryTitle>
  13. <ManVolNum>library call</ManVolNum>
  14. </RefMeta>
  15. <RefNameDiv>
  16. <RefName><StructName Role="typedef">DtActionCallbackProc</StructName></RefName>
  17. <RefPurpose>notify application that the status of an application has changed
  18. </RefPurpose>
  19. </RefNameDiv>
  20. <!-- CDE Common Source Format, Version 1.0.0-->
  21. <!-- *************************************************************************-->
  22. <!-- ** (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company-->
  23. <!-- ** (c) Copyright 1993, 1994, 1995 International Business Machines Corp.-->
  24. <!-- ** (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.-->
  25. <!-- ** (c) Copyright 1993, 1994, 1995 Novell, Inc.-->
  26. <!-- *************************************************************************-->
  27. <RefSynopsisDiv>
  28. <Synopsis>#include &lt;Dt/Action.h>
  29. </Synopsis>
  30. </RefSynopsisDiv>
  31. <RefSect1>
  32. <Title>DESCRIPTION</Title>
  33. <Para>The
  34. <Filename Role="Header">Dt/Action.h</Filename> header defines the
  35. <Function>DtActionCallbackProc</Function> callback prototype as follows:
  36. </Para>
  37. <Synopsis>typedef void (*DtActionCallbackProc)(DtActionInvocationID <Emphasis>id</Emphasis>,
  38. XtPointer <Symbol Role="Variable">client_data</Symbol>,
  39. DtActionArg *<Symbol Role="Variable">args</Symbol>,
  40. int <Emphasis>argCount</Emphasis>,
  41. DtActionStatus <Symbol Role="Variable">status</Symbol>);
  42. </Synopsis>
  43. <Para>If registered when invoking an action with
  44. &cdeman.DtActionInvoke;, a
  45. <Function>DtActionCallbackProc</Function> procedure is called
  46. whenever an action has a status update, such as action termination.
  47. Depending on
  48. <Symbol Role="Variable">status</Symbol>, modified action arguments may be returned using
  49. <Symbol Role="Variable">args</Symbol>.</Para>
  50. <Para>The
  51. <Emphasis>id</Emphasis> argument specifies an invocation ID as returned by
  52. &cdeman.DtActionInvoke;.</Para>
  53. <Para>The
  54. <Symbol Role="Variable">client_data</Symbol> argument specifies the client data that was
  55. registered with
  56. &cdeman.DtActionInvoke;.</Para>
  57. <Para>The
  58. <Symbol Role="Variable">args</Symbol> argument is an array of updated action argument structures, if there are any.
  59. Individual arguments have their
  60. <Emphasis>argClass</Emphasis> set to one of the standard argument classes, or
  61. <SystemItem Class="Constant">DtACTION_NULLARG</SystemItem>, to indicate that the current
  62. status update is not providing an update for the given argument.
  63. If the object has been removed (for example, dropped on the trash), the
  64. return
  65. <Emphasis>argClass</Emphasis> is set to
  66. <SystemItem Class="Constant">DtACTION_NULLARG</SystemItem> to indicate that it no longer exists.
  67. </Para>
  68. <Para>The
  69. <Symbol Role="Variable">args</Symbol> array has been allocated by
  70. <Function>XtMalloc</Function>(3), as have any of the
  71. <StructName Role="typedef">char*</StructName> or
  72. <StructName Role="typedef">void*</StructName> elements contained in each of the
  73. <Symbol Role="Variable">args</Symbol>. The application is responsible for calling
  74. <Function>XtFree</Function>(3) on all elements contained in each of the
  75. <Symbol Role="Variable">args</Symbol>, and then calling
  76. <Function>XtFree</Function>(3) on
  77. <Symbol Role="Variable">args</Symbol>.</Para>
  78. <Para>The
  79. <Emphasis>argCount</Emphasis> argument specifies the total number of arguments
  80. in
  81. <Symbol Role="Variable">args</Symbol>. This number equals the number of arguments originally provided to
  82. &cdeman.DtActionInvoke;</Para>
  83. <Para>The
  84. <Symbol Role="Variable">n</Symbol>th argument in the original action
  85. argument array corresponds to the
  86. <Symbol Role="Variable">n</Symbol>th argument in an updated action argument array.
  87. </Para>
  88. <Para>The
  89. <Symbol Role="Variable">status</Symbol> argument specifies the purpose of the status update.
  90. The status codes listed here and in
  91. &cdeman.Dt.Action.h;, may be returned in a
  92. <Function>DtActionCallbackProc</Function>:</Para>
  93. <VariableList>
  94. <VarListEntry>
  95. <Term>DtACTION_INVOKED</Term>
  96. <ListItem>
  97. <Para>The corresponding
  98. &cdeman.DtActionInvoke; which is asynchronous and does not block when starting actions,
  99. has finished starting the requested actions.
  100. For all
  101. &cdeman.DtActionInvoke; calls that include a
  102. <Function>DtactionCallbackProc</Function>, this status code is guaranteed to be returned.
  103. When returned, no additional prompts for data will appear
  104. from the action service.
  105. </Para>
  106. </ListItem>
  107. </VarListEntry>
  108. <VarListEntry>
  109. <Term>DtACTION_DONE</Term>
  110. <ListItem>
  111. <Para>The actions that were the result of the original
  112. &cdeman.DtActionInvoke; call have terminated normally.
  113. Once this status value is returned, all registered callbacks are invalidated,
  114. and
  115. <Emphasis>id</Emphasis> can no longer be used in subsequent action service calls.
  116. Returned
  117. <Symbol Role="Variable">args</Symbol> data may accompany the
  118. <SystemItem Class="Constant">DtACTION_DONE</SystemItem> status code.
  119. For all
  120. &cdeman.DtActionInvoke; calls that include a
  121. <Function>DtActionCallbackProc</Function>, this status code or an equivalent status code (for example,
  122. <SystemItem Class="Constant">DtACTION_CANCELED</SystemItem> or
  123. <SystemItem Class="Constant">DtACTION_FAILED</SystemItem>) is guaranteed to be returned.
  124. </Para>
  125. </ListItem>
  126. </VarListEntry>
  127. <VarListEntry>
  128. <Term>DtACTION_CANCELED</Term>
  129. <ListItem>
  130. <Para>The actions that were the result of the original
  131. &cdeman.DtActionInvoke; call were canceled and have terminated normally.
  132. Once this status value is returned, all registered callbacks are
  133. invalidated, and
  134. <Emphasis>id</Emphasis> can no longer be used in subsequent
  135. action service calls.
  136. No
  137. <Symbol Role="Variable">args</Symbol> data will accompany the
  138. <SystemItem Class="Constant">DtACTION_CANCELED</SystemItem> status code.
  139. </Para>
  140. </ListItem>
  141. </VarListEntry>
  142. <VarListEntry>
  143. <Term>DtACTION_FAILED</Term>
  144. <ListItem>
  145. <Para>An error occurred and a normal termination is no longer possible.
  146. The action service may have failed to start the
  147. action or lost contact with and abandoned the action.
  148. Once this status value is returned, an error dialog may be
  149. posted by the action service, all registered callbacks are
  150. invalidated, and
  151. <Emphasis>id</Emphasis> can no longer be used in subsequent action service calls.
  152. No
  153. <Symbol Role="Variable">args</Symbol> data will accompany the
  154. <SystemItem Class="Constant">DtACTION_FAILED</SystemItem> status code.
  155. </Para>
  156. </ListItem>
  157. </VarListEntry>
  158. <VarListEntry>
  159. <Term>DtACTION_STATUS_UPDATE</Term>
  160. <ListItem>
  161. <Para>The actions associated with
  162. <Emphasis>id</Emphasis> have generated a status update, such as returning modified
  163. <Symbol Role="Variable">args</Symbol>. Updates occur in several ways.
  164. </Para>
  165. <Para>If several actions were started from a single
  166. &cdeman.DtActionInvoke;, then as each individual action terminates, a
  167. <SystemItem Class="Constant">DtACTION_STATUS_UPDATE</SystemItem> with return
  168. <Symbol Role="Variable">args</Symbol> is returned, and when the final action
  169. terminates, a
  170. <SystemItem Class="Constant">DtACTION_DONE</SystemItem> or equivalent status code is returned, possibly with return arguments.
  171. </Para>
  172. <Para>Other actions may have the capability to generate updates
  173. (for example, Tooltalk-based actions doing a Media Exchange
  174. Deposit (Request)).
  175. </Para>
  176. <Para>In most cases, a
  177. <StructName Role="typedef">DtActionArg</StructName> argument array accompanying a
  178. <SystemItem Class="Constant">DtACTION_STATUS_UPDATE</SystemItem> only has updated data for a few of the arguments; the remaining arguments
  179. are set to
  180. <SystemItem Class="Constant">DtACTION_NULLARG</SystemItem>.</Para>
  181. </ListItem>
  182. </VarListEntry>
  183. </VariableList>
  184. </RefSect1>
  185. <RefSect1>
  186. <Title>EXAMPLES</Title>
  187. <Para>The following shows how a
  188. <Function>DtActionCallbackProc</Function> might be coded.
  189. </Para>
  190. <InformalExample>
  191. <ProgramListing>DtActionCallbackProc myCallback(
  192. DtActionInvocationID id,
  193. XtPointer client_data,
  194. DtActionArg *actionArgPtr,
  195. int actionArgCount,
  196. DtActionStatus status);
  197. {
  198. extern DtActionArg *myUpdatedArgs; /* global hook for new data */
  199. extern int myDoneFlag; /* global done flag */
  200. switch (status) {
  201. case DtACTION_INVOKED:
  202. /*
  203. * All the arguments to the original DtActionInvoke
  204. * have been consumed by actions, and the actions have
  205. * been started. Among other things, we will not see
  206. * any more prompts for user input.
  207. */
  208. break;
  209. case DtACTION_DONE:
  210. myUpdatedArgs = (DtActionArg *) actionArgPtr;
  211. myDoneFlag = TRUE;
  212. break;
  213. case DtACTION_CANCELED:
  214. case DtACTION_FAILED:
  215. if ((actionArgCount != 0) &amp;&amp; actionArgPtr) {
  216. /*
  217. * If not a normal shutdown, throw away returned
  218. * information.
  219. */
  220. for (i=0; i &lt; actionArgCount; i++) {
  221. if (actionArgPtr[i].argClass == DtACTION_FILE) {
  222. XtFree(actionArgPtr[i].u.file.name);
  223. } else if (actionArgPtr[i].argClass ==
  224. DtACTION_BUFFER) {
  225. XtFree(actionArgPtr[i].u.buffer.bp);
  226. XtFree(actionArgPtr[i].u.buffer.type);
  227. XtFree(actionArgPtr[i].u.buffer.name);
  228. }
  229. }
  230. XtFree(actionArgPtr);
  231. }
  232. myUpdatedArgs = (DtActionArg *) NULL;
  233. myDoneFlag = FALSE;
  234. break;
  235. case DtACTION_STATUS_UPDATE:
  236. myUpdatedArgs = (DtActionArg *) actionArgPtr;
  237. myDoneFlag = FALSE;
  238. break;
  239. default:
  240. /* ignore */
  241. break;
  242. }
  243. }
  244. </ProgramListing>
  245. </InformalExample>
  246. </RefSect1>
  247. <RefSect1>
  248. <Title>SEE ALSO</Title>
  249. <Para>&cdeman.Dt.Action.h;, &cdeman.DtDbLoad;, &cdeman.DtActionLabel;, &cdeman.DtActionDescription;, &cdeman.DtActionExists;, &cdeman.DtActionInvoke;, <![ %CDE.C.CDE; [<Function>XtMalloc</Function>(3), <Function>XtFree</Function>(3), &cdeman.dtdtfile;. ]]><![ %CDE.C.XO; [<Function>XtMalloc</Function>(3), <Function>XtFree</Function>(3) in the &str-Zt;;
  250. <XRef Linkend="XCDI.ACTI.anch.3" Role="2">. ]]></Para>
  251. </RefSect1>
  252. </RefEntry>
  253. <!--fickle 1.12 mancsf-to-docbook 1.2 08/07/95 23:18:47-->