Conversion stuff

pull/38/head
E. Almqvist 3 years ago
parent 08d1f09e4c
commit 62f473f1e7
  1. 4
      drivers/vga.c
  2. 2
      kernel/kernel.c
  3. 10
      lib/conv.c
  4. 2
      lib/conv.h
  5. 10
      lib/util.c
  6. 3
      lib/util.h

@ -4,7 +4,7 @@
#include "../kernel/io.h" #include "../kernel/io.h"
#include "../kernel/memory.h" #include "../kernel/memory.h"
#include "../lib/str.h" #include "../lib/str.h"
#include "../lib/strf.h" #include "../lib/conv.h"
static uint cursor_row = 0; static uint cursor_row = 0;
static uint cursor_col = 0; static uint cursor_col = 0;
@ -75,10 +75,12 @@ void println(char* str, int attribute_byte) {
} }
void printint(int i, int attribute_byte) { void printint(int i, int attribute_byte) {
/*
char* strbuf; char* strbuf;
strbuf = int_to_str(i, strbuf); strbuf = int_to_str(i, strbuf);
println(strbuf, attribute_byte); println(strbuf, attribute_byte);
*/
} }
void printalign(char* str, int attribute_byte, enum align alignment) { void printalign(char* str, int attribute_byte, enum align alignment) {

@ -3,7 +3,7 @@
#include "paging.h" #include "paging.h"
#include "../drivers/vga.h" #include "../drivers/vga.h"
#include "../lib/str.h" #include "../lib/str.h"
#include "../lib/strf.h" #include "../lib/conv.h"
void init() { void init() {
vga_init(); // Initialize the screen first vga_init(); // Initialize the screen first

@ -1,2 +1,12 @@
#include "conv.h" #include "conv.h"
void int_to_str(int i, char* buf) {
bool use_sign = false;
if( i < 0 ) {
i = (ulong)(i * (-1))
use_sign = true;
}
uint len = ulong_len(i);
}

@ -1 +1,3 @@
#include "types.h"
void int_to_str(int i, char* buf); void int_to_str(int i, char* buf);

@ -0,0 +1,10 @@
#include "util.h"
uint ulong_len(ulong i) {
int len = 0;
while (i != 0) {
i = i / 10;
++len;
}
return len;
}

@ -0,0 +1,3 @@
#include "types.h"
uint ulong_len(ulong n);
Loading…
Cancel
Save