emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for fields of `struct buffer'


From: Tom Tromey
Subject: Re: Patch for fields of `struct buffer'
Date: Tue, 01 Feb 2011 11:26:07 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

>>>>> "Tom" == Tom Tromey <address@hidden> writes:

Stefan> To the extent that they're hidden behind macros, the current changes
Stefan> seem fine (the move of vars to globals.h is not, tho, which is why
Stefan> I want globals.h to be auto-generated).

Tom> I can do this after my current patch is done.

I wrote an evil sed script to generate globals.h from the .c files.
I used sed and not anything nicer since that is what the GNU coding
standards specify.

It is rather slow.  On my laptop it takes 10 seconds to scan src/*.c.
This would have to be done with every change to a .c file.

I've appended the script in case you want to try it yourself.
This is just generating the body of the "emacs_globals" struct; some
minor tweaks remain to be done in the Makefile.

Maybe Andreas' idea of reusing the doc extractor would be better.
I have not looked at that.

Tom

s/^.*DEFVAR_INT *("[^"]*", *\([a-zA-Z0-9_]*\),.*$/\1/
t printint
/^.*DEFVAR_INT *("[^"]*",[      ]*$/ {
  n
  s/^[  ]*\([a-zA-Z0-9_]*\),.*$/\1/
  b printint
}
s/^.*DEFVAR_BOOL *("[^"]*", *\([a-zA-Z0-9_]*\),.*$/\1/
t printbool
/^.*DEFVAR_BOOL ("[^"]*",[      ]*$/ {
  n
  s/^[  ]*\([a-zA-Z0-9_]*\),.*$/\1/
  b printbool
}
s/^.*DEFVAR_LISP\(_NOPRO\)* *("[^"]*", *\([a-zA-Z0-9_]*\),.*$/\2/
t printlisp
/^.*DEFVAR_LISP\(_NOPRO\)* ("[^"]*",[   ]*$/ {
  n
  s/^[  ]*\([a-zA-Z0-9_]*\),.*$/\1/
  b printlisp
}

b done

: printint
h
s/^\(.*\)$/  EMACS_INT f_\1;/p
g
s/^\(.*\)$/#define \1 globals.f_\1/p
b done

: printbool
h
s/^\(.*\)$/  int f_\1;/p
g
s/^\(.*\)$/#define \1 globals.f_\1/p
b done

: printlisp
h
s/^\(.*\)$/  Lisp_Object f_\1;/p
g
s/^\(.*\)$/#define \1 globals.f_\1/p
b done

: done



reply via email to

[Prev in Thread] Current Thread [Next in Thread]