88064b2011-12-20Henrik Grubbström (Grubba) /* -*- C -*- * * Cmod header-file acting as a template for the hash classes. */
de38b72013-10-05Henrik Grubbström (Grubba) DOCSTART() @class PIKE_NAME *! *! Implementation of the PIKE_NAME hash algorithm.
88064b2011-12-20Henrik Grubbström (Grubba)  *! DOCEND()
de38b72013-10-05Henrik Grubbström (Grubba) PIKECLASS PIKE_NAME
88064b2011-12-20Henrik Grubbström (Grubba) {
de38b72013-10-05Henrik Grubbström (Grubba)  DOCSTART() @decl inherit Hash DOCEND() INHERIT Hash;
88064b2011-12-20Henrik Grubbström (Grubba)  INIT {
180dd12013-10-19Henrik Grubbström (Grubba)  struct Hash_struct *Hash = (struct Hash_struct *) get_inherit_storage(Pike_fp->current_object, 1 + (Pike_fp->context - Pike_fp->current_program->inherits));
de38b72013-10-05Henrik Grubbström (Grubba)  werror(cmod_STRFY_EVAL(PIKE_NAME) "->INIT\n"); if (Hash && !Hash->meta) Hash->meta = &cmod_CONCAT_EVAL(nettle_, NETTLE_NAME);
88064b2011-12-20Henrik Grubbström (Grubba)  else { /* Can't call Pike_error here. * Pike_error("Can't initialize this object.\n"); */
de38b72013-10-05Henrik Grubbström (Grubba)  werror(cmod_STRFY_EVAL(PIKE_NAME) "->INIT failed\n");
88064b2011-12-20Henrik Grubbström (Grubba)  } }
de38b72013-10-05Henrik Grubbström (Grubba)  DOCSTART() @class State *! *! State for PIKE_NAME hashing. *! DOCEND() PIKECLASS State program_flags PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT; {
fc0a7a2013-10-05Henrik Grubbström (Grubba)  DOCSTART() @decl inherit Hash::State DOCEND()
de38b72013-10-05Henrik Grubbström (Grubba)  EXTRA {
180dd12013-10-19Henrik Grubbström (Grubba)  /* Perform an inherit of the Hash.State class that our parent * contains via its inherit of Hash.
de38b72013-10-05Henrik Grubbström (Grubba)  */ struct program *parent_prog = Pike_compiler->previous->new_program; struct object *parent_obj = Pike_compiler->previous->fake_object; int parent_State_fun_num = really_low_find_shared_string_identifier(MK_STRING("State"), parent_prog, SEE_PROTECTED|SEE_PRIVATE); if (parent_State_fun_num >= 0) { struct program *parent_State_prog = low_program_from_function(parent_obj, parent_State_fun_num); if (parent_State_prog) { low_inherit(parent_State_prog, 0, parent_State_fun_num + parent_prog->inherits[1].identifier_level, 1 + 42, 0, NULL); } } }
88064b2011-12-20Henrik Grubbström (Grubba)  CVAR struct cmod_CONCAT_EVAL(NETTLE_NAME, _ctx) NETTLE_NAME; INIT {
de38b72013-10-05Henrik Grubbström (Grubba)  /* FIXME: Ought to traverse the inherit graph for * the current program. */
180dd12013-10-19Henrik Grubbström (Grubba)  struct Hash_State_struct *instance = (struct Hash_State_struct *) get_inherit_storage(Pike_fp->current_object, 1 + (Pike_fp->context - Pike_fp->current_program->inherits));
de38b72013-10-05Henrik Grubbström (Grubba)  werror(cmod_STRFY_EVAL(PIKE_NAME) ".State->INIT\n");
88064b2011-12-20Henrik Grubbström (Grubba)  assert(instance); cmod_CONCAT_EVAL(NETTLE_NAME, _init)(&THIS->NETTLE_NAME); instance->ctx = &THIS->NETTLE_NAME; }
de38b72013-10-05Henrik Grubbström (Grubba)  } DOCSTART() @endclass State DOCEND()
88064b2011-12-20Henrik Grubbström (Grubba) }
de38b72013-10-05Henrik Grubbström (Grubba) DOCSTART() @endclass PIKE_NAME
88064b2011-12-20Henrik Grubbström (Grubba) DOCEND()
de38b72013-10-05Henrik Grubbström (Grubba)