#include "assert.h" #include "errors/errors.h" #include "errors/exceptions.h" #include "interpreter/parameters/actions.h" #include "interpreter/parameters/current.h" #include "interpreter/parameters/parameters.h" #include "object.h" #include "types/composites/composites.h" #include "types/composites/load.h" #include "types/equality.h" #define converted(OBJECT) ( \ ((OBJECT) = ((OBJECT).type == integertype ? cvs((OBJECT), memory(longestname)) : (OBJECT))), \ ((OBJECT).type != stringtype ? (throw (typecheck), null) : (OBJECT)) \ ) void setpassword(object plaintext, const object password) { if (eq(password, string("SystemParamsPassword")) || eq(password, string("StartJobPassword"))) (void)setinterpreterparameter((object [pair]){[key] = password, [value] = converted(plaintext)}, category(System)); else throw (undefined); } object secret(const object password) { if (eq(password, string("SystemParamsPassword")) || eq(password, string("StartJobPassword"))) { const object * const entry = current(password, category(System)); return entry ? *valuefrom(entry) : string(""); } else { throw (undefined); } } boolean checkpassword(object plaintext, const object password) { const object Password = secret(password); return (eq(string(""), Password) || eq(converted(plaintext), Password)); }