File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ std::cout << "[a.c:4] a_variable: " << a_variable << std::endl;
5151
5252Lang | Debug String | Debug Variable
5353--- | --- | ---
54- C | :heavy_check_mark : | :x :
55- C++ | :heavy_check_mark : | :x :
54+ C | :heavy_check_mark : | :heavy_check_mark :
55+ C++ | :heavy_check_mark : | :heavy_check_mark :
5656CMake | :heavy_check_mark : | :heavy_check_mark :
5757Fortran | :heavy_check_mark : | :x :
5858Haskell | :heavy_check_mark : | :heavy_check_mark :
@@ -152,6 +152,6 @@ vim.org](https://vim.sourceforge.io/scripts/script.php?script_id=5634)
152152- [ ] Use travis for CI
153153- [x] Bug with changing the filename of the current file
154154- [x] Make vim-repeat dependency optional
155- - [ ] Turn supported languages into a table - what do we support in which
156- language?
155+ - [x ] Turn supported languages into a table - what do we support in which
156+ language
157157- [x] Make vim-repeat dependency optional
Original file line number Diff line number Diff line change @@ -2,11 +2,18 @@ if exists('g:debugstring_loaded_cpp_vim')
22 finish
33endif
44
5- let g: path = fnamemodify ( resolve ( expand ( ' <sfile>:p ' )), ' :h ' )
6- execute ' source ' . g: path . ' /common/c_like.vim '
5+ function ! s: DebugStringFunBase (desc, var )
6+ let l: debug_str = " printf( \" " . a: desc . " %d \\ n \" , " . a: var . " ); "
77
8- function ! s: DebugStringFun ()
9- return DebugStringFunC ()
8+ if g: debugstringAlwaysIncludeHeader
9+ let l: incStr = ' #include <stdio.h>; '
10+ let l: debug_str = l: incStr . l: debug_str
11+ endif
12+
13+ return l: debug_str
1014endfunc
1115
12- command ! - buffer -nargs =0 AddDebugString put = s: DebugStringFun ()
16+ command ! - buffer -nargs =0 AddDebugString
17+ \ put = s: DebugStringFunBase (g: DebugstringPrefixStr (), g: debugStringCounter )
18+ command ! - buffer -nargs =1 AddDebugStringExpr
19+ \ put = s: DebugStringFunBase (<args> . ' : ' , <args> )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11let g: debugstring_loaded_cpp_vim = 1
22
3- let g: path = fnamemodify (resolve (expand (' <sfile>:p' )), ' :h' )
4- execute ' source ' . g: path . ' /common/c_like.vim'
5-
6- function ! s: DebugStringFun ()
7- return DebugStringFunC ()
8- endfunc
9-
10- function ! s: DebugStringFunExpr (expr )
11- let l: debug_str = ' std::cout << "' . g: DebugstringPrefixStr ()
12- \ . a: expr . ' "' . ' << '
13- \ . a: expr
3+ function ! s: DebugStringFunBase (desc, var )
4+ let l: debug_str = ' std::cout << "' . a: desc
5+ \ . ' " << '
6+ \ . a: var
147 \ . ' << '
158 \ . ' std::endl;'
169
@@ -22,6 +15,7 @@ function! s:DebugStringFunExpr(expr)
2215 return l: debug_str
2316endfunc
2417
25- command ! - buffer -nargs =0 AddDebugString :put = s: DebugStringFun ()
26- command ! - buffer -nargs =1 AddDebugStringExpr :put = s: DebugStringFunExpr (<args> )
27-
18+ command ! - buffer -nargs =0 AddDebugString
19+ \ put = s: DebugStringFunBase (g: DebugstringPrefixStr (), g: debugStringCounter )
20+ command ! - buffer -nargs =1 AddDebugStringExpr
21+ \ put = s: DebugStringFunBase (<args> . ' : ' , <args> )
Original file line number Diff line number Diff line change 44
55
66
7+ " TODO: Rewrite these instructions
78" "
89" @section Introduction, intro
910"
@@ -80,7 +81,8 @@ let s:modes = {
8081let g: debugStringCounter = 0
8182let g: debugStringCounterStep = 1
8283
83- " By default debugging lines should be of the form <directive_to_print> " <prefix_string><debug_number>
84+ " By default debugging lines should be of the form
85+ " <directive_to_print> <prefix_string><debug_number>
8486function ! g: DebugstringPrefixStr ()
8587 let l: debug_str = ' [' . fnamemodify (bufname (' %' ), ' :t' ) . ' :'
8688 if getline (' .' ) = ~# ' ^$' " Empty line
You can’t perform that action at this time.
0 commit comments