Changeset 53f421b
- Timestamp:
- Jun 22, 2003, 1:45:23 PM (22 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:
- e4eebe8
- Parents:
- e187445
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
context.c
recd5dc5 r53f421b 7 7 #define SET_MODE(ctx, new) ctx->mode = ((ctx->mode)&~OWL_CTX_MODE_BITS)|new 8 8 9 int owl_context_init(owl_context *ctx) { 9 int owl_context_init(owl_context *ctx) 10 { 10 11 ctx->mode = OWL_CTX_STARTUP; 11 12 ctx->data = NULL; … … 15 16 16 17 /* returns whether test matches the current context */ 17 int owl_context_matches(owl_context *ctx, int test) { 18 int owl_context_matches(owl_context *ctx, int test) 19 { 18 20 /*owl_function_debugmsg(", current: 0x%04x test: 0x%04x\n", ctx->mode, test);*/ 19 21 if ((((ctx->mode&OWL_CTX_MODE_BITS) & test) … … 28 30 } 29 31 30 void *owl_context_get_data(owl_context *ctx) { 32 void *owl_context_get_data(owl_context *ctx) 33 { 31 34 return ctx->data; 32 35 } 33 36 34 int owl_context_get_mode(owl_context *ctx) { 37 int owl_context_get_mode(owl_context *ctx) 38 { 35 39 return ctx->mode & OWL_CTX_MODE_BITS; 36 40 } 37 41 38 int owl_context_get_active(owl_context *ctx) { 42 int owl_context_get_active(owl_context *ctx) 43 { 39 44 return ctx->mode & OWL_CTX_ACTIVE_BITS; 40 45 } 41 46 42 int owl_context_is_startup(owl_context *ctx) { 47 int owl_context_is_startup(owl_context *ctx) 48 { 43 49 return (ctx->mode & OWL_CTX_STARTUP)?1:0; 44 50 } 45 51 46 int owl_context_is_interactive(owl_context *ctx) { 52 int owl_context_is_interactive(owl_context *ctx) 53 { 47 54 return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0; 48 55 } 49 56 50 void owl_context_set_startup(owl_context *ctx) { 57 void owl_context_set_startup(owl_context *ctx) 58 { 51 59 SET_MODE(ctx, OWL_CTX_STARTUP); 52 60 } 53 61 54 void owl_context_set_readconfig(owl_context *ctx) { 62 void owl_context_set_readconfig(owl_context *ctx) 63 { 55 64 SET_MODE(ctx, OWL_CTX_READCONFIG); 56 65 } 57 66 58 void owl_context_set_interactive(owl_context *ctx) { 67 void owl_context_set_interactive(owl_context *ctx) 68 { 59 69 SET_MODE(ctx, OWL_CTX_INTERACTIVE); 60 70 } 61 71 62 void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw) { 72 void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw) 73 { 63 74 ctx->data = (void*)vw; 64 75 SET_ACTIVE(ctx, OWL_CTX_POPLESS); 65 76 } 66 77 67 void owl_context_set_recv(owl_context *ctx) { 78 void owl_context_set_recv(owl_context *ctx) 79 { 68 80 SET_ACTIVE(ctx, OWL_CTX_RECV); 69 81 } 70 82 71 void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew) { 83 void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew) 84 { 72 85 ctx->data = (void*)ew; 73 86 SET_ACTIVE(ctx, OWL_CTX_EDITMULTI); 74 87 } 75 88 76 void owl_context_set_editline(owl_context *ctx, owl_editwin *ew) { 89 void owl_context_set_editline(owl_context *ctx, owl_editwin *ew) 90 { 77 91 ctx->data = (void*)ew; 78 92 SET_ACTIVE(ctx, OWL_CTX_EDITLINE); -
list.c
rd09e5a1 r53f421b 8 8 #define GROWBY 1.5 9 9 10 int owl_list_create(owl_list *l) { 10 int owl_list_create(owl_list *l) 11 { 11 12 l->size=0; 12 13 l->list=(void **)owl_malloc(INITSIZE*sizeof(void *)); … … 16 17 } 17 18 18 int owl_list_get_size(owl_list *l) { 19 int owl_list_get_size(owl_list *l) 20 { 19 21 return(l->size); 20 22 } 21 23 22 void *owl_list_get_element(owl_list *l, int n) { 24 void *owl_list_get_element(owl_list *l, int n) 25 { 23 26 if (n>l->size-1) return(NULL); 24 27 return(l->list[n]); 25 28 } 26 29 27 int owl_list_append_element(owl_list *l, void *element) { 30 int owl_list_append_element(owl_list *l, void *element) 31 { 28 32 void *ptr; 29 33 … … 40 44 } 41 45 42 int owl_list_prepend_element(owl_list *l, void *element) { 46 int owl_list_prepend_element(owl_list *l, void *element) 47 { 43 48 void *ptr; 44 49 int i; … … 59 64 } 60 65 61 int owl_list_remove_element(owl_list *l, int n) { 66 int owl_list_remove_element(owl_list *l, int n) 67 { 62 68 int i; 63 69 … … 71 77 72 78 /* todo: might leak memory */ 73 int owl_list_replace_element(owl_list *l, int n, void *element) { 79 int owl_list_replace_element(owl_list *l, int n, void *element) 80 { 74 81 if (n>l->size-1) return(-1); 75 82 … … 78 85 } 79 86 80 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) { 87 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) 88 { 81 89 int i; 82 90 … … 87 95 } 88 96 89 void owl_list_free_simple(owl_list *l) { 97 void owl_list_free_simple(owl_list *l) 98 { 90 99 if (l->list) owl_free(l->list); 91 100 }
Note: See TracChangeset
for help on using the changeset viewer.