Itcl - the [incr Tcl] extension

Check-in [ddf387cd88]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Put extern "C" guard around stub table definition: In C++, calling convention on functions through function pointers might be influcenced by that. See for example: http://en.wikipedia.org/wiki/Compatibility_of_C_and_C++ On SUN's C++ compiler this might generate the warning: Warning (Anachronism): Formal argument fn_ptr of type ..... in call to ... is being passed ....
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ddf387cd8868dceb8f9541c7856fdf0adf14124e
User & Date: jan.nijtmans 2013-10-30 15:29:27
Context
2013-10-30
15:39
Make itclStubsPtr and itclIntStubsPtr in the Itcl stub-library MODULE_SCOPE, so they will not be re-exported when linked into a DLL. check-in: 4c66a90e45 user: jan.nijtmans tags: trunk
15:29
Put extern "C" guard around stub table definition: In C++, calling convention on functions through function pointers might be influcenced by that. See for example: http://en.wikipedia.org/wiki/Compatibility_of_C_and_C++ On SUN's C++ compiler this might generate the warning: Warning (Anachronism): Formal argument fn_ptr of type ..... in call to ... is being passed .... check-in: ddf387cd88 user: jan.nijtmans tags: trunk
2013-10-09
12:06
CONST -> const, and some more changes directed at making Itcl work with "novem". Not finished yet. check-in: c4af6df735 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/itclDecls.h.

15
16
17
18
19
20
21




22
23
24
25
26
27
28


/* !BEGIN!: Do not edit below this line. */

#define ITCL_STUBS_EPOCH 0
#define ITCL_STUBS_REVISION 144





/*
 * Exported function declarations:
 */

/* Slot 0 is reserved */
/* Slot 1 is reserved */
/* 2 */







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


/* !BEGIN!: Do not edit below this line. */

#define ITCL_STUBS_EPOCH 0
#define ITCL_STUBS_REVISION 144

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Exported function declarations:
 */

/* Slot 0 is reserved */
/* Slot 1 is reserved */
/* 2 */
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
ITCLAPI Itcl_InterpState Itcl_SaveInterpState(Tcl_Interp *interp, int status);
/* 24 */
ITCLAPI int		Itcl_RestoreInterpState(Tcl_Interp *interp,
				Itcl_InterpState state);
/* 25 */
ITCLAPI void		Itcl_DiscardInterpState(Itcl_InterpState state);

typedef struct ItclStubHooks {
    const struct ItclIntStubs *itclIntStubs;
} ItclStubHooks;

