Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Porting to c++, freebasic constructors?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Arcade
View previous topic :: View next topic  
Author Message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Feb 15, 2009 11:19 am    Post subject: Reply with quote

Another late reply. I had a reply typed out the other day, and then my browser crashed.

Just let me point out again that if you want to start over and rewrite the OHR from scratch in C++, you're likely to have some trouble recruiting people because it'll be pretty depressing. However considering your modules and the OHR's existing code, I think that the OHR would benefit from having the equivalent of several of your proposed modules rewritten from scratch. It *might* be possible to replace them with pure OO C++. In fact, just about everything except Player, Editor, and Audio. Our music backends have problems, but improving on them doesn't seem likely. If you/we do write just some of these modules, to slot into the existing OHR (or even OHR++), you can always do the rest later as well if you feel up to it.

However, the only thing I care to focus on is the graphics backend/HID/GUI.

Hieran_Del8 wrote:
TMC:
Excellent ideas! I read through the comments on CP and the mailing list and began compiling a new diagram to represent the connections. Here it is:


The separation of Surface and Graphics Renderer makes no sense (to me anymore) because you've stated that Surfaces wrap hardware/backend specific representations of graphics. (I was earlier thinking, I suppose about Surfaces which always have the same internals.) Therefore Surfaces and the Graphics Renderer are two symboitically linked halves of the same thing, and it seems crazy to separate them into different modules, at least by the meaning of modules I understand.

Likewise, I think Audio and Audio Renderer should be the same module.

Quote:
The Network module now is an extension of the File IO. Therefore, if the file is on a server, or parts of data are from the server, then they are streamed. Otherwise, the Network module is transparent.

From your suggestion about editing the file while playing the game, the editor is now an extension of the player. Therefore, if a file is editable, a player can modify the game, save changes, and return to the game. (Password protection still applies for whether a file is editable.)


Actually, I think it would be smoother to make the player an extension of the editor. The editor handles only the RPG data, the player knows about RPG data and a game state.

Of course, I'm not agreeing that making one an extension of the other is the best way to do things Happy Actually, I think this would be the most interesting and challenging part the design of any part of a new engine.

Quote:
I'm having difficulty connecting the renderers and the HID to the rest of the modules via the GUI system. I know a GUI system should be mediating somehow, but I'm not sure if this is the correct implementation. Mental block. Some of that may be due in part to an incomplete understanding of a GUI system. Please comment on this.


The requirements for the behaviour of GUI are different between a game and in an editor or other normal application. It depends totally on what kind of GUI you're talking about. Using a big GUI framework is most probably going to need to run in its own thread.

In my experimental wxwidgets GUI backend, I basically had the GUI hiding in the Window module. In there, it can multiplex user input, grab output and put it in an individual window, and run multiple games each in a different thread. Well actually, I just don't think anything it making sense to me at the moment. What's the point of thinking about modules: you can only design them by thinking about the implementation details anyway.

Quote:
The idea's been tossed around that multiple languages could be used, and that "glue code" would hold it together. Understanding how that is to be used will become important once the design reaches phase 3. How are multiple languages currently "glued" together? (I've only used c++ calling a full module, not the module's functions.)


What's phase 3? And how do you call a full module?

Well, here are several ways to do so, although you've found a few more:
* Source files written in different compiled languages are compiled to object files and then linked together. This is the normal way to use multiple languages. For example, FB programs are linked to the FB runtime library, which is written in C. You need to ensure the same calling conventions and name mangling.
* If one language is a superset of another (as C++ nearly is of C) then you can compile everything with the same compiler Happy
* You could also embed link to an interpreter for a scripting language like Python and jump into it when you need to.

Hieran_Del8 wrote:
Been researching foreign function interfaces (FFI) for gluing code. Are you guys using SWIG, or do you use an interface definition language (IDL)? Or are you linking by other means? Or are you bribing the little gnomes that press the buttons and switch the levers in the computer case with various grades of cheese?


I can't said I've heard of those terms before, aside from SWIG. We're dLinking, simply linking.
Notice that at the moment, the only foriegn code we link to is audwrap, a wrapper Mike wrote in C++ to provide a C-style interface to audiere (which is C++ OO and therefore not callable from FB).

Here's an example for how I plan to be calling C++ from FB and vice versa in future:

