macOS Ventura 13.6.2
Gerbil v0.18-62-gf7d8efcf on Gambit v4.9.5-78-g8b18ab69
λ echo $CC
gcc-13
Running brew info ncurses
gives us the following part:
(* I overuse these two badboys *) | |
let parse fmt map line = try Some (Scanf.sscanf line fmt map) with _ -> None | |
let rec try_parse parsers line = | |
match parsers with | |
| [] -> failwith ("could not parse: " ^ line) | |
| parse :: parsers -> ( | |
match parse line with | |
| None -> try_parse parsers line | |
| Some result -> result |
{ | |
description = "Haskell"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/haskell-updates"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, nixpkgs, flake-utils }: | |
flake-utils.lib.eachDefaultSystem (system: |
Pos :: [2]int | |
Component :: enum u16 { | |
PLAYER, | |
COLLISION, | |
PUSH, | |
SPRITE, | |
} | |
Entity :: struct { |
package audio | |
import "core:fmt" | |
// https://miniaud.io/docs/ | |
import ma "vendor:miniaudio" | |
// 0 - Use native channel count of the device | |
AUDIO_CHANNELS :: 0 | |
AUDIO_SAMPLE_RATE :: 0 |
{ | |
description = "dungeoncrawler"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/master"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
rust-overlay.url = "github:oxalica/rust-overlay"; | |
}; | |
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: |
macOS Ventura 13.6.2
Gerbil v0.18-62-gf7d8efcf on Gambit v4.9.5-78-g8b18ab69
λ echo $CC
gcc-13
Running brew info ncurses
gives us the following part:
So, I am a little bit (very) new to C, "systems programming" and the tools surrounding C. I thought it would be fun to try to make a little ncurses thing with Gerbil!
I've installed gcc
version 12.3.0 (with Nix if that matters) and ncurses6
with Homebrew. This would be instead of using clang
provided by macOS by default? I think I read in the docs that gcc
is preferred. Is this still the case on macOS?
I've compiled a C-program using ncurses with gcc
and got it to run using the following:
gcc `ncurses6-config --cflags --libs` test.c -o test.out
module Card = struct | |
type t = { id : int; wins : int list; mine : int list } | |
[@@deriving show { with_path = false }, eq] | |
end | |
module P = struct | |
open Angstrom | |
let is_digit = function '0' .. '9' -> true | _ -> false | |
let int = take_while1 is_digit >>| Int.of_string_exn |
module Coordinate = struct | |
type t = { x : int; y : int; value : int } | |
let make ~x ~y value = { x; y; value } | |
let compare t1 t2 = | |
match compare t1.x t2.x with 0 -> compare t1.y t2.y | _ as x -> x | |
end | |
module PQ = Psq.Make (Coordinate) (Int) |
open ContainersLabels | |
let read_file name = CCIO.(with_in name read_lines_l) | |
let rec try_parse parsers line = | |
match parsers with | |
| [] -> failwith ("could not parse: " ^ line) | |
| parse :: parsers -> ( | |
match parse line with | |
| None -> try_parse parsers line |