📄 util.c
字号:
double d; int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { if (val) *val = (long)(d); return res; } } } return SWIG_TypeError;}SWIGINTERN intSWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val){ long v; int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v); if (SWIG_IsOK(res)) { if ((v < INT_MIN || v > INT_MAX)) { return SWIG_OverflowError; } else { if (val) *val = (int)(v); } } return res;}voidset_erroutput_type(char *type, char *context){ if (strcmp(context, "cmdline") == 0) { erroutput_type = ERR_INTERACTIVE; } else if (strcmp(context, "daemon") == 0) { if (strcmp(type, "server") == 0) { erroutput_type = ERR_INTERACTIVE|ERR_AMANDALOG; } else if (strcmp(type, "client") == 0) { erroutput_type = ERR_INTERACTIVE|ERR_SYSLOG; } }}#ifdef PERL_OBJECT#define MAGIC_CLASS _wrap_Amanda::Util_var::class _wrap_Amanda::Util_var : public CPerlObj {public:#else#define MAGIC_CLASS#endifSWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) { MAGIC_PPERL croak("Value is read-only."); return 0;}#ifdef PERL_OBJECT};#endif#ifdef __cplusplusextern "C" {#endifXS(_wrap_set_pname) { { char *arg1 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: set_pname(name);"); } res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_pname" "', argument " "1"" of type '" "char *""'"); } arg1 = (char *)(buf1); set_pname(arg1); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); XSRETURN(argvi); fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); SWIG_croak_null(); }}XS(_wrap_safe_cd) { { int argvi = 0; dXSARGS; if ((items < 0) || (items > 0)) { SWIG_croak("Usage: safe_cd();"); } safe_cd(); XSRETURN(argvi); fail: SWIG_croak_null(); }}XS(_wrap_check_running_as) { { running_as_flags arg1 ; int argvi = 0; dXSARGS; if ((items < 1) || (items > 1)) { SWIG_croak("Usage: check_running_as(who);"); } { if (sizeof(signed int) == 1) { arg1 = amglue_SvI8(ST(0)); } else if (sizeof(signed int) == 2) { arg1 = amglue_SvI16(ST(0)); } else if (sizeof(signed int) == 4) { arg1 = amglue_SvI32(ST(0)); } else if (sizeof(signed int) == 8) { arg1 = amglue_SvI64(ST(0)); } else { g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */ } } check_running_as(arg1); XSRETURN(argvi); fail: SWIG_croak_null(); }}XS(_wrap_set_erroutput_type) { { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; int argvi = 0; dXSARGS; if ((items < 2) || (items > 2)) { SWIG_croak("Usage: set_erroutput_type(type,context);"); } res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_erroutput_type" "', argument " "1"" of type '" "char *""'"); } arg1 = (char *)(buf1); res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "set_erroutput_type" "', argument " "2"" of type '" "char *""'"); } arg2 = (char *)(buf2); set_erroutput_type(arg1,arg2); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); XSRETURN(argvi); fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); SWIG_croak_null(); }}/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */static swig_type_info _swigt__p_char = {"_p_char", "char *|gchar *", 0, 0, (void*)0, 0};static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};static swig_type_info _swigt__p_int = {"_p_int", "int *|running_as_flags *", 0, 0, (void*)0, 0};static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|guchar *", 0, 0, (void*)0, 0};static swig_type_info *swig_type_initial[] = { &_swigt__p_char, &_swigt__p_double, &_swigt__p_float, &_swigt__p_int, &_swigt__p_unsigned_char,};static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};static swig_cast_info *swig_cast_initial[] = { _swigc__p_char, _swigc__p_double, _swigc__p_float, _swigc__p_int, _swigc__p_unsigned_char,};/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */static swig_constant_info swig_constants[] = {{0,0,0,0,0,0}};#ifdef __cplusplus}#endifstatic swig_variable_info swig_variables[] = {{0,0,0,0}};static swig_command_info swig_commands[] = {{"Amanda::Utilc::set_pname", _wrap_set_pname},{"Amanda::Utilc::safe_cd", _wrap_safe_cd},{"Amanda::Utilc::check_running_as", _wrap_check_running_as},{"Amanda::Utilc::set_erroutput_type", _wrap_set_erroutput_type},{0,0}};/* ----------------------------------------------------------------------------- * Type initialization: * This problem is tough by the requirement that no dynamic * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back * to swig_type_info structures, we need some lookup code at initialization. * The idea is that swig generates all the structures that are needed. * The runtime then collects these partially filled structures. * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * * The generated swig_type_info structures are assigned staticly to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a * two-dimensional array. Each row corresponds to a type (there are the same * number of rows as there are in the swig_type_initial array). Each entry in * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that * swig_cast_info to the linked list (because the cast->type) pointer will * be correct. * ----------------------------------------------------------------------------- */#ifdef __cplusplusextern "C" {#if 0} /* c-mode */#endif#endif#if 0#define SWIGRUNTIME_DEBUG#endifSWIGRUNTIME voidSWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; int found; clientdata = clientdata; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { /* Initialize the swig_module */ swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0; iter=module_head; do { if (iter==&swig_module) { found=1; break; } iter=iter->next; } while (iter!= module_head); /* if the is found in the list, then all is done and we may leave */ if (found) return; /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } /* Now work on filling in swig_module.types */#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size);#endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);#endif /* if there is another module already loaded */ if (swig_module.next != &swig_module) { type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); } if (type) { /* Overwrite clientdata field */#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found type %s\n", type->name);#endif if (swig_module.type_initial[i]->clientdata) { type->clientdata = swig_module.type_initial[i]->clientdata;#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);#endif } } else { type = swig_module.type_initial[i]; } /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { /* Don't need to add information already in the list */ ret = 0;#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);#endif if (swig_module.next != &swig_module) { ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);#ifdef SWIGRUNTIME_DEBUG if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);#endif } if (ret) { if (type == swig_module.type_initial[i]) {#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: skip old type %s\n", ret->name);#endif cast->type = ret; ret = 0; } else { /* Check for casting already in the list */ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);#ifdef SWIGRUNTIME_DEBUG if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);#endif if (!ocast) ret = 0; } } if (!ret) {#ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);#endif if (type->cast) { type->cast->prev = cast; cast->next = type->cast; } type->cast = cast; } cast++; } /* Set entry in modules->types array equal to the type */ swig_module.types[i] = type; } swig_module.types[i] = 0; #ifdef SWIGRUNTIME_DEBUG printf("**** SWIG_InitializeModule: Cast List ******\n"); for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; ++j; } printf("---- Total casts: %d\n",j); } printf("**** SWIG_InitializeModule: Cast List ******\n");#endif}/* This function will propagate the clientdata field of type to* any new swig_type_info structures that have been added into the list* of equivalent types. It is like calling* SWIG_TypeClientData(type, clientdata) a second time.*/SWIGRUNTIME voidSWIG_PropagateClientData(void) { size_t i; swig_cast_info *equiv; static int init_run = 0; if (init_run) return; init_run = 1; for (i = 0; i < swig_module.size; i++) { if (swig_module.types[i]->clientdata) { equiv = swig_module.types[i]->cast; while (equiv) { if (!equiv->converter) { if (equiv->type && !equiv->type->clientdata) SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); } equiv = equiv->next; } } }}#ifdef __cplusplus#if 0{ /* c-mode */#endif}#endif#ifdef __cplusplusextern "C"#endifXS(SWIG_init) { dXSARGS; int i; SWIG_InitializeModule(0); /* Install commands */ for (i = 0; swig_commands[i].name; i++) { newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); } /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { sv_setiv(sv,(IV) 0); } swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); } /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); break; case SWIG_FLOAT: sv_setnv(sv, (double) swig_constants[i].dvalue); break; case SWIG_STRING: sv_setpv(sv, (char *) swig_constants[i].pvalue); break; case SWIG_POINTER: SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); break; case SWIG_BINARY: SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); break; default: break; } SvREADONLY_on(sv); } /*@SWIG:%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ROOT", TRUE | 0x2); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_ROOT))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; /*@SWIG:%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER", TRUE | 0x2); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; /*@SWIG:%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER_PREFERRED", TRUE | 0x2); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER_PREFERRED))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; /*@SWIG:%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_CLIENT_LOGIN", TRUE | 0x2); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_CLIENT_LOGIN))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; /*@SWIG:%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_UID_ONLY", TRUE | 0x2); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_UID_ONLY))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; ST(0) = &PL_sv_yes; XSRETURN(1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -