diff options
author | Andrew Shadura <andrew.shadura@collabora.co.uk> | 2016-09-20 10:53:53 +0200 |
---|---|---|
committer | Andrew Shadura <andrew.shadura@collabora.co.uk> | 2016-09-20 10:53:53 +0200 |
commit | 45aaf5ce2b9346cf69960a16b79a2ff9c437abfb (patch) | |
tree | d9031ef624c296bcefdb64f1f85d2ab6199d12ee /src | |
parent | f4f1836a959667709d73ae5a67283d99759bf7ee (diff) |
Imported Upstream version 3.8.2+20160226+ea7138c
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.in | 231 | ||||
-rw-r--r-- | src/args.c | 71 | ||||
-rw-r--r-- | src/main.c | 170 |
3 files changed, 270 insertions, 202 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index b691f25..d507109 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,23 +15,61 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -53,12 +90,16 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = seed$(EXEEXT) subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/intltool.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -70,9 +111,22 @@ seed_DEPENDENCIES = ../libseed/libseed@SEED_GTK_VERSION@.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = seed_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(seed_CFLAGS) $(CFLAGS) \ $(seed_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -85,20 +139,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(seed_SOURCES) DIST_SOURCES = $(seed_SOURCES) am__can_run_installinfo = \ @@ -106,8 +156,26 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ @@ -171,6 +239,8 @@ GDK_LIBS = @GDK_LIBS@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GIO_CFLAGS = @GIO_CFLAGS@ GIO_LIBS = @GIO_LIBS@ +GMODULE_CFLAGS = @GMODULE_CFLAGS@ +GMODULE_LIBS = @GMODULE_LIBS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_JS_CFLAGS = @GNOME_JS_CFLAGS@ @@ -184,6 +254,7 @@ GREP = @GREP@ GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ GTHREAD_LIBS = @GTHREAD_LIBS@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -209,6 +280,7 @@ INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -220,6 +292,7 @@ LIBXSS_LIBS = @LIBXSS_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -252,6 +325,7 @@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SED = @SED@ SEED_DEBUG_CFLAGS = @SEED_DEBUG_CFLAGS@ +SEED_GJSCOMPAT_CFLAGS = @SEED_GJSCOMPAT_CFLAGS@ SEED_GTK_VERSION = @SEED_GTK_VERSION@ SEED_PROFILE_CFLAGS = @SEED_PROFILE_CFLAGS@ SEED_PROFILE_LIBS = @SEED_PROFILE_LIBS@ @@ -362,7 +436,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -389,10 +462,12 @@ install-binPROGRAMS: $(bin_PROGRAMS) fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -413,7 +488,8 @@ uninstall-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ + -e 's/$$/$(EXEEXT)/' \ + `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files @@ -426,6 +502,7 @@ clean-binPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + seed$(EXEEXT): $(seed_OBJECTS) $(seed_DEPENDENCIES) $(EXTRA_seed_DEPENDENCIES) @rm -f seed$(EXEEXT) $(AM_V_CCLD)$(seed_LINK) $(seed_OBJECTS) $(seed_LDADD) $(LIBS) @@ -444,14 +521,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -494,26 +571,15 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -525,15 +591,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -542,6 +604,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -685,19 +762,21 @@ uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. @@ -26,60 +26,59 @@ #include "config.h" extern gboolean seed_interpreter_arg_print_version; -extern gchar *seed_interpreter_arg_exec_string; +extern gchar* seed_interpreter_arg_exec_string; static GOptionEntry seed_args[] = { - {"version", 0, 0, G_OPTION_ARG_NONE, &seed_interpreter_arg_print_version, - "Print interpreter version", 0}, - {"execute", 'e', 0, G_OPTION_ARG_STRING, &seed_interpreter_arg_exec_string, - "Pass program in as string", "expression"}, - {NULL,}, + { "version", 0, 0, G_OPTION_ARG_NONE, &seed_interpreter_arg_print_version, + "Print interpreter version", 0 }, + { "execute", 'e', 0, G_OPTION_ARG_STRING, &seed_interpreter_arg_exec_string, + "Pass program in as string", "expression" }, + { + NULL, + }, }; - -static GOptionGroup * -seed_interpreter_get_option_group (void) +static GOptionGroup* +seed_interpreter_get_option_group(void) { - GOptionGroup *group; + GOptionGroup* group; - group = g_option_group_new ("seed-interpreter", "Interpreter Options", - "Show Interpreter Options", NULL, NULL); - g_option_group_add_entries (group, seed_args); + group = g_option_group_new("seed-interpreter", "Interpreter Options", + "Show Interpreter Options", NULL, NULL); + g_option_group_add_entries(group, seed_args); - return group; + return group; } gboolean -seed_interpreter_parse_args (int *argc, char ***argv) +seed_interpreter_parse_args(int* argc, char*** argv) { - GOptionContext *option_context; - GOptionGroup *interpreter_group; + GOptionContext* option_context; + GOptionGroup* interpreter_group; - GError *error = NULL; - gboolean ret = TRUE; + GError* error = NULL; + gboolean ret = TRUE; - option_context = g_option_context_new (NULL); - g_option_context_set_ignore_unknown_options (option_context, TRUE); - g_option_context_set_help_enabled (option_context, TRUE); + option_context = g_option_context_new(NULL); + g_option_context_set_ignore_unknown_options(option_context, TRUE); + g_option_context_set_help_enabled(option_context, TRUE); - /* Initiate any command line options from the backend */ + /* Initiate any command line options from the backend */ - interpreter_group = seed_interpreter_get_option_group (); - g_option_context_set_main_group (option_context, interpreter_group); - g_option_context_add_group (option_context, seed_get_option_group ()); + interpreter_group = seed_interpreter_get_option_group(); + g_option_context_set_main_group(option_context, interpreter_group); + g_option_context_add_group(option_context, seed_get_option_group()); - if (!g_option_context_parse (option_context, argc, argv, &error)) - { - if (error) - { - g_warning ("%s", error->message); - g_error_free (error); - } + if (!g_option_context_parse(option_context, argc, argv, &error)) { + if (error) { + g_warning("%s", error->message); + g_error_free(error); + } - ret = FALSE; + ret = FALSE; } - g_option_context_free (option_context); + g_option_context_free(option_context); - return ret; + return ret; } @@ -27,138 +27,128 @@ #define DEFAULT_PATH "." -SeedEngine *eng; +SeedEngine* eng; gboolean seed_interpreter_arg_print_version; -gchar *seed_interpreter_arg_exec_string; +gchar* seed_interpreter_arg_exec_string; -gboolean seed_interpreter_parse_args (int *argc, char ***argv); +gboolean seed_interpreter_parse_args(int* argc, char*** argv); static void -seed_repl () +seed_repl() { - SeedScript *script; - SeedException e; + SeedScript* script; + SeedException e; - script = seed_make_script (eng->context, "repl = imports.repl", NULL, 0); + script = seed_make_script(eng->context, "repl = imports.repl", NULL, 0); - if ((e = seed_script_exception (script))) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); + if ((e = seed_script_exception(script))) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); } - seed_evaluate (eng->context, script, 0); + seed_evaluate(eng->context, script, 0); - if ((e = seed_script_exception (script))) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); + if ((e = seed_script_exception(script))) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); } - g_free (script); + g_free(script); } static void -seed_exec (gchar * filename) +seed_exec(gchar* filename) { - SeedObject global; - SeedScript *script; - SeedException e; - gchar *buffer; + SeedObject global; + SeedScript* script; + SeedException e; + gchar* buffer; - g_file_get_contents (filename, &buffer, 0, 0); + g_file_get_contents(filename, &buffer, 0, 0); - if (!buffer) - { - g_critical ("File %s not found!", filename); - exit (EXIT_FAILURE); + if (!buffer) { + g_critical("File %s not found!", filename); + exit(EXIT_FAILURE); } - if (*buffer == '#') - { - while (*buffer != '\n') - buffer++; - buffer++; + if (*buffer == '#') { + while (*buffer != '\n') + buffer++; + buffer++; } - script = seed_make_script (eng->context, buffer, filename, 1); + script = seed_make_script(eng->context, buffer, filename, 1); - if ((e = seed_script_exception (script))) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); + if ((e = seed_script_exception(script))) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); } - global = seed_context_get_global_object (eng->context); - seed_importer_add_global (global, filename); + global = seed_context_get_global_object(eng->context); + seed_importer_add_global(global, filename); - seed_evaluate (eng->context, script, 0); - if ((e = seed_script_exception (script))) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); + seed_evaluate(eng->context, script, 0); + if ((e = seed_script_exception(script))) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); } - g_free (script); + g_free(script); } static void -seed_exec_str () +seed_exec_str() { - SeedException e = NULL; - SeedValue val; - gchar *val_str; - - val = - seed_simple_evaluate (eng->context, seed_interpreter_arg_exec_string, &e); - - if (e) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); + SeedException e = NULL; + SeedValue val; + gchar* val_str; + + val = seed_simple_evaluate(eng->context, seed_interpreter_arg_exec_string, + &e); + + if (e) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); + } else { + val_str = seed_value_to_string(eng->context, val, &e); + if (e) { + g_critical("%s", seed_exception_to_string(eng->context, e)); + exit(EXIT_FAILURE); + } + + g_print("%s\n", val_str); + g_free(seed_interpreter_arg_exec_string); + g_free(val_str); + + exit(EXIT_SUCCESS); } - else - { - val_str = seed_value_to_string (eng->context, val, &e); - if (e) - { - g_critical ("%s", seed_exception_to_string (eng->context, e)); - exit (EXIT_FAILURE); - } - - g_print ("%s\n", val_str); - g_free (seed_interpreter_arg_exec_string); - g_free (val_str); - - exit (EXIT_SUCCESS); - } - } gint -main (gint argc, gchar ** argv) +main(gint argc, gchar** argv) { - g_set_prgname ("seed"); - g_thread_init (NULL); + g_set_prgname("seed"); +#if !GLIB_CHECK_VERSION(2, 32, 0) + g_thread_init(NULL); +#endif - seed_interpreter_parse_args (&argc, &argv); + seed_interpreter_parse_args(&argc, &argv); - if (seed_interpreter_arg_print_version) - { - g_print ("%s\n", "Seed " VERSION); - exit (EXIT_SUCCESS); + if (seed_interpreter_arg_print_version) { + g_print("%s\n", "Seed " VERSION); + exit(EXIT_SUCCESS); } - eng = seed_init (&argc, &argv); + eng = seed_init(&argc, &argv); - seed_engine_set_search_path (eng, DEFAULT_PATH); + seed_engine_set_search_path(eng, DEFAULT_PATH); - if (seed_interpreter_arg_exec_string) - seed_exec_str (); - else if (argc == 1) - seed_repl (); - else - seed_exec (argv[1]); + if (seed_interpreter_arg_exec_string) + seed_exec_str(); + else if (argc == 1) + seed_repl(); + else + seed_exec(argv[1]); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } |