diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e8d922c..f979fcb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,8 +21,10 @@ The format is based on [Keep a Changelog]. * [`gawk`](https://www.gnu.org/software/gawk/) for [awk](https://en.wikipedia.org/wiki/AWK) ([#187]). * [`asmfmt`](https://github.com/klauspost/asmfmt) for assembly ([#168]). +* [`astyle`](https://github.com/steinwurf/astyle) for C ([#169]). [#168]: https://github.com/radian-software/apheleia/pull/168 +[#169]: https://github.com/radian-software/apheleia/pull/169 [#174]: https://github.com/radian-software/apheleia/pull/174 [#182]: https://github.com/radian-software/apheleia/pull/182 [#187]: https://github.com/radian-software/apheleia/pull/187 diff --git a/apheleia.el b/apheleia.el index 5684990a..66a40250 100644 --- a/apheleia.el +++ b/apheleia.el @@ -32,7 +32,9 @@ :link '(emacs-commentary-link :tag "Commentary" "apheleia")) (defcustom apheleia-formatters - '((asmfmt . ("asmfmt")) + '((astyle . ("astyle" (apheleia-formatters-locate-file + "--options" ".astylerc"))) + (asmfmt . ("asmfmt")) (bean-format . ("bean-format")) (black . ("black" (when (apheleia-formatters-extension-p "pyi") "--pyi") diff --git a/test/formatters/installers/astyle.bash b/test/formatters/installers/astyle.bash new file mode 100644 index 00000000..2a9cde97 --- /dev/null +++ b/test/formatters/installers/astyle.bash @@ -0,0 +1 @@ +apt-get install -y astyle diff --git a/test/formatters/samplecode/astyle/in.c b/test/formatters/samplecode/astyle/in.c new file mode 120000 index 00000000..4e7891c2 --- /dev/null +++ b/test/formatters/samplecode/astyle/in.c @@ -0,0 +1 @@ +../clang-format/in.c \ No newline at end of file diff --git a/test/formatters/samplecode/astyle/out.c b/test/formatters/samplecode/astyle/out.c new file mode 100644 index 00000000..bfc35f67 --- /dev/null +++ b/test/formatters/samplecode/astyle/out.c @@ -0,0 +1,5 @@ +// https://www.ioccc.org/2020/burton/prog.c +int main(int b,char**i) { + long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r); + printf("%.8s\n",(char*)&_); +}