typedef struct ItclStubs {
    int magic;
    int epoch;
    int revision;
    const struct ItclStubHooks *hooks;

    void (*reserved0)(void);
    void (*reserved1)(void);
    int (*itcl_RegisterC) (Tcl_Interp *interp, const char *name, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 2 */
    int (*itcl_RegisterObjC) (Tcl_Interp *interp, const char *name, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 3 */
    int (*itcl_FindC) (Tcl_Interp *interp, const char *name, Tcl_CmdProc **argProcPtr, Tcl_ObjCmdProc **objProcPtr, ClientData *cDataPtr); /* 4 */
    void (*itcl_InitStack) (Itcl_Stack *stack); /* 5 */







|







|







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
ITCLAPI Itcl_InterpState Itcl_SaveInterpState(Tcl_Interp *interp, int status);
/* 24 */
ITCLAPI int		Itcl_RestoreInterpState(Tcl_Interp *interp,
				Itcl_InterpState state);
/* 25 */
ITCLAPI void		Itcl_DiscardInterpState(Itcl_InterpState state);

typedef struct {
    const struct ItclIntStubs *itclIntStubs;
} ItclStubHooks;

typedef struct ItclStubs {
    int magic;
    int epoch;
    int revision;
    const ItclStubHooks *hooks;

    void (*reserved0)(void);
    void (*reserved1)(void);
    int (*itcl_RegisterC) (Tcl_Interp *interp, const char *name, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 2 */
    int (*itcl_RegisterObjC) (Tcl_Interp *interp, const char *name, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 3 */
    int (*itcl_FindC) (Tcl_Interp *interp, const char *name, Tcl_CmdProc **argProcPtr, Tcl_ObjCmdProc **objProcPtr, ClientData *cDataPtr); /* 4 */
    void (*itcl_InitStack) (Itcl_Stack *stack); /* 5 */
121
122
123
124
125
126
127
128
129
130
131

132
133
134
135
136
137
138
    void (*itcl_PreserveData) (ClientData cdata); /* 21 */
    void (*itcl_ReleaseData) (ClientData cdata); /* 22 */
    Itcl_InterpState (*itcl_SaveInterpState) (Tcl_Interp *interp, int status); /* 23 */
    int (*itcl_RestoreInterpState) (Tcl_Interp *interp, Itcl_InterpState state); /* 24 */
    void (*itcl_DiscardInterpState) (Itcl_InterpState state); /* 25 */
} ItclStubs;

#ifdef __cplusplus
extern "C" {
#endif
extern const ItclStubs *itclStubsPtr;

#ifdef __cplusplus
}
#endif

#if defined(USE_ITCL_STUBS)

/*







<
<
<

>







125
126
127
128
129
130
131



132
133
134
135
136
137
138
139
140
    void (*itcl_PreserveData) (ClientData cdata); /* 21 */
    void (*itcl_ReleaseData) (ClientData cdata); /* 22 */
    Itcl_InterpState (*itcl_SaveInterpState) (Tcl_Interp *interp, int status); /* 23 */
    int (*itcl_RestoreInterpState) (Tcl_Interp *interp, Itcl_InterpState state); /* 24 */
    void (*itcl_DiscardInterpState) (Itcl_InterpState state); /* 25 */
} ItclStubs;




extern const ItclStubs *itclStubsPtr;

#ifdef __cplusplus
}
#endif

#if defined(USE_ITCL_STUBS)

/*

Changes to generic/itclIntDecls.h.

1
2
3
4
5
6
7
8
9
10




11
12
13
14
15
16
17
/*
 * This file is (mostly) automatically generated from itcl.decls.
 */


/* !BEGIN!: Do not edit below this line. */

#define ITCLINT_STUBS_EPOCH 0
#define ITCLINT_STUBS_REVISION 144





/*
 * Exported function declarations:
 */

/* 0 */
ITCLAPI int		Itcl_IsClassNamespace(Tcl_Namespace *namesp);
/* 1 */










>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * This file is (mostly) automatically generated from itcl.decls.
 */


/* !BEGIN!: Do not edit below this line. */

#define ITCLINT_STUBS_EPOCH 0
#define ITCLINT_STUBS_REVISION 144

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Exported function declarations:
 */

/* 0 */
ITCLAPI int		Itcl_IsClassNamespace(Tcl_Namespace *namesp);
/* 1 */
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
				ItclClass *iclsPtr, Tcl_Obj *componentPtr,
				int type, ItclComponent **icPtrPtr);

typedef struct ItclIntStubs {
    int magic;
    int epoch;
    int revision;
    const struct ItclIntStubHooks *hooks;

    int (*itcl_IsClassNamespace) (Tcl_Namespace *namesp); /* 0 */
    int (*itcl_IsClass) (Tcl_Command cmd); /* 1 */
    ItclClass * (*itcl_FindClass) (Tcl_Interp *interp, const char *path, int autoload); /* 2 */
    int (*itcl_FindObject) (Tcl_Interp *interp, const char *name, ItclObject **roPtr); /* 3 */
    int (*itcl_IsObject) (Tcl_Command cmd); /* 4 */
    int (*itcl_ObjectIsa) (ItclObject *contextObj, ItclClass *cdefn); /* 5 */







|







514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
				ItclClass *iclsPtr, Tcl_Obj *componentPtr,
				int type, ItclComponent **icPtrPtr);

typedef struct ItclIntStubs {
    int magic;
    int epoch;
    int revision;
    void *hooks;

    int (*itcl_IsClassNamespace) (Tcl_Namespace *namesp); /* 0 */
    int (*itcl_IsClass) (Tcl_Command cmd); /* 1 */
    ItclClass * (*itcl_FindClass) (Tcl_Interp *interp, const char *path, int autoload); /* 2 */
    int (*itcl_FindObject) (Tcl_Interp *interp, const char *name, ItclObject **roPtr); /* 3 */
    int (*itcl_IsObject) (Tcl_Command cmd); /* 4 */
    int (*itcl_ObjectIsa) (ItclObject *contextObj, ItclClass *cdefn); /* 5 */
696
697
698
699
700
701
702
703
704
705
706

707
708
709
710
711
712
713
    Tcl_CallFrame * (*itcl_ActivateCallFrame) (Tcl_Interp *interp, Tcl_CallFrame *framePtr); /* 177 */
    const char* (*itclSetInstanceVar) (Tcl_Interp *interp, const char *name, const char *name2, const char *value, ItclObject *contextIoPtr, ItclClass *contextIclsPtr); /* 178 */
    Tcl_Obj * (*itclCapitalize) (const char *str); /* 179 */
    int (*itclClassBaseCmd) (ClientData clientData, Tcl_Interp *interp, int flags, int objc, Tcl_Obj *const objv[], ItclClass **iclsPtrPtr); /* 180 */
    int (*itclCreateComponent) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *componentPtr, int type, ItclComponent **icPtrPtr); /* 181 */
} ItclIntStubs;

#ifdef __cplusplus
extern "C" {
#endif
extern const ItclIntStubs *itclIntStubsPtr;

#ifdef __cplusplus
}
#endif

#if defined(USE_ITCL_STUBS)

/*







<
<
<

>







700
701
702
703
704
705
706



707
708
709
710
711
712
713
714
715
    Tcl_CallFrame * (*itcl_ActivateCallFrame) (Tcl_Interp *interp, Tcl_CallFrame *framePtr); /* 177 */
    const char* (*itclSetInstanceVar) (Tcl_Interp *interp, const char *name, const char *name2, const char *value, ItclObject *contextIoPtr, ItclClass *contextIclsPtr); /* 178 */
    Tcl_Obj * (*itclCapitalize) (const char *str); /* 179 */
    int (*itclClassBaseCmd) (ClientData clientData, Tcl_Interp *interp, int flags, int objc, Tcl_Obj *const objv[], ItclClass **iclsPtrPtr); /* 180 */
    int (*itclCreateComponent) (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *componentPtr, int type, ItclComponent **icPtrPtr); /* 181 */
} ItclIntStubs;




