Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Arbitrarily Nested Loops

by ikegami (Patriarch)
on Feb 03, 2006 at 16:44 UTC ( [id://527721]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    struct NestedLoopList {
       int   elem_size;
    ...
          struct NestedLoopFuncArg  func;
       } ptr;
    };
    
  2. or download this
    struct NestedLoopArg* args = (NestedLoopArg*)calloc(2, sizeof(NestedLo
    +opArg));
    
    ...
    NestedLoops(args);
    
    ... free memory allocated for args ...
    
  3. or download this
    struct NestedLoopList list;
    if ((*arg_ptr).ptr_type == 0)
    ...
       struct NestedLoopFuncArg* func_ptr = (*arg_ptr).ptr;
       (*(*func_ptr).ptr)(&list, (*func_ptr).pad);
    }
    
  4. or download this
    struct MyFuncPad {
       int count;
    ...
       (*list_ptr).ptr       = array;
       (*list_ptr).free_ptr  = 1;
    }
    
  5. or download this
    /* Convert the pointer to an int since ++ and other  */
    /* arithmentic operators are overloaded for pointers */
    ...
    
       ...work with elem_ptr...
    }
    
  6. or download this
    struct ElementType {
       int  size;
    ...
          struct NestedLoopFuncArg  func;
       } ptr;
    };
    
  7. or download this
    struct NestedLoopArg* arg = (NestedLoopArg*)calloc(2, sizeof(NestedLoo
    +pArg));
    
    ...
    NestedLoops(args);
    
    ... free memory allocated for args ...
    
  8. or download this
    struct NestedLoopList list;
    
    ...
          break;
       }
    }
    
  9. or download this
    struct MyFuncPad {
       int count;
    ...
       (*list_ptr).free_ptr   = 1;
       (*list_ptr).free_elems = 1;
    }
    
  10. or download this
    Element* elem_ptr = list.ptr;
    
    ...
       free(list.ptr);
       list.ptr = NULL;
    }
    
  11. or download this
    if (list.free_elems) {
       int i;
    ...
    if (list.free_ptr) {
       free(list.ptr);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://527721]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-23 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found