Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of cpputest by
include/CppUTest/PlatformSpecificFunctions_c.h@1:4769360130ed, 2014-06-17 (annotated)
- Committer:
- Rohit Grover
- Date:
- Tue Jun 17 15:52:54 2014 +0100
- Revision:
- 1:4769360130ed
- Parent:
- 0:0b799af9d58e
updating to the latest version of cppUtest; tested against nordic's m-kit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 0:0b799af9d58e | 1 | /* |
rgrover1 | 0:0b799af9d58e | 2 | * Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde |
rgrover1 | 0:0b799af9d58e | 3 | * All rights reserved. |
rgrover1 | 0:0b799af9d58e | 4 | * |
rgrover1 | 0:0b799af9d58e | 5 | * Redistribution and use in source and binary forms, with or without |
rgrover1 | 0:0b799af9d58e | 6 | * modification, are permitted provided that the following conditions are met: |
rgrover1 | 0:0b799af9d58e | 7 | * * Redistributions of source code must retain the above copyright |
rgrover1 | 0:0b799af9d58e | 8 | * notice, this list of conditions and the following disclaimer. |
rgrover1 | 0:0b799af9d58e | 9 | * * Redistributions in binary form must reproduce the above copyright |
rgrover1 | 0:0b799af9d58e | 10 | * notice, this list of conditions and the following disclaimer in the |
rgrover1 | 0:0b799af9d58e | 11 | * documentation and/or other materials provided with the distribution. |
rgrover1 | 0:0b799af9d58e | 12 | * * Neither the name of the <organization> nor the |
rgrover1 | 0:0b799af9d58e | 13 | * names of its contributors may be used to endorse or promote products |
rgrover1 | 0:0b799af9d58e | 14 | * derived from this software without specific prior written permission. |
rgrover1 | 0:0b799af9d58e | 15 | * |
rgrover1 | 0:0b799af9d58e | 16 | * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY |
rgrover1 | 0:0b799af9d58e | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
rgrover1 | 0:0b799af9d58e | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
rgrover1 | 0:0b799af9d58e | 19 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY |
rgrover1 | 0:0b799af9d58e | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
rgrover1 | 0:0b799af9d58e | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
rgrover1 | 0:0b799af9d58e | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
rgrover1 | 0:0b799af9d58e | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
rgrover1 | 0:0b799af9d58e | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
rgrover1 | 0:0b799af9d58e | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
rgrover1 | 0:0b799af9d58e | 26 | */ |
rgrover1 | 0:0b799af9d58e | 27 | |
rgrover1 | 0:0b799af9d58e | 28 | /****************************************************************************** |
rgrover1 | 0:0b799af9d58e | 29 | * |
rgrover1 | 0:0b799af9d58e | 30 | * PlatformSpecificFunctions_c.H |
rgrover1 | 0:0b799af9d58e | 31 | * |
rgrover1 | 0:0b799af9d58e | 32 | * Provides an interface for when working with pure C |
rgrover1 | 0:0b799af9d58e | 33 | * |
rgrover1 | 0:0b799af9d58e | 34 | *******************************************************************************/ |
rgrover1 | 0:0b799af9d58e | 35 | |
rgrover1 | 0:0b799af9d58e | 36 | |
rgrover1 | 0:0b799af9d58e | 37 | #ifndef PLATFORMSPECIFICFUNCTIONS_C_H_ |
rgrover1 | 0:0b799af9d58e | 38 | #define PLATFORMSPECIFICFUNCTIONS_C_H_ |
rgrover1 | 0:0b799af9d58e | 39 | |
rgrover1 | 0:0b799af9d58e | 40 | #ifdef __cplusplus |
rgrover1 | 0:0b799af9d58e | 41 | extern "C" { |
rgrover1 | 0:0b799af9d58e | 42 | #endif |
rgrover1 | 0:0b799af9d58e | 43 | |
rgrover1 | 0:0b799af9d58e | 44 | /* Jumping operations. They manage their own jump buffers */ |
rgrover1 | 0:0b799af9d58e | 45 | int PlatformSpecificSetJmp(void (*function) (void*), void* data); |
rgrover1 | 0:0b799af9d58e | 46 | void PlatformSpecificLongJmp(void); |
rgrover1 | 0:0b799af9d58e | 47 | void PlatformSpecificRestoreJumpBuffer(void); |
rgrover1 | 0:0b799af9d58e | 48 | |
rgrover1 | 0:0b799af9d58e | 49 | /* Time operations */ |
rgrover1 | 0:0b799af9d58e | 50 | long GetPlatformSpecificTimeInMillis(void); |
rgrover1 | 0:0b799af9d58e | 51 | void SetPlatformSpecificTimeInMillisMethod(long(*platformSpecific)(void)); |
rgrover1 | 0:0b799af9d58e | 52 | |
rgrover1 | 0:0b799af9d58e | 53 | const char* GetPlatformSpecificTimeString(void); |
rgrover1 | 0:0b799af9d58e | 54 | void SetPlatformSpecificTimeStringMethod(const char* (*platformMethod)(void)); |
rgrover1 | 0:0b799af9d58e | 55 | |
rgrover1 | 0:0b799af9d58e | 56 | /* String operations */ |
rgrover1 | 0:0b799af9d58e | 57 | int PlatformSpecificAtoI(const char*str); |
rgrover1 | 0:0b799af9d58e | 58 | size_t PlatformSpecificStrLen(const char* str); |
rgrover1 | 0:0b799af9d58e | 59 | int PlatformSpecificStrCmp(const char* s1, const char* s2); |
rgrover1 | 0:0b799af9d58e | 60 | int PlatformSpecificStrNCmp(const char* s1, const char* s2, size_t size); |
rgrover1 | 0:0b799af9d58e | 61 | char* PlatformSpecificStrStr(const char* s1, const char* s2); |
rgrover1 | 0:0b799af9d58e | 62 | |
rgrover1 | 0:0b799af9d58e | 63 | int PlatformSpecificVSNprintf(char *str, size_t size, const char* format, |
rgrover1 | 0:0b799af9d58e | 64 | va_list va_args_list); |
rgrover1 | 0:0b799af9d58e | 65 | |
rgrover1 | 0:0b799af9d58e | 66 | char PlatformSpecificToLower(char c); |
rgrover1 | 0:0b799af9d58e | 67 | |
rgrover1 | 0:0b799af9d58e | 68 | /* Misc */ |
rgrover1 | 0:0b799af9d58e | 69 | double PlatformSpecificFabs(double d); |
rgrover1 | 0:0b799af9d58e | 70 | int PlatformSpecificIsNan(double d); |
rgrover1 | 0:0b799af9d58e | 71 | int PlatformSpecificAtExit(void(*func)(void)); |
rgrover1 | 0:0b799af9d58e | 72 | |
rgrover1 | 0:0b799af9d58e | 73 | /* IO operations */ |
rgrover1 | 0:0b799af9d58e | 74 | typedef void* PlatformSpecificFile; |
rgrover1 | 0:0b799af9d58e | 75 | |
rgrover1 | 0:0b799af9d58e | 76 | PlatformSpecificFile PlatformSpecificFOpen(const char* filename, |
rgrover1 | 0:0b799af9d58e | 77 | const char* flag); |
rgrover1 | 0:0b799af9d58e | 78 | void PlatformSpecificFPuts(const char* str, PlatformSpecificFile file); |
rgrover1 | 0:0b799af9d58e | 79 | void PlatformSpecificFClose(PlatformSpecificFile file); |
rgrover1 | 0:0b799af9d58e | 80 | |
rgrover1 | 0:0b799af9d58e | 81 | int PlatformSpecificPutchar(int c); |
rgrover1 | 0:0b799af9d58e | 82 | void PlatformSpecificFlush(void); |
rgrover1 | 0:0b799af9d58e | 83 | |
rgrover1 | 0:0b799af9d58e | 84 | /* Dynamic Memory operations */ |
rgrover1 | 0:0b799af9d58e | 85 | void* PlatformSpecificMalloc(size_t size); |
rgrover1 | 0:0b799af9d58e | 86 | void* PlatformSpecificRealloc(void* memory, size_t size); |
rgrover1 | 0:0b799af9d58e | 87 | void PlatformSpecificFree(void* memory); |
rgrover1 | 0:0b799af9d58e | 88 | void* PlatformSpecificMemCpy(void* s1, const void* s2, size_t size); |
rgrover1 | 0:0b799af9d58e | 89 | void* PlatformSpecificMemset(void* mem, int c, size_t size); |
rgrover1 | 0:0b799af9d58e | 90 | |
rgrover1 | 0:0b799af9d58e | 91 | #ifdef __cplusplus |
rgrover1 | 0:0b799af9d58e | 92 | } |
rgrover1 | 0:0b799af9d58e | 93 | #endif |
rgrover1 | 0:0b799af9d58e | 94 | |
rgrover1 | 0:0b799af9d58e | 95 | #endif /* PLATFORMSPECIFICFUNCTIONS_C_H_ */ |