OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 2:58 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Syntax Highlighting
PostPosted: Sun Feb 01, 2009 2:42 pm 
Offline
Member
Member

Joined: Wed Oct 18, 2006 3:29 pm
Posts: 202
I think a wiki with so much code samples should support syntax highlighting. It would make code a lot easier to read.

JJ


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Mon Mar 30, 2009 6:47 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 3:03 am
Posts: 1029
Location: Hobart, Australia
I agree with you completely, I see no reason not to have it. A quick Google search turns up this, which might be worth a go.

_________________
My Personal Blog | My Software Company - Loop Foundry | My Github Page


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Mon Mar 30, 2009 7:11 pm 
Offline
Member
Member
User avatar

Joined: Fri Jun 22, 2007 12:47 pm
Posts: 1598
Location: New Hampshire, USA
I personally find the [ code ] blocks very hard to read as they are all uniform in color and a very dull color at that. very tough on the eyes.

_________________
Website: https://Joscor.com


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Mon Mar 30, 2009 8:40 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 3:03 am
Posts: 1029
Location: Hobart, Australia
01000101: Do you mean the Code blocks on the forum, or the Wiki?

_________________
My Personal Blog | My Software Company - Loop Foundry | My Github Page


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Mon Mar 30, 2009 9:24 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
I think he means the wiki, the forum ones are fine to me.

_________________
Image
Image
Solar wrote:
It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.

I wish I could add more tex


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Mon Mar 30, 2009 10:39 pm 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2566
Location: Sydney, Australia (I come from a land down under!)
I'm pretty sure he meant the Forum ones - why else would he specifically write [code] into his post? The wiki doesn't have BBCode syntax, unless there's a custom extension I don't know about.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Tue Mar 31, 2009 12:41 am 
Offline
Member
Member
User avatar

Joined: Thu Aug 11, 2005 11:00 pm
Posts: 1110
Location: Tartu, Estonia
Syntax highlighting would be great - both in the wiki and the forum. Sometimes it's a pure mess to dig through those huge single color code blocks here in the forum...

There might be other opinions, since anything dealing with colors depends on skin settings, which differ among users. So, a syntax highlighting suitable for one user might be painful for another. So if we want syntax highlighting for the forum, it should be different for every skin (and maybe there should be an option to switch it off...). And, besides that, we need a different one for different languages - ASM or Pascal need a different highlighting than C++. Maybe this could do the job for the forum.

In the wiki there is no such trouble with skins, so I think syntax highlighting would definitely be a good idea.

_________________
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Tue Mar 31, 2009 9:29 am 
Offline
Member
Member
User avatar

Joined: Fri Jun 22, 2007 12:47 pm
Posts: 1598
Location: New Hampshire, USA
I meant the forums, but on second thought, it 100% applies to the wiki as well. I'm using a dark theme in the forums and the code blocks here are a shade of grey, so its very unsightly.

I think some C/ASM syntax highlighting for both would go a long way, then if it works out, get more of the other languages to utilize syntax-highlighting.

_________________
Website: https://Joscor.com


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Tue Mar 31, 2009 1:44 pm 
Offline
Member
Member
User avatar

Joined: Thu Jan 04, 2007 3:29 pm
Posts: 1466
Location: Noricum and Pannonia
XenOS wrote:
There might be other opinions, since anything dealing with colors depends on skin settings, which differ among users. So, a syntax highlighting suitable for one user might be painful for another.

If we all just used the damn ponies theme, this wouldn't be a problem!

I second the desire to experiment with highlighting. Test Forum?

_________________
C8H10N4O2 | #446691 | Trust the nodes.


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sat May 09, 2009 5:34 pm 
Offline
Site Admin
User avatar

Joined: Wed Oct 20, 2004 10:46 pm
Posts: 684
Location: Texas
Added to the wiki. See the CPUID article for an example.
Using this mediawiki extension: http://www.mediawiki.org/wiki/Extension ... ight_GeSHi
The extension actually uses GeSHi 1.0.8.3 from here: http://qbnz.com/highlighter/
I noticed that at least the cpuid instruction was missing from the syntax file for asm so I added that. I'm sure there are other instructions that are missing, if anyone wants to download Geshi 1.0.8.3 and create an updated asm.php file I'll install it.

The extension can be used like:
Code:
<source lang="asm">
mov eax, 0x0
cpuid
</source>

Or to add line numbers
Code:
<source lang="asm" line>
mov eax, 0x0
cpuid
</source>

Or to add line numbers that start at a specified number
Code:
<source lang="asm" line start="20">
mov eax, 0x0
cpuid
</source>



