473,657 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Implementing an I/O wrapper and Parser (console project)

Hello everyone,

I'm wanting to start implementation of a pet project game IO mechanism.

The game is console based. A cross between MUD and Rogue types. For I/O
operations I'll be using ncurses (PDCurses to be accurate). Mainly
taking advantage of colors in the console and wanting to minimize any
work in porting it to Linux and Mac.

What I'm thinking doing is designing two singletons CPrompt, CParse.

CPrompt - responsible for I/O operations. It wraps ncurses
functionality, accepts input from the user, sends to CParse. Receives
input from various objects and formats to screen.

CParse - Parses commands, returns error or sends to correct objects for
processing.

Various objects (the game engine) - Receive processing requests from
CParse and send results back to CPrompt for output.

However, I'm not sure of this design on a few points:

1. CPrompt is supposed to wrap ncurses functionality, but by having
the various object communicate directly to it, I'll be forced to provide
ncurses functionality on the objects themselves. Or probably complicate
my code by sending to CPrompt also the output format requirements. What
do you suggest?

2. CParse seems to be doing too much; parsing the input and deciding
on which objects to call. Is it better to provide some form of messaging
system between CParse and the objects? And how would this be
implemented. Links to reading material (books or web) would be enough if
you don't want to spend much time discussing this point.

3. By making CPrompt and Cparse singletons I'm thinking on the need
of having these two object in memory at all times. There is of course
only one prompt. But CParse is less obvious as a good candidate for a
singleton class. It's the fact that it will be staying in memory at all
times that moves me into making it a singleton. However, should it be
ever-present? Is it more logical to have it be destroyed after each
parsing?
I would appreciate your help on this. Understanding the programming
language is becoming less of a challenge as time moves on, but applying
this knowledge is the real challenge.

Best regards.
Nov 10 '06 #1
0 1492

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5708
by: Daniel Howard | last post by:
bxmlnode is described as an "XML file reader" (even though it is technically a parser) to try to avoid confusion with more sophisticated, standards-compliant XML parsers. bxmlnode consists of about 500 lines of C source code, none longer than 80 columns. bxmlnode can be easily pasted into existing C++ or C source files without linking against a separate library. bxmlnode relies only on the C Runtime Library, specifically stdio.h,...
0
518
by: soundchaser | last post by:
I'm looking for a simple but complete example of creating a VB.Net ActiveX / COM component from a C Library. One should be able to use it by calling the Server.CreateObject method from an ASP script. I have already figured out how to do most of it, but I'm stumped on the part where I call it from an ASP script. Assume I have a VS.Net solution with three projects: 1. CLibrary - generates a DLL from the following C source code:
6
1894
by: Phlip | last post by:
C++ newsgroupies: I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8". It's bad luck to name an interface after its implementation. This file could have been "expressionSolver.h". But naturally, if I set out to implement recursive descent parsing, that tainted my filename selection. Below my sig is recursiveDescentParser.h, a math expression solver. Using the test framework, and test suite appearing in parallel...
25
12751
by: Ali-R | last post by:
Hi, Is there a parser which parses CSV files? Thanks for your help. Reza
12
12397
by: Janiek Buysrogge | last post by:
Hello, Does anyone know if there is a library or a sample project that can parse strings with mathematical expressions inside ? eg. string math = "(23 + 48) ^ 2 - (7.76 * 3.14)"; parser should calculate the result of this. Atm I have my own parser, but it can only handle very simple expressions with 2 operands eg. (34 * 89), I tried to expand the
2
7251
by: =?Utf-8?B?cGh5cw==?= | last post by:
I need to write a C# application that uses unmanaged C++ code. I created a C++/CLI wrapper to C++ code and encountered the following problem. Any time I try to instantiate a wrapper in C# application the program crashes with an error "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll, Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)". C#...
1
2659
by: Tony Freixas | last post by:
Hello, I'm trying to create a wrapper for a program. I want to execute program 'X' by running program 'Y', such that 'Y' appears to function pretty much like 'X' both in the way command line options are handled and the way input, output and error messages are reported. Program 'X' is a console application. I had it pretty well figured out, I thought, until I ran into a case where program X spit out ZIP code. In other words, I was...
3
3822
by: ups_genius | last post by:
Hi everyone! I created an error parser using the existing CDT stuff by basically copying some of the GNU / make / ... error parsers' code. I also added the extension point for the new error parser, and by debugging I see, that when activated, the new error parser is actually used to parse the regular build output. The reason for writing this error parser though was to parse the output produced by a batch file, run as "external tool"....
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.