#Parse C file without checking for errors?

1 messages · Page 1 of 1 (latest)

hoary magnet
#

Is there a way to read a C file and force Zig to not check for missing headers or #include inside that C file?

So I import a C file mainly to access its data and not to run any codes inside that file.

#

Basically saying "Hey I import this C file, I know what I'm doing trust me, don't check for errors"

uneven junco
hoary magnet
summer yoke
#

why do you want to do this?

hoary magnet
#

I want to make a program that reads a QMK keymap.c keymaps matrix and map the keys into an ASCII art template

#

I did this before but I have to use regex, It would be cool if Zig could read C file directly and access the data the legit way

uneven junco
hoary magnet
# uneven junco Any reason you cant seperate it into a header file?

wdym? I want to make it general so that anyone can just point the program to a keymap.c file and that's it. Because it's a C file, people can put whatever they want inside of it, all I know is that by convention, the keymap.c will have this inside:

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_ortho_4x12(
   KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC, \
   KC_ESC,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, \
   KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_ENT , \
   ADJUST,  KC_LCTL, KC_LALT, KC_LGUI, LOWER,   KC_SPC,  KC_SPC,  RAISE,   KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT  \
), .....}

And this is the only part I'm interested in.