Skip to content

Commit 94bb457

Browse files
committed
WIP: Add excerpts from TCL / Tk header
Add parts of TCL / Tk headers needed to compile. If this header is enough, and correct across platforms, then we should be able to remove the complicated TCL / Tk search algorithms at build time.
1 parent 4c5a3ab commit 94bb457

File tree

2 files changed

+92
-10
lines changed

2 files changed

+92
-10
lines changed

src/_tkagg.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@
2020

2121
extern "C"
2222
{
23-
#ifdef __APPLE__
24-
# ifdef TK_FRAMEWORK
25-
# include <Tcl/tcl.h>
26-
# include <Tk/tk.h>
27-
# else
28-
# include <tk.h>
29-
# endif
30-
#else
31-
# include <tk.h>
32-
#endif
23+
#include "_tkmini.h"
3324
}
3425

3526
#if defined(_MSC_VER)

src/_tkmini.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/* Small excerpts from the Tcl / Tk 8.6 headers
2+
*
3+
* License terms copied from:
4+
* http://www.tcl.tk/software/tcltk/license.html
5+
* as of 20 May 2016.
6+
*
7+
* Copyright (c) 1987-1994 The Regents of the University of California.
8+
* Copyright (c) 1993-1996 Lucent Technologies.
9+
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
10+
* Copyright (c) 1998-2000 by Scriptics Corporation.
11+
* Copyright (c) 2002 by Kevin B. Kenny. All rights reserved.
12+
*
13+
* This software is copyrighted by the Regents of the University
14+
* of California, Sun Microsystems, Inc., Scriptics Corporation,
15+
* and other parties. The following terms apply to all files
16+
* associated with the software unless explicitly disclaimed in
17+
* individual files.
18+
*
19+
* The authors hereby grant permission to use, copy, modify,
20+
* distribute, and license this software and its documentation
21+
* for any purpose, provided that existing copyright notices are
22+
* retained in all copies and that this notice is included
23+
* verbatim in any distributions. No written agreement, license,
24+
* or royalty fee is required for any of the authorized uses.
25+
* Modifications to this software may be copyrighted by their
26+
* authors and need not follow the licensing terms described
27+
* here, provided that the new terms are clearly indicated on
28+
* the first page of each file where they apply.
29+
*
30+
* IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO
31+
* ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
32+
* CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS
33+
* SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN
34+
* IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
35+
* DAMAGE.
36+
*
37+
* THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY
38+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
39+
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
40+
* PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON
41+
* AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
42+
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
43+
* ENHANCEMENTS, OR MODIFICATIONS.
44+
*
45+
* GOVERNMENT USE: If you are acquiring this software on behalf
46+
* of the U.S. government, the Government shall have only
47+
* "Restricted Rights" in the software and related documentation
48+
* as defined in the Federal Acquisition Regulations (FARs) in
49+
* Clause 52.227.19 (c) (2). If you are acquiring the software
50+
* on behalf of the Department of Defense, the software shall be
51+
* classified as "Commercial Computer Software" and the
52+
* Government shall have only "Restricted Rights" as defined in
53+
* Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
54+
* foregoing, the authors grant the U.S. Government and others
55+
* acting in its behalf permission to use and distribute the
56+
* software in accordance with the terms specified in this
57+
* license
58+
*/
59+
60+
/* Tcl header excerpts */
61+
#define TCL_OK 0
62+
#define TCL_ERROR 1
63+
64+
typedef struct Tcl_Interp
65+
{
66+
char *result;
67+
void (*freeProc) (char *);
68+
int errorLine;
69+
} Tcl_Interp;
70+
71+
typedef struct Tcl_Command_ *Tcl_Command;
72+
typedef void *ClientData;
73+
74+
typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp
75+
*interp, int argc, const char *argv[]);
76+
typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
77+
78+
/* Tk header excerpts */
79+
typedef struct Tk_Window_ *Tk_Window;
80+
81+
typedef void *Tk_PhotoHandle;
82+
83+
typedef struct Tk_PhotoImageBlock
84+
{
85+
unsigned char *pixelPtr;
86+
int width;
87+
int height;
88+
int pitch;
89+
int pixelSize;
90+
int offset[4];
91+
} Tk_PhotoImageBlock;

0 commit comments

Comments
 (0)