Permalink
Browse files

Rename project

  • Loading branch information...
marciof committed Mar 22, 2018
1 parent 9474ac0 commit bfacfa63e202f0a074dcdc546a328f1443ed6f6b
Showing with 476 additions and 476 deletions.
  1. +1 −1 CMakeLists.txt
  2. +11 −11 interpreter/core/Log.c
  3. +9 −9 interpreter/core/Log.h
  4. +2 −2 interpreter/core/Memory.h
  5. +4 −4 interpreter/core/System.h
  6. +5 −5 interpreter/i386/Bit.h
  7. +15 −15 interpreter/i386/IO.asm
  8. +6 −6 interpreter/i386/IO.h
  9. +12 −12 interpreter/i386/Log.c
  10. +4 −4 interpreter/i386/Memory.asm
  11. +9 −9 interpreter/i386/Memory.c
  12. +52 −52 interpreter/i386/Multiboot.c
  13. +2 −2 interpreter/i386/Multiboot.h
  14. +10 −10 interpreter/i386/System.asm
  15. +15 −15 interpreter/i386/System.c
  16. +1 −1 interpreter/i386/arg.asm
  17. +19 −19 interpreter/i386/vga/Attr.c
  18. +11 −11 interpreter/i386/vga/Attr.h
  19. +16 −16 interpreter/i386/vga/CRT.c
  20. +31 −31 interpreter/i386/vga/CRT.h
  21. +10 −10 interpreter/i386/vga/Color.c
  22. +3 −3 interpreter/i386/vga/Color.h
  23. +10 −10 interpreter/i386/vga/Extern.c
  24. +2 −2 interpreter/i386/vga/Extern.h
  25. +9 −9 interpreter/i386/vga/Gfx.c
  26. +14 −14 interpreter/i386/vga/Gfx.h
  27. +11 −11 interpreter/i386/vga/Seqr.c
  28. +9 −9 interpreter/i386/vga/Seqr.h
  29. +17 −17 interpreter/i386/vga/Text.c
  30. +25 −25 interpreter/i386/vga/Text.h
  31. +5 −5 interpreter/javascript/Err.h
  32. +8 −8 interpreter/javascript/Input.c
  33. +8 −8 interpreter/javascript/Input.h
  34. +7 −7 interpreter/javascript/Ref.h
  35. +11 −11 interpreter/javascript/Str.c
  36. +4 −4 interpreter/javascript/Str.h
  37. +35 −35 interpreter/javascript/Token.c
  38. +9 −9 interpreter/javascript/Token.h
  39. +4 −4 interpreter/javascript/main.c
  40. 0 interpreter/javascript/{eon.js → main.js}
  41. +2 −2 interpreter/javascript/package.json
  42. +15 −15 interpreter/javascript/test/number.js
  43. +13 −13 interpreter/native/Log.c
  44. +1 −1 interpreter/native/Memory.c
  45. +9 −9 interpreter/native/System.c
  46. 0 stdlib/{core.eon → core.k}
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
project(eon)
project(karyon)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(interpreter)
@@ -13,7 +13,7 @@
#define STATIC_ARRAY_LEN(array) (sizeof((array)) / sizeof((array)[0]))
static void print_int(struct e_Log* log, unsigned int integer, size_t base) {
static void print_int(struct k_Log* log, unsigned int integer, size_t base) {
if (integer == 0) {
log->print_ch(log, NUMERIC_BASE_CONVERSION_SYMBOLS[integer]);
return;
@@ -38,7 +38,7 @@ static void print_int(struct e_Log* log, unsigned int integer, size_t base) {
log->print_str(log, byte + i + 1);
}
static void print(struct e_Log* log, const char* format, va_list args) {
static void print(struct k_Log* log, const char* format, va_list args) {
for (; *format != '\0'; ++format) {
if (*format == PLACEHOLDER_END) {
++format;
@@ -49,7 +49,7 @@ static void print(struct e_Log* log, const char* format, va_list args) {
}
else {
log->print_str(log, "\n" FORMAT_STR_ERROR);
e_System_get()->stop(e_System_get(), E_SYSTEM_HALT);
k_System_get()->stop(k_System_get(), K_SYSTEM_HALT);
}
}
else if (*format != PLACEHOLDER_BEGIN) {
@@ -104,27 +104,27 @@ static void print(struct e_Log* log, const char* format, va_list args) {
break;
default:
log->print_str(log, "\n" FORMAT_STR_ERROR);
e_System_get()->stop(e_System_get(), E_SYSTEM_HALT);
k_System_get()->stop(k_System_get(), K_SYSTEM_HALT);
break;
}
if (*format != PLACEHOLDER_END) {
log->print_str(log, "\n" FORMAT_STR_ERROR);
e_System_get()->stop(e_System_get(), E_SYSTEM_HALT);
k_System_get()->stop(k_System_get(), K_SYSTEM_HALT);
}
}
}
void e_Log_msg(
struct e_Log* log, enum e_Log_Level level, const char* format, ...) {
void k_Log_msg(
struct k_Log* log, enum k_Log_Level level, const char* format, ...) {
const char* msg_prefix;
log->prepare(log, level);
if (level == E_LOG_ERROR) {
if (level == K_LOG_ERROR) {
msg_prefix = ERROR_MSG_PREFIX;
}
else if (level == E_LOG_WARN) {
else if (level == K_LOG_WARN) {
msg_prefix = "[WARN] ";
}
else {
@@ -139,7 +139,7 @@ void e_Log_msg(
va_end(args);
log->print_ch(log, '\n');
if (level == E_LOG_ERROR) {
e_System_get()->stop(e_System_get(), E_SYSTEM_HALT);
if (level == K_LOG_ERROR) {
k_System_get()->stop(k_System_get(), K_SYSTEM_HALT);
}
}
@@ -1,19 +1,19 @@
#pragma once
#include <stdint.h>
enum {E_LOG_TAB_SIZE_SPACES = 4};
enum e_Log_Level {E_LOG_ERROR, E_LOG_WARN, E_LOG_INFO};
enum {K_LOG_TAB_SIZE_SPACES = 4};
enum k_Log_Level {K_LOG_ERROR, K_LOG_WARN, K_LOG_INFO};
// FIXME: use ref?
// FIMXE: add timestamps?
struct e_Log {
void (*prepare)(struct e_Log* log, enum e_Log_Level level);
void (*print_ch)(struct e_Log* log, char ch);
void (*print_str)(struct e_Log* log, const char* str);
struct k_Log {
void (*prepare)(struct k_Log* log, enum k_Log_Level level);
void (*print_ch)(struct k_Log* log, char ch);
void (*print_str)(struct k_Log* log, const char* str);
uint8_t val[];
};
extern struct e_Log* e_Log_get();
extern struct k_Log* k_Log_get();
/**
* Log format is a regular string with placeholders denoted by curly braces.
@@ -30,5 +30,5 @@ extern struct e_Log* e_Log_get();
*
* To print a literal curly brace, repeat it twice.
*/
void e_Log_msg(
struct e_Log* log, enum e_Log_Level level, const char* format, ...);
void k_Log_msg(
struct k_Log* log, enum k_Log_Level level, const char* format, ...);
@@ -1,5 +1,5 @@
#pragma once
struct e_Memory;
struct k_Memory;
extern struct e_Memory* e_Memory_get();
extern struct k_Memory* k_Memory_get();
@@ -1,9 +1,9 @@
#pragma once
enum e_System_Stop_Mode {E_SYSTEM_HALT, E_SYSTEM_RESET};
enum k_System_Stop_Mode {K_SYSTEM_HALT, K_SYSTEM_RESET};
struct e_System {
void (*stop)(struct e_System* system, enum e_System_Stop_Mode mode);
struct k_System {
void (*stop)(struct k_System* system, enum k_System_Stop_Mode mode);
};
extern struct e_System* e_System_get();
extern struct k_System* k_System_get();
@@ -1,17 +1,17 @@
#pragma once
#include <stdbool.h>
#define E_BIT(pos) \
#define K_BIT(pos) \
(1 << (pos))
#define E_BIT_CLEAR(value, bit_flag) \
#define K_BIT_CLEAR(value, bit_flag) \
((value) & (~0 ^ (bit_flag)))
#define E_BIT_IS_SET(value, bit_flag) \
#define K_BIT_IS_SET(value, bit_flag) \
(((value) & (bit_flag)) != 0 ? true : false)
#define E_BIT_ATTR_PACKED(type) \
#define K_BIT_ATTR_PACKED(type) \
type __attribute__((__packed__))
#define E_BIT_ATTR_SECTION(name, declaration) \
#define K_BIT_ATTR_SECTION(name, declaration) \
declaration __attribute__((section(name)))
@@ -1,10 +1,10 @@
%include "arg.asm"
%macro E_IO_READ_FN 2
global e_IO_read_%1
e_IO_read_%1:
%macro K_IO_READ_FN 2
global k_IO_read_%1
k_IO_read_%1:
enter 0, 0
mov edx, E_ARG(1)
mov edx, K_ARG(1)
; Clear return value register.
mov eax, 0
@@ -16,13 +16,13 @@ e_IO_read_%1:
ret
%endmacro
%macro E_IO_WRITE_FN 2
global e_IO_write_%1
e_IO_write_%1:
%macro K_IO_WRITE_FN 2
global k_IO_write_%1
k_IO_write_%1:
enter 0, 0
mov edx, E_ARG(1)
mov eax, E_ARG(2)
mov edx, K_ARG(1)
mov eax, K_ARG(2)
out dx, %2
leave
@@ -32,10 +32,10 @@ e_IO_write_%1:
section .text
align 4
E_IO_READ_FN byte, al
E_IO_READ_FN dword, eax
E_IO_READ_FN word, ax
K_IO_READ_FN byte, al
K_IO_READ_FN dword, eax
K_IO_READ_FN word, ax
E_IO_WRITE_FN byte, al
E_IO_WRITE_FN dword, eax
E_IO_WRITE_FN word, ax
K_IO_WRITE_FN byte, al
K_IO_WRITE_FN dword, eax
K_IO_WRITE_FN word, ax
@@ -2,9 +2,9 @@
#include <stddef.h>
#include <stdint.h>
extern uint8_t e_IO_read_byte(uint16_t port);
extern uint32_t e_IO_read_dword(uint16_t port);
extern uint16_t e_IO_read_word(uint16_t port);
extern void e_IO_write_byte(uint16_t port, uint8_t data);
extern void e_IO_write_dword(uint16_t port, uint32_t data);
extern void e_IO_write_word(uint16_t port, uint16_t data);
extern uint8_t k_IO_read_byte(uint16_t port);
extern uint32_t k_IO_read_dword(uint16_t port);
extern uint16_t k_IO_read_word(uint16_t port);
extern void k_IO_write_byte(uint16_t port, uint8_t data);
extern void k_IO_write_dword(uint16_t port, uint32_t data);
extern void k_IO_write_word(uint16_t port, uint16_t data);
@@ -1,28 +1,28 @@
#include "../core/Log.h"
#include "vga/Text.h"
static void prepare(struct e_Log* log, enum e_Log_Level level) {
if (level == E_LOG_ERROR) {
e_VGA_Text_set_color(E_VGA_TEXT_RED, E_VGA_TEXT_BLACK);
static void prepare(struct k_Log* log, enum k_Log_Level level) {
if (level == K_LOG_ERROR) {
k_VGA_Text_set_color(K_VGA_TEXT_RED, K_VGA_TEXT_BLACK);
}
else if (level == E_LOG_WARN) {
e_VGA_Text_set_color(E_VGA_TEXT_YELLOW, E_VGA_TEXT_BLACK);
else if (level == K_LOG_WARN) {
k_VGA_Text_set_color(K_VGA_TEXT_YELLOW, K_VGA_TEXT_BLACK);
}
else {
e_VGA_Text_set_color(E_VGA_TEXT_WHITE, E_VGA_TEXT_BLACK);
k_VGA_Text_set_color(K_VGA_TEXT_WHITE, K_VGA_TEXT_BLACK);
}
}
static void print_ch(struct e_Log* log, char ch) {
e_VGA_Text_print_ch(ch);
static void print_ch(struct k_Log* log, char ch) {
k_VGA_Text_print_ch(ch);
}
static void print_str(struct e_Log* log, const char* str) {
e_VGA_Text_print_str(str);
static void print_str(struct k_Log* log, const char* str) {
k_VGA_Text_print_str(str);
}
// FIXME: remove globals in VGA and use this instance instead?
struct e_Log* e_Log_get() {
static struct e_Log log = {prepare, print_ch, print_str};
struct k_Log* k_Log_get() {
static struct k_Log log = {prepare, print_ch, print_str};
return &log;
}
@@ -10,14 +10,14 @@ gdtr:
section .text
align 4
global e_Memory_Physical_set_gdt_reg
e_Memory_Physical_set_gdt_reg:
global k_Memory_Physical_set_gdt_reg
k_Memory_Physical_set_gdt_reg:
enter 0, 0
mov ax, E_ARG(1)
mov ax, K_ARG(1)
mov [gdtr], ax
mov eax, E_ARG(2)
mov eax, K_ARG(2)
mov [gdtr + 2], eax
lgdt [gdtr]
@@ -10,21 +10,21 @@
#define STATIC_ASSERT(expr, message) \
enum {CONCAT_EXPAND(STATIC_ASSERTION_, __LINE__) = 1 / ((expr) ? 1 : 0)}
extern void e_Memory_Physical_set_gdt_reg(uint16_t size_bytes, uint32_t addr);
extern void k_Memory_Physical_set_gdt_reg(uint16_t size_bytes, uint32_t addr);
enum Segment_Attr {
ACCESSED = E_BIT(0),
EXECUTABLE = E_BIT(3),
ACCESSED = K_BIT(0),
EXECUTABLE = K_BIT(3),
};
enum Segment_Attr_Code {
EXECUTE_READ = E_BIT(1),
CONFORMING = E_BIT(2),
EXECUTE_READ = K_BIT(1),
CONFORMING = K_BIT(2),
};
enum Segment_Attr_Data {
READ_WRITE = E_BIT(1),
EXPAND_DOWN = E_BIT(2),
READ_WRITE = K_BIT(1),
EXPAND_DOWN = K_BIT(2),
};
enum Segment_Granularity {
@@ -50,7 +50,7 @@ enum Segment_Type {
CODE_DATA = 1,
};
E_BIT_ATTR_PACKED(struct Segment_Descriptor {
K_BIT_ATTR_PACKED(struct Segment_Descriptor {
/** Specifies the segment size according to the granularity. */
uint16_t segment_limit_low;
@@ -79,6 +79,6 @@ E_BIT_ATTR_PACKED(struct Segment_Descriptor {
STATIC_ASSERT(sizeof(struct Segment_Descriptor) == 8,
"Memory segment descriptor structure not packed.");
struct e_Memory* e_Memory_get() {
struct k_Memory* k_Memory_get() {
return NULL;
}
Oops, something went wrong.

0 comments on commit bfacfa6

Please sign in to comment.