Commit graph

27 commits

Author SHA1 Message Date
Bill Currie
cf4ca286f0 implement pre and post increment operators (++ and --) 2001-08-20 06:22:28 +00:00
Bill Currie
248de6858d hopefully take care of freebsd 2001-08-11 21:46:02 +00:00
Bill Currie
c2d3d8f3ab temp def expressions and ?:
seems to work :)
2001-08-11 21:15:24 +00:00
Adam Olsen
6414897dae got a few new operators for qc :)
<< >> % which all act like their C counterparts
+= -= *= /= &= ^= |= <<= >>= %= which just expand into the obvious,
also like the C versions.
2001-08-10 16:17:00 +00:00
Bill Currie
28b1598e7e break the emit_* functions out of expr.c into emit.c 2001-07-26 05:15:34 +00:00
Bill Currie
620063628c typecheck values for [frame, think] on thost functions and fix some misplaced
immediate defs
2001-07-24 23:53:35 +00:00
Bill Currie
9ad075b02e make if/while/for use test_expr, make test_expr fix the new exp line/file,
fix some string const issues
2001-07-24 22:30:31 +00:00
Bill Currie
b8874cab1c function return checking 2001-07-23 02:27:46 +00:00
Bill Currie
c248372e20 Initial integer type support. qfcc /is/ partially broken when it comes to
integer constants and float function args/return values.

pr_comp.h:
	o  add the integer opcodes to pr_opcode_e
pr_edict.c:
	o  add "quaternion" and "integer" to type_name[]
	o  support quatnernion and integers types when printing values
	o  support the integer opcodes when bounds checking
pr_exec.c
	o  enable the integer opcodes
pr_opcode:
	o  add the integer opcodes to the opcode table
	o  logical operators all result in an integer rather than a value
expr.h:
	o  rename int_val to integer_val
qfcc.h:
	o  kill another magic number
expr.c:
	o  move the opcode to string conversion out of type_mismatch and into
	   get_op_string
	o  rename int_val to integer_val
	o  general integer type support.
	o  generate an internal comipiler error for null opcodes rather than
	   segging.
pr_imm.c:
	o  rename int_val to integer_val
	o  support integer constants, converting to float when needed.
pr_lex.c:
	o  magic number death and support quaternions and integers in type_size[]
qc-lex.l
	o  rename int_val to integer_val
	o  support quaternion and integer type keywords
qc-parse.y:
	o  rename int_val to integer_val
	o  use binary_expr instead of new_binary_expr for local initialized
	   variables
builtins.c:
	o  rename int_val to integer_val
	o  fix most (all?) of the INT related FIXMEs
defs.qc:
	o  use integer instead of float where it makes sense
main.c:
	o  read_result is now integer rather than float
main.qc:
	o  float -> integer where appropriate
	o  new test for int const to float arg
2001-07-23 01:31:22 +00:00
Bill Currie
55ac55c7ac rename ev_int and ex_int to ev_integer and ex_integer. create type_integer
and def_integer (do I need that?), clean up and or coment on XXX and FIXME
2001-07-22 06:59:12 +00:00
Bill Currie
098305d649 fix (expr_type1 && expr_type2). this involed type completing expressions :/ 2001-07-18 06:37:14 +00:00
Bill Currie
64e50e1ebd Basic debug info generation, just line numbers and local defs for each
function.
2001-07-14 01:15:40 +00:00
Bill Currie
1edf1e0b39 format checking for error and warning + needed fixes
try to give name of object when calling non-function
2001-07-03 20:53:49 +00:00
Bill Currie
6dfee9968b /much/ better error handling 2001-06-28 21:26:40 +00:00
Bill Currie
0271afbb10 warn about the dangers of (!foo & bar) 2001-06-28 15:20:31 +00:00
Bill Currie
50ae388caa initialisations now seem to work, including cows (mooOOoo:) 2001-06-26 22:43:28 +00:00
Bill Currie
d783a024b3 record an expression's line number and file and sort of handle state
expressions
2001-06-26 16:23:21 +00:00
Bill Currie
c1753046a9 start on actually generating code. doesn't work yet (getting a weird type
redeclaration error and not all expressions are handled yet).
2001-06-26 07:21:20 +00:00
Bill Currie
e99796c4cf new expression type: ex_block. forms a linked list of expressions for fast
appending and ease of manipulation.
2001-06-26 03:33:01 +00:00
Bill Currie
749d460041 duplicate code cleanup 2001-06-26 02:46:02 +00:00
Bill Currie
90b5c57266 fix lost initial char of string constants
make expression strings char * instead of string_t (don't put them into
pr_strings prematurely);
2001-06-25 22:53:15 +00:00
Bill Currie
53b66ef2e0 better label handling and strings are now completely parsed (including escapes) 2001-06-25 22:11:20 +00:00
Bill Currie
1779a124c5 expr.h:
nuke the ex_statement and estatement_[st] stuff
	add label_expr prototype
expr.c:
	ex_statement nukage
	correct new_expr's decl
	add label_expr to ease label creation
	don't crash when printing a null expression (bare return)
qc-parse.y:
	estatement_t nukage
	statement statements and statement_block are type expr
	generate `expressions' for statements

a full parse tree for each function is now generated. there are several
special expression opcodes for statements:
	d	done    \
	r	return  -> unary: expression to return or null
	i	if      binary:   evaluated expression, destination label
	n	ifnot   binary:   evaluated expression, destination label
	c	call    binary:   function def, args (expr list, rev order)
	s	state   binary:   frame const, function def
	g	goto    unary:    destination label
	l	label   unary:    label number
in a top level expression, l (label) defines the label, otherwise it is a
reference.
2001-06-25 20:52:04 +00:00
Bill Currie
ab051248e8 expr.h:
add prototype for print_expr
expr.c:
	add print_expr
	correct string accessors
	currect the result type for unary operators
qc-lex.l:
	correct string, vector and quaternion parsing
qc-parse.y:
	precedence corrections and more function scope work

CustomTF gets through the parsing again.
2001-06-25 17:15:56 +00:00
Bill Currie
aac91d8cd6 more expression handling. turns out I'm mis-parsing field types, so that's next 2001-06-20 21:18:04 +00:00
Bill Currie
226b40483d beginnings of expression and statement processing 2001-06-20 07:02:36 +00:00
Bill Currie
eeaab95be5 beginnings of expression and def handling. 2001-06-15 19:38:43 +00:00