Skip to content

Instantly share code, notes, and snippets.

@BonyChops
Last active December 29, 2020 14:01
Show Gist options
  • Save BonyChops/4026151655675c74e831cec41f460e43 to your computer and use it in GitHub Desktop.
Save BonyChops/4026151655675c74e831cec41f460e43 to your computer and use it in GitHub Desktop.
Generate C header from C source
const fs = require('fs');
const filePath = "mulprec_test.c";
const fileData = fs.readFileSync(filePath).toString();
result = fileData.split("\n").filter(line => line.match(/^(int|double|NUMBER|bool|void).*/)).map(line => line.replace(/(\s)*{(\s)*$/,";")).join("\n");
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment