comparison lwbasic/attic/emit.c @ 185:cca933d32298

Clean up some mess in lwbasic directory
author lost@l-w.ca
date Thu, 22 Dec 2011 18:03:38 -0700
parents lwbasic/emit.c@49d608aecc4d
children
comparison
equal deleted inserted replaced
184:6433cb024174 185:cca933d32298
1 /*
2 emit.c
3
4 Copyright © 2011 William Astle
5
6 This file is part of LWTOOLS.
7
8 LWTOOLS is free software: you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation, either version 3 of the License, or (at your option) any later
11 version.
12
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 more details.
17
18 You should have received a copy of the GNU General Public License along with
19 this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 /*
23 This is the actual compiler bit; it drives the parser and code generation
24 */
25
26 #include <stdio.h>
27
28 #define __emit_c_seen__
29 #include "lwbasic.h"
30
31 void emit_prolog(cstate *state, int vis)
32 {
33 if (vis)
34 {
35 printf("\texport _%s\n", state -> currentsub);
36 }
37 printf("_%s\n", state -> currentsub);
38 if (state -> framesize > 0)
39 {
40 printf("\tleas %d,s\n", -(state -> framesize));
41 }
42 }
43
44 void emit_epilog(cstate *state)
45 {
46 if (state -> framesize > 0)
47 {
48 printf("\tleas %d,s\n", state -> framesize);
49 }
50 printf("\trts\n");
51 }