- Timestamp:
- Jul 8, 2002, 10:37:21 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- e1c4636
- Parents:
- 8df36cc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
history.c
r1aee7d9 r10b866d 5 5 void owl_history_init(owl_history *h) { 6 6 owl_list_create(&(h->hist)); 7 h->cur=0; 8 h->touched=0; 9 h->partial=0; 7 h->cur=0; /* current position in history */ 8 h->touched=0; /* whether we've gone into history */ 9 h->partial=0; /* is the 0th element is partially composed? */ 10 10 } 11 11 12 12 char *owl_history_get_prev(owl_history *h) { 13 14 if (!h) return NULL; 13 15 h->touched=1; 14 16 … … 20 22 21 23 h->cur++; 24 22 25 return(owl_list_get_element(&(h->hist), h->cur)); 23 26 } 24 27 25 28 char *owl_history_get_next(owl_history *h) { 29 if (!h) return NULL; 26 30 if (owl_list_get_size(&(h->hist))==0) return(NULL); 27 28 31 if (h->cur==0) { 29 32 return(NULL); … … 37 40 int size; 38 41 42 if (!h) return; 43 39 44 /* if partial is set, remove the first entry first */ 40 45 if (h->partial) { 41 46 owl_list_remove_element(&(h->hist), 0); 42 47 } 43 48 44 49 /* if we've reached the max history size, pop off the last element */ 45 50 size=owl_list_get_size(&(h->hist)); … … 54 59 55 60 void owl_history_set_partial(owl_history *h) { 61 if (!h) return; 56 62 h->partial=1; 57 63 } 58 64 59 65 void owl_history_reset(owl_history *h) { 66 if (!h) return; 60 67 h->cur=0; 61 68 h->touched=0; … … 64 71 65 72 int owl_history_is_touched(owl_history *h) { 73 if (!h) return(0); 66 74 if (h->touched) return(1); 67 75 return(0);
Note: See TracChangeset
for help on using the changeset viewer.