/* Copyright 2009 Castle Technology Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* -> h.Message
 * Title: Message
 * Purpose: Message protocol definition for task
            communication in task windows.
 * History:
 *   16-May-88: JGT: history started.
 */

#ifndef message_h
#define message_h

#define TaskModuleSWI 0x808C0
typedef enum {
message_input   = TaskModuleSWI,     /* Parent has input for child */
message_output  = TaskModuleSWI + 1, /* Child has output for parent */
message_ego     = TaskModuleSWI + 2, /* Child tells parent its name */
message_morio   = TaskModuleSWI + 3, /* Child dies */
message_morite  = TaskModuleSWI + 4, /* Parent kills child */
message_newtask = TaskModuleSWI + 5, /* External agent requests task window */
message_suspend = TaskModuleSWI + 6, /* Parent halts child */
message_resume  = TaskModuleSWI + 7  /* Parent continues child */
} message_action;
/* This will appear in place of the wimp_msgaction in wimp_msghdr */

typedef struct
{
int    size;
char * data;
} message_data;
/* This will appear in the data field of wimp_msgstr */

extern os_error * message_taskinit(
char *   name,   /* The * comand to start the task, and its parameters */
wimp_t   me);    /* My task handle, passed to the task in STR$~ form */

extern os_error * message_sendmessage(
message_action action, /* As above */
wimp_t         dest,   /* Who to, 0 => everyone, including us */
message_data * data);  /* The data, NULL for die */

extern void message_taskwindow(char * comname);

extern void killalltasks(void);

extern void message_init(void);

#endif

/* End Message.h */