Valid languages are
Code:
abap
actionscript3
actionscript
ada
apache
applescript
apt_sources
asm
asp
autoit
bash
basic4gl
blitzbasic
bnf
boo
caddcl
cadlisp
cfdg
cfm
cil
c_mac
cobol
c
cpp
cpp-qt
csharp
css
delphi
diff
div
dos
dot
d
eiffel
fortran
freebasic
genero
gettext
glsl
gml
gnuplot
groovy
haskell
html4strict
idl
ini
inno
io
java5
java
javascript
kixtart
klonec
klonecpp
latex
lisp
lotusformulas
lotusscript
lua
m68k
matlab
mirc
mpasm
mxml
mysql
nsis
objc
ocaml-brief
ocaml
oobas
oracle8
pascal
perl
per
php-brief
php
plsql
powershell
python
qbasic
rails
reg
robots
ruby
sas
scala
scheme
sdlbasic
smalltalk
smarty
sql
tcl
text
thinbasic
tsql
vbnet
vb
verilog
vhdl
visualfoxpro
winbatch
xml
xorg_conf
xpp
z80


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sat May 09, 2009 7:55 pm 
Offline
Member
Member

Joined: Sat Sep 08, 2007 11:26 pm
Posts: 143
Location: Canada
I have finished from A to E. Its mostly fine, however I (or someone else needs to fix the spacing in a few of the examples.


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sun May 10, 2009 3:59 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
Quote:
I noticed that at least the cpuid instruction was missing from the syntax file for asm so I added that. I'm sure there are other instructions that are missing
It seems that all of the MMX and SSE instructions are absent, the long mode registers.

Going by the directives array, the thing ends with 486 support. (cmpxchg8b is missing as well). I guess it needs a bit more than a little work :(

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sun May 10, 2009 8:22 am 
Offline
Site Admin
User avatar

Joined: Wed Oct 20, 2004 10:46 pm
Posts: 684
Location: Texas
How many people do you think are trying to syntax highlight asm code in a wiki? :)

The asm.php file that I mention in my previous message is a pretty straight forward array of keywords. See: http://geshi.svn.sourceforge.net/viewvc ... iew=markup Mostly just needs the additional keywords mentioned in http://scintilla.cvs.sourceforge.net/vi ... iew=markup which served as the original source for asm.php but has been updated to be mostly current.


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sun May 10, 2009 4:09 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
oh well, for the relevant part of asm.php: (not tested)
Code:
'KEYWORDS' => array(
        /*CPU*/
        1 => array(
            'aaa','aad','aam','aas','adc','add','and','call','cbw', 'cflush', 'clc','cld','cli','cmc','cmp',
            'cmps','cmpsb','cmpsw','cmpxchg8b','cpuid','cwd','daa','das','dec','div','esc','hlt','idiv','imul','in','inc',
            'int','int1','int3','into','iret','ja','jae','jb','jbe','jc','jcxz','je','jg','jge','jl','jle','jmp',
            'jna','jnae','jnb','jnbe','jnc','jne','jng','jnge','jnl','jnle','jno','jnp','jns','jnz',
            'jo','jp','jpe','jpo','js','jz','lahf','lds','lea','les','lods','lodsb','lodsw','loop',
            'loope','loopew','loopne','loopnew','loopnz','loopnzw','loopw','loopz','loopzw','mov',
            'movs','movsb','movsw','mul','neg','nop','not','or','out','pop','popf','push','pushf',
            'rcl','rcr','ret','retf','retn','rol','ror','sahf','sal','sar','sbb','scas','scasb','scasw',
            'shl','shr','stc','std','sti','stos','stosb','stosw','sub','test','wait','xchg','xlat',
            'xlatb','xor','bound','enter','ins','insb','insw','leave','outs','outsb','outsw','popa','pusha','pushw',
            'arpl','lar','lsl','sgdt','sidt','sldt','smsw','str','verr','verw','clts','lgdt','lidt','lldt','lmsw','ltr',
            'bsf','bsr','bt','btc','btr','bts','cdq','cmpsd','cwde','insd','iretd','iretdf','iretf','iretw',
            'jecxz','lfs','lgs','lodsd','loopd','looped','loopned','loopnzd','loopzd','lss','movsd',
            'movsx','movzx','outsd','popad','popfd','pushad','pushd','pushfd','scasd','seta','setae',
            'setb','setbe','setc','sete','setg','setge','setl','setle','setna','setnae','setnb','setnbe',
            'setnc','setne','setng','setnge','setnl','setnle','setno','setnp','setns','setnz','seto','setp',
            'setpe','setpo','sets','setz','shld','shrd','stosd','bswap','cmpxchg','invd','invlpg','wbinvd','xadd','lock',
            'rep','repe','repne','repnz','repz','rdmsr','wrmsr','rdpmc','rdshr','rdtsc','rsdc','rsldt','rsm',
            'rsts','salc','smi','smintold','smint','svdc','svldt','svts','pause','syscall','sysenter','sysexit','sysret',
            'ud2','umov','xbts','wrshr'
            ),
        /*FPU*/
        2 => array(
            'f2xm1','fabs','fadd','faddp','fbld','fbstp','fchs','fclex','fcom','fcomp','fcompp','fdecstp',
            'fdisi','fdiv','fdivp','fdivr','fdivrp','feni','ffree','fiadd','ficom','ficomp','fidiv',
            'fidivr','fild','fimul','fincstp','finit','fist','fistp','fisub','fisubr','fld','fld1',
            'fldcw','fldenv','fldenvw','fldl2e','fldl2t','fldlg2','fldln2','fldpi','fldz','fmul',
            'fmulp','fnclex','fndisi','fneni','fninit','fnop','fnsave','fnsavew','fnstcw','fnstenv',
            'fnstenvw','fnstsw','fpatan','fprem','fptan','frndint','frstor','frstorw','fsave',
            'fsavew','fscale','fsqrt','fst','fstcw','fstenv','fstenvw','fstp','fstsw','fsub','fsubp',
            'fsubr','fsubrp','ftst','fwait','fxam','fxch','fxtract','fyl2x','fyl2xp1',
            'fsetpm','fcos','fldenvd','fnsaved','fnstenvd','fprem1','frstord','fsaved','fsin','fsincos',
            'fstenvd','fucom','fucomp','fucompp',
            'emms','femms','fxsave','fxrstor'
            ),
        /*registers*/
        3 => array(
            'ah','al','ax','bh','bl','bp','bx','ch','cl','cr0','cr2','cr3','cs','cx','dh','di','dl',
            'dr0','dr1','dr2','dr3','dr6','dr7','ds','dx','eax','ebp','ebx','ecx','edi','edx',
            'es','esi','esp','fs','gs','si','sp','ss','st','tr3','tr4','tr5','tr6','tr7',
            'rax','rbx','rcx','rdx','rsi','rdi','rbp','rsp','cr8','spl','bpl','sil','dil',
            'r8b','r9b','r10b','r11b','r12b','r13b','r14b','r15b',
            'r8w','r9w','r10w','r11w','r12w','r13w','r14w','r15w',
            'r8d','r9d','r10d','r11d','r12d','r13d','r14d','r15d',
            'r8','r9','r10','r11','r12','r13','r14','r15'
            ),
        /*Directive*/
        4 => array(
            '186','286','286c','286p','287','386','386c','386p','387','486','486p','586','686'
            '8086','8087','alpha','break','code','const','continue','cref','data','data?',
            'dosseg','else','elseif','endif','endw','err','err1','err2','errb',
            'errdef','errdif','errdifi','erre','erridn','erridni','errnb','errndef',
            'errnz','exit','fardata','fardata?','if','lall','lfcond','list','listall',
            'listif','listmacro','listmacroall',' model','no87','nocref','nolist',
            'nolistif','nolistmacro','radix','repeat','sall','seq','sfcond','stack',
            'startup','tfcond','type','until','untilcxz','while','xall','xcref',
            'xlist','alias','align','assume','catstr','comm','comment','db','dd','df','dq',
            'dt','dup','dw','echo','elseif1','elseif2','elseifb','elseifdef','elseifdif',
            'elseifdifi','elseife','elseifidn','elseifidni','elseifnb','elseifndef','end',
            'endm','endp','ends','eq',' equ','even','exitm','extern','externdef','extrn','for',
            'forc','ge','goto','group','high','highword','if1','if2','ifb','ifdef','ifdif',
            'ifdifi','ife',' ifidn','ifidni','ifnb','ifndef','include','includelib','instr','invoke',
            'irp','irpc','label','le','length','lengthof','local','low','lowword','lroffset',
            'macro','mask','mod','msfloat','name','ne','offset','opattr','option','org','%out',
            'page','popcontext','private','proc','proto','ptr','public','purge','pushcontext','record',
            'rept','seg','segment','short','size','sizeof','sizestr','struc','struct',
            'substr','subtitle','subttl','textequ','this','title','typedef','union','width',
            '.model', '.stack', '.code', '.data'
            ),
        /*Operands*/
        5 => array(
            '@b','@f','addr','basic','byte','c','carry?','dword',
            'far','far16','fortran','fword','near','near16','overflow?','parity?','pascal','qword',
            'real4',' real8','real10','sbyte','sdword','sign?','stdcall','sword','syscall','tbyte',
            'vararg','word','zero?','flat','near32','far32',
            'abs','all','assumes','at','casemap','common','compact',
            'cpu','dotname','emulator','epilogue','error','export','expr16','expr32','farstack',
            'forceframe','huge','language','large','listing','ljmp','loadds','m510','medium','memory',
            'nearstack','nodotname','noemulator','nokeyword','noljmp','nom510','none','nonunique',
            'nooldmacros','nooldstructs','noreadonly','noscoped','nosignextend','nothing',
            'notpublic','oldmacros','oldstructs','os_dos','para','prologue',
            'readonly','req','scoped','setif2','smallstack','tiny','use16','use32','uses'
            )
        ),

which should add 64 bit support, as well as all non-vector instructions up to the opteron series. (vmx/svm and later extentions are still missing)

at least, its an start :)

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Syntax Highlighting
PostPosted: Sun May 10, 2009 4:18 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
It appears it's meant for MASM or TASM, not really a NASM syntax.. maybe we should fix that?

_________________
Image
Image
Solar wrote:
It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.

I wish I could add more tex


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 99 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group