Update the license and generate a header file.

Generate z80_instruction_types.h rather than including z80_types.tab.
This commit is contained in:
Stephen Checkoway 2017-08-12 14:33:28 -05:00
parent 66bd860a2e
commit 4d0e434589
15 changed files with 57 additions and 34 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
libzel.a libzel.a
include/zel/z80_types.tab include/zel/z80_instruction_types.h
*.o *.o
doc doc
tables/*.tab tables/*.tab

View File

@ -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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -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 # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # 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.h \
include/zel/z80_instructions.h \ include/zel/z80_instructions.h \
include/zel/z80_types.h \ include/zel/z80_types.h \
include/zel/z80_types.tab \ include/zel/z80_instruction_types.h \
tables/gen.pl \ tables/gen.pl \
$(spec) \ $(spec) \
$(itables) \ $(itables) \
@ -74,11 +74,38 @@ libzel.a: z80.o z80_instructions.o
tables/%.tab: tables/%.spec tables/gen.pl tables/%.tab: tables/%.spec tables/gen.pl
perl tables/gen.pl $< > $@ perl tables/gen.pl $< > $@
include/zel/z80_types.tab: $(itables) include/zel/z80_instruction_types.h: $(itables)
awk '{ split($$2,a,/_/); sub(/,/,"",a[1]); printf "%s //!< %s\n", $$2, tolower(a[1]) }' \ sed -e '1s,^,/* ,;2,$$s,^, * ,' LICENSE >$@
$(itables) |sort|uniq > $@ echo ' */' >>$@
z80.o: z80.c include/zel/z80.h include/zel/z80_instructions.h include/zel/z80_types.h include/zel/z80_types.tab echo >>$@
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) 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 check: all
$(MAKE) -C tests check $(MAKE) -C tests check
@ -93,7 +120,7 @@ clean: doc-clean
$(MAKE) -C tests clean $(MAKE) -C tests clean
$(RM) libzel.a z80.o z80_instructions.o *~ $(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 doxygen
pdf: doc/$(distname).pdf pdf: doc/$(distname).pdf
@ -114,14 +141,14 @@ install:
$(INSTALL_DATA) include/zel/z80.h $(DESTDIR)$(includedir)/zel $(INSTALL_DATA) include/zel/z80.h $(DESTDIR)$(includedir)/zel
$(INSTALL_DATA) include/zel/z80_instructions.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.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 uninstall: uninstall-doc
$(RM) $(DESTDIR)$(libdir)/libzel.a $(RM) $(DESTDIR)$(libdir)/libzel.a
$(RM) $(DESTDIR)$(includedir)/zel/z80.h $(RM) $(DESTDIR)$(includedir)/zel/z80.h
$(RM) $(DESTDIR)$(includedir)/zel/z80_instructions.h $(RM) $(DESTDIR)$(includedir)/zel/z80_instructions.h
$(RM) $(DESTDIR)$(includedir)/zel/z80_types.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 rmdir $(DESTDIR)$(includedir)/zel
install-doc: install-html install-pdf install-doc: install-html install-pdf
@ -169,4 +196,4 @@ distcheck: $(distname).tar.gz
distclean: clean distclean: clean
mostlyclean: clean mostlyclean: clean
maintainer-clean: clean maintainer-clean: clean
$(RM) include/zel/z80_types.tab $(itables) $(RM) include/zel/z80_instruction_types.h $(itables)

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -22,9 +22,9 @@
/*! \file /*! \file
* *
* Create and run a z80 processor instance. * Create and run a z80 processor instance.
* \author Steve Checkoway * \author Stephen Checkoway
* \version 0.1 * \version 0.1
* \date 2008 * \date 2008, 2017
*/ */
#ifndef ZEL_Z80_H #ifndef ZEL_Z80_H
#define ZEL_Z80_H #define ZEL_Z80_H

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -22,9 +22,9 @@
/*! \file /*! \file
* *
* Functions for decoding and disassembling z80 instructions. * Functions for decoding and disassembling z80 instructions.
* \author Steve Checkoway * \author Stephen Checkoway
* \version 0.1 * \version 0.1
* \date 2008 * \date 2008, 2017
*/ */
#ifndef ZEL_Z80_INSTRUCTIONS_H #ifndef ZEL_Z80_INSTRUCTIONS_H
#define ZEL_Z80_INSTRUCTIONS_H #define ZEL_Z80_INSTRUCTIONS_H
@ -42,6 +42,7 @@ extern "C" {
#endif #endif
#include <zel/z80_types.h> #include <zel/z80_types.h>
#include <zel/z80_instruction_types.h>
/*! The type of a z80 instruction. Many z80 instructions are similar /*! The type of a z80 instruction. Many z80 instructions are similar
* and share a common type. For example, <code>add a,b</code> and * and share a common type. For example, <code>add a,b</code> and
@ -59,11 +60,6 @@ extern "C" {
* - \c MRR 16 bit paired register used as an address * - \c MRR 16 bit paired register used as an address
* - \c MNN 16 bit immediate used as an address * - \c MNN 16 bit immediate used as an address
*/ */
typedef enum
{
#include <zel/z80_types.tab>
//! \includedoc z80_types.tab
} InstructionType;
#ifndef BYTE_ORDER #ifndef BYTE_ORDER
#error define BYTE_ORDER #error define BYTE_ORDER

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl #!/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 # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal

View File

@ -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 # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

View File

@ -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 <stdlib.h> #include <stdlib.h>
#include <z80.h> #include <z80.h>

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

View File

@ -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 <stdlib.h> #include <stdlib.h>
#include <zel/z80.h> #include <zel/z80.h>

View File

@ -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 <stdlib.h> #include <stdlib.h>
#include <zel/z80.h> #include <zel/z80.h>

View File

@ -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 <stdlib.h> #include <stdlib.h>
#include <zel/z80.h> #include <zel/z80.h>

2
z80.c
View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal