Skip to content
Permalink
Browse files

Replace main.c with main.zig

  • Loading branch information
tiehuis committed Jul 19, 2017
1 parent e24d314 commit 1bbee329aebbbb8578623d4b8e1967904fa6dcb1
Showing with 10 additions and 37 deletions.
  1. +1 −25 build.zig
  2. +0 −1 compute.h
  3. +2 −2 compute.zig
  4. +0 −1 display.h
  5. +1 −1 display.zig
  6. +0 −7 main.c
  7. +6 −0 main.zig
@@ -1,31 +1,7 @@
const Builder = @import("std").build.Builder;

pub fn build(b: &Builder) {
const exe = b.addCExecutable("main");
b.addCIncludePath(".");
exe.addCompileFlags([][]const u8 {
"-std=c99",
"-nostdlib",
});

const source_files = [][]const u8 {
"main.c",
};

for (source_files) |source| {
exe.addSourceFile(source);
}

const zig_source_files = [][]const u8 {
"compute.zig",
"compute_helper.zig",
"display.zig",
};

for (zig_source_files) |source| {
const object = b.addObject(source, source);
exe.addObject(object);
}
const exe = b.addExecutable("main", "main.zig");

exe.setOutputPath("./main");
b.default_step.dependOn(&exe.step);

This file was deleted.

@@ -1,5 +1,5 @@
pub use @import("compute_helper.zig");
use @import("compute_helper.zig");

export fn compute(a: u8) -> u8 {
pub fn compute(a: u8) -> u8 {
compute_helper(a) + 5
}

This file was deleted.

@@ -1,7 +1,7 @@
const std = @import("std");
const printf = std.io.stdout.printf;

export fn display_char(c: u8)
pub fn display_char(c: u8)
{
%%printf("{c}\n", c);
}
7 main.c

This file was deleted.

@@ -0,0 +1,6 @@
use @import("display.zig");
use @import("compute.zig");

pub fn main() -> %void {
display_char(compute('A'));
}

0 comments on commit 1bbee32

Please sign in to comment.
You can’t perform that action at this time.