44 |
fmt_roman(int,int,int,int,int); |
fmt_roman(int,int,int,int,int); |
45 |
|
|
46 |
static void |
static void |
47 |
fmt_integer(object,bool,bool,int,int,int,int); |
fmt_integer(object,bool,bool,int,int,int,int,int); |
48 |
|
|
49 |
static void |
static void |
50 |
fmt_semicolon(bool,bool); |
fmt_semicolon(bool,bool); |
676 |
static void |
static void |
677 |
fmt_decimal(bool colon, bool atsign) |
fmt_decimal(bool colon, bool atsign) |
678 |
{ |
{ |
679 |
int mincol=0, padchar=0, commachar=0; |
int mincol=0, padchar=0, commachar=0, commainterval=0; |
680 |
|
|
681 |
fmt_max_param(3); |
fmt_max_param(4); |
682 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
683 |
fmt_set_param(1, &padchar, fmt_char, ' '); |
fmt_set_param(1, &padchar, fmt_char, ' '); |
684 |
fmt_set_param(2, &commachar, fmt_char, ','); |
fmt_set_param(2, &commachar, fmt_char, ','); |
685 |
|
fmt_set_param(3, &commainterval, fmt_int, 3); |
686 |
fmt_integer(fmt_advance(), colon, atsign, |
fmt_integer(fmt_advance(), colon, atsign, |
687 |
10, mincol, padchar, commachar); |
10, mincol, padchar, commachar, commainterval); |
688 |
} |
} |
689 |
|
|
690 |
static void |
static void |
691 |
fmt_binary(bool colon, bool atsign) |
fmt_binary(bool colon, bool atsign) |
692 |
{ |
{ |
693 |
int mincol=0, padchar=0, commachar=0; |
int mincol=0, padchar=0, commachar=0, commainterval=0; |
694 |
|
|
695 |
fmt_max_param(3); |
fmt_max_param(4); |
696 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
697 |
fmt_set_param(1, &padchar, fmt_char, ' '); |
fmt_set_param(1, &padchar, fmt_char, ' '); |
698 |
fmt_set_param(2, &commachar, fmt_char, ','); |
fmt_set_param(2, &commachar, fmt_char, ','); |
699 |
|
fmt_set_param(3, &commainterval, fmt_int, 3); |
700 |
fmt_integer(fmt_advance(), colon, atsign, |
fmt_integer(fmt_advance(), colon, atsign, |
701 |
2, mincol, padchar, commachar); |
2, mincol, padchar, commachar, commainterval); |
702 |
} |
} |
703 |
|
|
704 |
static void |
static void |
705 |
fmt_octal(bool colon, bool atsign) |
fmt_octal(bool colon, bool atsign) |
706 |
{ |
{ |
707 |
int mincol=0, padchar=0, commachar=0; |
int mincol=0, padchar=0, commachar=0, commainterval=0;; |
708 |
|
|
709 |
fmt_max_param(3); |
fmt_max_param(4); |
710 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
711 |
fmt_set_param(1, &padchar, fmt_char, ' '); |
fmt_set_param(1, &padchar, fmt_char, ' '); |
712 |
fmt_set_param(2, &commachar, fmt_char, ','); |
fmt_set_param(2, &commachar, fmt_char, ','); |
713 |
|
fmt_set_param(3, &commainterval, fmt_int, 3); |
714 |
fmt_integer(fmt_advance(), colon, atsign, |
fmt_integer(fmt_advance(), colon, atsign, |
715 |
8, mincol, padchar, commachar); |
8, mincol, padchar, commachar, commainterval); |
716 |
} |
} |
717 |
|
|
718 |
static void |
static void |
719 |
fmt_hexadecimal(bool colon, bool atsign) |
fmt_hexadecimal(bool colon, bool atsign) |
720 |
{ |
{ |
721 |
int mincol=0, padchar=0, commachar=0; |
int mincol=0, padchar=0, commachar=0, commainterval=0;; |
722 |
|
|
723 |
fmt_max_param(3); |
fmt_max_param(4); |
724 |
fmt_set_param(0, &mincol, fmt_int, 0); |
fmt_set_param(0, &mincol, fmt_int, 0); |
725 |
fmt_set_param(1, &padchar, fmt_char, ' '); |
fmt_set_param(1, &padchar, fmt_char, ' '); |
726 |
fmt_set_param(2, &commachar, fmt_char, ','); |
fmt_set_param(2, &commachar, fmt_char, ','); |
727 |
|
fmt_set_param(3, &commainterval, fmt_int, 3); |
728 |
fmt_integer(fmt_advance(), colon, atsign, |
fmt_integer(fmt_advance(), colon, atsign, |
729 |
16, mincol, padchar, commachar); |
16, mincol, padchar, commachar, commainterval); |
730 |
} |
} |
731 |
|
|
732 |
static void |
static void |
733 |
fmt_radix(bool colon, bool atsign) |
fmt_radix(bool colon, bool atsign) |
734 |
{ |
{ |
735 |
int radix=0, mincol=0, padchar=0, commachar=0; |
int radix=0, mincol=0, padchar=0, commachar=0, commainterval=0;; |
736 |
object x; |
object x; |
737 |
int i, j, k; |
int i, j, k; |
738 |
int s, t; |
int s, t; |
749 |
i = -1; |
i = -1; |
750 |
if ((!colon && (i <= 0 || i >= 4000)) || |
if ((!colon && (i <= 0 || i >= 4000)) || |
751 |
(colon && (i <= 0 || i >= 5000))) { |
(colon && (i <= 0 || i >= 5000))) { |
752 |
fmt_integer(x, FALSE, FALSE, 10, 0, ' ', ','); |
fmt_integer(x, FALSE, FALSE, 10, 0, ' ', ',', 3); |
753 |
return; |
return; |
754 |
} |
} |
755 |
fmt_roman(i/1000, 'M', '*', '*', colon); |
fmt_roman(i/1000, 'M', '*', '*', colon); |
796 |
} |
} |
797 |
return; |
return; |
798 |
} |
} |
799 |
fmt_max_param(4); |
fmt_max_param(5); |
800 |
fmt_set_param(0, &radix, fmt_int, 10); |
fmt_set_param(0, &radix, fmt_int, 10); |
801 |
fmt_set_param(1, &mincol, fmt_int, 0); |
fmt_set_param(1, &mincol, fmt_int, 0); |
802 |
fmt_set_param(2, &padchar, fmt_char, ' '); |
fmt_set_param(2, &padchar, fmt_char, ' '); |
803 |
fmt_set_param(3, &commachar, fmt_char, ','); |
fmt_set_param(3, &commachar, fmt_char, ','); |
804 |
|
fmt_set_param(4, &commainterval, fmt_int, 3); |
805 |
x = fmt_advance(); |
x = fmt_advance(); |
806 |
check_type_integer(&x); |
check_type_integer(&x); |
807 |
if (radix < 0 || radix > 36) { |
if (radix < 0 || radix > 36) { |
808 |
vs_push(make_fixnum(radix)); |
vs_push(make_fixnum(radix)); |
809 |
FEerror("~D is illegal as a radix.", 1, vs_head); |
FEerror("~D is illegal as a radix.", 1, vs_head); |
810 |
} |
} |
811 |
fmt_integer(x, colon, atsign, radix, mincol, padchar, commachar); |
fmt_integer(x, colon, atsign, radix, mincol, padchar, commachar, commainterval); |
812 |
} |
} |
813 |
|
|
814 |
static void |
static void |
815 |
fmt_integer(object x, bool colon, bool atsign, int radix, int mincol, int padchar, int commachar) |
fmt_integer(object x, bool colon, bool atsign, int radix, int mincol, int padchar, int commachar, int commainterval) |
816 |
{ |
{ |
817 |
int l, l1; |
int l, l1; |
818 |
int s; |
int s; |
863 |
writec_stream('+', fmt_stream); |
writec_stream('+', fmt_stream); |
864 |
while (l1-- > 0) { |
while (l1-- > 0) { |
865 |
writec_stream(fmt_tempstr(s++), fmt_stream); |
writec_stream(fmt_tempstr(s++), fmt_stream); |
866 |
if (colon && l1 > 0 && l1%3 == 0) |
if (colon && l1 > 0 && l1%(commainterval) == 0) |
867 |
writec_stream(commachar, fmt_stream); |
writec_stream(commachar, fmt_stream); |
868 |
} |
} |
869 |
} |
} |