Code:
//In C++
extern "C" __stdcall FBSTRING *Do_Stuff(int a, int b, int c, FBstring &d, FBarray<double> &e);
''In FB
a = do_stuff(1,2,3,"-d\", appleweights())


(But it's likely that I'll change the use of pointers and references in recieving/returning FB strings and arrays. Why the heck have I recieved a FBstring& and returned a FBSTRING*??)

FB has limited support for dealing with C++ classes at the moment. It can call constructors, destructors and copy constructors, but method calls are not available in the -lang deprecated dialect (used by the OHR), and inheritance and virtual methods are totally unsupported. So a FB2C++ translator would make dramatic improvements.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Fri Feb 20, 2009 3:40 pm    Post subject: Reply with quote

Indeed! Those are some major flaws. Thankyou for pointing them out TMC!

The suggestion that the Surfaces and Video renderer are two halves of the same module are reasonable. The design should be adjusted so that both components are contained within a singular module, ie. Graphics. It would load the surface types from the file IO and manage their allocations and rendering.

The same could be applied to Sounds and Audio renderer, ie. Sounds.

Finally, the GUI. I've been researching GUI systems quite a bit now. I understand the concepts a little better, and IM's presentation was quite a good approach in OHR++. The Graphics module should probably be contained within the GUI. It would be nice if the GUI's layout was customizable (as in James's editedit suggestion). Also the HID would be contained in the GUI. As regards the Window module, that may need to be wrapped inside the Graphics module. Callbacks could ensure that basic window functions (including window menus) are still executed in the GUI. I still feel the Game editor and player should be separate from the GUI as they represent strict data management and high level commands.

With regards the editor being wrapped inside the player, it is a valid argument. This is how Torque3D wraps their editor--inside the player. Interestingly, in Torque's design, game state could still be present in the editor.

Essentially, the design now appears as:


In studying Torque, as well as many other Networkable engines, a simple game is broken into a Server and Clients. Even if the game is single player, both Server and Client operate on the same system. This design allows for easy extension from single player to multiplayer to mmo. This technology can extend to both playing of the games and editing the games. Imagine a team of developers (with different layers of authority) being able to edit a game simultaneously. At the same time, other users could play the game, receiving streamed updates to seamlessly integrate the changes.

In studying Javascript, and Javascript in ASP, it is of benefit to consider both client side and server side scripting, that is plotscripting. Perhaps certain plotscripts would run on the server, such as global events, time, weather, new random quests, etc. Then client side plotscripting would run local events, such as battles, vehicles, npc interaction, story, etc.

Those elements would be neat to integrate. What do you think?

With regards approaching "phase 3", I'll clarify. I used a design model which broke the design into 3 separate phases: brain storming, modular concepts, and implementation. I mistakenly reported this development in the first phase whereas the current development was in the second. I suppose the ideas are mostly established in the current OHR. I believe I did not give ample consideration to the brain storm phase, however. This, compounded by a unclear understanding of certain programming principles (ie. GUI, FFI, etc.), has led to backwards development and confusion at my fault.

To correctly put it, we should probably still be just about into phase 2: modular concepts. And then the implementation. However, there's still room for brain storming!

Quite a bit of brainstorming has already occurred in the OHR development plans. I'll continue reading through the development plans. What other thoughts do you have with regards the design (brainstorming or modular concept)?
Back to top
View user's profile Send private message Visit poster's website
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Tue Mar 10, 2009 2:13 pm    Post subject: Reply with quote

Well, just finished Lesley Anne Robertson's Simple Program Design: A Step-by-Step Approach, and found a better method for program design.

To summarize the book in 6 statements:
    1. Define the problem (what to do, not how to do)
    2. Group activities into subtasks or functions (top level subtasks)
    3. Construct a hierarchy chart (modules, and relation to each other)
    4. Establish logic of the main line (initialize, main loop, close)
    5. Develop psuedocode for each successive module in hierarchy (top level working downwards)
    6. Desk check the solution algorithm for each module/function


This design mechanism came highly recommended. And the book was very persuasive in its usage for large projects.

OHR wiki has many entries that define the problems and group activities into high level functions. Is there a database of all the features of the current OHRRPGCE and OHR Game?
Back to top
View user's profile Send private message Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Tue Mar 10, 2009 3:24 pm    Post subject: Reply with quote

