From 637be83cf5b129b7e55de97c5988f4dfa3c397bf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 26 Apr 2012 09:43:55 +1000 Subject: TONY: Start of work converting over MPAL sub-system --- engines/tony/mpal/expr.h | 116 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 engines/tony/mpal/expr.h (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h new file mode 100644 index 0000000000..d54f17b088 --- /dev/null +++ b/engines/tony/mpal/expr.h @@ -0,0 +1,116 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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 + * of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * + */ +/************************************************************************** + * 様様様様様様様様様様様様様様様様様 * + * ... Spyral Software snc * + * . x#""*$Nu -= We create much MORE than ALL =- * + * d*#R$. R ^#$o 様様様様様様様様様様様様様様様様様 * + * .F ^$k $ "$b * + * ." $b u "$ #$L * + * P $c :*$L"$L '$k Project: MPAL................... * + * d @$N. $. d ^$b^$k $c * + * F 4 "$c '$ $ #$u#$u '$ Module: Expression gestor heade * + * 4 4k *N #b .> '$N'*$u * * + * M $L #$ $ 8 "$c'#$b.. .@ Author: Giovanni Bajo.......... * + * M '$u "$u :" *$. "#*#" * + * M '$N. " F ^$k Desc: Gestisce le espressioni * + * 4> ^R$oue# d matematiche............ * + * '$ "" @ ....................... * + * #b u# * + * $b .@" OS: [ ] DOS [X] WIN95 [ ] OS/2 * + * #$u .d" * + * '*$e. .zR".@ 様様様様様様様様様様様様様様様様様 * + * "*$$beooee$*" @"M This source code is * + * """ '$.? Copyright (C) Spyral Software * + * '$d> ALL RIGHTS RESERVED * + * '$> 様様様様様様様様様様様様様様様様様 * + * * + **************************************************************************/ + +#ifndef MPAL_EXPR_H +#define MPAL_EXPR_H + +namespace Tony { + +namespace MPAL { + +/****************************************************************************\ +* Prototipi di funzione +\****************************************************************************/ + +/****************************************************************************\ +* +* Function: byte *ParseExpression(byte *buf, HGLOBAL *h); +* +* Description: Esegue il parsing da file .MPC di un'espressione matematica. +* +* Input: byte *buf Buffer contenente l'espressione +* compilata. +* HGLOBAL *h Pointer a un handle che, alla fine +* dell'esecuzione, puntera' alla +* zona di memoria contenete l'espres- +* sione parsata +* +* Return: Puntatore al buffer subito dopo l'espressione, o NULL in caso +* di errore. +* +\****************************************************************************/ + +byte *ParseExpression(byte *lpBuf, HGLOBAL *h); + + +/****************************************************************************\ +* +* Function: int EvaluateExpression(HGLOBAL h); +* +* Description: Calcola il valore di un'espressione matematica +* +* Input: HGLOBAL h Handle all'espressione +* +* Return: Valore numerico +* +\****************************************************************************/ + +int EvaluateExpression(HGLOBAL h); + + +/****************************************************************************\ +* +* Function: bool CompareExpressions(HGLOBAL h1, HGLOBAL h2); +* +* Description: Confronta due espressioni matematiche tra loro +* +* Input: HGLOBAL h1,h2 Espressioni da confrontare +* +* Return: TRUE se sono uguali, FALSE se sono diverse +* +\****************************************************************************/ + +bool CompareExpressions(HGLOBAL h1, HGLOBAL h2); + + +} // end of namespace MPAL + +} // end of namespace Tony + +#endif -- cgit v1.2.3 From a511b828e416c657e01a86e931016d4a4b7d49b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 May 2012 00:29:44 +1000 Subject: TONY: Initial fixes for some of the Valgrind reported errors --- engines/tony/mpal/expr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index d54f17b088..582f6d381d 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -76,7 +76,7 @@ namespace MPAL { * \****************************************************************************/ -byte *ParseExpression(byte *lpBuf, HGLOBAL *h); +const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); /****************************************************************************\ -- cgit v1.2.3 From 5d18a71045bd933fc2efc7ed6e60ef7763745cb7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 May 2012 12:33:14 +1000 Subject: TONY: Converting comments to English and formatting --- engines/tony/mpal/expr.h | 65 ++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 44 deletions(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 582f6d381d..3a9f0f3208 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -55,60 +55,37 @@ namespace Tony { namespace MPAL { /****************************************************************************\ -* Prototipi di funzione -\****************************************************************************/ - -/****************************************************************************\ -* -* Function: byte *ParseExpression(byte *buf, HGLOBAL *h); -* -* Description: Esegue il parsing da file .MPC di un'espressione matematica. -* -* Input: byte *buf Buffer contenente l'espressione -* compilata. -* HGLOBAL *h Pointer a un handle che, alla fine -* dell'esecuzione, puntera' alla -* zona di memoria contenete l'espres- -* sione parsata -* -* Return: Puntatore al buffer subito dopo l'espressione, o NULL in caso -* di errore. -* +* Function Prototypes \****************************************************************************/ +/** + * Parses a mathematical expression from the MPC file + * + * @param buf Buffer containing the expression to evaluate + * @param h Pointer to a handle that, at the end of execution, + * will point to the area of memory containing the parsed expression + * @returns Pointer to the buffer immediately after the expression, or NULL if error. + */ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); -/****************************************************************************\ -* -* Function: int EvaluateExpression(HGLOBAL h); -* -* Description: Calcola il valore di un'espressione matematica -* -* Input: HGLOBAL h Handle all'espressione -* -* Return: Valore numerico -* -\****************************************************************************/ - +/** + * Calculate the value of a mathamatical expression + * + * @param h Handle to the expression + * @returns Numeric value + */ int EvaluateExpression(HGLOBAL h); -/****************************************************************************\ -* -* Function: bool CompareExpressions(HGLOBAL h1, HGLOBAL h2); -* -* Description: Confronta due espressioni matematiche tra loro -* -* Input: HGLOBAL h1,h2 Espressioni da confrontare -* -* Return: TRUE se sono uguali, FALSE se sono diverse -* -\****************************************************************************/ - +/** + * Compare two mathematical expressions together + * + * @param h1 Expression to be compared + * @param h2 Expression to be compared + */ bool CompareExpressions(HGLOBAL h1, HGLOBAL h2); - } // end of namespace MPAL } // end of namespace Tony -- cgit v1.2.3 From c38bbce20cf69748012863dcd08c575ba6b56c9d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 May 2012 16:11:25 +1000 Subject: TONY: Remove original header --- engines/tony/mpal/expr.h | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 3a9f0f3208..7d7ca09c41 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -20,32 +20,11 @@ * * */ -/************************************************************************** - * 様様様様様様様様様様様様様様様様様 * - * ... Spyral Software snc * - * . x#""*$Nu -= We create much MORE than ALL =- * - * d*#R$. R ^#$o 様様様様様様様様様様様様様様様様様 * - * .F ^$k $ "$b * - * ." $b u "$ #$L * - * P $c :*$L"$L '$k Project: MPAL................... * - * d @$N. $. d ^$b^$k $c * - * F 4 "$c '$ $ #$u#$u '$ Module: Expression gestor heade * - * 4 4k *N #b .> '$N'*$u * * - * M $L #$ $ 8 "$c'#$b.. .@ Author: Giovanni Bajo.......... * - * M '$u "$u :" *$. "#*#" * - * M '$N. " F ^$k Desc: Gestisce le espressioni * - * 4> ^R$oue# d matematiche............ * - * '$ "" @ ....................... * - * #b u# * - * $b .@" OS: [ ] DOS [X] WIN95 [ ] OS/2 * - * #$u .d" * - * '*$e. .zR".@ 様様様様様様様様様様様様様様様様様 * - * "*$$beooee$*" @"M This source code is * - * """ '$.? Copyright (C) Spyral Software * - * '$d> ALL RIGHTS RESERVED * - * '$> 様様様様様様様様様様様様様様様様様 * - * * - **************************************************************************/ +/* + * This code is based on original Tony Tough source code + * + * Copyright (c) 1997-2003 Nayma Software + */ #ifndef MPAL_EXPR_H #define MPAL_EXPR_H -- cgit v1.2.3 From 75a0b0c6296af6600ce1a4e585fb7c5b9a0ea203 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 May 2012 00:19:46 +0200 Subject: TONY: Some more code formatting --- engines/tony/mpal/expr.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 7d7ca09c41..17e9c1264b 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -47,7 +47,6 @@ namespace MPAL { */ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); - /** * Calculate the value of a mathamatical expression * @@ -56,7 +55,6 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); */ int EvaluateExpression(HGLOBAL h); - /** * Compare two mathematical expressions together * -- cgit v1.2.3 From cd15e483ed64274049142a2e6838962d794c3ff5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Jun 2012 21:14:59 +0200 Subject: TONY: Some more renaming --- engines/tony/mpal/expr.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 17e9c1264b..7d33e5c8ca 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -45,7 +45,7 @@ namespace MPAL { * will point to the area of memory containing the parsed expression * @returns Pointer to the buffer immediately after the expression, or NULL if error. */ -const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); +const byte *parseExpression(const byte *lpBuf, HGLOBAL *h); /** * Calculate the value of a mathamatical expression @@ -53,7 +53,7 @@ const byte *ParseExpression(const byte *lpBuf, HGLOBAL *h); * @param h Handle to the expression * @returns Numeric value */ -int EvaluateExpression(HGLOBAL h); +int evaluateExpression(HGLOBAL h); /** * Compare two mathematical expressions together @@ -61,7 +61,7 @@ int EvaluateExpression(HGLOBAL h); * @param h1 Expression to be compared * @param h2 Expression to be compared */ -bool CompareExpressions(HGLOBAL h1, HGLOBAL h2); +bool compareExpressions(HGLOBAL h1, HGLOBAL h2); } // end of namespace MPAL -- cgit v1.2.3 From d4777379d23b70aa07feec3ef2e90fcf376f4117 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Jun 2012 23:00:48 +1000 Subject: TONY: Refactored the memory manager to increase performance --- engines/tony/mpal/expr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 7d33e5c8ca..9844add822 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -29,6 +29,8 @@ #ifndef MPAL_EXPR_H #define MPAL_EXPR_H +#include "tony/mpal/memory.h" + namespace Tony { namespace MPAL { -- cgit v1.2.3 From 83f1cad02be38e56161350aabc29176f24c901a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Jun 2012 01:20:08 +1000 Subject: TONY: Added code to free parsed MPC file data when the game ends --- engines/tony/mpal/expr.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 9844add822..3130539000 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -65,6 +65,13 @@ int evaluateExpression(HGLOBAL h); */ bool compareExpressions(HGLOBAL h1, HGLOBAL h2); +/** + * Frees an expression that was previously parsed + * + * @param h Handle for the expression + */ +void freeExpression(HGLOBAL h); + } // end of namespace MPAL } // end of namespace Tony -- cgit v1.2.3 From d2b33ca4cce2794e7b4fcf3ccb3f00dc74fff68d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 28 Aug 2012 23:25:50 +0200 Subject: TONY: Janitorial - remove trailing spaces --- engines/tony/mpal/expr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index 3130539000..f9c8a7c48f 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -43,7 +43,7 @@ namespace MPAL { * Parses a mathematical expression from the MPC file * * @param buf Buffer containing the expression to evaluate - * @param h Pointer to a handle that, at the end of execution, + * @param h Pointer to a handle that, at the end of execution, * will point to the area of memory containing the parsed expression * @returns Pointer to the buffer immediately after the expression, or NULL if error. */ -- cgit v1.2.3 From f2df769aab10e719cc4fba6cb71e1500eb3acae4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Sep 2012 00:25:35 +0200 Subject: TONY: More renaming --- engines/tony/mpal/expr.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/tony/mpal/expr.h') diff --git a/engines/tony/mpal/expr.h b/engines/tony/mpal/expr.h index f9c8a7c48f..9036099993 100644 --- a/engines/tony/mpal/expr.h +++ b/engines/tony/mpal/expr.h @@ -47,7 +47,7 @@ namespace MPAL { * will point to the area of memory containing the parsed expression * @returns Pointer to the buffer immediately after the expression, or NULL if error. */ -const byte *parseExpression(const byte *lpBuf, HGLOBAL *h); +const byte *parseExpression(const byte *lpBuf, MpalHandle *h); /** * Calculate the value of a mathamatical expression @@ -55,7 +55,7 @@ const byte *parseExpression(const byte *lpBuf, HGLOBAL *h); * @param h Handle to the expression * @returns Numeric value */ -int evaluateExpression(HGLOBAL h); +int evaluateExpression(MpalHandle h); /** * Compare two mathematical expressions together @@ -63,14 +63,14 @@ int evaluateExpression(HGLOBAL h); * @param h1 Expression to be compared * @param h2 Expression to be compared */ -bool compareExpressions(HGLOBAL h1, HGLOBAL h2); +bool compareExpressions(MpalHandle h1, MpalHandle h2); /** * Frees an expression that was previously parsed * * @param h Handle for the expression */ -void freeExpression(HGLOBAL h); +void freeExpression(MpalHandle h); } // end of namespace MPAL -- cgit v1.2.3