PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
getStr.c
1 /*
2  * Super-simple text I/O for PropGCC, stripped of all stdio overhead.
3  * Copyright (c) 2012, Ted Stefanik. Concept inspired by:
4  *
5  * very simple printf, adapted from one written by me [Eric Smith]
6  * for the MiNT OS long ago
7  * placed in the public domain
8  * - Eric Smith
9  * Propeller specific adaptations
10  * Copyright (c) 2011 Parallax, Inc.
11  * Written by Eric R. Smith, Total Spectrum Software Inc.
12  *
13  * MIT licensed (see terms at end of file)
14  */
15 
16 #include <limits.h>
17 #include "simpletext.h"
18 
19 char* getStr(char* buf, int max)
20 {
21  extern text_t *dport_ptr;
22  return (_safe_gets(dport_ptr, buf, max));
23 }
24 
25 char* readStr(text_t *text, char* buf, int max)
26 {
27  return (_safe_gets(text, buf, max));
28 }
29 
30 
31 /* +--------------------------------------------------------------------
32  * | TERMS OF USE: MIT License
33  * +--------------------------------------------------------------------
34  * Permission is hereby granted, free of charge, to any person obtaining
35  * a copy of this software and associated documentation files
36  * (the "Software"), to deal in the Software without restriction,
37  * including without limitation the rights to use, copy, modify, merge,
38  * publish, distribute, sublicense, and/or sell copies of the Software,
39  * and to permit persons to whom the Software is furnished to do so,
40  * subject to the following conditions:
41  *
42  * The above copyright notice and this permission notice shall be
43  * included in all copies or substantial portions of the Software.
44  *
45  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
46  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
47  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
48  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
49  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
50  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
51  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52  * +--------------------------------------------------------------------
53  */
getStr
char * getStr(char *buffer, int max)
Get string of chars from the debug port.
Definition: getStr.c:19
readStr
char * readStr(text_t *device, char *buffer, int max)
Get string of chars from the device.
Definition: getStr.c:25
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
text_struct
Structure that contains data used by simple text device libraries.
Definition: simpletext.h:81