From 266962f9fefaa914bc6ad8385159926e20fcd4b2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 3 Mar 2016 12:59:50 +0300 Subject: [PATCH] Fix license headers in new files --- tests/host/common/Arduino.cpp | 22 +++++++--- tests/host/common/Arduino.h | 25 ++++++++--- tests/host/common/pgmspace.h | 72 ++++++++++++++++--------------- tests/host/common/pins_arduino.h | 22 ++++++---- tests/host/common/spiffs_mock.cpp | 22 +++++++--- tests/host/common/spiffs_mock.h | 21 ++++++--- tests/host/fs/test_fs.cpp | 21 ++++++--- 7 files changed, 127 insertions(+), 78 deletions(-) diff --git a/tests/host/common/Arduino.cpp b/tests/host/common/Arduino.cpp index fd84147d1..dfb0e825e 100644 --- a/tests/host/common/Arduino.cpp +++ b/tests/host/common/Arduino.cpp @@ -1,10 +1,18 @@ -// -// Arduino.cpp -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 02/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// +/* + Arduino.cpp - Mocks for common Arduino APIs + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +*/ + #define CATCH_CONFIG_MAIN #include #include diff --git a/tests/host/common/Arduino.h b/tests/host/common/Arduino.h index d5bb23d19..e68565ee8 100644 --- a/tests/host/common/Arduino.h +++ b/tests/host/common/Arduino.h @@ -1,10 +1,21 @@ -// -// Arduino.hpp -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 02/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// +/* + Arduino.h - Main include file for the Arduino SDK + Copyright (c) 2005-2013 Arduino Team. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef Arduino_h #define Arduino_h diff --git a/tests/host/common/pgmspace.h b/tests/host/common/pgmspace.h index a36dd3238..7bdd80963 100644 --- a/tests/host/common/pgmspace.h +++ b/tests/host/common/pgmspace.h @@ -1,3 +1,17 @@ +/* + pgmspace.cpp - PROGMEM stubs for host-side tests + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + */ #ifndef __PGMSPACE_H_ #define __PGMSPACE_H_ @@ -7,7 +21,7 @@ #define PROGMEM #define PGM_P const char * #define PGM_VOID_P const void * -#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) +#define PSTR(s) (s) #define _SFR_BYTE(n) (n) @@ -22,47 +36,35 @@ typedef uint16_t prog_uint16_t; typedef int32_t prog_int32_t; typedef uint32_t prog_uint32_t; -#define SIZE_IRRELEVANT 0x7fffffff +#define memcmp_P memcmp +#define memccpy_P memccpy +#define memmem_P memmem +#define memcpy_P memcpy +#define strncpy_P strncpy +#define strcpy_P strcpy -int memcmp_P(const void* buf1, PGM_VOID_P buf2P, size_t size); -// memccpy_P is only valid when used with pointers to 8bit data, due to size aligned pointers -// and endianess of the values greater than 8bit, matching c may return invalid aligned pointers -void* memccpy_P(void* dest, PGM_VOID_P src, int c, size_t count); -void* memmem_P(const void* buf, size_t bufSize, PGM_VOID_P findP, size_t findPSize); -void* memcpy_P(void* dest, PGM_VOID_P src, size_t count); +#define strncat_P strncat +#define strcat_P strcat -#define strncpy_P(dest, src, size) strncpy(dest, src, size) -#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT) +#define strncmp_P strncmp +#define strcmp_P strcmp -#define strncat_P(dest, src, size) strncat(dest, src, size) -#define strcat_P(dest, src) strncat_P((dest), (src), SIZE_IRRELEVANT) +#define strncasecmp_P strncasecmp +#define strcasecmp_P strcasecmp -#define strncmp_P(str1, str2P, size) strncmp(str1, str2P, size) -#define strcmp_P(str1, str2P) strncmp_P((str1), (str2P), SIZE_IRRELEVANT) +#define strnlen_P strnlen +#define strlen_P strlen -#define strncasecmp_P(str1, str2P, size) strncasecmp(str1, str2P, size) -#define strcasecmp_P(str1, str2P) strncasecmp_P((str1), (str2P), SIZE_IRRELEVANT) +#define printf_P printf +#define sprintf_P sprintf +#define snprintf_P snprintf +#define vsnprintf_P vsnprintf -#define strnlen_P(s, size) strnlen(s, size) -#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT) - -#define printf_P(formatP, ...) printf(formatP, __VA_ARGS__) -#define sprintf_P(str, formatP, ...) sprintf(str, formatP, __VA_ARGS__) -#define snprintf_P(str, strSize, formatP, ...) snprintf(str, strSize, formatP, __VA_ARGS__) -#define vsnprintf_P(str, strSize, formatP, ap) vsnprintf(str, strSize, formatP, ap) - -// flash memory must be read using 32 bit aligned addresses else a processor -// exception will be triggered -// order within the 32 bit values are -// -------------- -// b3, b2, b1, b0 -// w1, w0 - -#define pgm_read_byte(x) (*reinterpret_cast(x)) -#define pgm_read_word(x) (*reinterpret_cast(x)) -#define pgm_read_float(x) (*reinterpret_cast(x)) -#define pgm_read_dword(x) (*reinterpret_cast(x)) +#define pgm_read_byte(addr) (*reinterpret_cast(addr)) +#define pgm_read_word(addr) (*reinterpret_cast(addr)) +#define pgm_read_float(addr) (*reinterpret_cast(addr)) +#define pgm_read_dword(addr) (*reinterpret_cast(addr)) #define pgm_read_byte_near(addr) pgm_read_byte(addr) #define pgm_read_word_near(addr) pgm_read_word(addr) diff --git a/tests/host/common/pins_arduino.h b/tests/host/common/pins_arduino.h index f93d73c06..ad051ed24 100644 --- a/tests/host/common/pins_arduino.h +++ b/tests/host/common/pins_arduino.h @@ -1,11 +1,17 @@ -// -// pins_arduino.h -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 02/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// - +/* + pins_arduino.h + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + */ #ifndef pins_arduino_h #define pins_arduino_h diff --git a/tests/host/common/spiffs_mock.cpp b/tests/host/common/spiffs_mock.cpp index b2c975ac9..4a0a5ace8 100644 --- a/tests/host/common/spiffs_mock.cpp +++ b/tests/host/common/spiffs_mock.cpp @@ -1,10 +1,18 @@ -// -// spiffs_mock.cpp -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 03/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// +/* + spiffs_mock.cpp - SPIFFS HAL mock for host side testing + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +*/ + #include "spiffs_mock.h" #include "spiffs/spiffs.h" diff --git a/tests/host/common/spiffs_mock.h b/tests/host/common/spiffs_mock.h index 2996fc844..1de1b904f 100644 --- a/tests/host/common/spiffs_mock.h +++ b/tests/host/common/spiffs_mock.h @@ -1,10 +1,17 @@ -// -// spiffs_mock.hpp -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 03/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// +/* + spiffs_mock.h - SPIFFS HAL mock for host side testing + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +*/ #ifndef spiffs_mock_hpp #define spiffs_mock_hpp diff --git a/tests/host/fs/test_fs.cpp b/tests/host/fs/test_fs.cpp index c510f4ac5..5cfc28ffc 100644 --- a/tests/host/fs/test_fs.cpp +++ b/tests/host/fs/test_fs.cpp @@ -1,10 +1,17 @@ -// -// test_fs.cpp -// esp8266-host-tests -// -// Created by Ivan Grokhotkov on 02/03/16. -// Copyright © 2016 esp8266.com. All rights reserved. -// +/* + test_fs.cpp - host side file system tests + Copyright © 2016 Ivan Grokhotkov + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +*/ #include #include