source: trunk/src/emx/include/dyn-string.h@ 1015

Last change on this file since 1015 was 123, checked in by zap, 22 years ago

Started the work for re-designing the EMX C runtime library to not require
EMX.DLL. The new design is projected to be as follows:

  • all emx syscalls are replaced with the routines from the old sys.lib library which is now compilable in both a.out and OMF formats.
  • the sys.a library should be made replaceable and selectable by some gcc switch (e.g. -msyslib=emx would link with emx.a instead of sys.a which would give almost full backward compatibility with emx).
  • All C functions names were renamed to not contain the starting underscore (e.g. fopen and not _fopen). The underscored aliases will be added later with the c_alias library (which will be generated automatically from all public symbols of libc; any exported symbol that do not start with an underscore will be given an underscored alias unless such a symbol is already defined).

Also a lot of updates to the building system. It is now much faster (thanks
to Knut's suggestion of using ash's builtin echo).
Also re-wrote thunk1.asm and thunk2.asm to GAS format; this removes the need
for MASM and makes it possible to use 16-bit functions in a.out programs
without the need for EMX.DLL.
Also made a lot of small changes I don't remember now.

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/* An abstract string datatype.
2 Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
3 Contributed by Mark Mitchell (mark@markmitchell.com).
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22
23typedef struct dyn_string
24{
25 int allocated; /* The amount of space allocated for the string. */
26 int length; /* The actual length of the string. */
27 char *s; /* The string itself, NUL-terminated. */
28}* dyn_string_t;
29
30/* The length STR, in bytes, not including the terminating NUL. */
31#define dyn_string_length(STR) \
32 ((STR)->length)
33
34/* The NTBS in which the contents of STR are stored. */
35#define dyn_string_buf(STR) \
36 ((STR)->s)
37
38/* Compare DS1 to DS2 with strcmp. */
39#define dyn_string_compare(DS1, DS2) \
40 (strcmp ((DS1)->s, (DS2)->s))
41
42
43/* dyn_string functions are used in the demangling implementation
44 included in the G++ runtime library. To prevent collisions with
45 names in user programs, the functions that are used in the
46 demangler are given implementation-reserved names. */
47
48#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
49
50#define dyn_string_init __cxa_dyn_string_init
51#define dyn_string_new __cxa_dyn_string_new
52#define dyn_string_delete __cxa_dyn_string_delete
53#define dyn_string_release __cxa_dyn_string_release
54#define dyn_string_resize __cxa_dyn_string_resize
55#define dyn_string_clear __cxa_dyn_string_clear
56#define dyn_string_copy __cxa_dyn_string_copy
57#define dyn_string_copy_cstr __cxa_dyn_string_copy_cstr
58#define dyn_string_prepend __cxa_dyn_string_prepend
59#define dyn_string_prepend_cstr __cxa_dyn_string_prepend_cstr
60#define dyn_string_insert __cxa_dyn_string_insert
61#define dyn_string_insert_cstr __cxa_dyn_string_insert_cstr
62#define dyn_string_insert_char __cxa_dyn_string_insert_char
63#define dyn_string_append __cxa_dyn_string_append
64#define dyn_string_append_cstr __cxa_dyn_string_append_cstr
65#define dyn_string_append_char __cxa_dyn_string_append_char
66#define dyn_string_substring __cxa_dyn_string_substring
67#define dyn_string_eq __cxa_dyn_string_eq
68
69#endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */
70
71
72extern int dyn_string_init PARAMS ((struct dyn_string *, int));
73extern dyn_string_t dyn_string_new PARAMS ((int));
74extern void dyn_string_delete PARAMS ((dyn_string_t));
75extern char *dyn_string_release PARAMS ((dyn_string_t));
76extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int));
77extern void dyn_string_clear PARAMS ((dyn_string_t));
78extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t));
79extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *));
80extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t));
81extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *));
82extern int dyn_string_insert PARAMS ((dyn_string_t, int,
83 dyn_string_t));
84extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int,
85 const char *));
86extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int));
87extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t));
88extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *));
89extern int dyn_string_append_char PARAMS ((dyn_string_t, int));
90extern int dyn_string_substring PARAMS ((dyn_string_t,
91 dyn_string_t, int, int));
92extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t));
Note: See TracBrowser for help on using the repository browser.