compile parser.c separately

* publish parse_config_file() and parse_arg()
* change Makefile to compile objects for tiny version separately
This commit is contained in:
Charlie Gordon 2014-02-03 20:03:07 +00:00
commit 6b0e73b689
4 changed files with 45 additions and 24 deletions

View file

@ -55,8 +55,9 @@ DEFINES=-DHAVE_QE_CONFIG_H
TARGETLIBS:=
TARGETS+= qe$(EXE) tqe$(EXE) kmaps ligatures
OBJS= qe.o charset.o buffer.o input.o display.o util.o hex.o list.o cutils.o
TOBJS= tqe.o charset.o buffer.o input.o display.o util.o hex.o list.o cutils.o
OBJS:= qe.o parser.o charset.o buffer.o input.o display.o util.o hex.o \
list.o cutils.o
TOBJS:= $(OBJS)
OBJS+= extras.o
@ -80,10 +81,8 @@ ifdef CONFIG_HAIKU
endif
ifdef CONFIG_WIN32
OBJS+= unix.o
TOBJS+= unix.o
OBJS+= win32.o
TOBJS+= win32.o
OBJS+= unix.o win32.o
TOBJS+= unix.o win32.o
# OBJS+= printf.o
# TOBJS+= printf.o
LIBS+= -lmsvcrt -lgdi32 -lwsock32
@ -107,9 +106,7 @@ ifdef CONFIG_UNICODE_JOIN
endif
# more charsets if needed
ifndef CONFIG_TINY
OBJS+= charsetjis.o charsetmore.o
endif
OBJS+= charsetjis.o charsetmore.o
ifdef CONFIG_ALL_MODES
OBJS+= unihex.o clang.o xml.o bufed.o \
@ -162,16 +159,16 @@ endif
SRCS:= $(OBJS:.o=.c)
TSRCS:= $(TOBJS:.o=.c)
TSRCS:= $(TSRCS:tqe.c=qe.c)
DEPENDS:= qe.h config.h cutils.h display.h qestyles.h config.mak
DEPENDS:= $(addprefix $(DEPTH)/, $(DEPENDS))
OBJS_DIR:= $(DEPTH)/.objs
TOBJS_DIR:= $(DEPTH)/.tobjs
OBJS:= $(addprefix $(OBJS_DIR)/, $(OBJS))
TOBJS:= $(addprefix $(OBJS_DIR)/, $(TOBJS))
TOBJS:= $(addprefix $(TOBJS_DIR)/, $(TOBJS))
$(shell mkdir -p $(OBJS_DIR))
$(shell mkdir -p $(OBJS_DIR) $(TOBJS_DIR))
#
# Dependencies
@ -206,15 +203,12 @@ tqe$(EXE): tqe_g$(EXE) Makefile
echo `size $@` `wc -c $@` tqe $(OPTIONS) \
| cut -d ' ' -f 7-10,13,15-40 >> STATS
$(OBJS_DIR)/tqe.o: qe.c parser.c qeconfig.h variables.h $(DEPENDS) Makefile
$(CC) $(DEFINES) -DCONFIG_TINY $(CFLAGS) -o $@ -c $<
ffplay$(EXE): qe$(EXE) Makefile
ln -sf $< $@
ifndef CONFIG_INIT_CALLS
$(OBJS_DIR)/qe.o: allmodules.txt
$(OBJS_DIR)/tqe.o: basemodules.txt
$(TOBJS_DIR)/qe.o: basemodules.txt
endif
allmodules.txt: $(SRCS) Makefile
@ -230,18 +224,33 @@ basemodules.txt: $(TSRCS) Makefile
$(OBJS_DIR)/cfb.o: cfb.c cfb.h fbfrender.h
$(OBJS_DIR)/charsetjis.o: charsetjis.c charsetjis.def
$(OBJS_DIR)/fbfrender.o: fbfrender.c fbfrender.h libfbf.h
$(OBJS_DIR)/qe.o: qe.c parser.c qeconfig.h qe.h qfribidi.h variables.h
$(OBJS_DIR)/qe.o: qe.c parser.c qeconfig.h qfribidi.h variables.h
$(OBJS_DIR)/qfribidi.o: qfribidi.c qfribidi.h
$(TOBJS_DIR)/cfb.o: cfb.c cfb.h fbfrender.h
$(TOBJS_DIR)/charsetjis.o: charsetjis.c charsetjis.def
$(TOBJS_DIR)/fbfrender.o: fbfrender.c fbfrender.h libfbf.h
$(TOBJS_DIR)/qe.o: qe.c parser.c qeconfig.h qfribidi.h variables.h
$(TOBJS_DIR)/qfribidi.o: qfribidi.c qfribidi.h
$(OBJS_DIR)/%.o: %.c $(DEPENDS) Makefile
$(CC) $(DEFINES) $(CFLAGS) -o $@ -c $<
$(TOBJS_DIR)/%.o: %.c $(DEPENDS) Makefile
$(CC) $(DEFINES) -DCONFIG_TINY $(CFLAGS) -o $@ -c $<
$(OBJS_DIR)/haiku.o: haiku.cpp $(DEPENDS) Makefile
g++ $(DEFINES) $(CFLAGS) -Wno-multichar -o $@ -c $<
$(TOBJS_DIR)/haiku.o: haiku.cpp $(DEPENDS) Makefile
g++ $(DEFINES) -DCONFIG_TINY $(CFLAGS) -Wno-multichar -o $@ -c $<
%.s: %.c $(DEPENDS) Makefile
$(CC) $(DEFINES) $(CFLAGS) -o $@ -S $<
%.s: %.cpp $(DEPENDS) Makefile
g++ $(DEFINES) $(CFLAGS) -Wno-multichar -o $@ -S $<
#
# Test for bidir algorithm
#
@ -371,7 +380,7 @@ clean:
$(OBJS_DIR)/*.o
distclean: clean
rm -rf config.h config.mak $(OBJS_DIR)
rm -rf config.h config.mak $(OBJS_DIR) $(TOBJS_DIR)
install: $(TARGETS) qe.1
$(INSTALL) -m 755 -d $(DESTDIR)$(prefix)/bin

View file

@ -19,6 +19,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "qe.h"
#include "variables.h"
/* config file parsing */
/* CG: error messages should go to the *error* buffer.

10
qe.c
View file

@ -3693,10 +3693,10 @@ static void get_param(const char **pp, char *param, int param_size, int osep, in
}
/* return -1 if error, 0 if no more args, 1 if one arg parsed */
static int parse_arg(const char **pp, unsigned char *argtype,
char *prompt, int prompt_size,
char *completion, int completion_size,
char *history, int history_size)
int parse_arg(const char **pp, unsigned char *argtype,
char *prompt, int prompt_size,
char *completion, int completion_size,
char *history, int history_size)
{
int tc, type;
const char *p;
@ -7268,8 +7268,6 @@ int find_resource_file(char *path, int path_size, const char *pattern)
/******************************************************/
#include "parser.c"
void do_load_config_file(EditState *e, const char *file)
{
QEmacsState *qs = e->qe_state;

11
qe.h
View file

@ -1772,6 +1772,10 @@ void do_set_system_font(EditState *s, const char *qe_font_name,
const char *system_fonts);
void call_func(CmdSig sig, CmdProto func, int nb_args, CmdArg *args,
unsigned char *args_type);
int parse_arg(const char **pp, unsigned char *argtype,
char *prompt, int prompt_size,
char *completion, int completion_size,
char *history, int history_size);
void exec_command(EditState *s, CmdDef *d, int argval, int key);
void do_execute_command(EditState *s, const char *cmd, int argval);
void window_display(EditState *s);
@ -1820,6 +1824,13 @@ int parse_command_line(int argc, char **argv);
void set_user_option(const char *user);
void set_tty_charset(const char *name);
/* parser.c */
int parse_config_file(EditState *s, const char *filename);
void do_eval_expression(EditState *s, const char *expression);
void do_eval_region(EditState *s);
void do_eval_buffer(EditState *s);
/* extras.c */
void do_compare_windows(EditState *s, int argval);