From 32fa80be0f6d7819f876080b807c17515d2f1ee3 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 8 Oct 2007 22:04:11 +0000 Subject: [PATCH] Removed the kroc C wrapper file (kroc-wrapper-c.c) in favour of tacking it onto the end of each C file we create (to better facilitate all-in-one compilation) --- Makefile.am | 2 +- backends/GenerateC.hs | 7 +++++++ kroc-wrapper-c.c | 31 ------------------------------- 3 files changed, 8 insertions(+), 32 deletions(-) delete mode 100644 kroc-wrapper-c.c diff --git a/Makefile.am b/Makefile.am index df94122..4b93a41 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CompilerCommands.hs: Makefile echo -e 'cAsmCommand :: String -> String -> String\n' >> CompilerCommands.hs echo -e 'cAsmCommand inp out = "$(CC) $(TOCK_CFLAGS) -x c -S -o " ++ out ++ " " ++ inp\n' >> CompilerCommands.hs echo -e 'krocLinkCommand :: String -> String -> String -> String\n' - echo -e 'krocLinkCommand fileA fileB out = "kroc -o " ++ out ++ " kroc-wrapper.occ " ++ fileA ++ " " ++ fileB ++ " kroc-wrapper-c.o -lcif"\n' >> CompilerCommands.hs + echo -e 'krocLinkCommand fileA fileB out = "kroc -o " ++ out ++ " kroc-wrapper.occ " ++ fileA ++ " " ++ fileB ++ " -lcif"\n' >> CompilerCommands.hs echo -e 'cxxCommand :: String -> String -> String\n' >> CompilerCommands.hs echo -e 'cxxCommand inp out = "$(CXX) $(TOCK_CXXFLAGS) -x c++ -o " ++ out ++ " " ++ inp\n' >> CompilerCommands.hs diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 9ccf7e6..0cd3906 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -289,6 +289,13 @@ cgenTopLevel ops p sequence_ [tell [", "] >> call genTLPChannel ops c | (_,c) <- chans] tell [");\n"] tell ["}\n"] + + tell ["void _tock_main_init (int *ws) {"] + tell ["Process *p = ProcAlloc (tock_main, 65536, 3,"] + tell ["(Channel *) ws[1], (Channel *) ws[2], (Channel *) ws[3]);"] + tell ["*((int *) ws[0]) = (int) p;"] + tell ["}"] + tell ["void _tock_main_free (int *ws) {ProcAllocClean ((Process *) ws[0]);}"] --}}} --{{{ utilities diff --git a/kroc-wrapper-c.c b/kroc-wrapper-c.c deleted file mode 100644 index db53007..0000000 --- a/kroc-wrapper-c.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * KRoC wrapper to run Tock-generated CIF program - * Copyright (C) 2007 University of Kent - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License 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 the GNU Lesser - * General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - */ - -#include - -extern void tock_main (Process *me, Channel *in, Channel *out, Channel *err); - -void _tock_main_init (int *ws) { - Process *p = ProcAlloc (tock_main, 65536, 3, - (Channel *) ws[1], (Channel *) ws[2], (Channel *) ws[3]); - *((int *) ws[0]) = (int) p; -} - -void _tock_main_free (int *ws) { - ProcAllocClean ((Process *) ws[0]); -}