From e0f108ee555dabee2dac562df51beddcd3f7a011 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sat, 23 Aug 2008 17:48:38 +0100 Subject: [PATCH] allow -L option to be used for stack size (in SWI compatibility). --- console/yap.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/console/yap.c b/console/yap.c index 1b4cfbce6..2b29e6113 100644 --- a/console/yap.c +++ b/console/yap.c @@ -397,6 +397,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) #endif case 's': case 'S': + stack_mode: ssize = &(iap->StackSize); #if defined(ENV_COPY) || defined(ACOW) || defined(SBA) if (p[1] == 'l') { @@ -428,6 +429,22 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) int i = 0, ch; while ((ch = *p++) >= '0' && ch <= '9') i = i * 10 + ch - '0'; + switch(ch) { + case 'M': + case 'm': + i *= 1024; + ch = *p++; + break; + case 'g': + case 'G': + i *= 1024*1024; + ch = *p++; + break; + case 'k': + case 'K': + ch = *p++; + break; + } if (ch) { iap->YapPrologTopLevelGoal = add_end_dot(*argv); } else { @@ -456,6 +473,22 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) int i = 0, ch; while ((ch = *p++) >= '0' && ch <= '9') i = i * 10 + ch - '0'; + switch(ch) { + case 'M': + case 'm': + i *= 1024; + ch = *p++; + break; + case 'g': + case 'G': + i *= 1024*1024; + ch = *p++; + break; + case 'k': + case 'K': + ch = *p++; + break; + } if (ch) { fprintf(stderr,"[ YAP unrecoverable error: illegal size specification %s ]", argv[-1]); @@ -471,6 +504,8 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap) break; #endif case 'L': + if (p[0]) + goto stack_mode; iap->QuietMode = TRUE; iap->HaltAfterConsult = TRUE; case 'l':