Compare commits
3 commits
1fd55fa7d1
...
a9d8874980
| Author | SHA1 | Date | |
|---|---|---|---|
| a9d8874980 | |||
| 467746b30e | |||
| 08703389db |
5 changed files with 71 additions and 3 deletions
1
axl.h
1
axl.h
|
|
@ -4,5 +4,6 @@
|
|||
#include "axl_types.h"
|
||||
#include "axl_memory.h"
|
||||
#include "axl_string.h"
|
||||
#include "axl_io.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
53
axl_io.c
Normal file
53
axl_io.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include "axl_io.h"
|
||||
#include <windows.h>
|
||||
#include "axl_string.h"
|
||||
|
||||
i8 axl_putchar(i32 c)
|
||||
{
|
||||
HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
if(console_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return AXL_EOF;
|
||||
}
|
||||
|
||||
i8 char_to_write = (i8)c;
|
||||
DWORD bytes_written = 0;
|
||||
|
||||
BOOL status = WriteConsoleA(console_handle, &char_to_write, 1,
|
||||
&bytes_written, NULL);
|
||||
|
||||
if(!status || bytes_written != 1)
|
||||
{
|
||||
return AXL_EOF;
|
||||
}
|
||||
|
||||
return char_to_write;
|
||||
}
|
||||
|
||||
i8 axl_puts(const i8* str)
|
||||
{
|
||||
HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
if(console_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return AXL_EOF;
|
||||
}
|
||||
|
||||
DWORD str_length = (DWORD)axl_strlen(str);
|
||||
DWORD bytes_written = 0;
|
||||
|
||||
BOOL status = WriteConsoleA(console_handle, str, str_length, &bytes_written,
|
||||
NULL);
|
||||
if(!status || bytes_written != str_length)
|
||||
{
|
||||
return AXL_EOF;
|
||||
}
|
||||
|
||||
if(axl_putchar('\n') != '\n')
|
||||
{
|
||||
return AXL_EOF;
|
||||
}
|
||||
|
||||
return AXL_SUCCESS;
|
||||
}
|
||||
10
axl_io.h
Normal file
10
axl_io.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef AXL_IO_H
|
||||
#include "axl_types.h"
|
||||
|
||||
#define AXL_EOF -1
|
||||
#define AXL_SUCCESS 0
|
||||
|
||||
i8 axl_putchar(i32 c);
|
||||
i8 axl_puts(const i8* str);
|
||||
|
||||
#endif // !AXL_IO_H
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
#ifndef AXL_STRING_H
|
||||
#define AXL_STRING_H
|
||||
|
||||
#include "axl_types.h"
|
||||
|
||||
u32 axl_strlen(const i8* s);
|
||||
|
|
|
|||
9
main.c
9
main.c
|
|
@ -4,6 +4,13 @@ int _start(void)
|
|||
{
|
||||
axl_init();
|
||||
|
||||
axl_puts("Potato activated");
|
||||
axl_puts("Quack quack motherducker");
|
||||
axl_puts("Meowdy partner");
|
||||
axl_puts("I am a meat popsicle");
|
||||
axl_puts("My spoon is too big");
|
||||
axl_puts("Blin!");
|
||||
|
||||
void* fds = axl_malloc(83);
|
||||
|
||||
int* f = axl_malloc(sizeof(int));
|
||||
|
|
@ -16,7 +23,5 @@ int _start(void)
|
|||
(void)fds;
|
||||
(void)f;
|
||||
|
||||
while(true){}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue