資源簡介
gawk-4.1.3.tar.gz
代碼片段和文件信息
/*
?*?array.c?-?routines?for?awk?arrays.
?*/
/*?
?*?Copyright?(C)?1986?1988?1989?1991-2014?the?Free?Software?Foundation?Inc.
?*?
?*?This?file?is?part?of?GAWK?the?GNU?implementation?of?the
?*?AWK?Programming?Language.
?*?
?*?GAWK?is?free?software;?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*?the?Free?Software?Foundation;?either?version?3?of?the?License?or
?*?(at?your?option)?any?later?version.
?*?
?*?GAWK?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?General?Public?License?for?more?details.
?*?
?*?You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*?along?with?this?program;?if?not?write?to?the?Free?Software
?*?Foundation?Inc.?51?Franklin?Street?Fifth?Floor?Boston?MA??02110-1301?USA
?*/
#include?“awk.h“
extern?FILE?*output_fp;
extern?NODE?**fmt_list;??????????/*?declared?in?eval.c?*/
static?size_t?SUBSEPlen;
static?char?*SUBSEP;
static?char?indent_char[]?=?“????“;
static?NODE?**null_lookup(NODE?*symbol?NODE?*subs);
static?NODE?**null_dump(NODE?*symbol?NODE?*subs);
static?afunc_t?null_array_func[]?=?{
(afunc_t)?0
(afunc_t)?0
null_length
null_lookup
null_afunc
null_afunc
null_afunc
null_afunc
null_afunc
null_dump
(afunc_t)?0
};
#define?MAX_ATYPE?10
static?afunc_t?*array_types[MAX_ATYPE];
static?int?num_array_types?=?0;
/*?array?func?to?index?mapping?*/
#define?AFUNC(F)?(F?##?_ind)
/*?register_array_func?---?add?routines?to?handle?arrays?*/
int
register_array_func(afunc_t?*afunc)
{
if?(afunc?&&?num_array_types? if?(afunc?!=?str_array_func?&&?!?afunc[AFUNC(atypeof)])
return?false;
array_types[num_array_types++]?=?afunc;
if?(afunc[AFUNC(ainit)]) /*?execute?init?routine?if?any?*/
(void)?(*afunc[AFUNC(ainit)])(NULL?NULL);
return?true;
}
return?false;
}
/*?array_init?---?register?all?builtin?array?types?*/
void
array_init()
{
(void)?register_array_func(str_array_func); /*?the?default?*/
if?(!?do_mpfr)?{
(void)?register_array_func(int_array_func);
(void)?register_array_func(cint_array_func);
}
}
/*?make_array?---?create?an?array?node?*/
NODE?*
make_array()
{
NODE?*array;
getnode(array);
memset(array?‘\0‘?sizeof(NODE));
array->type?=?Node_var_array;
array->array_funcs?=?null_array_func;
/*?vname?flags?and?parent_array?not?set?here?*/
return?array;
}
/*?null_array?---?force?symbol?to?be?an?empty?typeless?array?*/
void
null_array(NODE?*symbol)
{
symbol->type?=?Node_var_array;
symbol->array_funcs?=?null_array_func;
symbol->buckets?=?NULL;
symbol->table_size?=?symbol->array_size?=?0;
symbol->array_capacity?=?0;
symbol->flags?=?0;
assert(symbol->xarray?==?NULL);
/*?vname?parent_array?not?(re)initialized?*/
}
/*?null_lookup?---?assign?type?to?an?empty?array.?*/
static?NODE?**
null_lookup(NODE?*symbol?NODE?*subs)
{
int?
- 上一篇:多因子選股模型之因子分析與篩選
- 下一篇:解析WSDL并寫入到Excel
評論
共有 條評論