Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change C string literal type to array of char.
- Loading branch information
1 parent
64c2186
commit cd69292
Showing
24 changed files
with
469 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
#include "std.h" | ||
|
||
void printf() | ||
void printf(char* x) | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
void printf(); | ||
void printf(char*); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
import io | ||
from ppci.api import ir_to_python, c3toir, get_arch | ||
from ppci.api import ir_to_python, c3_to_ir, get_arch | ||
|
||
|
||
def run_it(): | ||
arch = get_arch('example') | ||
bsp = io.StringIO(""" | ||
arch = get_arch("example") | ||
bsp = io.StringIO( | ||
""" | ||
module bsp; | ||
public function void sleep(int ms); | ||
public function void putc(byte c); | ||
public function bool get_key(int* key); | ||
""") | ||
""" | ||
) | ||
|
||
ircode = c3toir( | ||
['../src/snake/game.c3', '../src/snake/main.c3', '../../librt/io.c3'], | ||
[bsp], arch) | ||
ircode = c3_to_ir( | ||
["../src/snake/game.c3", "../src/snake/main.c3", "../../librt/io.c3"], | ||
[bsp], | ||
arch, | ||
) | ||
|
||
with open('python_snake2.py', 'w') as f: | ||
print('import time', file=f) | ||
print('import sys', file=f) | ||
print('import threading', file=f) | ||
ir_to_python(ircode, f) | ||
with open("python_snake2.py", "w") as f: | ||
print("import time", file=f) | ||
print("import sys", file=f) | ||
print("import threading", file=f) | ||
ir_to_python([ircode], f) | ||
|
||
print('', file=f) | ||
print('def bsp_putc(c):', file=f) | ||
print("", file=f) | ||
print("def bsp_putc(c):", file=f) | ||
print(' print(chr(c), end="")', file=f) | ||
print('def bsp_get_key(x):', file=f) | ||
print(' return 0', file=f) | ||
print('def bsp_sleep(x):', file=f) | ||
print(' time.sleep(x*0.001)', file=f) | ||
print('main_main()', file=f) | ||
print("def bsp_get_key(x):", file=f) | ||
print(" return 0", file=f) | ||
print("def bsp_sleep(x):", file=f) | ||
print(" time.sleep(x*0.001)", file=f) | ||
print("main_main()", file=f) | ||
|
||
print("Now run python_snake2.py !") | ||
|
||
print('Now run python_snake2.py !') | ||
|
||
run_it() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#ifndef ASSERT_H | ||
#define ASSERT_H | ||
|
||
#define assert(x) | ||
// do nothing for now.. | ||
#define assert(x) (0) | ||
|
||
#endif |
Oops, something went wrong.