// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/PrayerModule.java
// static CalcMethod calc_methods[] = {
//         new CalcMethod(MethodId.MWL, "Muslim World League (MWL)",
//                 IshaFlag.ANGLE, 18, 17),
//         new CalcMethod(MethodId.ISNA, "Islamic Society of North America (ISNA)",
//                 IshaFlag.ANGLE, 15, 15),
//         new CalcMethod(MethodId.EGAS, "Egyptian General Authority of Survey",
//                 IshaFlag.ANGLE, 19.5, 17.5),
//         new CalcMethod(MethodId.UMAQ, "Umm Al-Qura University, Makkah",
//                 IshaFlag.OFFSET, 18.5, 90),
//         new CalcMethod(MethodId.UIS, "University of Islamic Sciences, Karachi",
//                 IshaFlag.ANGLE, 18, 18)
// };


import java.io.IOException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.arabeyes.itl.newmethod.PrayerModule.calc_methods;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import java.io.BufferedReader;
import java.io.FileReader;
                    print_usage();
                    return 1;
                }
                config_from_file = 1;
                i++;
            } else if ("-h".equals(args[i])) {
                i++;
                print_usage();
                return 1;
            } else {
                System.err.printf("Invalid option\n");
                print_usage();
                return 1;
            }
        }

        /* By this point, command line parsing should have
         * been done successfully... */
        if (date_set == 0) {
            /* Original C: TODO: localtime is not thread safe, however,
             * it is the only portable one... */
            localtime(date);
        }

        if (config_from_file == 0) {
            set_default_location(loc);
        }
        return 0;
    }

// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class date_t {
//     int year, month, day;
// 
//     /**
//      * @param day starts from 1
//      * @param month starts from 1, like the old ITL
//      */
//     date_t set(int day, int month, int year) {
//         this.year = year;
//         this.month = month;
//         this.day = day;
//         return this;
//     }
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/DefsModule.java
// static class location {
//     /* In original C: The struct members ordering guarantees that the compiler does
//      * not add any padding bytes when compiling for 64-bit machines */
// 
//     double longitude;   /* Observer's longitude */
//     double latitude;    /* Observer's latitude */
//     double altitude;    /* Observer's altitude in meters */
//     double timezone;    /* Observer's timezone (in hours) relative
//                               to Universal Coordinated Time (UTC) */
//     int daylight;    /* Daylight Savings Time (DST) Flag
//                               Set to 1 if DST is on, 0 otherwise */
//     AsrMethod asr_method;  /* Asr Method: Shafii or Hanafi */
//     CalcMethod calc_method; /* Fajr and Isha Calculation method */
//     ExtremeMethod extr_method; /* Extreme latitude method */
//     String name;    /* Observer's location name */
// }
// 
// Path: itl/src/main/java/org/arabeyes/itl/newmethod/PrayerModule.java
// static CalcMethod calc_methods[] = {
//         new CalcMethod(MethodId.MWL, "Muslim World League (MWL)",
//                 IshaFlag.ANGLE, 18, 17),
//         new CalcMethod(MethodId.ISNA, "Islamic Society of North America (ISNA)",
//                 IshaFlag.ANGLE, 15, 15),
//         new CalcMethod(MethodId.EGAS, "Egyptian General Authority of Survey",
//                 IshaFlag.ANGLE, 19.5, 17.5),
//         new CalcMethod(MethodId.UMAQ, "Umm Al-Qura University, Makkah",
//                 IshaFlag.OFFSET, 18.5, 90),
//         new CalcMethod(MethodId.UIS, "University of Islamic Sciences, Karachi",
//                 IshaFlag.ANGLE, 18, 18)
// };


// Path: itl/src/main/java/org/arabeyes/itl/newmethod/ConfigModule.java
import java.io.IOException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.arabeyes.itl.newmethod.PrayerModule.calc_methods;
import org.arabeyes.itl.newmethod.DefsModule.date_t;
import org.arabeyes.itl.newmethod.DefsModule.location;
import java.io.BufferedReader;
import java.io.FileReader;

                    print_usage();
                    return 1;
                }
                config_from_file = 1;
                i++;
            } else if ("-h".equals(args[i])) {
                i++;
                print_usage();
                return 1;
            } else {
                System.err.printf("Invalid option\n");
                print_usage();
                return 1;
            }
        }

        /* By this point, command line parsing should have
         * been done successfully... */
        if (date_set == 0) {
            /* Original C: TODO: localtime is not thread safe, however,
             * it is the only portable one... */
            localtime(date);
        }

        if (config_from_file == 0) {
            set_default_location(loc);
        }
        return 0;
    }

    private static void localtime(date_t date) {