From 4d0e4345896ca2cc6517466f7676188320a77158 Mon Sep 17 00:00:00 2001 From: Stephen Checkoway Date: Sat, 12 Aug 2017 14:33:28 -0500 Subject: [PATCH] Update the license and generate a header file. Generate z80_instruction_types.h rather than including z80_types.tab. --- .gitignore | 2 +- LICENSE | 2 +- Makefile | 49 ++++++++++++++++++++++++++-------- include/zel/z80.h | 6 ++--- include/zel/z80_instructions.h | 12 +++------ tables/gen.pl | 2 +- tests/Makefile | 2 +- tests/itest.c | 2 +- tests/template.c | 2 +- tests/test.c | 2 +- tests/test_arithmetic.c | 2 +- tests/test_load.c | 2 +- tests/test_set.c | 2 +- z80.c | 2 +- z80_instructions.c | 2 +- 15 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 97e3b5b..e9345b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ libzel.a -include/zel/z80_types.tab +include/zel/z80_instruction_types.h *.o doc tables/*.tab diff --git a/LICENSE b/LICENSE index eb62077..b8d18c4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2008 Steve Checkoway +Copyright (c) 2008, 2017 Stephen Checkoway Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index b7ebd86..a3f5e47 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2008 Steve Checkoway +# Copyright (c) 2008, 2017 Stephen Checkoway # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -51,7 +51,7 @@ dist_source := z80.c \ include/zel/z80.h \ include/zel/z80_instructions.h \ include/zel/z80_types.h \ - include/zel/z80_types.tab \ + include/zel/z80_instruction_types.h \ tables/gen.pl \ $(spec) \ $(itables) \ @@ -74,11 +74,38 @@ libzel.a: z80.o z80_instructions.o tables/%.tab: tables/%.spec tables/gen.pl perl tables/gen.pl $< > $@ -include/zel/z80_types.tab: $(itables) - awk '{ split($$2,a,/_/); sub(/,/,"",a[1]); printf "%s //!< %s\n", $$2, tolower(a[1]) }' \ - $(itables) |sort|uniq > $@ -z80.o: z80.c include/zel/z80.h include/zel/z80_instructions.h include/zel/z80_types.h include/zel/z80_types.tab -z80_instructions.o: z80_instructions.c include/zel/z80_instructions.h include/zel/z80.h include/zel/z80_types.h include/zel/z80_types.tab $(itables) +include/zel/z80_instruction_types.h: $(itables) + sed -e '1s,^,/* ,;2,$$s,^, * ,' LICENSE >$@ + echo ' */' >>$@ + echo >>$@ + echo '/*! \\file' >>$@ + echo ' *' >>$@ + echo ' * z80 instruction types.' >>$@ + echo ' * \\author Stephen Checkoway' >>$@ + echo ' * \\version 0.1' >>$@ + echo ' * \\date 2008, 2017' >>$@ + echo ' */' >>$@ + echo '#ifndef ZEL_Z80_INSTRUCTION_TYPES_H' >>$@ + echo '#define ZEL_Z80_INSTRUCTION_TYPES_H' >>$@ + echo >>$@ + echo '#ifdef __cplusplus' >>$@ + echo 'extern "C" {' >>$@ + echo '#endif' >>$@ + echo >>$@ + echo 'typedef enum' >>$@ + echo '{' >>$@ + awk '{ split($$2,a,/_/); sub(/,/,"",a[1]); printf "\t%s //!< %s\n", $$2, tolower(a[1]) }' \ + $(itables) |sort|uniq >>$@ + echo '} InstructionType;' >>$@ + echo >>$@ + echo '#ifdef __cplusplus' >>$@ + echo '}' >>$@ + echo '#endif' >>$@ + echo >>$@ + echo '#endif' >>$@ + +z80.o: z80.c include/zel/z80.h include/zel/z80_instructions.h include/zel/z80_types.h include/zel/z80_instruction_types.h +z80_instructions.o: z80_instructions.c include/zel/z80_instructions.h include/zel/z80.h include/zel/z80_types.h include/zel/z80_instruction_types.h $(itables) check: all $(MAKE) -C tests check @@ -93,7 +120,7 @@ clean: doc-clean $(MAKE) -C tests clean $(RM) libzel.a z80.o z80_instructions.o *~ -doc: Doxyfile $(wildcard include/zel/*.h) include/zel/z80_types.tab +doc: Doxyfile $(wildcard include/zel/*.h) include/zel/z80_instruction_types.h doxygen pdf: doc/$(distname).pdf @@ -114,14 +141,14 @@ install: $(INSTALL_DATA) include/zel/z80.h $(DESTDIR)$(includedir)/zel $(INSTALL_DATA) include/zel/z80_instructions.h $(DESTDIR)$(includedir)/zel $(INSTALL_DATA) include/zel/z80_types.h $(DESTDIR)$(includedir)/zel - $(INSTALL_DATA) include/zel/z80_types.tab $(DESTDIR)$(includedir)/zel + $(INSTALL_DATA) include/zel/z80_instruction_types.h $(DESTDIR)$(includedir)/zel uninstall: uninstall-doc $(RM) $(DESTDIR)$(libdir)/libzel.a $(RM) $(DESTDIR)$(includedir)/zel/z80.h $(RM) $(DESTDIR)$(includedir)/zel/z80_instructions.h $(RM) $(DESTDIR)$(includedir)/zel/z80_types.h - $(RM) $(DESTDIR)$(includedir)/zel/z80_types.tab + $(RM) $(DESTDIR)$(includedir)/zel/z80_instruction_types.h rmdir $(DESTDIR)$(includedir)/zel install-doc: install-html install-pdf @@ -169,4 +196,4 @@ distcheck: $(distname).tar.gz distclean: clean mostlyclean: clean maintainer-clean: clean - $(RM) include/zel/z80_types.tab $(itables) + $(RM) include/zel/z80_instruction_types.h $(itables) diff --git a/include/zel/z80.h b/include/zel/z80.h index dba7a05..c3cc8c2 100644 --- a/include/zel/z80.h +++ b/include/zel/z80.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,9 +22,9 @@ /*! \file * * Create and run a z80 processor instance. - * \author Steve Checkoway + * \author Stephen Checkoway * \version 0.1 - * \date 2008 + * \date 2008, 2017 */ #ifndef ZEL_Z80_H #define ZEL_Z80_H diff --git a/include/zel/z80_instructions.h b/include/zel/z80_instructions.h index 616e56a..7d73f76 100644 --- a/include/zel/z80_instructions.h +++ b/include/zel/z80_instructions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,9 +22,9 @@ /*! \file * * Functions for decoding and disassembling z80 instructions. - * \author Steve Checkoway + * \author Stephen Checkoway * \version 0.1 - * \date 2008 + * \date 2008, 2017 */ #ifndef ZEL_Z80_INSTRUCTIONS_H #define ZEL_Z80_INSTRUCTIONS_H @@ -42,6 +42,7 @@ extern "C" { #endif #include +#include /*! The type of a z80 instruction. Many z80 instructions are similar * and share a common type. For example, add a,b and @@ -59,11 +60,6 @@ extern "C" { * - \c MRR 16 bit paired register used as an address * - \c MNN 16 bit immediate used as an address */ -typedef enum -{ -#include -//! \includedoc z80_types.tab -} InstructionType; #ifndef BYTE_ORDER #error define BYTE_ORDER diff --git a/tables/gen.pl b/tables/gen.pl index 44a3286..05e2221 100755 --- a/tables/gen.pl +++ b/tables/gen.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# Copyright (c) 2008 Steve Checkoway +# Copyright (c) 2008, 2017 Stephen Checkoway # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/Makefile b/tests/Makefile index 5e549c6..8793900 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2008 Steve Checkoway +# Copyright (c) 2008, 2017 Stephen Checkoway # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/itest.c b/tests/itest.c index 1116baf..e58c17a 100644 --- a/tests/itest.c +++ b/tests/itest.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tests/template.c b/tests/template.c index 93312d9..147258b 100644 --- a/tests/template.c +++ b/tests/template.c @@ -1,4 +1,4 @@ -/* Written by Steve Checkoway, 2008. Released into the public domain. */ +/* Written by Stephen Checkoway, 2008, 2017. Released into the public domain. */ #include #include diff --git a/tests/test.c b/tests/test.c index 5d7edd3..228f77d 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tests/test_arithmetic.c b/tests/test_arithmetic.c index 1eb4119..79d545a 100644 --- a/tests/test_arithmetic.c +++ b/tests/test_arithmetic.c @@ -1,4 +1,4 @@ -/* Written by Steve Checkoway, 2008. Released into the public domain. */ +/* Written by Stephen Checkoway, 2008, 2017. Released into the public domain. */ #include #include diff --git a/tests/test_load.c b/tests/test_load.c index f037dd4..8a4f86b 100644 --- a/tests/test_load.c +++ b/tests/test_load.c @@ -1,4 +1,4 @@ -/* Written by Steve Checkoway, 2008. Released into the public domain. */ +/* Written by Stephen Checkoway, 2008, 2017. Released into the public domain. */ #include #include diff --git a/tests/test_set.c b/tests/test_set.c index 2411b1e..8c32a8a 100644 --- a/tests/test_set.c +++ b/tests/test_set.c @@ -1,4 +1,4 @@ -/* Written by Steve Checkoway, 2008. Released into the public domain. */ +/* Written by Stephen Checkoway, 2008, 2017. Released into the public domain. */ #include #include diff --git a/z80.c b/z80.c index b08eb44..76f8425 100644 --- a/z80.c +++ b/z80.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/z80_instructions.c b/z80_instructions.c index 338f10d..02a91a6 100644 --- a/z80_instructions.c +++ b/z80_instructions.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 Steve Checkoway +/* Copyright (c) 2008, 2017 Stephen Checkoway * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal