/*
dnl  This file is part of GNU APL, a free implementation of the
dnl  ISO/IEC Standard 13751, "Programming Language APL, Extended"
dnl
dnl  Copyright (C) 2008-2014  Dr. Jürgen Sauermann
dnl
dnl  This program is free software: you can redistribute it and/or modify
dnl  it under the terms of the GNU General Public License as published by
dnl  the Free Software Foundation, either version 3 of the License, or
dnl  (at your option) any later version.
dnl
dnl  This program is distributed in the hope that it will be useful,
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl  GNU General Public License for more details.
dnl
dnl  You should have received a copy of the GNU General Public License
dnl  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


/// ⎕SVO
m4_signal(MAKE_OFFER,       x64,    key)
/// ⎕SVR
m4_signal(RETRACT_OFFER,    x64,    key)
/// ⎕SVR
m4_signal(RETRACT_VAR,      x64,    key)

/// set state of shared var \b key
m4_signal(SET_STATE,        x64,    key,
                            u8,     new_state,
                            string, loc)

/// set control of shared var \b key
m4_signal(SET_CONTROL,      x64,    key,
                            u8,     new_control)

/// X←SVAR
m4_signal(GET_VALUE,        x64,    key)

/// X←SVAR result
m4_signal(VALUE_IS,         x64,    key,
                            u32,    error,
                            string, error_loc,
                            string, cdr_value)

/// SVAR←X
m4_signal(ASSIGN_VALUE,     x64,    key,
                            string, cdr_value)
/// SVAR←X result
m4_signal(SVAR_ASSIGNED,    x64,    key,
                            u32,    error,
                            string, error_loc)

/// Can svar key be referenced ?
m4_signal(MAY_USE,          x64,    key,
                            i32,    attempt)

/// Can svar key be assigned ?
m4_signal(MAY_SET,          x64,    key,
                            i32,    attempt)

/// read SVAR database record from APserver
///
///		apl/APnnn	--> READ_SVAR_RECORD		APserver
///				<-- SVAR_RECORD_IS
///
m4_signal(READ_SVAR_RECORD,     x64,    key)
/// result (record) for read SVAR database record from APserver
m4_signal(SVAR_RECORD_IS,       string, record)

/// is ID registered ?
m4_signal(IS_REGISTERED_ID,	u32,    proc,
				u32,    parent,
				u32,    grand)

/// yes (1) or no (0)
m4_signal(YES_NO,	        u8,    yes)

/// register processor proc in APserver
m4_signal(REGISTER_PROCESSOR,	u32,    proc,
				u32,    parent,
				u32,    grand,
				u8,     evconn,
				string, progname)

/// match offered shared variable or create a new offer
m4_signal(MATCH_OR_MAKE,        string, varname,
                                u32,    to_proc,
                                u32,    to_parent,
                                u32,    to_grand,
                                u32,    from_proc,
                                u32,    from_parent,
                                u32,    from_grand)

/// result for match or create
m4_signal(MATCH_OR_MAKE_RESULT, x64,    key)


/// find processor ID that offers \b key
m4_signal(FIND_OFFERING_ID,     x64,    key)

/// result of find processor ID that offers \b key
m4_signal(OFFERING_ID_IS,       u32,    proc,
                                u32,    parent,
                                u32,    grand)

/// get offering processors  (⎕SVQ)
m4_signal(GET_OFFERING_PROCS,   u32,    offered_to_proc)

/// result of get offering processors  (⎕SVQ)
m4_signal(OFFERING_PROCS_ARE,   string, offering_procs)

/// get offered variables  (⎕SVQ)
m4_signal(GET_OFFERED_VARS,     u32,    offered_to_proc,
                                u32,    accepted_by_proc)

/// result of get offered variables  (⎕SVQ)
m4_signal(OFFERED_VARS_ARE,     string, offered_vars)

/// find pairing key (CTL vs. DAT or Cnnn vs. Dnnn) for AP210
m4_signal(FIND_PAIRING_KEY,	x64,    key)

/// result of find pairing key
m4_signal(PAIRING_KEY_IS,	x64,    pairing_key)

/// result of find pairing key (CTL vs. DAT or Cnnn vs. Dnnn) for AP210
/// get events for one processor (first shared var with an event)
m4_signal(GET_EVENTS,           u32,    proc,
                                u32,    parent,
                                u32,    grand)

/// clear all events for one processor
m4_signal(CLEAR_ALL_EVENTS,     u32,    proc,
                                u32,    parent,
                                u32,    grand)


/// result of clear all events for one processor (first cleared svar
m4_signal(EVENTS_ARE,           x64,    key,
                                u32,    events)

/// add an event  for \b key
m4_signal(ADD_EVENT,	        x64,    key,
				u32,    proc,
                                u32,    parent,
                                u32,    grand,
				u32,    event)

/// ws-ws SVAR←X
m4_signal(ASSIGN_WSWS_VAR,	x64,    key,
                                string, cdr_value)
/// X←ws-ws SVAR
m4_signal(READ_WSWS_VAR,	x64,    key)
/// result of X←ws-ws SVAR
m4_signal(WSWS_VALUE_IS,	string, cdr_value)

/// print the entire database (for command ]SVARS)
m4_signal(PRINT_SVAR_DB)
/// print the entire database result
m4_signal(SVAR_DB_PRINTED,      string, printout)

