From 326cdd953e780fff61cfa81ab6c9a7b6e14efff1 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 13 Mar 2014 20:32:48 -0500 Subject: [PATCH] Adding support for objective-C and assembler --- .../media/idf/css/syntaxhighlight/shCore.css | 38 +++++++ .../idf/js/syntaxhighlight/shBrushAsm.js | 45 ++++++++ .../idf/js/syntaxhighlight/shBrushObjC.js | 103 ++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 indefero/www/media/idf/js/syntaxhighlight/shBrushAsm.js create mode 100644 indefero/www/media/idf/js/syntaxhighlight/shBrushObjC.js diff --git a/indefero/www/media/idf/css/syntaxhighlight/shCore.css b/indefero/www/media/idf/css/syntaxhighlight/shCore.css index 34f6864..2bbf94b 100644 --- a/indefero/www/media/idf/css/syntaxhighlight/shCore.css +++ b/indefero/www/media/idf/css/syntaxhighlight/shCore.css @@ -224,3 +224,41 @@ .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { color: black !important; } + +/* From - http://www.chlankboot.com/blog/asm-brush */ + +/* Registers */ +.syntaxhighlighter .registers +{ color: #ff8000; font-weight: normal !important; } + +/* User Instructions */ +.syntaxhighlighter .usr_inst +{ color: #ff0080; font-weight: normal !important; } + +/* System Instructions */ +.syntaxhighlighter .sys_inst +{ color: #0000ff; font-weight: normal !important; } + +/* FPU Instructions */ +.syntaxhighlighter .fpu_inst +{ color: #ff8040; font-weight: normal !important; } + +/* Multimedia Instructions */ +.syntaxhighlighter .mul_inst +{ color: #cbd601; font-weight: normal !important; } + +/* Masm Specific */ +.syntaxhighlighter .masm_spc +{ color: #0080c0; font-weight: normal !important; } + +/* Numbers */ +.syntaxhighlighter .numbers +{ color: #8000ff; font-weight: normal !important; } + +/* IDA labels */ +.syntaxhighlighter .labels +{ color: blue; font-weight: normal !important; } + +/* Strings */ +.syntaxhighlighter .asmstring +{ color: #b0002d; font-weight: normal !important; } \ No newline at end of file diff --git a/indefero/www/media/idf/js/syntaxhighlight/shBrushAsm.js b/indefero/www/media/idf/js/syntaxhighlight/shBrushAsm.js new file mode 100644 index 0000000..5bca15f --- /dev/null +++ b/indefero/www/media/idf/js/syntaxhighlight/shBrushAsm.js @@ -0,0 +1,45 @@ +/** + * asm-brush + * http://www.chlankboot.com/blog/asm-brush + * + * @version + * 1.0.1 (December 15, 2010) + * + * @copyright + * Copyleft 2010 chlankboot + * + * @license + * Free + * + */ + +SyntaxHighlighter.brushes.Asm=function(){ + var registers = "ah al ax bh bl bp bx ch cl cr0 cr2 cr3 cr4 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 st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7"; + var usr_inst = "aaa aad aam aas adc add and bsf bsr bswap bt btc btr bts call cbw cdq clc cld cmc cmova cmovae cmovb cmovbe cmovc cmove cmovg cmovge cmovl cmovle cmovna cmovnae cmovnb cmovnbe cmovnc cmovne cmovng cmovnge cmovnl cmovnle cmovno cmovnp cmovns cmovnz cmovo cmovp cmovpe cmovpo cmovs cmovz cmp cmps cmpsb cmpsd cmpsw cmpxchg cmpxchg8b cpuid cwd cwde daa das dec div enter idiv imul inc ja jae jb jbe jc jcxz je jecxz 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 lea leave lods lodsb lodsd lodsw loop loopd loope looped loopew loopne loopned loopnew loopnz loopnzd loopnzw loopw loopz loopzd loopzw mov movs movsb movsd movsw movsx movzx mul neg nop not or pop popa popad popf popfd push pusha pushad pushd pushf pushfd pushw rcl rcr rep repe repne repnz repz ret retf retn rol ror sahf sal sar sbb scas scasb scasd scasw 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 shl shld shr shrd stc std stos stosb stosd stosw sub test ud2 xadd xchg xlat xlatb xor"; + var sys_inst = "arpl bound cli clts hlt in ins insb insd insw int into invd invlpg iret iretd iretdf iretf lar lds les lfs lgdt lgs lidt lldt lmsw lock lsl lss ltr out outs outsb outsd outsw rdmsr rdpmc rdtsc rsm sgdt sidt sldt smsw sti str sysenter sysexit verr verw wbinvd wrmsr"; + var fpu_inst = "f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdiv fdivp fdivr fdivrp ffree fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub fisubr fld fld1 fldcw fldenv fldenvd fldenvw fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fninit fnop fnsave fnsaved fnsavew fnstcw fnstenv fnstenvd fnstenvw fnstsw fpatan fprem fprem1 fptan frndint frstor frstord frstorw fsave fsaved fsavew fscale fsin fsincos fsqrt fst fstcw fstenv fstenvd fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fwait fxam fxch fxtract fyl2x fyl2xp1 wait esc feni fneni fdisi fndisi fsetpm"; + var mul_inst = "addpd addps addsd addss andnpd andnps andpd andps clflush cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmppd cmpps cmpsd cmpss cmpunordps cmpunordss comisd comiss cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvtss2sd cvtss2si cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi cvttsd2si cvttss2si divpd divps divsd divss emms femms fxrstor fxsave ldmxcsr lfence maskmovdqu maskmovq maxpd maxps maxsd maxss mfence minpd minps minsd minss movapd movaps movd movdq2q movdqa movdqu movhlps movhpd movhps movlhps movlpd movlps movmskpd movmskps movntdq movnti movntpd movntps movntq movq movq2dq movsd movss movupd movups mulpd mulps mulsd mulss orpd orps packssdw packsswb packuswb paddb paddd paddq paddsb paddsw paddusb paddusw paddw pand pandn pause pavgb pavgusb pavgw pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pextrw pf2fw pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pinsrw pmaddwd pmaxsw pmaxub pminsw pminub pmovmskb pmulhrw pmulhuw pmulhw pmullw pmuludq por prefetch prefetchnta prefetcht0 prefetcht1 prefetcht2 prefetchw psadbw pshufd pshufhw pshuflw pshufw pslld pslldq psllq psllw psrad psraw psrld psrldq psrlq psrlw psubb psubd psubq psubsb psubsw psubusb psubusw psubw pswapd punpckhbw punpckhdq punpckhqdq punpckhwd punpcklbw punpckldq punpcklqdq punpcklwd pxor rcpps rcpss rsqrtps rsqrtss sfence shufpd shufps sqrtpd sqrtps sqrtsd sqrtss stmxcsr subpd subps subsd subss ucomisd ucomiss unpckhpd unpckhps unpcklpd unpcklps xorpd xorps cmpeqpd cmpltpd cmplepd cmpunordpd cmpneqpd cmpnltpd cmpnlepd cmpordpd cmpeqsd cmpltsd cmplesd cmpunordsd cmpneqsd cmpnltsd cmpnlesd cmpordsd pavgusb pfadd pfsub pfsubr pfacc pfcmpge pfcmpgt pfcmpeq pfmin pfmax pi2fd pf2id pfrcp pfrsqrt pfmul pfrcpit1 pfrsqit1 pfrcpit2 pmulhrw femms prefetch prefetchw pf2iw pfnacc pfpnacc pf2fw pswapd fisttp lddqu addsubps addsubpd haddpd hsubps haddpd hsubpd movshdup movsldup monitor mwait"; + var masm_specific="\\.186 \\.286 \\.286c \\.286p \\.287 .386 \\.386c \\.386p \\.387 \\.486 \\.486p \\.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 dosseg dq dt dup dw echo else elseif elseif1 elseif2 elseifb elseifdef elseifdif elseifdifi elseife elseifidn elseifidni elseifnb elseifndef end endif endm endp ends eq equ even exitm extern externdef extrn for forc ge goto group [^&]gt high highword if 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 [^&]lt macro mask mod \\.msfloat name ne offset opattr option org %out page popcontext proc proto ptr public purge pushcontext record repeat rept seg segment short size sizeof sizestr struc struct substr subtitle subttl textequ this title type typedef union while width resb resw resd resq rest incbin equ times %define %idefine %xdefine %xidefine %undef %assign %iassign %strlen %substr %macro %imacro %endmacro %rotate \\.nolist %if %elif %else %endif %ifdef %ifndef %elifdef %elifndef %ifmacro %ifnmacro %elifmacro %elifnmacro %ifctk %ifnctk %elifctk %elifnctk %ifidn %ifnidn %elifidn %elifnidn %ifidni %ifnidni %elifidni %elifnidni %ifid %ifnid %elifid %elifnid %ifstr %ifnstr %elifstr %elifnstr %ifnum %ifnnum %elifnum %elifnnum %error %rep %endrep %exitrep %include %push %pop %repl struct endstruc istruc at iend align alignb %arg %stacksize %local %line bits use16 use32 section absolute extern global common cpu org section group import export \\$ \\? @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 flat 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 private prologue radix readonly req scoped setif2 smallstack tiny use16 use32 uses # nasm directives, mostly complete, does not parse properly a16 a32 o16 o32 byte word dword nosplit \\$ \\$\\$ seq wrt flat large small \\.text \\.data \\.bss near far %0 %1 %2 %3 %4 %5 %6 %7 %8 %9"; + this.regexList=[ + {regex:/^;.*$/gm,css:"comments"}, + {regex:/\s\;.*$/gm,css:"comments"}, + {regex:/db|dd|df/gm,css:"masm_spc"}, + {regex:/\b[0-9a-fA-F]+\b/gm,css:"numbers"}, + {regex:/\b[0-9a-fA-F]+h$\b/gm,css:"numbers"}, + {regex:/\bloc_[0-9a-fA-F]+\b/gm,css:"labels"}, + {regex:/\bsub_[0-9a-fA-F]+\b/gm,css:"labels"}, + {regex:/@[_a-zA-Z-]+./gm,css:"labels"}, + {regex:/.inc|.lib/gm,css:"plain"}, + {regex:/\.[0-9_a-zA-Z-?]+/gm,css:"masm_spc"}, + {regex:SyntaxHighlighter.regexLib.doubleQuotedString,css:"asmstring"}, + {regex:SyntaxHighlighter.regexLib.singleQuotedString,css:"asmstring"}, + {regex:new RegExp(this.getKeywords(registers),"gmi"),css:"registers"}, + {regex:new RegExp(this.getKeywords(usr_inst),"gmi"),css:"usr_inst"}, + {regex:new RegExp(this.getKeywords(sys_inst),"gmi"),css:"sys_inst"}, + {regex:new RegExp(this.getKeywords(fpu_inst),"gmi"),css:"fpu_inst"}, + {regex:new RegExp(this.getKeywords(mul_inst),"gmi"),css:"mul_inst"}, + {regex:new RegExp(this.getKeywords(masm_specific),"gmi"),css:"masm_spc"} + ]}; + SyntaxHighlighter.brushes.Asm.prototype=new SyntaxHighlighter.Highlighter(); + SyntaxHighlighter.brushes.Asm.aliases=["asm","x86"]; + diff --git a/indefero/www/media/idf/js/syntaxhighlight/shBrushObjC.js b/indefero/www/media/idf/js/syntaxhighlight/shBrushObjC.js new file mode 100644 index 0000000..ab77f3c --- /dev/null +++ b/indefero/www/media/idf/js/syntaxhighlight/shBrushObjC.js @@ -0,0 +1,103 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + // Copyright 2006 Shin, YoungJin + // Copyright 2011 Scott Densmore + + var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + + 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + + 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + + 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + + 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + + 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + + 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + + 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + + 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + + 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + + 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + + 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + + 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + + 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + + 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + + 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + + 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + + 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + + 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + + '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t id ' + + 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + + 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + + 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + + 'va_list wchar_t wctrans_t wctype_t wint_t signed'; + + var keywords = 'break case catch class copy const __finally __exception __try ' + + 'const_cast continue private public protected __declspec ' + + 'default delete deprecated dllexport dllimport do dynamic_cast ' + + 'else enum explicit extern if for friend getter goto inline ' + + 'mutable naked namespace new nil NO noinline nonatomic noreturn nothrow NULL ' + + 'readonly readwrite register reinterpret_cast retain return SEL selectany self ' + + 'setter sizeof static static_cast struct super switch template this ' + + 'thread throw true false try typedef typeid typename union ' + + 'using uuid virtual void volatile whcar_t while YES'; + + var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + + 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + + 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + + 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + + 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + + 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + + 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + + 'fwrite getc getchar gets perror printf putc putchar puts remove ' + + 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + + 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + + 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + + 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + + 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + + 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + + 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + + 'clock ctime difftime gmtime localtime mktime strftime time'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /^ *#.*/gm, css: 'preprocessor' }, + { regex: /^#!.*$/gm, css: 'preprocessor' }, + { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'keyword bold' }, + { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }, + { regex: new RegExp('\\bNS\\w+\\b', 'gm'), css: 'keyword bold' }, + { regex: new RegExp('\\bUI\\w+\\b', 'gm'), css: 'keyword bold' }, + { regex: new RegExp('\\bIB\\w+\\b', 'gm'), css: 'keyword bold' }, + { regex: new RegExp('@\\w+\\b', 'gm'), css: 'keyword bold' }, + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['obj-c', 'objc']; + + SyntaxHighlighter.brushes.Objc = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})();