On Tuesday 07 April 2009 03:32:43 pm Mark Polesky wrote:

> I was fiddling around with output-ps.scm (specifically
> the grob-cause procedure on line 159) and was getting
> frustrated with the poor indentation displaying in my
> editor when I realized that this was being caused by
> tab characters in the source. 
> 
> Is there an easy way to address this? I don't know how
> many tab characters there are in the source, nor do I
> know how to find out. But it can be frustrating. Any
> solutions?

Here's a hack I wrote for my Amiga files in 1994 'cos I was fed up of tabs.
Error checking is minimal and boundary checking is non existent.

#include <stdio.h>
#include <ctype.h>
#include <math.h>

main(int argc, char *argv*[]) {
  int tab, c, ts;

  if (argc !=2 ) {
    fprintf(stderr, "Use: expandtab n\n");
    exit(27);
  }

  ts =  atoi(argv[1]);

  tab = 0;
  while ((c=getchar()) != EOF) {

    if (c=='\t')  {
      tab %= ts;
      do {
        putchar(' ');
        ++tab;
      } while (tab != ts);
    }
    else {
      putchar(c);
      ++tab;
    }

    if ( c=='\n' )
      tab = 0;
  }
}

Ian
--


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to