comparison src/g-builtins.cc @ 210:7947b7a6b6da

[project @ 1993-11-12 10:51:10 by jwe]
author jwe
date Fri, 12 Nov 1993 10:51:33 +0000
parents 1761d7a3770c
children 1468a5e6a466
comparison
equal deleted inserted replaced
209:5869adaa6aea 210:7947b7a6b6da
816 816
817 return retval; 817 return retval;
818 } 818 }
819 819
820 /* 820 /*
821 * Variable argument lists.
822 */
823 tree_constant *
824 builtin_get_next_arg (const tree_constant *args, int nargin, int nargout)
825 {
826 tree_constant *retval = NULL_TREE_CONST;
827 if (nargin == 1)
828 {
829 if (curr_function != (tree_function *) NULL)
830 {
831 if (curr_function->takes_varargs ())
832 {
833 retval = new tree_constant [2];
834 retval[0] = curr_function->get_next_arg ();
835 }
836 else
837 error ("next_arg only valid within function taking\
838 variable number of arguments");
839 }
840 else
841 error ("next_arg only valid within function body");
842 }
843 else
844 print_usage ("get_next_arg");
845
846 return retval;
847 }
848
849 /*
850 * Get the value of an environment variable. 821 * Get the value of an environment variable.
851 */ 822 */
852 tree_constant * 823 tree_constant *
853 builtin_getenv (const tree_constant *args, int nargin, int nargout) 824 builtin_getenv (const tree_constant *args, int nargin, int nargout)
854 { 825 {
1686 1657
1687 return retval; 1658 return retval;
1688 } 1659 }
1689 1660
1690 /* 1661 /*
1662 * Variable argument lists.
1663 */
1664 tree_constant *
1665 builtin_va_arg (const tree_constant *args, int nargin, int nargout)
1666 {
1667 tree_constant *retval = NULL_TREE_CONST;
1668 if (nargin == 1)
1669 {
1670 if (curr_function != (tree_function *) NULL)
1671 {
1672 if (curr_function->takes_varargs ())
1673 {
1674 retval = new tree_constant [2];
1675 retval[0] = curr_function->va_arg ();
1676 }
1677 else
1678 error ("va_arg only valid within function taking\
1679 variable number of arguments");
1680 }
1681 else
1682 error ("va_arg only valid within function body");
1683 }
1684 else
1685 print_usage ("va_arg");
1686
1687 return retval;
1688 }
1689
1690 tree_constant *
1691 builtin_va_start (const tree_constant *args, int nargin, int nargout)
1692 {
1693 tree_constant *retval = NULL_TREE_CONST;
1694 if (nargin == 1)
1695 {
1696 if (curr_function != (tree_function *) NULL)
1697 {
1698 if (curr_function->takes_varargs ())
1699 curr_function->va_start ();
1700 else
1701 error ("va_start only valid within function taking\
1702 variable number of arguments");
1703 }
1704 else
1705 error ("va_start only valid within function body");
1706 }
1707 else
1708 print_usage ("va_start");
1709
1710 return retval;
1711 }
1712
1713 /*
1691 * Copying information. 1714 * Copying information.
1692 */ 1715 */
1693 tree_constant * 1716 tree_constant *
1694 builtin_warranty (const tree_constant *args, int nargin, int nargout) 1717 builtin_warranty (const tree_constant *args, int nargin, int nargout)
1695 { 1718 {