home *** CD-ROM | disk | FTP | other *** search
- /*
- * This code is copyright ADE Muffett, September 1991, and is distributed as
- * part of the ASP .plan description language compiler. This code is freely
- * redistributable as long as this copyright notice remains intact. No
- * responsibility is assumed by the author for any situation which arises
- * from the use of this code, including insanity, late nights, or disk
- * storage problems.
- */
-
- #include "asp.h"
-
- /* alas, for ANSI... */
- char *
- Memcpy (to2, from, num)
- char *to2;
- register char *from;
- register int num;
- {
- register char *to = to2;
-
- while (num--)
- {
- *(to++) = *(from++);
- }
- return (to2);
- }
- /* Set a buffer to be full of nulls */
- void
- NullSet (string, num)
- register char *string;
- register int num;
- {
- while (num--)
- {
- *(string++) = '\0';
- }
- }
- /* Set all nulls in a buffer to be whitespace */
- void
- SpaceFlood (string, num)
- register char *string;
- register int num;
- {
- while (num--)
- {
- if (!*string)
- {
- *string = ' ';
- }
- string++;
- }
- }
- /* copy source to destination without adding trailing null */
- void
- Overlay (destination, source)
- register char *destination;
- register char *source;
- {
- while (*source)
- {
- *(destination++) = *(source++);
- }
- }
- /* copy source to destination without adding trailing null, except whitespace */
- void
- TransparentOverlay (destination, source)
- register char *destination;
- register char *source;
- {
- while (*source)
- {
- if (*source != ' ')
- {
- *destination = *source;
- }
- source++;
- destination++;
- }
- }
- /* copy into a bounded buffer */
- void
- LimCopy (to, from, start)
- register char *to;
- register char *from;
- register int start;
- {
- while (*from)
- {
- if (start >= 0 && start < SCREENWIDTH)
- {
- to[start] = *from;
- }
- from++;
- start++;
- }
- }
- /* END OF COPY PRIMITIVES */
-