summary refs log tree commit diff stats
path: root/lib/system/gc.nim
Commit message (Expand)AuthorAgeFilesLines
...
* preparations for making 'closure' the default calling convention for proc typesAraq2012-07-161-1/+1
* thread var emulation should work againAraq2012-06-251-0/+2
* bite the bullet and make 'initStackBottom' a compilerprocAraq2012-06-241-0/+1
* added gcleak4.nim test; fails in debug modeAraq2012-06-241-2/+0
* tests/gc/gcleak4.nimAraq2012-06-241-0/+2
* documentation improvements; GC_step improvedAraq2012-04-211-8/+4
* GC with realtime supportAraq2012-04-211-24/+81
* implemented marker procs for the GC resulting in huge speedupsAraq2012-03-211-11/+18
* bootstraps fine with overloadable templatesZahary Karadjov2012-03-141-1/+1
* added 'system.shallow'Araq2012-02-091-2/+2
* pragma on/off improvements; endb rewrittenAraq2012-01-281-5/+12
* removed nimKeepAlive as it's not necessary with interior pointer checkingAraq2012-01-151-7/+0
* GC: growObj: revert to somewhat more efficient versionAraq2012-01-131-3/+3
* even more sys assertionsAraq2012-01-131-3/+22
* more sysasserts for allocator/gcAraq2012-01-121-4/+5
* GC: interior pointers on stack are not necessarily alignedAraq2012-01-101-8/+1
* year 2012 for most copyright headersAraq2012-01-021-1/+1
* GC stack scanning cares about interior pointersAraq2011-12-301-9/+9
* code gen can generate code to keep alive stack rootsAraq2011-12-221-0/+7
* GC: some inlining to improve performance sensitive partsAraq2011-12-131-1/+11
* C code gen: generate even better code for the GCAraq2011-12-121-3/+9
* c2nim compiles againAraq2011-12-121-1/+1
* compiler takes advantage of 'new(Obj|New)RC1Araq2011-12-121-0/+1
* compiler generates volatile temps to keep C compiler from optimizing away sta...Araq2011-12-121-3/+29
* bugfixes for .rod files and visual C++Araq2011-12-031-32/+32
* fixes #31Araq2011-11-271-0/+3
* C codegen: generate nimKeepAlive calls at strategic places to keep the C comp...Araq2011-11-241-6/+15
* attempt to fix tunidecode test; GC cares for seq->openArray conversionsAraq2011-11-211-0/+6
* DLL generation may work againAraq2011-11-021-3/+3
* better code generation for constant aggregatesAraq2011-11-021-3/+4
* got rid of tyPureObject; broke bootstrapping; use generated C codeAraq2011-09-241-1/+1
* bugfix: 'set' overloadable; further steps for multi threading supportAraq2011-07-081-89/+93
* improvements to get code size down for programs that don't use GCAraq2011-06-261-1/+0
* code gen bugfixes; marshal.nim implementedAraq2011-06-261-4/+4
* compiler can emulate thread local variablesAraq2011-06-151-1/+2
* bugfixes for semantic checking; thread implementation pushed the compilerAraq2011-06-041-24/+28
* first steps to thread local heapsAraq2011-06-021-14/+29
* further progress for multi-threadingAraq2011-05-191-17/+9
* still playing with threadsAraq2011-05-171-13/+14
* thread support: next iterationAraq2011-05-171-10/+11
* further steps for thread support; bootstrapping should require unzip C source...Araq2011-05-161-1/+1
* loop unrolled for stack markingAraq2011-05-131-0/+13
* gc tweaking to gain a few percent of performanceAraq2011-05-071-19/+52
* := templatable; lexer improvementsAraq2011-04-171-1/+5
* p[] instead of p^Araq2011-04-111-15/+15
* bugfix: GC more forgivingAraq2011-04-031-1/+4
* fixes #20Araq2011-03-121-2/+3
* basic thread support; still broken on Windows; untested on Mac OS XAraq2011-01-181-4/+6
* renamed lock->aquireAraq2010-11-181-16/+16
* version 0.8.10Araq2010-10-211-4/+5
l+g: switch file') if Show_log_browser_side then add_hotkey_to_menu('ctrl+l: hide log browser') else add_hotkey_to_menu('ctrl+l: show log browser') end add_hotkey_to_menu('ctrl+k: clear logs') if Editor_state.expanded then add_hotkey_to_menu('alt+b: collapse debug prints') else add_hotkey_to_menu('alt+b: expand debug prints') end add_hotkey_to_menu('alt+d: create/edit debug print') add_hotkey_to_menu('ctrl+f: find in file') add_hotkey_to_menu('alt+left alt+right: prev/next word') elseif Focus == 'log_browser' then -- nothing yet else assert(false, 'unknown focus "'..Focus..'"') end add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo') add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste') add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom') end function add_hotkey_to_menu(s) local width = App.width(s) if Menu_cursor > App.screen.width - 30 then return end App.color(Menu_command_color) App.screen.print(s, Menu_cursor,5) Menu_cursor = Menu_cursor + width + 30 end function source.draw_file_navigator() App.color(Menu_command_color) App.screen.print(File_navigation.filter, 5, 5) draw_cursor(5 + App.width(File_navigation.filter), 5) if File_navigation.num_lines == nil then File_navigation.num_lines = source.num_lines_for_file_navigator(File_navigation.candidates) end App.color(Menu_background_color) love.graphics.rectangle('fill', 0,Menu_status_bar_height, App.screen.width, File_navigation.num_lines * Editor_state.line_height + --[[highlight padding]] 2) local x,y = 5, Menu_status_bar_height for i,filename in ipairs(File_navigation.candidates) do x,y = add_file_to_menu(x,y, filename, i == File_navigation.index) if Menu_cursor >= App.screen.width - 5 then break end end end function draw_cursor(x, y) -- blink every 0.5s if math.floor(Cursor_time*2)%2 == 0 then App.color(Cursor_color) love.graphics.rectangle('fill', x,y, 3,Editor_state.line_height) end end function source.file_navigator_candidates() if File_navigation.filter == '' then return File_navigation.all_candidates end local result = {} for _,filename in ipairs(File_navigation.all_candidates) do if starts_with(filename, File_navigation.filter) then table.insert(result, filename) end end return result end function source.num_lines_for_file_navigator(candidates) local result = 1 local x = 5 for i,filename in ipairs(candidates) do local width = App.width(filename) if x + width > App.screen.width - 5 then result = result+1 x = 5 + width else x = x + width + 30 end end return result end function add_file_to_menu(x,y, s, cursor_highlight) local width = App.width(s) if x + width > App.screen.width - 5 then y = y + Editor_state.line_height x = 5 end local color = Menu_background_color if cursor_highlight then color = Menu_highlight_color end button(Editor_state, 'menu', {x=x-5, y=y-2, w=width+5*2, h=Editor_state.line_height+2*2, color=colortable(color), onpress1 = function() navigate_to_file(s) end }) App.color(Menu_command_color) App.screen.print(s, x,y) x = x + width + 30 return x,y end function navigate_to_file(s) move_candidate_to_front(s) local candidate = guess_source(s..'.lua') source.switch_to_file(candidate) reset_file_navigator() end function move_candidate_to_front(s) local index = array.find(File_navigation.all_candidates, s) assert(index) table.remove(File_navigation.all_candidates, index) table.insert(File_navigation.all_candidates, 1, s) end function reset_file_navigator() Show_file_navigator = false File_navigation.index = 1 File_navigation.filter = '' File_navigation.candidates = File_navigation.all_candidates end function keychord_press_on_file_navigator(chord, key) log(2, 'file navigator: '..chord) log(2, {name='file_navigator_state', files=File_navigation.candidates, index=File_navigation.index}) if chord == 'escape' then reset_file_navigator() elseif chord == 'return' then navigate_to_file(File_navigation.candidates[File_navigation.index]) elseif chord == 'backspace' then local len = utf8.len(File_navigation.filter) local byte_offset = Text.offset(File_navigation.filter, len) File_navigation.filter = string.sub(File_navigation.filter, 1, byte_offset-1) File_navigation.index = 1 File_navigation.candidates = source.file_navigator_candidates() elseif chord == 'left' then if File_navigation.index > 1 then File_navigation.index = File_navigation.index-1 end elseif chord == 'right' then if File_navigation.index < #File_navigation.candidates then File_navigation.index = File_navigation.index+1 end elseif chord == 'down' then file_navigator_down() elseif chord == 'up' then file_navigator_up() end end function log_render.file_navigator_state(o, x,y, w) -- duplicate structure of source.draw_file_navigator local num_lines = source.num_lines_for_file_navigator(o.files) local h = num_lines * Editor_state.line_height App.color(Menu_background_color) love.graphics.rectangle('fill', x,y, w,h) -- compute the x,y,width of the current index (in offsets from top left) local x2,y2 = 0,0 local width = 0 for i,filename in ipairs(o.files) do width = App.width(filename) if x2 + width > App.screen.width - 5 then y2 = y2 + Editor_state.line_height x2 = 0 end if i == o.index then break end x2 = x2 + width + 30 end -- figure out how much of the menu to display local menu_xmin = math.max(0, x2-w/2) local menu_xmax = math.min(App.screen.width, x2+w/2) -- now selectively print out entries local x3,y3 = 0,y -- x3 is relative, y3 is absolute local width = 0 for i,filename in ipairs(o.files) do width = App.width(filename) if x3 + width > App.screen.width - 5 then y3 = y3 + Editor_state.line_height x3 = 0 end if i == o.index then App.color(Menu_highlight_color) love.graphics.rectangle('fill', x + x3-menu_xmin - 5, y3-2, width+5*2, Editor_state.line_height+2*2) end if x3 >= menu_xmin and x3 + width < menu_xmax then App.color(Menu_command_color) App.screen.print(filename, x + x3-menu_xmin, y3) end x3 = x3 + width + 30 end -- return h+20 end function file_navigator_up() local y, x, width = file_coord(File_navigation.index) local index = file_index(y-Editor_state.line_height, x, width) if index then File_navigation.index = index end end function file_navigator_down() local y, x, width = file_coord(File_navigation.index) local index = file_index(y+Editor_state.line_height, x, width) if index then File_navigation.index = index end end function file_coord(index) local y,x = Menu_status_bar_height, 5 for i,filename in ipairs(File_navigation.candidates) do local width = App.width(filename) if x + width > App.screen.width - 5 then y = y + Editor_state.line_height x = 5 end if i == index then return y, x, width end x = x + width + 30 end end function file_index(fy, fx, fwidth) log_start('file index') log(2, ('for %d %d %d'):format(fy, fx, fwidth)) local y,x = Menu_status_bar_height, 5 local best_guess, best_guess_x, best_guess_width for i,filename in ipairs(File_navigation.candidates) do local width = App.width(filename) if x + width > App.screen.width - 5 then y = y + Editor_state.line_height x = 5 end if y == fy then log(2, ('%d: correct row; considering %d %s %d %d'):format(y, i, filename, x, width)) if best_guess == nil then log(2, 'nil') best_guess = i best_guess_x = x best_guess_width = width elseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) then best_guess = i best_guess_x = x best_guess_width = width end log(2, ('best guess now %d %s %d %d'):format(best_guess, File_navigation.candidates[best_guess], best_guess_x, best_guess_width)) end x = x + width + 30 end log_end('file index') return best_guess end function text_input_on_file_navigator(t) File_navigation.filter = File_navigation.filter..t File_navigation.candidates = source.file_navigator_candidates() end