/* * Class: ch_jodersky_flow_UnsafeSerial__ * Method: debug * Signature: (Z)V */ JNIEXPORT void JNICALL Java_ch_jodersky_flow_UnsafeSerial_00024_debug (JNIEnv *env, jobject instance, jboolean value) { UNUSED_ARG(env); UNUSED_ARG(instance); serial_debug((bool) value); }
void kbd_handler() { char scancode = 0; if(inb(0x64) & 1) scancode = inb(0x60); // kprintf("%X ", scancode); // return; if(scancode & 0x80) { // when key release // if(scancode == 0x2A || scancode == 0x36) { shift_pressed = false; return; } } else { scancode = scancode & 0x7F; // 0x0E -> backspace // 0x49 -> page up // 0x48 -> a up // 0x4B -> a left // 0x4D -> a right // 0x50 -> a down // 0x51 -> page down // 0x47 -> home // 0x4F -> end serial_debug("%X ", scancode); if(scancode == 0x48) { scroll_up(); return; } if(scancode == 0x50) { scroll_down(); return; } if (scancode == 0x1) { kprintf("Shut down\n"); char *c = "Shutdown"; while (*c) { outb(0x8900, *c++); } } // kprintf("%c", scancode); // when key pressed // if(scancode == 0x2A || scancode == 0x36) { shift_pressed = true; return; } if(shift_pressed) { kprintf("%c", kbd_map_shift[scancode]); } else { kprintf("%c", kbd_map[scancode]); } } return; }
void dump_engine(fuzzy_engine* engine) { char buffer[500]; char buffer_tmp[600]; serial_debug("Linguistic variables\n====================\n", DEBUG_1); linked_list_node* node = engine->ling_vars->head; linked_list_node* aux_node; ling_var* var; ling_val* val; while(node != 0) { var = (ling_var*)node->data; os_sprintf(buffer, "%d %d %s ", var->id, var->type, var->name); ftoa(var->value, buffer); serial_debug(buffer, DEBUG_1); aux_node = var->values->head; serial_debug(" ", DEBUG_1); while(aux_node != 0) { val = (ling_val*)aux_node->data; os_sprintf(buffer, "%s ", val->name); serial_debug(buffer, DEBUG_1); aux_node = aux_node->next; } serial_debug("\n", DEBUG_1); node = node->next; } serial_debug("Rules\n=====\n", DEBUG_1); node = engine->rules->head; condition* cond; while(node != 0) { fuzzy_rule* rule = node->data; aux_node = rule->antecedent->head; while(aux_node != 0) { cond = aux_node->data; os_sprintf(buffer, "if %s is %s %d ", cond->variable->name, cond->value->name, cond->op); serial_debug(buffer, DEBUG_1); aux_node = aux_node->next; } os_sprintf(buffer, "then %s is %s | result: ", rule->consequent->variable->name, rule->consequent->value->name); ftoa(rule->result, buffer); os_sprintf(buffer_tmp, "%s consequent value: ", buffer); ftoa(rule->consequent->result, buffer_tmp); serial_debug(buffer, DEBUG_1); node = node->next; } }
/* * Class: com_github_jodersky_flow_internal_NativeSerial * Method: debug * Signature: (Z)V */ JNIEXPORT void JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_debug (JNIEnv *env, jclass clazz, jboolean value) { serial_debug((bool) value); }