return (s + n);
}
-cstring cstring_prefix (cstring s, int n)
+cstring cstring_prefix (cstring s, int n) /*@requires maxRead(s) >= n /\ maxSet(s) >= n @*/ /*@ensures maxRead(result) == n /\ maxSet(result) == n @*/
{
cstring t;
char c;
return cstring_undefined;
}
-void cstring_setChar (cstring s, int n, char c)
+void cstring_setChar (cstring s, int n, char c) /*@requires maxRead(s) >= (n - 1) /\ maxSet(s) >= (n - 1) @*/
{
llassert (cstring_isDefined (s));
llassert (n > 0 && n <= cstring_length (s));
return (s[length - 1]);
}
-/*@only@*/ cstring cstring_copy (cstring s)
+/*@only@*/ cstring cstring_copy (cstring s) /*@ensures maxSet(result) == maxRead(s) /\ maxRead(result) == maxRead(s) @*/
{
if (cstring_isDefined (s))
{
}
}
-/*@only@*/ cstring cstring_copyLength (char *s, int len)
+/*@only@*/ cstring cstring_copyLength (char *s, int len) /*@requires maxSet(s) >= (len - 1) @*/
{
char *res = mstring_create (len + 1);
}
}
-void cstring_replaceLit (/*@unique@*/ cstring s, char *old, char *snew)
+void cstring_replaceLit (/*@unique@*/ cstring s, char *old, char *snew) /*@requires maxRead(snew) >= 0 /\ maxRead(old) >= 0 /\ maxRead(old) >= maxRead(snew) @*/
{
llassert (strlen (old) >= strlen (snew));
for (i = 0; i < size; i++)
{
- char c = s[i];
+/*drl bee: is*/ char c = s[i];
if (strchr (clist, c) != NULL)
{
for (j = i; j < size; j++)
{
- s[j] = s[j+1];
+ /*drl bee: is*/ /*drl bee: is*/ s[j] = s[j+1];
}
- s[size] = '\0';
+ /*drl bee: is*/ s[size] = '\0';
i--;
}
}
cmpcode cstring_genericEqual (cstring s, cstring t,
int nchars,
bool caseinsensitive,
- bool lookalike)
+ bool lookalike) /*@requires maxRead(s) >= nchars /\ maxRead(t) >= nchars @*/
{
if (s == t) return CGE_SAME;
else if (cstring_isUndefined (s))
t++;
}
+ /*drl bee: ib*/
+ /*drl bee: ib*/
if (*s == '\0' && *t != '\0')
{
return CGE_DISTINCT;
}
cstring
-cstring_capitalize (cstring s)
+cstring_capitalize (cstring s) /*@requires maxSet(s) >= 0 @*/
{
if (!cstring_isEmpty (s))
{
}
cstring
-cstring_capitalizeFree (cstring s)
+cstring_capitalizeFree (cstring s) /*@requires maxSet(s) >= 0 /\ maxRead(s) >= 0 @*/
{
if (!cstring_isEmpty (s))
{
else
{
llassert (s != NULL);
- *(s + len) = '\0';
+ /*drl bee: mrms*/ *(s + len) = '\0';
}
return s;
cstring sc = cstring_create (len);
strncpy (sc, s, size_fromInt (len));
- *(sc + len - 1) = '\0';
+ /*drl bee: mrms*/ *(sc + len - 1) = '\0';
*(sc + len - 2) = '.';
*(sc + len - 3) = '.';
*(sc + len - 4) = '.';
}
/*@only@*/ cstring
-cstring_fill (cstring s, int n)
+cstring_fill (cstring s, int n) /*@requires n >= 0 @*/
{
cstring t = cstring_create (n + 1);
cstring ot = t;
{
for (i = 0; i < n; i++)
{
+ /*drl bee: is*/
+ /*drl bee: is*/
*t++ = *s++;
}
*t = '\0';
{
for (i = 0; i < len; i++)
{
+ /*drl bee: is*/
+/*drl bee: is*/
*t++ = *s++;
}
for (i = 0; i < n - len; i++)
{
+/*drl bee: is*/
*t++ = ' ';
}
*t = '\0';
cstring ot = t;
char c;
- while ((c = *s) != '\0')
+ /*drl bee: lhnt*/ while ((c = *s) != '\0')
{
if (c >= 'A' && c <= 'Z')
{
*t++ = c;
s++;
}
- *t = '\0';
+ /*drl bee: is*/ *t = '\0';
return ot;
}
{
strcpy (s, s1);
*(s + l) = c;
- *(s + l + 1) = '\0';
+ /*drl bee: dm*/ *(s + l + 1) = '\0';
sfree (s1);
}
else
{
*(s) = c;
- *(s + 1) = '\0';
+ /*drl bee: dm*/ *(s + 1) = '\0';
}
return s;
# endif
/*@only@*/ cstring
-cstring_concatLength (cstring s1, char *s2, int len)
+cstring_concatLength (cstring s1, char *s2, int len) /*@requires maxSet(s2) >= (len - 1) @*/
{
cstring tmp = cstring_copyLength (s2, len);
cstring res = cstring_concat (s1, tmp);
}
/*@only@*/ cstring
-cstring_concat (cstring s, cstring t)
+cstring_concat (cstring s, cstring t) /*@requires maxSet(s) >= 0 @*/
{
char *ret = mstring_create (cstring_length (s) + cstring_length (t));
if (cstring_isDefined (s))
{
- strcpy (ret, s);
+ /*drl bee: sl*/ strcpy (ret, s);
}
if (cstring_isDefined (t))
{
int l = cstring_length (s1);
char *s = (char *) dmalloc (sizeof (*s) * (l + 2));
- *(s) = c;
+/*drl bee: dm*/ *(s) = c;
if (cstring_isDefined (s1))
{
/*@=mayaliasunique@*/
}
- *(s + l + 1) = '\0';
+ /*drl bee: dm*/ *(s + l + 1) = '\0';
return s;
}
if (cstring_isUndefined (s)) return FALSE;
- while ((c = (int) *s) != (int) '\0')
+/*drl bee: lhnt*/ while ((c = (int) *s) != (int) '\0')
{
if ((isalnum (c) == 0) && (c != (int) '_')
&& (c != (int) '.') && (c != (int) CONNECTCHAR))
{
char *s = dmalloc (sizeof (*s) * (n + 1));
- *s = '\0';
+ /*drl bee: dm*/ *s = '\0';
return s;
}
if (mid != 0 && mid < nentries - 1)
{
llassert (cstring_compare (key, table[mid - 1]) > 0);
- llassert (cstring_compare (key, table[mid + 1]) < 0);
+ /*drl bee: ndv*/ llassert (cstring_compare (key, table[mid + 1]) < 0);
}
return res;
if (cstring_isDefined (s)) {
char *t = s;
- while (*t != '\0' && isspace ((int) *t)) {
+ /*drl bee: lhnt*/ while (*t != '\0' && isspace ((int) *t)) {
t++;
}