• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

cjc - C to Jass2 compiler

Level 8
Joined
Aug 1, 2023
Messages
34
C.png


cjc is a C to Jass2 compiler. It takes as input a .c source file and a runtime.j file and generates an output a.j file.
cjc is based on Rui Ueyama's chibicc C compiler, but instead of generating x86 assembly, it generates pseudo-instructions that are implemented in Jass2.
cjc is a simple code generator built on top of chibicc.

More information and examples on using cjc can be found in the cjc.zip archive.
You could also read the Simple setup for scripting Warcraft 3 maps in C.

updates:
* 2024/04/26 - fixed an issue with arguments to functions returning structs with size > 16 bytes
 

Attachments

  • cjc.zip
    495.4 KB · Views: 1
Last edited:

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
I can't run windows executables so to be honest i'm not even sure if this is an aprils fool or not. Last year i nearly missed first of april as well. Are you going to release the source?
 
Level 8
Joined
Aug 1, 2023
Messages
34
I downloaded this file cjc.zip and it was immediately deleted by my Windows computer, which said Virus detected with no question. That's a good April Fool's!

Yes, no one should run untrusted executables downloaded from the web. I would encourage people to virus check the cjc.exe executable using virustotal, for example.

It's LeP's fault really... He taught me about the upx packer (used by pjass), so I used it... (it reduced the executable's size from ~200KiB to ~90KiB). I've update the cjc.zip archive with a non-upx compressed cjc.exe, which again, people should only try to run after checking it with virustotal. And also, at least it's just a single executable file, not 10+ '.dll's and '.jar's :^).

I can't run windows executables so to be honest i'm not even sure if this is an aprils fool or not. Last year i nearly missed first of april as well. Are you going to release the source?

The source code is 95% that of chibicc. The other 5% (my "contribution") is an awful spaghetti-like code for the code generator that generates crappy/inefficient Jass2 stack-machine-like code (as one does when they don't know much about compilers, I suppose).
 
Top