Hieran_Del8 wrote:
OHR wiki has many entries that define the problems and group activities into high level functions. Is there a database of all the features of the current OHRRPGCE and OHR Game?


No, there isn't but that does seem like a good list to try and build.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Battleblaze
Warrior Thread Monk




Joined: 19 Dec 2003
Posts: 782
Location: IndY OHR

PostPosted: Wed Mar 18, 2009 6:28 pm    Post subject: Reply with quote

You all realize that if the easy to usenes sof OHR had MMO creation capability the world would break and the HamsterRepublic would resume its once great and terrible rule over the earths (free) game creation engines.

Also OHR Land...Online.

Shudders of awesomeness. There could be a real in game HamsterRepublic. I could get real estate in Lord Hasims old Kingdom. We could have live oHR house...(goes off imagining)
_________________
Indy OHR! and National OHR Month Contest going on now!

"Aeth calls PHC an anti-semite; PHC blames anti-semitism"
-squall
Back to top
View user's profile Send private message Visit poster's website AIM Address
Newbie_Power




Joined: 04 Sep 2006
Posts: 1762

PostPosted: Wed Mar 18, 2009 6:30 pm    Post subject: Reply with quote

You all realize that if the easy to usenes sof OHR had MMO creation capability the world would break and the HamsterRepublic would resume its once great and terrible rule over the earths (free) game creation engines.

If the OHR could make MMOs, we would likely create the greatest MMO ever since we could just get rid of glaring flaws MMOs tend to have.
_________________

TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Back to top
View user's profile Send private message
Battleblaze
Warrior Thread Monk




Joined: 19 Dec 2003
Posts: 782
Location: IndY OHR

PostPosted: Wed Mar 18, 2009 6:44 pm    Post subject: Reply with quote

And then there would eventually be soemthing equivalent to AFENHOUSE ONLINE FURREVAR
_________________
Indy OHR! and National OHR Month Contest going on now!

"Aeth calls PHC an anti-semite; PHC blames anti-semitism"
-squall
Back to top
View user's profile Send private message Visit poster's website AIM Address
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Mon Mar 23, 2009 12:25 pm    Post subject: Reply with quote

Regarding mmo, that would be cool.

For dynamic linking, I am a bit confused as to freebasic's usage. For instance:

Code:
//exampleHeader.h
extern "C"
{
     void __stdcall DoSomething(void);
}

Code:
//exampleSource.cpp
#include "exampleHeader.h"
void __stdcall DoSomething()
{
     ...
}

The source is then compiled into exampleSource.dll, with exampleSource.lib library indexing.
Code:
//exampleMainSource.cpp
#include "exampleHeader.h"
#pragma comment(lib, "exampleSource.lib")
int main()
{
     DoSomething();
     return 0;
}

Can you demonstrate how freebasic would use this simple dll? And also QBasic 4.5 (if it can)?
Back to top
View user's profile Send private message Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon Mar 23, 2009 12:38 pm    Post subject: Reply with quote

I have never done runtime linking to a dll in FreeBasic, but I think the command you want is DYLIBLOAD

You can't do it in QuickBasic 4.5 That is a 16 bit compiler.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Tue Apr 14, 2009 6:31 am    Post subject: Reply with quote

Well, as it turns out, rewriting is a little too ambitious right now. So I've turned my attentions to a freebasic to c++ converter.

TMC, I know you've done work on that. I'm currently working data management, including data representation, scope, threading, etc. Soon, I'll be ready to begin functions and commands. What sort of work have you done?

Some of the code is available at http://www.crazyleafgames.com/miscWork.htm under the programming division, under the heading "General Interpreter". I still need to give the DataObjectBase class a reference count (like COM) to remove itself when references drop.

If you've already done work, I'd much rather collaborate than build it by myself.
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Apr 16, 2009 2:36 am    Post subject: Reply with quote

