ch02.sgm 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <!-- $XConsortium: ch02.sgm /main/8 1996/08/31 15:12:59 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. <Chapter Id="TTUG.HTU.div.1">
  10. <Title Id="TTUG.HTU.mkr.1">Using ToolTalk Messaging</Title>
  11. <indexterm><primary>messages</primary><secondary>general information</secondary></indexterm>
  12. <note>
  13. <para>Some code fragments shown in this chapter are taken from a
  14. ToolTalk demo program called <literal>broadcast</literal>. See the directory
  15. <filename>/usr/dt/examples/tt</filename> for the source code, <filename>Makefile</filename>
  16. and <filename>README</filename> file.
  17. </para>
  18. </note>
  19. <Sect1 Id="TTUG.HTU.div.2">
  20. <title>Telling Your Application about ToolTalk Functionality</title>
  21. <para>Before your application can use the inter-operability functionality
  22. provided by the ToolTalk service and the Messaging Toolkit, it needs to
  23. know where the ToolTalk libraries and toolkit reside.
  24. </para>
  25. <Sect2 Id="TTUG.HTU.div.3">
  26. <title>Using the Messaging Toolkit and Including ToolTalk Commands</title>
  27. <para>To use the ToolTalk service, an application calls ToolTalk functions
  28. from the ToolTalk application programming interface (API). The Messaging
  29. Toolkit provides higher-level functions than the ToolTalk API, such as
  30. functions to register with the ToolTalk service, to create message
  31. patterns, to send messages, to receive messages, and to examine message
  32. information. To modify your application to use the ToolTalk service and
  33. toolkit, you must include the following header files:
  34. </para>
  35. <indexterm><primary>header files</primary></indexterm>
  36. <programlisting>#include &lt;Tt/tt_c.h&gt; /* ToolTalk Header File */
  37. #include &lt;Tt/tttk.h&gt; /* Messaging Toolkit Header File */
  38. </programlisting>
  39. </sect2>
  40. <Sect2 Id="TTUG.HTU.div.4">
  41. <title>Using the ToolTalk Library</title>
  42. <indexterm><primary>library, ToolTalk</primary></indexterm>
  43. <para>The ToolTalk library is located in the directory:
  44. </para>
  45. <programlisting>/usr/dt/lib
  46. </programlisting>
  47. <para>The library name is platform-dependent (for example, on Solaris it is named
  48. <filename>libtt.so</filename> and on HP-UX is its named
  49. <filename>libtt.sl</filename>).
  50. </para>
  51. </sect2>
  52. </sect1>
  53. <Sect1 Id="TTUG.HTU.div.5">
  54. <title>Before You Start Coding</title>
  55. <para>Before you can incorporate the Messaging Toolkit functionality into your
  56. application, you need to determine the way that your tool will work with
  57. other tools. There are several basic questions you need to ask:
  58. </para>
  59. <itemizedlist>
  60. <listitem>
  61. <para>How will these tools work together?
  62. </para>
  63. </listitem>
  64. <listitem>
  65. <para>What kinds of operations can these tools perform?
  66. </para>
  67. </listitem>
  68. <listitem>
  69. <para>What kinds of operations can these tools ask other tools to perform?
  70. </para>
  71. </listitem>
  72. <listitem>
  73. <para>What events will these tools generate that may interest other tools?
  74. (What types of messages will these tools want to send?)
  75. </para>
  76. </listitem>
  77. <listitem>
  78. <para>What events generated by other tools will be of interest to these
  79. tools? (What types of messages will these tools want to receive?)
  80. </para>
  81. </listitem>
  82. </itemizedlist>
  83. <para>To best answer these questions, you need to understand the difference
  84. between events and operations, and how the ToolTalk service handles
  85. messages regarding each of these.
  86. </para>
  87. <Sect2 Id="TTUG.HTU.div.6">
  88. <title>What Is the Difference Between an Event and an Operation?</title>
  89. <indexterm><primary>event defined</primary></indexterm>
  90. <indexterm><primary>operation defined</primary></indexterm>
  91. <para>An <emphasis>event</emphasis> is an announcement that something has happened. An event is
  92. simply a news bulletin. The sending process has no formal expectations
  93. as to whether any other process will hear about the event, or whether an
  94. action is taken as a consequence of the event. When a process uses the
  95. ToolTalk service to inform interested processes that an event has
  96. occurred, it sends a <emphasis>notice</emphasis>. Since the sending process does not expect a
  97. reply, an event cannot fail.
  98. </para>
  99. <para>An <emphasis>operation</emphasis> is an inquiry or an action. The requesting process makes an
  100. inquiry or requests that an operation be performed. The requesting
  101. process expects a result to be returned and needs to be informed of the
  102. status of the inquiry or action. When a process uses the ToolTalk
  103. service to ask another tool to perform an operation, it sends a <emphasis>request</emphasis>.
  104. The ToolTalk service delivers the request to interested processes and
  105. informs the sending process of the status of the request.
  106. </para>
  107. <Sect3 Id="TTUG.HTU.div.7">
  108. <title>Sending Notices</title>
  109. <para>When your application sends a ToolTalk notice, it will not receive a
  110. reply or be informed about whether or not any tool pays attention to the
  111. notice. It is important to make the notice an impartial report of the
  112. event as it happens. For example, if your tool sends the Desktop
  113. Services message <literal>Modified</literal>, it may expect any listening tools to react in
  114. a given way. Your tool, however, should not care, and does not need to
  115. be informed about whether any or no other tool reacts to the message; it
  116. only wants to report the event, <Symbol>THE_USER_HAS_MADE_CHANGES_TO_THIS</Symbol>.
  117. </para>
  118. </sect3>
  119. <Sect3 Id="TTUG.HTU.div.8">
  120. <title>Sending Requests</title>
  121. <para>When your application sends a ToolTalk request, it expects one tool to
  122. perform the indicated operation, or to answer the inquiry, and return a
  123. reply message. For example, if your tool sends the Desktop Services
  124. message <literal>Get_Modified</literal>, it should expect notification that the message was
  125. delivered and the action performed. The ToolTalk service guarantees that
  126. either a reply will be returned by the receiving process or the sender
  127. will be informed of the request's failure.
  128. </para>
  129. <para>You can identify requests in three ways:
  130. </para>
  131. <itemizedlist>
  132. <listitem>
  133. <para>By identifying the operations requested by your tool that can fail.
  134. </para>
  135. </listitem>
  136. <listitem>
  137. <para>By identifying the operations your tool can perform for other tools.
  138. </para>
  139. </listitem>
  140. <listitem>
  141. <para>By identifying the operations your tool will want other tools to perform.
  142. </para>
  143. </listitem>
  144. </itemizedlist>
  145. <para>A good method to use to identify these operations is to develop a
  146. scenario that outlines the order of events and operations that you
  147. expect your tool to perform and have performed.
  148. </para>
  149. </sect3>
  150. </sect2>
  151. <Sect2 Id="TTUG.HTU.div.9">
  152. <title>Developing a Scenario</title>
  153. <para>A scenario outlines the order of the events and operations that a tool
  154. will expect to perform and to have performed. For example, the following
  155. scenario outlines the events a generic editor could expect to perform
  156. and to have performed:
  157. </para>
  158. <orderedlist>
  159. <listitem>
  160. <para>User double-clicks on a document icon in the File Manager.
  161. The file opens in the editor, which is started by the system if one is
  162. not already running. (If another tool has modifications to the text
  163. pending for the document, the user is asked whether the other tool
  164. should save the text changes or revert to the last saved version of the
  165. document.)
  166. </para>
  167. </listitem>
  168. <listitem>
  169. <para>User inserts text.
  170. </para>
  171. </listitem>
  172. <listitem>
  173. <para>User saves the document. (If another tool has modifications pending
  174. for the document, the user is asked whether to modify the document.)
  175. </para>
  176. </listitem>
  177. <listitem>
  178. <para>User exits the editor. (If text has unsaved changes, the user is
  179. asked whether to save or discard the changes before quitting the file.)
  180. </para>
  181. </listitem>
  182. </orderedlist>
  183. <para>Once the scenario is done, you can answer your basic questions.
  184. </para>
  185. <Sect3 Id="TTUG.HTU.div.10">
  186. <title>How Will the Tools Work Together?</title>
  187. <itemizedlist>
  188. <listitem>
  189. <para>The File Manager requests that an editor open a document for
  190. editing.
  191. </para>
  192. </listitem>
  193. <listitem>
  194. <para>Each instance of the editor notifies other interested instances of
  195. changes it makes to the state of the document.
  196. </para>
  197. </listitem>
  198. </itemizedlist>
  199. </sect3>
  200. <Sect3 Id="TTUG.HTU.div.11">
  201. <title>What Kinds of Operations Do the Tools Perform?</title>
  202. <itemizedlist>
  203. <listitem>
  204. <para>Each instance of the editor can answer questions about itself and
  205. its state, such as &ldquo;What is your status?&rdquo;
  206. </para>
  207. </listitem>
  208. <listitem>
  209. <para>Each instance of the editor has the capability of performing
  210. operations such as:
  211. </para>
  212. <itemizedlist>
  213. <listitem>
  214. <para>Iconifying and de-iconifying
  215. </para>
  216. </listitem>
  217. <listitem>
  218. <para>Raising to front and lowering to back
  219. </para>
  220. </listitem>
  221. <listitem>
  222. <para>Editing a document
  223. </para>
  224. </listitem>
  225. <listitem>
  226. <para>Displaying a document (read-only)
  227. </para>
  228. </listitem>
  229. <listitem>
  230. <para>Quitting
  231. </para>
  232. </listitem>
  233. </itemizedlist>
  234. </listitem>
  235. </itemizedlist>
  236. </sect3>
  237. <Sect3 Id="TTUG.HTU.div.12">
  238. <title>What Kinds of Operations Can the Tools Ask Other Tools to Perform?</title>
  239. <itemizedlist>
  240. <listitem>
  241. <para>The File Manager must request that the editor open a document for editing.
  242. </para>
  243. </listitem>
  244. <listitem>
  245. <para>An instance of the editor can ask another instance of the editor to save changes to the open document.
  246. </para>
  247. </listitem>
  248. <listitem>
  249. <para>An instance of the editor can ask another instance of the editor to revert to the last saved version of the open document.
  250. </para>
  251. </listitem>
  252. </itemizedlist>
  253. </sect3>
  254. <Sect3 Id="TTUG.HTU.div.13">
  255. <title>What Events Will the Tools Generate that May Interest Other Tools?</title>
  256. <itemizedlist>
  257. <listitem>
  258. <para>The document has been opened.
  259. </para>
  260. </listitem>
  261. <listitem>
  262. <para>The document has been modified.
  263. </para>
  264. </listitem>
  265. <listitem>
  266. <para>The document has been reverted to last saved version.
  267. </para>
  268. </listitem>
  269. <listitem>
  270. <para>The document has been saved.
  271. </para>
  272. </listitem>
  273. <listitem>
  274. <para>An instance of the editor has been exited.
  275. </para>
  276. </listitem>
  277. </itemizedlist>
  278. </sect3>
  279. <Sect3 Id="TTUG.HTU.div.14">
  280. <title>What Events Generated by Other Tools Will Be of Interest to This Tool?</title>
  281. <itemizedlist>
  282. <listitem>
  283. <para>The document has been opened.
  284. </para>
  285. </listitem>
  286. <listitem>
  287. <para>The document has been modified.
  288. </para>
  289. </listitem>
  290. <listitem>
  291. <para>The document has been reverted to last saved version.
  292. </para>
  293. </listitem>
  294. <listitem>
  295. <para>The document has been saved.
  296. </para>
  297. </listitem>
  298. <listitem>
  299. <para>An instance of the editor has been exited.
  300. </para>
  301. </listitem>
  302. </itemizedlist>
  303. </sect3>
  304. </sect2>
  305. </sect1>
  306. <Sect1 Id="TTUG.HTU.div.15">
  307. <title>Preparing Your Application for Communication</title>
  308. <para>The ToolTalk service provides you with a complete set of functions for
  309. application integration. Using the functionality provided with the
  310. ToolTalk Messaging Toolkit, your applications can be made to &ldquo;speak&rdquo; to
  311. other applications that are ToolTalk-compliant. This section describes
  312. how to add the kinds of ToolTalk functions you need to include in your
  313. application so that it can communicate with other ToolTalk-aware
  314. applications that follow the same protocols.
  315. </para>
  316. <Sect2 Id="TTUG.HTU.div.16">
  317. <title>Creating a Ptype File</title>
  318. <indexterm><primary>ptype file, creating</primary></indexterm>
  319. <para>The ToolTalk types mechanism is designed to help the ToolTalk service
  320. route messages. When your tool declares a ptype (process type), the message patterns
  321. listed in it are automatically registered. The ToolTalk service then
  322. matches messages it receives to these registered patterns. These static
  323. message patterns remain in effect until the tool closes communication
  324. with the ToolTalk service.
  325. </para>
  326. <para>The ToolTalk Types Database already has installed ptypes for tools
  327. bundled with this release. You can extract a list of the installed
  328. ptypes from the ToolTalk Types Database, as follows:
  329. </para>
  330. <screen>% tt_type_comp -d <symbol role="variable">user | system | network</symbol> -P
  331. </screen>
  332. <para>The names of the ptypes are printed out in source format.
  333. </para>
  334. <para>To generate a list of the installed ptypes including their signatures:
  335. </para>
  336. <screen>% tt_type_comp -d <symbol role="variable">user | system | network</symbol> -p
  337. </screen>
  338. <para>For all other tools (that is, tools that are not included in this
  339. release), you need to first create a ptype file to define the ptype for
  340. your application, and then compile the ptype with the ToolTalk type
  341. compiler, <filename>tt_type_comp</filename>. To define a ptype, you need to include the
  342. following information in a file:
  343. </para>
  344. <itemizedlist>
  345. <listitem>
  346. <para>A process-type identifier (<literal>ptid</literal>).
  347. </para>
  348. </listitem>
  349. <listitem>
  350. <para>An optional start string &mdash; The ToolTalk service executes this command, if necessary, to start a process running the program.
  351. </para>
  352. </listitem>
  353. <listitem>
  354. <para>Signatures &mdash; Describes the <Symbol>TT_PROCEDURE</Symbol>-addressed messages that the
  355. program wants to receive. Messages to be observed are described
  356. separately from messages to be handled.
  357. </para>
  358. </listitem>
  359. </itemizedlist>
  360. <para>To create a ptype file, you can use any text editor
  361. (such as <command>vi</command>, <command>emacs</command>, or <command>dtpad</command>).
  362. </para>
  363. <para>After you have created a ptype file, you need to install the ptype by
  364. running the ToolTalk type compiler. On the command line, type:
  365. </para>
  366. <screen>% tt_type_comp <symbol role="variable">file_name.ptype</symbol>
  367. </screen>
  368. <para>where <symbol role="variable">file_name.ptype</symbol>
  369. is the name of the ptype file.
  370. </para>
  371. <Sect3 Id="TTUG.HTU.div.17">
  372. <title>Testing for Existing Ptypes in Current Session</title>
  373. <indexterm><primary>ptypes, testing for existence of</primary></indexterm>
  374. <para>The ToolTalk service provides the following function to test if a given
  375. ptype is already registered in the current session:
  376. </para>
  377. <programlisting>tt_ptype_exists(const char *ptype_id)
  378. </programlisting>
  379. <para>where <symbol role="variable">ptype_id</symbol> is the identifier of the session to test for registration.
  380. </para>
  381. </sect3>
  382. <Sect3 Id="TTUG.HTU.div.18">
  383. <title>Merging a Compiled Ptype File into a Currently Running ttsession</title>
  384. <para>The ToolTalk service provides the following function to merge a compiled
  385. ToolTalk type file into the currently running <literal>ttsession</literal>:
  386. </para>
  387. <programlisting>tt_session_types_load (
  388. const char *session,
  389. const char *compile_types_file)
  390. </programlisting>
  391. <para>where <symbol role="variable">session</symbol> is the current default ToolTalk session and
  392. <symbol role="variable">compiled_types_file</symbol> is the name of the compiled ToolTalk types file.
  393. This function adds new types and replaces existing types of the same
  394. name; other existing types remain unchanged.
  395. </para>
  396. </sect3>
  397. </sect2>
  398. <Sect2 Id="TTUG.HTU.div.19">
  399. <title>Tasks Every ToolTalk-aware Application Needs to Perform</title>
  400. <para>There are a number of tasks every ToolTalk-aware application needs to
  401. perform, including:
  402. </para>
  403. <itemizedlist>
  404. <listitem>
  405. <para>Initializing the toolkit.
  406. </para>
  407. </listitem>
  408. <listitem>
  409. <para>Joining a ToolTalk session and registering patterns.
  410. </para>
  411. </listitem>
  412. <listitem>
  413. <para>Adding the ToolTalk service to its event loop.
  414. </para>
  415. </listitem>
  416. </itemizedlist>
  417. <para>This section provides examples of the ToolTalk code you need to include
  418. in your application so that it can perform these tasks.
  419. </para>
  420. <Sect3 Id="TTUG.HTU.div.20">
  421. <title>Initializing the Toolkit</title>
  422. <indexterm><primary>toolkit initialization</primary></indexterm>
  423. <para>Your application needs to initialize and register with the initial
  424. ToolTalk session. To do so, it first needs to obtain a process
  425. identifier (procid). The following code fragment shows how to obtain a
  426. procid and how to initialize the toolkit.
  427. </para>
  428. <programlisting>char *procid = ttdt_open(
  429. int *tt_fd,
  430. const char *ptype_name,
  431. const char *vendor_name,
  432. const char *version,
  433. int send_started)
  434. </programlisting>
  435. <note>
  436. <para>Your application must call <function>ttdt_open</function> before any other ToolTalk
  437. calls are made; otherwise, errors may occur.
  438. </para>
  439. </note>
  440. </sect3>
  441. <Sect3 Id="TTUG.HTU.div.21">
  442. <title>Joining the ToolTalk Session and Registering Message Patterns</title>
  443. <indexterm><primary>message patterns, registering</primary></indexterm>
  444. <para>Before your application can receive messages, it must join a ToolTalk
  445. session and register the message patterns that are to be matched. The
  446. ttdt_session_join function registers patterns and default callbacks for
  447. many standard desktop message interfaces.
  448. </para>
  449. <programlisting>Tt_pattern *sess_patt = ttdt_session_join(
  450. const char *session_id,
  451. Ttdt_contract_cb cb,
  452. Widget shell,
  453. void *client_data,
  454. int join)
  455. </programlisting>
  456. <para>Note that if an application has ptypes installed, it will normally call
  457. the function <function>ttmedia_ptype_declare</function> before calling <function>ttdt_session_join</function>.
  458. </para>
  459. </sect3>
  460. <Sect3 Id="TTUG.HTU.div.22">
  461. <title>Adding the ToolTalk Service to Event Loop</title>
  462. <para>Your application also needs to add the ToolTalk service to its event
  463. loop. If the application is an Xt client, it would use <function>XtAppAddInput</function> as
  464. follows:
  465. </para>
  466. <programlisting>XtAppAddInput (app_context,
  467. tt_fd(),
  468. (XtPointer) XtInputReadMask,
  469. tttk_Xt_input_handler,
  470. client_data)
  471. </programlisting>
  472. </sect3>
  473. </sect2>
  474. <Sect2 Id="TTUG.HTU.div.23">
  475. <title>Tasks ToolTalk-aware Editor Applications Need to Perform</title>
  476. <para>In addition to the duties described in the section &ldquo;Tasks Every
  477. ToolTalk-aware Application Needs to Perform&rdquo; in this chapter,
  478. ToolTalk-aware editor applications may also need to perform other tasks,
  479. including:
  480. </para>
  481. <itemizedlist>
  482. <listitem>
  483. <para>Declaring a ptype.
  484. </para>
  485. </listitem>
  486. <listitem>
  487. <para>Writing a media load callback.
  488. </para>
  489. </listitem>
  490. <listitem>
  491. <para>Accepting a contract to handle a message.
  492. </para>
  493. </listitem>
  494. <listitem>
  495. <para>Replying when a request has been completed.
  496. </para>
  497. </listitem>
  498. </itemizedlist>
  499. <para>This section provides examples of the ToolTalk code you need to include
  500. in your editor application so that it can perform these additional
  501. tasks.
  502. </para>
  503. <Sect3 Id="TTUG.HTU.div.24">
  504. <title>Declaring a Ptype</title>
  505. <indexterm><primary>ptype, declaring</primary></indexterm>
  506. <para>If an application has a ptype file that has been installed, the ptypes
  507. need to be associated with the application. The convenience function for
  508. declaring this association is ttmedia_ptype_declare:
  509. </para>
  510. <programlisting>Tt_status status = ttmedia_ptype_declare(
  511. char *ptype_name,
  512. int base_opnum,
  513. Ttmedia_load_pat_cb cb,
  514. void *client_data,
  515. int declare)
  516. </programlisting>
  517. <para>The callback <function>cb</function> is invoked when the application is asked to service
  518. a request supported by the ptype <symbol role="variable">ptype_name</symbol>.
  519. </para>
  520. </sect3>
  521. <Sect3 Id="TTUG.HTU.div.25">
  522. <title>Writing a Media Load Pattern Callback</title>
  523. <para>Before coding an editor application to include any ToolTalk functions,
  524. you need to write a media load callback routine. This callback is
  525. invoked when another application responds to your application's
  526. <function>ttmedia_load</function> call.
  527. </para>
  528. </sect3>
  529. <Sect3 Id="TTUG.HTU.div.26">
  530. <title>Accepting a Contract to Handle a Message</title>
  531. <para>When an application receives a message in its <function>ttmedia_ptype_declare</function>
  532. handler, it should call the following function to accept a contract to
  533. handle the request.
  534. </para>
  535. <programlisting>Tt_pattern *desktop_patts = ttdt_message_accept (
  536. Tt_message contract,
  537. Ttdt_contract_cb cb,
  538. Widget shell,
  539. void *client_data,
  540. int accept,
  541. int send_status)
  542. </programlisting>
  543. </sect3>
  544. <Sect3 Id="TTUG.HTU.div.27">
  545. <title>Replying When Request Is Completed</title>
  546. <para>After your application has completed the operation requested (for
  547. example to edit a document), it must reply to the sending application.
  548. The following function can be used to do the reply and to return the
  549. edited contents of the text to the sender.
  550. </para>
  551. <programlisting>Tt_message msg = ttmedia_load_reply (
  552. Tt_message contract,
  553. const unsigned char *new_contents,
  554. int new_length,
  555. int reply_and_destroy)
  556. </programlisting>
  557. </sect3>
  558. </sect2>
  559. <Sect2 Id="TTUG.HTU.div.28">
  560. <title>Optional Tasks ToolTalk-aware Editor Applications Can Perform</title>
  561. <para>In addition to the tasks described in the section &ldquo;Tasks ToolTalk-aware
  562. Editor Applications Need to Perform&rdquo; in this chapter, editor
  563. applications can also perform other optional tasks such as tasks that
  564. use desktop file interfaces to coordinate with other editors. This
  565. section mentions some of the ToolTalk functions you need to include in
  566. your editor application so that it can perform these optional tasks.
  567. </para>
  568. <Sect3 Id="TTUG.HTU.div.29">
  569. <title>Requesting Modify, Revert, or Save Operations</title>
  570. <para>The following functions can be used to request modify, revert, or save
  571. operations:
  572. </para>
  573. <itemizedlist>
  574. <listitem>
  575. <para><function>ttdt_Get_Modified</function>
  576. </para>
  577. </listitem>
  578. <listitem>
  579. <para><function>ttdt_Revert</function>
  580. </para>
  581. </listitem>
  582. <listitem>
  583. <para><function>ttdt_Save</function>
  584. </para>
  585. </listitem>
  586. </itemizedlist>
  587. </sect3>
  588. <Sect3 Id="TTUG.HTU.div.30">
  589. <title>Notifying When a File Is Modified, Reverted, or Saved</title>
  590. <para>The function <function>ttdt_file_event</function> can be used to notify other ToolTalk
  591. applications that your application's file has been modified, has
  592. reverted, or has been saved.
  593. </para>
  594. </sect3>
  595. <Sect3 Id="TTUG.HTU.div.31">
  596. <title>Quitting a File</title>
  597. <para>The function <function>ttdt_file_quit</function> unregisters interest in ToolTalk events
  598. about a file and destroys the associated pattern.
  599. </para>
  600. </sect3>
  601. </sect2>
  602. </sect1>
  603. </chapter>