]> git.mdlowis.com Git - archive/afm.git/commitdiff
tweaked rake scripts
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 27 Jul 2014 22:47:08 +0000 (18:47 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 27 Jul 2014 22:47:08 +0000 (18:47 -0400)
Rakefile
source/input.c
source/screen.c

index 7f93db2179753e83fcaa6112bf1176dcfed91fd8..36869d0c00ca208473d91b56629ff39cac744bf5 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -24,8 +24,7 @@ Env = Rscons::Environment.new do |env|
   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
   # -------------------------
@@ -60,5 +59,16 @@ task(:clean) { Rscons.clean }
 
 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
index 4333454d04f5919416f42c37bdd4ddf22b710c86..6916a2b8bbe48763a75681d9ffb2c27055fbac6b 100644 (file)
@@ -38,23 +38,27 @@ static void handle_cd(void) {
 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);
@@ -121,14 +125,15 @@ void input_handle_key(char ch) {
     }
 
     /* 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;
 
@@ -138,6 +143,7 @@ void input_handle_key(char ch) {
             {
                 more_matches = true;
             }
+
             /* If the current string matches exactly then execute it's handler */
             if (0 == strcmp(Key_Buffer, seq))
             {
index ccabe5cd3ea08a85a2335d8cb29f5b2a5a70baec..96a148436e1e068ad8f36ca3d22b1930dbb48d4b 100644 (file)
 #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;
@@ -44,11 +43,11 @@ void screen_update(void) {
     /* 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);
@@ -57,6 +56,7 @@ void screen_update(void) {
 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) {
@@ -66,6 +66,7 @@ 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) {
@@ -108,6 +109,16 @@ 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(){
@@ -194,6 +205,7 @@ int realrows(frame_t* p_frame){
     (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));
 }