[Python-checkins] CVS: python/dist/src/Modules readline.c,2.34,2.35

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 13 Apr 2001 11:14:29 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv25767

Modified Files:
	readline.c 
Log Message:
Clean up the unsightly mess around the readline header files.  We now
always:

- #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include
  strings.h)

- #include readline.h and history.h

and we never declare any readline function prototypes ourselves.

This makes it compile with readline 4.2, albeit with a few warnings.
Some of the remaining warnings are about completion_matches(), which
is renamed to rl_completion_matches().

I've tested it with various other versions, from 2.0 up, and they all
seem to work (some with warnings) -- but only on Red Hat Linux 6.2.

Fixing the warnings for readline 4.2 would break compatibility with
3.0 (and maybe even earlier versions), and readline doesn't seem to
have a way to test for its version at compile time, so I'd rather
leave the warnings in than break compilation with older versions.


Index: readline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -r2.34 -r2.35
*** readline.c	2001/01/10 21:03:32	2.34
--- readline.c	2001/04/13 18:14:27	2.35
***************
*** 18,47 ****
  
  /* GNU readline definitions */
! /* If you have string.h, you might need to add yourself to this #if... [cjh] */
! #if defined(__BEOS__)
! #undef HAVE_CONFIG_H
! /* At max warnings, we need protos for everything. [cjh] */
  #include <readline/readline.h>
  #include <readline/history.h>
- #include <unistd.h>
- #else
- #include <readline/readline.h> /* You may need to add an -I option to Setup */
- 
- #ifdef __CYGWIN__
- #include <readline/history.h>
- #else /* !__CYGWIN__ */
- extern int rl_parse_and_bind(char *);
- extern int rl_read_init_file(char *);
- extern int rl_insert_text(char *);
- extern int rl_bind_key(int, Function *);
- extern int rl_bind_key_in_map(int, Function *, Keymap);
- extern int rl_initialize(void);
- extern int add_history(char *);
- extern int read_history(char *);
- extern int write_history(char *);
- extern int history_truncate_file(char *, int);
- extern Function *rl_event_hook;
- #endif /* !__CYGWIN__ */
- #endif
  
  /* Pointers needed from outside (but not declared in a header file). */
--- 18,24 ----
  
  /* GNU readline definitions */
! #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
  #include <readline/readline.h>
  #include <readline/history.h>
  
  /* Pointers needed from outside (but not declared in a header file). */