flat assembler
Message board for the users of flat assembler.
Index
> Windows > FASM OPERTORS |
Author |
|
revolution 11 Feb 2011, 01:18
What do you want to do? What does "Operator" do in the above code? For those of us (like me) with no understanding of C++ the above has no meaning.
|
|||
11 Feb 2011, 01:18 |
|
typedef 11 Feb 2011, 05:15
Operators are in other terms, "mathematical functions".
They let you assign, increment, decrement, various types of objects. for a quick glance : http://www.cplusplus.com/doc/tutorial/operators/ |
|||
11 Feb 2011, 05:15 |
|
JohnFound 11 Feb 2011, 05:51
OOP is not a goal in itself. It is a tool, created to help you to achieve your goals.
That is why revolution asked you "What do you want to do?" The answer is "Yes OOP can be implemented in assembly language". But because assembly is not HLL this OOP can not be the same as in C++. You can create macro with name "class" but it will not be "class" in HLL meaning. For example you can't implement "encapsulation" in assembly because in assembly you always have control over the data. |
|||
11 Feb 2011, 05:51 |
|
typedef 14 Feb 2011, 17:40
Thanks JohnFound, you opened my eyes there lol.
I knew in LLL you have control over your data but never tought about it. Thanks very much. I see now that it doesn't make any sense really to be implementing that. However I'm still curious. Is it possible to make a "class" ( via macro) so that you don't need to be calling all the methods again and again. For example in C++ Code: class Window { private: // <---- I know this doesn't matter in LLL HWND hHandle; WNDPROC myProc; public: Window ( char* name, char* lpClass,LONG style){ hHandle = CreateWindowEx(....); ShowWindow(hHandle,SW_HIDE); } int Exec() { MSG msg = {0} while( GetMessage(NULL,&msg,0,0) > 0 ) { ... ... } return msg.wParam; } void SetProc(WNDPROC wndProc) { myProc = wndProc; } void Init() { WNDCLASSEX wc; wc... wc.lpfnWndProc = myProc; RegisterClassEx(&wc); } void SetVisible(bool bVisible) { ShowWindow(hHandle, (bVisible==true) ? SW_SHOW : SW_HIDE ); } }; LRESULT CALLBACK proc(.....) { .... } in main function ... Window *wnd = new Window("","",WS_VISIBLE|WS_OVERLAPPEDWINDOW); wnd->setProc( proc ); wnd->Init(); return wnd->Exec(); How would you do that in LLL so you wouldn't have to go through all those methods over and over again ? I want to create an ASM include file for those classes so I don't have to re-write them (methods ) again. (You know, "code re-use", OOP way ) Thanks Last edited by typedef on 14 Feb 2011, 20:56; edited 3 times in total |
|||
14 Feb 2011, 17:40 |
|
edfed 14 Feb 2011, 17:46
code re-use is not oop only;
C langage is an example of code reuse. because instead of rewrite printf everytime, you just reference it. asm too is oop if you define it as code re-use capacity. because you don't have to rewire every circuits each time you call an instruction, and don't have to re-write a funtion, just include it. |
|||
14 Feb 2011, 17:46 |
|
typedef 14 Feb 2011, 17:54
Yep, but what I need to know is how to make the macro "class".
Last edited by typedef on 14 Feb 2011, 20:24; edited 1 time in total |
|||
14 Feb 2011, 17:54 |
|
edfed 14 Feb 2011, 19:58
before trying to implement class, try to implement this:
Code: Foo { Foo(int x); Foo Operator+=(Foo& ptr) { Foo temp; temp.x = this.x + ptr.x; return temp; } }; class seems to just be a keyword. apparentlly, class means nothing at all in asm, and only reference the label for your "class" is enough to call it, or read it, or write it, or whatever you want on it. what does class mean exactlly? how is it represented in mémory? in a file? in a flowchart? maybe: Code:
macro class {}
is enough, but then, the way to call the class is... please stop, here it is assembly programming forum, post in HLL or macro subforum |
|||
14 Feb 2011, 19:58 |
|
JohnFound 15 Feb 2011, 08:07
typedef wrote: How would you do that in LLL so you wouldn't have to go through all those methods over and over again ? Actually in this very moment I am working on something that can be named "classes" and "objects". It is not OOP. It is simply a natural representation of GUI elements. You can see the work in progress in FreshLib library; Files from GUI directory. |
|||
15 Feb 2011, 08:07 |
|
typedef 16 Feb 2011, 19:22
Say, did you start this along time ago ?
What a coincident. |
|||
16 Feb 2011, 19:22 |
|
typedef 16 Feb 2011, 19:27
You included SQLite too ? You are the man dude.
I really was in need of that sometime ago. Thanks dude |
|||
16 Feb 2011, 19:27 |
|
typedef 16 Feb 2011, 19:29
sorry double post. But this thing just meets my needs. Code completetion also. Man, 10 out of 10 though you said tis not done yet.
|
|||
16 Feb 2011, 19:29 |
|
JohnFound 16 Feb 2011, 19:57
I am glad you are happy.
But Fresh is really not finished yet. The old library is not portable, the new one is not ready. Of course code completion and other editor features works and will work in the future versions. The visual part - forms, components etc. will be changed a lot with the new library. Maybe there will be tool to convert from the old format to the new, but I am not sure. |
|||
16 Feb 2011, 19:57 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.