<commit_before>#![feature(no_std,lang_items,core)]
#![no_std]

#![crate_type = "staticlib"]
#![crate_name = "rustcode"]

#[macro_use]
extern crate core;
extern crate rlibc;

use core::fmt;

#[no_mangle]
pub fn kernel_main() {

}

#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}

#[lang = "panic_fmt"]
pub extern fn rust_begin_unwind(args: fmt::Arguments,
                                file: &'static str, line: u32) -> ! {
//    use core::fmt::Write;
//    log!("\r\nPanic at {}:{}: ", file, line);<commit_msg>Painting screen<commit_after>#![feature(no_std,lang_items,core)]
#![no_std]

#![crate_type = "staticlib"]
#![crate_name = "rustcode"]

#![allow(dead_code)]

#[macro_use]
extern crate core;
extern crate rlibc;

use core::prelude::*;
use core::fmt;

enum Color {
    Black      = 0,
    Blue       = 1,
    Green      = 2,
    Cyan       = 3,
    Red        = 4,
    Pink       = 5,
    Brown      = 6,
    LightGray  = 7,
    DarkGray   = 8,
    LightBlue  = 9,
    LightGreen = 10,
    LightCyan  = 11,
    LightRed   = 12,
    LightPink  = 13,
    Yellow     = 14,
    White      = 15,
}

fn clear_screen(background: u16) {
    for i in 0..(80 * 25) {
        unsafe {
            *((0xb8000 + i * 2) as *mut u16) = background << 12;
        }
    }
}

/**
 * This is the entry point to the kernel. It is the first rust code that runs.
 */
#[no_mangle]
pub fn kernel_main() {
    let color = Color::LightGreen as u16;
    clear_screen(color);
}


// For bare-bones rust
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}

#[lang = "panic_fmt"]
pub extern fn rust_begin_unwind(args: fmt::Arguments,
                                file: &'static str, line: u32) -> ! {
//    use core::fmt::Write;
//    log!("\r\nPanic at {}:{}: ", file, line);
{'fraction_non_alphanumeric': 0.1641079936474325, 'fraction_numerical': 0.02382212811011117, 'mean_word_length': 2.6206896551724137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3458839', 'n_tokens_mistral': 738, 'n_tokens_neox': 698, 'n_words': 173}