home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #if defined(THINK_C)
- #include <MacHeaders>
- #else
- #include <Types.h>
- #include <Memory.h>
- #include <Quickdraw.h>
- #include <Windows.h>
- #endif
-
- void
- pstrcpy(unsigned char *s,unsigned char *t)
- {
- memcpy(s,t,t[0]+1L);
- }
-
- void
- pstrcat(unsigned char *s,unsigned char *t)
- {
- if ((long)s[0] + (long)t[0] > 255L) return;
- memcpy(s+s[0]+1,t+1,(long)t[0]);
- s[0] += t[0];
- }
-
- int
- pstrcmp(unsigned char *s,unsigned char *t)
- {
- int i;
-
- i = 1;
- while (1) {
- if (i-1 == s[0])
- if (i-1 == t[0])
- return 0;
- else
- return t[i];
- else
- if (i-1 == t[0])
- return -s[i];
- else
- if (s[i] != t[i])
- return t[i] - s[i];
- else
- ++i;
- }
- }
-
- int
- atoi(char *s)
- {
- int i;
- int neg;
-
- while (*s == ' ' || *s == '\t' || *s == '\015' || *s == '\012')
- ++s;
-
- if (*s == '-')
- neg = 1, ++s;
- else
- neg = 0;
-
- i = 0;
- while (*s >= '0' && *s <= '9') {
- i = 10 * i + (*s - '0');
- ++s;
- }
-
- return neg ? -i : i;
- }
-
- char *
- index(char *s,int t)
- {
- char *strchr();
- return strchr(s,t);
- }
-
- char *
- rindex(char *s,int t)
- {
- char *strrchr();
- return strrchr(s,t);
- }
-
- int
- random()
- {
- return Random() << 16 | Random();
- }
-
- void
- srandom(int seed)
- {
- qd.randSeed = seed;
- }
-