Uploaded on

 

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,158
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
6
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. libtcc AND GWAN charsyam@naver.com
  • 2. Language Java JavaScript C Scala
  • 3. Platform Node.js Django Play
  • 4. Tcc: Tiny C Compiler 1. C Script Support
  • 5. C Script #! /usr/bin/tcc -run int main() { printf("Hello Worldn"); return 0; }
  • 6. Tcc: Tiny C Compiler 2. Dynamic Code Generation
  • 7. Code Generation int add(int a, int b) { return a + b; } char my_program[] = "int foo(int n)n" "{n" " printf("Hello World!n");n" " printf("fib(%d) = %dn", n, fib(n));n" " printf("add(%d, %d) = %dn", n, 2 * n, add(n, 2 * n));n" " return 0;n" "}n";
  • 8. Code GenerationTCCState *s;s = tcc_new();tcc_set_output_type(s, TCC_OUTPUT_MEMORY);if (tcc_compile_string(s, my_program) == -1) return 1;tcc_add_symbol(s, "add", add);size = tcc_relocate(s, NULL);if (size == -1) return 1;mem = malloc(size);tcc_relocate(s, mem);func = tcc_get_symbol(s, "foo");if (!func) return 1;tcc_delete(s);func(32);free(mem);
  • 9. Code Generationcharsyam@charsyam-lv63:~/repo/libtcc$ ./a.outHello World!fib(32) = 2178309add(32, 64) = 96
  • 10. GWanWeb Application Server
  • 11. GWanSupport Scripting C Java Object C
  • 12. GWanwget http://gwan.com/archives/gwan_linux64-bit.tar.bz2tar -xjf gwan_linux64-bit.tar.bz2cd gwan_linux64-bitsudo ./gwan (./gwan -h for help)Need javac, gobjc, gobjc++
  • 13. GWancharsyam@ubuntu:~/apps/gwan/0.0.0.0_8080/#0.0.0.0/csp/folder$실제 핸들러 위치
  • 14. Thank You!