Next: With CMOD
Up: Write the Functions
Previous: Write the Functions
  Contents
reversed_string_create()
This is the function that will be run upon creation of a ReversedString
object, because we set that earlier in pike_module_init(). It does the following:
- Checks whether the constructor was called with one argument, i.e.
if args == 1, throws an exception if not
- Checks whether the only argument is a pike_string ,
throws an exception if not.
- Takes the 49 first characters, using the Pike_fp-current_storage pointer, reverses the order of them, and
stores them in storage.
- Removes one argument from the stack, i.e. does a pop_n_elems(args)
reversed_string_write()
This is just a function to generate some output in order to test if
everything in the create function and the storage works. It does the
following:
- Checks the argument, i.e. check that args == 1 and that the
argument is an int.
- If the argument check succeeded, then it fetches the argument
from the stack, and reads the content of the storage.
- Prints the content of the storage on the screen
The callback functions
The init and exit callback functions exist in this module, but since
nothing needs to be done in them they are left empty. These functions
need to take a struct object* as argument, or else warnings will be
generated when the module is compiled.
Next: With CMOD
Up: Write the Functions
Previous: Write the Functions
  Contents
2003-03-04