File: tcl-compat.h

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (36 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/// @file
/// @brief Definitions to enable compatibility across Tcl 8 → Tcl 9
///
/// Tcl 9 contained multiple breaking changes to the API. To allow compilation
/// under either Tcl 8 or Tcl 9, various shims are needed.
///   • https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9
///   • https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9

#pragma once

#include <limits.h>
#include <tcl.h>

// suggested Tcl 8 compatibility shims from
// https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9
#ifndef TCL_SIZE_MAX
#define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj
#define TCL_SIZE_MAX INT_MAX
#define TCL_SIZE_MODIFIER ""

/// size type for Tcl 8
///
/// https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9
/// says:
///
///   "Tcl_Size" itself doesn't need to be provided as long as you update the
///   extension to the latest tclconfig release. TEA (latest tcl.m4/rules.vc
///   files) takes care of providing an appropriate preprocessor `#define` for
///   `Tcl_Size`.
///
/// but we assume this has not happened.
#ifndef Tcl_Size
#define Tcl_Size int
#endif

#endif