aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-12 20:58:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-12 20:58:27 +0000
commit6ca409e0e4c198fe3081346eebbae3f068fe605a (patch)
tree060cb05d99220a1eda399194d1209c269f0e8cd8 /editors/awk.c
parent4185548984357df91311f30c8e43d95f33922576 (diff)
downloadbusybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.gz
busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.bz2
busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.zip
trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount of padding (unfortunately, needs hand editing ATM). *: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts size saving: 0.5k
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 752c73e7e..4ec3d4652 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -263,7 +263,7 @@ enum {
263 263
264#define OC_B OC_BUILTIN 264#define OC_B OC_BUILTIN
265 265
266static const char tokenlist[] = 266static const char tokenlist[] ALIGN1 =
267 "\1(" NTC 267 "\1(" NTC
268 "\1)" NTC 268 "\1)" NTC
269 "\1/" NTC /* REGEXP */ 269 "\1/" NTC /* REGEXP */
@@ -373,7 +373,7 @@ enum {
373 ENVIRON, F0, NUM_INTERNAL_VARS 373 ENVIRON, F0, NUM_INTERNAL_VARS
374}; 374};
375 375
376static const char vNames[] = 376static const char vNames[] ALIGN1 =
377 "CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0" 377 "CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0"
378 "ORS\0" "RS\0*" "RT\0" "FILENAME\0" 378 "ORS\0" "RS\0*" "RT\0" "FILENAME\0"
379 "SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0" 379 "SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0"
@@ -381,16 +381,15 @@ static const char vNames[] =
381 "NR\0" "NF\0*" "IGNORECASE\0*" 381 "NR\0" "NF\0*" "IGNORECASE\0*"
382 "ENVIRON\0" "$\0*" "\0"; 382 "ENVIRON\0" "$\0*" "\0";
383 383
384static const char vValues[] = 384static const char vValues[] ALIGN1 =
385 "%.6g\0" "%.6g\0" " \0" " \0" 385 "%.6g\0" "%.6g\0" " \0" " \0"
386 "\n\0" "\n\0" "\0" "\0" 386 "\n\0" "\n\0" "\0" "\0"
387 "\034\0" 387 "\034\0"
388 "\377"; 388 "\377";
389 389
390/* hash size may grow to these values */ 390/* hash size may grow to these values */
391#define FIRST_PRIME 61; 391#define FIRST_PRIME 61
392static const unsigned PRIMES[] = { 251, 1021, 4093, 16381, 65521 }; 392static const uint16_t PRIMES[] ALIGN2 = { 251, 1021, 4093, 16381, 65521 };
393
394 393
395 394
396/* Globals. Split in two parts so that first one is addressed 395/* Globals. Split in two parts so that first one is addressed
@@ -504,17 +503,17 @@ static int awk_exit(int) ATTRIBUTE_NORETURN;
504 503
505/* ---- error handling ---- */ 504/* ---- error handling ---- */
506 505
507static const char EMSG_INTERNAL_ERROR[] = "Internal error"; 506static const char EMSG_INTERNAL_ERROR[] ALIGN1 = "Internal error";
508static const char EMSG_UNEXP_EOS[] = "Unexpected end of string"; 507static const char EMSG_UNEXP_EOS[] ALIGN1 = "Unexpected end of string";
509static const char EMSG_UNEXP_TOKEN[] = "Unexpected token"; 508static const char EMSG_UNEXP_TOKEN[] ALIGN1 = "Unexpected token";
510static const char EMSG_DIV_BY_ZERO[] = "Division by zero"; 509static const char EMSG_DIV_BY_ZERO[] ALIGN1 = "Division by zero";
511static const char EMSG_INV_FMT[] = "Invalid format specifier"; 510static const char EMSG_INV_FMT[] ALIGN1 = "Invalid format specifier";
512static const char EMSG_TOO_FEW_ARGS[] = "Too few arguments for builtin"; 511static const char EMSG_TOO_FEW_ARGS[] ALIGN1 = "Too few arguments for builtin";
513static const char EMSG_NOT_ARRAY[] = "Not an array"; 512static const char EMSG_NOT_ARRAY[] ALIGN1 = "Not an array";
514static const char EMSG_POSSIBLE_ERROR[] = "Possible syntax error"; 513static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error";
515static const char EMSG_UNDEF_FUNC[] = "Call to undefined function"; 514static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function";
516#if !ENABLE_FEATURE_AWK_MATH 515#if !ENABLE_FEATURE_AWK_MATH
517static const char EMSG_NO_MATH[] = "Math support is not compiled in"; 516static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in";
518#endif 517#endif
519 518
520static void zero_out_var(var * vp) 519static void zero_out_var(var * vp)
@@ -522,8 +521,8 @@ static void zero_out_var(var * vp)
522 memset(vp, 0, sizeof(*vp)); 521 memset(vp, 0, sizeof(*vp));
523} 522}
524 523
525static void syntax_error(const char * const message) ATTRIBUTE_NORETURN; 524static void syntax_error(const char *const message) ATTRIBUTE_NORETURN;
526static void syntax_error(const char * const message) 525static void syntax_error(const char *const message)
527{ 526{
528 bb_error_msg_and_die("%s:%i: %s", g_progname, g_lineno, message); 527 bb_error_msg_and_die("%s:%i: %s", g_progname, g_lineno, message);
529} 528}
@@ -825,7 +824,7 @@ static var *copyvar(var *dest, const var *src)
825 824
826static var *incvar(var *v) 825static var *incvar(var *v)
827{ 826{
828 return setvar_i(v, getvar_i(v)+1.); 827 return setvar_i(v, getvar_i(v) + 1.);
829} 828}
830 829
831/* return true if v is number or numeric string */ 830/* return true if v is number or numeric string */