diff --git a/Makefile.in b/Makefile.in index 3e0c773a8..da74f1fd6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,7 +23,7 @@ # # Makefile for the fish shell. Can build fish and associated # applications, install them, recalculate dependencies and also create -# binary distributions in tar.bz2 tar.gz and rpm formats. +# binary distributions in tar.bz2, tar.gz and rpm formats. # # @@ -56,44 +56,36 @@ ETC_DIR_INSTALL = etc/fish_interactive.fish # Set to 1 if we have gettext HAVE_GETTEXT=@HAVE_GETTEXT@ -CORE_OBJS := util.o common.o halloc.o halloc_util.o fallback.o +#Additional .c files used by common.o. These also have a corresponding +#.h file. +COMMON_FILES := util.c halloc.c halloc_util.c fallback.c -# All objects used by fish, that are compiled from an ordinary .c file -# using an ordinary .h file. -COMMON_OBJS := function.o builtin.o complete.o env.o exec.o \ +# All objects that the system needs to build fish, except main.o +FISH_OBJS := function.o builtin.o complete.o env.o exec.o \ expand.o highlight.o history.o kill.o parser.o proc.o reader.o \ sanity.o tokenizer.o wildcard.o wgetopt.o wutil.o input.o \ output.o intern.o env_universal.o env_universal_common.o \ - input_common.o event.o signal.o io.o translate.o parse_util.o \ - $(CORE_OBJS) + input_common.o event.o signal.o io.o translate.o parse_util.o common.o \ -# builtin_help.h exists, but builtin_help.c is autogenerated -COMMON_OBJS_WITH_HEADER := builtin_help.o - -# main.c exists, but main.h does not, etc. -COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o \ - builtin_ulimit.o builtin_complete.o builtin_jobs.o - -# All objects that the system needs to build fish -FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \ - $(COMMON_OBJS_WITH_HEADER) main.o +# Additional files used by builtin.o +BUILTIN_FILES := builtin_help.c builtin_set.c builtin_commandline.c \ + builtin_ulimit.c builtin_complete.c builtin_jobs.c # All objects that the system needs to build fish_pager FISH_PAGER_OBJS := fish_pager.o output.o wutil.o \ tokenizer.o input_common.o env_universal.o env_universal_common.o \ - translate.o $(CORE_OBJS) + translate.o common.o # All objects that the system needs to build fish_tests -FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) \ - $(COMMON_OBJS_WITH_HEADER) fish_tests.o +FISH_TESTS_OBJS := common.o fish_tests.o # All objects that the system needs to build fishd FISHD_OBJS := fishd.o env_universal_common.o wutil.o \ - doc_src/fishd.o $(CORE_OBJS) + doc_src/fishd.o common.o # All objects needed to build mimedb MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \ - xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o $(CORE_OBJS) + xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o common.o # # Files containing documentation for builtins. Should be listed @@ -150,14 +142,14 @@ DOC_SRC_DIR_FILES := doc_src/Doxyfile.in doc_src/doc.hdr \ $(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/fish.1.in # Files in ./ -MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \ - configure.ac config.h.in install-sh set_color.c count.c \ - key_reader.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \ - $(MIME_OBJS:.o=.c) $(COMMON_OBJS_WITH_HEADER:.o=.h) \ - $(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \ - $(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \ - user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \ - config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in +MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \ + configure.ac config.h.in install-sh set_color.c count.c \ + key_reader.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \ + $(MIME_OBJS:.o=.c) $(FISH_OBJS:.o=.h) $(BUILTIN_FILES) \ + $(COMMON_FILES) $(COMMON_FILES:.c=.h) $(FISH_OBJS:.o=.c) \ + builtin_help.hdr fish.spec.in INSTALL README user_doc.head.html \ + xsel-0.9.6.tar ChangeLog config.sub config.guess fish_tests.c \ + main.c fish_pager.c fishd.c seq.in # Files in ./etc/ ETC_DIR_FILES :=etc/fish.in etc/fish_inputrc \ @@ -208,8 +200,10 @@ debug: .PHONY: debug # User documentation, describing the features of the fish shell. -user_doc: doc.h Doxyfile.user user_doc.head.html +user_doc: doc_src/doc.hdr Doxyfile.user user_doc.head.html + $(MAKE) doc.h # Depend on the source (doc.hdr) and manually make the intermediate as needed doxygen Doxyfile.user + touch user_doc # Source code documentation. Also includes user documentation. doc: *.h *.c doc.h Doxyfile builtin_help.c @@ -283,6 +277,10 @@ messages.pot: *.c *.h etc/*.in share/fish share/completions/*.fish share/functio fi; \ fi +builtin.o: $(BUILTIN_FILES) + +common.o: $(COMMON_FILES) + # Generate the internal help functions by making doxygen create # man-pages which are then converted into C code. The convertion path # looks like this: @@ -315,15 +313,24 @@ messages.pot: *.c *.h etc/*.in share/fish share/completions/*.fish share/functio # Which is an awful, clunky and ugly way of producing # documentation. There ought to be something simpler. -builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh builtin_help.hdr $(CMD_DOC_HDR) - cd doc_src; doxygen; cd ..; +doc_src/builtin_doc: $(BUILTIN_DOC_SRC) doc_src/count.txt builtin_help.hdr $(CMD_DOC_SRC) + for i in $(BUILTIN_DOC_SRC) $(CMD_DOC_SRC); do \ + FILE=doc_src/`basename $$i .txt`.doxygen; \ + echo "/** \page" `basename $$i .txt` >$$FILE; \ + cat $$i >>$$FILE; \ + echo "*/" >>$$FILE; \ + done + cd doc_src; doxygen; cd ..; + touch doc_src/builtin_doc + +builtin_help.c: doc_src/builtin_doc gen_hdr.sh + $(MAKE) gen_hdr2 # Don't depend on gen_hdr2, because then we would need to rebuild the docs whenever we use a fresh tarball cp builtin_help.hdr builtin_help.c; - chmod 755 gen_hdr.sh + if ! test -x gen_hdr.sh; then chmod 755 gen_hdr.sh; fi for i in $(BUILTIN_DOC_HDR) doc_src/count.doxygen ; do \ - echo ' hash_put( &tbl, L"'`basename $$i .doxygen`'",' >>$@; \ + echo ' hash_put( &tbl, L"'`basename $$i .doxygen`'",' >>$@; \ ./gen_hdr.sh $$i >>$@; \ - echo " );" >>$@; \ - echo >>$@; \ + printf " );\n\n" >>$@; \ done; echo "}" >>builtin_help.c @@ -332,7 +339,8 @@ builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh bui # mimedb. Depends on builtin_help.c to make sure doxygen gets run to # generate the man files. # -%.c : %.doxygen gen_hdr2 builtin_help.c +%.c : %.doxygen + $(MAKE) gen_hdr2 builtin_help.c # These should really be filed as dependencis for %.c above instead, but that seems to confuse make echo "// This file was automatically generated, do not edit" >$@ echo "#include " >>$@ echo "#include " >>$@ @@ -478,8 +486,8 @@ uninstall-translations: # The build rules for all the commands # -fish: $(FISH_OBJS) - $(CC) $(FISH_OBJS) $(LDFLAGS) -o $@ +fish: $(FISH_OBJS) main.o + $(CC) $(FISH_OBJS) main.o $(LDFLAGS) -o $@ fish_pager: $(FISH_PAGER_OBJS) $(CC) $(FISH_PAGER_OBJS) $(LDFLAGS) -o $@ @@ -498,12 +506,12 @@ set_color: set_color.o doc_src/set_color.o $(CC) set_color.o doc_src/set_color.o $(LDFLAGS) -o $@ # Test program for the tokenizer library -tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o - $(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@ +tokenizer_test: tokenizer.c tokenizer.h wutil.o common.o + $(CC) ${CFLAGS} tokenizer.c wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@ # Neat little program to show output from terminal -key_reader: key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o - $(CC) key_reader.o input_common.o $(CORE_OBJS) env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@ +key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o + $(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o wutil.o $(LDFLAGS) -o $@ # # Update dependencies @@ -519,7 +527,7 @@ depend: # # Uses install instead of mkdir so build won't fail if the directory # exists -fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(SHARE_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog user_doc +fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(SHARE_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog user_doc doc_src/builtin_doc rm -rf fish-@PACKAGE_VERSION@ $(INSTALL) -d fish-@PACKAGE_VERSION@ $(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src @@ -531,7 +539,6 @@ fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FIL $(INSTALL) -d fish-@PACKAGE_VERSION@/tests $(INSTALL) -d fish-@PACKAGE_VERSION@/po cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src - cp -rf user_doc fish-@PACKAGE_VERSION@/ cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/ cp -f $(ETC_DIR_FILES) fish-@PACKAGE_VERSION@/etc/ cp -f $(SHARE_DIR_FILES) fish-@PACKAGE_VERSION@/share/ @@ -539,6 +546,8 @@ fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FIL cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/functions/ cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/ cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/ + cp -rf user_doc fish-@PACKAGE_VERSION@/ + cp -rf doc_src/builtin_doc fish-@PACKAGE_VERSION@/doc_src/ tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar rm -rf fish-@PACKAGE_VERSION@ @@ -598,112 +607,116 @@ clean: # DO NOT DELETE THIS LINE -- make depend depends on it. -builtin.o: config.h fallback.h common.h util.h wutil.h builtin.h function.h -builtin.o: complete.h proc.h io.h parser.h event.h reader.h env.h wgetopt.h -builtin.o: sanity.h tokenizer.h builtin_help.h wildcard.h input_common.h -builtin.o: input.h intern.h signal.h translate.h halloc.h halloc_util.h -builtin.o: parse_util.h expand.h -builtin_commandline.o: signal.h config.h fallback.h common.h util.h wutil.h -builtin_commandline.o: builtin.h wgetopt.h reader.h proc.h io.h parser.h +builtin.o: config.h fallback.h util.h wutil.h builtin.h function.h complete.h +builtin.o: proc.h io.h parser.h event.h reader.h env.h common.h wgetopt.h +builtin.o: sanity.h tokenizer.h wildcard.h input_common.h input.h intern.h +builtin.o: signal.h translate.h halloc.h halloc_util.h parse_util.h expand.h +builtin.o: builtin_help.c builtin_set.c builtin_commandline.c +builtin.o: builtin_complete.c builtin_ulimit.c builtin_jobs.c +builtin_commandline.o: signal.h config.h fallback.h util.h wutil.h builtin.h +builtin_commandline.o: common.h wgetopt.h reader.h proc.h io.h parser.h builtin_commandline.o: event.h tokenizer.h input_common.h input.h translate.h builtin_commandline.o: parse_util.h -builtin_complete.o: signal.h config.h fallback.h common.h util.h wutil.h -builtin_complete.o: builtin.h complete.h wgetopt.h parser.h proc.h io.h +builtin_complete.o: signal.h config.h fallback.h util.h wutil.h builtin.h +builtin_complete.o: common.h complete.h wgetopt.h parser.h proc.h io.h builtin_complete.o: event.h reader.h translate.h -builtin_help.o: config.h util.h common.h builtin_help.h -builtin_set.o: signal.h config.h fallback.h common.h util.h wutil.h builtin.h -builtin_set.o: env.h expand.h wgetopt.h proc.h io.h parser.h event.h +builtin_help.o: config.h util.h common.h halloc_util.h +builtin_jobs.o: config.h fallback.h util.h wutil.h builtin.h proc.h io.h +builtin_jobs.o: parser.h event.h common.h wgetopt.h translate.h +builtin_set.o: signal.h config.h fallback.h util.h wutil.h builtin.h env.h +builtin_set.o: expand.h common.h wgetopt.h proc.h io.h parser.h event.h builtin_set.o: translate.h -builtin_ulimit.o: config.h fallback.h common.h util.h builtin.h wgetopt.h +builtin_ulimit.o: config.h fallback.h util.h builtin.h common.h wgetopt.h builtin_ulimit.o: translate.h -common.o: config.h fallback.h common.h util.h wutil.h expand.h proc.h io.h -common.o: wildcard.h parser.h event.h -complete.o: signal.h config.h fallback.h common.h util.h tokenizer.h -complete.o: wildcard.h proc.h io.h parser.h event.h function.h complete.h -complete.o: builtin.h env.h exec.h expand.h reader.h history.h intern.h -complete.o: translate.h parse_util.h halloc_util.h wutil.h -env.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h env.h +common.o: config.h fallback.h util.h wutil.h common.h expand.h proc.h io.h +common.o: wildcard.h parser.h event.h util.c halloc.c halloc.h halloc_util.c +common.o: fallback.c +complete.o: signal.h config.h fallback.h util.h tokenizer.h wildcard.h proc.h +complete.o: io.h parser.h event.h function.h complete.h builtin.h env.h +complete.o: exec.h expand.h common.h reader.h history.h intern.h translate.h +complete.o: parse_util.h halloc.h halloc_util.h wutil.h +env.o: config.h signal.h fallback.h util.h wutil.h proc.h io.h common.h env.h env.o: sanity.h expand.h history.h reader.h parser.h event.h env_universal.h env.o: env_universal_common.h input_common.h translate.h complete.h -env_universal.o: config.h signal.h fallback.h common.h util.h wutil.h +env_universal.o: config.h signal.h fallback.h util.h common.h wutil.h env_universal.o: env_universal_common.h env_universal.h -env_universal_common.o: config.h signal.h fallback.h common.h util.h wutil.h +env_universal_common.o: config.h signal.h fallback.h util.h common.h wutil.h env_universal_common.o: env_universal_common.h -event.o: signal.h config.h fallback.h common.h util.h wutil.h function.h -event.o: proc.h io.h parser.h event.h translate.h halloc_util.h -exec.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h +event.o: signal.h config.h fallback.h util.h wutil.h function.h proc.h io.h +event.o: parser.h event.h common.h translate.h halloc_util.h +exec.o: signal.h config.h fallback.h util.h common.h wutil.h proc.h io.h exec.o: exec.h parser.h event.h builtin.h function.h env.h wildcard.h exec.o: sanity.h expand.h env_universal.h env_universal_common.h translate.h exec.o: halloc.h halloc_util.h parse_util.h -expand.o: signal.h config.h fallback.h common.h util.h wutil.h env.h proc.h +expand.o: signal.h config.h fallback.h util.h common.h wutil.h env.h proc.h expand.o: io.h parser.h event.h expand.h wildcard.h exec.h tokenizer.h expand.o: complete.h translate.h parse_util.h halloc_util.h -fallback.o: config.h fallback.h common.h util.h -fishd.o: config.h signal.h fallback.h common.h util.h wutil.h +fallback.o: config.h fallback.h util.h +fishd.o: config.h signal.h fallback.h util.h common.h wutil.h fishd.o: env_universal_common.h -fish_pager.o: config.h signal.h fallback.h common.h util.h wutil.h complete.h +fish_pager.o: config.h signal.h fallback.h util.h wutil.h common.h complete.h fish_pager.o: output.h input_common.h env_universal.h env_universal_common.h fish_pager.o: halloc.h halloc_util.h -fish_tests.o: config.h signal.h fallback.h common.h util.h proc.h io.h +fish_tests.o: config.h signal.h fallback.h util.h common.h proc.h io.h fish_tests.o: reader.h builtin.h function.h complete.h wutil.h env.h expand.h fish_tests.o: parser.h event.h tokenizer.h output.h exec.h halloc_util.h -function.o: signal.h config.h wutil.h fallback.h common.h util.h function.h -function.o: proc.h io.h translate.h parser.h event.h intern.h reader.h +function.o: signal.h config.h wutil.h fallback.h util.h function.h proc.h +function.o: io.h translate.h parser.h event.h common.h intern.h reader.h function.o: parse_util.h env.h expand.h -halloc.o: config.h fallback.h common.h util.h halloc.h -halloc_util.o: config.h fallback.h common.h util.h halloc.h -highlight.o: signal.h config.h fallback.h common.h util.h wutil.h highlight.h +halloc.o: config.h fallback.h util.h common.h halloc.h +halloc_util.o: config.h fallback.h util.h common.h halloc.h +highlight.o: signal.h config.h fallback.h util.h wutil.h highlight.h highlight.o: tokenizer.h proc.h io.h parser.h event.h parse_util.h builtin.h -highlight.o: function.h env.h expand.h sanity.h complete.h output.h -history.o: config.h fallback.h common.h util.h wutil.h history.h reader.h +highlight.o: function.h env.h expand.h sanity.h common.h complete.h output.h +highlight.o: halloc.h halloc_util.h +history.o: config.h fallback.h util.h wutil.h history.h common.h reader.h history.o: env.h sanity.h signal.h -input.o: config.h signal.h fallback.h common.h util.h wutil.h reader.h proc.h -input.o: io.h sanity.h input_common.h input.h parser.h event.h env.h expand.h -input.o: translate.h output.h -input_common.o: config.h fallback.h common.h util.h wutil.h input_common.h +input.o: config.h signal.h fallback.h util.h wutil.h reader.h proc.h io.h +input.o: common.h sanity.h input_common.h input.h parser.h event.h env.h +input.o: expand.h translate.h output.h +input_common.o: config.h fallback.h util.h common.h wutil.h input_common.h input_common.o: env_universal.h env_universal_common.h -intern.o: config.h fallback.h common.h util.h wutil.h intern.h -io.o: config.h fallback.h common.h util.h wutil.h exec.h proc.h io.h +intern.o: config.h fallback.h util.h wutil.h common.h intern.h +io.o: config.h fallback.h util.h wutil.h exec.h proc.h io.h common.h io.o: translate.h halloc.h -key_reader.o: fallback.h common.h util.h input_common.h -kill.o: signal.h config.h fallback.h common.h util.h wutil.h kill.h proc.h -kill.o: io.h sanity.h env.h exec.h parser.h event.h -main.o: config.h signal.h fallback.h common.h util.h reader.h builtin.h +key_reader.o: config.h fallback.h input_common.h +kill.o: signal.h config.h fallback.h util.h wutil.h kill.h proc.h io.h +kill.o: sanity.h common.h env.h exec.h parser.h event.h halloc.h +main.o: config.h signal.h fallback.h util.h common.h reader.h builtin.h main.o: function.h complete.h wutil.h env.h sanity.h proc.h io.h parser.h main.o: event.h expand.h intern.h exec.h output.h translate.h halloc_util.h main.o: history.h -mimedb.o: config.h xdgmime.h fallback.h common.h util.h -output.o: config.h signal.h fallback.h common.h util.h wutil.h expand.h +mimedb.o: config.h xdgmime.h fallback.h util.h +output.o: config.h signal.h fallback.h util.h wutil.h expand.h common.h output.o: output.h halloc_util.h highlight.h -parser.o: signal.h config.h fallback.h common.h util.h wutil.h proc.h io.h +parser.o: signal.h config.h fallback.h util.h common.h wutil.h proc.h io.h parser.o: parser.h event.h tokenizer.h exec.h wildcard.h function.h builtin.h -parser.o: builtin_help.h env.h expand.h reader.h sanity.h env_universal.h +parser.o: env.h expand.h reader.h sanity.h env_universal.h parser.o: env_universal_common.h translate.h intern.h parse_util.h halloc.h parser.o: halloc_util.h -parse_util.o: config.h fallback.h common.h util.h wutil.h tokenizer.h +parse_util.o: config.h fallback.h util.h wutil.h common.h tokenizer.h parse_util.o: parse_util.h expand.h intern.h exec.h proc.h io.h env.h parse_util.o: wildcard.h halloc_util.h -proc.o: config.h signal.h fallback.h common.h util.h wutil.h proc.h io.h +proc.o: config.h signal.h fallback.h util.h wutil.h proc.h io.h common.h proc.o: reader.h sanity.h env.h parser.h event.h translate.h halloc.h proc.o: halloc_util.h output.h -reader.o: config.h signal.h fallback.h common.h util.h wutil.h highlight.h -reader.o: reader.h proc.h io.h parser.h event.h complete.h history.h sanity.h +reader.o: config.h signal.h fallback.h util.h wutil.h highlight.h reader.h +reader.o: proc.h io.h parser.h event.h complete.h history.h common.h sanity.h reader.o: env.h exec.h expand.h tokenizer.h kill.h input_common.h input.h reader.o: function.h output.h translate.h parse_util.h -refcount.o: config.h fallback.h common.h util.h wutil.h refcount.h -sanity.o: signal.h config.h fallback.h common.h util.h sanity.h proc.h io.h +sanity.o: signal.h config.h fallback.h util.h common.h sanity.h proc.h io.h sanity.o: history.h reader.h kill.h wutil.h translate.h set_color.o: config.h signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h signal.o: reader.h proc.h io.h translate.h -tokenizer.o: config.h fallback.h common.h util.h wutil.h tokenizer.h +tokenizer.o: config.h fallback.h util.h wutil.h tokenizer.h common.h tokenizer.o: wildcard.h translate.h translate.o: config.h common.h util.h fallback.h halloc_util.h -util.o: config.h fallback.h common.h util.h wutil.h -wgetopt.o: config.h wgetopt.h wutil.h fallback.h common.h util.h translate.h -wildcard.o: config.h fallback.h common.h util.h wutil.h complete.h wildcard.h +util.o: config.h fallback.h util.h common.h wutil.h +wgetopt.o: config.h wgetopt.h wutil.h fallback.h translate.h +wildcard.o: config.h fallback.h util.h wutil.h complete.h common.h wildcard.h wildcard.o: reader.h expand.h translate.h -wutil.o: config.h fallback.h common.h util.h wutil.h +wutil.o: config.h fallback.h util.h common.h wutil.h xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h xdgmime.o: xdgmimeparent.h diff --git a/builtin.c b/builtin.c index e896ac916..e1997b20a 100644 --- a/builtin.c +++ b/builtin.c @@ -54,7 +54,6 @@ #include "wgetopt.h" #include "sanity.h" #include "tokenizer.h" -#include "builtin_help.h" #include "wildcard.h" #include "input_common.h" #include "input.h" @@ -67,6 +66,13 @@ #include "parse_util.h" #include "expand.h" +#include "builtin_help.c" +#include "builtin_set.c" +#include "builtin_commandline.c" +#include "builtin_complete.c" +#include "builtin_ulimit.c" +#include "builtin_jobs.c" + /** The default prompt for the read command */ @@ -2942,8 +2948,6 @@ void builtin_init() hash_put( &builtin, builtin_data[i].name, builtin_data[i].func ); intern_static( builtin_data[i].name ); } - - builtin_help_init(); } void builtin_destroy() @@ -2957,7 +2961,6 @@ void builtin_destroy() al_destroy( &io_stack ); hash_destroy( &builtin ); - builtin_help_destroy(); } int builtin_exists( wchar_t *cmd ) diff --git a/builtin.h b/builtin.h index 95d837670..511a046b2 100644 --- a/builtin.h +++ b/builtin.h @@ -150,36 +150,6 @@ int builtin_count_args( wchar_t **argv ); void builtin_print_help( wchar_t *cmd, string_buffer_t *b ); -/** - The set builtin, used for setting variables. Defined in - builtin_set.c. -*/ -int builtin_set(wchar_t **argv); - -/** - The commandline builtin, used for setting and getting the contents - of the commandline. Defined in builtin_commandline.c. -*/ -int builtin_commandline(wchar_t **argv); - -/** - The ulimit builtin, used for setting resource limits. Defined in - builtin_ulimit.c. -*/ -int builtin_ulimit(wchar_t **argv); - -/** - The complete builtin. Used for specifying programmable - tab-completions. Calls the functions in complete.c for any heavy - lifting. Defined in builtin_complete.c -*/ -int builtin_complete(wchar_t **argv); - -/** - The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c. -*/ -int builtin_jobs(wchar_t **argv); - const wchar_t *builtin_complete_get_temporary_buffer(); /** @@ -189,4 +159,13 @@ const wchar_t *builtin_complete_get_temporary_buffer(); */ void builtin_wperror( const wchar_t *s); +/** + Return the help text for the specified builtin command. Use + non-wide characters since wide characters have some issues with + string formating escape sequences sometimes. + + \param cmd The command for which to obtain help text +*/ +char *builtin_help_get( wchar_t *cmd ); + #endif diff --git a/builtin_commandline.c b/builtin_commandline.c index 3d0f77e0b..19e604715 100644 --- a/builtin_commandline.c +++ b/builtin_commandline.c @@ -195,7 +195,7 @@ static void write_part( const wchar_t *begin, The commandline builtin. It is used for specifying a new value for the commandline. */ -int builtin_commandline( wchar_t **argv ) +static int builtin_commandline( wchar_t **argv ) { int buffer_part=0; diff --git a/builtin_complete.c b/builtin_complete.c index 1519f5db2..e93f9cde3 100644 --- a/builtin_complete.c +++ b/builtin_complete.c @@ -249,7 +249,12 @@ const wchar_t *builtin_complete_get_temporary_buffer() return temporary_buffer; } -int builtin_complete( wchar_t **argv ) +/** + The complete builtin. Used for specifying programmable + tab-completions. Calls the functions in complete.c for any heavy + lifting. Defined in builtin_complete.c +*/ +static int builtin_complete( wchar_t **argv ) { int res=0; int argc=0; diff --git a/builtin_help.h b/builtin_help.h deleted file mode 100644 index c831b3e41..000000000 --- a/builtin_help.h +++ /dev/null @@ -1,32 +0,0 @@ -/** \file builtin_help.h - - Prototypes for functions for printing usage information of builtin commands. The - corresponding .c file is automatically generated by combining the - builtin_help.hdr file with doxygen output. -*/ - -#ifndef FISH_BUILTIN_HELP_H -#define FISH_BUILTIN_HELP_H - -#include - -/** - Return the help text for the specified builtin command. Use - non-wide characters since wide characters have some issues with - string formating escape sequences sometimes. - - \param cmd The command for which to obtain help text -*/ -char *builtin_help_get( wchar_t *cmd ); - -/** - Initialize builtin help data -*/ -void builtin_help_init(); - -/** - Destory builtin help data -*/ -void builtin_help_destroy(); - -#endif diff --git a/builtin_help.hdr b/builtin_help.hdr index 7507fae29..c2671a5f3 100644 --- a/builtin_help.hdr +++ b/builtin_help.hdr @@ -14,24 +14,28 @@ #include "config.h" #include "util.h" #include "common.h" -#include "builtin_help.h" +#include "halloc_util.h" + +static int is_help_init=0; /** Hashtable storing the help text */ static hash_table_t tbl; +static void builtin_help_init(); + char *builtin_help_get( wchar_t *cmd ) { + if( !is_help_init ) + { + builtin_help_init(); + } return (char *)hash_get( &tbl, (void *)cmd ); } -void builtin_help_destroy() -{ - hash_destroy( &tbl ); -} - - -void builtin_help_init() +static void builtin_help_init() { + is_help_init = 1; + halloc_register_function( global_context, (void (*)(void *))&hash_destroy, &tbl ); hash_init( &tbl, &hash_wcs_func, &hash_wcs_cmp ); diff --git a/builtin_jobs.c b/builtin_jobs.c index 0a3f2d707..a527fdf0e 100644 --- a/builtin_jobs.c +++ b/builtin_jobs.c @@ -158,7 +158,10 @@ static void builtin_jobs_print( job_t *j, int mode, int header ) -int builtin_jobs( wchar_t **argv ) +/** + The jobs builtin. Used fopr printing running jobs. Defined in builtin_jobs.c. +*/ +static int builtin_jobs( wchar_t **argv ) { int argc=0; int found=0; diff --git a/builtin_set.c b/builtin_set.c index 1e3e42b15..6841aeb48 100644 --- a/builtin_set.c +++ b/builtin_set.c @@ -381,7 +381,7 @@ static void print_variables(int include_values, int esc, int scope) The set builtin. Creates, updates and erases environment variables and environemnt variable arrays. */ -int builtin_set( wchar_t **argv ) +static int builtin_set( wchar_t **argv ) { /** diff --git a/builtin_ulimit.c b/builtin_ulimit.c index d03521939..6b8c7b7ee 100644 --- a/builtin_ulimit.c +++ b/builtin_ulimit.c @@ -257,7 +257,11 @@ static int set_all( int hard, int soft, rlim_t value ) return res; } -int builtin_ulimit( wchar_t ** argv ) +/** + The ulimit builtin, used for setting resource limits. Defined in + builtin_ulimit.c. +*/ +static int builtin_ulimit( wchar_t ** argv ) { int hard=0; int soft=0; diff --git a/common.c b/common.c index f9bfdca84..9475fd64c 100644 --- a/common.c +++ b/common.c @@ -61,6 +61,11 @@ parts of fish. #include "wildcard.h" #include "parser.h" +#include "util.c" +#include "halloc.c" +#include "halloc_util.c" +#include "fallback.c" + /** The number of milliseconds to wait between polls when attempting to acquire a lockfile diff --git a/parser.c b/parser.c index b717bda2f..daedbdad5 100644 --- a/parser.c +++ b/parser.c @@ -31,7 +31,6 @@ The fish parser. Contains functions for parsing code. #include "wildcard.h" #include "function.h" #include "builtin.h" -#include "builtin_help.h" #include "env.h" #include "expand.h" #include "reader.h" @@ -256,11 +255,14 @@ The fish parser. Contains functions for parsing code. Size of the error string buffer */ #define ERR_STR_SZ 1024 + /** Last error code */ -int error_code; +static int error_code; event_block_t *global_event_block=0; +io_data_t *block_io; + /** Position of last error */ static int err_pos; @@ -288,8 +290,6 @@ static array_list_t *forbidden_function; */ static int job_start_pos; -io_data_t *block_io; - /** List of all profiling data */ diff --git a/parser.h b/parser.h index 604289360..e82a6e7f9 100644 --- a/parser.h +++ b/parser.h @@ -191,10 +191,6 @@ extern block_t *current_block; /** Global event blocks */ extern event_block_t *global_event_block; - -/** The current error code */ -extern int error_code; - /** Current block level io redirections */ diff --git a/proc.c b/proc.c index b3519e2df..56c43ebd0 100644 --- a/proc.c +++ b/proc.c @@ -171,6 +171,7 @@ void proc_destroy() void proc_set_last_status( int s ) { + last_status = s; // fwprintf( stderr, L"Set last status to %d\n", s ); }