~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/TCLwidgets/tw_sglobal.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2   tw_sglobal.c
  3 */
  4 #include <stdio.h>
  5 #include <tina/sys.h>
  6 #include <tcl.h>
  7 #include "tclWt.h"
  8 #include "tclWtPro.h"
  9 
 10 
 11 static void sglobal_call(Tw_callback *twc)
 12 {
 13 }
 14 
 15 
 16 static void sglobal_cmnd(Tw_callback * twc, char *args)
 17 {
 18         char  *ptr = (char *)twc->data1;
 19 
 20         (void) sscanf(args, "%*s %s", ptr);
 21 }
 22 
 23 
 24 static void sglobal_prnt(FILE * fp, Tw_callback * twc)
 25 {
 26         char *s = (char *) twc->data1;
 27 
 28         (void) fprintf(fp, "%s %s\n", twc->name, s);
 29 }
 30 
 31 
 32 static char *ttcl_writetrace_sglobal(ClientData cdata, Tcl_Interp *interp,
 33                                                         char *name1, char *name2, int flags)
 34 {
 35         Tw_callback  *twc = (Tw_callback *)cdata;
 36         char               *ptr = (char *)twc->data1;
 37         char         *tclvalue;
 38 
 39   tclvalue = Tcl_GetVar2(interp, name1, name2, flags);
 40         if (tclvalue == NULL)
 41                 return ("variable update failed");
 42 
 43         (void) sscanf(tclvalue, "%s", ptr);
 44         return(NULL);
 45 }
 46 
 47 
 48 static char *ttcl_readtrace_sglobal(ClientData cdata, Tcl_Interp *interp,
 49                                                         char *name1, char *name2, int flags)
 50 {
 51         Tw_callback  *twc = (Tw_callback *)cdata;
 52         char               *ptr = (char *)twc->data1;
 53 
 54   if (!Tcl_SetVar2(interp, name1, name2, ptr, flags))
 55                 return ("variable update failed");
 56         return(NULL);
 57 }
 58 
 59 
 60 Tw_callback *tw_sglobal(char *name, char *ptr, int nchars)
 61 {
 62         Tcl_Interp      *interp;
 63         Tw_callback *twc;
 64         char *fullname = tw_extend_fullname(tw_get_toolname(), name);
 65         char *tclname;
 66         
 67         if ((interp = ttcl_get_interp()) == NULL)
 68                 return;
 69 
 70         twc = tw_callback_make(fullname, NULL, sglobal_call, sglobal_cmnd,
 71                                          sglobal_prnt, (void (*)()) NULL, (void *)ptr, NULL);
 72 
 73         tclname = ttcl_mkshellname(fullname, TTCLSGLOBAL);
 74 
 75         Tcl_SetVar(interp, tclname, ptr, 0);
 76         Tcl_TraceVar(interp, tclname, TCL_TRACE_WRITES, ttcl_writetrace_sglobal, 
 77                         (ClientData)twc);
 78         Tcl_TraceVar(interp, tclname, TCL_TRACE_READS, ttcl_readtrace_sglobal, 
 79                         (ClientData)twc);
 80 
 81         rfree(tclname);
 82         return (twc);
 83 }
 84 
 85 void tw_sglobal_reset(Tw_callback * twc)
 86 {
 87 }
 88 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.