Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 6:40e873bbc5f7 1 /* mbed Microcontroller Library
MACRUM 6:40e873bbc5f7 2 * Copyright (c) 2006-2013 ARM Limited
MACRUM 6:40e873bbc5f7 3 *
MACRUM 6:40e873bbc5f7 4 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 6:40e873bbc5f7 5 * you may not use this file except in compliance with the License.
MACRUM 6:40e873bbc5f7 6 * You may obtain a copy of the License at
MACRUM 6:40e873bbc5f7 7 *
MACRUM 6:40e873bbc5f7 8 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 6:40e873bbc5f7 9 *
MACRUM 6:40e873bbc5f7 10 * Unless required by applicable law or agreed to in writing, software
MACRUM 6:40e873bbc5f7 11 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 6:40e873bbc5f7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 6:40e873bbc5f7 13 * See the License for the specific language governing permissions and
MACRUM 6:40e873bbc5f7 14 * limitations under the License.
MACRUM 6:40e873bbc5f7 15 */
MACRUM 6:40e873bbc5f7 16 #ifndef MBED_STREAM_H
MACRUM 6:40e873bbc5f7 17 #define MBED_STREAM_H
MACRUM 6:40e873bbc5f7 18
MACRUM 6:40e873bbc5f7 19 #include "platform/platform.h"
MACRUM 6:40e873bbc5f7 20 #include "drivers/FileLike.h"
MACRUM 6:40e873bbc5f7 21 #include "drivers/FileHandle.h"
MACRUM 6:40e873bbc5f7 22 #include <cstdarg>
MACRUM 6:40e873bbc5f7 23
MACRUM 6:40e873bbc5f7 24 namespace mbed {
MACRUM 6:40e873bbc5f7 25 /** \addtogroup drivers */
MACRUM 6:40e873bbc5f7 26 /** @{*/
MACRUM 6:40e873bbc5f7 27
MACRUM 6:40e873bbc5f7 28 extern void mbed_set_unbuffered_stream(FILE *_file);
MACRUM 6:40e873bbc5f7 29 extern int mbed_getc(FILE *_file);
MACRUM 6:40e873bbc5f7 30 extern char* mbed_gets(char *s, int size, FILE *_file);
MACRUM 6:40e873bbc5f7 31
MACRUM 6:40e873bbc5f7 32 /** File stream
MACRUM 6:40e873bbc5f7 33 *
MACRUM 6:40e873bbc5f7 34 * @Note Synchronization level: Set by subclass
MACRUM 6:40e873bbc5f7 35 */
MACRUM 6:40e873bbc5f7 36 class Stream : public FileLike {
MACRUM 6:40e873bbc5f7 37
MACRUM 6:40e873bbc5f7 38 public:
MACRUM 6:40e873bbc5f7 39 Stream(const char *name=NULL);
MACRUM 6:40e873bbc5f7 40 virtual ~Stream();
MACRUM 6:40e873bbc5f7 41
MACRUM 6:40e873bbc5f7 42 int putc(int c);
MACRUM 6:40e873bbc5f7 43 int puts(const char *s);
MACRUM 6:40e873bbc5f7 44 int getc();
MACRUM 6:40e873bbc5f7 45 char *gets(char *s, int size);
MACRUM 6:40e873bbc5f7 46 int printf(const char* format, ...);
MACRUM 6:40e873bbc5f7 47 int scanf(const char* format, ...);
MACRUM 6:40e873bbc5f7 48 int vprintf(const char* format, std::va_list args);
MACRUM 6:40e873bbc5f7 49 int vscanf(const char* format, std::va_list args);
MACRUM 6:40e873bbc5f7 50
MACRUM 6:40e873bbc5f7 51 operator std::FILE*() {return _file;}
MACRUM 6:40e873bbc5f7 52
MACRUM 6:40e873bbc5f7 53 protected:
MACRUM 6:40e873bbc5f7 54 virtual int close();
MACRUM 6:40e873bbc5f7 55 virtual ssize_t write(const void* buffer, size_t length);
MACRUM 6:40e873bbc5f7 56 virtual ssize_t read(void* buffer, size_t length);
MACRUM 6:40e873bbc5f7 57 virtual off_t seek(off_t offset, int whence);
MACRUM 6:40e873bbc5f7 58 virtual off_t tell();
MACRUM 6:40e873bbc5f7 59 virtual void rewind();
MACRUM 6:40e873bbc5f7 60 virtual int isatty();
MACRUM 6:40e873bbc5f7 61 virtual int sync();
MACRUM 6:40e873bbc5f7 62 virtual size_t size();
MACRUM 6:40e873bbc5f7 63
MACRUM 6:40e873bbc5f7 64 virtual int _putc(int c) = 0;
MACRUM 6:40e873bbc5f7 65 virtual int _getc() = 0;
MACRUM 6:40e873bbc5f7 66
MACRUM 6:40e873bbc5f7 67 std::FILE *_file;
MACRUM 6:40e873bbc5f7 68
MACRUM 6:40e873bbc5f7 69 /* disallow copy constructor and assignment operators */
MACRUM 6:40e873bbc5f7 70 private:
MACRUM 6:40e873bbc5f7 71 Stream(const Stream&);
MACRUM 6:40e873bbc5f7 72 Stream & operator = (const Stream&);
MACRUM 6:40e873bbc5f7 73 };
MACRUM 6:40e873bbc5f7 74
MACRUM 6:40e873bbc5f7 75 } // namespace mbed
MACRUM 6:40e873bbc5f7 76
MACRUM 6:40e873bbc5f7 77 #endif
MACRUM 6:40e873bbc5f7 78
MACRUM 6:40e873bbc5f7 79 /** @}*/