----------------->  GNU Sather - compiler configuration file  <----------------
-- Copyright (C) 199x by International Computer Science Institute            --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  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 Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

#ifndef LM_INCLUDE_CONFIG
#define LM_ACCESS_CONFIG

LM_LOCK_C_ARRAY_CREATE: volatile, no_pre, no_post,
        var     "int i;"
                "@r $$;",
        exec    "$$ = (@r)malloc($2 * sizeof(@r));"
                "if (FAR($1) { lm_get_remote_locks($$,$1,$2); "
                "} else { for(i=0;i<$2;i++) $$[i] = ((@r)locks)[i]; }"
                "$$";

GET_REMOTE_C_ARRAY: volatile, no_pre, no_post,
        var     "int i;"
                "int offset;"
                "BR_spinlock_t spinlock;"
                "@r $$;",
        exec    "$$ = (@r)malloc(($2) * sizeof(@r));"
                "BR_SPINLOCK_INIT(spinlock);"
                "BR_SPINLOCK_LOCK(spinlock);"
                "for (i=0, offset=0; i<($2); i++, offset+=sizeof(void*)) {"
                " BR_REQUEST_3($3,(BR_handler_3_t)lm_get_remote_ptr_request,(BR_word_t)(($1)+offset),(BR_word_t)(($$)+offset),(BR_word_t)(&spinlock));"
                " BR_SPINLOCK_LOCK(spinlock);"
                "}"
                "$$";

#endif


