tclegg.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * tclegg.h
  3. * stuff used by tcl.c and tclhash.c
  4. *
  5. */
  6. #ifndef _EGG_TCLEGG_H
  7. #define _EGG_TCLEGG_H
  8. #include "lush.h" /* Include this here, since it's needed
  9. in this file */
  10. #ifndef MAKING_MODS
  11. # include "proto.h" /* This file needs this */
  12. #endif
  13. /* Match types for check_tcl_bind
  14. */
  15. #define MATCH_PARTIAL 0
  16. #define MATCH_EXACT 1
  17. #define MATCH_MASK 2
  18. #define MATCH_CASE 3
  19. /* Bitwise 'or' these:
  20. */
  21. #define BIND_USE_ATTR 0x04
  22. #define BIND_STACKABLE 0x08
  23. #define BIND_HAS_BUILTINS 0x10
  24. #define BIND_WANTRET 0x20
  25. #define BIND_ALTER_ARGS 0x40
  26. /* Return values
  27. */
  28. #define BIND_NOMATCH 0
  29. #define BIND_AMBIGUOUS 1
  30. #define BIND_MATCHED 2 /* But the proc couldn't be found */
  31. #define BIND_EXECUTED 3
  32. #define BIND_EXEC_LOG 4 /* Proc returned 1 -> wants to be logged */
  33. #define BIND_EXEC_BRK 5 /* Proc returned BREAK (quit) */
  34. /* Extra commands are stored in Tcl hash tables (one hash table for each type
  35. * of command: msg, dcc, etc)
  36. */
  37. typedef struct timer_str {
  38. struct timer_str *next;
  39. unsigned int mins; /* Time to elapse */
  40. char *cmd; /* Command linked to */
  41. unsigned long id; /* Used to remove timers */
  42. } tcl_timer_t;
  43. /* Used for stub functions:
  44. */
  45. #define STDVAR (cd, irp, argc, argv) \
  46. ClientData cd; \
  47. Tcl_Interp *irp; \
  48. int argc; \
  49. char *argv[];
  50. #define BADARGS(nl, nh, example) do { \
  51. if ((argc < (nl)) || (argc > (nh))) { \
  52. Tcl_AppendResult(irp, "wrong # args: should be \"", \
  53. argv[0], (example), "\"", NULL); \
  54. return TCL_ERROR; \
  55. } \
  56. } while (0)
  57. unsigned long add_timer(tcl_timer_t **, int, char *, unsigned long);
  58. int remove_timer(tcl_timer_t **, unsigned long);
  59. void list_timers(Tcl_Interp *, tcl_timer_t *);
  60. void wipe_timers(Tcl_Interp *, tcl_timer_t **);
  61. void do_check_timers(tcl_timer_t **);
  62. typedef struct _tcl_strings {
  63. char *name;
  64. char *buf;
  65. int length;
  66. int flags;
  67. } tcl_strings;
  68. typedef struct _tcl_int {
  69. char *name;
  70. int *val;
  71. int readonly;
  72. } tcl_ints;
  73. typedef struct _tcl_coups {
  74. char *name;
  75. int *lptr;
  76. int *rptr;
  77. } tcl_coups;
  78. typedef struct _tcl_cmds {
  79. char *name;
  80. Function func;
  81. } tcl_cmds;
  82. typedef struct _cd_tcl_cmd {
  83. char *name;
  84. Function callback;
  85. void *cdata;
  86. } cd_tcl_cmd;
  87. void add_tcl_commands(tcl_cmds *);
  88. void add_cd_tcl_cmds(cd_tcl_cmd *);
  89. void rem_tcl_commands(tcl_cmds *);
  90. void rem_cd_tcl_cmds(cd_tcl_cmd *);
  91. void add_tcl_strings(tcl_strings *);
  92. void rem_tcl_strings(tcl_strings *);
  93. void add_tcl_coups(tcl_coups *);
  94. void rem_tcl_coups(tcl_coups *);
  95. void add_tcl_ints(tcl_ints *);
  96. void rem_tcl_ints(tcl_ints *);
  97. /* From Tcl's tclUnixInit.c */
  98. /* The following table is used to map from Unix locale strings to
  99. * encoding files.
  100. */
  101. typedef struct LocaleTable {
  102. const char *lang;
  103. const char *encoding;
  104. } LocaleTable;
  105. static const LocaleTable localeTable[] = {
  106. {"ja_JP.SJIS", "shiftjis"},
  107. {"ja_JP.EUC", "euc-jp"},
  108. {"ja_JP.JIS", "iso2022-jp"},
  109. {"ja_JP.mscode", "shiftjis"},
  110. {"ja_JP.ujis", "euc-jp"},
  111. {"ja_JP", "euc-jp"},
  112. {"Ja_JP", "shiftjis"},
  113. {"Jp_JP", "shiftjis"},
  114. {"japan", "euc-jp"},
  115. #ifdef hpux
  116. {"japanese", "shiftjis"},
  117. {"ja", "shiftjis"},
  118. #else
  119. {"japanese", "euc-jp"},
  120. {"ja", "euc-jp"},
  121. #endif
  122. {"japanese.sjis", "shiftjis"},
  123. {"japanese.euc", "euc-jp"},
  124. {"japanese-sjis", "shiftjis"},
  125. {"japanese-ujis", "euc-jp"},
  126. {"ko", "euc-kr"},
  127. {"ko_KR", "euc-kr"},
  128. {"ko_KR.EUC", "euc-kr"},
  129. {"ko_KR.euc", "euc-kr"},
  130. {"ko_KR.eucKR", "euc-kr"},
  131. {"korean", "euc-kr"},
  132. {"ru", "iso8859-5"},
  133. {"ru_RU", "iso8859-5"},
  134. {"ru_SU", "iso8859-5"},
  135. {"zh", "cp936"},
  136. {NULL, NULL}
  137. };
  138. #endif /* _EGG_TCLEGG_H */