avoid repeated fetch

This commit is contained in:
Vítor Santos Costa 2011-02-15 18:40:18 +00:00
parent ce0874d6be
commit e90a1ce024

View File

@ -1087,20 +1087,22 @@ writeTerm2(term_t t, int prec, write_options *options, bool arg)
_PL_get_arg(1, t, arg); _PL_get_arg(1, t, arg);
#if __YAP_PROLOG__ #if __YAP_PROLOG__
if ( PL_get_integer(arg, &n) && n == -1 ) /* YAP supports $VAR(-1) as a quick hack to write singleton variables */
{ char buf[16]; #define MIN_DOLLAR_VAR -1
#else
buf[0] = '_'; #define MIN_DOLLAR_VAR 0
buf[1] = EOS;
return PutToken(buf, out);
}
#endif #endif
if ( PL_get_integer(arg, &n) && n >= 0 ) if ( PL_get_integer(arg, &n) && n >= MIN_DOLLAR_VAR )
{ int i = n % 26; { int i = n % 26;
int j = n / 26; int j = n / 26;
char buf[16]; char buf[16];
#if __YAP_PROLOG__
if ( n == -1 ) {
buf[0] = '_';
buf[1] = EOS;
} else
#endif
if ( j == 0 ) if ( j == 0 )
{ buf[0] = i+'A'; { buf[0] = i+'A';
buf[1] = EOS; buf[1] = EOS;