Changeset bab52da


Ignore:
Timestamp:
Jul 11, 2009, 1:14:34 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
98f1e69
Parents:
521bc84
git-author:
Karl Ramm <kcr@1ts.org> (06/09/09 21:43:47)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:34)
Message:
make a bunch of stuff static, possibly inline, maybe remove a leading _
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r521bc84 rbab52da  
    3333} oe_excursion;
    3434
     35static void oe_reframe(owl_editwin *e);
     36static void oe_save_excursion(owl_editwin *e, oe_excursion *x);
     37static void oe_restore_excursion(owl_editwin *e, oe_excursion *x);
     38static int oe_find_display_line(owl_editwin *e, int *x, int index);
     39static int owl_editwin_limit_maxcols(int v, int maxv);
     40static int owl_editwin_check_dotsend(owl_editwin *e);
     41static void _owl_editwin_process_char(owl_editwin *e, gunichar j);
    3542static int owl_editwin_is_char_in(owl_editwin *e, char *set);
    36 static void oe_reframe(owl_editwin *e);
     43static int owl_editwin_is_char_in(owl_editwin *e, char *set);
     44static int owl_editwin_linewrap_word(owl_editwin *e);
     45static gunichar owl_editwin_get_char_at_point(owl_editwin *e);
     46
     47static void _owl_editwin_addspace(owl_editwin *e);
     48static void owl_editwin_overwrite_char(owl_editwin *e, gunichar c);
     49static void owl_editwin_insert_char(owl_editwin *e, gunichar c);
     50static void owl_editwin_overwrite_string(owl_editwin *e, char *string);
    3751
    3852#define INCR 5000
     
    4054#define WHITESPACE " \n\t"
    4155
    42 owl_editwin *owl_editwin_allocate(void) {
     56owl_editwin *owl_editwin_allocate(void)
     57{
    4358  return owl_malloc(sizeof(owl_editwin));
    4459}
    4560
    46 static void oe_set_index(owl_editwin *e, int index) {
     61static inline void oe_set_index(owl_editwin *e, int index)
     62{
    4763  e->index = index;
    4864  e->goal_column = -1;
     
    124140}
    125141
    126 void owl_editwin_set_command(owl_editwin *e, char *command) {
     142void owl_editwin_set_command(owl_editwin *e, char *command)
     143{
    127144  if(e->command) owl_free(e->command);
    128145  e->command = owl_strdup(command);
    129146}
    130147
    131 char *owl_editwin_get_command(owl_editwin *e) {
     148char *owl_editwin_get_command(owl_editwin *e)
     149{
    132150  if(e->command) return e->command;
    133151  return "";
    134152}
    135153
    136 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*)) {
     154void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*))
     155{
    137156  e->callback = cb;
    138157}
    139158
    140 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*) {
     159void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*)
     160{
    141161  return e->callback;
    142162}
    143163
    144 void owl_editwin_set_cbdata(owl_editwin *e, void *data) {
     164void owl_editwin_set_cbdata(owl_editwin *e, void *data)
     165{
    145166  e->cbdata = data;
    146167}
     
    161182}
    162183
    163 int owl_editwin_limit_maxcols(int v, int maxv)
     184static int owl_editwin_limit_maxcols(int v, int maxv)
    164185{
    165186  if (maxv > 5 && v > maxv) {
     
    255276
    256277/* malloc more space for the buffer */
    257 void _owl_editwin_addspace(owl_editwin *e)
     278static void _owl_editwin_addspace(owl_editwin *e)
    258279{
    259280  e->buff=owl_realloc(e->buff, e->allocated+INCR);
     
    469490 * returns -1 if we could not wrap.
    470491 */
    471 int _owl_editwin_linewrap_word(owl_editwin *e)
     492static int owl_editwin_linewrap_word(owl_editwin *e)
    472493{
    473494  int i;
     
    504525 * characters over)
    505526 */
    506 void owl_editwin_insert_char(owl_editwin *e, gunichar c)
     527static void owl_editwin_insert_char(owl_editwin *e, gunichar c)
    507528{
    508529  int i, ret, len;
     
    553574
    554575/* overwrite the character at the current point with 'c' */
    555 void owl_editwin_overwrite_char(owl_editwin *e, gunichar c)
     576static void owl_editwin_overwrite_char(owl_editwin *e, gunichar c)
    556577{
    557578  int oldlen, newlen, i;
     
    692713 */
    693714
    694 void owl_editwin_overwrite_string(owl_editwin *e, char *string)
     715static void owl_editwin_overwrite_string(owl_editwin *e, char *string)
    695716{
    696717  char *p;
     
    711732
    712733/* We assume index is not set to point to a mid-char */
    713 gunichar _owl_editwin_get_char_at_point(owl_editwin *e)
     734static gunichar owl_editwin_get_char_at_point(owl_editwin *e)
    714735{
    715736  return g_utf8_get_char(e->buff + e->index);
     
    762783  oe_save_excursion(e, &x);
    763784  owl_editwin_point_move(e, -1);
    764   ret = (_owl_editwin_get_char_at_point(e) == '\n');
     785  ret = (owl_editwin_get_char_at_point(e) == '\n');
    765786  oe_restore_excursion(e, &x);
    766787
     
    773794  /* It would be awfully nice if we could do UTF-8 comparisons */
    774795  for (p = set; *p != 0; p++)
    775     if (_owl_editwin_get_char_at_point(e) == *p)
     796    if (owl_editwin_get_char_at_point(e) == *p)
    776797      return 1;
    777798  return 0;
     
    10721093}
    10731094
    1074 int owl_editwin_check_dotsend(owl_editwin *e)
     1095static int owl_editwin_check_dotsend(owl_editwin *e)
    10751096{
    10761097  char *p, *p_n, *p_p;
     
    11101131}
    11111132
    1112 void _owl_editwin_process_char(owl_editwin *e, gunichar j)
     1133static void _owl_editwin_process_char(owl_editwin *e, gunichar j)
    11131134{
    11141135  if (!(g_unichar_iscntrl(j) && (j != 10) && (j != 13)) || j==9 ) {
Note: See TracChangeset for help on using the changeset viewer.