comparison lwbasic/input.c @ 25:87590f43e76d

Started lwbasic parser; checkpoint
author lost@l-w.ca
date Mon, 24 Jan 2011 20:08:09 -0700
parents 25a4aef9c5ed
children
comparison
equal deleted inserted replaced
24:421d7ceb4d86 25:87590f43e76d
26 #include <stdlib.h> 26 #include <stdlib.h>
27 #include <stdio.h> 27 #include <stdio.h>
28 #include <string.h> 28 #include <string.h>
29 29
30 #include <lw_alloc.h> 30 #include <lw_alloc.h>
31 #include <lw_error.h>
31 32
32 #define __input_c_seen__ 33 #define __input_c_seen__
33 #include "lwbasic.h" 34 #include "lwbasic.h"
34 35
35 struct input_state 36 struct input_state
52 else 53 else
53 { 54 {
54 sp -> fp = fopen(state -> input_file, "rb"); 55 sp -> fp = fopen(state -> input_file, "rb");
55 if (!(sp -> fp)) 56 if (!(sp -> fp))
56 { 57 {
57 fprintf(stderr, "Cannot open input file\n"); 58 lwb_error("Cannot open input file\n");
58 exit(1);
59 } 59 }
60 } 60 }
61 61
62 state -> input_state = sp; 62 state -> input_state = sp;
63 } 63 }