*** empty log message ***
This commit is contained in:
parent
7f8d858030
commit
5298b39326
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: extio.c,v 1.58 2006-10-27 13:49:43 bacon Exp $
|
||||
* $Id: extio.c,v 1.59 2006-11-16 11:53:15 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -173,7 +173,7 @@ int ase_awk_readextio (
|
||||
|
||||
/* get the record separator */
|
||||
rs = ase_awk_getglobal (run, ASE_AWK_GLOBAL_RS);
|
||||
ase_awk_refupval (rs);
|
||||
ase_awk_refupval (run, rs);
|
||||
|
||||
if (rs->type == ASE_AWK_VAL_NIL)
|
||||
{
|
||||
@ -334,7 +334,7 @@ int ase_awk_readextio (
|
||||
ase_real_t rv;
|
||||
|
||||
nr = ase_awk_getglobal (run, ASE_AWK_GLOBAL_NR);
|
||||
ase_awk_refupval (nr);
|
||||
ase_awk_refupval (run, nr);
|
||||
|
||||
n = ase_awk_valtonum (run, nr, &lv, &rv);
|
||||
ase_awk_refdownval (run, nr);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: func.c,v 1.74 2006-11-14 14:54:17 bacon Exp $
|
||||
* $Id: func.c,v 1.75 2006-11-16 11:53:16 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -645,7 +645,7 @@ static int __bfn_split (ase_awk_run_t* run)
|
||||
|
||||
ase_awk_refdownval (run, *a1_ref);
|
||||
*a1_ref = t1;
|
||||
ase_awk_refupval (*a1_ref);
|
||||
ase_awk_refupval (run, *a1_ref);
|
||||
|
||||
p = str; str_left = str_len;
|
||||
sta = (ase_awk_getopt(run->awk) & ASE_AWK_STRINDEXONE)? 1: 0;
|
||||
@ -707,7 +707,7 @@ static int __bfn_split (ase_awk_run_t* run)
|
||||
* handle the assignment-like situation. anyway, it is
|
||||
* incremented in advance as if the assignment was successful.
|
||||
* it is decremented if the assignement fails. */
|
||||
ase_awk_refupval (t2);
|
||||
ase_awk_refupval (run, t2);
|
||||
|
||||
if (ase_awk_map_putx (
|
||||
((ase_awk_val_map_t*)t1)->map,
|
||||
@ -1093,7 +1093,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
|
||||
|
||||
ase_awk_refdownval (run, *a2_ref);
|
||||
*a2_ref = v;
|
||||
ase_awk_refupval (*a2_ref);
|
||||
ase_awk_refupval (run, *a2_ref);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,7 +1208,7 @@ static int __bfn_match (ase_awk_run_t* run)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ase_awk_refupval (a0);
|
||||
ase_awk_refupval (run, a0);
|
||||
|
||||
a1 = ase_awk_makeintval (run,
|
||||
((n == 0)? (ase_long_t)-1: (ase_long_t)mat_len));
|
||||
@ -1219,7 +1219,7 @@ static int __bfn_match (ase_awk_run_t* run)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ase_awk_refupval (a1);
|
||||
ase_awk_refupval (run, a1);
|
||||
|
||||
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_RSTART, a0) == -1)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: rec.c,v 1.6 2006-10-26 09:27:15 bacon Exp $
|
||||
* $Id: rec.c,v 1.7 2006-11-16 11:53:16 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -46,7 +46,7 @@ int ase_awk_setrec (
|
||||
/* d0 should be cleared before the next line is reached
|
||||
* as it doesn't call ase_awk_refdownval on run->inrec.d0 */
|
||||
run->inrec.d0 = v;
|
||||
ase_awk_refupval (v);
|
||||
ase_awk_refupval (run, v);
|
||||
|
||||
if (__split_record (run) == -1)
|
||||
{
|
||||
@ -79,7 +79,7 @@ int ase_awk_setrec (
|
||||
|
||||
ase_awk_refdownval (run, run->inrec.d0);
|
||||
run->inrec.d0 = v;
|
||||
ase_awk_refupval (v);
|
||||
ase_awk_refupval (run, v);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -217,7 +217,7 @@ static int __split_record (ase_awk_run_t* run)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ase_awk_refupval (run->inrec.flds[run->inrec.nflds].val);
|
||||
ase_awk_refupval (run, run->inrec.flds[run->inrec.nflds].val);
|
||||
run->inrec.nflds++;
|
||||
|
||||
len = ASE_AWK_STR_LEN(&run->inrec.line) -
|
||||
@ -379,7 +379,7 @@ static int __recomp_record_fields (
|
||||
else run->inrec.nflds++;
|
||||
|
||||
run->inrec.flds[i].val = tmp;
|
||||
ase_awk_refupval (tmp);
|
||||
ase_awk_refupval (run, tmp);
|
||||
}
|
||||
else if (i >= nflds)
|
||||
{
|
||||
@ -400,7 +400,7 @@ static int __recomp_record_fields (
|
||||
* to any valid values */
|
||||
/*ase_awk_refdownval (run, run->inrec.flds[i].val);*/
|
||||
run->inrec.flds[i].val = ase_awk_val_zls;
|
||||
ase_awk_refupval (ase_awk_val_zls);
|
||||
ase_awk_refupval (run, ase_awk_val_zls);
|
||||
run->inrec.nflds++;
|
||||
}
|
||||
else
|
||||
|
434
ase/awk/run.c
434
ase/awk/run.c
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.c,v 1.85 2006-11-16 04:44:16 bacon Exp $
|
||||
* $Id: val.c,v 1.86 2006-11-16 11:53:16 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk_i.h>
|
||||
@ -304,14 +304,16 @@ xp_printf (ASE_T("\n"));*/
|
||||
}
|
||||
}
|
||||
|
||||
void ase_awk_refupval (ase_awk_val_t* val)
|
||||
void ase_awk_refupval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
{
|
||||
if (ase_awk_isbuiltinval(val)) return;
|
||||
|
||||
/*
|
||||
xp_printf (ASE_T("ref up "));
|
||||
ase_awk_dprintval (val);
|
||||
xp_printf (ASE_T("\n"));
|
||||
run->awk->syscas.dprintf (ASE_T("ref up [ptr=%p] [count=%d] "), val, (int)val->ref);
|
||||
ase_awk_dprintval (run, val);
|
||||
run->awk->syscas.dprintf (ASE_T("\n"));
|
||||
*/
|
||||
|
||||
val->ref++;
|
||||
}
|
||||
|
||||
@ -320,10 +322,9 @@ void ase_awk_refdownval (ase_awk_run_t* run, ase_awk_val_t* val)
|
||||
if (ase_awk_isbuiltinval(val)) return;
|
||||
|
||||
/*
|
||||
xp_printf (ASE_T("%p, %p, %p\n"), ase_awk_val_nil, &__awk_nil, val);
|
||||
xp_printf (ASE_T("ref down [count=>%d]\n"), (int)val->ref);
|
||||
ase_awk_dprintval (val);
|
||||
xp_printf (ASE_T("\n"));
|
||||
run->awk->syscas.dprintf (ASE_T("ref down [ptr=%p] [count=%d]\n"), val, (int)val->ref);
|
||||
ase_awk_dprintval (run, val);
|
||||
run->awk->syscas.dprintf (ASE_T("\n"));
|
||||
*/
|
||||
|
||||
ASE_AWK_ASSERTX (run->awk, val->ref > 0,
|
||||
@ -572,7 +573,7 @@ static ase_char_t* __val_real_to_str (
|
||||
int opt, ase_awk_str_t* buf, ase_size_t* len)
|
||||
{
|
||||
/* TODO: change the code */
|
||||
ase_char_t tbuf[256], * tmp;
|
||||
ase_char_t* tmp;
|
||||
ase_size_t tmp_len;
|
||||
|
||||
if (opt & ASE_AWK_VALTOSTR_PRINT)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: val.h,v 1.49 2006-10-28 05:24:08 bacon Exp $
|
||||
* $Id: val.h,v 1.50 2006-11-16 11:53:16 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ASE_AWK_VAL_H_
|
||||
@ -160,7 +160,7 @@ ase_awk_val_t* ase_awk_makerefval (
|
||||
ase_bool_t ase_awk_isbuiltinval (ase_awk_val_t* val);
|
||||
|
||||
void ase_awk_freeval (ase_awk_run_t* run, ase_awk_val_t* val, ase_bool_t cache);
|
||||
void ase_awk_refupval (ase_awk_val_t* val);
|
||||
void ase_awk_refupval (ase_awk_run_t* run, ase_awk_val_t* val);
|
||||
void ase_awk_refdownval (ase_awk_run_t* run, ase_awk_val_t* val);
|
||||
void ase_awk_refdownval_nofree (ase_awk_run_t* run, ase_awk_val_t* val);
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
BEGIN {
|
||||
CONVFMT="%s";
|
||||
printf "%s", sprintf ("abc %s abc\n", sprintf ("def %s %s", sprintf ("xyz %s xyz", 1.2342), "def"));
|
||||
#CONVFMT="%*.*s";
|
||||
#CONVFMT="%*.*f";
|
||||
printf "%s", sprintf ("abc %s abc\n", sprintf ("def %s %s", sprintf ("%s %s %s", "xyz", 1.2342, "xyz"), "def"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user