next up previous contents
Next: With CMOD Up: Write the Functions Previous: Write the Functions   Contents

Without CMOD

We have stubs for the functions, so then we can go on writing the code. What needs to be done in each function that implements a method is in abstract:

  1. Read the parameters from the stack. The argument args specifies how many parameters that should be read. Pointers to the parameters can be found in Pike_sp[-args], Pike_sp[1-args], Pike_sp[2-args] and so on..
  2. Make function calls, assignments, and so on until we have the desired result, i.e. until the return value is right and all variables in the storage have their desired value. In other words, write the actual program.
  3. Pop the parameters from the stack and push the return value from 2) to the stack.
As we can see all input to and output from the functions is passed through the stack.



2003-03-04