Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1: - /* $Id: module.pike,v 1.69 2000/01/18 15:15:03 mast Exp $ */ + /* $Id: module.pike,v 1.70 2000/01/23 13:50:26 nilsson Exp $ */   #include <module.h>   #include <request_trace.h>      mapping (string:mixed *) variables=([]);   RoxenModule this = this_object();   mapping(string:array(int)) error_log=([]);      constant is_module = 1;   constant module_type = MODULE_ZERO;   constant module_name = "Unnamed module";
Roxen.git/server/base_server/module.pike:124:    int type, string|void doc_str, mixed|void misc,    int|function|void not_in_config)   {   #ifdef MODULE_DEBUG    if(!strlen(var))    report_debug("No name for variable!\n");   // if(var[0]=='_' && previous_object() != roxen)   // report_debug("Variable names beginning with '_' are reserved for"   // " internal usage.\n");    if (!stringp(name)) -  report_debug("The variable "+var+"has no name.\n"); +  report_error("The variable "+var+"has no name.\n");       if((search(name, "\"") != -1)) -  report_debug("Please do not use \" in variable names"); +  report_error("Please do not use \" in variable names");       if (!stringp(doc_str))    doc_str = "No documentation";       switch (type & VAR_TYPE_MASK)    {    case TYPE_NODE:    if(!arrayp(value)) -  report_debug("TYPE_NODE variables should contain a list of variables " +  report_error("TYPE_NODE variables should contain a list of variables "    "to use as subnodes.\n");    break;    case TYPE_CUSTOM:    if(!misc    && arrayp(misc)    && (sizeof(misc)>=3)    && functionp(misc[0])    && functionp(misc[1])    && functionp(misc[2])) -  report_debug("When defining a TYPE_CUSTOM variable, the MISC " +  report_error("When defining a TYPE_CUSTOM variable, the MISC "    "field must be an array of functionpointers: \n"    "({describe,describe_form,set_from_form})\n");    break;       case TYPE_TEXT_FIELD:    case TYPE_FILE:    case TYPE_STRING:    case TYPE_LOCATION:    case TYPE_PASSWORD:    if(value && !stringp(value)) { -  report_debug("%s:\nPassing illegal value (%t:%O) " +  report_error("%s:\nPassing illegal value (%t:%O) "    "to string type variable.\n",    roxen->filename(this), value, value);    }    break;       case TYPE_FLOAT:    if(!floatp(value)) -  report_debug("%s:\nPassing illegal value (%t:%O) " +  report_error("%s:\nPassing illegal value (%t:%O) "    "(not float) to floating point "    "decimal number variable.\n",    roxen->filename(this), value, value);    break;    case TYPE_INT:    if(!intp(value)) -  report_debug("%s:\nPassing illegal value (%t:%O) " +  report_error("%s:\nPassing illegal value (%t:%O) "    "(not int) to integer number variable.\n",    roxen->filename(this), value, value);    break;       case TYPE_MODULE_LIST:    value = ({});    break;       case TYPE_MODULE:    /* No default possible */    value = 0;    break;       case TYPE_DIR_LIST:    int i;    if(!arrayp(value)) { -  report_debug("%s:\nIllegal type %t to TYPE_DIR_LIST, " +  report_error("%s:\nIllegal type %t to TYPE_DIR_LIST, "    "must be array.\n",    roxen->filename(this), value);    value = ({ "./" });    } else {    for(i=0; i<sizeof(value); i++) {    if(strlen(value[i])) {    if(value[i][-1] != '/')    value[i] += "/";    } else {    value[i]="./";    }    }    }    break;       case TYPE_DIR:    if(value && !stringp(value)) -  report_debug("%s:\nPassing illegal value (%t:%O) (not string) " +  report_error("%s:\nPassing illegal value (%t:%O) (not string) "    "to directory variable.\n",    roxen->filename(this), value, value);       if(value && strlen(value) && ((string)value)[-1] != '/')    value+="/";    break;       case TYPE_INT_LIST:    case TYPE_STRING_LIST:    if(!misc && value && !arrayp(value)) { -  report_debug("%s:\nPassing illegal misc (%t:%O) (not array) " +  report_error("%s:\nPassing illegal misc (%t:%O) (not array) "    "to multiple choice variable.\n",    roxen->filename(this), value, value);    } else {    if(misc && !arrayp(misc)) { -  report_debug("%s:\nPassing illegal misc (%t:%O) (not array) " +  report_error("%s:\nPassing illegal misc (%t:%O) (not array) "    "to multiple choice variable.\n",    roxen->filename(this), misc, misc);    }    if(misc && value && search(misc, value)==-1) { -  report_debug("%s:\nPassing value (%t:%O) not present " +  report_error("%s:\nPassing value (%t:%O) not present "    "in the misc array.\n",    roxen->filename(this), value, value);    }    }    break;       case TYPE_FLAG:    value=!!value;    break;       case TYPE_ERROR:    break;       case TYPE_COLOR:    if (!intp(value)) -  report_debug("%s:\nPassing illegal value (%t:%O) (not int) " +  report_error("%s:\nPassing illegal value (%t:%O) (not int) "    "to color variable.\n",    roxen->filename(this), value, value);    break;       case TYPE_FILE_LIST:    case TYPE_PORTS:    case TYPE_FONT:    // FIXME: Add checks for these.    break;       default: -  report_debug("%s:\nIllegal type (%s) in defvar.\n", +  report_error("%s:\nIllegal type (%s) in defvar.\n",    roxen->filename(this), type);    break;    }   #endif    // Locale stuff.    reg_s_loc( this_object(), var, name, doc_str );       variables[var]=allocate( VAR_SIZE );    variables[var][ VAR_VALUE ]=value;    variables[var][ VAR_TYPE ]=type&VAR_TYPE_MASK;