AssocData.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
源码类别:

通讯编程

开发平台:

Visual C++

  1. '"
  2. '" Copyright (c) 1995-1996 Sun Microsystems, Inc.
  3. '"
  4. '" See the file "license.terms" for information on usage and redistribution
  5. '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  6. '" 
  7. '" 
  8. '" RCS: @(#) $Id: AssocData.3,v 1.4 2001/04/24 20:59:17 kennykb Exp $
  9. .so man.macros
  10. .TH Tcl_SetAssocData 3 7.5 Tcl "Tcl Library Procedures"
  11. .BS
  12. .SH NAME
  13. Tcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData - manage
  14. associations of string keys and user specified data with Tcl
  15. interpreters.
  16. .SH SYNOPSIS
  17. .nf
  18. fB#include <tcl.h>fR
  19. .sp
  20. ClientData
  21. fBTcl_GetAssocDatafR(fIinterp, key, delProcPtrfR)
  22. .sp
  23. fBTcl_SetAssocDatafR(fIinterp, key, delProc, clientDatafR)
  24. .sp
  25. fBTcl_DeleteAssocDatafR(fIinterp, keyfR)
  26. .SH ARGUMENTS
  27. .AS Tcl_InterpDeleteProc *delProcPtr
  28. .AP Tcl_Interp *interp in
  29. Interpreter in which to execute the specified command.
  30. .VS 8.4
  31. .AP "CONST char" *key in
  32. .VE
  33. Key for association with which to store data or from which to delete or
  34. retrieve data.  Typically the module prefix for a package.
  35. .AP Tcl_InterpDeleteProc *delProc in
  36. Procedure to call when fIinterpfR is deleted.
  37. .AP Tcl_InterpDeleteProc **delProcPtr in
  38. Pointer to location in which to store address of current deletion procedure
  39. for association.  Ignored if NULL.
  40. .AP ClientData clientData in
  41. Arbitrary one-word value associated with the given key in this
  42. interpreter.  This data is owned by the caller.
  43. .BE
  44. .SH DESCRIPTION
  45. .PP
  46. These procedures allow extensions to associate their own data with
  47. a Tcl interpreter.
  48. An association consists of a string key, typically the name of
  49. the extension, and a one-word value, which is typically a pointer
  50. to a data structure holding data specific to the extension.
  51. Tcl makes no interpretation of either the key or the value for
  52. an association.
  53. .PP
  54. Storage management is facilitated by storing with each association a
  55. procedure to call when the interpreter is deleted. This
  56. procedure can dispose of the storage occupied by the client's data in any
  57. way it sees fit.
  58. .PP
  59. fBTcl_SetAssocDatafR creates an association between a string
  60. key and a user specified datum in the given interpreter.
  61. If there is already an association with the given fIkeyfR,
  62. fBTcl_SetAssocDatafR overwrites it with the new information.
  63. It is up to callers to organize their use of names to avoid conflicts,
  64. for example, by using package names as the keys.
  65. If the fIdeleteProcfR argument is non-NULL it specifies the address of a
  66. procedure to invoke if the interpreter is deleted before the association
  67. is deleted.  fIDeleteProcfR should have arguments and result that match
  68. the type fBTcl_InterpDeleteProcfR:
  69. .CS
  70. typedef void Tcl_InterpDeleteProc(
  71. ClientData fIclientDatafR,
  72. Tcl_Interp *fIinterpfR);
  73. .CE
  74. When fIdeleteProcfR is invoked the fIclientDatafR and fIinterpfR
  75. arguments will be the same as the corresponding arguments passed to
  76. fBTcl_SetAssocDatafR.
  77. The deletion procedure will fInotfR be invoked if the association
  78. is deleted before the interpreter is deleted.
  79. .PP
  80. fBTcl_GetAssocDatafR returns the datum stored in the association with the
  81. specified key in the given interpreter, and if the fIdelProcPtrfR field
  82. is non-fBNULLfR, the address indicated by it gets the address of the
  83. delete procedure stored with this association. If no association with the
  84. specified key exists in the given interpreter fBTcl_GetAssocDatafR
  85. returns fBNULLfR.
  86. .PP
  87. fBTcl_DeleteAssocDatafR deletes an association with a specified key in
  88. the given interpreter.  Then it calls the deletion procedure.
  89. .SH KEYWORDS
  90. association, data, deletion procedure, interpreter, key