~delay delay delay~ (I'm sorry)

Quote:
With regards the editor being wrapped inside the player, it is a valid argument. This is how Torque3D wraps their editor--inside the player. Interestingly, in Torque's design, game state could still be present in the editor.


Interesting. But I wouldn't take it too far: editor and player should still be separate and able to function normally without the other, but can share quite a lot of internals. But it doesn't make sense to put the script interpreter inside the editor.

Quote:
In studying Torque, as well as many other Networkable engines, a simple game is broken into a Server and Clients. Even if the game is single player, both Server and Client operate on the same system. This design allows for easy extension from single player to multiplayer to mmo. This technology can extend to both playing of the games and editing the games. Imagine a team of developers (with different layers of authority) being able to edit a game simultaneously. At the same time, other users could play the game, receiving streamed updates to seamlessly integrate the changes.


Multiple people being able to edit a game would be a big bonus, but it seems that you're talking about multiple people modifying an MMO online, which is a completely different thing. I think extending the OHR to MMO is extremely out there (though I started working on such an OHR game/engine mod once... contests make you contemplate terrible things)

I assume allowing simultaneous playing and editting requires a great deal of work on logic for updating game data and state. So you wouldn't want more than you need.

Quote:
In studying Javascript, and Javascript in ASP, it is of benefit to consider both client side and server side scripting, that is plotscripting. Perhaps certain plotscripts would run on the server, such as global events, time, weather, new random quests, etc. Then client side plotscripting would run local events, such as battles, vehicles, npc interaction, story, etc.

Those elements would be neat to integrate. What do you think?


I'm not sure what you are thinking of here: multiplayer, MMO, or single player OHR games? If it's regular single player games, then I agree that there might be merit in the idea. One of the hardest things to figure out is how can you make it possible to save and quit a game, modify the game and then reload your save. In future, I hope to see saved games storing a lot more state, such as the state of all running scripts. Client/server mentality might help when figuring out how to load a save with out scripts: 'local' scripts might not get updated, while 'server' scripts might be those immediately replaceable with new versions.

Quote:
Quite a bit of brainstorming has already occurred in the OHR development plans. I'll continue reading through the development plans. What other thoughts do you have with regards the design (brainstorming or modular concept)?


I don't think this design method is working. And you've lost me on that last question.


Quote:
OHR wiki has many entries that define the problems and group activities into high level functions. Is there a database of all the features of the current OHRRPGCE and OHR Game?


Many of the features are undocumented, which is a problem for reimplementing everything from scratch. The best way to reimplement is to read the existing source and rewrite it.


Hieran_Del8 wrote:
Can you demonstrate how freebasic would use this simple dll? And also QBasic 4.5 (if it can)?


You would link statically like this I think, untested (stdcall is the default for FB):

Code:
#inclib "exampleSource"
declare sub DoSomething()

DoSomething

SWIG can be used to translate headers from C to FB.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Apr 16, 2009 9:34 am    Post subject: Reply with quote

Hieran_Del8 wrote:
Well, as it turns out, rewriting is a little too ambitious right now. So I've turned my attentions to a freebasic to c++ converter.


A FB interpreter? That sounds like a great deal of work actually, and I don't think you would be gaining too much.

Quote:
TMC, I know you've done work on that. I'm currently working data management, including data representation, scope, threading, etc. Soon, I'll be ready to begin functions and commands. What sort of work have you done?

Some of the code is available at http://www.crazyleafgames.com/miscWork.htm under the programming division, under the heading "General Interpreter". I still need to give the DataObjectBase class a reference count (like COM) to remove itself when references drop.

If you've already done work, I'd much rather collaborate than build it by myself.


Pretty interesting, and looks like you've already done a lot of work on it. DataScope and DataThread caught my attention. Do you plan to emulate threads as well? Also, what's a struct template? However, it looks like it uses memory extremely inefficiently so far.


Have you ever used a parser generator like lex/yacc? You can surely help: there are a large number of grammar/translation rules to write. I'm using peg/leg: http://piumarta.com/software/peg/, see the man page to find out what it's about.

I haven't gotten too far: testing and customising leg, set up keyword recognition using gperf, and copied a few grammar rules from the forum thread I linked to and cleaned them up a little (turns out they were totally incorrect) in order to use them for testing. I hope that it is only the lexing rules from that thread that were rubbish.

Now I'm starting on translation; may or may not have some actual translating to show tomorrow, depending on whether I work on the OHR instead.
Note that the header for C++ class wrappers around FB strings/arrays is missing, and everything is still very messy, plus you should ignore most of the grammar.
SVN repos at http://fleet.castleparadox.com/svn/other/fb2cpp/

It would probably be more interesting to have a look at my wxwidgets GUI wrapper around the OHR instead. It doesn't actually link to the OHR yet, but to a tiny C++ program that draws a gradient using a mock allmodex-like library. I was developing it under Windows (wxMSW), Mac OS X (wxMac) and GNU/Linux (wxGTK) simultaneously. The next things I need to add are keyboard input and the graphics palette. After that I was going to create all the stubs needed and try linking it to the OHR; however I suddenly realised that I was mistaken and it wouldn't work without a FB to C++ translator, so I immediately switched to that instead.
I'll post something about it's design/structure here sometime soon.
Warning, this isn't entirely clean code either.
http://fleet.castleparadox.com/svn/other/wxohr/


As a spot of trivia, someone on the FB forums set themselves the challenge of writing a FB to C++ compiler in one day. They succeeded: the compiler can compile its own 57kB of source. Very impressive, but not useful, as that's the only source it is written to compile; it's very hacky. But it shows that FB to C++ translation is an easy route.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Fri Apr 17, 2009 11:05 am    Post subject: Reply with quote

Well, it's not an FB interpreter, per se. Eventually, it's supposed to convert code into a generic language of data types and commands. Those can either be interpreted or converted into a target language.

I do plan to emulate threads, and yes, it is terribly inefficient if it runs as an interpreter. A struct template is a struct definition. It is not a structure instance, just the definition.

I have never used a parser generator before. Site visited, interesting, I'll study peg/leg more.

I was intimidated by the translation mechanisms and files at the repository. Probably study those after I have a better understanding about what is happening.

Regarding the GUI wrapper, that's pretty neat. It was rather difficult to read through the files, and some of the classes I couldn't locate. Could you rewrite/reorganize them to be broken into modules, then linking them together? Currently, such as in the w.cpp, source code files are linked together, as in:
Code:
//threading code, also handles all thread-local data
#include "context.cpp"
//the C++ wxwidgets graphics backend
#include "gfx_wx.cpp"
//a temporary stub for allmodex.bas, which doesn't replicate it closely at all, for testing
#include "mockmodex.cpp"
//our testing code, emulating a FB allmodex program
#include "clientapp.cpp"
//the window into which the modex page is drawn
#include "videopagewindow.cpp"
//a generic client window
#include "generic_clientwin.cpp"

It is difficult to follow. Why not compile the sources separately and link them together at the linker stage? Also, you could prototype the functions and define the classes, but provide specific implementation in different source compiles. What I mean is:

Header 1:
Code:
//example header
//hello.h
#ifndef HELLO_H
#define HELLO_H

#include <iostream>

class Hello
{
protected:
int nGreetings;
public:
Hello(int numGreetings);
};

#endif


Code:
//hello.cpp
#include "hello.h"
using namespace std;

Hello::Hello(int n) : nGreetings(n)
{
cout << "Hello x" << nGreetings << " ";
}


Header 2:
Code:
//another header
//world.h
#ifndef WORLD_H
#define WORLD_H

#include <iostream>

class World
{
protected:
int nPlanets;
public:
World(int numPlanets);
};

#endif


Code:
//world.cpp
#include "world.h"
using namespace std;

World::World(int n) : nPlanets(n)
{
cout << "World x" << nPlanets << "!\n";
}


Header 3:
Code:
//a third, and final header
//helloWorld.h
#ifndef HELLOWORLD_H
#define HELLOWORLD_H

#include "hello.h"
#include "world.h"

class HelloWorld : public Hello, World
{
public:
HelloWorld();
};

void PrintHelloWorld();

#endif


Code:
//helloWorld.cpp
#include "helloWorld.h"
using namespace std;

HelloWorld::HelloWorld() : Hello(3), World(5)
{
cout << "It is a good day!" << endl;
}

void PrintHelloWorld()
{
HelloWorld obj;
}


And finally, a main source file:
Code:
//_main.cpp
#include "HelloWorld.h"

int main()
{
PrintHelloWorld();
return 0;
}


This code is highly readable. Could you rewrite yours to be a little more readable, or commented? If anything, avoid including ".cpp" files into another .cpp file. Just link to their compilation at the linker stage.
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Apr 21, 2009 8:51 am    Post subject: Reply with quote

Hahah. Don't worry, I'm not some sort of cave programmer who doesn't know about header files. I just did that because the windows computer I was using is pretty slow, the wxwidgets headers are enormous, and I couldn't get gcc to successfully precompile them. Early on, heavy experimentation means I would probably have to recompile several modules every time.

Anyway, the code is stabilising (I've been picking at it in some form since last year) so I think I'll add headers next time I work on it. Also, like I said, I'll diagram the structure/operation of the program and post it here when I get around to it.

Quote:
Well, it's not an FB interpreter, per se. Eventually, it's supposed to convert code into a generic language of data types and commands. Those can either be interpreted or converted into a target language.

I do plan to emulate threads, and yes, it is terribly inefficient if it runs as an interpreter. A struct template is a struct definition. It is not a structure instance, just the definition.


Ah. A kind of generic code representation/translation tool?
But if you run it as a translator, will it really need to know anything about threads?


I've been working on fb2cpp plenty lately. I'm now using a customised version of peg/leg, get it from http://fleet.castleparadox.com/svn/other/peg/. When I remember, I'll document the differences. Mostly the addition of YYSINIT and YYSDESTRUCT

So far it can read and translate whitespace (comments) and integer, floating point and string literals, handling nearly all quirks. Here's the example input:

Code:
command: command ' a comment
print "quotation""" /' comment
                       end comment '/
comment k,k, .3E+3!, !"\\ \t" "\d\"
p 43#, 0!, 0, 0003, &hffff, &O666, 4444.5e-99, _
   3.d3, ""
'''''/'''/'''
Integer


And here's the output:

Code:
command; command // a comment
print "quotation\"" /* comment
                       end comment */
comment k,k, .3E+3f, "\\ \t" "\\d\\"
p 43.0, 0.0f, 0, 3, 0xffff, 0666, 4444.5e-99, \
   3.e3, ""
//''''/'''/'''
Integer


I've rewritten and cleaned up the rules considerably, though I admit that some of them, having to handle lots of lexer quirks, are still pretty hard to understand. I expect most rules won't be as bad. I haven't found an indentation scheme I'm totally happy with yet either.

So you might want to have another look. fb.leg (and maybe fb2cpp.h) is the only file you should bother looking at.

I think I'm going to have to halt work for the rest of the week due to a pile of tests and assignments.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Hieran_Del8




Joined: 23 Jan 2009
Posts: 18

PostPosted: Wed Apr 22, 2009 7:45 am    Post subject: Reply with quote

Quote:
Hahah. Don't worry, I'm not some sort of cave programmer who doesn't know about header files. I just did that because the windows computer I was using is pretty slow, the wxwidgets headers are enormous, and I couldn't get gcc to successfully precompile them. Early on, heavy experimentation means I would probably have to recompile several modules every time.

Ah, I understand. I know what you mean about slow compiles on slow computers, especially at the experimental stages.
Quote:
But if you run it as a translator, will it really need to know anything about threads?

Good question. I'm not sure how time for the threads will be allocated, or thread priority, or even critical sections. I do plan on making the interpreter multithreaded, however, so any code that has threading in it would benefit. I've updated the files a bit, at least ironed out more of the DataManagement header.
Quote:
So far it can read and translate whitespace (comments) and integer, floating point and string literals, handling nearly all quirks.

That's very good so far. I looked into fb.leg and the coding makes sense. There's a few concepts still over my head, such as %{ and }%, the debugging commands, using variable arguments, using the colon as in a:compound EOF (looks like style sheets almost), and using malloc, _realloc, and free (I use new and delete).

I also checked out fb2cpp.h. Ingenious code!:
Code:
#define strlenX(ptr)  (ptr ? strlen(ptr) : 0)

What an excellent way to deal with null pointers!

I was perusing the commands in the cstdlib, and found _beep(), equivalent was SOUND in qbasic. I was thrilled to find it--one of my favorite commands in qbasic!

I've written a string class, much like <string>, except it manages a wchar_t* and char*, in the event that you need to convert between Unicode and Multibyte. It handles all allocations, destructions, and conversions. Overloaded operators for assignment, concatenation, concatenate assign, and string comparisons to either wchar_t*, char*, or SmartChar&. You may find it of interest. You can get it from http://www.crazyleafgames.com/miscWork.htm under the division Programming, under the heading SmartChar and SmartArray. (SmartArray is an expandable array that grows as you access outside its bounds. Unlike <vector>, the memory locations of the data don't change, and bools are not compressed to a bit field.)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Arcade All times are GMT - 8 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group