/[qemacs]/qemacs/shell.c
ViewVC logotype

Diff of /qemacs/shell.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by chqrlie, Mon May 9 09:10:38 2005 UTC revision 1.14 by chqrlie, Wed May 11 12:13:56 2005 UTC
# Line 144  static int run_process(const char *path, Line 144  static int run_process(const char *path,
144      if (pid == 0) {      if (pid == 0) {
145          /* child process */          /* child process */
146          nb_fds = getdtablesize();          nb_fds = getdtablesize();
147          for(i=0;i<nb_fds;i++)          for (i = 0; i < nb_fds; i++)
148              close(i);              close(i);
149          /* open pseudo tty for standard i/o */          /* open pseudo tty for standard i/o */
150          open(tty_name, O_RDWR);          open(tty_name, O_RDWR);
# Line 370  static void tty_gotoxy(ShellState *s, in Line 370  static void tty_gotoxy(ShellState *s, in
370          total_lines++;          total_lines++;
371      }      }
372      offset = eb_goto_pos(s->b, line_num, 0);      offset = eb_goto_pos(s->b, line_num, 0);
373      for(;x > 0; x--) {      for (; x > 0; x--) {
374          c = eb_nextc(s->b, offset, &offset1);          c = eb_nextc(s->b, offset, &offset1);
375          if (c == '\n') {          if (c == '\n') {
376              buf1[0] = ' ';              buf1[0] = ' ';
377              for(;x > 0; x--) {              for (; x > 0; x--) {
378                  eb_insert(s->b, offset, buf1, 1);                  eb_insert(s->b, offset, buf1, 1);
379              }              }
380              break;              break;
# Line 388  static void tty_gotoxy(ShellState *s, in Line 388  static void tty_gotoxy(ShellState *s, in
388  void tty_csi_m(ShellState *s, int c)  void tty_csi_m(ShellState *s, int c)
389  {  {
390      /* we handle only a few possible modes */      /* we handle only a few possible modes */
391      switch(c) {      switch (c) {
392      case 0:      case 0:
393          s->color = s->def_color;          s->color = s->def_color;
394          break;          break;
# Line 413  static void tty_update_cursor(ShellState Line 413  static void tty_update_cursor(ShellState
413      if (s->cur_offset == -1)      if (s->cur_offset == -1)
414          return;          return;
415    
416      for(e = qs->first_window; e != NULL; e = e->next_window) {      for (e = qs->first_window; e != NULL; e = e->next_window) {
417          if (s->b == e->b && e->interactive) {          if (s->b == e->b && e->interactive) {
418              e->offset = s->cur_offset;              e->offset = s->cur_offset;
419          }          }
# Line 720  static void tty_emulate(ShellState *s, i Line 720  static void tty_emulate(ShellState *s, i
720                  break;                  break;
721              case 'K':   /* clear eol (parm=1 -> bol) */              case 'K':   /* clear eol (parm=1 -> bol) */
722                  offset1 = s->cur_offset;                  offset1 = s->cur_offset;
723                  for(;;) {                  for (;;) {
724                      c = eb_nextc(s->b, offset1, &offset2);                      c = eb_nextc(s->b, offset1, &offset2);
725                      if (c == '\n')                      if (c == '\n')
726                          break;                          break;
# Line 734  static void tty_emulate(ShellState *s, i Line 734  static void tty_emulate(ShellState *s, i
734                  if (n <= 0)                  if (n <= 0)
735                      n = 1;                      n = 1;
736                  offset1 = s->cur_offset;                  offset1 = s->cur_offset;
737                  for(;n > 0;n--) {                  for (; n > 0; n--) {
738                      c = eb_nextc(s->b, offset1, &offset2);                      c = eb_nextc(s->b, offset1, &offset2);
739                      if (c == '\n')                      if (c == '\n')
740                          break;                          break;
# Line 748  static void tty_emulate(ShellState *s, i Line 748  static void tty_emulate(ShellState *s, i
748                  if (n <= 0)                  if (n <= 0)
749                      n = 1;                      n = 1;
750                  buf1[0] = ' ';                  buf1[0] = ' ';
751                  for(;n > 0;n--) {                  for (; n > 0; n--) {
752                      eb_insert(s->b, s->cur_offset, buf1, 1);                      eb_insert(s->b, s->cur_offset, buf1, 1);
753                  }                  }
754                  break;                  break;
# Line 757  static void tty_emulate(ShellState *s, i Line 757  static void tty_emulate(ShellState *s, i
757                  n = s->nb_esc_params;                  n = s->nb_esc_params;
758                  if (n == 0)                  if (n == 0)
759                      n = 1;                      n = 1;
760                  for(i=0;i<n;i++)                  for (i = 0; i < n; i++)
761                      tty_csi_m(s, s->esc_params[i]);                      tty_csi_m(s, s->esc_params[i]);
762                  break;                  break;
763              case 'n':              case 'n':
# Line 791  static void shell_color_callback(EditBuf Line 791  static void shell_color_callback(EditBuf
791      unsigned char buf[32];      unsigned char buf[32];
792      int len;      int len;
793    
794      switch(op) {      switch (op) {
795      case LOGOP_WRITE:      case LOGOP_WRITE:
796          while (size > 0) {          while (size > 0) {
797              len = size;              len = size;
# Line 835  static int shell_get_colorized_line(Edit Line 835  static int shell_get_colorized_line(Edit
835      /* record line */      /* record line */
836      buf_ptr = buf;      buf_ptr = buf;
837      buf_end = buf + buf_size;      buf_end = buf + buf_size;
838      for(;;) {      for (;;) {
839          eb_read(b_color, offset, buf1, 1);          eb_read(b_color, offset, buf1, 1);
840          color = buf1[0];          color = buf1[0];
841          c = eb_nextc(b, offset, &offset1);          c = eb_nextc(b, offset, &offset1);
# Line 1118  void shell_write_char(EditState *e, int Line 1118  void shell_write_char(EditState *e, int
1118          ch = c;          ch = c;
1119          tty_write(s, &ch, 1);          tty_write(s, &ch, 1);
1120      } else {      } else {
1121          switch(c) {          switch (c) {
1122          case 4:          case 4:
1123              do_delete_char(e);              do_delete_char(e);
1124              break;              break;
# Line 1157  void do_shell_toggle_input(EditState *e) Line 1157  void do_shell_toggle_input(EditState *e)
1157  #endif  #endif
1158  }  }
1159    
1160    /* CG: these variables should move to mode structure */
1161  static int error_offset = -1;  static int error_offset = -1;
1162  static int last_line_num = -1;  static int last_line_num = -1;
1163  static char last_filename[1024];  static char last_filename[MAX_FILENAME_SIZE];
1164    
1165  static void do_compile(EditState *e, const char *cmd)  static void do_compile(EditState *e, const char *cmd)
1166  {  {
# Line 1196  static void do_compile_error(EditState * Line 1197  static void do_compile_error(EditState *
1197      EditState *e;      EditState *e;
1198      EditBuffer *b;      EditBuffer *b;
1199      int offset, offset1, found_offset;      int offset, offset1, found_offset;
1200      char filename[1024], *q;      char filename[MAX_FILENAME_SIZE], *q;
1201      int line_num, c;      int line_num, c;
1202    
1203      /* CG: should have a buffer flag for error source.      /* CG: should have a buffer flag for error source.
# Line 1217  static void do_compile_error(EditState * Line 1218  static void do_compile_error(EditState *
1218          offset = 0;          offset = 0;
1219          goto find_error;          goto find_error;
1220      }      }
1221      for(;;) {      for (;;) {
1222          if (dir > 0) {          if (dir > 0) {
1223              if (offset >= b->total_size) {              if (offset >= b->total_size) {
1224                  put_status(s, "No more errors");                  put_status(s, "No more errors");
1225                  return;                  return;
1226              }              }
1227              for(;;) {              for (;;) {
1228                  c = eb_nextc(b, offset, &offset);                  c = eb_nextc(b, offset, &offset);
1229                  if (c == '\n')                  if (c == '\n')
1230                      break;                      break;
# Line 1234  static void do_compile_error(EditState * Line 1235  static void do_compile_error(EditState *
1235                  return;                  return;
1236              }              }
1237              eb_prevc(b, offset, &offset);              eb_prevc(b, offset, &offset);
1238              for(;;) {              for (;;) {
1239                  c = eb_prevc(b, offset, &offset1);                  c = eb_prevc(b, offset, &offset1);
1240                  if (c == '\n')                  if (c == '\n')
1241                      break;                      break;

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26