env.build_dir('modules','build/obj/modules')
env['LIBS'] = ['ncurses']
env['CPPPATH'] += Dir['modules/data-structures/source/**/']
- env['CFLAGS'] += ['-Wall']
- env['CFLAGS'] += ['-Werror', '-pedantic', '--std=c99']
+ env['CFLAGS'] += ['-Wall', '-Werror', '-pedantic', '--std=c99']
# Platform-specific Defines
# -------------------------
desc "Remove all generated artifacts and directories as well as any git submodules"
task :clobber => [:clean] do
- sh 'git submodule deinit -f .'
+ sh 'git submodule deinit -f .'
+end
+
+task :valgrind => [:build] do
+ sh "valgrind --leak-check=full ./build/afm 2> ./build/valgrind.txt"
+end
+
+task :splint do
+ include_dirs = Dir['source/**/','modules/**/source/**/'].map{|e| "-I#{e}" }
+ sources = Dir['source/**/*.c', 'modules/data-structures/source/**/*.c']
+ cmd = ['splint', '+posixlib'] + include_dirs + sources
+ sh *cmd
end
static void handle_scroll_to_top(void) {
workdir_scroll_to_top(state_get_focused_frame()->workdir);
}
+
static void handle_scroll_to_bottom(void) {
workdir_scroll_to_bot(state_get_focused_frame()->workdir);
}
+
static void handle_page_up(void){
screen_frame_page_up(state_get_focused_frame());
}
+
static void handle_page_down(void){
screen_frame_page_down(state_get_focused_frame());
}
+
static void handle_expand(void){
workdir_expand_selected(state_get_focused_frame()->workdir);
}
+
static void handle_collapse(void){
workdir_collapse_selected(state_get_focused_frame()->workdir);
}
-
static void search_mode(void){
int searchcap = 8;
char* searchstr = malloc(sizeof(char)*searchcap);
}
/* If we got a valid key then process it */
- if(ERR != ch) {
+ if((char)ERR != ch) {
+ int i;
/* Put the key in the buffer */
len++;
Key_Buffer[len-1] = ch;
Key_Buffer[len] = '\0';
/* Loop over the bindings */
- for(int i = 0; i < num_entries; i++) {
+ for(i = 0; i < num_entries; i++) {
binding_t binding = Default_Bindings[i];
char* seq = binding.sequence;
{
more_matches = true;
}
+
/* If the current string matches exactly then execute it's handler */
if (0 == strcmp(Key_Buffer, seq))
{
#include "aardvark.h"
#include "workdir.h"
-//number of lines to leave before/after dir contents in frame
-static int FrameTopBuffer = 2;
-static int FrameBotBuffer = 2;
-
static void screen_place_windows(void);
+static void screen_refresh_curr_frame(void);
static frame_t* screen_frame_new(void);
static void screen_frame_free(void* p_frame);
void screen_frame_draw_files(frame_t* frame);
static list_t* Screen_List;
+static int FrameTopBuffer = 2;
+static int FrameBotBuffer = 2;
static frame_t* master_frame(void){
return (frame_t*) Screen_List->head->contents;
/* Clear screen and update LINES and COLS */
if(state_get_screen_resized()){
endwin();
+ screen_place_windows();
state_set_screen_resized(false);
+ } else {
+ screen_refresh_curr_frame();
}
- clear();
- refresh();
- screen_place_windows();
if(state_get_aardvark_mode()) aardvark_draw();
/* Refresh and mark complete */
state_set_screen_dirty(false);
void screen_open(void) {
list_push_back(Screen_List, screen_frame_new());
state_set_screen_dirty(true);
+ state_set_screen_resized(true);
}
void screen_close(void) {
state_set_focused_frame(master_frame());
}
state_set_screen_dirty(true);
+ state_set_screen_resized(true);
}
static void screen_place_windows(void) {
}
}
+
+static void screen_refresh_curr_frame(void) {
+ /* Print the master frame */
+ frame_t* p_frame = list_at(Screen_List,0)->contents;
+ wclear(p_frame->p_win);
+ screen_frame_draw_files(p_frame);
+ box(p_frame->p_win, 0 , 0);
+ wrefresh(p_frame->p_win);
+}
+
//get the curent directory and copy it into a ref-counted memory block
//return a pointer to the new block
char* pwd(){
(void) cols;
return rows - FrameTopBuffer - FrameBotBuffer;
}
+
void screen_frame_page_up(frame_t* p_frame){
workdir_set_idx(p_frame->workdir, p_frame->workdir->idx - realrows(p_frame));
}