From: Charlie Brej Date: Sun, 30 Aug 2009 18:07:51 +0000 (+0100) Subject: [script] Adds debug support source files X-Git-Tag: 0.7.2~24^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6be18908b2fde845690a4906b054ae7d500ed210;p=thirdparty%2Fplymouth.git [script] Adds debug support source files --- diff --git a/src/plugins/splash/script/script-debug.c b/src/plugins/splash/script/script-debug.c new file mode 100644 index 00000000..9e9ef57a --- /dev/null +++ b/src/plugins/splash/script/script-debug.c @@ -0,0 +1,22 @@ +/* script-debug.h - Debug handling matching memory loaded data to source locations + * + * Copyright (C) 2009 Charlie Brej + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by: Charlie Brej + */ +#include "script-debug.h" diff --git a/src/plugins/splash/script/script-debug.h b/src/plugins/splash/script/script-debug.h new file mode 100644 index 00000000..8b6a41ea --- /dev/null +++ b/src/plugins/splash/script/script-debug.h @@ -0,0 +1,33 @@ +/* script-debug.h - Debug handling matching memory loaded data to source locations + * + * Copyright (C) 2009 Charlie Brej + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by: Charlie Brej + */ +#ifndef SCRIPT_DEBUG_H +#define SCRIPT_DEBUG_H + + +typedef struct +{ + int line_index; + int column_index; +} script_debug_source_location_t; + + +#endif /* SCRIPT_DEBUG_H */ diff --git a/src/plugins/splash/script/script-parse.c b/src/plugins/splash/script/script-parse.c index b409659d..08146ea5 100644 --- a/src/plugins/splash/script/script-parse.c +++ b/src/plugins/splash/script/script-parse.c @@ -150,8 +150,8 @@ static void script_parse_error (script_scan_token_t *token, const char *expected) { ply_error ("Parser error L:%d C:%d : %s\n", - token->line_index, - token->column_index, + token->location.line_index, + token->location.column_index, expected); } @@ -628,7 +628,7 @@ static script_op_t *script_parse_for (script_scan_t *scan) ply_list_append_data (op_list, op_first); ply_list_append_data (op_list, op_for); - script_op_t *op_block = script_parse_new_op_block (op_list) + script_op_t *op_block = script_parse_new_op_block (op_list); return op_block; } @@ -721,7 +721,7 @@ static script_op_t *script_parse_op (script_scan_t *scan) curtoken = script_scan_get_next_token (scan); #endif - script_op_t *op = script_parse_new_op_exp (exp) + script_op_t *op = script_parse_new_op_exp (exp); return op; } return NULL; diff --git a/src/plugins/splash/script/script-scan.c b/src/plugins/splash/script/script-scan.c index 7c59c385..114d0e76 100644 --- a/src/plugins/splash/script/script-scan.c +++ b/src/plugins/splash/script/script-scan.c @@ -171,8 +171,8 @@ void script_scan_read_next_token (script_scan_t *scan, } break; } - token->line_index = scan->line_index; - token->column_index = scan->column_index; + token->location.line_index = scan->line_index; + token->location.column_index = scan->column_index; nextchar = script_scan_get_next_char (scan); if (ply_bitarray_lookup (scan->identifier_1st_char, curchar)) diff --git a/src/plugins/splash/script/script-scan.h b/src/plugins/splash/script/script-scan.h index 971292f1..0b23b015 100644 --- a/src/plugins/splash/script/script-scan.h +++ b/src/plugins/splash/script/script-scan.h @@ -22,6 +22,7 @@ #ifndef script_scan_H #define script_scan_H +#include "script-debug.h" #include "ply-bitarray.h" #include @@ -49,8 +50,7 @@ typedef struct double floatpoint; } data; int whitespace; - int line_index; - int column_index; + script_debug_source_location_t location; } script_scan_token_t; typedef struct