]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot/GStrCase.c
1 /* do not edit automatically generated by mc from StrCase. */
2 /* StrCase.mod provides procedure to convert between text case.
4 Copyright (C) 2001-2021 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
30 # if !defined (PROC_D)
32 typedef void (*PROC_t
) (void);
33 typedef struct { PROC_t proc
; } PROC
;
44 StrToUpperCase - converts string, a, to uppercase returning the
48 extern "C" void StrCase_StrToUpperCase (const char *a_
, unsigned int _a_high
, char *b
, unsigned int _b_high
);
51 StrToLowerCase - converts string, a, to lowercase returning the
55 extern "C" void StrCase_StrToLowerCase (const char *a_
, unsigned int _a_high
, char *b
, unsigned int _b_high
);
58 Cap - converts a lower case character into a capital character.
59 If the character is not a lower case character 'a'..'z'
60 then the character is simply returned unaltered.
63 extern "C" char StrCase_Cap (char ch
);
66 Lower - converts an upper case character into a lower case character.
67 If the character is not an upper case character 'A'..'Z'
68 then the character is simply returned unaltered.
71 extern "C" char StrCase_Lower (char ch
);
75 StrToUpperCase - converts string, a, to uppercase returning the
79 extern "C" void StrCase_StrToUpperCase (const char *a_
, unsigned int _a_high
, char *b
, unsigned int _b_high
)
86 /* make a local copy of each unbounded array. */
87 memcpy (a
, a_
, _a_high
+1);
89 higha
= StrLib_StrLen ((const char *) a
, _a_high
);
92 while (((i
< higha
) && (a
[i
] != ASCII_nul
)) && (i
< highb
))
94 b
[i
] = StrCase_Cap (a
[i
]);
105 StrToLowerCase - converts string, a, to lowercase returning the
109 extern "C" void StrCase_StrToLowerCase (const char *a_
, unsigned int _a_high
, char *b
, unsigned int _b_high
)
116 /* make a local copy of each unbounded array. */
117 memcpy (a
, a_
, _a_high
+1);
119 higha
= StrLib_StrLen ((const char *) a
, _a_high
);
122 while (((i
< higha
) && (a
[i
] != ASCII_nul
)) && (i
< highb
))
124 b
[i
] = StrCase_Lower (a
[i
]);
135 Cap - converts a lower case character into a capital character.
136 If the character is not a lower case character 'a'..'z'
137 then the character is simply returned unaltered.
140 extern "C" char StrCase_Cap (char ch
)
142 if ((ch
>= 'a') && (ch
<= 'z'))
144 ch
= ((char) (( ((unsigned int) (ch
))- ((unsigned int) ('a')))+ ((unsigned int) ('A'))));
147 /* static analysis guarentees a RETURN statement will be used before here. */
148 __builtin_unreachable ();
153 Lower - converts an upper case character into a lower case character.
154 If the character is not an upper case character 'A'..'Z'
155 then the character is simply returned unaltered.
158 extern "C" char StrCase_Lower (char ch
)
160 if ((ch
>= 'A') && (ch
<= 'Z'))
162 ch
= ((char) (( ((unsigned int) (ch
))- ((unsigned int) ('A')))+ ((unsigned int) ('a'))));
165 /* static analysis guarentees a RETURN statement will be used before here. */
166 __builtin_unreachable ();
169 extern "C" void _M2_StrCase_init (__attribute__((unused
)) int argc
,__attribute__((unused
)) char *argv
[],__attribute__((unused
)) char *envp
[])
173 extern "C" void _M2_StrCase_finish (__attribute__((unused
)) int argc
,__attribute__((unused
)) char *argv
[],__attribute__((unused
)) char *envp
[])