Commit 60d7787
committed
fbc: github # 426: add __FB_ARG_LISTEXPAND__( macroname, macroargcount, args... )
- tests added
- only emit NEWLINE if the expansion is multiple source lines
- fix pointers to string characters to use sizeof(wstring) since it will vary
depending on host platform
- add __FB_ARG_LISTEXPAND__( macroname, macroargcount, args... )
- expands to one or more 'macroname( .... )' depending on the value of
macroargcount and number of arguments in the args... list
/'
#macro m( arg... )
#print " "##arg
#endmacro
#print "1. MacroArgCount=0:"
__FB_ARG_LISTEXPAND__( m, 0, Hello1, Hello2, Hello3, Hello4)
#print "2. MacroArgCount>0:"
__FB_ARG_LISTEXPAND__( m, 1, Hello1, Hello2, Hello3, Hello4)
#print "3. MacroArgCount<0:"
__FB_ARG_LISTEXPAND__( m, -1, Hello1, Hello2, Hello3, Hello4)
'/
/' Compiler output:
1. MacroArgCount=0:
Hello1, Hello2, Hello3, Hello4
2. MacroArgCount>0:
Hello1
Hello2
Hello3
Hello4
3. MacroArgCount<0:
Hello1, Hello2, Hello3, Hello4
Hello2, Hello3, Hello4
Hello3, Hello4
Hello4
'/1 parent 392937e commit 60d7787
File tree
5 files changed
+602
-8
lines changed- src/compiler
- tests/pp
5 files changed
+602
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
10 | 18 | | |
11 | 19 | | |
12 | 20 | | |
| |||
1333 | 1341 | | |
1334 | 1342 | | |
1335 | 1343 | | |
1336 | | - | |
| 1344 | + | |
1337 | 1345 | | |
1338 | 1346 | | |
1339 | 1347 | | |
| |||
1628 | 1636 | | |
1629 | 1637 | | |
1630 | 1638 | | |
1631 | | - | |
1632 | | - | |
1633 | 1639 | | |
1634 | | - | |
| 1640 | + | |
| 1641 | + | |
1635 | 1642 | | |
1636 | 1643 | | |
1637 | 1644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
750 | 753 | | |
751 | 754 | | |
752 | 755 | | |
753 | 756 | | |
754 | 757 | | |
755 | 758 | | |
756 | 759 | | |
757 | | - | |
| 760 | + | |
758 | 761 | | |
759 | 762 | | |
760 | 763 | | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
761 | 767 | | |
762 | 768 | | |
763 | 769 | | |
| |||
766 | 772 | | |
767 | 773 | | |
768 | 774 | | |
769 | | - | |
| 775 | + | |
770 | 776 | | |
771 | 777 | | |
772 | 778 | | |
| |||
812 | 818 | | |
813 | 819 | | |
814 | 820 | | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
815 | 824 | | |
816 | 825 | | |
817 | 826 | | |
| |||
820 | 829 | | |
821 | 830 | | |
822 | 831 | | |
823 | | - | |
| 832 | + | |
824 | 833 | | |
825 | 834 | | |
826 | 835 | | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
827 | 839 | | |
828 | 840 | | |
829 | 841 | | |
| |||
833 | 845 | | |
834 | 846 | | |
835 | 847 | | |
836 | | - | |
| 848 | + | |
837 | 849 | | |
838 | 850 | | |
839 | 851 | | |
| |||
Binary file not shown.
0 commit comments