home *** CD-ROM | disk | FTP | other *** search
- /* throwback.c - throwback client library */
- /* GTK 09.09.1992 */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <kernel.h>
-
- #define THROWBACK_START 0x42587
- #define THROWBACK_SEND 0x42588
- #define THROWBACK_END 0x42589
-
- /* holds filename of file currently being processed */
- static char* current_pathname = NULL;
-
- /* duplicate a string */
- char *strdup(char *from)
- {
- char *to;
-
- to = malloc(strlen(from) + 1);
- return(strcpy(to, from));
- }
-
- /* start throwback session */
- void throwback_start(void)
- {
- /* just dummies */
- _kernel_swi_regs regs;
-
- /* just call the swi */
- _kernel_swi(THROWBACK_START, ®s, ®s);
- }
-
- /* send something to the throwback-handling task */
- static void throwback_send(_kernel_swi_regs regs)
- {
- /* call swi passing on received register settings */
- _kernel_swi(THROWBACK_SEND, ®s, ®s);
- }
-
- /* end throwback session */
- void throwback_end(void)
- {
- /* just dummies */
- _kernel_swi_regs regs;
-
- /* just call the swi */
- _kernel_swi(THROWBACK_END, ®s, ®s);
- }
-
- /* tell throwback module (and this library) which file we're
- * currently processing */
- void throwback_processing(char *pathname)
- {
- _kernel_swi_regs r;
-
- r.r[0] = 0; /* reason code */
- current_pathname = strdup(pathname);
- /* pathname of file being processed */
- r.r[2] = (int) current_pathname;
- throwback_send(r); /* tell dde module about it */
- }
-
- /* signal an error to the throwback-handling task */
- void throwback_error(int lineno, int severity, char *description)
- {
- _kernel_swi_regs r;
-
- r.r[0] = 1;
- r.r[2] = (int) current_pathname;
- r.r[3] = lineno;
- r.r[4] = severity;
- r.r[5] = (int) description;
- throwback_send(r);
- }
-
- /* just issue a plain info message */
- void throwback_info(int lineno, char *description)
- {
- _kernel_swi_regs r;
-
- r.r[0] = 2;
- r.r[2] = (int) current_pathname;
- r.r[3] = lineno;
- r.r[4] = 0;
- r.r[5] = (int) description;
- throwback_send(r);
- }
-