¿Se apaga la CPU? | ¿Se apaga la RAM? | ¿Se cierra la sesión? | |
Encendido | No | No | No |
Suspendido (Modo S3) | Sí | No | No |
Hibernado (Modo S4) | Sí | Sí | No |
Apagado | Sí | Sí | Sï |
Nota: Para los modos ver ACPI.
Información aleatoria proveniente de un ser racional
¿Se apaga la CPU? | ¿Se apaga la RAM? | ¿Se cierra la sesión? | |
Encendido | No | No | No |
Suspendido (Modo S3) | Sí | No | No |
Hibernado (Modo S4) | Sí | Sí | No |
Apagado | Sí | Sí | Sï |
int GetInteger()const { if(type==INT_LIT) return int_val; throw L"Integer expected"; } bool GetBoolean()const { if(type==BOOL_VAL) return bool_val; throw L"Boolean expected"; } STRING const& GetString()const { if(type==STRING_LIT) return *string_val; throw L"String expected"; }
> define(a, 5) [] > define(f, lambda([x],[x+a])) [] > f(3) 8
CELL* Script::FindName(CELL& name, CELL& envir) { //Try to find the name in current environment ENVIR_TABLE::const_iterator i=envir.envir_table->find(&name); if(i!=envir.envir_table->end()) return i->second; //Failed, try parent if(envir.parent_envir!=NULL) return FindName(name, *envir.parent_envir); //Failed also, not found return NULL; }
void Script::ChangeName(CELL& name, CELL& envir, CELL& value) { //Try to find the name in current environment ENVIR_TABLE::iterator i=envir.envir_table->find(&name); if(i!=envir.envir_table->end()) { (*envir.envir_table)[&name]=&value; return; } //Failed, try parent if(envir.parent_envir!=NULL) return ChangeName(name, *envir.parent_envir, value); //Failed also, not found throw L"Name to be changed is undefined"; }
void CELL::Print(OSTREAM& o)const { switch(type) { default: o << L"{{**UNKNOWN**}}"; break; case UNUSED: o << L"{{**UNUSED**}}"; break; case INT_LIT: o << std::dec << int_val; break; case BOOL_VAL: o << (bool_val ? L"true" : L"false"); break; case LAMBDA_VAL:o << L"{{ "; code->Print(o); o << L" }}"; break; case NATIVE_VAL:o << L"{{NATIVE}}"; break;
case STRING_LIT:PrintEscapedString(o, *string_val); break; case NAME_CODE: o << L"@"; PrintEscapedString(o, *string_val); break;
case CONS_CTOR: case EMPTY_LIT: o << L"["; PrintList(o, L", "); o << L"]"; break; case COMBINE_CODE: op->Print(o); o << L"("; operands->PrintList(o, L", "); o << L")"; break;
case ENVIR_VAL: o << L"{{ENVIR "; for(ENVIR_TABLE::const_iterator i=envir_table->begin(); i!=envir_table->end(); ++i) { o << *i->first->string_val << L"= "; i->second->Print(o); } o << L"}}"; break; } }
void CELL::PrintList(OSTREAM& o, STRING const& separator)const { for(CELL const* c=this; c->type==CONS_CTOR; c=c->tail) { if(c!=this) o << separator; c->head->Print(o); } } void CELL::PrintEscapedString(OSTREAM& o, STRING const& s) { o << L"\""; for(STRING::const_iterator i=s.begin(); i!=s.end(); ++i) { if(*i<32) o << L"\\x" << std::hex << (unsigned int)(unsigned)*i << L";"; else o << *i; } o << L"\""; }
[1, 2, 3] {{ [[@"x"], [@"+"(@"x", @"x")]] }} true
@"f"(@"x", @"y")