1 /*
2 * Copyright (c) 2008 Stephen Williams (steve@icarus.com)
3 *
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 # include "config.h"
21 # include "compiler.h"
22 # include "pform.h"
23 # include "parse_misc.h"
24 # include "AStatement.h"
25
pform_contribution_statement(const struct vlltype & loc,PExpr * lval,PExpr * rval)26 AContrib* pform_contribution_statement(const struct vlltype&loc,
27 PExpr*lval, PExpr*rval)
28 {
29 AContrib*tmp = new AContrib(lval, rval);
30 FILE_NAME(tmp, loc);
31 return tmp;
32 }
33
pform_make_analog_behavior(const struct vlltype & loc,ivl_process_type_t pt,Statement * statement)34 void pform_make_analog_behavior(const struct vlltype&loc, ivl_process_type_t pt,
35 Statement*statement)
36 {
37 AProcess*proc = new AProcess(pt, statement);
38 FILE_NAME(proc, loc);
39
40 pform_put_behavior_in_scope(proc);
41 }
42
pform_make_branch_probe_expression(const struct vlltype & loc,char * name,char * n1,char * n2)43 PExpr* pform_make_branch_probe_expression(const struct vlltype&loc,
44 char*name, char*n1, char*n2)
45 {
46 vector<PExpr*> parms (2);
47 parms[0] = new PEIdent(lex_strings.make(n1));
48 FILE_NAME(parms[0], loc);
49
50 parms[1] = new PEIdent(lex_strings.make(n2));
51 FILE_NAME(parms[1], loc);
52
53 PECallFunction*res = new PECallFunction(lex_strings.make(name), parms);
54 FILE_NAME(res, loc);
55 return res;
56 }
57
pform_make_branch_probe_expression(const struct vlltype & loc,char * name,char * branch_name)58 PExpr* pform_make_branch_probe_expression(const struct vlltype&loc,
59 char*name, char*branch_name)
60 {
61 vector<PExpr*> parms (1);
62 parms[0] = new PEIdent(lex_strings.make(branch_name));
63 FILE_NAME(parms[0], loc);
64
65 PECallFunction*res = new PECallFunction(lex_strings.make(name), parms);
66 FILE_NAME(res, loc);
67
68 return res;
69 }
70