From 53be062c6b4fe137f96dc3985ea4a0ac3fa0022e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 17 Oct 2006 03:44:37 +0000 Subject: [PATCH] added new op.genarray.z for zeroing arrays --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40128 --- sourcepawn/compiler/sc.h | 2 +- sourcepawn/compiler/sc1.c | 2 +- sourcepawn/compiler/sc4.c | 8 ++++++-- sourcepawn/compiler/sc6.c | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 92f613a5..c6e0e8de 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -590,7 +590,7 @@ SC_FUNC void moveto1(void); SC_FUNC void pushreg(regid reg); SC_FUNC void pushval(cell val); SC_FUNC void popreg(regid reg); -SC_FUNC void genarray(int dims); +SC_FUNC void genarray(int dims, int _autozero); SC_FUNC void swap1(void); SC_FUNC void ffswitch(int label); SC_FUNC void ffcase(cell value,char *labelname,int newtable); diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 6d4082c0..50b7c320 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -1961,7 +1961,7 @@ static int declloc(int fstatic) needtoken(')'); numdim++; } while (matchtoken('(')); - genarray(numdim); + genarray(numdim, autozero); } if (getstates(name)) error(88,name); /* local variables may not have states */ diff --git a/sourcepawn/compiler/sc4.c b/sourcepawn/compiler/sc4.c index 834aeac5..a9971783 100644 --- a/sourcepawn/compiler/sc4.c +++ b/sourcepawn/compiler/sc4.c @@ -675,9 +675,13 @@ SC_FUNC void popreg(regid reg) /* * Generate an array */ -SC_FUNC void genarray(int dims) +SC_FUNC void genarray(int dims, int _autozero) { - stgwrite("\tgenarray "); + if (_autozero) { + stgwrite("\tgenarray.z "); + } else { + stgwrite("\tgenarray "); + } outval(dims, TRUE); code_idx+=opcodes(1)+opargs(1); } diff --git a/sourcepawn/compiler/sc6.c b/sourcepawn/compiler/sc6.c index 7dd4a295..97ead13e 100644 --- a/sourcepawn/compiler/sc6.c +++ b/sourcepawn/compiler/sc6.c @@ -490,6 +490,7 @@ static OPCODEC opcodelist[] = { /*{124, "file", sIN_CSEG, do_file }, */ {119, "fill", sIN_CSEG, parm1 }, {162, "genarray", sIN_CSEG, parm1 }, + {163, "genarray.z", sIN_CSEG, parm1 }, {100, "geq", sIN_CSEG, parm0 }, { 99, "grtr", sIN_CSEG, parm0 }, {120, "halt", sIN_CSEG, parm1 },