Exemple #1
0
        public static int PyNode_AddChild(node n1, int type, CharPtr str, int lineno)
        {
            int     nch = n1.n_nchildren;
            int     current_capacity;
            int     required_capacity;
            nodePtr n;

            if (nch == INT_MAX || nch < 0)
            {
                return(E_OVERFLOW);
            }
            current_capacity  = XXXROUNDUP(nch);
            required_capacity = XXXROUNDUP(nch + 1);
            if (current_capacity < 0 || required_capacity < 0)
            {
                return(E_OVERFLOW);
            }
            if (current_capacity < required_capacity)
            {
                n = new nodePtr(n1.n_child);
                PyMem_RESIZE_node(ref n, required_capacity);
                if (n == null)
                {
                    return(E_NOMEM);
                }
                n1.n_child = n;
            }
            n                = new nodePtr(n1.n_child, n1.n_nchildren++);
            n[0].n_type      = (short)type;
            n[0].n_str       = str;
            n[0].n_lineno    = lineno;
            n[0].n_nchildren = 0;
            n[0].n_child     = null;
            return(0);
        }
Exemple #2
0
 public nodePtr(nodePtr ptr, int index)
 {
 }
Exemple #3
0
 public static void PyMem_RESIZE_node(ref nodePtr x, int n)
 {
 }
Exemple #4
0
 public nodePtr(nodePtr ptr)
 {
 }
Exemple #5
0
 public static void PyMem_DEL(ref nodePtr x)
 {
 }