Skip to content

Commit

Permalink
29-3
Browse files Browse the repository at this point in the history
  • Loading branch information
kowill committed Sep 12, 2019
1 parent de3160e commit bb809a6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 deletions.
51 changes: 51 additions & 0 deletions 29_day/api.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <stdio.h>
#include <stdarg.h>
#include "app_c/apilib.h"

int putchar(int c);
int printf(char *format, ...);
void *malloc(int size);
void free(void *p);

int putchar(int c)
{
api_putchar(c);
return c;
}

int printf(char *format, ...)
{
va_list ap;
char s[1000];
int i;

va_start(ap, format);
i = vsprintf(s, format, ap);
api_putstr0(s);
va_end(ap);
return i;
}

void *malloc(int size)
{
char *p = api_malloc(size + 16);
if (p != 0)
{
*((int *)p) = size;
p += 16;
}
return p;
}

void free(void *p)
{
char *q = p;
int size;
if (q != 0)
{
q -= 16;
size = *((int *)q);
api_free(q, size + 18);
}
return;
}
19 changes: 0 additions & 19 deletions 29_day/app_c/typeipl.c

This file was deleted.

4 changes: 2 additions & 2 deletions 29_day/bootpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ struct TASK
struct FILEHANDLE
{
char *buf;
char size;
char pos;
int size;
int pos;
};

struct TASKLEVEL
Expand Down
1 change: 0 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ $appTargest = @(
@{Name = "color2"; HeapSize = "56k" },
@{Name = "sosu"; HeapSize = "56k"; StackSize = "11k" },
@{Name = "sosu3"; HeapSize = "56k"; StackSize = "11k" },
@{Name = "typeipl"; HeapSize = "40k"; },
@{Name = "type"; HeapSize = "0" },
@{Name = "iroha"; HeapSize = "0" },
@{Name = "chlang"; HeapSize = "0" }
Expand Down

0 comments on commit bb809a6

Please sign in to comment.