BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / deskcalc / DeskCalc.cpp
blobaf78d8ebe340dd12d2afe2bc6b2ab2e647ea7770
1 /*
2 * Copyright 2006 Haiku, Inc. All Rights Reserved.
3 * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved.
4 * Distributed under the terms of the MIT License.
6 * Authors:
7 * Timothy Wayper <timmy@wunderbear.com>
8 * Stephan Aßmus <superstippi@gmx.de>
9 */
12 #include <stdio.h>
14 #include "CalcApplication.h"
15 #include "ExpressionParser.h"
18 int
19 main(int argc, char* argv[])
21 if (argc == 1) {
22 // run GUI
23 CalcApplication* app = new CalcApplication();
25 app->Run();
26 delete app;
27 } else {
28 // evaluate expression from command line
29 BString expression;
30 int32 i = 1;
31 while (i < argc) {
32 expression << argv[i];
33 i++;
36 try {
37 ExpressionParser parser;
38 BString result = parser.Evaluate(expression.String());
39 printf("%s\n", result.String());
40 } catch (ParseException e) {
41 printf("%s at %" B_PRId32 "\n", e.message.String(), e.position + 1);
42 return 1;
46 return 0;