summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-11-04 21:29:33 +0000
committerPaul Buetow <paul@buetow.org>2008-11-04 21:29:33 +0000
commit37c687c229f89202e5625bc3d3f9b1c85cb94b51 (patch)
treed479b5a573854192f6a8703fe5f1c4bde6dae5fc
parentff0828f06a1f317681c45402feda48bde592a076 (diff)
array_delete_iterate implemented..
-rw-r--r--Session.vim193
-rw-r--r--docs/help.txt2
-rw-r--r--docs/stats.txt2
-rw-r--r--docs/version.txt2
-rwxr-xr-xfypebin449199 -> 449532 bytes
-rw-r--r--src/build.h2
-rw-r--r--src/core/token.c9
-rw-r--r--src/data/array.c17
-rw-r--r--src/data/array.h1
-rw-r--r--tags1
10 files changed, 70 insertions, 159 deletions
diff --git a/Session.vim b/Session.vim
index 1358ee6..0800758 100644
--- a/Session.vim
+++ b/Session.vim
@@ -39,9 +39,9 @@ set showmatch
set smartcase
set tabstop=4
set tags=./tags,./TAGS,tags,TAGS,./tags,./../tags,./../../tags,./*/tags
+set textwidth=80
set title
set visualbell
-set window=46
let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
let v:this_session=expand("<sfile>:p")
silent only
@@ -50,136 +50,35 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
let s:wipebuf = bufnr('%')
endif
set shortmess=aoO
-badd +51 src/core/interpret.h
-badd +26 tmp/test.fy
+badd +72 src/core/interpret.h
+badd +7 tmp/test.fy
badd +81 src/defines.h
-badd +0 TODO
+badd +4 TODO
+badd +1005 ./src/core/interpret.c
+badd +73 Makefile
+badd +67 src/core/symbol.h
+badd +115 ./src/core/symbol.c
+badd +25 src/core/function.c
+badd +173 src/core/token.h
+badd +322 ./src/core/token.c
+badd +50 src/core/convert.c
+badd +65 ./src/data/array.c
+badd +1 src/core/array.h
+badd +63 src/data/array.h
args src/core/interpret.h
-edit TODO
+edit tmp/test.fy
set splitbelow splitright
wincmd _ | wincmd |
vsplit
1wincmd h
-wincmd _ | wincmd |
-split
-1wincmd k
-wincmd w
wincmd w
set nosplitbelow
set nosplitright
wincmd t
set winheight=1 winwidth=1
-exe '1resize ' . ((&lines * 22 + 23) / 47)
exe 'vert 1resize ' . ((&columns * 71 + 71) / 143)
-exe '2resize ' . ((&lines * 21 + 23) / 47)
exe 'vert 2resize ' . ((&columns * 71 + 71) / 143)
-exe 'vert 3resize ' . ((&columns * 71 + 71) / 143)
-argglobal
-setlocal keymap=
-setlocal noarabic
-setlocal autoindent
-setlocal balloonexpr=
-setlocal nobinary
-setlocal bufhidden=
-setlocal buflisted
-setlocal buftype=
-setlocal cindent
-setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
-setlocal cinoptions=
-setlocal cinwords=if,else,while,do,for,switch
-setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
-setlocal commentstring=/*%s*/
-setlocal complete=.,w,b,u,t,i
-setlocal completefunc=
-setlocal nocopyindent
-setlocal nocursorcolumn
-set cursorline
-setlocal cursorline
-setlocal define=
-setlocal dictionary=
-setlocal nodiff
-setlocal equalprg=
-setlocal errorformat=
-setlocal noexpandtab
-if &filetype != ''
-setlocal filetype=
-endif
-setlocal foldcolumn=0
-setlocal foldenable
-setlocal foldexpr=0
-setlocal foldignore=#
-setlocal foldlevel=0
-setlocal foldmarker={{{,}}}
-set foldmethod=indent
-setlocal foldmethod=indent
-setlocal foldminlines=1
-setlocal foldnestmax=20
-setlocal foldtext=foldtext()
-setlocal formatexpr=
-setlocal formatoptions=tcq
-setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
-setlocal grepprg=
-setlocal iminsert=2
-setlocal imsearch=2
-setlocal include=
-setlocal includeexpr=
-setlocal indentexpr=
-setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
-setlocal noinfercase
-setlocal iskeyword=@,48-57,_,192-255
-setlocal keywordprg=
-setlocal nolinebreak
-setlocal nolisp
-setlocal nolist
-setlocal makeprg=
-setlocal matchpairs=(:),{:},[:]
-setlocal modeline
-setlocal modifiable
-setlocal nrformats=octal,hex
-setlocal nonumber
-set numberwidth=1
-setlocal numberwidth=1
-setlocal omnifunc=
-setlocal path=
-setlocal nopreserveindent
-setlocal nopreviewwindow
-setlocal quoteescape=\\
-setlocal noreadonly
-setlocal norightleft
-setlocal rightleftcmd=search
-setlocal noscrollbind
-setlocal shiftwidth=3
-setlocal noshortname
-setlocal nosmartindent
-setlocal softtabstop=0
-setlocal nospell
-setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
-setlocal spellfile=
-setlocal spelllang=en
-setlocal statusline=
-setlocal suffixesadd=
-setlocal swapfile
-setlocal synmaxcol=3000
-if &syntax != ''
-setlocal syntax=
-endif
-setlocal tabstop=4
-setlocal tags=
-setlocal textwidth=0
-setlocal thesaurus=
-setlocal nowinfixheight
-setlocal nowinfixwidth
-setlocal wrap
-setlocal wrapmargin=0
-let s:l = 2 - ((1 * winheight(0) + 11) / 22)
-if s:l < 1 | let s:l = 1 | endif
-exe s:l
-normal! zt
-2
-normal! 0
-wincmd w
argglobal
-edit tmp/test.fy
setlocal keymap=
setlocal noarabic
setlocal autoindent
@@ -276,15 +175,15 @@ setlocal nowinfixheight
setlocal nowinfixwidth
setlocal wrap
setlocal wrapmargin=0
-let s:l = 26 - ((12 * winheight(0) + 10) / 21)
+let s:l = 4 - ((3 * winheight(0) + 22) / 44)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
-26
+4
normal! 0
wincmd w
argglobal
-edit src/core/interpret.h
+edit ./src/core/interpret.c
setlocal keymap=
setlocal noarabic
setlocal autoindent
@@ -311,8 +210,8 @@ setlocal nodiff
setlocal equalprg=
setlocal errorformat=
setlocal noexpandtab
-if &filetype != 'cpp'
-setlocal filetype=cpp
+if &filetype != 'c'
+setlocal filetype=c
endif
setlocal foldcolumn=0
setlocal nofoldenable
@@ -370,46 +269,41 @@ setlocal statusline=
setlocal suffixesadd=
setlocal swapfile
setlocal synmaxcol=3000
-if &syntax != 'cpp'
-setlocal syntax=cpp
+if &syntax != 'c'
+setlocal syntax=c
endif
setlocal tabstop=4
setlocal tags=
-setlocal textwidth=0
+setlocal textwidth=80
setlocal thesaurus=
setlocal nowinfixheight
setlocal nowinfixwidth
setlocal wrap
setlocal wrapmargin=0
-let s:l = 69 - ((36 * winheight(0) + 22) / 44)
+let s:l = 947 - ((9 * winheight(0) + 22) / 44)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
-69
-normal! 012l
+947
+normal! 0
wincmd w
-3wincmd w
-exe '1resize ' . ((&lines * 22 + 23) / 47)
exe 'vert 1resize ' . ((&columns * 71 + 71) / 143)
-exe '2resize ' . ((&lines * 21 + 23) / 47)
exe 'vert 2resize ' . ((&columns * 71 + 71) / 143)
-exe 'vert 3resize ' . ((&columns * 71 + 71) / 143)
-tabnew
+tabedit ./src/data/array.c
set splitbelow splitright
set nosplitbelow
set nosplitright
wincmd t
set winheight=1 winwidth=1
argglobal
-edit /usr/local/share/vim/vim71/doc/windows.txt
setlocal keymap=
setlocal noarabic
setlocal autoindent
setlocal balloonexpr=
setlocal nobinary
setlocal bufhidden=
-setlocal nobuflisted
-setlocal buftype=help
+setlocal buflisted
+setlocal buftype=
setlocal cindent
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
setlocal cinoptions=
@@ -428,8 +322,8 @@ setlocal nodiff
setlocal equalprg=
setlocal errorformat=
setlocal noexpandtab
-if &filetype != 'help'
-setlocal filetype=help
+if &filetype != 'c'
+setlocal filetype=c
endif
setlocal foldcolumn=0
setlocal nofoldenable
@@ -453,7 +347,7 @@ setlocal includeexpr=
setlocal indentexpr=
setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
setlocal noinfercase
-setlocal iskeyword=!-~,^*,^|,^\",192-255
+setlocal iskeyword=@,48-57,_,192-255
setlocal keywordprg=
setlocal nolinebreak
setlocal nolisp
@@ -461,7 +355,7 @@ setlocal nolist
setlocal makeprg=
setlocal matchpairs=(:),{:},[:]
setlocal modeline
-setlocal nomodifiable
+setlocal modifiable
setlocal nrformats=octal,hex
setlocal nonumber
set numberwidth=1
@@ -471,7 +365,7 @@ setlocal path=
setlocal nopreserveindent
setlocal nopreviewwindow
setlocal quoteescape=\\
-setlocal readonly
+setlocal noreadonly
setlocal norightleft
setlocal rightleftcmd=search
setlocal noscrollbind
@@ -487,25 +381,24 @@ setlocal statusline=
setlocal suffixesadd=
setlocal swapfile
setlocal synmaxcol=3000
-if &syntax != 'help'
-setlocal syntax=help
+if &syntax != 'c'
+setlocal syntax=c
endif
-setlocal tabstop=8
+setlocal tabstop=4
setlocal tags=
-setlocal textwidth=78
+setlocal textwidth=80
setlocal thesaurus=
setlocal nowinfixheight
setlocal nowinfixwidth
setlocal wrap
setlocal wrapmargin=0
-let s:l = 38 - ((6 * winheight(0) + 22) / 45)
+let s:l = 89 - ((44 * winheight(0) + 22) / 45)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
-38
-normal! 064l
-3wincmd w
-tabnext 1
+89
+normal! 02l
+tabnext 2
if exists('s:wipebuf')
silent exe 'bwipe ' . s:wipebuf
endif
diff --git a/docs/help.txt b/docs/help.txt
index 54bb8cb..21d596e 100644
--- a/docs/help.txt
+++ b/docs/help.txt
@@ -1,4 +1,4 @@
-Fype v0.1-devel Build 9328
+Fype v0.1-devel Build 9338
(c) Paul C. Buetow (2005 - 2008) <fype@dev.buetow.org>
-e Executes given code string (see synopses)
-h Prints this help
diff --git a/docs/stats.txt b/docs/stats.txt
index ba901aa..f6e3e1f 100644
--- a/docs/stats.txt
+++ b/docs/stats.txt
@@ -1,4 +1,4 @@
===> Num of C source files : 44
-===> Num of C source lines : 7874
+===> Num of C source lines : 7891
===> Num of Fype source examples : 14
===> Num of Fype source lines : 362
diff --git a/docs/version.txt b/docs/version.txt
index 8457f26..520eab4 100644
--- a/docs/version.txt
+++ b/docs/version.txt
@@ -1 +1 @@
-Fype v0.1-devel Build 9328
+Fype v0.1-devel Build 9338
diff --git a/fype b/fype
index 0039bf7..b98fbff 100755
--- a/fype
+++ b/fype
Binary files differ
diff --git a/src/build.h b/src/build.h
index 9b4930d..204d15b 100644
--- a/src/build.h
+++ b/src/build.h
@@ -35,7 +35,7 @@
#ifndef BUILD_H
#define BUILD_H
-#define BUILDNR 9335
+#define BUILDNR 9340
#define OS_FREEBSD
#endif
diff --git a/src/core/token.c b/src/core/token.c
index ee2a0b8..16d0eab 100644
--- a/src/core/token.c
+++ b/src/core/token.c
@@ -319,7 +319,8 @@ void token_copy_vals(Token *p_token_to, Token *p_token_from) {
p_token_to->c_filename = p_token_from->c_filename;
if (NULL != p_token_from->p_array)
- p_token_to->p_array = array_new_copy(p_token_from);
+ // Copy all tokens by reference (pointers)
+ p_token_to->p_array = array_new_copy(p_token_from->p_array);
}
void
@@ -349,10 +350,8 @@ token_delete(Token *p_token) {
if (p_token->c_val)
free(p_token->c_val);
- if (NULL != p_token->p_array) {
- array_iterate(p_token->p_array, token_delete_cb);
- array_delete(p_token->p_array);
- }
+ if (NULL != p_token->p_array)
+ array_delete_iterate(p_token->p_array, token_delete_cb);
free(p_token);
}
diff --git a/src/data/array.c b/src/data/array.c
index 6a2b1fa..553d6f5 100644
--- a/src/data/array.c
+++ b/src/data/array.c
@@ -84,6 +84,23 @@ array_delete(Array *p_array) {
}
void
+array_delete_iterate(Array *p_array, void (*func)(void *)) {
+ if (!p_array)
+ return;
+
+ array_iterate(p_array, func);
+
+ if (p_array->i_size)
+ for (int i = p_array->i_size - 1; i >= 0; --i)
+ arrayelement_delete(p_array->pp_ae[i]);
+
+ if (p_array->pp_ae)
+ free(p_array->pp_ae);
+
+ free(p_array);
+}
+
+void
array_set(Array *p_array, int i_index, void *p_val) {
if (p_array->i_size > i_index) {
p_array->pp_ae[i_index]->p_val = p_val;
diff --git a/src/data/array.h b/src/data/array.h
index 75f6365..14e3851 100644
--- a/src/data/array.h
+++ b/src/data/array.h
@@ -64,6 +64,7 @@ Array *array_new();
Array *array_new_size(int i_size);
Array *array_new_copy(Array *p_array);
void array_delete(Array *p_array);
+void array_delete_iterate(Array *p_array, void (*func)(void*));
void array_set(Array *p_array, int i_index, void *p_val);
void array_insert(Array *p_array, int i_index, void *p_val);
void *array_remove(Array *p_array, int i_index);
diff --git a/tags b/tags
index 86ed559..6915cc7 100644
--- a/tags
+++ b/tags
@@ -50,6 +50,7 @@ argv_synopsis ./src/argv.c /^argv_synopsis(Tupel *p_tupel_argv) {$/
argv_tupel_delete ./src/argv.c /^argv_tupel_delete(Tupel *p_tupel_argv) {$/
array_defined ./src/data/array.c /^array_defined(Array *p_array, int i_index) {$/
array_delete ./src/data/array.c /^array_delete(Array *p_array) {$/
+array_delete_iterate ./src/data/array.c /^array_delete_iterate(Array *p_array, void (*func)(/
array_get ./src/data/array.c /^array_get(Array *p_array, int i_index) {$/
array_insert ./src/data/array.c /^array_insert(Array *p_array, int i_index, void *p_/
array_iterate ./src/data/array.c /^array_iterate(Array *p_array, void (*func)(void *)/