• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

超漢字開発環境でClangを使ってみるテスト


Commit MetaInfo

Revisão9c96c55bdcf5596dc3154a098f9dda6176a789c4 (tree)
Hora2015-11-19 01:59:38
Autorornse01 <ornse01@user...>
Commiterornse01

Mensagem de Log

add sample code.

* call system function.
* use some C99 feature.

Mudança Sumário

Diff

--- a/src/main.c
+++ b/src/main.c
@@ -1,9 +1,42 @@
11 #include <basic.h>
22 #include <bstdio.h>
3+#include <bstdlib.h>
34 #include <btron/btron.h>
4-
5+
6+typedef struct {
7+ W err;
8+ UW array[];
9+} test_t;
10+
11+LOCAL VOID func1(test_t *t)
12+{
13+ printf("err = %08x\n", t->err);
14+ printf(" array = %08x\n", t->array[0]);
15+ printf(" %08x\n", t->array[1]);
16+ printf(" %08x\n", t->array[2]);
17+}
18+
519 EXPORT W MAIN(MESSAGE *msg)
620 {
7- printf("hello\n");
21+ W err;
22+ P_STATE state;
23+ test_t *p;
24+
25+ p = malloc(sizeof(W)*4);
26+ if (p == NULL) {
27+ printf("malloc error\n");
28+ return 0;
29+ }
30+
31+ err = prc_sts(0, &state, NULL);
32+ p->err = err;
33+ p->array[0] = state.state;
34+ p->array[1] = state.priority;
35+ p->array[2] = state.parpid;
36+
37+ func1(p);
38+
39+ free(p);
40+
841 return 0;
942 }