flat assembler
Message board for the users of flat assembler.
Index
> Main > asm syntax highlightning |
Author |
|
bubach 19 Nov 2004, 18:15
hello, i am wondering if i could get the php code for your asm syntax highlighting?
it would be very nice.. |
|||
19 Nov 2004, 18:15 |
|
Matrix 19 Nov 2004, 21:18
well have you tried clicking on the PHPBB @ the bottom?
it is free maeby you could find it in it? you're making some highlighting for your site? |
|||
19 Nov 2004, 21:18 |
|
Tommy 20 Nov 2004, 08:14
No, the assembly syntax highlighter is not a part of PHPBB; I wrote it... I've lost the source code for it, so please ask Privalov!
Regards |
|||
20 Nov 2004, 08:14 |
|
Tomasz Grysztar 20 Nov 2004, 09:59
Tommy, would it be OK with you to publish this code as a public domain?
|
|||
20 Nov 2004, 09:59 |
|
crc 20 Nov 2004, 13:09
Why only GPL?
|
|||
20 Nov 2004, 13:09 |
|
JohnFound 20 Nov 2004, 13:27
crc wrote: Why only GPL? Well, because it is part (modification) of the product (phpBB) distributed under GPL. Under the terms of GPL, every modification of GPLed product must be distributed under GPL. IMHO, you can make modifications for your personal needs without distributing them. Of course, the mentioned module for syntax highlighting can be released as a separate product, under any other license, if it doesn't contain any code from GPLed product. But IMHO, for such module intended to improve bug GPLed product like phpBB, it is simply meaningless to be released as separate product. In similar cases, GPL looks like very reasonable distribution license. Of course, only Tommy, as an author have the right to decide what he wants. Regards. |
|||
20 Nov 2004, 13:27 |
|
Tomasz Grysztar 20 Nov 2004, 14:25
Since this code in its current state is our common work, we have to agree both on how to release it.
|
|||
20 Nov 2004, 14:25 |
|
JohnFound 20 Nov 2004, 14:33
Privalov wrote: Since this code in its current state is our common work, we have to agree both on how to release it. Yes, you are right, of course. Regards |
|||
20 Nov 2004, 14:33 |
|
Tommy 21 Nov 2004, 08:14
Yes, it's allright with me!
|
|||
21 Nov 2004, 08:14 |
|
Tomasz Grysztar 21 Nov 2004, 09:54
OK, this is the routine used by this message board:
Code: /** * Syntax highlighting for fasm code by Tommy Lillehagen * Fixed and improved by Tomasz Grysztar */ function showasm($src) { $code = explode("\n",$src); $result = ""; $chars = ".,()[]{}=|\\#&!:+-*/<>~`\t "; $q = ""; $inq = false; $colors = array("#000000","#808080","#880000","#0000FF","#008800"); foreach($code as $line) { $lastcolor = 3; $nextcolor = 0; $part = ""; $inq = false; $column = 0; for ($i=0;$i<strlen($line);$i++) { if ($nextcolor == 1) { $lastcolor = 3; $nextcolor = 0; } if (substr($line,$i,1) == ";" & $lastcolor != 2) { $lastcolor = 1; } elseif ((strstr("0123456789",substr($line,$i,1)) | (substr($line,$i,1) == "$")) & $lastcolor == 3) { $lastcolor = 4; if (substr($line,$i,1) == "$" & stristr("0123456789ABCDEF",substr($line,$i+1,1)) === false) { $lastcolor = 0; } } elseif ((substr($line,$i,1) == "'" | substr($line,$i,1) == "\"") & ($lastcolor == 3 | $lastcolor == 2)) { if ($inq === false) { $q = substr($line,$i,1); } if (substr($line,$i,1) == $q) { if ($lastcolor == 2) { $lastcolor = 2; $nextcolor = 1; $inq = false; } else { $lastcolor = 2; $inq = true; } } } elseif ((strpos($chars,substr($line,$i,1)) != false) & ($lastcolor != 1) & ($inq === false)) { $lastcolor = 3; $nextcolor = 1; } elseif ($lastcolor == 3) { $lastcolor = 0; } $part .= $lastcolor; } $isStarted = false; for ($i=0;$i<strlen($line);$i++) { if ($isStarted === false) { $result .= "{A\n}span{S\n}style={Q\n}color:{S\n}".$colors[substr($part,$i,1)]."{Q\n}{B\n}"; $isStarted = true; } $c=substr($line,$i,1); if ($c != "\t") $result .= $c; else { $spacecount = 8 - $column % 8; $result .= str_repeat(" ",$spacecount); $column += $spacecount-1; } if (substr($part,$i+1,1) != substr($part,$i,1)) { $result .= "{A\n}/span{B\n}"; $isStarted = false; } $column++; } if ($isStarted) $result .= "{A\n}/span{B\n}"; $result .= "{A\n}br{B\n}"; } $result = htmlspecialchars($result) ; $result = str_replace(" ", " ", $result); $result = preg_replace("/{A\n}/i", "<", $result); $result = preg_replace("/{B\n}/i", ">", $result); $result = preg_replace("/{Q\n}/i", "\"", $result); $result = preg_replace("/{S\n}/i", " ", $result); return($result); } |
|||
21 Nov 2004, 09:54 |
|
bubach 21 Nov 2004, 18:17
Thanks!
|
|||
21 Nov 2004, 18:17 |
|
Tommy 21 Nov 2004, 19:01
No problem..
|
|||
21 Nov 2004, 19:01 |
|
JohnFound 21 Nov 2004, 20:40
Privalov wrote: OK, this is the routine used by this message board: Well, it looks I was wrong, about the license. This procedure is not dependent on the phpBB in any way, so if you doesn't distribute modified version of phpBB with this procedure used, but only the source of the procedure itself, you can choose whatever license you like. Regards. |
|||
21 Nov 2004, 20:40 |
|
zbenjudah 28 Nov 2004, 20:07
about this piece of code I take it that it does syntax high lighting but why have you done it in C rather than assembly just curiouse is all
|
|||
28 Nov 2004, 20:07 |
|
crc 28 Nov 2004, 20:13
I think that it's in PHP, not C
The reason would be that the message board software is written in PHP, not assembly. |
|||
28 Nov 2004, 20:13 |
|
decard 28 Nov 2004, 20:15
It is not C - it is a PHP highlighter (for websites). If you want similar code in asm, you can try my asm2html program - it adds HTML-based syntax highlighting to your sources. |
|||
28 Nov 2004, 20:15 |
|
zbenjudah 29 Nov 2004, 02:04
I have not done much php! just quikly paroused the sourse it does have C style comments so I was mistaken............
that would explain why it does not compile in a c compiler what compiler does one use to compile this particular piece of code decard u say u have an htm converter are there any C2asm coverters around |
|||
29 Nov 2004, 02:04 |
|
rea 29 Nov 2004, 02:37
much compilers can output asm files, check if exist the option in the one you are using.
I think that decard is talking about a program that read a parse a input file, and format is like html style... |
|||
29 Nov 2004, 02:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.