ATerm lf_2 ( ATerm arg0 , ATerm arg1 ) { { ATerm tmp [ 2 ] ; FUNC_ENTRY ( lf_2sym , ATmakeAppl ( lf_2sym , arg0 , arg1 ) ) ; if ( check_sym ( arg1 , lf_list_1sym ) ) { ( tmp [ 1 ] = arg_0 ( arg1 ) ) ; { ATerm atmp1010 ; ATerm atmp100 [ 2 ] ; ( atmp100 [ 0 ] = tmp [ 1 ] ) ; ( atmp100 [ 1 ] = tmp [ 1 ] ) ; while ( not_empty_list ( tmp [ 1 ] ) ) { ( atmp1010 = list_head ( tmp [ 1 ] ) ) ; ( tmp [ 1 ] = list_tail ( tmp [ 1 ] ) ) ; if ( term_equal ( arg0 , atmp1010 ) ) { FUNC_EXIT_CONST ( constant0 , make_nf0 ( lf_3sym ) ) ; } ( atmp100 [ 1 ] = list_tail ( atmp100 [ 1 ] ) ) ; ( tmp [ 1 ] = atmp100 [ 1 ] ) ; } } } if ( check_sym ( arg1 , lf_list_1sym ) ) { { ATerm atmp10 = arg_0 ( arg1 ) ; FUNC_EXIT_CONST ( constant1 , make_nf0 ( lf_4sym ) ) ; } } FUNC_EXIT ( make_nf2 ( lf_2sym , arg0 , arg1 ) ) ; } }
ATerm lf_8 ( ATerm arg0 ) { { ATerm tmp [ 2 ] ; FUNC_ENTRY ( lf_8sym , ATmakeAppl ( lf_8sym , arg0 ) ) ; if ( check_sym ( arg0 , lf_list_6sym ) ) { ( tmp [ 1 ] = arg_0 ( arg0 ) ) ; { ATerm atmp001110 ; ATerm atmp00110 [ 2 ] ; ATerm atmp0010 ; ATerm atmp000 [ 2 ] ; ( atmp000 [ 0 ] = tmp [ 1 ] ) ; ( atmp000 [ 1 ] = tmp [ 1 ] ) ; while ( not_empty_list ( tmp [ 1 ] ) ) { ( atmp0010 = list_head ( tmp [ 1 ] ) ) ; ( tmp [ 1 ] = list_tail ( tmp [ 1 ] ) ) ; ( atmp00110 [ 0 ] = tmp [ 1 ] ) ; ( atmp00110 [ 1 ] = tmp [ 1 ] ) ; while ( not_empty_list ( tmp [ 1 ] ) ) { ( atmp001110 = list_head ( tmp [ 1 ] ) ) ; ( tmp [ 1 ] = list_tail ( tmp [ 1 ] ) ) ; if ( term_equal ( atmp0010 , atmp001110 ) ) { FUNC_EXIT ( lf_8_recursive ( cons ( slice ( atmp000 [ 0 ] , atmp000 [ 1 ] ) , cons ( make_list ( atmp0010 ) , cons ( slice ( atmp00110 [ 0 ] , atmp00110 [ 1 ] ) , tmp [ 1 ] ) ) ) ) ) ; } ( atmp00110 [ 1 ] = list_tail ( atmp00110 [ 1 ] ) ) ; ( tmp [ 1 ] = atmp00110 [ 1 ] ) ; } ( atmp000 [ 1 ] = list_tail ( atmp000 [ 1 ] ) ) ; ( tmp [ 1 ] = atmp000 [ 1 ] ) ; } } } FUNC_EXIT ( make_nf1 ( lf_8sym , arg0 ) ) ; } }
int z_inflateBackInit_(z_streamp strm, int windowBits, unsigned char *window, const char *version, int stream_size) { check_sym(p_inflateBackInit_, Z_STREAM_ERROR); return (* p_inflateBackInit_)(strm, windowBits, window, version, stream_size); }
int z_inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size) { int rc; check_sym(p_inflateInit2_, Z_STREAM_ERROR); rc = (* p_inflateInit2_)(strm, windowBits, version, stream_size); return rc; }
int z_deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size) { int rc; check_sym(p_deflateInit2_, Z_STREAM_ERROR); rc = (* p_deflateInit2_)(strm, level, method, windowBits, memLevel, strategy, version, stream_size); return rc; }
int gzprintf(gzFile file, const char *format, ...) { int count; va_list ap; check_sym(p_gzprintf, -1); va_start(ap, format); count = (* p_gzprintf)(file, format, ap); va_end(ap); return count; }
ATerm lf_5_recursive ( ATerm arg0 ) { { ATerm tmp [ 7 ] ; FUNC_ENTRY ( lf_5_recursivesym , ATmakeAppl ( lf_5_recursivesym , arg0 ) ) ; ( tmp [ 1 ] = arg0 ) ; { ATerm atmp001110 ; ATerm atmp00110 [ 2 ] ; ATerm atmp0010 ; ATerm atmp000 [ 2 ] ; ( atmp000 [ 0 ] = tmp [ 1 ] ) ; ( atmp000 [ 1 ] = tmp [ 1 ] ) ; while ( not_empty_list ( tmp [ 1 ] ) ) { ( atmp0010 = list_head ( tmp [ 1 ] ) ) ; ( tmp [ 1 ] = list_tail ( tmp [ 1 ] ) ) ; ( atmp00110 [ 0 ] = tmp [ 1 ] ) ; ( atmp00110 [ 1 ] = tmp [ 1 ] ) ; while ( not_empty_list ( tmp [ 1 ] ) ) { ( atmp001110 = list_head ( tmp [ 1 ] ) ) ; ( tmp [ 1 ] = list_tail ( tmp [ 1 ] ) ) ; if ( term_equal ( atmp0010 , atmp001110 ) ) { ( tmp [ 2 ] = lf_5_recursive ( cons ( make_list ( atmp0010 ) , tmp [ 1 ] ) ) ) ; if ( check_sym ( tmp [ 2 ] , lf_5_recursivesym ) ) { ( tmp [ 3 ] = arg_0 ( tmp [ 2 ] ) ) ; ( tmp [ 4 ] = arg_0 ( tmp [ 3 ] ) ) ; if ( not_empty_list ( tmp [ 4 ] ) ) { ( tmp [ 5 ] = list_head ( tmp [ 4 ] ) ) ; ( tmp [ 4 ] = list_tail ( tmp [ 4 ] ) ) ; ( tmp [ 6 ] = lf_5_recursive ( cons ( slice ( atmp000 [ 0 ] , atmp000 [ 1 ] ) , cons ( make_list ( tmp [ 5 ] ) , cons ( slice ( atmp00110 [ 0 ] , atmp00110 [ 1 ] ) , tmp [ 4 ] ) ) ) ) ) ; FUNC_EXIT ( tmp [ 6 ] ) ; } } } ( atmp00110 [ 1 ] = list_tail ( atmp00110 [ 1 ] ) ) ; ( tmp [ 1 ] = atmp00110 [ 1 ] ) ; } ( atmp000 [ 1 ] = list_tail ( atmp000 [ 1 ] ) ) ; ( tmp [ 1 ] = atmp000 [ 1 ] ) ; } } FUNC_EXIT ( make_nf1 ( lf_5_recursivesym , lf_list_1 ( arg0 ) ) ) ; } }
z_off_t gzoffset(gzFile file) { check_sym(p_gzoffset, -1ll); return (* p_gzoffset)(file); }
z_off_t gzseek64(gzFile file, z_off64_t offset, int whence) { check_sym(p_gzseek64, -1ll); return (* p_gzseek64)(file, offset, whence); }
z_off64_t gztell64(gzFile file) { check_sym(p_gztell64, -1ll); return (* p_gztell64)(file); }
z_off_t gztell(gzFile file) { check_sym(p_gztell, -1ll); return (* p_gztell)(file); }
int z_deflateReset(z_streamp strm) { check_sym(p_deflateReset, Z_STREAM_ERROR); return (* p_deflateReset)(strm); }
int gzputs(gzFile file, const char *s) { check_sym(p_gzputs, -1); return (* p_gzputs)(file, s); }
int gzputc(gzFile file, int c) { check_sym(p_gzputc, -1); return (* p_gzputc)(file, c); }
int gzgetc(gzFile file) { check_sym(p_gzgetc, -1); return (* p_gzgetc)(file); }
char * gzgets(gzFile file, char *buf, int len) { check_sym(p_gzgets, NULL); return (* p_gzgets)(file, buf, len); }
int gzrewind(gzFile file) { check_sym(p_gzrewind, -1); return (* p_gzrewind)(file); }
const char *gzerror(gzFile file, int *errnum) { check_sym(p_gzerror, NULL); return (* p_gzerror)(file, errnum); }
z_off_t gzoffset64(gzFile file) { check_sym(p_gzoffset64, -1ll); return (* p_gzoffset64)(file); }
int uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) { check_sym(p_uncompress, Z_STREAM_ERROR); return (* p_uncompress)(dest, destLen, source, sourceLen); }
const z_crc_t *get_crc_table() { check_sym(p_get_crc_table, NULL); return (* p_get_crc_table)(); }
int gzflush(gzFile file, int flush) { check_sym(p_gzflush, Z_STREAM_ERROR); return (* p_gzflush)(file, flush); }
int z_deflateParams(z_streamp strm, int level, int strategy) { check_sym(p_deflateParams, Z_STREAM_ERROR); return (* p_deflateParams)(strm, level, strategy); }
int gzungetc(int c, gzFile file) { check_sym(p_gzungetc, -1); return (* p_gzungetc)(c, file); }
int z_deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength) { check_sym(p_deflateSetDictionary, Z_STREAM_ERROR); return (* p_deflateSetDictionary)(strm, dictionary, dictLength); }
gzFile gzopen64(const char *path, const char *mode) { check_sym(p_gzopen64, NULL); return (* p_gzopen64)(path, mode); }
uLong adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) { check_sym(p_adler32_combine64, Z_STREAM_ERROR); return (* p_adler32_combine64)(adler1, adler2, len2); }
int gzeof(gzFile file) { check_sym(p_gzeof, 0); return (* p_gzeof)(file); }
int CLIF_parse_cmdline (int argc, char *argv[], CLIF_option *option_list, CLIF_argument *argument_list, unsigned int parse_flags) { int i, j; CLIF_option *optn; CLIF_argument *argm; int num_args = 0; int num_argm = 0, strict_beg = 0, strict_end = 0; _CLIF_index arg_n[MAX_ARGC_NUMBER]; unsigned int dirty_flags = 0; int dirty_plus = 0; int exclusive_cnt = 0; int posix = getenv ("POSIXLY_CORRECT") != NULL || (parse_flags & CLIF_POSIX); curr.argc = argc; curr.argv = argv; curr.option_list = option_list; curr.argument_list = argument_list; curr.parse_flags = parse_flags; if (argc <= 1 && (parse_flags & CLIF_HELP_EMPTY)) { CLIF_current_help (); exit (0); } /* Scan argument_list for check and some info. */ if (argument_list) { enum stages { STRICT_BEG, OPTIONAL, STRICT_END }; int stage = STRICT_BEG; for (argm = argument_list; argm->name; argm++) { if (argm->flags & CLIF_STRICT) { if (stage == STRICT_BEG) strict_beg++; else if (stage == OPTIONAL) { stage = STRICT_END; strict_end++; } else if (stage == STRICT_END) strict_end++; } else { if (stage == STRICT_BEG) stage = OPTIONAL; else if (stage == STRICT_END) { err_report ("Incorrect argument list set in program " "source: more than one optional area."); return -1; } } num_argm++; } } /* Scan option_list for some info. */ if (option_list) { dirty_flags = parse_flags; for (optn = option_list; optn->short_opt || optn->long_opt; optn++ ) { dirty_flags |= optn->flags; if (optn->function_plus) dirty_plus = 1; } } if (dirty_flags & CLIF_EXCL) exclusive_cnt = 1; /* only one is allowed... */ /* Go ! Store arguments, parse options. */ for (i = 1; i < argc; i++) { char *arg = argv[i]; char *opt_arg = NULL; char sym = '-'; if (!option_list) goto handle_arg; if (*arg == '+' && dirty_plus) sym = '+'; if (*arg != sym) { /* argument or keyword */ if (dirty_flags & CLIF_MAY_KEYWORD) { optn = find_long (arg, &opt_arg, CLIF_MAY_KEYWORD, 0); if (optn) goto long_found; } if (num_args == 0 && (parse_flags & CLIF_FIRST_GROUP)) { /* ugly... */ parse_flags &= ~CLIF_FIRST_GROUP; dirty_flags &= ~CLIF_FIRST_GROUP; /* to be correct */ goto handle_short; } /* else it is an argument */ goto handle_arg; } else if (*++arg == sym) { /* `--' - long option */ arg++; if (*arg == sym || /* `---' - let it be not option... */ (parse_flags & (_CLIF_STRICT_KEYWORD|_CLIF_STRICT_ONEDASH)) ) { arg -= 2; goto handle_arg; /* not option anyway */ } optn = find_long (arg, &opt_arg, 0, _CLIF_STRICT_KEYWORD | _CLIF_STRICT_ONEDASH); if (optn) goto long_found; /* XXX: May be allow only for `--', not `++' too... */ if (!*arg && sym == '-') { /* `--' and no empty longoption */ option_list = NULL; /* POSIX way... */ continue; } /* XXX: or treat as an argument sometimes??? */ err_bad_opt (argv[i], 0, i); return -1; } else { /* short option, or several short options... */ if (dirty_flags & CLIF_MAY_ONEDASH) { optn = find_long (arg, &opt_arg, CLIF_MAY_ONEDASH, 0); if (optn) goto long_found; } if (!*arg) { /* POSIX say: only "stdout specification"... */ arg--; goto handle_arg; } goto handle_short; } long_found: if (check_sym (optn, sym) < 0) { /* Oops... */ err_bad_opt (argv[i], 0, i); return -1; } if (optn->flags & CLIF_EXCL) { if (!exclusive_cnt) { err_bad_excl (optn, 0, i); return -1; } exclusive_cnt--; } if (optn->arg_name && !opt_arg) { unsigned int flags = optn->flags | parse_flags; if (++i >= argc || !(flags & CLIF_MAY_NOEQUAL) ) { /* missing opt arg */ i--; if (!(flags & CLIF_OPTARG)) { err_bad_arg (optn, 0, i); return -1; } opt_arg = NULL; } else opt_arg = argv[i]; } if (call_function (optn, opt_arg, sym) < 0) { err_bad_res (optn, 0, opt_arg, i); return -1; } if (optn->flags & CLIF_EXIT) exit (0); continue; handle_arg: if (argument_list) { if (i < MAX_ARGC_NUMBER) /* XXX: ugly, better report */ arg_n[num_args++] = i; } else { err_report ("`%s' (argc %d): arguments are not allowed", argv[i], i); return -1; } /* POSIX say: No more options after args... */ if (posix) option_list = NULL; /* geniously... */ continue; handle_short: opt_arg = NULL; do { for (optn = option_list; optn->short_opt || optn->long_opt; optn++ ) { if (optn->short_opt && optn->short_opt[0] == *arg) break; } if (!optn->short_opt || check_sym (optn, sym) < 0 ) { err_bad_opt (argv[i], *arg, i); return -1; } if (optn->flags & CLIF_EXCL) { if (!exclusive_cnt) { err_bad_excl (optn, *arg, i); return -1; } exclusive_cnt--; } if (optn->arg_name) { unsigned int flags = parse_flags | optn->flags; if (arg[1] == '\0') { /* a last one */ /* POSIX say: an option with arg cannot be grouped. */ if (posix && arg != argv[i] && arg[-1] != sym) { err_bad_arg (optn, *arg, i); /* good way? */ return -1; } if (++i >= argc || (flags & _CLIF_STRICT_JOIN_ARG) ) { i--; if (!(flags & CLIF_OPTARG)) { err_bad_arg (optn, *arg, i); return -1; } opt_arg = NULL; } else opt_arg = argv[i]; } else if ((arg == argv[i] || arg[-1] == sym) && (flags & CLIF_MAY_JOIN_ARG) ) { opt_arg = ++arg; } else { /* inside a group... */ if (!(flags & CLIF_OPTARG) || (flags & CLIF_MAY_JOIN_ARG) ) { err_bad_arg (optn, *arg, i); return -1; } opt_arg = NULL; } } if (call_function (optn, opt_arg, sym) < 0) { err_bad_res (optn, optn->short_opt[0], opt_arg, i); return -1; } if (optn->flags & CLIF_EXIT) exit (0); } while (!opt_arg && *++arg); } /* for ( ... ) */ if ((parse_flags & CLIF_STRICT_EXCL) && exclusive_cnt != 0) { err_report ("One of these must be specified:\n %s\n", show_excl (option_list, 0)); return -1; } /* Now, after *ALL* options, handle arguments, if any. */ if (num_args < strict_beg + strict_end) { /* Missing some needed arguments. */ if (num_args < strict_beg) argm = argument_list + num_args; else argm = argument_list + ((num_args - strict_beg) + (num_argm - strict_end)); if (num_args == strict_beg + strict_end - 1) err_report ("Specify \"%s\" missing argument.", argm->name); else err_report ("Specify \"%s\" and other missing arguments.", argm->name); return -1; } if (num_args > 0) { _CLIF_index argm_index[MAX_ARGC_NUMBER]; /* assing argm (by index) for each arg... */ for (i = 0, j = 0; i < strict_beg; i++, j++) argm_index[i] = j; for (i = num_args - strict_end, j = num_argm - strict_end; i < num_args; i++, j++ ) argm_index[i] = j; for (i = strict_beg, j = strict_beg; i < num_args - strict_end && j < num_argm - strict_end; i++ ) { argm_index[i] = j; if (!(argument_list[j].flags & CLIF_MORE)) j++; } if (i < num_args - strict_end) { /* there are extra args... */ err_report ("Extra arg `%s' (position %d, argc %d)", argv[arg_n[i]], i + 1, arg_n[i]); return -1; } if (j < num_argm - strict_end && !(argument_list[j].flags & CLIF_MORE) && /* ...i.e, there are some missing optional args... */ (argument_list[j].flags & CLIF_ACC_PREV) ) { if (j == 0) err_report ("Incorrect argument list set: first arg " "cannot be `accompanied with previous'."); else err_report ("Arg \"%s\" must be specified because " "\"%s\" `%s' is used.", argument_list[j].name, argument_list[j - 1].name, argv[arg_n[i - 1]]); return -1; } if (argm_index[--i] == j && /* above is true only after OPTIONAL area scan and when `j' is stopped on CLIF_MORE */ ++j < num_argm - strict_end /* i.e: there is a *last* one (after CLIF_MORE) in the OPTIONAL area */ ) argm_index[i] = j; /* *last* is better than *more* */ /* ...and work now */ for (i = 0; i < num_args; i++) { argm = argument_list + argm_index[i]; if (argm->function && argm->function (argm, argv[arg_n[i]], i) < 0 ) { err_report ("Cannot handle \"%s\" cmdline arg `%s' " "on position %d (argc %d)", argm->name, argv[arg_n[i]], i + 1, arg_n[i]); return -1; } } /* That`s all. */ } return 0; }
uLong crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) { check_sym(p_crc32_combine64, Z_STREAM_ERROR); return (* p_crc32_combine64)(crc1, crc2, len2); }