Skip to content

Commit 67aa952

Browse files
authored
remove html code in c++ code, enable syntax highlighting
1 parent 42122de commit 67aa952

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

doc/freefun.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You have already seen an example of how to expose a free C++ function to the Tcl
66

77
No matter whether you write an extension module or embed Tcl in a C++ application, the way to expose a free function is alway the same:
88

9-
```
9+
```cpp
1010
i.def("tcl_function_name", cpp_function_name);
1111
```
1212

@@ -16,13 +16,13 @@ In the above example, the "tcl_function_name" is a name that will be visible to
1616

1717
They do not have to be the same, although this is the usual practice, like in the [Quick Start](quickstart.md) examples:
1818

19-
```
19+
```cpp
2020
i.def("hello", hello);
2121
```
2222

2323
Suppose that we want to expose the following C++ function:
2424

25-
```
25+
```cpp
2626
int sum(int a, int b)
2727
{
2828
     return a + b;
@@ -31,20 +31,20 @@ int sum(int a, int b)
3131
3232
We can define it in the interpreter like this:
3333
34-
```
35-
i.def("<span style="font-weight: bold;">add</span>", sum);
36-
i.def("<span style="font-weight: bold;">+</span>", sum);
34+
```cpp
35+
i.def("add", sum);
36+
i.def("+", sum);
3737
```
3838

3939
so that we can call the sum function from Tcl like this:
4040

41-
```
41+
```tcl
4242
add 3 4
4343
```
4444

4545
or:
4646

47-
```
47+
```tcl
4848
+ 3 4
4949
```
5050

0 commit comments

Comments
 (0)