flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > fasm macro for html. |
Author |
|
edfed 28 Apr 2011, 11:29
LOL .
i was playing with fasmw to write html code when i had an idea: use fasm syntax, and macro system to write html code. simple idea, really, simple... the original editor higlighting is very good for html reading the main challenge is to be able to do recursive macro. just don't be too much hurry to find the solution and it will be cool. first, the <> chars are really cool in my opinion. the absence of easy coding of html is a brake to the creativity. the bloat is really huge in html. then, solution is to do a macro to create html code... it will let you use any solution. i think about a macro with large associed library, using directives in macro for the large bloat or the easy coding. Code: format binary as 'html' org 0 crlf equ 10,13 macro header title,color { db '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',crlf db '<HTML>',crlf db '<HEAD>',crlf db ' <TITLE>',title,'</TITLE>',crlf db ' </HEAD>',crlf db ' <BODY bgcolor="',color,'">',crlf } macro headerend { db '</BODY></HTML>',0 } macro § text { db '<br>' db text } and how it would be used Code: include 'html.inc' header ' - test - ','112233' § 'hello world' § 'how are you today?' § 'fine and you how are you?' headerend compile it, and browse it. it gives that and why not... using fasm optimized for cgi scripting, is it fast enough? i jut wonder how to do the implementation of a db text redefinition macro, with the crlf and formating of the editor, in order to don't have to enter chars like: <br> <nbsp> and all specail chars too. i wonder if fasm macro can use text from the source and convert bytes from a string in a string of strings, generating the special chars and items directlly from text. an idea can be to use bbcode to implement tags and advanced macro (quote, table, list, code, etc...) i think fasm can be only made with the macro system. if you delete all the mnemonic parts relative to X86 opcodes, etc, and using only the macro and directive system (db, align, include) to implement opcodes (mov, ret, etc...), it is possible to make an interresting fork of fasm. Last edited by edfed on 26 Sep 2011, 22:00; edited 1 time in total |
|||
28 Apr 2011, 11:29 |
|
Tomasz Grysztar 28 Apr 2011, 11:44
Back in 2001 there was an article about CGI programming with fasm published in the issue 9 of Assembly Programming Journal (look for the title "Common Gateway Interface using PE console apps"). So the idea is not new.
|
|||
28 Apr 2011, 11:44 |
|
Tomasz Grysztar 28 Apr 2011, 21:13
I now think that CGI, being really a nice and simple idea in general, is not really so great when you consider performance. For each request the application has to be loaded and executed - this gives some considerable overhead. Ideally the web server would just call some code already residing in memory, like a function imported from some external library. This would of course mean that the web application would have to be "deployed" into server - which would be nothing else than LoadLibrary or something like that - just like in modern application servers the Java classes implementing servlet interfaces are loaded in memory upon startup.
So... what about writing some simple HTTP server with a high-performance binary interface for web applications written in assembly? |
|||
28 Apr 2011, 21:13 |
|
typedef 28 Apr 2011, 23:53
Tomasz Grysztar wrote: So... what about writing some simple HTTP server with a high-performance binary interface for web applications written in assembly? If that is an idea, I second it. That would be one hell of a milestone though . |
|||
28 Apr 2011, 23:53 |
|
JohnFound 29 Apr 2011, 06:12
Tomasz Grysztar wrote: Ideally the web server would just call some code already residing in memory, like a function imported from some external library. Of course these functions should be dynamically loaded and unloaded. And also, there should be some die-hard exception handling in order to not give the imported function to crash the server. Another important issue is the security - the imported functions should not be able to access the same files as the whole server, but only the files of the web site it belongs. This can be implemented as different thread security attributes. But I am not very sure how exactly it should appear in Windows and Unixes. |
|||
29 Apr 2011, 06:12 |
|
edfed 30 Apr 2011, 21:25
typedef wrote:
it is not a bad idea, will increase a lot the servicing. using first a project in fasm that supports some basic server function, and add one by one every single function we will need to generate html from a very short describing code like i posted in first. something like that. as dexos still have the server part, it can be interresting to focus on it for the start. but as we don't really need the real internet connection management to test the idea, we can certainly try it as a little program that takes parameters from a file or ram, and convert it in a file or in ram... a specialized server like a phpbb board don't need a lot of funcitons i think, and it needs every functions in permanence, then, it is some job for us as we can make fit very big librairies in less than 64k. to be continued then. |
|||
30 Apr 2011, 21:25 |
|
edfed 01 May 2011, 11:24
added some little macros just to test, it works.
Code: format binary as 'html' org 0 crlf equ 10,13 macro header title,color { db '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',crlf db '<HTML>',crlf db '<HEAD>',crlf db ' <TITLE>',title,'</TITLE>',crlf db ' </HEAD>',crlf db ' <BODY bgcolor="',color,'">',crlf } macro headerend { db '</BODY></HTML>',0 } macro § text { db '<br>' db text } macro img i { db '<IMG SRC="',i,'" ALT="',i,'">' } macro link l,t { db '<a href="',l,'">' t db '</a>' } macro anchor l,t { db '<a name="',l,'">' t db '</a>' } link.t takes any line of code, even a macro, and that is fine. now, the problem is how to put a long string of macro inside link.t, because if i want to create a <a href> with an image, a text, and maybe something else like formating, it will be longer than just one line of code... and will use more than just one macro... Code: include 'mhtml.inc' header ' - test - ','112233' § 'hello world' § 'how are you today?' § 'fine and you how are you?' § '' § '' § '' § '' link 'http://fool.asm4u.net', img 'fool-icon-80.png' § '' headerend it works, i like it! |
|||
01 May 2011, 11:24 |
|
JohnFound 01 May 2011, 12:16
I don't know how about France, but the "paragraph" character is missing from my keyboard.
|
|||
01 May 2011, 12:16 |
|
revolution 01 May 2011, 12:45
JohnFound wrote: I don't know how about France, but the "paragraph" character is missing from my keyboard. http://en.wikipedia.org/wiki/File:Bulgarian_BDS_layout.svg OMG is Wikipedia wrong! |
|||
01 May 2011, 12:45 |
|
JohnFound 01 May 2011, 14:49
[offtopic]
No, it is not wrong, but BDS (Bulgarian state standard) keyboard is only for Cyrillic and is not so popular here. Particularly, for Cyrillic, I use phonetic layout, that is based on standard QWERTY keyboard. BDS is actually better for Bulgarian language and even for english, because it loads both wrists equally and the most words are typed using both hands consequently. Unfortunately I never managed to learn to use it. [/offtopic] |
|||
01 May 2011, 14:49 |
|
Dex4u 01 May 2011, 18:42
This would be great. I have aways want to do this with simple games, as any body got any ideas of a way to implement this ?.
|
|||
01 May 2011, 18:42 |
|
edfed 02 May 2011, 11:25
if § is not on the common layout of all keyboard, it might be good to find another char for this...
for me, this is the shifted key of !, on the left of the right shift key, that's why i feel it very good for this purpose, because it is very fast to type § but finally, what i'd like is to just input text with db (or file, or include), and replace all crlf occurences (or 10,13) by <br> tag... and more, it should be able to take multiple ' ' (20h) and replace them by the <nbsp> special char. then, db should be redefined by a macro... it would be not so complex to do, forward directive is the main part of the solution, with some if =20h and if =crlf. html is really bloated, but will never be replaced by something better, as all the public internet is build on... |
|||
02 May 2011, 11:25 |
|
Madis731 03 May 2011, 07:47
...and what is HTML 3.2??? Because of this kind of code in 2011 we won't ever hit HTML5. Why would anyone use anything less than 4.01 or XHTML 1 in 2011? Because of IE6?
http://www.ie6countdown.com/ http://whencaniuse.com/ sad |
|||
03 May 2011, 07:47 |
|
edfed 03 May 2011, 09:54
for the html3.2, the explanation is simple, i just took the header from a random html page.
but effectivelly, the finality is to comply with the last html revision. for that, i think an axtra parameter for the macro 'header' will be needed, with a default value predefined, and if header.v equ, ver = default. but it is just a little, a very little detail in this html macro project. at term, it will be exatlly as the macro for pic i made, just use fasm to compile your html pages, and then, bring fasmw the ability to be a suiss knife instead of a hammer, without modifiing its internal code modifing the fasm code is something too much advanced for me, and have nothing to do with html or pic compilation, as it is the internal of the fasm engine. one day, i will learn polish and russian. |
|||
03 May 2011, 09:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.