April 29, 2024, 10:52:40 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Aurora Common Classes

Started by Zen, January 06, 2006, 11:26:04 AM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

lviklund

Lewis,

Lists,queues ... already. :D

I just would like to say thank's a million.
Very useful for me.

/Lasse

Zen

No Problem. Its Parker you need to thank for those though. He had made then a bit before i even started the common classes. He has kindly contributed them and is also adding the dictionary class later.

How was the installer? Nice and easy?

Lewis

lviklund

The installer worked without problems.

Parker. Thank's a million to you to ;D

/Lasse

Zen

Good Good. Your the first to try the installer (apart from myself) so was not sure if it worked ok. Sorry there are no examples all the classes yet. Maybe people who use the classes can make some examples or me and parker can once we get some free time. As for documentation, it will come at the end or when i get stuck, whatever comes first i guess.

Lewis

Steven Picard

Quote from: Lewis on January 13, 2006, 02:47:57 PM
Ok got it working now. After a little bit of googling and the example code above to head me in the right direction i managed to get Inno Setup working to install the common classes in the Aurora directory.

final pascal script was...

Function installDirectory(default: string): string;

var Path: String;

begin

Path := '';
RegQueryStringValue(HKCU,'Software\IonicWind\Aurora\PATHS','BIN',Path);
Result := Path;

end;


Here is the latest version of the common classes too.

Lewis

I forgot about the last parameter being a variable that is populated with the results.  If I actually tried the code i would found out pretty quick.  Whoops!  :-\

Zen

No problem. My firend google and i solved it ;) Would of taken me a lot longer without your contribution though.

Thanks again
Lewis

Steven Picard

January 13, 2006, 03:50:07 PM #56 Last Edit: January 13, 2006, 03:53:59 PM by stevenp
Was it supposed to delete my Windows directory?  J/K.    ;D

Zen

 ::) Windows, hmmm ;)

It should install (currently) 2 examples into the examples folder, some class definitions into the include\classes folder and some libs into your libs folder.

As for the lack of documentation, if you need any help let me know and ill be on it quicker than you can say Aurora Borealis*

Lewis

*9am - 5pm Monday - Sat GMT ;)

Steven Picard

Before I say everything worked, what files are supposed to go where so I can make sure?

Zen

bin
---
No Files

examples
------------
ConsoleServer.src
ConsoleClient.src

include\classes
--------------------
lists.inc
queue.inc
raw.inc
stack.inc

libs
----
mysql.lib (not finished yet but there anyway)
w2_32.lib
CCL.lib

Thats it for now, i will add a readme file for the next installation and all thereafter to show updates and progress ;)

Lewis

Parker

The stack and queue classes don't have peek functions yet, I'll be adding them sometime in the near future. Along with the dictionary, btree (it'll be another dictionary type, just using a binary search instead of a hash), threads, services, registry, command line, and the GetAuroraDir function.

I've decided to implement the command line functions inside a class because
- ArgC must be called first to load the command line and tokenize it, the constructor will do this.
- The list must be destroyed when your program ends in order to avoid memory loss on older systems, which will be done by the destructor.

But the functions _ArgC(), _ArgV(), and _ArgFree() will exist, the class will just wrap them.

Zen

Thats why i suggested putting the one off functions into a tools class or something.

Lewis

Parker

Those I said I'd think about, it's the GetAuroraDir I don't want in there. But I'll have those done in a few minutes hopefully, they're already written I've just gotta test them.

Zen

well you can still put them in the same .lib anyhow, if you decide to put them in a class or not. We can just make another include to declare the functions.

Lewis

Parker

I can even do it myself. Go to the command prompt and type "ar" assuming you've got a gcc installation. I can just generate the obj file and add it to the current library ;)

Zen

yes you can. But you will have to do it every time i update the lib, he he.

Lewis

LarryMc

install worked fine for me!

Thanks guys!!!! ;D
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Zen

No problem. Hope you can make some use out of it.

Lewis

Parker

I also thought I'd note that the linked list class is just a wrapper for the functions, here are the declarations just in case you prefer doing it that way:
struct listnode {
pointer pData;
listnode *pNext;
listnode *pPrev;
}

declare extern ListCreate(),pointer;
declare extern ListAdd(listnode *list, pointer item),pointer;
declare extern ListAddHead(listnode *list, pointer item),pointer;
declare extern ListGetFirst(listnode *list),pointer;
declare extern ListGetLast(listnode *list),pointer;
declare extern ListGetNext(listnode *list),pointer;
declare extern ListGetPrev(listnode *list),pointer;
declare extern ListGetData(listnode *list),pointer;
declare extern ListRemove(listnode *list, opt int bDelete = 0),pointer;
declare extern ListRemoveAll(listnode *list, opt int bDelete = 0);

Zen

Hmm not anymore it isnt. I re-wrote the code into classes.

Lewis

Parker

January 13, 2006, 08:08:26 PM #70 Last Edit: January 13, 2006, 08:10:26 PM by Parker
I'd recommend keeping those functions though, since the stack and queue class use them, and the somewhat complicated dictionary class uses the functions and not a LinkedList class. And the Stack and Queue are going to have some changes in the future, you don't want to keep rewriting them.

And possibly the last linked list function (and class method), ListInsert will be added. But not for a while, since I've got other things to write first.

Zen

OK well it only took a few minutes to change it. I will change it back.

Lewis

Parker

January 14, 2006, 11:31:25 AM #72 Last Edit: January 14, 2006, 11:44:38 AM by Parker
The commandline class is completed, but I don't have the installer's code. So I just injected CommandLine.o into the library and made an include file.

You should make sure to copy over your current includes, since Stack, Queue, and List won't work unless you include the raw file, that has been fixed.

Let me know if there are any bugs. I don't have the raw internet source, but the others I do have.

The commandline class isn't a wrapper now, so you can't call _ArgC or anything. This is my example:
global sub main()
{
CommandLine cl;
for (i = 0; i < cl.Count(); i++)
{
writeln(cl.Index(i)+"\n");
}
while (GetKey() = "");
return;
}


The Index() method returns "" if the index specified doesn't exist, so it's safe to call Index(234234). You must not use this class as a global, since the constructor and destructor will never be called, so the commandline won't be parsed and the Index() method will crash the program, probably.

The CommandLine class also handles empty arguments ( "" ) and discards them. That only happens if there are two quotes like that. So a command like this
program -option "" x:on
would have only 3 arguments, "program", "-option", and "-x:on". It is up to you to parse any options containing : like MS tools do, or the - and / switches, which can easily be found by using arg_string[0].

Zen

All bugs and include problems will be fixed after this weekend. There will be an installer for that one too.

I have been a bit busy latley so not yet had time to send all my stuff over to parker ;)

Lewis

Parker

Arg!  :(

The file I uploaded is bad (wrong includes), it'll be fixed in a minute.