Changeset 53f421b


Ignore:
Timestamp:
Jun 22, 2003, 1:45:23 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
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
Message:
Reformatted context and list to new code style
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • context.c

    recd5dc5 r53f421b  
    77#define SET_MODE(ctx, new) ctx->mode = ((ctx->mode)&~OWL_CTX_MODE_BITS)|new
    88
    9 int owl_context_init(owl_context *ctx) {
     9int owl_context_init(owl_context *ctx)
     10{
    1011  ctx->mode = OWL_CTX_STARTUP;
    1112  ctx->data = NULL;
     
    1516
    1617/* returns whether test matches the current context */
    17 int owl_context_matches(owl_context *ctx, int test) {
     18int owl_context_matches(owl_context *ctx, int test)
     19{
    1820  /*owl_function_debugmsg(", current: 0x%04x test: 0x%04x\n", ctx->mode, test);*/
    1921  if ((((ctx->mode&OWL_CTX_MODE_BITS) & test)
     
    2830}
    2931
    30 void *owl_context_get_data(owl_context *ctx) {
     32void *owl_context_get_data(owl_context *ctx)
     33{
    3134  return ctx->data;
    3235}
    3336
    34 int owl_context_get_mode(owl_context *ctx) {
     37int owl_context_get_mode(owl_context *ctx)
     38{
    3539  return ctx->mode & OWL_CTX_MODE_BITS;
    3640}
    3741
    38 int owl_context_get_active(owl_context *ctx) {
     42int owl_context_get_active(owl_context *ctx)
     43{
    3944  return ctx->mode & OWL_CTX_ACTIVE_BITS;
    4045}
    4146
    42 int owl_context_is_startup(owl_context *ctx) {
     47int owl_context_is_startup(owl_context *ctx)
     48{
    4349  return (ctx->mode & OWL_CTX_STARTUP)?1:0;
    4450}
    4551
    46 int owl_context_is_interactive(owl_context *ctx) {
     52int owl_context_is_interactive(owl_context *ctx)
     53{
    4754  return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0;
    4855}
    4956
    50 void owl_context_set_startup(owl_context *ctx) {
     57void owl_context_set_startup(owl_context *ctx)
     58{
    5159  SET_MODE(ctx, OWL_CTX_STARTUP);
    5260}
    5361
    54 void owl_context_set_readconfig(owl_context *ctx) {
     62void owl_context_set_readconfig(owl_context *ctx)
     63{
    5564  SET_MODE(ctx, OWL_CTX_READCONFIG);
    5665}
    5766
    58 void owl_context_set_interactive(owl_context *ctx) {
     67void owl_context_set_interactive(owl_context *ctx)
     68{
    5969  SET_MODE(ctx, OWL_CTX_INTERACTIVE);
    6070}
    6171
    62 void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw) {
     72void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw)
     73{
    6374  ctx->data = (void*)vw;
    6475  SET_ACTIVE(ctx, OWL_CTX_POPLESS);
    6576}
    6677
    67 void owl_context_set_recv(owl_context *ctx) {
     78void owl_context_set_recv(owl_context *ctx)
     79{
    6880  SET_ACTIVE(ctx, OWL_CTX_RECV);
    6981}
    7082
    71 void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew) {
     83void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew)
     84{
    7285  ctx->data = (void*)ew;
    7386  SET_ACTIVE(ctx, OWL_CTX_EDITMULTI);
    7487}
    7588
    76 void owl_context_set_editline(owl_context *ctx, owl_editwin *ew) {
     89void owl_context_set_editline(owl_context *ctx, owl_editwin *ew)
     90{
    7791  ctx->data = (void*)ew;
    7892  SET_ACTIVE(ctx, OWL_CTX_EDITLINE);
  • list.c

    rd09e5a1 r53f421b  
    88#define GROWBY 1.5
    99
    10 int owl_list_create(owl_list *l) {
     10int owl_list_create(owl_list *l)
     11{
    1112  l->size=0;
    1213  l->list=(void **)owl_malloc(INITSIZE*sizeof(void *));
     
    1617}
    1718
    18 int owl_list_get_size(owl_list *l) {
     19int owl_list_get_size(owl_list *l)
     20{
    1921  return(l->size);
    2022}
    2123
    22 void *owl_list_get_element(owl_list *l, int n) {
     24void *owl_list_get_element(owl_list *l, int n)
     25{
    2326  if (n>l->size-1) return(NULL);
    2427  return(l->list[n]);
    2528}
    2629
    27 int owl_list_append_element(owl_list *l, void *element) {
     30int owl_list_append_element(owl_list *l, void *element)
     31{
    2832  void *ptr;
    2933 
     
    4044}
    4145
    42 int owl_list_prepend_element(owl_list *l, void *element) {
     46int owl_list_prepend_element(owl_list *l, void *element)
     47{
    4348  void *ptr;
    4449  int i;
     
    5964}
    6065
    61 int owl_list_remove_element(owl_list *l, int n) {
     66int owl_list_remove_element(owl_list *l, int n)
     67{
    6268  int i;
    6369
     
    7177
    7278/* todo: might leak memory */
    73 int owl_list_replace_element(owl_list *l, int n, void *element) {
     79int owl_list_replace_element(owl_list *l, int n, void *element)
     80{
    7481  if (n>l->size-1) return(-1);
    7582
     
    7885}
    7986
    80 void owl_list_free_all(owl_list *l, void (*elefree)(void *)) {
     87void owl_list_free_all(owl_list *l, void (*elefree)(void *))
     88{
    8189  int i;
    8290
     
    8795}
    8896
    89 void owl_list_free_simple(owl_list *l) {
     97void owl_list_free_simple(owl_list *l)
     98{
    9099  if (l->list) owl_free(l->list);
    91100}
Note: See TracChangeset for help on using the changeset viewer.