From 3f3d91f06bf18edcce1a9c777a228a851d9b231e Mon Sep 17 00:00:00 2001 From: "Koine Yuusuke(koinec)" Date: Mon, 11 Feb 2019 20:39:06 +0900 Subject: [PATCH] 2019/02/11(Mon) 20:39 (LibGoblin) * Create drd64_libgoblin_common.[ch] --- libgoblin/Makefile | 5 ++++ libgoblin/drd64_libgoblin.h | 1 + libgoblin/drd64_libgoblin_common.c | 56 ++++++++++++++++++++++++++++++++++++++ libgoblin/drd64_libgoblin_common.h | 55 +++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 libgoblin/drd64_libgoblin_common.c create mode 100644 libgoblin/drd64_libgoblin_common.h diff --git a/libgoblin/Makefile b/libgoblin/Makefile index 3ae31d8..63a31d7 100644 --- a/libgoblin/Makefile +++ b/libgoblin/Makefile @@ -53,6 +53,7 @@ OBJS = drd64_libgoblin_api.o \ drd64_libgoblin_binaryfile.o \ drd64_libgoblin_srcfile.o \ drd64_libgoblin_checkbin.o \ + drd64_libgoblin_common.o \ drd64_libgoblin_readbin.o \ drd64_libgoblin_loadprog.o \ drd64_libgoblin_symwork.o \ @@ -80,6 +81,7 @@ HEADER = drd64_libgoblin.h \ drd64_libgoblin_binaryfile.h \ drd64_libgoblin_srcfile.h \ drd64_libgoblin_checkbin.h \ + drd64_libgoblin_common.h \ drd64_libgoblin_readbin.h \ drd64_libgoblin_loadprog.h \ drd64_libgoblin_symwork.h \ @@ -153,6 +155,9 @@ drd64_libgoblin_srcfile.o: drd64_libgoblin_srcfile.c $(HEADER) drd64_libgoblin_checkbin.o: drd64_libgoblin_checkbin.c $(HEADER) $(CC) -c -o drd64_libgoblin_checkbin.o $(FLAGS_DEBUG) \ drd64_libgoblin_checkbin.c +drd64_libgoblin_common.o: drd64_libgoblin_common.c $(HEADER) + $(CC) -c -o drd64_libgoblin_common.o $(FLAGS_DEBUG) \ + drd64_libgoblin_common.c drd64_libgoblin_readbin.o: drd64_libgoblin_readbin.c $(HEADER) $(CC) -c -o drd64_libgoblin_readbin.o $(FLAGS_DEBUG) \ drd64_libgoblin_readbin.c diff --git a/libgoblin/drd64_libgoblin.h b/libgoblin/drd64_libgoblin.h index 61402b1..fc3fecf 100644 --- a/libgoblin/drd64_libgoblin.h +++ b/libgoblin/drd64_libgoblin.h @@ -75,6 +75,7 @@ Comment: #include"drd64_libgoblin_binaryfile.h" #include"drd64_libgoblin_srcfile.h" #include"drd64_libgoblin_checkbin.h" +#include"drd64_libgoblin_common.h" #include"drd64_libgoblin_readbin.h" #include"drd64_libgoblin_loadprog.h" #include"drd64_libgoblin_symwork.h" diff --git a/libgoblin/drd64_libgoblin_common.c b/libgoblin/drd64_libgoblin_common.c new file mode 100644 index 0000000..2eb4406 --- /dev/null +++ b/libgoblin/drd64_libgoblin_common.c @@ -0,0 +1,56 @@ +/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64 + + D r . D e a m o n 6 4 + for INTEL64(R), AMD64(R) + + Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/ + +/* File Info ----------------------------------------------------------- +File: drd64_.c +Function: +Comment: +----------------------------------------------------------------------*/ + +#define DRD64_SRC_LIBGOBLIN_COMMON +#include"drd64_libgoblin.h" + +LIBGOBLIN_COMMON_EXTERN +DWord + Common_CalcDJBhash( char *pstr_src ) +{ + DWord dw_value; + Byte b_temp; + + dw_value = 5381; + + for( b_temp = *pstr_src; '\0' != b_temp; b_temp = *++pstr_src ) + { dw_value = ( dw_value * 33 ) + b_temp; } + + return dw_value; +} + + +/* EOF of drd64_.c ----------------------------------- */ diff --git a/libgoblin/drd64_libgoblin_common.h b/libgoblin/drd64_libgoblin_common.h new file mode 100644 index 0000000..9100f02 --- /dev/null +++ b/libgoblin/drd64_libgoblin_common.h @@ -0,0 +1,55 @@ +/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64 + + D r . D e a m o n 6 4 + for INTEL64(R), AMD64(R) + + Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/ + +/* File Info ----------------------------------------------------------- +File: drd64_.h +Function: Header +Comment: +----------------------------------------------------------------------*/ + +#ifndef DRD64_HEADER_LIBGOBLIN_COMMON +#define DRD64_HEADER_LIBGOBLIN_COMMON + +#include"drd64_libgoblin.h" + +#ifdef DRD64_SRC_LIBGOBLIN_COMMON + #define LIBGOBLIN_COMMON_EXTERN +#else + #define LIBGOBLIN_COMMON_EXTERN extern +#endif + + +LIBGOBLIN_COMMON_EXTERN + DWord Common_CalcDJBhash( char *pstr_src ); + + +#endif /* DRD64_HEADER_LIBGOBLIN_COMMON */ + +/* EOF of drd64_.h ----------------------------------- */ -- 2.11.0