]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.7
authorfred <fred>
Sun, 24 Mar 2002 19:51:02 +0000 (19:51 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:51:02 +0000 (19:51 +0000)
flower/include/lgetopt.hh
lily/main.cc

index 6db9cd4dfdb7c0ea8a24d8eb1740e837703807a8..89b0196bf28e61dd94722694ec35b2c99738ec92 100644 (file)
@@ -14,7 +14,7 @@ struct Long_option_init {
     char const * longname;
     char        shortname;
 
-    ostream &printon(ostream &errorout);
+    void printon(ostream &errorout)const ;
 };
 
 
@@ -28,54 +28,56 @@ struct Long_option_init {
   argument reordering
   */
 class Getopt_long {
-public:
-    /** errorcodes: no error, argument expected, no argument expected,
-      unknown option, illegal argument (eg. int expected).  */
-    enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
-               E_ILLEGALARG } ;
-
-
-private:
 
     /// the option info.
-    Long_option_init *the_opts;
-    int table_len;
+    const Long_option_init *option_a_;
+    int table_len_i_;
     
-    /// if doing short option, argv[optind][optindind] is processed next.
-    int optindind;
+    /// if doing short option, arg_value_ch_a_a_[optind][optindind] is processed next.
+    int argument_index_i_;
 
     /// the option found
-    Long_option_init *beet;
+    const Long_option_init *found_option_l_;
 
-    /// get ready for processing next error.
-    bool next();
-    Long_option_init *parselong();
-    Long_option_init *parseshort();
-    
-    ostream *errorout;
 
-    /// report an error and abort
-    void report(Errorcod c);
-public:
+public: 
+    /** errorcodes: no error, argument expected, no argument expected,
+      unknown option, illegal argument (eg. int expected).  */
+    enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
+               E_ILLEGALARG } ;
 
     /// argument. Set to 0 if not present
-    char* optarg;
+    char const * optional_argument_ch_C_;
 
     /// current error status
-    Errorcod error;
+    Errorcod error_;
 
-    /// return an integer (with err. detect)
-    long intarg();
-    /// argv[optind] will be processed next.
-    int optind;
+    /// arg_value_ch_a_a_[array_index_i_] will be processed next.
+    int array_index_i_;
 
     /// the arguments
-    char **argv;
+    char **arg_value_ch_a_a_;
 
     /// the arg. count
-    int argc;
-    
-    /* *************** */
+    int argument_count_i_;
+
+    ostream *error_ostream_l_;
+
+public:
+    /// get ready for processing next error.
+    void next();
+    const Long_option_init *parselong();
+    const Long_option_init *parseshort();
+    void OK()const;
+    bool ok() const;
+
+    /// report an error and abort
+    void report(Errorcod c);
+
+
+    /// return an integer (with err. detect)
+    long argument_to_i();
     
     /**
       What to do with  errors. 
@@ -92,9 +94,9 @@ public:
       @return pointer to next option found.
       0 if error occurred, or next argument is no option.
       */
-    Long_option_init *operator()();
+    const Long_option_init *operator()();
 
-    char *current_arg();
-    char * get_next_arg();
+    char const *current_arg();
+    char const * get_next_arg();
 };
 #endif
index a87d9b28852241a821362f4e8bec1608094afa42..eff3d6cc811f3244dd57a039a9284ffb18264adc 100644 (file)
@@ -23,6 +23,7 @@
 Sources* source_l_g = 0;
 bool only_midi = false;
 bool version_ignore_b_ = false;
+int exit_status_i_;
 
 void destill_inname( String &name_str_r);
 
@@ -65,7 +66,10 @@ usage()
 #ifdef STRING_UTILS_INLINED
        "STRING_UTILS_INLINED "
 #endif
-       "datadir= " DIR_DATADIR "\n" 
+       "datadir= " DIR_DATADIR 
+
+       "\n";
+       
        ;
     
     
@@ -76,13 +80,10 @@ notice()
 {
     cout <<
        "\n"
-       "GNU LilyPond, a music typesetter.\n"
-       "Copyright (C) 1996,97 by\n"
+       "GNU LilyPond -- The GNU Project music typesetter.\n"
+       "Copyright 1996,97 by\n"
        "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
        "  Jan Nieuwenhuizen <jan@digicash.com>\n"
-       "Contributors\n"
-       "  Mats Bengtsson <matsb@s3.kth.se>\n"
-       "  Werner Lemberg <xlwy01@uxp1.hrz.uni-dortmund.de>\n"
        "\n"
        "    This program is free software; you can redistribute it and/or\n"
        "modify it under the terms of the GNU General Public License version 2\n"
@@ -106,7 +107,7 @@ void
 do_one_file(String init_str, String file_str)
 {
     if ( init_str != "" && "" == path.find( init_str ) ) {
-       error ( "Can not find `" + init_str +"'");
+       error ( "Can not find `" + init_str +"\'");
        return ;
     }
     if ( file_str!= "" && path.find( file_str ) == "" ) {
@@ -146,20 +147,20 @@ main (int argc, char **argv)
     cout << get_version_str() << endl;
     String init_str("symbol.ly");
     
-    while (Long_option_init * opt = oparser()) {
+    while (Long_option_init const * opt = oparser()) {
        switch ( opt->shortname){
        case 'o':
-           set_default_output(oparser.optarg);
+           set_default_output(oparser.optional_argument_ch_C_);
            break;
        case 'w':
            notice();
            exit(0);
            break;
        case 'I':
-           path.push(oparser.optarg);
+           path.push(oparser.optional_argument_ch_C_);
            break;
        case 'i':
-           init_str = oparser.optarg;
+           init_str = oparser.optional_argument_ch_C_;
            break;
        case 'h':
            usage();
@@ -181,7 +182,7 @@ main (int argc, char **argv)
     }
 
     int p=0;
-    char *arg ;
+    const char *arg ;
     while ( (arg= oparser.get_next_arg()) ) {
        String f(arg);
        destill_inname(f);
@@ -192,7 +193,7 @@ main (int argc, char **argv)
        do_one_file(init_str, "");      
     }
 
-    return 0;
+    return exit_status_i_;
 }
 
 /// make input file name: add default extension. "" is stdin.