PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
TextDevices
libsimpletext
putStrDigits.c
1
/*
2
* @file writeStrDigits.c
3
* Function to print a string of specified width to the pointer.
4
*
5
* Copyright (c) 2013, Parallax Inc.
6
* Written by Steve Denson
7
*/
8
#include <ctype.h>
9
#include "
simpletext.h
"
10
11
int
putStrLen
(
char
*str,
int
width)
12
{
13
extern
text_t
*dport_ptr;
14
int
n;
15
for
(n = 0;
isalnum
(*(str+n)); n++)
16
;
17
for
( ; n < width; n++)
18
writeChar
(dport_ptr,
' '
);
19
while
(*str && width--)
20
{
21
writeChar
(dport_ptr, *str);
22
str++;
23
}
24
return
n;
25
}
26
27
/*
28
+--------------------------------------------------------------------
29
| TERMS OF USE: MIT License
30
+--------------------------------------------------------------------
31
Permission is hereby granted, free of charge, to any person obtaining
32
a copy of this software and associated documentation files
33
(the "Software"), to deal in the Software without restriction,
34
including without limitation the rights to use, copy, modify, merge,
35
publish, distribute, sublicense, and/or sell copies of the Software,
36
and to permit persons to whom the Software is furnished to do so,
37
subject to the following conditions:
38
39
The above copyright notice and this permission notice shall be
40
included in all copies or substantial portions of the Software.
41
42
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49
+--------------------------------------------------------------------
50
*/
51
putStrLen
int putStrLen(char *str, int width)
Send a string with a certain number of characters.
Definition:
putStrDigits.c:11
isalnum
#define isalnum(c)
Definition:
ctype.h:57
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
writeChar
void writeChar(text_t *device, char c)
Send a character to the device.
Definition:
writeChar.c:11
text_struct
Structure that contains data used by simple text device libraries.
Definition:
simpletext.h:81
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17