ttsnoop_stubs.C.src 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. /*** DTB_USER_CODE_START vvv Add file header below vvv ***/
  2. //%% (c) Copyright 1993, 1994 Hewlett-Packard Company
  3. //%% (c) Copyright 1993, 1994 International Business Machines Corp.
  4. //%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  5. //%% (c) Copyright 1993, 1994 Novell, Inc.
  6. //%% $XConsortium: ttsnoop_stubs.C.src /main/3 1995/11/06 17:14:48 rswiston $
  7. /*** DTB_USER_CODE_END ^^^ Add file header above ^^^ ***/
  8. /*
  9. * File: ttsnoop_stubs.c
  10. * Contains: Module callbacks and connection functions
  11. *
  12. * This file was generated by dtcodegen, from module ttsnoop
  13. *
  14. * Any text may be added between the DTB_USER_CODE_START and
  15. * DTB_USER_CODE_END comments (even non-C code). Descriptive comments
  16. * are provided only as an aid.
  17. *
  18. * ** EDIT ONLY WITHIN SECTIONS MARKED WITH DTB_USER_CODE COMMENTS. **
  19. * ** ALL OTHER MODIFICATIONS WILL BE OVERWRITTEN. DO NOT MODIFY OR **
  20. * ** DELETE THE GENERATED COMMENTS! **
  21. */
  22. #include <stdio.h>
  23. #include <Xm/Xm.h>
  24. #include "dtb_utils.h"
  25. #include "ttsnoop_ui.h"
  26. /**************************************************************************
  27. *** DTB_USER_CODE_START
  28. ***
  29. *** All necessary header files have been included.
  30. ***
  31. *** Add include files, types, macros, externs, and user functions here.
  32. ***/
  33. #include <unistd.h>
  34. #include <fstream>
  35. #include <sstream>
  36. #include "apiTracer_ui.h"
  37. #include "DtTt.h"
  38. extern "C" { const char *_tt_lib_version; };
  39. extern std::ofstream snoopStream;
  40. extern unsigned int globalSaveLines;
  41. extern std::string traceScript;
  42. extern const char * globalVersionString;
  43. extern Tt_pattern snoopPat;
  44. extern Boolean snoopPatIsRegistered;
  45. /*** DTB_USER_CODE_END
  46. ***
  47. *** End of user code section
  48. ***
  49. **************************************************************************/
  50. void
  51. ttsnoop_Help_menu_On_Item_item_CB1(
  52. Widget widget,
  53. XtPointer clientData,
  54. XtPointer callData
  55. )
  56. {
  57. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  58. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  59. dtb_do_onitem_help();
  60. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  61. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  62. }
  63. void
  64. fork_tttrace(
  65. Widget widget,
  66. XtPointer clientData,
  67. XtPointer callData
  68. )
  69. {
  70. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  71. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  72. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  73. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  74. std::ostringstream tttraceCmd;
  75. tttraceCmd << "unset TT_TRACE_SCRIPT; dtterm -sb -sl ";
  76. tttraceCmd << globalSaveLines;
  77. tttraceCmd << " -title tttrace -geometry 120x24 -e tttrace &";
  78. DtTtSetLabel( instance->ttsnoopWin_label, "tttrace" );
  79. system( tttraceCmd.str().c_str() );
  80. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  81. }
  82. void
  83. turnOnTracing(
  84. Widget widget,
  85. XtPointer clientData,
  86. XtPointer callData
  87. )
  88. {
  89. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  90. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  91. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  92. DtbApiTracerTracerInfo instance = &dtb_api_tracer_tracer;
  93. if (!(instance->initialized))
  94. {
  95. dtb_api_tracer_tracer_initialize(
  96. instance, dtb_ttsnoop_ttsnoop_win.ttsnoopWin);
  97. }
  98. DtTtSetLabel( instance->cancelButton, "Stop" );
  99. XtManageChild(instance->tracer_shellform);
  100. tt_trace_control( 0 );
  101. putenv( const_cast<char *>(traceScript.c_str()) );
  102. tt_trace_control( 1 );
  103. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  104. }
  105. void
  106. createMessage(
  107. Widget widget,
  108. XtPointer clientData,
  109. XtPointer callData
  110. )
  111. {
  112. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  113. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  114. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  115. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  116. Tt_message msg = tt_message_create();
  117. Tt_status status = DtTtSetLabel( instance->ttsnoopWin_label,
  118. "tt_message_create()", msg );
  119. if (tt_is_err( status )) {
  120. return;
  121. }
  122. DtTtCreated( DTTT_MESSAGE, msg );
  123. Widget newWidget = DtTtMessageWidgetCreate( instance->ttsnoopWin, msg,
  124. DtTtMessageWidgetUpdate );
  125. status = tt_ptr_error( newWidget );
  126. if (tt_is_err( status )) {
  127. return;
  128. }
  129. XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
  130. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  131. }
  132. void
  133. receiveMessage(
  134. Widget widget,
  135. XtPointer clientData,
  136. XtPointer callData
  137. )
  138. {
  139. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  140. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  141. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  142. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  143. Tt_message msg = tt_message_receive();
  144. Tt_status status = DtTtSetLabel( instance->ttsnoopWin_label,
  145. "tt_message_receive()", msg );
  146. if (tt_is_err( status )) {
  147. return;
  148. }
  149. if (msg == 0) {
  150. return;
  151. }
  152. DtTtCreated( DTTT_MESSAGE, msg );
  153. Widget newWidget = DtTtMessageWidgetCreate( instance->ttsnoopWin, msg,
  154. DtTtMessageWidgetUpdate );
  155. status = tt_ptr_error( newWidget );
  156. if (tt_is_err( status )) {
  157. return;
  158. }
  159. XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
  160. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  161. }
  162. void
  163. openMessage(
  164. Widget widget,
  165. XtPointer clientData,
  166. XtPointer callData
  167. )
  168. {
  169. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  170. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  171. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  172. _DtTtChooserSet( _DtTtChooserMessageOpen );
  173. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  174. }
  175. void
  176. destroyMessage(
  177. Widget widget,
  178. XtPointer clientData,
  179. XtPointer callData
  180. )
  181. {
  182. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  183. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  184. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  185. _DtTtChooserSet( _DtTtChooserMessageDestroy );
  186. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  187. }
  188. void
  189. help_ttsnoop(
  190. Widget widget,
  191. XtPointer clientData,
  192. XtPointer callData
  193. )
  194. {
  195. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  196. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  197. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  198. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  199. _DtMan( instance->ttsnoopWin_label, "ttsnoop" );
  200. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  201. }
  202. void
  203. help_tttrace(
  204. Widget widget,
  205. XtPointer clientData,
  206. XtPointer callData
  207. )
  208. {
  209. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  210. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  211. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  212. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  213. _DtMan( instance->ttsnoopWin_label, "tttrace" );
  214. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  215. }
  216. void
  217. help_ttsession(
  218. Widget widget,
  219. XtPointer clientData,
  220. XtPointer callData
  221. )
  222. {
  223. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  224. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  225. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  226. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  227. _DtMan( instance->ttsnoopWin_label, "ttsession" );
  228. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  229. }
  230. void
  231. help_tt_type_comp(
  232. Widget widget,
  233. XtPointer clientData,
  234. XtPointer callData
  235. )
  236. {
  237. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  238. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  239. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  240. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  241. _DtMan( instance->ttsnoopWin_label, "tt_type_comp" );
  242. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  243. }
  244. void
  245. help_dbserver(
  246. Widget widget,
  247. XtPointer clientData,
  248. XtPointer callData
  249. )
  250. {
  251. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  252. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  253. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  254. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  255. _DtMan( instance->ttsnoopWin_label, "rpc.ttdbserverd" );
  256. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  257. }
  258. void
  259. help_tttracefile(
  260. Widget widget,
  261. XtPointer clientData,
  262. XtPointer callData
  263. )
  264. {
  265. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  266. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  267. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  268. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  269. _DtMan( instance->ttsnoopWin_label, "tttracefile" );
  270. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  271. }
  272. void
  273. help_tt_c(
  274. Widget widget,
  275. XtPointer clientData,
  276. XtPointer callData
  277. )
  278. {
  279. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  280. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  281. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  282. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  283. _DtMan( instance->ttsnoopWin_label, "Tttt_c" );
  284. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  285. }
  286. void
  287. help_tttk(
  288. Widget widget,
  289. XtPointer clientData,
  290. XtPointer callData
  291. )
  292. {
  293. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  294. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  295. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  296. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  297. _DtMan( instance->ttsnoopWin_label, "Tttttk" );
  298. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  299. }
  300. void
  301. helpUsenet(
  302. Widget widget,
  303. XtPointer clientData,
  304. XtPointer callData
  305. )
  306. {
  307. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  308. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  309. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  310. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  311. char *buf = "news:alt.soft-sys.tooltalk";
  312. _DtOpen( instance->ttsnoopWin_label, buf, strlen(buf), "altTT" );
  313. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  314. }
  315. void
  316. sessionTypesLoad(
  317. Widget widget,
  318. XtPointer clientData,
  319. XtPointer callData
  320. )
  321. {
  322. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  323. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  324. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  325. _DtFileChooserSet( _DtFileChooseTypesLoad, 0 );
  326. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  327. }
  328. void
  329. sessionTypesReload(
  330. Widget widget,
  331. XtPointer clientData,
  332. XtPointer callData
  333. )
  334. {
  335. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  336. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  337. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  338. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  339. Tt_message msg = ttdt_file_notice( 0, TTDT_SAVED, TT_BOTH,
  340. "/etc/tt/types.xdr", 0 );
  341. Tt_status status = DtTtSetLabel( instance->ttsnoopWin_label,
  342. "ttdt_file_notice()", msg );
  343. if (tt_is_err( status )) {
  344. return;
  345. }
  346. status = tt_message_send( msg );
  347. if (tt_is_err( status )) {
  348. DtTtSetLabel( instance->ttsnoopWin_label, "tt_message_send()",
  349. status );
  350. }
  351. DtTtCreated( DTTT_MESSAGE, msg );
  352. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  353. }
  354. void
  355. dumpSource(
  356. Widget widget,
  357. XtPointer clientData,
  358. XtPointer callData
  359. )
  360. {
  361. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  362. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  363. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  364. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  365. _DtOpen( instance->ttsnoopWin_label, "tt_type_comp -p", "types" );
  366. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  367. }
  368. void
  369. typesEnumerate(
  370. Widget widget,
  371. XtPointer clientData,
  372. XtPointer callData
  373. )
  374. {
  375. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  376. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  377. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  378. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  379. _DtOpen( instance->ttsnoopWin_label, "tt_type_comp -P", "types" );
  380. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  381. }
  382. void
  383. createPattern(
  384. Widget widget,
  385. XtPointer clientData,
  386. XtPointer callData
  387. )
  388. {
  389. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  390. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  391. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  392. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  393. Tt_pattern pat = tt_pattern_create();
  394. Tt_status status = DtTtSetLabel( instance->ttsnoopWin_label,
  395. "tt_pattern_create()", pat );
  396. if (tt_is_err( status )) {
  397. return;
  398. }
  399. DtTtCreated( DTTT_PATTERN, pat );
  400. Widget newWidget = DtTtPatternWidgetCreate( instance->ttsnoopWin, pat, 0 );
  401. status = tt_ptr_error( newWidget );
  402. if (tt_is_err( status )) {
  403. return;
  404. }
  405. XRaiseWindow( XtDisplay( newWidget ), XtWindow( newWidget ));
  406. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  407. }
  408. void
  409. openPattern(
  410. Widget widget,
  411. XtPointer clientData,
  412. XtPointer callData
  413. )
  414. {
  415. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  416. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  417. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  418. _DtTtChooserSet( _DtTtChooserPatternOpen );
  419. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  420. }
  421. void
  422. destroyPattern(
  423. Widget widget,
  424. XtPointer clientData,
  425. XtPointer callData
  426. )
  427. {
  428. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  429. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  430. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  431. _DtTtChooserSet( _DtTtChooserPatternDestroy );
  432. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  433. }
  434. void
  435. ptypeDeclare(
  436. Widget widget,
  437. XtPointer clientData,
  438. XtPointer callData
  439. )
  440. {
  441. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  442. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  443. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  444. _DtStringChooserSet( _DtStringChoosePtype2Declare, 0 );
  445. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  446. }
  447. void
  448. mediaPtypeDeclare(
  449. Widget widget,
  450. XtPointer clientData,
  451. XtPointer callData
  452. )
  453. {
  454. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  455. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  456. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  457. _DtStringChooserSet( _DtStringChooseMediaPtype2Declare, 0 );
  458. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  459. }
  460. void
  461. ptypeUnDeclare(
  462. Widget widget,
  463. XtPointer clientData,
  464. XtPointer callData
  465. )
  466. {
  467. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  468. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  469. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  470. _DtStringChooserSet( _DtStringChoosePtype2UnDeclare, 0 );
  471. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  472. }
  473. void
  474. ptypeSetDefault(
  475. Widget widget,
  476. XtPointer clientData,
  477. XtPointer callData
  478. )
  479. {
  480. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  481. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  482. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  483. _DtStringChooserSet( _DtStringChoosePtype2SetDefault, 0 );
  484. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  485. }
  486. void
  487. ptypeExists(
  488. Widget widget,
  489. XtPointer clientData,
  490. XtPointer callData
  491. )
  492. {
  493. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  494. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  495. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  496. _DtStringChooserSet( _DtStringChoosePtype2Exists, 0 );
  497. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  498. }
  499. void
  500. libcSystem(
  501. Widget widget,
  502. XtPointer clientData,
  503. XtPointer callData
  504. )
  505. {
  506. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  507. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  508. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  509. _DtStringChooserSet( _DtStringChooseSystem, 0 );
  510. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  511. }
  512. void
  513. libcChdir(
  514. Widget widget,
  515. XtPointer clientData,
  516. XtPointer callData
  517. )
  518. {
  519. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  520. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  521. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  522. _DtFileChooserSet( _DtFileChooseChdir, 0 );
  523. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  524. }
  525. void
  526. libcPutenv(
  527. Widget widget,
  528. XtPointer clientData,
  529. XtPointer callData
  530. )
  531. {
  532. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  533. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  534. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  535. _DtStringChooserSet( _DtStringChoosePutenv, 0 );
  536. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  537. }
  538. void
  539. libcPause(
  540. Widget widget,
  541. XtPointer clientData,
  542. XtPointer callData
  543. )
  544. {
  545. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  546. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  547. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  548. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  549. std::ostringstream advice;
  550. advice << "pause(); /* kill -CONT " << getpid() << " */";
  551. DtTtSetLabel( instance->ttsnoopWin_label, advice.str().c_str() );
  552. //
  553. // run "(if dterror.ds blah blah; then kill -CONT pid; fi)&"
  554. //
  555. std::ostringstream script;
  556. script << "(if dterror.ds ";
  557. // arg 1: text
  558. script << "\"kill -CONT " << getpid() << "\" ";
  559. // arg 2: window title
  560. script << "\"pause()\" ";
  561. // arg 3: confirmation button label
  562. script << "CONT; then ";
  563. // After confirmation, invoke kill(1)
  564. script << "kill -CONT " << getpid() << "; fi)&";
  565. system( script.str().c_str() );
  566. // Run the event loop a few laps, to paint the footer
  567. tttk_block_while( XtWidgetToApplicationContext( widget ), 0, 50 );
  568. pause();
  569. DtTtSetLabel( instance->ttsnoopWin_label, " " );
  570. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  571. }
  572. void
  573. libcExit(
  574. Widget widget,
  575. XtPointer clientData,
  576. XtPointer callData
  577. )
  578. {
  579. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  580. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  581. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  582. exit( 0 );
  583. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  584. }
  585. void
  586. msgActions(
  587. Widget widget,
  588. XtPointer clientData,
  589. XtPointer callData
  590. )
  591. {
  592. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  593. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  594. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  595. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  596. _DtOpen( instance->ttsnoopWin_label,
  597. "dttypes -db ACTION -w fld_name TYPE fld_value TT_MSG", "actns" );
  598. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  599. }
  600. void
  601. sessionJoin(
  602. Widget widget,
  603. XtPointer clientData,
  604. XtPointer callData
  605. )
  606. {
  607. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  608. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  609. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  610. _DtSessionChooserSet( _DtSessionChooseJoin, 0 );
  611. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  612. }
  613. void
  614. dtSessionJoin(
  615. Widget widget,
  616. XtPointer clientData,
  617. XtPointer callData
  618. )
  619. {
  620. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  621. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  622. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  623. _DtSessionChooserSet( _DtSessionChooseDtJoin, 0 );
  624. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  625. }
  626. void
  627. sessionQuit(
  628. Widget widget,
  629. XtPointer clientData,
  630. XtPointer callData
  631. )
  632. {
  633. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  634. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  635. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  636. _DtSessionChooserSet( _DtSessionChooseQuit, 0 );
  637. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  638. }
  639. void
  640. sessionSetDefault(
  641. Widget widget,
  642. XtPointer clientData,
  643. XtPointer callData
  644. )
  645. {
  646. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  647. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  648. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  649. _DtSessionChooserSet( _DtSessionChooseDefault, 0 );
  650. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  651. }
  652. void
  653. fileJoin(
  654. Widget widget,
  655. XtPointer clientData,
  656. XtPointer callData
  657. )
  658. {
  659. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  660. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  661. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  662. _DtFileChooserSet( _DtFileChooseJoin, 0 );
  663. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  664. }
  665. void
  666. fileDesktopJoin(
  667. Widget widget,
  668. XtPointer clientData,
  669. XtPointer callData
  670. )
  671. {
  672. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  673. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  674. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  675. _DtFileChooserSet( _DtFileChooseDtJoin, 0 );
  676. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  677. }
  678. void
  679. fileQuit(
  680. Widget widget,
  681. XtPointer clientData,
  682. XtPointer callData
  683. )
  684. {
  685. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  686. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  687. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  688. _DtFileChooserSet( _DtFileChooseQuit, 0 );
  689. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  690. }
  691. void
  692. fileSetDefault(
  693. Widget widget,
  694. XtPointer clientData,
  695. XtPointer callData
  696. )
  697. {
  698. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  699. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  700. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  701. _DtFileChooserSet( _DtFileChooseDefault, 0 );
  702. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  703. }
  704. void
  705. fileUnSetDefault(
  706. Widget widget,
  707. XtPointer clientData,
  708. XtPointer callData
  709. )
  710. {
  711. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  712. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  713. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  714. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  715. Tt_status status = tt_default_file_set( 0 );
  716. DtTtSetLabel( instance->ttsnoopWin_label, "tt_default_file_set( 0 )",
  717. status );
  718. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  719. }
  720. void
  721. fileSaved(
  722. Widget widget,
  723. XtPointer clientData,
  724. XtPointer callData
  725. )
  726. {
  727. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  728. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  729. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  730. _DtTtChooserSet( _DtTtChooserDtFileSaved );
  731. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  732. }
  733. void
  734. fileModified(
  735. Widget widget,
  736. XtPointer clientData,
  737. XtPointer callData
  738. )
  739. {
  740. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  741. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  742. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  743. _DtTtChooserSet( _DtTtChooserDtFileModified );
  744. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  745. }
  746. void
  747. fileReverted(
  748. Widget widget,
  749. XtPointer clientData,
  750. XtPointer callData
  751. )
  752. {
  753. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  754. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  755. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  756. _DtTtChooserSet( _DtTtChooserDtFileReverted );
  757. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  758. }
  759. void
  760. fileGetModified(
  761. Widget widget,
  762. XtPointer clientData,
  763. XtPointer callData
  764. )
  765. {
  766. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  767. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  768. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  769. _DtFileChooserSet( _DtFileChooseGetModified, 0 );
  770. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  771. }
  772. void
  773. fileSave(
  774. Widget widget,
  775. XtPointer clientData,
  776. XtPointer callData
  777. )
  778. {
  779. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  780. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  781. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  782. _DtFileChooserSet( _DtFileChooseSave, 0 );
  783. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  784. }
  785. void
  786. fileRevert(
  787. Widget widget,
  788. XtPointer clientData,
  789. XtPointer callData
  790. )
  791. {
  792. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  793. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  794. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  795. _DtFileChooserSet( _DtFileChooseRevert, 0 );
  796. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  797. }
  798. void
  799. fileNetfile(
  800. Widget widget,
  801. XtPointer clientData,
  802. XtPointer callData
  803. )
  804. {
  805. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  806. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  807. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  808. _DtFileChooserSet( _DtFileChooseNetfile, 0 );
  809. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  810. }
  811. void
  812. netfileFile(
  813. Widget widget,
  814. XtPointer clientData,
  815. XtPointer callData
  816. )
  817. {
  818. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  819. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  820. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  821. _DtStringChooserSet( _DtStringChooseNetfile2File, 0 );
  822. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  823. }
  824. void
  825. fileDesktopQuit(
  826. Widget widget,
  827. XtPointer clientData,
  828. XtPointer callData
  829. )
  830. {
  831. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  832. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  833. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  834. _DtTtChooserSet( _DtTtChooserDtFileQuit );
  835. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  836. }
  837. void
  838. fileMoved(
  839. Widget widget,
  840. XtPointer clientData,
  841. XtPointer callData
  842. )
  843. {
  844. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  845. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  846. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  847. _DtTtChooserSet( _DtTtChooserDtFileMoved );
  848. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  849. }
  850. void
  851. fileDeleted(
  852. Widget widget,
  853. XtPointer clientData,
  854. XtPointer callData
  855. )
  856. {
  857. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  858. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  859. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  860. _DtTtChooserSet( _DtTtChooserDtFileDeleted );
  861. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  862. }
  863. void
  864. dtSessionQuit(
  865. Widget widget,
  866. XtPointer clientData,
  867. XtPointer callData
  868. )
  869. {
  870. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  871. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  872. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  873. _DtTtChooserSet( _DtTtChooserDtSessionQuit );
  874. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  875. }
  876. void
  877. procidOpen(
  878. Widget widget,
  879. XtPointer clientData,
  880. XtPointer callData
  881. )
  882. {
  883. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  884. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  885. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  886. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  887. char *procid = tt_open();
  888. Widget label = instance->ttsnoopWin_label;
  889. DtTtSetLabel( label, "tt_open()", procid );
  890. int fd = tt_fd();
  891. Tt_status status = tt_int_error( fd );
  892. if (tt_is_err( status )) {
  893. DtTtSetLabel( instance->ttsnoopWin_label, "tt_fd()", status );
  894. return;
  895. }
  896. XtInputId id = XtAppAddInput( XtWidgetToApplicationContext( label ),
  897. fd, (XtPointer)XtInputReadMask,
  898. tttk_Xt_input_handler, procid );
  899. DtTtCreated( DTTT_PROCID, procid, (void *)id );
  900. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  901. }
  902. void
  903. procidClose(
  904. Widget widget,
  905. XtPointer clientData,
  906. XtPointer callData
  907. )
  908. {
  909. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  910. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  911. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  912. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  913. char *procid = tt_default_procid();
  914. Tt_status status = DtTtSetLabel( instance->ttsnoopWin_label,
  915. "tt_default_procid()", procid );
  916. if (tt_is_err( status )) {
  917. return;
  918. }
  919. status = tt_close();
  920. DtTtSetLabel( instance->ttsnoopWin_label, "tt_close()", status );
  921. int nth = DtTtIndex( DTTT_PROCID, procid );
  922. if (nth < 0) {
  923. return;
  924. }
  925. XtInputId id = (XtInputId)DtTtNthClientDatum( DTTT_PROCID, nth );
  926. if (id != 0) {
  927. XtRemoveInput( id );
  928. }
  929. DtTtDestroyed( DTTT_PROCID, procid );
  930. tt_free( procid );
  931. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  932. }
  933. void
  934. procidSetDefault(
  935. Widget widget,
  936. XtPointer clientData,
  937. XtPointer callData
  938. )
  939. {
  940. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  941. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  942. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  943. _DtTtChooserSet( _DtTtChooserProcidSetDefault );
  944. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  945. }
  946. void
  947. procidSuspend(
  948. Widget widget,
  949. XtPointer clientData,
  950. XtPointer callData
  951. )
  952. {
  953. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  954. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  955. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  956. _DtTtChooserSet( _DtTtChooserProcidSuspend );
  957. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  958. }
  959. void
  960. procidResume(
  961. Widget widget,
  962. XtPointer clientData,
  963. XtPointer callData
  964. )
  965. {
  966. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  967. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  968. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  969. _DtTtChooserSet( _DtTtChooserProcidResume );
  970. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  971. }
  972. void
  973. procidDtOpen(
  974. Widget widget,
  975. XtPointer clientData,
  976. XtPointer callData
  977. )
  978. {
  979. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  980. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  981. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  982. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  983. int fd;
  984. char *procid = ttdt_open( &fd, "Ttsnoop", "CDE", globalVersionString, 1 );
  985. Widget label = instance->ttsnoopWin_label;
  986. DtTtSetLabel( label, "ttdt_open()", procid );
  987. if (! tt_is_err( tt_ptr_error( procid ) )) {
  988. XtInputId id;
  989. id = XtAppAddInput( XtWidgetToApplicationContext( label ),
  990. fd, (XtPointer)XtInputReadMask,
  991. tttk_Xt_input_handler, procid );
  992. DtTtCreated( DTTT_PROCID, procid, (void *)id );
  993. }
  994. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  995. }
  996. void
  997. procidDtClose(
  998. Widget widget,
  999. XtPointer clientData,
  1000. XtPointer callData
  1001. )
  1002. {
  1003. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1004. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1005. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1006. _DtTtChooserSet( _DtTtChooserDtProcidClose );
  1007. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1008. }
  1009. void
  1010. procidDefault(
  1011. Widget widget,
  1012. XtPointer clientData,
  1013. XtPointer callData
  1014. )
  1015. {
  1016. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1017. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1018. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1019. char *val = tt_default_procid();
  1020. snoopStream << "tt_default_procid() = " << (void *)val;
  1021. if (tt_is_err( tt_ptr_error( val ))) {
  1022. snoopStream << tt_ptr_error( val );
  1023. } else if (val != 0) {
  1024. snoopStream << val;
  1025. }
  1026. snoopStream << endl;
  1027. tt_free( val );
  1028. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1029. }
  1030. void
  1031. ptypeDefault(
  1032. Widget widget,
  1033. XtPointer clientData,
  1034. XtPointer callData
  1035. )
  1036. {
  1037. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1038. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1039. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1040. char *val = tt_default_ptype();
  1041. snoopStream << "tt_default_ptype() = " << (void *)val;
  1042. if (tt_is_err( tt_ptr_error( val ))) {
  1043. snoopStream << tt_ptr_error( val );
  1044. } else if (val != 0) {
  1045. snoopStream << val;
  1046. }
  1047. snoopStream << endl;
  1048. tt_free( val );
  1049. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1050. }
  1051. void
  1052. sessionDefault(
  1053. Widget widget,
  1054. XtPointer clientData,
  1055. XtPointer callData
  1056. )
  1057. {
  1058. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1059. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1060. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1061. char *val = tt_default_session();
  1062. snoopStream << "tt_default_session() = " << (void *)val;
  1063. if (tt_is_err( tt_ptr_error( val ))) {
  1064. snoopStream << tt_ptr_error( val );
  1065. } else if (val != 0) {
  1066. snoopStream << val;
  1067. }
  1068. snoopStream << endl;
  1069. tt_free( val );
  1070. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1071. }
  1072. void
  1073. fileDefault(
  1074. Widget widget,
  1075. XtPointer clientData,
  1076. XtPointer callData
  1077. )
  1078. {
  1079. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1080. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1081. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1082. char *val = tt_default_file();
  1083. snoopStream << "tt_default_file() = " << (void *)val;
  1084. if (tt_is_err( tt_ptr_error( val ))) {
  1085. snoopStream << tt_ptr_error( val );
  1086. } else if (val != 0) {
  1087. snoopStream << val;
  1088. }
  1089. snoopStream << endl;
  1090. tt_free( val );
  1091. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1092. }
  1093. void
  1094. toggleSnooping(
  1095. Widget widget,
  1096. XtPointer clientData,
  1097. XtPointer callData
  1098. )
  1099. {
  1100. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1101. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1102. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1103. DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
  1104. if (snoopPat == 0) {
  1105. DtTtSetLabel( instance->ttsnoopWin_label, "Tt_pattern == 0" );
  1106. XtSetSensitive(
  1107. instance->menubar_Snoop_item_Snoop_menu_items.Off_item,
  1108. False );
  1109. return;
  1110. }
  1111. Tt_status status;
  1112. char *func;
  1113. if (snoopPatIsRegistered) {
  1114. status = tt_pattern_unregister( snoopPat );
  1115. func = "tt_pattern_unregister(";
  1116. } else {
  1117. status = tt_pattern_register( snoopPat );
  1118. func = "tt_pattern_register(";
  1119. }
  1120. if (! tt_is_err( status )) {
  1121. snoopPatIsRegistered = ! snoopPatIsRegistered;
  1122. }
  1123. std::ostringstream stream;
  1124. stream << func << (void *)snoopPat << ")" << ends;
  1125. DtTtSetLabel( instance->ttsnoopWin_label, stream.str().c_str(), status );
  1126. DtTtSetLabel( instance->menubar_Snoop_item_Snoop_menu_items.Off_item,
  1127. snoopPatIsRegistered ? "Off" : "On" );
  1128. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1129. }
  1130. void
  1131. printVersion(
  1132. Widget widget,
  1133. XtPointer clientData,
  1134. XtPointer callData
  1135. )
  1136. {
  1137. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1138. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1139. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1140. snoopStream << "ttsnoop: " << globalVersionString << endl;
  1141. snoopStream << "tt_c.h: " << TT_VERSION << endl;
  1142. snoopStream << "libtt: " << _tt_lib_version << endl;
  1143. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1144. }
  1145. void
  1146. createStandardMessage(
  1147. Widget widget,
  1148. XtPointer clientData,
  1149. XtPointer callData
  1150. )
  1151. {
  1152. /*** DTB_USER_CODE_START vvv Add C variables and code below vvv ***/
  1153. /*** DTB_USER_CODE_END ^^^ Add C variables and code above ^^^ ***/
  1154. /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
  1155. _DtTtChooserSet( _DtTtChooserMessageCreateStandard );
  1156. /*** DTB_USER_CODE_END ^^^ Add C code above ^^^ ***/
  1157. }
  1158. /**************************************************************************
  1159. *** DTB_USER_CODE_START
  1160. ***
  1161. *** All automatically-generated data and functions have been defined.
  1162. ***
  1163. *** Add new functions here, or at the top of the file.
  1164. ***/
  1165. /*** DTB_USER_CODE_END
  1166. ***
  1167. *** End of user code section
  1168. ***
  1169. **************************************************************************/