void FC_FUNC_(getopt_help, GETOPT_HELP) (STR_F_TYPE mode, STR_F_TYPE name STR_ARG2) { int c; #if defined(HAVE_GETOPT_LONG) static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"list", no_argument, 0, 'l'}, {"search", required_argument, 0, 's'}, {"print", required_argument, 0, 'p'}, {0, 0, 0, 0} }; #endif while (1) { int option_index = 0; #if defined(HAVE_GETOPT_LONG) c = getopt_long(argc, argv, "hvls:p:", long_options, &option_index); #else c = getopt(argc, argv, "hvls:p:"); #endif if(argc==1) help_help(); if (c == -1) break; switch (c) { case 'h': help_help(); break; case 'v': printf("octopus %s (svn version %s)\n", PACKAGE_VERSION, LATEST_SVN); exit(0); case 'l': TO_F_STR1("list", mode); return; case 's': TO_F_STR1("search", mode); TO_F_STR2(optarg, name); return; case 'p': TO_F_STR1("print", mode); TO_F_STR2(optarg, name); return; } } if (optind < argc) help_help(); }
void FC_FUNC_(oct_getcwd, OCT_GETCWD) (STR_F_TYPE name STR_ARG1) { char s[256]; getcwd(s, 256); TO_F_STR1(s, name); }
void FC_FUNC_(oct_strerror, OCT_STRERROR) (const int *err, STR_F_TYPE res STR_ARG1) { const char *c; c = gsl_strerror(*err); TO_F_STR1(c, res); }
void FC_FUNC_(getopt_harmonic_spectrum, GETOPT_HARMONIC_SPECTRUM) (double *w0, int *m, STR_F_TYPE pol STR_ARG1) { int c; #if defined(HAVE_GETOPT_LONG) static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"freq", required_argument, 0, 'w'}, {"pol", required_argument, 0, 'p'}, {"mode", required_argument, 0, 'm'}, {0, 0, 0, 0} }; #endif while (1) { int option_index = 0; #if defined(HAVE_GETOPT_LONG) c = getopt_long(argc, argv, "hvw:p:m:", long_options, &option_index); #else c = getopt(argc, argv, "hvw:p:m:"); #endif if (c == -1) break; switch (c) { case 'h': harmonic_spectrum_help(); break; case 'v': printf("octopus %s (svn version %s)\n", PACKAGE_VERSION, LATEST_SVN); exit(0); case 'w': *w0 = (double)atof(optarg); break; case 'p': TO_F_STR1(optarg, pol); break; case 'm': *m = (int)atoi(optarg); break; } } }
void FC_FUNC_(getopt_propagation_spectrum, GETOPT_PROPAGATION_SPECTRUM) (STR_F_TYPE fname STR_ARG1) { int c; #if defined(HAVE_GETOPT_LONG) static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"reference", required_argument, 0, 'r'}, {0, 0, 0, 0} }; #endif while (1) { int option_index = 0; #if defined(HAVE_GETOPT_LONG) c = getopt_long(argc, argv, "hvr:", long_options, &option_index); #else c = getopt(argc, argv, "hvr:"); #endif if (c == -1) break; switch (c) { case 'h': propagation_spectrum_help(); break; case 'v': printf("octopus %s (svn version %s)\n", PACKAGE_VERSION, LATEST_SVN); exit(0); case 'r': TO_F_STR1(optarg, fname); break; } } if (optind < argc) propagation_spectrum_help(); }
void FC_FUNC_(getopt_oscillator_strength, GETOPT_OSCILLATOR_STRENGTH) (int *mode, double *omega, double *searchinterval, int *order, int *nresonances, int *nfrequencies, double *time, int *l, int *m, double *damping, STR_F_TYPE ffile STR_ARG1) { int c; /* This line would be present if we wanted to make the omega a mandatory argument. But for the moment I think it should not be mandatory. if(argc==1) oscillator_strength_help(); */ while (1) { c = getopt(argc, argv, "hm:s:k:O:r:n:t:d:f:"); if (c == -1) break; switch (c) { case 'h': oscillator_strength_help(); break; case 'm': *mode = (int)atoi(optarg); break; case 's': *searchinterval = (double)atof(optarg); break; case 'O': c = sscanf(optarg, "(%d,%d)", l, m); if(c != 2){ switch (optarg[0]){ case 'x': *l = 0; *m = 1; break; case 'y': *l = 0; *m = 2; break; case 'z': *l = 0; *m = 3; break; default: printf("Problem reading the -O option value.\n\n"); oscillator_strength_help(); } } break; case 'k': *order = (int)atoi(optarg); break; case 'r': *nresonances = (int)atoi(optarg); break; case 'n': *nfrequencies = (int)atoi(optarg); break; case 't': *time = (double)atof(optarg); break; case 'f': TO_F_STR1(optarg, ffile); break; case 'd': *damping = (double)atof(optarg); break; case '?': oscillator_strength_help(); break; } } if (optind < argc) { while (optind < argc) *omega = (double)atof(argv[optind++]); } }