extern const ItclIntStubs *itclIntStubsPtr;

#ifdef __cplusplus
}
#endif

#if defined(USE_ITCL_STUBS)

/*

Changes to tools/genStubs.tcl.

824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
		} else {
		    eval {append temp} $skipString
		}
	    }
	    append text [addPlatformGuard $plat $temp {} true]
	}
	## macosx ##
	if {$block(macosx) && !$block(aqua) && !$block(x11)} {
	    set temp {}
	    set lastNum -1
	    foreach plat {unix macosx} {
		if {$block($plat)} {
		    set lastNum [expr {$lastNum > $stubs($name,$plat,lastNum)
			    ? $lastNum : $stubs($name,$plat,lastNum)}]
		}







|







824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
		} else {
		    eval {append temp} $skipString
		}
	    }
	    append text [addPlatformGuard $plat $temp {} true]
	}
	## macosx ##
	if {($block(unix) || $block(macosx)) && !$block(aqua) && !$block(x11)} {
	    set temp {}
	    set lastNum -1
	    foreach plat {unix macosx} {
		if {$block($plat)} {
		    set lastNum [expr {$lastNum > $stubs($name,$plat,lastNum)
			    ? $lastNum : $stubs($name,$plat,lastNum)}]
		}
979
980
981
982
983
984
985


986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002

1003



1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
    if {$epoch ne ""} {
	set CAPName [string toupper $name]
	append text "\n"
	append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
	append text "#define ${CAPName}_STUBS_REVISION $revision\n"
    }



    emitDeclarations $name text

    if {[info exists hooks($name)]} {
	append text "\ntypedef struct ${capName}StubHooks {\n"
	foreach hook $hooks($name) {
	    set capHook [string toupper [string index $hook 0]]
	    append capHook [string range $hook 1 end]
	    append text "    const struct ${capHook}Stubs *${hook}Stubs;\n"
	}
	append text "} ${capName}StubHooks;\n"
    }
    append text "\ntypedef struct ${capName}Stubs {\n"
    append text "    int magic;\n"
    if {$epoch ne ""} {
	append text "    int epoch;\n"
	append text "    int revision;\n"
    }

    append text "    const struct ${capName}StubHooks *hooks;\n\n"




    emitSlots $name text

    append text "} ${capName}Stubs;\n\n"

    append text "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
    append text "extern const ${capName}Stubs *${name}StubsPtr;\n"
    append text "#ifdef __cplusplus\n}\n#endif\n"

    emitMacros $name text

    rewriteFile [file join $outDir ${name}Decls.h] $text
    return
}







>
>



|













>
|
>
>
>





<
|







979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014

1015
1016
1017
1018
1019
1020
1021
1022
    if {$epoch ne ""} {
	set CAPName [string toupper $name]
	append text "\n"
	append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
	append text "#define ${CAPName}_STUBS_REVISION $revision\n"
    }

    append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"

    emitDeclarations $name text

    if {[info exists hooks($name)]} {
	append text "\ntypedef struct {\n"
	foreach hook $hooks($name) {
	    set capHook [string toupper [string index $hook 0]]
	    append capHook [string range $hook 1 end]
	    append text "    const struct ${capHook}Stubs *${hook}Stubs;\n"
	}
	append text "} ${capName}StubHooks;\n"
    }
    append text "\ntypedef struct ${capName}Stubs {\n"
    append text "    int magic;\n"
    if {$epoch ne ""} {
	append text "    int epoch;\n"
	append text "    int revision;\n"
    }
    if {[info exists hooks($name)]} {
	append text "    const ${capName}StubHooks *hooks;\n\n"
    } else {
	append text "    void *hooks;\n\n"
    }

    emitSlots $name text

    append text "} ${capName}Stubs;\n\n"


    append text "extern const ${capName}Stubs *${name}StubsPtr;\n\n"
    append text "#ifdef __cplusplus\n}\n#endif\n"

    emitMacros $name text

    rewriteFile [file join $outDir ${name}Decls.h] $text
    return
}