./0000755000175000017500000000000011621703711007652 5ustar neilneil./config/0000755000175000017500000000000011621703701011116 5ustar neilneil./config/slang/0000755000175000017500000000000011621703701012222 5ustar neilneil./config/slang/simple.keylist0000644000175000017500000000124007045070526015125 0ustar neilneil# This is a simple keymap file for the SLang-based FTE on Linux # Compile it with 'compkeys simple.keylist slangkbd.map'. # A Linux keymap is generated into "slangkbd.map" containing # escape sequences for each of the keys listed here, which # should be loaded using "loadkeys slangkbd.map" to # be able to use the keys. A+0 A+- C+. C+I C+M C+] C+S+] C+[ A+[ A+, A+. A+/ C+G++ A+G++ S+G++ C+G+- A+G+- S+G+- C+G+* A+G+* A+G+/ C+G+/ F11 F12 S+F2 C+F2 S+F3 C+F3 C+F4 C+A+F4 S+F6 A+F9 C+F9 S+F9 S+Up S+Down A+BackSp A+S+BackSp C+S+BackSp C+Ins S+Ins A+Ins S+Del C+Del S+Home S+C+Home C+Home S+End S+C+End C+End A+End S+PgUp S+PgDn S+Enter # A+Enter C+Enter ./config/slang/slangkbd.map0000644000175000017500000000707007045070526014521 0ustar neilneil############################ # Keytable to use with FTE # # generated by 'compkeys' # ############################ # A+0 alt keycode 11 = F100 string F100 = "\033\001\060" # A+- alt keycode 12 = F101 string F101 = "\033\001\055" # C+. control keycode 52 = F102 string F102 = "\033\003\056" # C+I control keycode 23 = F103 string F103 = "\033\003\111" # C+M control keycode 50 = F104 string F104 = "\033\003\115" # C+] control keycode 27 = F105 string F105 = "\033\003\135" # C+S+] shift control keycode 27 = F106 string F106 = "\033\023\003\135" # C+[ control keycode 26 = F107 string F107 = "\033\003\133" # A+[ alt keycode 26 = F108 string F108 = "\033\001\133" # A+, alt keycode 51 = F109 string F109 = "\033\001\054" # A+. alt keycode 52 = F110 string F110 = "\033\001\056" # A+/ alt keycode 53 = F111 string F111 = "\033\001\057" # C+G++ control keycode 78 = F112 string F112 = "\033\003\053" # A+G++ alt keycode 78 = F113 string F113 = "\033\001\053" # S+G++ shift keycode 78 = F114 string F114 = "\033\023\053" # C+G+- control keycode 74 = F115 string F115 = "\033\003\055" # A+G+- alt keycode 74 = F116 string F116 = "\033\001\055" # S+G+- shift keycode 74 = F117 string F117 = "\033\023\055" # C+G+* control keycode 55 = F118 string F118 = "\033\003\052" # A+G+* alt keycode 55 = F119 string F119 = "\033\001\052" # A+G+/ alt keycode 98 = F120 string F120 = "\033\001\057" # C+G+/ control keycode 98 = F121 string F121 = "\033\003\057" # F11 keycode 87 = F122 string F122 = "\033\006a" # F12 keycode 88 = F123 string F123 = "\033\006b" # S+F2 shift keycode 60 = F124 string F124 = "\033\023\0062" # C+F2 control keycode 60 = F125 string F125 = "\033\003\0062" # S+F3 shift keycode 61 = F126 string F126 = "\033\023\0063" # C+F3 control keycode 61 = F127 string F127 = "\033\003\0063" # C+F4 control keycode 62 = F128 string F128 = "\033\003\0064" # C+A+F4 control alt keycode 62 = F129 string F129 = "\033\003\001\0064" # S+F6 shift keycode 64 = F130 string F130 = "\033\023\0066" # A+F9 alt keycode 67 = F131 string F131 = "\033\001\0069" # C+F9 control keycode 67 = F132 string F132 = "\033\003\0069" # S+F9 shift keycode 67 = F133 string F133 = "\033\023\0069" # S+Up shift keycode 103 = F134 string F134 = "\033\023\025" # S+Down shift keycode 108 = F135 string F135 = "\033\023\004" # A+BackSp alt keycode 14 = F136 string F136 = "\033\001\010" # A+S+BackSp shift alt keycode 14 = F137 string F137 = "\033\023\001\010" # C+S+BackSp shift control keycode 14 = F138 string F138 = "\033\023\003\010" # C+Ins control keycode 110 = F139 string F139 = "\033\003\021" # S+Ins shift keycode 110 = F140 string F140 = "\033\023\021" # A+Ins alt keycode 110 = F141 string F141 = "\033\001\021" # S+Del shift keycode 111 = F142 string F142 = "\033\023\032" # C+Del control keycode 111 = F143 string F143 = "\033\003\032" # S+Home shift keycode 102 = F144 string F144 = "\033\023\002" # S+C+Home shift control keycode 102 = F145 string F145 = "\033\023\003\002" # C+Home control keycode 102 = F146 string F146 = "\033\003\002" # S+End shift keycode 107 = F147 string F147 = "\033\023\005" # S+C+End shift control keycode 107 = F148 string F148 = "\033\023\003\005" # C+End control keycode 107 = F149 string F149 = "\033\003\005" # A+End alt keycode 107 = F150 string F150 = "\033\001\005" # S+PgUp shift keycode 104 = F151 string F151 = "\033\023\020" # S+PgDn shift keycode 109 = F152 string F152 = "\033\023\016" # S+Enter shift keycode 28 = F153 string F153 = "\033\023\015" # C+Enter control keycode 28 = F154 string F154 = "\033\003\015" ./config/m_gawk.fte0000644000175000017500000001532210015231630013057 0ustar neilneil# # FTE highlighting rules for GAWK/AWK scripts # # Contributor: Wirawan Purwanto # Created: 4-Mar-2002 # Updated: 20-May-2002 # # The syntax highlighting is heavily biased toward GNU AWK. # # CAVEAT: The syntax highlighting for REGEX is not perfect at all: # ordinary divisions WILL be misunderstood as regex. Unless you have # divisions in your awk scripts (which is a kind of unlikely for typical # scripts), this should not be a big trouble. # # The original source code is m_gawk.src.fte. DO NOT EDIT FILE m_gawk.fte! # colorize GAWK { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Regexp', 'Lang_Regexp' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, { 'Tag', 'Markup_Tag' }, }; keyword 'Editor_Keywords' { # any missing ? 'BEGIN', 'END', 'print', 'printf', 'delete', 'if', 'else', 'for', 'in', 'while', 'do', 'break', 'continue', 'next', 'nextfile', 'function', 'return', 'exit', 'getline', }; # Standard functions supplied bu AWK keyword 'Lang_Function' { # any missing ? # math-oriented: 'int', 'sqrt', 'exp', 'log', 'sin', 'cos', 'atan2', 'rand', 'srand', # string-oriented: 'index', 'length', 'match', 'split', 'sprintf', 'strtonum', 'sub', 'gsub', 'gensub', 'substr', 'tolower', 'toupper', # file i/o: 'open', 'close', 'fflush', 'system', # GAWK-specific extensions --------- # string-oriented: 'asort', # bit oriented: (AWK/GAWK???) 'and', 'or', 'xor', 'compl', 'lshift', 'rshift', # timestamp functions: 'systime', 'mktime', 'strftime', # internationalization 'dcgettext', 'bindtextdomain', }; # standard library procedure/function names # Standard variables supplied by AWK keyword 'Lang_Variable' { # built-in/special-meaning variables 'CONVFMT', 'FS', 'OFMT', 'OFS', 'ORS', 'RS', 'SUBSEB', 'ARGC', 'ARGV', 'ENVIRON', 'ERRNO', 'FILENAME', 'FNR', 'NF', 'NR', 'PROCINFO', 'RLENGTH', 'RSTART', # gawk specific 'BINMODE', 'FIELDWIDTH', 'IGNORECASE', 'LINT', 'TEXTDOMAIN', 'ARGIND', 'RT', }; # default state h_state 0 { 'Punctuation' } h_trans { 2, '-s', '_a-zA-Z', 'Normal' } h_trans { 6, '-s', '0-9', 'Normal' } h_trans { 3, '<', '#', 'Comment' } h_trans { 4, '<', '"', 'String' } # h_trans { 5, '<', '\'', 'String' } # metachar (except tab -- how to include it?) h_trans { 0, '', '$', 'CPreprocessor' } h_trans { 0, '$', '\\', 'Punctuation' } # literal char # h_trans { 1, '', '\\', 'Punctuation' } -- this is not recognized here! h_trans { 7, '<', '/', 'Keyword' } # h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } # quote h_state 1 { 'String' } h_trans { 0, 'S', '', 'String' } h_trans { 0, '$', '', 'Normal' } # word h_state 2 { 'Normal' } h_wtype { -1, -1, -1, '', '_a-zA-Z0-9' } # end of a word h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', '_a-zA-Z0-9', 'Normal' } # comment h_state 3 { 'Comment' } h_trans { 0, '$<', '', 'Normal' } # string ("-quoted) h_state 4 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 4, '', '\\"', 'String' } h_trans { 4, '', '\\\\', 'String' } h_trans { 4, '$', '\\', 'Punctuation' } # not allowed in gawk/awk: ## string ('-quoted) h_state 5 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 5, '>', '\\\'', 'String' } h_trans { 5, '$', '\\', 'Punctuation' } # number h_state 6 { 'Number' } h_trans { 0, '-S', '.0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } # The regular-expression part: # regexp h_state 7 { 'Regexp' } h_trans { 8, '', '\\', 'Punctuation' } # regexp operators: h_trans { 7, 's', '^$.+*|()?', 'Punctuation' } h_trans { 9, '<', '[', 'Punctuation' } h_trans { 11,'<', '{', 'Punctuation' } h_trans { 0, '', '/', 'Keyword' } # h_trans { 12, '$>', '', 'Normal' } # literal quotation h_state 8 { 'Regexp' } h_trans { 7, 's', 'abfnrtv', 'Punctuation' } h_trans { 7, 'S', '', 'Regexp' } h_trans { 12, '$', '', 'Normal' } # grouping using [ ] h_state 9 { 'Regexp' } h_trans { 10, '', '\\', 'Punctuation' } h_trans { 9, '', '^', 'Punctuation' } h_trans { 9, '', '-', 'Punctuation' } h_trans { 7, '>', ']', 'Punctuation' } h_trans { 12, '$', '', 'Normal' } # regexpgroupquote h_state 10 { 'Regexp' } h_trans { 9, 's', 'abfnrtv', 'Punctuation' } h_trans { 9, 'S', '', 'Regexp' } h_trans { 12, '$', '', 'Normal' } # repeat count h_state 11 { 'Number' } h_trans { 11,'s', '0-9', 'Number' } h_trans { 11,'', ',', 'Punctuation' } h_trans { 7, '>', '}', 'Punctuation' } h_trans { 12, 'S', '', 'Normal' } h_trans { 12, '$', '', 'Normal' } # error h_state 12 { 'Tag' } # all the way to the end :-) } mode GAWK: PLAIN { # AWK mode with GNU extensions FirstLineRx = /^\#\![ ]*[^ ]*awk>/; FileNameRx = /\.\c{{AWK}|{GAWK}}$/; HilitOn = 1; Colorizer = 'GAWK'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*function\s+[A-Za-z_][A-Za-z_0-9]*\s*\(.*/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } ./config/m_asm.fte0000644000175000017500000001444107530515565012733 0ustar neilneil# x86 instruction list now nearly complete, # also added floating point registers and some nasm directives # jsvendsen 07-24-2001 colorize ASM { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'popad', 'movzx', 'movsx', 'lea', 'hlt', 'sal', 'sar', 'shl', 'shr', 'and', 'or', 'xor', 'not', 'ibts', 'add', 'adc', 'adb', 'sub', 'sbb', 'neg', 'mul', 'div', 'idiv', 'imul', 'test', 'cmp', 'inc', 'dec', 'popa', 'popaw', 'popf', 'popfw', 'popfd', 'pusha', 'pushad', 'pushaw', 'pushf', 'pushfd', 'pushfw', 'scasd', 'scasw', 'scasb', 'movsd', 'movsw', 'movsb', 'stosd', 'stosw', 'stosb', 'out', 'outsd', 'outsw', 'outsb', 'in', 'insd', 'insw', 'insb', 'int', 'nop', 'rep', 'repz', 'repnz', 'repe', 'repne', 'int1', 'icepb', 'int01', 'int3', 'into', 'cld', 'clc', 'cli', 'clts', 'stc', 'aaa', 'aas', 'aam', 'aad', 'daa', 'das', 'arpl', 'bound', 'bsf', 'bswap', 'bt', 'btc', 'btr', 'bts', 'cbw', 'cwd', 'cdq', 'cwde', 'cmc', 'cpuid', 'emms', 'cmpsb', 'cmpsw', 'cmpsd', 'cmpxchg', 'cmpxchg486', 'cmpxchg8b', 'f2xm1', 'fabs', 'fadd', 'faddp', 'to', 'fbld', 'fbstp', 'fchs', 'fclex', 'fcmovb', 'fcmovbe', 'fcmove', 'fcmovnb', 'fcmovnbe', 'fcmovne', 'fcmovnu', 'fcmovu', 'fcom', 'fcomp', 'fcompp', 'fcomi', 'fcomip', 'fcos', 'fdecstp', 'fdisi', 'fndisi', 'feni', 'fneni', 'fdiv', 'fdivp', 'fdivr', 'fdivrp', 'fcos', 'ffree', 'fiadd', 'ficom', 'ficomp', 'fidiv', 'fidivr', 'fild', 'fist', 'fistp', 'fimul', 'fincstp', 'finit', 'fninit', 'fisub', 'fisubr', 'fld', 'fld1', 'fldl2e', 'fldl2t', 'fldlg2', 'fldln2', 'fldpi', 'fldz', 'fldcw', 'fldenv', 'fmul', 'fmulp', 'fnop', 'fpatan', 'fptan', 'fprem', 'fprem1', 'frndint', 'fsave', 'frstor', 'fscale', 'fsetpm', 'fsin', 'fsincos', 'fsqrt', 'fst', 'fstp', 'fstcw', 'fstenv', 'fnstenv', 'fsub', 'fsubr', 'fsubp', 'fsubrp', 'ftst', 'fucom', 'fucomp', 'fucompp', 'fucomi', 'fucomip', 'fxam', 'fxch', 'fxtract', 'fyl2x', 'fyl2xp1', 'invd', 'invlpg', 'lahf', 'lar', 'lds', 'les', 'lfs', 'lgs', 'lss', 'lgdt', 'lidt', 'lldt', 'sgdt', 'sidt', 'sldt', 'lmsw', 'smsw', 'loadall', 'loadall286', 'lsl', 'ltr', 'movd', 'movq', 'packssdw', 'packsswb', 'packuswb', 'paddb', 'paddw', 'paddd', 'paddsb', 'paddsw', 'paddusb', 'paddusw', 'paddsiw', 'pand', 'pandn', 'paveb', 'pcmpeqb', 'pcmpeqw', 'pcmpeqd', 'pcmpgtb', 'pcmpgtw', 'pcmpgtd', 'pdistib', 'pmachriw', 'pmulhriw', 'pmaddwd', 'pmagw', 'pmulhrw', 'pmulhw', 'pmullw', 'pmvzb', 'pmvnzb', 'pmvlzb', 'pmvgezb', 'por', 'psllw', 'pslld', 'psllq', 'psraw', 'psrad', 'psrlw', 'psrld', 'psrlq', 'psubb', 'psubw', 'psubd', 'psubsb', 'psubsw', 'psubusb', 'psubusw', 'psubsiw', 'punpckhbw', 'punpckhwd', 'punpckhdq', 'punpcklbw', 'punpcklwd', 'punpckldq', 'pxor', 'rcl', 'rcr', 'rdmsr', 'rdpmc', 'rdtsc', 'rol', 'ror', 'rsm', 'sahf', 'salc', 'shld', 'shrd', 'smi', 'stc', 'std', 'sti', 'str', 'umov', 'verr', 'verw', 'wait', 'wbinvd', 'wrmsr', 'xadd', 'xbts', 'xchg', 'xlatb', 'enter', 'leave', }; keyword 'Editor_Keywords3' { 'eax', 'ax', 'ah', 'al', 'ebx', 'bx', 'bh', 'bl', 'ecx', 'cx', 'ch', 'cl', 'edx', 'dx', 'dh', 'dl', 'si', 'di', 'esi', 'edi', 'cs', 'ss', 'ds', 'es', 'fs', 'gs', 'bp', 'ebp', 'sp', 'esp', 'ip', 'eip', 'st', 'st0', 'st1', 'st2', 'st3', 'st4', 'st5', 'st6', 'st7', }; keyword 'Editor_Keywords2' { 'call', 'ret', 'retf', 'retn', 'iret', 'iretw', 'iretd', 'jmp', 'je', 'jne', 'jz', 'jnz', 'jl', 'jle', 'jg', 'jge', 'jnge', 'jng', 'jnle', 'jnl', 'jb', 'jbe', 'ja', 'jae', 'jnae', 'jna', 'jnbe', 'jnb', 'jo', 'jns', 'jcxz', 'jecxz', 'loop', 'loope', 'loopz', 'loopne', 'loopnz', }; keyword 'Editor_Keywords4' { 'near', 'far', 'short', 'seg', 'offset', 'ptr', 'word', 'byte', 'dword', 'qword', 'dup', }; keyword 'Editor_Keywords5' { 'assume', 'label', 'group', 'if', 'ifdef', 'ifndef', 'endif', 'else', 'public', 'extrn', 'macro', 'endm', 'end', 'proc', 'endp', 'equ', 'define', 'segment', 'section', 'seg', 'wrt', 'ends', 'use32', 'use16', 'db', 'dw', 'dd', 'dq', 'dt', 'resb', 'resw', 'resd', 'resq', 'rest', 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', 'incbin', 'bits', 'times' ,'org', }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', ';', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM: PLAIN { FileNameRx = /\.\cASM$/; HilitOn = 1; Colorizer = 'ASM'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } ./config/m_ldsgml.fte0000644000175000017500000000447607530515567013446 0ustar neilneil# linuxdoc-sgml colorize LDSGML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Markup_Default' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { # should be HTML 3.2 complete "doctype", "article", "title", "author", "date", "abstract", "toc", "sect","sect1", "sect2", "sect3", "sect4", "label", "ref", "url", "htmlurl", "tt", "bf", "em", "itemize", "enum", "descrip", "item", "tag", "p", "code", "verb", "tscreen", }; keyword "Editor_Keywords2" { "id", "url", "name", }; h_state 0 { 'Normal' } h_trans { 5, '<', '"; } ./config/m_catbs.fte0000644000175000017500000000073107530515712013236 0ustar neilneil# for viewing nroff output (do NOT use for editing). colorize CATBS { SyntaxParser = 'CATBS'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Symbol', 'Editor_Bold' }, }; } mode CATBS: PLAIN { FileNameRx = /\.\c{MAN}|{CAT}$/; # == never HilitOn = 1; Colorizer = 'CATBS'; ReadOnly = 1; # this mode cannot edit properly } ./config/m_unrealscript.fte0000644000175000017500000000357607657204171014673 0ustar neilneil# C mode colorize UNREALSCRIPT { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'class', 'extends', 'function', 'defaultproperties', 'Super', 'var', 'if', 'return', 'bool', 'true', 'false', 'string', 'local', 'Begin', 'Object', 'array', 'int', 'float', 'enum', 'localized', 'struct', 'config', 'for', 'else', 'event', 'exec', 'state', 'while', 'break', 'continue', 'native', 'simulated', 'abstract', 'native', 'nativereplication', 'const', 'final', 'iterator', 'static', 'color', 'simulated', 'replication', 'unreliable', 'foreach', 'optional', 'out', 'switch', 'transient', 'name', 'export', 'delegate', 'cpptext', 'globalconfig', 'self', 'preoperator', 'postoperator', 'operator', 'coerce', 'noexport', 'ignores', }; } mode UNREALSCRIPT: C { # UScript Mode FileNameRx = /\.\c{UC}$/; HilitOn = 1; Colorizer = 'UNREALSCRIPT'; AutoIndent = 0; IndentMode = 'C'; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*(({cpptext}|{defaultproperties}|{replication})\s*)|((({native}|{native\(\d+\)}|{final}|{static}|{simulated}|{exec})\s+)*({function}|{event})\s+(.+\s+)?[\w_]+\s*\([^;]*)$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/m_java.fte0000644000175000017500000000451211604440303013052 0ustar neilneil sub JAVA_Base { MoveFileStart; InsertString "package /* package name */;"; 2:LineNew; InsertString "import java.util.*;"; LineNew; InsertString "import javax.swing.*;"; 2:LineNew; InsertString "public class "; InsertString $FileBaseName; LineNew; InsertString "{"; LineIndent; 2:LineNew; InsertString "public "; InsertString $FileBaseName; InsertString "()"; LineIndent; LineNew; InsertString "{"; LineIndent; 2:LineNew; InsertString "}"; LineIndent; 2:LineNew; InsertString "}"; LineIndent; LineNew; MoveFileStart; 8:MoveRight; } colorize JAVA { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'abstract', 'default', 'goto', 'null', 'synchronized', 'boolean', 'do', 'if', 'package', 'this', 'break', 'double', 'implements', 'private', 'threadsafe', 'byte', 'else', 'import', 'protected', 'throw', 'byvalue', 'extends', 'instanceof', 'public', 'transient', 'case', 'false', 'int', 'return', 'true', 'catch', 'final', 'interface', 'short', 'try', 'char', 'finally', 'long', 'static', 'void', 'class', 'float', 'native', 'super', 'while', 'const', 'for', 'new', 'switch', 'continue', 'throws' }; } mode JAVA: PLAIN { # JAVA Mode FileNameRx = /\.\c{{java}|{js}}$/; HilitOn = 1; Colorizer = 'JAVA'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\s*\w[\w._]+{\s+[\w._]+}+[\w_]+\s*\([^;]*$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/m_perl.fte0000644000175000017500000000706411515403512013102 0ustar neilneil # syntax hilit needs to handle <. # useful command here is which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'unx' { KillWordPrev; %if(BSD_BRACE) InsertString 'unless ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'unless () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } } ./config/m_pascal.fte0000644000175000017500000001234410022715245013401 0ustar neilneil colorize PASCAL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Lang_Assembler' }, # assembler { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Keyword', 'Editor_Keywords' }, }; keyword 'Editor_Keywords' { 'program', 'const', 'type', 'var', 'begin', 'end', 'array', 'set', 'record', 'string', 'if', 'then', 'else', 'while', 'for', 'to', 'downto', 'do', 'with', 'repeat', 'until', 'case', 'of', 'goto', 'exit', 'label', 'procedure', 'function', 'nil', 'file', 'and', 'or', 'not', 'xor', 'div', 'mod', 'unit', 'uses', 'implementation', 'interface', 'asm', 'inline', 'object', 'constructor', 'destructor', 'inherited', 'except', 'finally', 'initialization', 'out', 'property', 'resourcestring', 'try', 'exports', 'library', 'packed', 'raise', 'as', 'class', 'dispinterface', 'in', 'shl', 'shr', 'threadvar', 'finalization', 'is', 'at', 'on', 'private', 'protected', 'public', 'published', 'automated', 'absolute', 'abstract', 'cdecl', 'contains', 'default', 'dispid', 'dynamic', 'export', 'external', 'far', 'assembler', 'virtual', 'near', 'forward', 'implements', 'index', 'message', 'name', 'nodefault', 'overload', 'override', 'package', 'pascal', 'read', 'readonly', 'register', 'reintroduce', 'requires', 'resident', 'safecall', 'stdcall', 'stored', 'write', 'writeonly', 'result', 'integer', 'cardinal', 'shortint', 'smallint', 'longint', 'int64', 'byte', 'word', 'longword', 'char', 'boolean', 'bytebool', 'wordbool', 'longbool', 'real48', 'single', 'smallword', 'double', 'extended', 'comp', 'currency', 'real', 'shortstring', 'ansistring', 'widestring', }; keyword 'Lang_DecimalNumber' { 'true', 'false', }; h_state 0 { 'Normal' } h_trans { 10, '<', '(*&', 'CPreprocessor' } h_trans { 10, '<', '(*$', 'CPreprocessor' } h_trans { 9, '<', '{&', 'CPreprocessor' } h_trans { 9, '<', '{$', 'CPreprocessor' } h_trans { 8, '', 'asm', 'Command' } # workaround for bug 854418 h_trans { 17, '<-x', /\c{while}|{if}|{until}|{not}|{and}|{or}|{xor}|{div}|{mod}\s*\(/, 'Keyword' } h_trans { 16, '<-x', /[_a-zA-Z0-9]+\s*\(/, 'Function' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 11, '<', '//', 'Comment' } h_trans { 1, '<', '(*', 'Comment' } h_trans { 2, '<', '{', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 6, '<', '0x', 'HexNumber' } h_trans { 6, '<', '$', 'HexNumber' } h_trans { 7, '', '*)', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '>', '}', 'Comment' } h_state 3 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } h_state 6 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 8 { 'Command' } h_trans { 0, '', 'end', 'Command' } h_trans { 12, '<', '(*', 'Comment' } h_trans { 13, '<', '{', 'Comment' } h_state 9 { 'CPreprocessor' } h_trans { 0, '>', '}', 'CPreprocessor' } h_state 10 { 'CPreprocessor' } h_trans { 0, '>', '*)', 'CPreprocessor' } h_state 11 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 12 { 'Comment' } h_trans { 8, '>', '*)', 'Comment' } h_state 13 { 'Comment' } h_trans { 8, '>', '}', 'Comment' } h_state 14 { 'String' } # character of the form #ddd h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 15 { 'String' } # character of the form #$xx h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 16 { 'Function' } h_trans { 0, '->', '(', 'Normal' } h_state 17 { 'Keyword' } h_trans { 0, '->', '(', 'Normal' } } mode PASCAL: PLAIN { # Pascal Mode FileNameRx = /\.\cPAS$/; HilitOn = 1; Colorizer = 'PASCAL'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' (*'; CommentEnd = '*)'; RoutineRegexp = '^{procedure}|{function}>'; } ./config/m_msg.fte0000644000175000017500000000120107172742705012727 0ustar neilneil colorize MSG { SyntaxParser = 'MSG'; color { { 'Normal', 'Editor_Bold' }, { 'Header', 'Msg_Header' }, { 'Quotes', 'Msg_Quotes' }, { 'Tag', 'Msg_Tag' }, { 'Control', 'Msg_Signature' }, }; } mode MSG: TEXT { # EMail messages FileNameRx = /\c{\.{MSG}|{YEP}|{SND}}|{^SLRN.\d+}|{{\.{article}|{letter}}|{snd}\.\d+}$/; # try also 1 WordWrap = 1; # automagic wordwrap HilitOn = 1; # enable highlight Colorizer = 'MSG'; # Highilight messages RoutineRegexp = /^Subject:/; } ./config/pal_bluez.fte0000644000175000017500000001202510335712644013602 0ustar neilneil# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:darkCyan' }, { 'ScrollBar_Background', 'black:darkCyan' }, { 'ScrollBar_Slider', 'black:cyan' }, { 'Status_Normal', 'black:gray' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'Status_Normal' }, { 'Message_Error', 'white:darkRed' }, { 'Message_Bold', 'yellow:darkRed' }, { 'EntryField_Field', 'black:gray' }, { 'EntryField_Prompt', 'darkBlue:gray' }, { 'EntryField_Selection', 'white:darkBlue' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:darkBlue' }, { 'List_Selected', 'black:darkCyan' }, { 'List_Hilited', 'white:darkBlue' }, { 'List_HilitSelect', 'black:darkCyan' }, { 'List_Marked', 'yellow:darkBlue' }, { 'List_MarkSelect', 'yellow:darkCyan' }, { 'List_MarkHilit', 'yellow:darkBlue' }, { 'List_MarkHilitSel', 'yellow:darkCyan' }, { 'ASCII_Chars', 'gray:darkBlue' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:black' }, { 'Menu_ActiveChar', 'red:black' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'darkRed:gray' }, { "Choice_Title", 'black:gray' }, { "Choice_Param", 'darkCyan:gray' }, { "Choice_Background", 'black:gray' }, { "Choice_ActiveItem", 'white:black' }, { "Choice_ActiveChar", 'red:black' }, { "Choice_NormalItem", 'black:gray' }, { "Choice_NormalChar", 'darkRed:gray' }, { "bg", 'gray:darkBlue' }, # background { "fg", 'gray:darkBlue' }, # foreground { 'Editor_Selected', 'black:gray' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkCyan' }, { 'Editor_Folds0', 'green:bg' }, { 'Editor_Folds1', 'blue:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'red:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'yellow:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'yellow:bg' }, { 'Editor_Keywords5', 'blue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'white:bg' }, { 'String', 'green:bg' }, { 'Lang_Number', 'cyan:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'cyan:bg' }, { 'Lang_OctalNumber', 'cyan:bg' }, { 'Lang_BinaryNumber', 'cyan:bg' }, { 'Lang_Punctuation', 'darkMagenta:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkGreen:bg' }, { 'Lang_Function', 'cyan:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'blue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'brown:bg' }, { 'DIFF_New', 'yellow:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ./config/m_resdlg.fte0000644000175000017500000000165607045070372013430 0ustar neilneil# OS/2 and Win* resource file (.RC) colorize RESOURCE { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; # keywords need to be defined... for os2 and win* } mode RESOURCE: PLAIN { # Resource file FileNameRx = /\.\c{RC}|{DLG}$/; HilitOn = 1; Colorizer = 'RESOURCE'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/main.fte0000644000175000017500000002023611331412500012535 0ustar neilneil# Main FTE Configuration File # operating system is now defined by CFTE # OS_UNIX, OS_OS2, OS_DOS32, OS_NT # uncomment for appropriate keybindings and menus %define(UI_KB) %define(UI_FTE) #%define(UI_WS) #%define(UI_NE) #%define(UI_BRIEF) # experimental %if(!BSD_BRACE) %define(1TBS_BRACE) %endif #%define(COLORS_GRAY_BG) #%define(COLORS_WHITE_BG) %define(COLORS_BLACK_BG) #%define(COLORS_BLUE_BG) %if(OS_OS2) %define(GUI_PM) %endif %if(OS_UNIX) %define(GUI_X11) %endif # to customize FTE to your preferences you should only need # to add stuff in this file. # Some examples are below. If you find something that cannot be # configured here, tell me about it. # If you wish to modify only a specific mode, add customizations # at the end of file. To also modify all of the descendants, # put customizations right after the include statement for mode. # The current hierarchy of modes is: # PLAIN # TEXT # MSG # C # ... # BIN # The order of things in this file is important! If you change a setting # before the default is set in one of the included files, your # setting will have no effect. # The file is processed in one pass, so everything should be defined, # before it is used. # My ultimate goal is to have the default files unmodifiable and # have all customization done here, but this is not currently possible for # all things (menus come to mind). include 'global.fte'; include 'pal_base.fte'; #color_palette { # { 'Comment', 'green:black' }, #} %if(COLORS_BLACK_BG) %if(UI_KB) include 'pal_b_kb.fte'; %endif include 'pal_blk.fte'; %endif %if(COLORS_WHITE_BG) include 'pal_wht.fte'; %endif %if(COLORS_GRAY_BG) include 'pal_gray.fte'; %endif %if(COLORS_BLUE_BG) include 'pal_blue.fte'; %endif %if(COLORS_BLUEZ_BG) include 'pal_bluez.fte'; # alternate blue from andyz @ sf.net %endif object GLOBAL { # fonts for GUI version %if(GUI_PM) # PM # Only System VIO fonts are used. Some listed below. XX*YY. # WindowFont = "8x8"; # WindowFont = "6x10"; # WindowFont = "8x10"; # WindowFont = "5x12"; # WindowFont = "8x12"; # WindowFont = "6x14"; WindowFont = "8x14"; # WindowFont = "5x16"; # WindowFont = "8x16"; # WindowFont = "8x18"; %endif %if(GUI_X11) # X11 # Any fixed-width font should do. Make sure it has all 256 characters # defined or weird things can happen. # WindowFont = "fixed"; # WindowFont = "6x8"; # WindowFont = "7x13"; # WindowFont = "8x13"; # WindowFont = "9x15"; WindowFont = "9x15"; %if(UI_KB) WindowFont = "*-fixed-bold-*-15*,*-fixed-bold-*-16*"; %endif # We need some font, which can be 'LOCALIZED' - and this can't be done # with font names like 9x15 (actually we can, but this would need # highly skilled users :)) # WindowFont = "10x20"; %endif } include 'color.fte'; # change background color # must be here to be inherited by other modes # object PLAIN { color { { 'Background', '17' } }; } # in this mode are declared all basic values # these are inherited in other modes - so basicaly # change only necessary values in submodes include 'm_plain.fte'; # must be here to be inherited by other modes # UNIX files have no CR at the end of line %if(OS_UNIX) mode PLAIN { # Don't autodetect line separator DetectLineSep = 0; # Don't add CR at EOL when saving AddCR = 0; # Don't remove CR if at EOL when loading StripChar = -1; } %endif eventmap TEX: PLAIN { key [F9] { Compile "latex " #. $FileName } } include 'm_4gl.fte'; include 'm_a51.fte'; include 'm_ada.fte'; include 'm_asm.fte'; include 'm_asm370.fte'; include 'm_bin.fte'; include 'm_c.fte'; include 'm_catbs.fte'; include 'm_clario.fte'; include 'm_diff.fte'; include 'm_ebnf.fte'; include 'm_fort90.fte'; include 'm_fte.fte'; include 'm_gawk.fte'; include 'm_html.fte'; include 'm_idl.fte'; include 'm_ipf.fte'; include 'm_java.fte'; include 'm_ldsgml.fte'; include 'm_make.fte'; include 'm_merge.fte'; include 'm_mod3.fte'; include 'm_msg.fte'; include 'm_pascal.fte'; include 'm_perl.fte'; include 'm_php.fte'; include 'm_py.fte'; include 'm_resdlg.fte'; include 'm_rexx.fte'; include 'm_ruby.fte'; include 'm_sgml.fte'; include 'm_sh.fte'; include 'm_siod.fte'; include 'm_sl.fte'; include 'm_sml.fte'; include 'm_sql.fte'; include 'm_tcl.fte'; include 'm_tex.fte'; include 'm_texi.fte'; include 'm_text.fte'; include 'm_unrealscript.fte'; include 'm_xml.fte'; include 'm_xslt.fte'; include 'm_rst.fte'; # C indentation style menu include 'uicstyle.fte'; # When doing large customizations of keyboard/menus # you should probably write your own version of these files. # to change a menu, predefine it before including the ui_*.fte file. # to add/override keybindings add them after including ui_*.fte file. # ui*.fte -files define all keyboard bindings and menus. # pick only one file. %if(UI_FTE) include 'ui_fte.fte'; # fte CUA style bindings %endif %if(UI_WS) include 'ui_ws.fte'; # wordstar like %endif %if(UI_NE) include 'ui_ne.fte'; # norton classic editor - incomplete %endif %if(UI_MEW) include 'ui_mew.fte'; # MultiEdit4Windows %endif %if(UI_BRIEF) include 'ui_brief.fte'; # BRIEF/CRISP %endif ##include 'ui_vi.fte'; # VI - very incomplete # todo: brief, epm, emacs, VI # some templates and abbreviations include 'ab_c.fte'; %if(OS_OS2) include 'ab_c_os2.fte'; %endif include 'ab_rexx.fte'; include 'ab_sh.fte'; include 'ab_java.fte'; include 'ab_perl.fte'; # some customizations object GLOBAL { SelectPathname = 0; ShowToolBar = 1; # PM only GUIDialogs = 1; # PM only SysClipboard = 1; # use PM clipboard, or X11 selection for clipboard # PMDisableAccel = 0; # disable Alt+Fx PM accelerators } # some editors have a SmartPaste feature. We can do that too. #eventmap C { key [S+G-Ins] { BlockPasteStream; BlockReIndent } } eventmap PLAIN { key [A+S+-] { # select block between {}()[]<> BlockUnmark; BlockMarkStream; MatchBracket; BlockMarkStream; SavePos; MoveBlockEnd; 2:MoveNext; ?MoveLeft; # do this to mark a newline after })>] BlockEnd; MoveSavedPos; } key [A+C+F] { IndentFunction } key [A+C+M] { BlockMarkFunction } key [A+C+[] { MoveFunctionPrev } key [A+C+\]] { MoveFunctionNext } key [C+F1] { ShowHelpWord %if(OS_OS2) # OS/2 - helpfile (can be contatenated) "CPREF+PMWIN+PMMSG+PMGPI+PMREL+PMFUN+PMHOK" %endif %if(OS_UNIX) # UNIX - specify options to MAN "" %endif %if(OS_NT) # Win32 - helpfile # "" %endif } %if(OS_OS2) key [S+F1] { ShowHelpWord "EMXDEV+EMXGNU+EMXLIB+EMXRT+EMXBSD" } %if(!UI_BRIEF) key [F1] { ShowHelp "FTE" "" } %endif %endif #key [C+A+F1] { # InsertString $FileName # InsertString $FilePath # InsertString $CurDirectory #} key [C+A+U] { MoveLineStart; ?FindReplace /^\/\/ / // "xnc"; MoveDown #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc"; MoveDown } key [C+A+C] { MoveLineStart; ?FindReplace /^(\s*)/ /\/\/ \1/ "xnc"; MoveDown #MoveLineStart; ?FindReplace /^(\s*)\/\// /\1/ "xnc"; #MoveLineStart; ?FindReplace /^(\s*)/ /\1\/\// "xnc"; MoveDown } key [G-Home] { MoveBeginOrNonWhite } key [C+G-Up] { PopGlobalBookmark } key [C+G-Down] { PushGlobalBookmark } #key [C+A+S+F] { # LineNew; # InsertString "path:" . $FilePath; LineNew; # InsertString "name:" . $FileName; LineNew; # InsertString "dir:" . $FileDirectory; LineNew; # InsertString "base:" . $FileBaseName; LineNew;. # InsertString "ext:" . $FileExtension; LineNew; #} } #and here is my function noumlaut: sub noumlaut { PlaceBookmark "0"; ?FindReplace /ä/ /\"a/ "agn" ; ?FindReplace /ö/ /\"o/ "agn" ; ?FindReplace /ü/ /\"u/ "agn" ; ?FindReplace /Ä/ /\"A/ "agn" ; ?FindReplace /Ö/ /\"O/ "agn" ; ?FindReplace /Ü/ /\"U/ "agn" ; ?FindReplace /ß/ /{\ss}/ "agn" ; GotoBookmark "0"; } object GLOBAL { # SevenBit = 1; # seven bit characters only for user interface... } eventmap PLAIN { #left arrow at the beginning of line moves to previous line # key [G-Left] { MovePrev } #right arrow at the end of line moves to next line # key [G-Right] { MoveNext } key [A+C+Enter] { noumlaut; RunProgram "latex " . $FileName; } } ./config/m_xslt.fte0000644000175000017500000003107610015225056013131 0ustar neilneil# FTE mode for editing XSLT files # created by Philippe Kirsanov # philippe@mail333.com # http://members.shaw.ca/phwp71/IT/ # Revision October 03, 2003 # XML+XSLT declaration sub XSLT_Base { MoveFileStart; MoveLineStart; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; 2:LineNew; 4:MoveLeft; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineStart; } sub XSLT_Template { InsertString ""; LineNew; InsertString "<\/xsl:template>"; LineNew; 2:MoveUp; MoveLineEnd; 10:MoveLeft; } sub XSLT_Param { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 4:MoveLeft; } sub XSLT_Variable { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 14:MoveLeft; } sub XSLT_ApplyTemplate { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 4:MoveUp; MoveLineEnd; 10:MoveLeft; } sub XSLT_CallTemaplate { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 3:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_If { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_CopyOf { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 4:MoveLeft; } sub XSLT_Copy { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_ValueOf { InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 33:MoveLeft; } sub XSLT_Text { InsertString ""; InsertString ""; LineNew; 1:MoveUp; MoveLineEnd; 11:MoveLeft; } sub XSLT_ForEach { InsertString ""; LineNew; InsertString ""; LineNew; 2:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_Choose { InsertString ""; LineNew; 4:MoveRight; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; 4:MoveLeft; InsertString ""; LineNew; 5:MoveUp; MoveLineEnd; 2:MoveLeft; } sub XSLT_Key { InsertString ""; LineNew; 1:MoveUp; MoveLineStart; 15:MoveRight; } sub XSLT_Sort { InsertString ""; LineNew; 1:MoveUp; MoveLineStart; 18:MoveRight; } colorize XSLT { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Command', 'Markup_Punctuation' }, { 'String', 'Markup_String' }, { 'Symbol', 'Markup_Control' }, { 'Tag', 'Markup_Tag' }, { 'Comment', 'Markup_Comment' }, { 'Directive', 'Markup_Symbol' }, { 'Special', 'Markup_Special' }, { 'Variable', 'Lang_Variable' }, { 'Keyword', 'Editor_Keywords' }, }; keyword "Editor_Keywords" { # HTML 4.0 keywords "a", "abbr", "acronym", "address", "area", "b", "base", "bdo", "big", "blockquote", "body", "br", "button", "caption", "cite", "code", "col", "colgroup", "dd", "del", "dfn", "div", "dl", "dt", "em", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "map", "meta", "noframes", "noscript", "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "samp", "script", "select", "small", "span", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var" }; keyword "Editor_Keywords2" { # Secondary keywords "above", "absbottom", "action", "align", "alink", "all", "alt", "auto", "background", "baseline", "below", "bgcolor", "border", "bordercolor", "bottom", "box", "button", "cellpadding", "cellspacing", "center", "checkbox", "checked", "circle", "class", "clear", "codebase", "color", "cols", "colspan", "compact", "coords", "datetime", "default", "dir", "disc", "enctype", "face", "file", "for", "frame", "frameborder", "get", "groups", "height", "hidden", "href", "hsides", "hspace", "image", "ismap", "justify", "label", "language", "left", "lhs", "link", "ltr", "mailto", "marginheight", "marginwidth", "maxlength", "method", "middle", "multiple", "name", "no", "nohref", "none", "noresize", "noshade", "nowrap", "onclick", "onmouseout", "onmouseover", "param", "password", "poly", "post", "prompt", "public", "radio", "rect", "rel", "reset", "rev", "rhs", "right", "rows", "rowspan", "rtl", "rules", "scrolling", "selected", "shape", "size", "square", "src", "start", "subject", "submit", "target", "text", "top", "type", "usemap", "valign", "value", "vlink", "void", "vsides", "vspace", "width", "yes", "_blank", "_parent", "_self", "_top", "id" }; keyword "Editor_Keywords5" { # Deprecated in HTML 4.01 "basefont", "font", "s", "strike", "u", "applet", "dir", "isindex", "menu" }; h_state 0 { 'Normal' } h_trans { 10, '<', '', '>', 'Command' } # End h_trans { 3, '<', '\'', 'String' } # String h_trans { 4, '<', '"', 'String' } # String h_trans { 7, '<', '?>', 'Special' } # Begin h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } # Tag Text # Entity h_state 2 { 'Symbol' } h_trans { 0, '>', ';', 'Symbol' } # End h_trans { 0, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # String h_state 3 { 'String' } h_trans { 8, '<', '&', 'Symbol' } # Entity h_trans { 1, '>', '\'', 'String' } # End # String h_state 4 { 'String' } h_trans { 9, '<', '&', 'Symbol' } # Entity h_trans { 1, '>', '"', 'String' } # End # Format Comment End Symbols h_state 5 { 'Comment' } h_trans { 6, '>', '--', 'Comment' } # End (Symbols) h_state 6 { 'Special' } h_trans { 5, '>', '--', 'Comment' } # Format Comment End Symbols h_trans { 0, '>', '>', 'Comment' } # End # Processing Instructions h_state 7 { 'Special' } h_trans { 1, '-S', '', 'Special' } # End # Entity h_state 8 { 'Symbol' } h_trans { 3, '>', ';', 'Symbol' } # End h_trans { 3, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # Entity h_state 9 { 'Symbol' } h_trans { 4, '>', ';', 'Symbol' } # End h_trans { 4, '-S', '#a-zA-Z0-9', 'Symbol' } # Entity Text # XSLT tags h_state 10 { 'Special' } h_wtype { -1, 15, 15, '', 'a-z\-' } # Tags h_words 'Markup_Symbol' { 'apply-imports', 'apply-templates', 'attribute', 'attribute-set', 'call-template', 'choose', 'comment', 'copy', 'copy-of', 'decimal-format', 'element', 'fallback', 'for-each', 'if', 'import', 'include', 'key', 'message', 'namespace-alias', 'number', 'otherwise', 'output', 'param', 'preserve-space', 'processing-instruction', 'sort', 'strip-space', 'stylesheet', 'template', 'text', 'transform', 'value-of', 'variable', 'when', 'with-param' } # String inside XSLT tag h_state 11 { 'String' } h_trans { 13, '<', '&', 'Symbol' } # Entity h_trans { 16, '<', '$', 'Variable' } # Variable h_trans { 11, 's', ':.*|@[]()', 'Tag' } # Special Symbols h_trans { 15, '>', '\'', 'String' } # End of String # String inside XSLT tag h_state 12 { 'String' } h_trans { 14, '<', '&', 'Symbol' } # Entity h_trans { 17, '<', '$', 'Variable' } # Variable h_trans { 12, 's', ':.*|@[]()', 'Tag' } # Special Symbols h_trans { 15, '>', '"', 'String' } # End of String # Entity h_state 13 { 'Symbol' } h_trans { 11, '>', ';', 'Symbol' } # End of Entity h_trans { 11, '-S', '#a-zA-Z0-9', 'Symbol' }# Entity Text # Entity h_state 14 { 'Symbol' } h_trans { 12, '>', ';', 'Symbol' } # End of Entity h_trans { 12, '-S', '#a-zA-Z0-9', 'Symbol' }# Entity Text # Process XSLT tag h_state 15 { 'Command' } h_trans { 0, '>', '>', 'Directive' } # End of Tag h_trans { 11, '<', '\'', 'String' } # String h_trans { 12, '<', '"', 'String' } # String h_trans { 19, '<', 'xmlns:', 'Keyword' } # Namespace h_wtype { -1, -1, -1, '', 'a-z\-' } # Tags # h_words 'Markup_Control' { # XSLT attributes h_words 'Markup_Symbol' { 'test', 'select', 'mode', 'name', 'namespace', 'use-attribute-sets', 'decimal-separator', 'grouping-separator', 'infinity', 'minus-sign', 'NaN', 'percent', 'per-mille', 'zero-digit', 'digit', 'pattern-separator', 'href', 'match', 'use', 'terminate', 'stylesheet-prefix', 'result-prefix', 'level', 'count', 'from', 'value', 'format', 'lang', 'letter-value', 'grouping-size', 'method', 'version', 'encoding', 'omit-xml-declaration', 'standalone', 'doctype-public', 'doctype-system', 'cdata-section-elements', 'indent', 'media-type', 'elements', 'data-type', 'order', 'case-order', 'id', 'extension-element-prefixes', 'exclude-result-prefixes', 'priority', 'disable-output-escaping' } # Variable h_state 16 { 'Variable' } h_trans { 11, '-S', 'a-zA-Z0-9_\$', 'Variable' } # Variable h_state 17 { 'Variable' } h_trans { 12, '-S', 'a-zA-Z0-9_\$', 'Variable' } # CDATA h_state 18 { 'String' } h_trans { 0, '<', ']]>', 'Keyword' } # >>> Namespace h_state 19 { 'Special' } h_trans { 15, '>', '=', 'Command' } # End of Namespace h_trans { 20, '-s', 'a-z\_', 'Tag' } # First qname is azure h_state 20 { 'Tag' } h_wtype { -1, 21, 21, '', 'a-z0-9\-\_' } # Second qname must be red h_state 21 { 'Special' } h_trans { 15, '>', '=', 'Command' } # <<< Namespace } mode XSLT: HTML { FileNameRx = /\.\c{{XSLT?}|{XML}|{XDR}|{WSC}}$/; TabSize = 4; SpaceTabs = 0; ShowTabs = 1; HilitOn = 1; Colorizer = "XSLT"; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /\ level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { #fold01 submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { #FOLD01 MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [C+D] { DeleteFile } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } key [A+T] { MainMenu 'T' } } # Buffer List #fold00 eventmap BUFFERS: MLIST { key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List #fold00 eventmap ROUTINES: MLIST { key [Esc] { FileClose } } # Message List #fold00 menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Editor - Editing Modes #FOLD00 # PLAIN #FOLD01 # menus #FOLD02 menu MChangeMode { #FOLD03 item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu MOpenInMode { #FOLD03 item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu File { #fold03 item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } # OpenDoc UI Guide recomments using Write To only, not Save As, hmm. item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Edit { #FOLD03 item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { #fold03 item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { #fold03 item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { #FOLD03 item "&Find...\tCtrl+Q C+W" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Fold { #fold03 item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { #fold03 submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { #fold03 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { #fold03 item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } eventmap PLAIN: MODEL { #FOLD02 # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [i] { ChangeKeys 'VI_INS' } key [I] { MoveLineStart; ChangeKeys 'VI_INS' } key [o] { LineAdd; MoveDown; MoveLineStart; ChangeKeys 'VI_INS' } key [O] { LineInsert; MoveLineStart; ChangeKeys 'VI_INS' } key [a] { MoveRight; ChangeKeys 'VI_INS' } key [A] { MoveLineEnd; ChangeKeys 'VI_INS' } key [r] { ToggleInsert; InsertChar; ToggleInsert } key [R] { ChangeKeys 'VI_OVER'; ToggleInsert } key [d] { ChangeKeys 'VI_DELETE' } key [D] { KillToLineEnd } key [y] { ChangeKeys 'VI_YANK' } key [x] { KillChar } key [X] { KillCharPrev } key [h] { MoveLeft } key [j] { MoveDown } key [k] { MoveUp } key [l] { MoveRight } key [$] { MoveLineEnd } key [0] { MoveLineStart } key [^] { MoveFirstNonWhite } key [:_q] { FileClose } key [:_w] { FileSave } key [:_e] { FileOpen } key [:_n] { FileNext } key [:_N] { FilePrev } #key [/] { SearchRx } #key [n] { SearchAgain } key [P] { BlockPaste } key [p] { BlockPaste } key [B] { MoveWordPrev } key [b] { MoveWordPrev } key [w] { MoveWordNext } key [W] { MoveWordNext } key [e] { MoveWordEndNext } key [E] { MoveWordEndNext } key [c] { ChangeKeys 'VI_CHANGE' } key [C+N] { MoveDown } key [C+P] { MoveUp } key [C+B] { MovePageUp } key [C+F] { MovePageDown } key [%] { MatchBracket } key [u] { Undo } key [C+R] { Redo } key [BackSp] { MoveLeft } key [Space] { MoveRight } key [G-Enter] { MoveDown; MoveLineStart } key [-] { MoveUp; MoveLineStart } key [+] { MoveDown; MoveLineStart } key [J] { LineJoin } key [C] { KillToLineEnd; ChangeKeys 'VI_INS' } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [G-C+PgDn] { MoveFileEnd } } eventmap VI_INS: MODEOPTS { key [Esc] { ChangeKeys; MoveLeft } key [G-Enter] { LineNew } key [Space] { InsertSpace } key [BackSp] { KillCharPrev } key [Tab] { InsertTab } } eventmap VI_OVER: VI_INS { #Insert = 0; key [Esc] { ChangeKeys; MoveLeft; ToggleInsert } } eventmap VI_DELETE: MODEOPTS { key [Esc] { ChangeKeys } key [d] { BlockSelectLine; BlockCut; ChangeKeys } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys } } eventmap VI_CHANGE: MODEOPTS { key [Esc] { ChangeKeys } key [w] { KillWord; ChangeKeys 'VI_INS' } key [$] { KillToLineEnd; ChangeKeys "VI_INS" } key [c] { MoveLineStart; KillToLineEnd; ChangeKeys "VI_INS" } } eventmap VI_YANK: MODEOPTS { key [Esc] { ChangeKeys } key [y] { BlockSelectLine; BlockCopy; ChangeKeys } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys } } mode PLAIN { EventMap = 'PLAIN'; } # C #fold01 menu Local_C { #fold02 item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tCtrl+F10" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C: PLAIN { #fold02 LocalMenu = 'Local_C'; # local menu key [=] { LineIndent; LineTrim } key [O] { LineIndent; LineNew } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } # key [A+\\] { BlockReIndent } # do some smart indents key [A+G-Enter] { LineAdd; LineIndent } key [S+G-Enter] { LineInsert; LineIndent } } mode C { #fold02 EventMap = 'C'; } # REXX #fold01 eventmap REXX: PLAIN { #fold02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [:] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode REXX { EventMap = 'REXX'; } #fold02 # PERL #fold01 eventmap PERL: PLAIN { #fold02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode PERL { EventMap = 'PERL'; } #fold02 # JAVA #fold01 eventmap JAVA: PLAIN { #fold02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } mode JAVA { EventMap = 'JAVA'; } #fold02 # HTML #fold01 menu HTML_Physical { #fold02 item "&Bold C-E C-B" { HTML_B } item "&Italic C-E C-I" { HTML_I } item "&Typewriter C-E C-T" { HTML_TT } } menu HTML_Logical { #fold02 item "&Definition C-E C-D" { HTML_DFN } item "&Emphasize C-E C-E" { HTML_EM } item "Citati&on C-E C-O" { HTML_CITE } item "&Code C-E C-C" { HTML_CODE } item "&Kbd entry C-E C-K" { HTML_KBD } item "Sam&ple msg C-E C-M" { HTML_SAMP } item "&Strong EM C-E C-S" { HTML_STRONG } item "&Variable C-E C-V" { HTML_VAR } } menu HTML_Header { #fold02 item "&1

C-E 1" { HTML_H1 } item "&2

C-E 2" { HTML_H2 } item "&3

C-E 3" { HTML_H3 } item "&4

C-E 4" { HTML_H4 } item "&5

C-E 5" { HTML_H5 } item "&6
C-E 6" { HTML_H6 } } menu HTML_List { #fold02 item "List &item
  • C-E i" { HTML_LI } item "&Unordered list C-E u" { HTML_UL } item "&Ordered list
      C-E o" { HTML_OL } item "Definition &list
      C-E l" { HTML_DL } item "Definition &tag
      C-E t" { HTML_DT } item "&Definition
      C-E d" { HTML_DD } } menu HTML_Table { #fold02 item "&Table C-E A-T" { HTML_TABLE } item "&Caption C-E A-R" { HTML_TR } item "&Data "; 10:MoveLeft; BlockUnmark; } sub HTML_TH { ?MoveBlockStart; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_TR { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_TD { ?MoveBlockStart; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_COL { ?MoveBlockStart; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_COLGROUP { ?MoveBlockStart; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_THEAD { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_TFOOT { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_TBODY { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } # Frames sub HTML_FRAME { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; 2:LineNew; InsertString ""; MoveSavedPos; } sub HTML_NOFRAMES { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 11:MoveLeft; BlockUnmark; } sub HTML_FRAMESET { ?MoveBlockStart; InsertString ""; 2:LineNew; InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; 2:LineNew; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_IFRAME { ?MoveBlockStart; InsertString ""; BlockUnmark; MoveSavedPos; } # Styles sub HTML_STYLE { InsertString ""; MoveSavedPos; } sub HTML_DIV { ?MoveBlockStart; InsertString "
      "; MoveLeft; SavePos; MoveRight; LineNew; ?MoveBlockEnd; BlockUnmark; LineNew; InsertString "
      "; MoveSavedPos; MoveRight; } sub HTML_SPAN { ?MoveBlockStart; InsertString ""; MoveLeft; SavePos; MoveRight; ?MoveBlockEnd; BlockUnmark; InsertString ""; 8:MoveLeft; MoveSavedPos; MoveRight; } # Programming sub HTML_SCRIPT { InsertString ""; 11:MoveLeft; SavePos; 11:MoveRight; LineNew; InsertString ""; LineNew; InsertString ""; MoveSavedPos; } sub HTML_NOSCRIPT { ?MoveBlockStart; InsertString ""; 11:MoveLeft; BlockUnmark; } sub HTML_OBJECT { InsertString ""; 9:MoveLeft; } sub HTML_PARAM { InsertString ""; 8:MoveLeft; } # basic document skeleton sub HTML_Base { MoveFileStart; InsertString ""; 2:LineNew; InsertString ""; 2:LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertDate "%Y"; InsertString " by "; InsertUid; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertUid; InsertString ","; InsertDate "%Y-%m-%d"; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString ""; LineNew; InsertString ""; 4:MoveLeft; InsertUid; 4:MoveRight; LineNew; InsertString ""; LineNew; InsertString ""; InsertString $FileBaseName; InsertString ""; LineNew; InsertString ""; 2:LineNew; InsertString ""; 2:LineNew; MoveFileEnd; LineAdd; MoveLineStart; InsertString ""; 2:LineNew; InsertString ""; MoveFileStart; 8:MoveDown; MoveLineEnd; 4:MoveLeft; } # Converts plain text to HTML sub HTML_TXT { MoveFileStart; ?FindReplace /&/ /&/ "agn" ; ?FindReplace // />/ "agn" ; ?FindReplace /tm/ "agn"; MoveFileStart; LineInsert; InsertString "
      "; MoveFileEnd;
          LineNew; InsertString "
      "; HTML_Base; } # basic frame skeleton sub HTML_BaseFrame { HTML_Base; SavePos; MoveFileStart; KillLine; HTML_DTD_X1F; ?FindReplace /body>/ /frameset>/ "agn"; MoveSavedPos; } colorize HTML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Markup_Punctuation' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { # XHTML 1.0 keywords "a", "abbr", "acronym", "address", "area", "b", "base", "bdo", "big", "blockquote", "body", "br", "button", "caption", "cite", "code", "col", "colgroup", "dd", "del", "dfn", "div", "dl", "dt", "em", "fieldset", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "map", "meta", "noframes", "noscript", "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "samp", "script", "select", "small", "span", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var" }; keyword "Editor_Keywords2" { # Secondary keywords "abbr", "above", "absbottom", "accept", "accept-charset", "accesskey", "action", "align", "all", "alt", "archive", "auto", "axis", "baseline", "below", "border", "bordercolor", "bottom", "box", "button", "cellpadding", "cellspacing", "char", "charoff", "charset", "checkbox", "checked", "circle", "cite", "class", "classid", "clear", "codebase", "codetype", "color", "cols", "colspan", "compact", "content", "coords", "data", "datetime", "declare", "default", "defer", "dir", "disabled", "disc", "enctype", "face", "file", "for", "frame", "frameborder", "get", "groups", "headers", "height", "hidden", "href", "hreflang","hsides", "hspace", "http-equiv", "id", "image", "ismap", "justify", "label", "lang", "left", "lhs", "longdesc", "ltr", "mailto", "marginheight", "marginwidth", "maxlength", "media", "method", "middle", "multiple", "name", "no", "nohref", "none", "noresize", "noshade", "nowrap", "param", "password", "poly", "post", "profile", "prompt", "radio", "readonly", "rect", "rel", "reset", "rev", "rhs", "right", "rows", "rowspan", "rtl", "rules", "scheme", "scope", "scrolling", "selected", "shape", "size", "span", "square", "src", "standby", "start", "style", "subject", "submit", "summary", "tabindex", "target", "title", "top", "type", "usemap", "valign", "value", "valuetype", "void", "vsides", "vspace", "width", "wrap", "yes", "_blank", "_parent", "_self", "_top", # DTD "doctype", "public", }; keyword "Editor_Keywords3" { # Event attributes "onfocus", "onblur", "onchange", "onclick", "ondblclick", "onfocus", "onload", "onkeydown", "onkeypress", "onkeyup", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset", "onselect", "onsubmit", }; keyword "Editor_Keywords5" { # Deprecated in XHTML 1.0 "applet", "basefont", "center", "dir", "font", "isindex", "listing", "menu", "plaintext", "s", "strike", "u", "xmp", # depricated attributes "alink", "background", "bgcolor", "language", "link", "text", "vlink", }; h_state 0 { 'Normal' } h_trans { 5, '<', '"; } ./config/pal_blue.fte0000644000175000017500000001231410015235324013377 0ustar neilneil# color palette (blue background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'black:gray' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'yellow:darkBlue' }, { 'EntryField_Field', 'darkCyan:gray' }, { 'EntryField_Prompt', 'black:gray' }, { 'EntryField_Selection', 'black:darkCyan' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:darkBlue' }, { 'List_Selected', 'black:darkCyan' }, { 'List_Hilited', 'white:darkBlue' }, { 'List_HilitSelect', 'white:darkCyan' }, { 'List_Marked', 'yellow:darkBlue' }, { 'List_MarkSelect', 'yellow:darkCyan' }, { 'List_MarkHilit', 'yellow:darkBlue' }, { 'List_MarkHilitSel', 'yellow:darkCyan' }, { 'ASCII_Chars', 'black:gray' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkCyan' }, { 'Menu_ActiveChar', 'darkRed:darkCyan' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'darkRed:gray' }, { "Choice_Title", 'black:gray' }, { "Choice_Param", 'darkCyan:gray' }, { "Choice_Background", 'black:gray' }, { "Choice_ActiveItem", 'black:darkCyan' }, { "Choice_ActiveChar", 'darkRed:darkCyan' }, { "Choice_NormalItem", 'black:gray' }, { "Choice_NormalChar", 'darkRed:gray' }, { "bg", 'yellow:darkBlue' }, # background { "fg", 'yellow:darkBlue' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'black:gray' }, { 'Editor_Folds0', 'cyan:bg' }, { 'Editor_Folds1', 'green:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'black:gray' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'white:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'yellow:bg' }, { 'Editor_Keywords5', 'magenta:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'cyan:bg' }, { 'Comment', 'gray:bg' }, { 'String', 'cyan:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'cyan:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'cyan:bg' }, { 'Lang_OctalNumber', 'magenta:bg' }, { 'Lang_BinaryNumber', 'magenta:bg' }, { 'Lang_Punctuation', 'white:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'green:bg' }, { 'Lang_Function', 'green:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'red:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'Editor_Default' }, { 'Markup_Punctuation', 'white:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'gray:bg' }, { 'Markup_Tag', 'yellow:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'white:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'green:bg' }, { 'Markup_Math', 'white:bg' }, # diff/diff3 { 'DIFF_Old', 'gray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'magenta:bg' }, { 'MERGE_Old', 'yellow:bg' }, { 'MERGE_New', 'cyan:bg' }, { 'MERGE_Control', 'white:bg' }, } ./config/m_vi.fte0000644000175000017500000000702607045070413012557 0ustar neilneil does not work at this time. needs fixing # # just an experiment, do not take this seriously :) # mode VIMODE: MODEOPTS { # VI mode key [i] { ChangeKeys 'VI_INS' } key [I] { MoveLineStart; ChangeKeys 'VI_INS' } key [o] { LineAdd; MoveDown; MoveLineStart; ChangeKeys 'VI_INS' } key [O] { LineInsert; MoveLineStart; ChangeKeys 'VI_INS' } key [a] { MoveRight; ChangeKeys 'VI_INS' } key [A] { MoveLineEnd; ChangeKeys 'VI_INS' } key [r] { ToggleInsert; InsertChar; ToggleInsert } key [R] { ChangeKeys 'VI_OVER'; ToggleInsert } key [d] { ChangeKeys 'VI_DELETE' } key [D] { KillToLineEnd } key [y] { ChangeKeys 'VI_YANK' } key [x] { KillChar } key [X] { KillCharPrev } key [h] { MoveLeft } key [j] { MoveDown } key [k] { MoveUp } key [l] { MoveRight } key [$] { MoveLineEnd } key [0] { MoveLineStart } key [^] { MoveFirstNonWhite } key [:] { MainMenu } key [/] { SearchRx } key [n] { SearchAgain } key [P] { BlockPaste } key [p] { MoveRight; BlockPaste } key [B] { MoveWordPrev } key [b] { MoveWordPrev } key [w] { MoveWordNext } key [W] { MoveWordNext } key [c] { ChangeKeys 'VI_CHANGE' } key [C+N] { MoveDown } key [C+P] { MoveUp } key [C+B] { MovePageUp } key [%] { MatchBracket } key [u] { Undo } key [U] { Redo } key [BackSp] { MoveLeft } key [Space] { MoveRight } key [G-Enter] { MoveDown; MoveLineStart } key [-] { MoveUp; MoveLineStart } key [+] { MoveDown; MoveLineStart } key [J] { LineJoin } key [C] { KillToLineEnd; ChangeKeys 'VI_INS' } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [G-C+PgDn] { MoveFileEnd } } mode VI_INS: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE'; MoveLeft } key [G-Enter] { LineNew } key [Space] { InsertSpace } key [BackSp] { KillCharPrev } key [Tab] { InsertTab } } mode VI_OVER: VI_INS { Insert = 0; key [Esc] { ChangeKeys 'VIMODE'; MoveLeft; ToggleInsert } } mode VI_DELETE: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [d] { BlockSelectLine; BlockCut; ChangeKeys 'VIMODE' } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCut; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VIMODE' } } mode VI_CHANGE: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VI_INS' } key [$] { KillToLineEnd; ChangeKeys "VI_INS" } key [c] { MoveLineStart; KillToLineEnd; ChangeKeys "VI_INS" } } mode VI_YANK: MODEOPTS { key [Esc] { ChangeKeys 'VIMODE' } key [d] { BlockSelectLine; BlockCopy; ChangeKeys 'VIMODE' } key [$] { BlockUnmark; BlockMarkStream; MoveLineEnd; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [0] { BlockUnmark; BlockMarkStream; MoveLineStart; BlockMarkStream; BlockCopy; MovePrevPos; ChangeKeys 'VIMODE' } key [w] { KillWord; ChangeKeys 'VIMODE' } } ./config/m_ipf.fte0000644000175000017500000000553207530515567012734 0ustar neilneilcolorize IPF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Control', 'Markup_Control' }, }; keyword 'Editor_Keywords' { 'acviewport', 'artlink', 'eartlink', 'artwork', 'caution', 'ecaution', 'cgraphic', 'ecgraphic', 'color', 'ctrl', 'ctrldef', 'ectrldef', 'ddf', 'docprof', 'fig', 'efig', 'figcap', 'font', 'fn', 'efn', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hp1', 'ehp1', 'hp2', 'ehp2', 'hp3', 'ehp3', 'hp4', 'ehp4', 'hp5', 'ehp5', 'hp6', 'ehp6', 'hp7', 'ehp7', 'hp8', 'ehp8', 'hp9', 'ehp9', 'i1', 'i2', 'hide', 'ehide', 'icmd', 'isyn', 'lines', 'elines', 'link', 'elink', 'lm', 'note', 'nt', 'ent', 'p', 'pbutton', 'rm', 'title', 'userdoc', 'euserdoc', 'warning', 'ewarning', 'xmp', 'exmp', 'dl', 'edl', 'dthd', 'ddhd', 'dt', 'dd', 'li', 'lp', 'ol', 'eol', 'parml', 'eparlm', 'pt', 'pd', 'sl', 'esl', 'table', 'etable', 'row', 'c', 'ul', 'eul', }; keyword 'Editor_Keywords2' { 'dll', 'objectname', 'objectinfo', 'objectid', 'vpx', 'vpy', 'vpcx', 'vpcy', 'name', 'align', 'linkfile', 'runin', 'fit', 'text', 'fc', 'bc', 'ctrlid', 'controls', 'page', 'coverpage', 'res', 'compact', 'tsize', 'break', 'toc', 'ctrlarea', 'facename', 'size', 'codepage', 'id', 'global', 'tutorial', 'x', 'y', 'width', 'height', 'group', 'viewport', 'clear', 'titlebar', 'scroll', 'rules', 'nosearch', 'noprint', 'hide', 'ctrlrefid', 'key', 'roots', 'sortkey', 'refid', 'root', 'reftype', 'database', 'object', 'data', 'auto', 'dependent', 'split', 'margin', 'break', 'cols', 'rules', 'frame', 'face', 'left', 'right', 'center', 'index', }; h_state 0 { 'Normal' } h_trans { 1, '^<', '.', 'Control' } h_trans { 2, '<', ':', 'Tag' } h_trans { 3, '<', '&', 'Symbol' } h_state 1 { 'Control' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Tag' } h_trans { 5, '-s', 'a-zA-Z_', 'Tag' } h_trans { 0, '>', '.', 'Tag' } h_trans { 4, '<', '\'', 'String' } h_state 3 { 'Symbol' } h_trans { 0, '>', '.', 'Symbol' } h_state 4 { 'String' } h_trans { 2, '>', '\'', 'String' } h_state 5 { 'Tag' } h_trans { 2, '$', '', 'Tag' } h_wtype { 2, 2, 2, '', 'a-zA-Z0-9_' } } mode IPF: PLAIN { # .IPF files FileNameRx = /\.\cIPF$/; HilitOn = 1; Colorizer = 'IPF'; MultiLineHilit = 1; RoutineRegexp = ':[Hh]\\d\\.'; SaveFolds = 1; # save fold info at beginning of line CommentStart = '.*'; CommentEnd = ''; } ./config/ui_ne.fte0000644000175000017500000000040107045070510012710 0ustar neilneil# NE include 'ui_m_ne.fte'; include 'ui_k_ne.fte'; include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; ./config/ui_brief.fte0000644000175000017500000000045407045070423013410 0ustar neilneil# Brief (work in progress) include 'ui_m_fte.fte'; # TODO include 'k_brief.fte'; # incomplete include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; ./config/m_idl.fte0000644000175000017500000000245007203604605012707 0ustar neilneil# IDL mode - Don Mahurin colorize IDL { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'struct', 'typedef', 'int', 'enum', 'char', 'void', 'long', 'const', 'float', 'short', 'union', 'double', 'public', 'signed', 'static', 'private', 'virtual', 'unsigned', 'bool', }; } mode IDL: C { # IDL Mode FileNameRx = /\.\c{IDL}$/; HilitOn = 1; Colorizer = 'IDL'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/m_bin.fte0000644000175000017500000000173507045070351012713 0ustar neilneilmode BIN: PLAIN { # Binary Mode # FileNameRx = /\.\c{EXE}|{DLL}|{LIB}|{OBJ}|{BIN}|{ZIP}|{TAR}|{Z}|{GZ}|{COM}$/; # OBJ is file for Alias Wavefront FileNameRx = /\.\c{EXE}|{DLL}|{LIB}|{BIN}|{ZIP}|{TAR}|{Z}|{GZ}|{COM}$/; FirstLineRx = /[^\r\n\t -\xFF]/; HilitOn = 0; AutoIndent = 0; ShowTabs = 1; DetectLineSep = 0; StripChar = -1; LineChar = -1; AddCR = 0; AddLF = 0; ExpandTabs = 0; ForceNewLine = 0; TabSize = 8; LoadMargin = 64; SpaceTabs = 0; BackSpKillTab = 1; DeleteKillTab = 1; BackSpUnindents = 0; Trim = 0; ShowMarkers = 1; WordWrap = 0; MatchCase = 1; ReadOnly = 1; MultiLineHilit = 0; AutoHilitParen = 0; Abbreviations = 0; } ./config/color.fte0000644000175000017500000000443007446664511012754 0ustar neilneilobject ScrollBar { color { { 'Arrows', 'ScrollBar_Arrows' }, { 'Back', 'ScrollBar_Background' }, { 'Fore', 'ScrollBar_Slider' }, }; } object Status { color { { 'Normal', 'Status_Normal' }, { 'Active', 'Status_Active' }, }; } object Message { color { { 'Normal', 'Message_Normal' }, { 'Bold', 'Message_Bold' }, { 'Error', 'Message_Error' }, }; } object Entry { color { { 'Field', 'EntryField_Field' }, { 'Prompt', 'EntryField_Prompt' }, { 'Selection', 'EntryField_Selection' }, }; } object LIST { color { { 'Status', 'List_Status' }, { 'Normal', 'List_Normal' }, { 'Selected', 'List_Selected' }, { 'Hilited', 'List_Hilited' }, { 'HilitSelect', 'List_HilitSelect' }, { 'Marked', 'List_Marked' }, { 'MarkSelect', 'List_MarkSelect' }, { 'MarkHilit', 'List_MarkHilit' }, { 'MarkHilitSel', 'List_MarkHilitSel' }, }; } object ASCII { color { { 'Chars', 'ASCII_Chars' }, }; } object Menu { color { { 'Background', 'Menu_Background' }, { 'ActiveItem', 'Menu_ActiveItem' }, { 'ActiveChar', 'Menu_ActiveChar' }, { 'NormalItem', 'Menu_NormalItem' }, { 'NormalChar', 'Menu_NormalChar' }, }; } object Choice { color { { "Title", 'Choice_Title' }, { "Param", 'Choice_Param' }, { "Background", 'Choice_Background' }, { "ActiveItem", 'Choice_ActiveItem' }, { "ActiveChar", 'Choice_ActiveChar' }, { "NormalItem", 'Choice_NormalItem' }, { "NormalChar", 'Choice_NormalChar' }, }; } object PLAIN { color { { 'Background', 'Editor_Default' }, { 'Selected', 'Editor_Selected' }, { 'Markers', 'Editor_Markers' }, { 'Found', 'Editor_FoundText' }, { 'Keyword', 'Editor_Keywords' }, { 'Folds0', 'Editor_Folds0' }, { 'Folds1', 'Editor_Folds1' }, { 'Folds2', 'Editor_Folds2' }, { 'Folds3', 'Editor_Folds3' }, { 'Folds4', 'Editor_Folds4' }, { 'HilitWord', 'Editor_HilitWord' }, }; } ./config/m_text.fte0000644000175000017500000000022307045070411013113 0ustar neilneil mode TEXT: PLAIN { # Text files (wordwrap) FileNameRx = /\.\c{TXT}|{DOC}$/; # try also 1 WordWrap = 2; } ./config/ui_k_joe.fte0000644000175000017500000000273307453316165013423 0ustar neilneil# # My basic joe like keybindings # # Copyright (C) 2002 Elrond # # The GNU General Public License applies. # eventmap MODEL { key [C+C] { FileClose } } eventmap PLAIN: MODEL { key [C+S-_] { Undo } key [C+^] { Redo } key [C+A] { MoveLineStart } key [C+C] { FileClose } key [C+D] { Delete } key [C+E] { MoveLineEnd } key [C+G] { MatchBracket } # key [C+K_/] { Filter_Block_Through_Command } key [C+K_Space] { ShowPosition } # joe shows more useful information key [C+K_.] { BlockIndent } key [C+K_,] { BlockUnindent } key [C+K_a] { LineCenter; MoveDown } key [C+K_b] { BlockBegin } key [C+K_c] { BlockCopy; BlockPaste } key [C+K_e] { FileOpen } key [C+K_f] { Find } # key [C+K_g] { make_win_greater } key [C+K_h] { BlockUnmark } # joe: help # key [C+K_i] { show_all_windows / show_one_window } # key [C+K_j] { fmtblk } key [C+K_k] { BlockEnd } key [C+K_C+K] { BlockEnd } key [C+K_l] { MoveToLine } key [C+K_m] { BlockCut; BlockPaste } key [C+K_C+M] { BlockCut; BlockPaste } key [C+K_n] { WinNext } # key [C+K_o] { Splitwindow } key [C+K_p] { WinPrev } key [C+K_r] { BlockRead } key [C+K_s] { FileSave } # key [C+K_t] { make_win_tinyer } key [C+K_u] { MoveFileStart } key [C+K_v] { MoveFileEnd } key [C+K_w] { BlockWrite } key [C+K_x] { FileCloseAll; } # Should not ask to save... key [C+K_y] { BlockKill } # or KillBlock ? key [C+L] { FindRepeat } key [C+Q_a] { FindReplace } key [C+Q_f] { Find } } ./config/m_ruby.fte0000644000175000017500000000606107406710201013115 0ustar neilneilcolorize Ruby { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, { 'Regexp', 'Lang_Regexp' }, }; keyword 'Editor_Keywords' { 'if', 'else', 'elsif', 'while', 'case', 'when', 'unless', 'until', 'for', 'in', 'loop', 'then', 'do', 'return', 'break', 'next', 'redo', 'retry', 'rescue', 'ensure', 'def', 'begin', 'end', 'yield', 'proc', 'class', 'module', 'nil', 'TRUE', 'true', 'FALSE', 'false', 'self', 'super', '__LINE__', '__FILE__', 'not', 'or', 'and', 'defined', 'undef', 'attr_reader', 'attr_writer', 'attr_accessor', 'alias', 'include', 'load', 'require' }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '#', 'Comment' } h_trans { 1, '^', '=begin', 'Comment' } # h_trans { 1, '', '//', 'Comment' } h_trans { 3, '', '"', 'String' } h_trans { 4, '', '\'', 'String' } h_trans { 6, 's', '0-9', 'Number' } h_trans { 7, '', '/', 'String' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } # single line comment h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Comment' } # multiline comment h_trans { 0, '^', '=end', 'Comment' } h_state 3 { 'String' } # Single quote h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 4 { 'String' } # Double quote h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } # h_trans { 0, '', '[a-zA-Z_][a-zA-Z0-9_]*', 'Function' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Regexp' } # Regular Expressions h_trans { 7, '', '\\/', 'Regexp' } h_trans { 0, 's', '/', 'String' } } mode Ruby: PLAIN { # Ruby mode FileNameRx = '\\.{rb}|{ruby}$'; Colorizer = 'Ruby'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; TabSize = 8; SpaceTabs = 1; MatchCase = 1; Trim = 1; MultiLineHilit = 0; AutoHilitParen = 1; RoutineRegexp = /^\s*{def}\s/; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } ./config/ab_c_os2.fte0000644000175000017500000000253007045070336013273 0ustar neilneil# abbreviations for OS/2 api. eventmap C { abbrev 'wswp' 'WinSetWindowPos'; abbrev 'wcsw' 'WinCreateStdWindow'; abbrev 'wrc' 'WinRegisterClass'; abbrev 'wdwp' 'WinDefWindowProc'; abbrev 'wdw' 'WinDestroyWindow'; abbrev 'wir' 'WinInvalidateRect'; abbrev 'wbp' 'WinBeginPaint'; abbrev 'wdb' 'WinDrawBitmap'; abbrev 'wdt' 'WinDrawText'; abbrev 'wep' 'WinEndPaint'; abbrev 'wi' 'WinInitialize'; abbrev 'wt' 'WinTerminate'; abbrev 'wsm' 'WinSendMsg'; abbrev 'wpm' 'WinPostMsg'; abbrev 'MR' 'MRESULT'; abbrev 'MP' 'MPARAM'; # MPFROMxxx abbrev 'MPV' 'MPVOID'; abbrev 'MPP' 'MPFROMP'; abbrev 'MPHW' 'MPFROMHWND'; abbrev 'MPC' 'MPFROMCHAR'; abbrev 'MPS' 'MPFROMSHORT'; abbrev 'MPS2' 'MPFROMSHORT2'; abbrev 'MPL' 'MPFROMLONG'; # xxxFROMMP abbrev 'PMP' 'PVOIDFROMMP'; abbrev 'HWMP' 'HWNDFROMMP'; abbrev 'C1MP' 'CHAR1FROMMP'; abbrev 'C2MP' 'CHAR2FROMMP'; abbrev 'C3MP' 'CHAR3FROMMP'; abbrev 'C4MP' 'CHAR4FROMMP'; # MRFROMxxx abbrev 'MRP' 'MRFROMP'; abbrev 'MRS' 'MRFROMSHORT'; abbrev 'MR2S' 'MRFROM2SHORT'; abbrev 'MRL' 'MRFROMLONG'; # xxxFROMMR abbrev 'PMR' 'PVOIDFROMMR'; abbrev 'S1MR' 'SHORT1FROMMR'; abbrev 'S2MR' 'SHORT2FROMMR'; abbrev 'LMR' 'LONGFROMMR'; } ./config/ui_mew.fte0000644000175000017500000007645210376157260013132 0ustar neilneil# mew_ui.fte # FTE configuration file to mimic the Multi Edit for Windows UI # # Basic Commands (Global) #FOLD00 menu Window { #FOLD01 item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Help { #FOLD01 item "&Keyboard" { ViewModeMap } item; item "&About..." { ShowVersion } } eventmap MODEL { #FOLD01 key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } # key [C+F4] { WinHSplit } key [S+F4] { WinPrev } # key [C+F4] { WinClose } key [A+Z] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F4] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [C+G-Up] { WinPrev } key [C+G-Down] { WinNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { FileSaveAll; Compile "make"; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [C+F6] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } # List Viewers #FOLD00 eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollLeft } key [C+G-Right] { ScrollRight } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } # Directory Browser #FOLD00 menu Directory { #FOLD01 item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { #FOLD01 item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { #FOLD01 submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { #FOLD01 MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } key [A+T] { MainMenu 'T' } } # Buffer List #FOLD00 eventmap BUFFERS: MLIST { key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List #FOLD00 eventmap ROUTINES: MLIST { key [Esc] { FileClose } } # Message List #FOLD00 menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Event Map View #FOLD00 eventmap EVENTMAPVIEW: MLIST { key [Esc] { FileClose 0 } } # Editor - Editing Modes #FOLD00 # PLAIN #FOLD01 # menus #FOLD02 menu MChangeMode { #FOLD03 item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } item "4&GL" { ChangeMode 'GL' } } menu MOpenInMode { #FOLD03 item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } item "4&GL" { FileOpenInMode 'GL' } } menu File { #FOLD03 item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } # OpenDoc UI Guide recomments using Write To only, not Save As, hmm. item "Save &As...\tCtrl+F2" { FileSaveAs } item "Save Al&l" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F4" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { #FOLD03 item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Enter" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Append\tAlt+Ins" { BlockCopyAppend } item "Cut a&nd Append\tCtrl+Num-" { BlockCutAppend } item "&Paste\tShift+Ins" { BlockPasteStream } # item; # item "&Insert line\tShift+Enter" { LineInsert } # item "&Delete line\tAlt+Shift+BackSp" { KillLine } # item "&Split line\tCtrl+Enter" { LineSplit } # item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } # item; # item "&Quote Literal...\tCtrl+Q" { InsertChar } } menu Translate { #FOLD03 item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { #FOLD03 item "&Delete Block\tCtrl+F8" { BlockKill } item; item "Save &Block to Disk...\tShift+F2" { BlockWrite } item "&Indent\tAlt+F3" { BlockIndent } item "&Unindent\tAlt+F2" { BlockUnindent } item; item "Mark &Lines of Text\tF7" { BlockMarkLine } item "Mark &Stream of Text\tCtrl+F7" { BlockMarkStream } item "Mark C&olumns of Text\tShift+F7" { BlockMarkColumn } item "Turn Marking O&ff\tEsc" { BlockUnmark } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; item "Sor&t" { BlockSort } item "Sort Re&verse" { BlockSortReverse } submenu "Translat&e", Translate; } menu Search { #FOLD03 item "&Search...\tF5" { Find } item "Search and &Replace...\tShift+F5" { FindReplace } item "&Again\tCtrl+F5" { FindRepeat } item "&Incremental Search\tAlt+I" { IncrementalSearch } item "Repeat last find re&verse\tCtrl+Shift+F5" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "Search Prev Word\tAlt+," { SearchWordPrev } item "Search Next Word\tAlt+." { SearchWordNext } item "&Highlight Current Word\tAlt+/" { HilitWord } item "Goto Line &Number...\tAlt+F5" { MoveToLine } } menu Fold { #FOLD03 item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { #FOLD03 submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { FileSaveAll; Compile "make" } item "&Grep" { Compile "grep -n " } item; item "&Shell\tAlt+F9" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SVN\tC+O_C+N", MSvn; item; submenu "Customi&ze", Options; } menu Text { submenu "C&ollapse...", Fold; } menu Main { #FOLD03 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "&Text", Text; submenu "&Macro", Macro; submenu "T&ools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu Local { #FOLD03 item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } eventmap PLAIN: MODEL { #FOLD02 # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu #------------------------------------------------------------------- # # The first section implements the keys promised by the menus # #---- The FILE menu key [F3] { FileOpen } key [C+F3] { FileOpenInMode } key [S+F3] { FileReload; WinRefresh } key [F2] { FileSave } key [C+F2] { FileSaveAs } key [C+F4] { FileClose } #---- The EDIT menu key [A+BackSp] { Undo } key [A+Enter] { Redo } key [S+G-Del] { BlockCut } key [C+G-Ins] { BlockCopy } key [A+G-Ins] { BlockCopyAppend } key [C+G+-] { BlockCutAppend } key [S+G-Ins] { BlockPasteStream } #---- The BLOCK menu key [C+F8] { BlockKill } key [A+F3] { BlockIndent } key [A+F2] { BlockUnindent } key [F7] { BlockMarkLine } key [C+F7] { BlockMarkStream } key [S+F7] { BlockMarkColumn } key [Esc] { BlockMarkStream; BlockUnmark } #---- The SEARCH menu key [F5] { Find } key [S+F5] { FindReplace } key [C+F5] { FindRepeat } key [A+I] { IncrementalSearch } key [A+F5] { MoveToLine } #---- The TEXT menu #---- The MACRO menu #---- The TOOLS menu #---- The WINDOW menu #---- The HELP menu key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } #------------------------------------------------------------------- key [A+S-F2] { FileSave; FileClose } # key [F7] { BlockBegin } # key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+S+BackSp] { KillLine } key [C+G-Del] { KillWord } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } key [C+S+F5] { FindRepeatReverse } key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+M] { DirOpen } key [C+N] { FindRepeatOnce } key [C+Q] { InsertChar } key [C+T] { KillWord } key [C+Y] { KillLine } key [C+E] { LineTrim } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [S+F2] { BlockWrite } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_S-M] { ChangeMode } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } # set margin to current cursor pos key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_G-Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } # key [A+,] { GetPMClip } # key [A+.] { PutPMClip } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } # key [G+*] { LineInsert ; MoveUp; ScrollUp } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } # key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [C+K] { ShowKey } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } mode PLAIN { EventMap = 'PLAIN'; } # C #FOLD01 menu Local_C { #FOLD02 item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tCtrl+F10" { FileClose } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C: PLAIN { #FOLD02 LocalMenu = 'Local_C'; # local menu key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } key [A+\\] { BlockReIndent } # do some smart indents key [A+G-Enter] { LineAdd; LineIndent } key [S+G-Enter] { LineInsert; LineIndent } } mode C { #FOLD02 EventMap = 'C'; } # REXX #FOLD01 eventmap REXX: PLAIN { #FOLD02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [:] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode REXX { EventMap = 'REXX'; } #FOLD02 # PERL #FOLD01 eventmap PERL: PLAIN { #FOLD02 key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } mode PERL { EventMap = 'PERL'; } #FOLD02 # JAVA #FOLD01 eventmap JAVA: PLAIN { #FOLD02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } mode JAVA { EventMap = 'JAVA'; } #FOLD02 # HTML #FOLD01 menu HTML_Physical { #FOLD02 item "&Bold \tC-E C-B" { HTML_B } item "&Italic \tC-E C-I" { HTML_I } item "&Typewriter \tC-E C-T" { HTML_TT } } menu HTML_Logical { #FOLD02 item "&Definition \tC-E C-D" { HTML_DFN } item "&Emphasize \tC-E C-E" { HTML_EM } item "Citati&on \tC-E C-O" { HTML_CITE } item "&Code \tC-E C-C" { HTML_CODE } item "&Kbd entry \tC-E C-K" { HTML_KBD } item "Sam&ple msg \tC-E C-M" { HTML_SAMP } item "&Strong EM \tC-E C-S" { HTML_STRONG } item "&Variable \tC-E C-V" { HTML_VAR } } menu HTML_Header { #FOLD02 item "&1

      \tC-E 1" { HTML_H1 } item "&2

      \tC-E 2" { HTML_H2 } item "&3

      \tC-E 3" { HTML_H3 } item "&4

      \tC-E 4" { HTML_H4 } item "&5

      \tC-E 5" { HTML_H5 } item "&6
      \tC-E 6" { HTML_H6 } } menu HTML_List { #FOLD02 item "List &item
    1. \tC-E i" { HTML_LI } item "&Unordered list \tC-E u" { HTML_UL } item "&Ordered list
        \tC-E o" { HTML_OL } item "Definition &list
        \tC-E l" { HTML_DL } item "Definition &tag
        \tC-E t" { HTML_DT } item "&Definition
        \tC-E d" { HTML_DD } } menu HTML_Table { #FOLD02 item "&Table
    2. C-E A-C" { HTML_CAPTION } item "&Header
      C-E A-H" { HTML_TH } item "&Row
      C-E A-D" { HTML_TD } } menu HTMLTags { #fold02 item "&Paragraph

      C-E C-P " { HTML_P } item "Line brea&k
      C-E Enter" { HTML_BR } item "Horiz.line


      C-E &- " { HTML_HR } item; submenu "P&hysical styles ", HTML_Physical; submenu "Logical &styles ", HTML_Logical; submenu "&Header ", HTML_Header; submenu "&Lists ", HTML_List; submenu "&Tables ", HTML_Table; item; item "Pre&formatted
           C-E C-F  " { HTML_PRE }
          item    "&Centered      
      C-E . " { HTML_CENTER } item; item "Anchor &Name C-E C-N " { HTML_ANAME } item "Anchor H&Ref C-E C-H " { HTML_AHREF } item; item "Basic document C-E &0 " { HTML_Base } } menu Main_HTML { #fold02 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML: PLAIN { #fold02 MainMenu = "Main_HTML"; # menu for menubar key [C+E_0] { HTML_Base } # headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } # physical key [C+E_C+B] { HTML_B } key [C+E_C+I] { HTML_I } key [C+E_C+T] { HTML_TT } # logical key [C+E_C+D] { HTML_DFN } key [C+E_C+E] { HTML_EM } key [C+E_C+O] { HTML_CITE } key [C+E_C+C] { HTML_CODE } key [C+E_C+K] { HTML_KBD } key [C+E_C+M] { HTML_SAMP } key [C+E_C+S] { HTML_STRONG } key [C+E_C+V] { HTML_VAR } # lists key [C+E_i] { HTML_LI } key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_d] { HTML_DD } # tables key [C+E_A+T] { HTML_TABLE } key [C+E_A+C] { HTML_CAPTION } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # anchors key [C+E_C+N] { HTML_ANAME } key [C+E_C+H] { HTML_AHREF } key [C+E_C+G] { HTML_IMG } key [C+E_C+F] { HTML_PRE } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_.] { HTML_CENTER } key [C+E_C+P] { HTML_P } # character escapes key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_"] { InsertString """; } # hilit bug } # make sure proper eventmap is used mode HTML { EventMap = 'HTML'; } #fold02 # FTE #fold01 eventmap FTE: PLAIN { #fold02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } # make sure proper eventmap is used mode FTE { EventMap = 'FTE'; } #fold02 ./config/m_sql.fte0000644000175000017500000001041007530515567012744 0ustar neilneil# # # colorize SQL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, }; keyword 'Editor_Keywords' { # Kosina # 'select', 'where', 'insert', 'into', # 'update', 'from', 'in', 'order', 'by', # 'and', 'or', 'not', 'union', 'distinct', 'join', 'all', # 'group', 'ADD','EXIT','PREPARE', 'ALL','FETCH','PRIMARY', 'ALTER','FILE','PRINT', 'AND','FILLFACTOR','PRIVILEGES', 'ANY','FLOPPY','PROC', 'AS','FOR','PROCEDURE', 'ASC','FOREIGN','PROCESSEXIT', 'AUTHORIZATION','FREETEXT','PUBLIC', 'AVG','FREETEXTTABLE','RAISERROR', 'BACKUP','FROM','READ', 'BEGIN','FULL','READTEXT', 'BETWEEN','GOTO','RECONFIGURE', 'BREAK','GRANT','REFERENCES', 'BROWSE','GROUP','REPEATABLE', 'BULK','HAVING','REPLICATION', 'BY','HOLDLOCK','RESTORE', 'CASCADE','IDENTITY','RESTRICT', 'CASE','IDENTITY_INSERT','RETURN', 'CHECK','IDENTITYCOL','REVOKE', 'CHECKPOINT','IF','RIGHT', 'CLOSE','IN','ROLLBACK', 'CLUSTERED','INDEX','ROWCOUNT', 'COALESCE','INNER','ROWGUIDCOL', 'COLUMN','INSERT','RULE', 'COMMIT','INTERSECT','SAVE', 'COMMITTED','INTO','SCHEMA', 'COMPUTE','IS','SELECT', 'CONFIRM','ISOLATION','SERIALIZABLE', 'CONSTRAINT','JOIN','SESSION_USER', 'CONTAINS','KEY','SET', 'CONTAINSTABLE','KILL','SETUSER', 'CONTINUE','LEFT','SHUTDOWN', 'CONTROLROW','LEVEL','SOME', 'CONVERT','LIKE','STATISTICS', 'COUNT','LINENO','SUM', 'CREATE','LOAD','SYSTEM_USER', 'CROSS','MAX','TABLE', 'CURRENT','MIN','TAPE', 'CURRENT_DATE','MIRROREXIT','TEMP', 'CURRENT_TIME','NATIONAL','TEMPORARY', 'CURRENT_TIMESTAMP','NOCHECK','TEXTSIZE', 'CURRENT_USER','NONCLUSTERED','THEN', 'CURSOR','NOT','TO', 'DATABASE','NULL','TOP', 'DBCC','NULLIF','TRAN', 'DEALLOCATE','OF','TRANSACTION', 'DECLARE','OFF','TRIGGER', 'DEFAULT','OFFSETS','TRUNCATE', 'DELETE','ON','TSEQUAL', 'DENY','ONCE','UNCOMMITTED', 'DESC','ONLY','UNION', 'DISK','OPEN','UNIQUE', 'DISTINCT','OPENDATASOURCE','UPDATE', 'DISTRIBUTED','OPENQUERY','UPDATETEXT', 'DOUBLE','OPENROWSET','USE', 'DROP','OPTION','USER', 'DUMMY','OR','VALUES', 'DUMP','ORDER','VARYING', 'ELSE','OUTER','VIEW', 'END','OVER','WAITFOR', 'ERRLVL','PERCENT','WHEN', 'ERROREXIT','PERM','WHERE', 'ESCAPE','PERMANENT','WHILE', 'EXCEPT','PIPE','WITH', 'EXEC','PLAN','WORK', 'EXECUTE','PRECISION','WRITETEXT', 'EXISTS', 'GO' }; h_state 0 { 'Normal' } h_trans { 4, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '<', '/*', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '', '*/', 'Comment' } h_state 2 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 3 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } # Kosina h_state 5 { 'Comment' } h_trans { 0, '$', '', 'Normal' } # Kosina h_state 6 { 'String' } h_trans { 0, '>', '\"', 'String' } h_trans { 0, '$', '', 'String' } } mode SQL: PLAIN { # SQL Mode FileNameRx = /\.\cSQL$/; HilitOn = 1; Colorizer = 'SQL'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/ui_fte.fte0000644000175000017500000000061010511004720013056 0ustar neilneil# FTE include 'ui_m_fte.fte'; include 'ui_k_fte.fte'; include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'menu/m_rexx.fte'; include 'menu/m_sgml.fte'; include 'menu/m_rst.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; include 'kbd/k_sgml.fte'; include 'kbd/k_rst.fte'; ./config/pal_gray.fte0000644000175000017500000001245210015224465013421 0ustar neilneil# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'gray:black' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:darkCyan' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:darkCyan' }, { 'List_Normal', 'black:white' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:darkBlue' }, { 'Menu_ActiveItem', 'white:darkCyan' }, { 'Menu_ActiveChar', 'yellow:darkCyan' }, { 'Menu_NormalItem', 'white:darkBlue' }, { 'Menu_NormalChar', 'yellow:darkBlue' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'black:gray' }, # background { "fg", 'black:gray' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'darkGreen:bg' }, { 'Editor_Folds1', 'darkBlue:bg' }, { 'Editor_Folds2', 'darkMagenta:bg' }, { 'Editor_Folds3', 'darkMagenta:bg' }, { 'Editor_Folds4', 'darkMagenta:bg' }, { 'Editor_HilitWord', 'darkRed:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'darkCyan:bg' }, { 'Editor_Keywords', 'red:bg' }, { 'Editor_Keywords2', 'green:bg' }, { 'Editor_Keywords3', 'darkGreen:bg' }, { 'Editor_Keywords4', 'brown:bg' }, { 'Editor_Keywords5', 'darkBlue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'darkBlue:bg' }, { 'String', 'blue:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'blue:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'Lang_Number' }, { 'Lang_OctalNumber', 'Lang_Number' }, { 'Lang_BinaryNumber', 'Lang_Number' }, { 'Lang_Punctuation', 'Editor_Default' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkMagenta:bg' }, { 'Lang_Function', 'darkBlue:bg' }, { 'Lang_Label', 'darkRed:bg' }, { 'Lang_Command', 'darkGreen:bg' }, { 'Lang_Regexp', 'darkMagenta:bg' }, { 'Lang_Variable', 'darkBlue:bg' }, { 'Lang_Control', 'cyan:bg' }, { 'Lang_Assembler', 'darkBlue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'Editor_Default' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'darkGray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkRed:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'darkGray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ./config/ui_m_ws.fte0000644000175000017500000003332311326137317013272 0ustar neilneil# Basic Commands (Global) menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } item; item "Sh&ell\tAlt+F9" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SV&N\tC+O_C+N", MSvn; } menu Window { # item "&New " { WinNewFrame } # item; item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tShift+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item "&Next view\tF4" { WinNext } item "&Prev view\tShift+F4" { WinPrev } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } # item "&Shell" { } } menu Help { item "&Keyboard\tF1" { ViewModeMap } item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } # Directory Browser menu Directory { item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } # Message List menu Messages { item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+N" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+Q Ctrl+W" { Find } item "Find and &replace...\tCtrl+Q Ctrl+A" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse" { FindRepeatReverse } item "Repeat last find &once" { FindRepeatOnce } item "Incremental &search\tCtrl+Q Tab" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tCtrl+Q Ctrl+[" { MatchBracket } item "&Goto line...\tCtrl+Q Ctrl+J" { MoveToLine } } menu Fold { item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } ./config/ui_k_ws.fte0000644000175000017500000003410410376157260013271 0ustar neilneileventmap MODEL { key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F10] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [C+Q_C-S-Q] { FileClose } key [C+G-Up] { WinPrev } key [C+G-Down] { WinNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+Left] { ScrollRight } key [C+Right] { ScrollLeft } key [C+S] { MoveLeft } key [C+D] { MoveRight } key [C+E] { MoveUp } key [C+X] { MoveDown } key [C+R] { MovePageUp } key [C+C] { MovePageDown } key [C+Q_C-S-R] { MoveFileStart } key [C+Q_C-S-C] { MoveFileEnd } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+Enter] { CloseActivate } key [C+N] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+L] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+L] { ChildClose } # does NOT kill, just closes pipe } eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S-F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+K_1] { PlaceBookmark "1" } key [C+K_2] { PlaceBookmark "2" } key [C+K_3] { PlaceBookmark "3" } key [C+K_4] { PlaceBookmark "4" } key [C+K_5] { PlaceBookmark "5" } key [C+K_6] { PlaceBookmark "6" } key [C+K_7] { PlaceBookmark "7" } key [C+K_8] { PlaceBookmark "8" } key [C+K_9] { PlaceBookmark "9" } key [C+K_0] { PlaceBookmark "0" } key [C+Q_1] { GotoBookmark "1" } key [C+Q_2] { GotoBookmark "2" } key [C+Q_3] { GotoBookmark "3" } key [C+Q_4] { GotoBookmark "4" } key [C+Q_5] { GotoBookmark "5" } key [C+Q_6] { GotoBookmark "6" } key [C+Q_7] { GotoBookmark "7" } key [C+Q_8] { GotoBookmark "8" } key [C+Q_9] { GotoBookmark "9" } key [C+Q_0] { GotoBookmark "0" } key [C+A] { MoveWordPrev } key [C+B] { ViewBuffers } key [C+C] { MovePageDown } key [C+D] { MoveRight } key [C+E] { MoveUp } key [C+F] { MoveWordNext } key [C+G] { KillChar } key [C+H] { KillCharPrev } key [C+I] { InsertTab } key [C+J] { LineJoin } key [C+K_C-S-A] { BlockMarkStream } key [C+K_C-S-B] { BlockBegin } key [C+K_C-S-C] { BlockCopy; BlockPaste } key [C+K_C-S-D] { FileSave; FileClose } key [C+K_C-S-E] { FileOpen } key [C+K_C-S-H] { BlockUnmark } key [C+K_C-S-I] { BlockIndent } key [C+K_C-S-K] { BlockEnd } key [C+K_C-S-L] { BlockMarkLine } key [C+K_C-S-M] { BlockMarkColumn } key [C+K_C-S-Q] { FileClose } key [C+K_C-S-R] { BlockRead } key [C+K_C-S-S] { FileSave } key [C+K_C-S-U] { BlockUnindent } key [C+K_C-S-V] { BlockCut; BlockPaste } key [C+K_C-S-W] { BlockWrite } key [C+K_C-S-X] { FileSave; FileClose } key [C+K_C-S-Y] { BlockKill } key [C+L] { FindRepeat } key [C+M] { LineNew } key [C+N] { LineSplit } key [C+P] { InsertChar } key [C+Q_C-S-A] { FindReplace } key [C+Q_C-S-C] { MoveFileEnd } key [C+Q_C-S-D] { MoveLineEnd } key [C+Q_C-S-E] { MovePageStart } key [C+Q_C-S-F] { Find } key [C+Q_C-S-I] { IncrementalSearch } key [C+Q_C-S-J] { MoveToLine } key [C+Q_C-S-L] { Undo } key [C+Q_C-S-R] { MoveFileStart } key [C+Q_C-S-S] { MoveLineStart } key [C+Q_C-S-X] { MovePageEnd } key [C+Q_C-S-Y] { KillToLineEnd } key [C+Q_C-\[] { MatchBracket } key [C+Q_C-\]] { MatchBracket } key [C+R] { MovePageUp } key [C+S] { MoveLeft } key [C+T] { KillWord } key [C+U] { Undo } key [C+V] { ToggleInsert } key [C+W] { ScrollDown } key [C+X] { MoveDown } key [C+Y] { KillLine } key [C+Z] { ScrollUp } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+U] { BlockUnindent } key [A+W] { MainMenu 'W' } key [A+X] { ExitEditor } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_S-M] { ChangeMode } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } # key [A+,] { GetPMClip } # key [A+.] { PutPMClip } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [A+F5] { ShowEntryScreen } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } key [G+*] { LineInsert ; MoveUp; ScrollUp } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [C+Q_Tab] { IncrementalSearch } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } ./config/ab_java.fte0000644000175000017500000000360607660600135013213 0ustar neilneil# Java language templates eventmap JAVA { # these work well for default indentation settings # changes may be necessary if you use different indentation # typical usage would be typing ifx and . # useful command here is which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'swx' { KillWordPrev; %if(BSD_BRACE) InsertString 'switch ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'switch () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case :'; LineIndent; LineNew; InsertString 'break;'; LineIndent; MoveUp; MoveLineEnd; MovePrev; Fail; } abbrev 'dex' { KillWordPrev; InsertString 'default:'; LineIndent; 2:LineNew; InsertString 'break;'; LineIndent; MoveUp; LineIndent; Fail; } } ./config/m_ebnf.fte0000644000175000017500000000162507530515566013066 0ustar neilneilcolorize EBNF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Symbol', 'Lang_Function' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Comment', 'Lang_Comment' }, }; h_state 0 { 'Normal' } h_trans { 1, '', '#', 'Comment' } h_trans { 2, '<', '"', 'String' } h_trans { 0, 's', '.|{}=[]()', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Symbol' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 2, 'Qq', '\\', 'Symbol' } } mode EBNF: PLAIN { FileNameRx = '\\.\\c{EBNF}$'; Colorizer = 'EBNF'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MultiLineHilit = 1; AutoHilitParen = 1; } ./config/ui_k_fte.fte0000644000175000017500000003201311344266036013411 0ustar neilneil eventmap MODEL { key [F1] { ViewModeMap } key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [C+S+F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F7] { Find $Word } key [F10] { MainMenu } key [C+F10] { FileClose } key [C+F9] { RunProgram } key [A+F9] { RunProgram "" } key [S+F10] { LocalMenu } key [A+G-Up] { WinPrev } key [A+G-Down] { WinNext } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } key [A+C+G-Left] { FramePrev } key [A+C+G-Right] { FrameNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+X] { ExitEditor } key [A+Q] { FileClose } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+F5] { ShowEntryScreen } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } key [A+F] { MainMenu 'F' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [A+H] { MainMenu 'H' } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollRight } key [C+G-Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose } key [A+N] { MainMenu 'N' } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [G-Del] { BufListFileClose } key [C+S] { BufListFileSave } key [F2] { BufListFileSave } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [C+C] { ChildClose } # does NOT kill, just closes pipe key [G-Home] { MoveLineStart } key [G-End] { MoveLineEnd } } # Event Map View eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S+F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } # key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } # key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } # key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } # key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } # key [A+G-C+Left] { MovePrevTab } # key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [S-BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+C] { BlockCopy } key [C+V] { BlockPaste } key [C+X] { BlockCut } key [C+Z] { Undo } key [C+S+Z] { Redo } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } #key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+F] { Find } key [C+G] { FindRepeat } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+H] { FindRepeatReverse } key [C+M] { DirOpen } key [C+Q] { InsertChar } key [C+R] { FindReplace } key [C+T] { KillWord } key [C+Y] { KillLine } # key [C+E] { LineTrim } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+G] { BlockCut } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+U] { BlockUnindent } key [C+S] { IncrementalSearch } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_S-M] { ChangeMode } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_C+V] { ShowMenu 'MCvs' } key [C+O_C+N] { ShowMenu 'MSvn' } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } # set margin to current cursor pos key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs ; WinRefresh } key [C+O_C+Tab] { ToggleExpandTabs ; WinRefresh } # Detection Control+Tab is not possible for terminal - so accept shift key [C+O_S+Tab] { ToggleExpandTabs ; WinRefresh } key [C+O_G-Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [C+_] { ShowPosition } key [C+-] { ShowPosition } key [Center] { MoveLineCenter } #key [C+X] { MovePrevPos } key [C+S+A] { ASCIITable } # key [G+*] { LineInsert ; MoveUp; ScrollUp } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } key [C+\]] { TagFindWord } key [C+S+\]] { TagFind } key [C+[] { TagPop } key [A+\]] { TagNext } key [A+[] { TagPrev } key [S+Tab] { InsertTab; LineTrim } } ./config/m_mod3.fte0000644000175000017500000001265407530515567013023 0ustar neilneil#From: Richard Glidden # # I just spent an hour or so configuring FTE to recognize Modula-3. #This file is almost complete (there are two minor bugs - Keywords #immediately following punctuation don't highlight correctly, and #RoutineRegexp isn't set to recognize Procedures unless they start at #column 1), but I thought you'd like a copy of it anyway to include with #FTE. colorize MODULA3 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Lang_Assembler' }, # Pragma }; keyword 'Editor_Keywords' { 'ABS', 'ADDRESS', 'ADR', 'ADRSIZE', 'AND', 'ANY', 'ARRAY', 'AS', 'BEGIN', 'BITS', 'BITSIZE', 'BOOLEAN', 'BRANDED', 'BY', 'BYTESIZE', 'CARDINAL', 'CASE', 'CEILING', 'CHAR', 'CONST', 'DEC', 'DISPOSE', 'DIV', 'DO', 'ELSE', 'ELSIF', 'END', 'EVAL', 'EXCEPT', 'EXCEPTION', 'EXIT', 'EXPORTS', 'EXTENDED', 'FALSE', 'FINALLY', 'FIRST', 'FLOAT', 'FLOOR', 'FOR', 'FROM', 'GENERIC', 'IF', 'IMPORT', 'IN', 'INC', 'INTEGER', 'INTERFACE', 'ISTYPE', 'LAST', 'LOCK', 'LONGREAL', 'LOOP', 'LOOPHOLE', 'MAX', 'METHODS', 'MIN', 'MOD', 'MODULE', 'MUTEX', 'NARROW', 'NEW', 'NIL', 'NOT', 'NULL', 'NUMBER', 'OBJECT', 'OF', 'OR', 'ORD', 'OVERRIDES', 'PROCEDURE', 'RAISE', 'RAISES', 'READONLY', 'REAL', 'RECORD', 'REF', 'REFANY', 'REPEAT', 'RETURN', 'REVEAL', 'ROOT', 'ROUND', 'SET', 'SUBARRAY', 'TEXT', 'THEN', 'TO', 'TRUE', 'TRUNC', 'TRY', 'TYPE', 'TYPECASE', 'TYPECODE', 'UNSAFE', 'UNTIL', 'UNTRACED', 'VAL', 'VALUE', 'VAR', 'WHILE', 'WITH', }; # The following h_states are lengthy, but work VERY well. Unlike the # m_pascal.fte file (which m_modul3.fte is based on), punctuation # colours do not get 'stuck' on Normal text. # BUG: Keywords immediately following punctuation (ie: .IF) do not # highlight. Please add a space between all punctuation and keywords, # for now. h_state 0 { 'Normal' } h_trans { 2, '<', '"', 'String' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '(*', 'Comment' } h_trans { 8, '<', '<*', 'Command' } h_trans { 5, '<', '2_', 'HexNumber' } h_trans { 5, '<', '3_', 'HexNumber' } h_trans { 5, '<', '4_', 'HexNumber' } h_trans { 5, '<', '5_', 'HexNumber' } h_trans { 5, '<', '6_', 'HexNumber' } h_trans { 5, '<', '7_', 'HexNumber' } h_trans { 5, '<', '8_', 'HexNumber' } h_trans { 5, '<', '9_', 'HexNumber' } h_trans { 5, '<', '10_', 'HexNumber' } h_trans { 5, '<', '11_', 'HexNumber' } h_trans { 5, '<', '12_', 'HexNumber' } h_trans { 5, '<', '13_', 'HexNumber' } h_trans { 5, '<', '14_', 'HexNumber' } h_trans { 5, '<', '15_', 'HexNumber' } h_trans { 5, '<', '16_', 'HexNumber' } h_trans { 6, '<-s', '0-9', 'Number' } h_trans { 1, '-s', 'a-zA-Z_', 'Normal' } h_trans { 0, 's', ' ', 'Normal' } h_trans { 7, 'S', '_a-zA-Z0-9 ', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 2 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 3 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'Comment' } h_trans { 0, '>', '*)', 'Comment' } h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Punctuation' } h_trans { 2, '<', '"', 'String' } h_trans { 3, '<', '\'', 'String' } h_trans { 4, '<', '(*', 'Comment' } h_trans { 8, '<', '<*', 'Command' } h_trans { 5, '<', '2_', 'HexNumber' } h_trans { 5, '<', '3_', 'HexNumber' } h_trans { 5, '<', '4_', 'HexNumber' } h_trans { 5, '<', '5_', 'HexNumber' } h_trans { 5, '<', '6_', 'HexNumber' } h_trans { 5, '<', '7_', 'HexNumber' } h_trans { 5, '<', '8_', 'HexNumber' } h_trans { 5, '<', '9_', 'HexNumber' } h_trans { 5, '<', '10_', 'HexNumber' } h_trans { 5, '<', '11_', 'HexNumber' } h_trans { 5, '<', '12_', 'HexNumber' } h_trans { 5, '<', '13_', 'HexNumber' } h_trans { 5, '<', '14_', 'HexNumber' } h_trans { 5, '<', '15_', 'HexNumber' } h_trans { 5, '<', '16_', 'HexNumber' } h_trans { 0, 's', '_a-zA-Z ', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 7, '', '*>', 'Command' } } mode MODULA3: PLAIN { # Modula-3 Mode FileNameRx = /\.\c{m3}|{i3}$/; HilitOn = 1; Colorizer = 'MODULA3'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' (*'; CommentEnd = '*)'; # Needs to be modified to allow PROCEDURE to start anywhere on a line, # not just column 1. RoutineRegexp = '^{PROCEDURE}'; } ./config/pal_base.fte0000644000175000017500000000215607407632676013413 0ustar neilneil# The basic symbol names for all colors. # # written by Elrond # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { # map system colors to symbolic { 'black', '0 0' }, { 'darkBlue', '1 1' }, { 'darkGreen', '2 2' }, { 'darkCyan', '3 3' }, { 'darkRed', '4 4' }, { 'darkMagenta', '5 5' }, { 'brown', '6 6' }, { 'gray', '7 7' }, { 'darkGray', '8 8' }, { 'blue', '9 9' }, { 'green', 'A A' }, { 'cyan', 'B B' }, { 'red', 'C C' }, { 'magenta', 'D D' }, { 'yellow', 'E E' }, { 'white', 'F F' }, } ./config/ui_ws.fte0000644000175000017500000000040307045070520012742 0ustar neilneil# FTE include 'ui_m_ws.fte'; include 'ui_k_ws.fte'; include 'menu/m_c.fte'; include 'menu/m_html.fte'; include 'kbd/k_c.fte'; include 'kbd/k_java.fte'; include 'kbd/k_perl.fte'; include 'kbd/k_rexx.fte'; include 'kbd/k_fte.fte'; include 'kbd/k_html.fte'; ./config/m_fort90.fte0000644000175000017500000001170307530515566013275 0ustar neilneil# FORTRAN-90 mode # Contributed by: Andrew Pitonyak # Operators include +, -, *, /, **, %, // # Comments start with ! and go to the end of the line # Comparison operators <, <=, ==, >, >=, /=, .LT, .LTE., .EQ., .GT.,.GTE., .NE. # Logical operators, .AND., .OR., .NOT. # # I should probably add the things like .EQ. to the keywords, I already # added .OR. and such. # How about a line comment command and then this will be pretty much # finished! # # In Fortran, arrays are accessed with () so you can not assume that # xpy() means that a function call is about to happen, it # could be an # array reference or a substring reference. colorize FORTRAN { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'abs', 'achar', 'acos', 'adjustl', 'adjustr', 'aimag', 'aint', 'all', 'allocatable', 'allocate', 'allocated', '.and.', 'anint', 'any', 'asin', 'assignment', 'associated', 'atan', 'atan2', 'backspace', 'bit_size', 'block', 'blockdata', 'btest', 'call', 'random_number', 'random_seed', 'system_clock', 'call', 'case', 'ceiling', 'char', 'character', 'close', 'cmplx', 'common', 'complex', 'conjg', 'contains', 'continue', 'cos', 'cosh', 'count', 'cshift', 'cycle', 'data', 'date_and_time', 'dble', 'deallocate', 'default', 'digits', 'dim', 'dimension', 'do', 'dot_product', 'double', 'doubleprecision', 'dprod', 'else', 'elseif', 'elsewhere', 'end', 'endblock', 'endblockdata', 'enddo', 'endfile', 'endif', 'endinterface', 'endselect', 'endtype', 'endwhere', 'entry', 'eoshift', 'epsilon', 'equivalence', 'exit', 'exp', 'exponent', 'external', 'file', 'floor', 'format.', 'fraction', 'function', 'go', 'goto', 'huge', 'iachar', 'iand', 'ibclr', 'ibits', 'ibset', 'ichar', 'ieor', 'if', 'implicit', 'in', 'index', 'inout', 'inquire', 'int', 'integer', 'intent', 'interface', 'intrinsic', 'iolength', 'ior', 'ishftc', 'ishift', 'kind', 'lbound', 'len', 'len_trim', 'lge', 'lgt', 'lle', 'llt', 'log', 'log10', 'logical', 'matmul', 'max', 'maxexponent', 'maxloc', 'maxval', 'merge', 'min', 'minexponent', 'minloc', 'minval', 'mod', 'module', 'modulo', 'mvbits', 'namelist', 'nearest', 'nint', 'none', '.not.', 'nullify', 'only', 'open', 'operator', 'optional', '.or.', 'out', 'pack', 'parameter', 'pointer', 'precision', 'present', 'print', 'private', 'procedure', 'product', 'program', 'public', 'radix', 'rangereal', 'read', 'real', 'recursive', 'repeat', 'reshape', 'result', 'return', 'rewrind', 'rrspacing', 'save', 'scale', 'scan', 'select', 'selectcase', 'selected_int_kind', 'selected_real_kind', 'sequence', 'set_exponent', 'shape', 'sign', 'sin', 'sinh', 'size', 'spacing', 'spread', 'sqrt', 'stop', 'subroutine', 'sum', 'tan', 'tanh', 'target', 'then', 'tiny', 'to', 'transfer', 'transpose', 'trim', 'type', 'unbound', 'unpack', 'use', 'verify', 'where', 'while', 'write' }; # Syntax Parser by Marko Macek # not complete, see comments below h_state 0 { 'Normal' } h_trans { 1, '-s', 'a-zA-Z_', 'Normal' } h_trans { 2, '<', '!', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 5, '', '"', 'String' } # how can things be quoted? h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } } mode FORTRAN: PLAIN { FileNameRx = /\.\c{F||{F90}|{F9P}|{FPP}}$/; HilitOn = 1; Colorizer = 'FORTRAN'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' !'; CommentEnd = ''; # ? RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; } ./config/ab_c.fte0000644000175000017500000000357707660600134012522 0ustar neilneil# c language templates eventmap C { # these work well for default indentation settings # changes may be necessary if you use different indentation # typical usage would be typing ifx and . # useful command here is which adds # a new line after the current one, and indents it properly. # in cmode defined as LineAdd; LineIndent; abbrev 'ifx' { KillWordPrev; %if(BSD_BRACE) InsertString 'if ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'if () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; %if(BSD_BRACE) InsertString 'while ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'while () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'swx' { KillWordPrev; %if(BSD_BRACE) InsertString 'switch ()'; MoveLeft; SavePos; MoveRight; LineIndent; LineNew; InsertString '{'; LineIndent; LineNew; %endif %if(1TBS_BRACE) InsertString 'switch () {'; 3:MoveLeft; SavePos; 3:MoveRight; LineIndent; LineNew; %endif InsertString '}'; LineIndent; MoveSavedPos; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case :'; LineIndent; LineNew; InsertString 'break;'; LineIndent; MoveUp; MoveLineEnd; MovePrev; Fail; } abbrev 'dex' { KillWordPrev; InsertString 'default:'; LineIndent; 2:LineNew; InsertString 'break;'; LineIndent; MoveUp; LineIndent; Fail; } } ./config/m_asm370.fte0000644000175000017500000000726307530515566013172 0ustar neilneil# Contributed by: # # Michael Taylor # miket@pcug.org.au Michael_Taylor@splwg.com. # http://www.pcug.org.au/~miket/ colorize ASM370 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; # assembler commands keyword 'Editor_Keywords' { 'a', 'ah', 'al', 'alr', 'ap', 'ar', 'b', 'bal', 'balr', 'bc', 'bcr', 'bct', 'bctr', 'be', 'bh', 'bhe', 'bl', 'ble', 'bne', 'bnh', 'bnl', 'bnlr', 'bnz', 'bnzr', 'br', 'bxhr', 'bxh', 'bxle', 'bxler', 'bzr', 'bz', 'bmr', 'bm', 'bor', 'bo', 'bnor', 'bno', 'bpr', 'bp', 'bnpr', 'bnp', 'c', 'cl', 'clc', 'cli', 'clr', 'clm', 'clcl', 'cp', 'cr', 'cs', 'cds', 'ch', 'cvb', 'cvd', 'd', 'dp', 'dr', 'ed', 'edmk', 'ex', 'ic', 'icm', 'l', 'la', 'lm', 'lr', 'ltr', 'lh', 'lcr', 'lnr', 'lpr', 'm', 'mc', 'mh', 'mp', 'mr', 'mvc', 'mvi', 'mvn', 'mvo', 'mvz', 'n', 'nc', 'ni', 'nr', 'o', 'or', 'oc', 'oi', 'pack', 's', 'sp', 'sr', 'srp', 'st', 'sll', 'srl', 'sh', 'stc', 'stcm', 'stck', 'sth', 'stm', 'spm', 'slda', 'srda', 'sra', 'sla', 'srdl', 'sldl', 'slr', 'sl', 'ts', 'tm', 'tr', 'trt', 'unpk', 'x', 'xr', 'xc', 'xi', 'zap' }; # define storage, define constant keyword 'Editor_Keywords2' { 'ds', 'dc' }; # assembler directives keyword 'Editor_Keywords3' { 'end', 'equ', 'csect', 'dsect', 'ltorg', 'org', 'using', 'drop', 'eject', 'title', 'copy', 'aif', 'anop', 'ago' }; # extended assmebler directives - used by MicroFocus 370 Assembler keyword 'Editor_Keywords4' { 'xdeco', 'xdeci', 'xdump', 'xprnt', 'xread' }; keyword 'Editor_Keywords5' { 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15' }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', '*', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM370: PLAIN { FileNameRx = /\.\c{{CPY}|{MLC}}$/; HilitOn = 1; Colorizer = 'ASM370'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = '*'; CommentEnd = ''; KeepBackups = 0; AutoIndent = 1; Trim = 1; } ./config/m_texi.fte0000644000175000017500000001127107530515567013124 0ustar neilneil# some stuff copied from m_texi.org. # need to add all assembler commands colorize TEXINFO { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Punctuation', 'Markup_Punctuation' }, { 'Special', 'Markup_Special' }, }; keyword 'Editor_Keywords' { # global keywords ... 'TeX{}', 'bullet{}', 'copyright{}', 'dots{}', 'equiv{}', 'error{}', 'expansion{}', 'minus{}', 'point{}', 'print{}', 'result{}', 'today{}', 'AA{}', 'aa{}', 'AE{}', 'ae{}', 'enddots{}', 'equiv{}', 'exclamdown{}', 'L{}', 'l{}', 'expansion{}', }; h_state 0 { 'Normal' } h_trans { 3, '', '%', 'Comment' } h_trans { 3, '', '@c ', 'Comment' } h_trans { 1, '^', '@', 'Keyword' } h_trans { 2, '', '@', 'Keyword' } h_trans { 0, 's', '{}\\', 'Punctuation' } h_state 1 { 'Keyword' } # bol only keywors h_trans { 0, '$', '', 'Normal' } h_trans { 0, 'S', 'a-zA-Z_', 'Special' } h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' } h_words 'Editor_Keywords' { 'appendix', 'appendixsec', 'appendixsections', 'appendixsubsec', 'appendixsubsubsec', 'author', 'bye', 'center', 'contents', 'centerchap', 'chapheading', 'chapter', 'cindex', 'clear', 'defcodeindex', 'defcv', 'deffn', 'defindex', 'defivar', 'defmac', 'defmethod', 'defop', 'defopt', 'defspec', 'deftp', 'deftypfn', 'deftypefun', 'deftypevr', 'deftypevar', 'deffun', 'defvar', 'defvr', 'dircategory', 'direntry', 'display', 'end', 'enumerate', 'enumerate', 'evenfooting', 'evenheading', 'everyfooting', 'everyheading', 'example', 'exdent', 'finalout', 'findex', 'flushleft', 'flushright', 'footnotestyle', 'format', 'ftable', 'group', 'heading', 'headings', 'ifclear', 'ifinfo', 'ifhtml', 'ifset', 'iftex', 'ignore', 'include', 'item', 'item', 'itemize', 'itemize', 'itemx', 'itemx', 'kindex', 'lisp', 'majorheading', 'menu', 'need', 'node', 'noindent', 'oddfooting', 'oddheading', 'page', 'paragraphindent', 'pindex', 'printindex', 'printindex', 'quotation', 'refill', 'section', 'set', 'setchapternewpage', 'setfilename', 'settitle', 'shortcontens', 'smallbook', 'smallexample', 'smalllisp', 'sp', 'strong', 'subheading', 'subsection', 'subsubheading', 'subsubsection', 'subtitle', 'summarycontents', 'syncodeindex', 'synindex', 'table', 'tex', 'thischapter', 'thischaptername', 'thisfile', 'thispage', 'thistitle', 'tindex', 'title', 'titlepage', 'top', 'unnumbered', 'unnumberedsec', 'unnumberedsubsec', 'unnumberedsubsubsec', 'vindex', 'vskip', 'vtable', } h_state 2 { 'Keyword' } h_trans { 0, 'S', 'a-zA-Z_', 'Special' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 4, 0, '->', 'a-zA-Z_{}' } h_state 3 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 4 { 'Keyword' } h_trans { 0, '$', '', 'Normal' } h_wtype { 5, 0, 0, '>', 'a-zA-Z_' } h_words 'Editor_Keywords' { 'value', 'b', 'code', 'file', 'email', 'H', 'cite', 'xref', 'pref', 'ref', 'samp', 'kbd', 'footnote', } h_state 5 { 'Normal' } h_trans { 6, '', '{', 'Punctuation' } h_trans { 0, '', '', 'Normal' } h_state 6 { 'String' } h_trans { 0, '', '}', 'Punctuation' } } mode TEXINFO: PLAIN { FileNameRx = /\.\cTEXI$/; HilitOn = 1; Colorizer = 'TEXINFO'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' %'; CommentEnd = ''; } ./config/global.fte0000644000175000017500000001115511604440303013056 0ustar neilneilobject GLOBAL { # ScreenSizeX = 80; ScreenSizeY = 25; CursorInsertStart = 84; CursorInsertEnd = 100; # % size in ins mode CursorOverStart = 0; CursorOverEnd = 100; # % size in over mode CursorBlink = 0; # set to 1 to have a blinking cursor. SysClipboard = 1; # use system (PM) clipboard if available SelectPathname = 1; # select pathname when asking for file OpenAfterClose = 1; # prompt to load new file after closing last ShowMenuBar = 1; # show main menu bar ShowToolBar = 1; # builtin tool bar (OS/2 PM version only) # 0=none, 1=top 1=bottom of window ShowVScroll = 1; # show vertical scroll bar (text) ShowHScroll = 0; # show horizontal scroll bar (text) WeirdScroll = 0; PMDisableAccel = 0; # disable Alt+Fx PM accelerators DefaultModeName = 'PLAIN'; KeepHistory = 1; # load/save history on entry/exit LoadDesktopOnEntry = 0; # load desktop on fte start (2 = when no files) SaveDesktopOnExit = 0; # save desktop in ExitEditor IgnoreBufferList = 0; # skip buffer list in FileNext/Prev/Last ReassignModelIds = 0; # assign first empty number for newly created buffer RecheckReadOnly = 0; # recheck read only status when trying to modify file (only performed on when read only is set) ShowTildeFilesInDirList = 1; # ignore files ending in ~ when showing the directory list CompletionFilter = /^{\c.+\.o|a|{bak}|{exe}|{lib}|{class}|{jar}|{zip}|{gz}|{tar.gz}|{tgz}}|{.+~}|{CVS}|{SVN}$/; # {obj} file is also ASCII Object File Format for MAYA graphics editor # so it is removed from Completion Filter %if(OS_UNIX) PrintDevice = "|lpr"; %endif %if(!OS_UNIX) PrintDevice = '\\DEV\\PRN'; %endif CompileCommand = 'make '; KeepMessages = 1; CvsCommand = 'cvs'; SvnCommand = 'svn'; %if(OS_UNIX) HelpCommand = "man"; %endif %if(OS_OS2) HelpCommand = "start view.exe"; %endif ScrollBorderX = 0; ScrollBorderY = 0; ScrollJumpX = 8; ScrollJumpY = 1; # smart indentation. C_Indent = 4; C_Continuation = 4; C_BraceOfs = 0; C_CaseOfs = 0; C_CaseDelta = 4; C_ClassOfs = 0; C_ClassDelta = 4; C_ColonOfs = -4; C_CommentOfs = 0; C_CommentDelta = 1; C_FirstLevelWidth = -1; C_FirstLevelIndent = 4; C_ParenDelta = -1; # if this is true (1), function parameters will only indent # as much as C_Continuation says, rather than line up one column # to the right of the '('. FunctionUsesContinuation = 0; REXX_Indent = 4; # REXX_Do_Offset = 0; # GCC - must be first before grep -n # filename:#ln:2: error:.... CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+):(\d+):(\d+):\s({warning}|{error}:.*)$/ }; # filename:#ln: error:.... CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+):(\d+):\s({warning}|{error}:.*)$/ }; # grep -n CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]#):(\d+):(.*)$/ }; # Borland C++ CompileRx = { 1, 2, 3, /^{Error}|{Warning}\s(\S+)\s(\d+):\s(.*)$/ }; # Borland C++ 5.5 command line CompileRx = { 1, 2, 3, /^{Error E}|{Warning W}\d+\s(\S+)\s(\d+):\s(.*)$/ }; # CSet++ CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+):\d+\)(.*)$/ }; # Watcom C++ CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+)\):\x20{Error!}|{Warning!}(.*)$/ }; # xlC (AIX) CompileRx = { 1, 2, 3, /^"([\w:._\-\+\/\\]+)", line (\d+){.\d+}?: (.*)$/ }; # IPF compiler CompileRx = { 1, 2, 3, /^\<([^:]+):(\d+)\> (.*)$/ }; CompileRx = { 1, 2, 3, /^([\w:._\-\+\/\\]+)\((\d+)\)\s*:\s*(.*)$/ }; CompileRx = { 2, 3, 1, /^([^\t]+)\t([^\t]+)\t(\d+)$/ }; CompileRx = { 2, 3, 1, /^\s*at\s*([^\(]+)\(([^\:]+)\:(\d+)\)$/ }; # PAF@design.ru # jikes +E (tested with version 1.18) CompileRx = { 1, 2, 3, /^.*\s([\w._\-\+\/\\]+):(\d+):\d+:\d+:\d+:\s(.*)$/ }; # Ant (javac) CompileRx = { 1, 2, 3, /^.*\s([\w:._\-\+\/\\]+):(\d+):\s(.*)$/ }; # Python interpreter tracebacks CompileRx = { 1, 2, 3, /^\s*File\s+"([\w:._\-\+\/\\]+)",\s+line\s+(\d+)(.*)$/ }; # bash: CompileRx = { 1, 2, 3, /^([\w:._\-\/\\]+): line (\d+):\s(.*)$/ }; # perl: CompileRx = { 2, 3, 1, /^(.*) at ([^ ]+) line ([0-9]+)/ }; CvsIgnoreRx = /^cvs update: Updating /; CvsIgnoreRx = /^cvs server: Updating /; SvnIgnoreRx = /^svn update: Updating /; SvnIgnoreRx = /^svn server: Updating /; } ./config/ui_m_fte.fte0000644000175000017500000004131711344266036013422 0ustar neilneil# FTE default menus menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MA&KE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "&Win Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } item "4&GL" { FileOpenInMode 'GL' } item "PHP" { FileOpenInMode 'PHP' } item "P&ython" { FileOpenInMode 'PYTHON' } item "reST" { FileOpenInMode 'reST' } } menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MA&KE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "&Win Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } item "4&GL" { ChangeMode 'GL' } item "PHP" { ChangeMode 'PHP' } item "P&ython" { ChangeMode 'PYTHON' } item "reST" { ChangeMode 'reST' } } menu MOpenInModeMore { item "ASM" { FileOpenInMode 'ASM' } item "ASM 370 (.CPY,.MLC)" { FileOpenInMode 'ASM370' } item "TCL" { FileOpenInMode 'TCL' } item "Fortran 90" { FileOpenInMode 'FORTRAN' } item "IPF" { FileOpenInMode 'IPF' } item "A51" { FileOpenInMode 'A51' } item "CLARION (.CLW)" { FileOpenInMode 'CLARION' } item "EBFN" { FileOpenInMode 'EBFN' } item "SGML" { FileOpenInMode 'SGML' } item "SIOD (.cscm)" { FileOpenInMode 'SIOD' } item "S&Lang" { FileOpenInMode 'sl' } item "Module 3" { FileOpenInMode 'MODULA3' } item "Tex Info" { FileOpenInMode 'TEXINFO' } item "Diff" { FileOpenInMode 'DIFF' } item "Merge" { FileOpenInMode 'MERGE' } item "Man pages" { FileOpenInMode 'CATBS' } } menu MChangeModeMore { item "ASM" { ChangeMode 'ASM' } item "ASM 370 (.CPY,.MLC)" { ChangeMode 'ASM370' } item "TCL" { ChangeMode 'TCL' } item "Fortran 90" { ChangeMode 'FORTRAN' } item "IPF" { ChangeMode 'IPF' } item "A51" { ChangeMode 'A51' } item "CLARION (.CLW)" { ChangeMode 'CLARION' } item "EBFN" { ChangeMode 'EBFN' } item "SGML" { ChangeMode 'SGML' } item "SIOD (.cscm)" { ChangeMode 'SIOD' } item "S&Lang" { ChangeMode 'sl' } item "Module 3" { ChangeMode 'MODULA3' } item "Tex Info" { ChangeMode 'TEXINFO' } item "Diff" { ChangeMode 'DIFF' } item "Merge" { ChangeMode 'MERGE' } item "Man pages" { ChangeMode 'CATBS' } } menu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; submenu "Open in Mode more..", MOpenInModeMore; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN S&tatus" { RunSvn "status" } item "SVN &Update" { RunSvn "update" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN Lo&g" { RunSvn "log" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile...\tF9" { Compile "make -k " } item "&Grep..." { Compile "grep -n " } item "&Find and grep..." { Compile "find . -iregex \".*\\.\\(c\\|h\\|cpp\\)\" -exec grep -Hn SEARCH {} \\;" } item "Save and &ISpell" { FileSave; RunProgram "ispell " . $FilePath; FileReload } item; item "&Shell\tAlt+F9" { RunProgram "" } item "&Run...\tCtrl+F9" { RunProgram } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item "C&lear Messages" { ClearMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SVN\tC+O_C+N", MSvn; } menu Window { item "New &Frame" { FrameNew } item; item "Split &Horizontal\tCtrl+F4" { WinHSplit } item "&Close view\tShift+Ctrl+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item "&Next view\tF4" { WinNext } item "&Prev view\tShift+F4" { WinPrev } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Help { item "&Keyboard\tF1" { ViewModeMap } item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } menu Navigate { item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } # item; # item '&C:\\' { DirGoto 'H:\\' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; submenu "Open in more", MOpenInModeMore; item "Open &Binary..." { FileOpenInMode 'BIN' } item "Open &Directory\tC+M" { DirOpen } item "&Reload\tShift+F3" { FileReload } item; item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } item; item "Prin&t" { FilePrint } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Line { item "&Insert line\tShift+Enter" { LineInsert } item "&Add line\tAlt+Enter" { LineAdd } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } item "Dup&licate line\tCtrl+D" { LineDuplicate } item "&Delete line\tCtrl+Y" { KillLine } item "&Center line" { LineCenter } item; item "Delete to line &end\tAlt+End" { KillToLineEnd } item "Delete to li&ne start\tCtrl+Sh+BackSp" { KillToLineStart } item; item "Comment\tCtrl+Alt+C" { MoveLineStart; ?FindReplace /^(\s*)/ /\/\/ \1/ "xnc"; MoveDown } item "Uncomment\tCtrl+Alt+U" { MoveLineStart; ?FindReplace /^[\/][\/] / // "xnc"; MoveDown } item; item "&Uppercase" { LineCaseUp } item "&Lowercase" { LineCaseDown } item "&Togglecase" { LineCaseToggle } item "&Rot13" { LineTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { LineTrans } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "Cut&-Append" { BlockCutAppend } item "Copy-Appe&nd" { BlockCopyAppend } item "&Paste Stream\tShift+Ins" { BlockPasteStream } item "Paste Colu&mn\tAlt+Ins" { BlockPasteColumn } item "Paste Li&ne" { BlockPasteLine } item "Cl&ear\tCtrl+Del" { BlockKill } item; submenu "&Line", Line; item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Sh+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item "Mark &Line\tAlt+L" { BlockMarkLine } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Write..." { BlockWrite } item "&Read Stream..." { BlockReadStream } item "Re&ad Column..." { BlockReadColumn } item "Rea&d Line..." { BlockReadLine } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item "E&xpand Tabs" { BlockUnTab } item "&Generate Tabs" { BlockEnTab } item "Sor&t" { BlockSort } item "Sort Re&verse" { BlockSortReverse } } menu Tags { item "&Find word\tCtrl+]" { TagFindWord } item "&Search tag...\tCtrl+Sh+]" { TagFind } item "&Go back\tCtrl+[" { TagPop } item "&Next tag\tAlt+]" { TagNext } item "&Previous tag\tAlt+[" { TagPrev } item; item "&Load tags..." { TagLoad } item "&Clear tags" { TagClear } } menu SearchWords { item "Search &Prev\tAlt+," { SearchWordPrev } item "Search &Next\tAlt+." { SearchWordNext } item "&Highlight\tAlt+/" { HilitWord } } menu Search { item "&Find...\tCtrl+F" { Find } item "Find &Next\tCtrl+G" { FindRepeat } item "Find &Prev\tCtrl+H" { FindRepeatReverse } item "Find and &Replace...\tCtrl+R" { FindReplace } item; item "P&lace Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; submenu "&Tags", Tags; item "&Match Paren\tAlt+-" { MatchBracket } item "&Goto Line...\tAlt+J" { MoveToLine } item "Goto &Column..." { MoveToColumn } submenu "&Words", SearchWords; } menu Fold { item "&Open fold\tCtrl+Gr+" { FoldOpen } item "Open &nested folds\tCtrl+Gr*" { FoldOpenNested } item "Open &all folds\tAlt+Gr*" { FoldOpenAll } item; item "C&lose fold\tCtrl+Gr-" { FoldClose } #item "Close &nested folds\tCtrl+Gray+/" { FoldCloseNested } item "Close all &folds\tAlt+Gr/" { FoldCloseAll } item; item "&Create fold\tAlt+Gr+" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "Create folds at routine&s" { FoldCreateAtRoutines } item; item "&Destroy fold\tAlt+Gr-" { FoldDestroy } item "Destro&y all folds" { FoldDestroyAll } item; item "&Promote\tSh+Gr-" { FoldPromote } item "De&mote\tSh+Gr+" { FoldDemote } item; item "&Toggle\tCtrl+Gr/" { FoldToggleOpenClose } } eventmap PLAIN: MODEL { key [A+\`] { CharCaseToggle ; MoveRight } } menu Toggle { item "Charac&ter case\tA+`" { CharCaseToggle } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Keep backups" { ToggleKeepBackups } item "&Make backups" { ToggleMakeBackups } item "&Backspace Unindents" { ToggleBackSpUnindents } item; item "I&ndent with tabs\tC+O Space" { ToggleIndentWithTabs } item "S&pace tabs" { ToggleSpaceTabs } item "Backspace k&ill tab\tC+O BackSp" { ToggleBackSpKillTab } item "&Delete kill tab\tC+O G+Del" { ToggleDeleteKillTab } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; submenu "Change mode more", MChangeModeMore; submenu "Change C in&dent style", MChangeCIndentStyle; item; submenu "&Toggle", Toggle; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Word wrap\tC+O C+W" { ToggleWordWrap } item; item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Insert tabulator\tS+Tab" { InsertTab } item "File Trim &EOL" { FileTrim; WinRefresh } item "I&ndent block\tAlt+\\" { BlockReIndent; FileTrim; WinRefresh } item "&Print to..." { SetPrintDevice } item; item "Rec&ompile Configuration" { ConfigRecompile } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "I&ndent block\tAlt+\\" { BlockReIndent; FileTrim; WinRefresh } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } ./config/m_php.fte0000644000175000017500000002025307530515567012742 0ustar neilneilcolorize PHP { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Special', 'Lang_Preprocessor' }, { 'Variable', 'Lang_Variable' }, }; keyword 'Editor_Keywords' { 'if', 'else', 'elseif', 'endif', 'while', 'for', 'class', 'extends', 'case', 'switch', 'global', 'function', 'var', 'new', 'break', 'continue', 'require', 'include', 'abs', 'acos', 'array', 'array_keys', 'array_merge', 'array_pop', 'array_push', 'array_shift', 'array_slice', 'array_splice', 'array_unshift', 'array_values', 'array_walk', 'array', 'arsort', 'asin', 'asort', 'aspell_check_raw', 'aspell_check', 'aspell_new', 'aspell_suggest', 'atan', 'atan2', 'base_convert', 'base64_decode', 'base64_encode', 'basename', 'bcadd', 'bccomp', 'bcdiv', 'bcmod', 'bcmul', 'bcpow', 'bcscale', 'bcsqrt', 'bcsub', 'bin2hex', 'bindec', 'ceil', 'chdir', 'checkdate', 'checkdnsrr', 'chgrp', 'chmod', 'chop', 'chown', 'chr', 'chunk_split', 'clearstatcache', 'closedir', 'closelog', 'compact', 'connection_aborted', 'connection_status', 'connection_timeout', 'convert_cyr_string', 'copy', 'cos', 'count', 'crypt', 'current', 'date', 'debugger_off', 'debugger_on', 'decbin', 'dechex', 'decoct', 'delete', 'die', 'dirname', 'diskfreespace', 'dl', 'doubleval', 'each', 'easter_date', 'easter_days', 'echo', 'empty', 'end', 'ereg_replace', 'ereg', 'eregi_replace', 'eregi', 'error_log', 'error_reporting', 'escapeshellcmd', 'eval', 'exec', 'exit', 'exp', 'explode', 'extension_loaded', 'extract', 'fclose', 'feof', 'fgetc', 'fgetcsv', 'fgets', 'fgetss', 'file_exists', 'file', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'flock', 'floor', 'flush', 'fopen', 'fpassthru', 'fputs', 'fread', 'frenchtojd', 'fseek', 'fsockopen', 'ftell', 'function_exists', 'fwrite', 'get_cfg_var', 'get_current_user', 'get_magic_quotes_gpc', 'get_magic_quotes_runtime', 'get_meta_tags', 'getallheaders', 'getdate', 'getenv', 'gethostbyaddr', 'gethostbyname', 'gethostbynamel', 'getimagesize', 'getlastmod', 'getmxrr', 'getmyinode', 'getmypid', 'getmyuid', 'getrandmax', 'getrusage', 'gettimeofday', 'gettype', 'gmdate', 'gmmktime', 'gmstrftime', 'gregoriantojd', 'header', 'hexdec', 'htmlentities', 'htmlspecialchars', 'hw_children', 'hw_childrenobj', 'hw_close', 'hw_connect', 'hw_cp', 'hw_deleteobject', 'hw_docbyanchor', 'hw_docbyanchorobj', 'hw_documentattributes', 'hw_documentbodytag', 'hw_documentcontent', 'hw_documentsetcontent', 'hw_documentsize', 'hw_edittext', 'hw_error', 'hw_errormsg', 'hw_free_document', 'hw_getanchors', 'hw_getanchorsobj', 'hw_getandlock', 'hw_getchildcoll', 'hw_getchildcollobj', 'hw_getchilddoccoll', 'hw_getchilddoccollobj', 'hw_getobject', 'hw_getobjectbyquery', 'hw_getobjectbyquerycoll', 'hw_getobjectbyquerycollobj', 'hw_getobjectbyqueryobj', 'hw_getparents', 'hw_getparentsobj', 'hw_getremote', 'hw_getremotechildren', 'hw_getsrcbydestobj', 'hw_gettext', 'hw_getusername', 'hw_identify', 'hw_incollections', 'hw_info', 'hw_inscoll', 'hw_insdoc', 'hw_insertdocument', 'hw_insertobject', 'hw_modifyobject', 'hw_mv', 'hw_new_document', 'hw_objrec2array', 'hw_outputdocument', 'hw_pconnect', 'hw_pipedocument', 'hw_root', 'hw_unlock', 'hw_who', 'ignore_user_abort', 'implode', 'in_array', 'include', 'intval', 'iptcparse', 'is_array', 'is_dir', 'is_double', 'is_executable', 'is_file', 'is_float', 'is_int', 'is_integer', 'is_link', 'is_long', 'is_object', 'is_readable', 'is_real', 'is_string', 'is_writeable', 'isset', 'jddayofweek', 'jdmonthname', 'jdtofrench', 'jdtogregorian', 'jdtojewish', 'jdtojulian', 'jewishtojd', 'join', 'juliantojd', 'key', 'ksort', 'leak', 'link', 'linkinfo', 'list', 'log', 'log10', 'lstat', 'ltrim', 'mail', 'max', 'md5', 'microtime', 'min', 'mkdir', 'mktime', 'next', 'nl2br', 'number_format', 'octdec', 'opendir', 'openlog', 'ord', 'pack', 'parse_str', 'parse_url', 'passthru', 'pclose', 'pfsockopen', 'phpinfo', 'phpversion', 'pi', 'popen', 'pos', 'pow', 'preg_grep', 'preg_match_all', 'preg_match', 'preg_quote', 'preg_replace', 'preg_split', 'prev', 'print', 'printf', 'putenv', 'quoted_printable_decode', 'quotemeta', 'rand', 'range', 'rawurldecode', 'rawurlencode', 'readdir', 'readfile', 'readgzfile', 'readlink', 'register_shutdown_function', 'rename', 'require', 'reset', 'rewind', 'rewinddir', 'rmdir', 'round', 'rsort', 'sem_acquire', 'sem_get', 'sem_release', 'serialize', 'set_file_buffer', 'set_magic_quotes_runtime', 'set_socket_blocking', 'set_time_limit', 'setcookie', 'setlocale', 'settype', 'shm_attach', 'shm_detach', 'shm_get_var', 'shm_put_var', 'shm_remove_var', 'shm_remove', 'shuffle', 'similar_text', 'sin', 'sizeof', 'sleep', 'sort', 'soundex', 'split', 'sprintf', 'sql_regcase', 'sqrt', 'srand', 'stat', 'str_replace', 'strchr', 'strcmp', 'strcspn', 'strftime', 'strip_tags', 'stripslashes', 'strlen', 'strpos', 'strrchr', 'strrev', 'strrpos', 'strspn', 'strstr', 'strtok', 'strtolower', 'strtoupper', 'strtr', 'strval', 'substr', 'sybase_affected_rows', 'symlink', 'syslog', 'system', 'tan', 'tempnam', 'time', 'touch', 'trim', 'uasort', 'ucfirst', 'ucwords', 'uksort', 'umask', 'uniqid', 'unlink', 'unpack', 'unserialize', 'unset', 'urldecode', 'urlencode', 'usleep', 'usort', 'utf8_decode', 'utf8_encode', 'virtual', 'vm_addalias', 'vm_adduser', 'vm_delalias', 'vm_deluser', 'vm_passwd' }; h_state 0 { 'Special' } h_trans { 9, '>', '', '', '*/', 'Comment' } h_state 2 { 'Comment' } h_trans { 9, '$', '', 'Comment' } h_state 3 { 'String' } h_trans { 9, '>', '"', 'String' } #h_trans { 9, '$', '', 'String' } h_trans { 3, 'qQ', '\\', 'String' } h_state 4 { 'String' } h_trans { 9, '>', '\'', 'String' } #h_trans { 9, '$', '', 'String' } h_trans { 4, 'qQ', '\\', 'String' } h_state 5 { 'Normal' } h_trans { 9, '$', '', 'Normal' } h_wtype { 9, 9, 9, 'i', 'a-zA-Z0-9_' } h_state 6 { 'HexNumber' } h_trans { 9, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 9, '$', '', 'Normal' } h_state 7 { 'Number' } h_trans { 9, '-S', '0-9', 'Normal' } h_trans { 9, '$', '', 'Normal' } h_state 8 { 'Variable' } h_trans { 9, '-S', 'a-zA-Z0-9_\$', 'Variable' } h_state 9 { 'Normal' } h_trans { 8, '<', '$', 'Variable' } h_trans { 5, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '<', '/*', 'Comment' } h_trans { 2, '<', '//', 'Comment' } h_trans { 2, '<', '#', 'Comment' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 10, '<', '`', 'String' } h_trans { 0, '<', '?>', 'Special' } h_trans { 6, '<', '0x', 'HexNumber' } h_trans { 7, '', '`', 'String' } h_trans { 10, 'qQ', '\\', 'String' } } mode PHP: PLAIN { # PHP Mode FileNameRx = /\.\c{PHP3}|{PHP4}|{PHP}|{PHTML}$/; HilitOn = 1; Colorizer = 'PHP'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; RoutineRegexp = '^{class}|{function}'; } ./config/kbd/0000755000175000017500000000000011621703701011656 5ustar neilneil./config/kbd/k_sgml.fte0000644000175000017500000000136007045070524013637 0ustar neilneil# this file defines additional keybindings for SGML mode. # SGML_* macros are defined in ../m_sgml.fte # menus are defined in ../menu/m_sgml.fte # this file is included from ../ui.fte eventmap SGML { key [C+E_0] { SGML_Base } key [C+E_C+B] { SGML_BO } key [C+E_C+I] { SGML_IT } key [C+E_C+P] { SGML_PA } key [C+E_C+S] { SGML_SE } key [C+E_C+C] { SGML_CH } key [C+E_C+R] { SGML_REF } key [C+E_C+X] { SGML_EX } key [C+E_x] { SGML_EX } # character escapes key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_@] { InsertString "©"; } } ./config/kbd/k_html.fte0000644000175000017500000000647707406006665013665 0ustar neilneil# FTE keybindings for editing HTML files # maintained by m_debusk@sourceforge.com # Revision 2001-11-18 # this file defines additional keybindings for HTML mode. # HTML_* macros are defined in ../m_html.fte # menus are defined in ../menu/m_html.fte # this file is included from ../ui.fte eventmap HTML { # Entities key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_"] { InsertString """; } key [C+E_Space] { InsertString " "; } key [C+Space] { InsertString " "; } # HTML Skeleton key [C+E_0] { HTML_Base } # Run the browser key [F9] { HTML_View } # Convert text to HTML key [C+E_x] { HTML_TXT } # Basic Tags ## Document Types key [C+E_A+F] { HTML_DTD_X1F } key [C+E_A+K] { HTML_DTD_X1S } key [C+E_A+N] { HTML_DTD_X1T } ## Headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } ## Other Basic Stuff key [C+E_9] { HTML_BODY } key [C+E_C+Z] { HTML_HTM } key [C+E_C+P] { HTML_P } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_c] { HTML_COMMENT } key [C+E_C] { HTML_COMMENT } # Character Format key [C+E_C+B] { HTML_B } key [C+E_C+S] { HTML_STRONG } key [C+E_C+I] { HTML_I } key [C+E_C+E] { HTML_EM } key [C+E_A+B] { HTML_BIG } key [C+E_A+S] { HTML_SMALL } key [C+E_A+U] { HTML_SUB } key [C+E_A+P] { HTML_SUP } key [C+E_A+O] { HTML_BDO } # Output key [C+E_C+F] { HTML_PRE } key [C+E_C+C] { HTML_CODE } key [C+E_C+T] { HTML_TT } key [C+E_C+K] { HTML_KBD } key [C+E_C+V] { HTML_VAR } key [C+E_C+M] { HTML_SAMP } # Blocks key [C+E_C+Y] { HTML_ACRONYM } key [C+E_C+A] { HTML_ABBR } key [C+E_A+A] { HTML_ADDRESS } key [C+E_C+Q] { HTML_BLOCKQUOTE } key [C+E_A+Q] { HTML_Q } key [C+E_C+O] { HTML_CITE } key [C+E_A+I] { HTML_INS } key [C+E_A+E] { HTML_DEL } # Links key [C+E_C+H] { HTML_AHREF } key [C+E_C+N] { HTML_ANAME } key [C+E_C+L] { HTML_LINK } # Frames key [C+E_7] { HTML_FRAMESET } key [C+E_C+R] { HTML_NOFRAMES } key [C+E_A+F] { HTML_FRAME } # Input # Lists key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_i] { HTML_LI } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_C+D] { HTML_DFN } key [C+E_d] { HTML_DD } # Images key [C+E_C+G] { HTML_IMG } key [C+E_A+M] { HTML_MAP } # Tables key [C+E_A+C] { HTML_CAPTION } key [C+E_A+G] { HTML_COLGROUP } key [C+E_A+T] { HTML_TABLE } key [C+E_b] { HTML_TBODY } key [C+E_f] { HTML_TFOOT } key [C+E_h] { HTML_THEAD } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # Styles key [C+E_A+L] { HTML_STYLE } key [C+E_A+V] { HTML_DIV } key [C+E_C+W] { HTML_SPAN } key [C+E_.] { HTML_CENTER } # Meta Information key [C+E_C+U] { HTML_BASEURL } key [C+E_8] { HTML_HEAD } # Programming key [C+E_C+J] { HTML_OBJECT } } ./config/kbd/k_fte.fte0000644000175000017500000000043607045070523013455 0ustar neilneil# additional keybindings for FTE edit mode # included from ../ui.fte eventmap FTE { key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } ./config/kbd/k_rexx.fte0000644000175000017500000000142607260001336013660 0ustar neilneil# FTE keybindings for REXX mode # enhanced from the original by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 eventmap REXX { key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [:] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } key [C+E_c] { REXX_Comment } # key [C+E_u] { REXX_RexxUtil } # key [C+E_s] { REXX_RxSock } # key [C+E_f] { REXX_RxFTP } # key [C+E_0] { REXX_Heading } # key [C+E_1] { REXX_Do } # key [C+E_2] { REXX_DoWhile } # key [C+E_3] { REXX_DoUntil } # key [C+E_4] { REXX_DoForever } # key [C+E_5] { REXX_If } # key [C+E_6] { REXX_Select } } ./config/kbd/k_perl.fte0000644000175000017500000000056407045070523013643 0ustar neilneil# additional keybindings for PERL mode # included from ../ui.fte eventmap PERL { key [Tab] { LineIndent LineTrim } key [G-Enter] { LineIndent LineNew } key [#] { SelfInsert LineIndent } key [{] { SelfInsert LineIndent } key [}] { SelfInsert LineIndent } key [A+\\] { BlockReIndent } } ./config/kbd/k_rst.fte0000644000175000017500000000325110506730262013504 0ustar neilneil# FTE keybindings for editing reStructuredText files # maintained by: Sergey Pinigin # Revision: 2006-08-29 # # this file defines additional keybindings for RST mode. # RST_* macros are defined in ../m_rst.fte # menus are defined in ../menu/m_rst.fte # this file is included from ../ui_fte.fte eventmap reST { # Sections # Press after input Section name key [C+E_1] { RST_H1 } key [C+E_2] { RST_H2 } key [C+E_3] { RST_H3 } key [C+E_4] { RST_H4 } key [C+E_5] { RST_H5 } key [C+G+Up] { RST_ROLE_EMP } key [C+G+Down] { RST_ROLE_STR } key [C+E_C+L] { RST_ROLE_LIT } key [A+G+Up] { RST_INLINE_EMP } key [A+G+Down] { RST_INLINE_STR } key [C+E_0] { RST_INLINE_INT } key [C+E_9] { RST_INLINE_LIT } key [C+E_C+H] { RST_INLINE_HLINK } key [C+E_C+U] { RST_INLINE_ELINK } key [C+E_C+T] { RST_INLINE_ITAG } key [C+E_C+R] { RST_INLINE_REF } # []_ key [C+E_C+A] { RST_INLINE_REFA } # [#]_ key [C+E_C+\\] { RST_INLINE_REFS } # ||_ key [C+E_A+A] { RST_ADM_ATTE } key [C+E_A+C] { RST_ADM_CAUT } key [C+E_A+D] { RST_ADM_DANG } key [C+E_A+E] { RST_ADM_ERRO } key [C+E_A+H] { RST_ADM_HINT } key [C+E_A+I] { RST_ADM_IMPO } key [C+E_A+N] { RST_ADM_NOTE } key [C+E_A+T] { RST_ADM_TIP } key [C+E_A+W] { RST_ADM_WARN } key [C+E_A+L] { RST_ADM_TITL } key [C+E_A+O] { RST_ADM_ADMO } key [C+E_C+I] { RST_IMAGE } key [C+E_C+F] { RST_FIGURE } # List Enter key [C+Enter] { RST_LISTS_1ENT } } ./config/kbd/k_c.fte0000644000175000017500000000120211331412500013075 0ustar neilneileventmap C { key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; ?LineIndent } key [}] { SelfInsert; ?LineIndent; MoveLeft; ?HilitMatchBracket; MoveRight } key [)] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [\]] { SelfInsert; MoveLeft; ?HilitMatchBracket; MoveRight } key [:] { SelfInsert; ?LineIndent } key [#] { SelfInsert; ?LineIndent } key [A+\\] { BlockReIndent; WinRefresh } # do some smart indents key [A+G-Enter] { LineAdd; LineIndent } key [S+G-Enter] { LineInsert; LineIndent } } ./config/kbd/k_java.fte0000644000175000017500000000072207342601307013616 0ustar neilneil# additional keybindings for JAVA mode # included from ../ui.fte eventmap JAVA { key [C+E_0] { JAVA_Base } key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } key [:] { SelfInsert; LineIndent } key [#] { SelfInsert; LineIndent } key [A+\\] { BlockReIndent } } ./config/ab_sh.fte0000644000175000017500000000224407172743547012716 0ustar neilneileventmap SH { abbrev 'ifx' { KillWordPrev; InsertString 'if [ ]'; LineIndent; LineNew; InsertString 'then'; LineIndent; LineNew; InsertString 'fi'; LineIndent; 2:MoveUp; MoveLineEnd; 2:MoveLeft; Fail; # do not insert typed character } abbrev 'fox' { KillWordPrev; InsertString 'for in'; LineIndent; LineNew; InsertString 'do'; LineIndent; LineNew; InsertString 'done'; LineIndent; 2:MoveUp; MoveLineEnd; 3:MoveLeft; Fail; # do not insert typed character } abbrev 'whx' { KillWordPrev; InsertString 'while [ ]'; LineIndent; LineNew; InsertString 'do'; LineIndent; LineNew; InsertString 'done'; LineIndent; 2:MoveUp; MoveLineEnd; 2:MoveLeft; Fail; } abbrev 'cax' { KillWordPrev; InsertString 'case of'; LineIndent; LineNew; InsertString 'esac'; LineIndent; MoveUp; MoveLineEnd; 3:MoveLeft; Fail; } abbrev 'dox' { KillWordPrev; InsertString 'do'; LineIndent; 2:LineNew; InsertString 'done'; LineIndent; MoveUp; LineIndent; MoveLineEnd; Fail; } } ./config/m_a51.fte0000644000175000017500000001121507530515565012535 0ustar neilneil# 8051 assembler mode colorize ASM51 { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'movc', 'movx', 'anl', 'da', 'orl', 'xrl', 'nop', 'add', 'addc', 'subb', 'mul', 'div', 'clr', 'setb', 'cpl', 'xch', 'xchd', 'inc', 'dec', 'rl', 'rlc', 'rrc', }; keyword 'Editor_Keywords3' { 'a', 'acc', 'b', 'dpl', 'dph', 'dptr', 'R0', 'R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'IE', 'IP', 'P0', 'P1', 'P2', 'P3', 'PCON', 'PSW', 'PSW', 'SBUF', 'SCON', 'SP', 'TCON', 'TH0', 'TH1', 'TL0', 'TL1', 'TMOD', 'T2CON', 'TH2', 'TL2', 'RCAP2H', 'RCAP2L', }; keyword 'Editor_Keywords4' { 'SM0', 'SM1', 'SM2', 'REN', 'TB8', 'RB8', 'TI', 'RI', 'E0', 'E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'F0', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'EA', 'ES', 'ET1', 'EX1', 'ET0', 'EX0', 'T2', 'T2EX', 'TF1', 'TR1', 'TF0', 'TR0', 'IE1', 'IT1', 'IE0', 'IT0', 'TF2', 'EXF2', 'RCLK', 'TCLK', 'EXEN2', 'TR2', 'C/T2', 'CP/RL2', 'P0.0', 'P0.1', 'P0.2', 'P0.3', 'P0.4', 'P0.5', 'P0.6', 'P0.7', 'P1.0', 'P1.1', 'P1.2', 'P1.3', 'P1.4', 'P1.5', 'P1.6', 'P1.7', 'P2.0', 'P2.1', 'P2.2', 'P2.3', 'P2.4', 'P2.5', 'P2.6', 'P2.7', 'P3.0', 'P3.1', 'P3.2', 'P3.3', 'P3.4', 'P3.5', 'P3.6', 'P3.7', }; # keyword '1C' { keyword 'Editor_Keywords2' { 'acall', 'lcall', 'ret', 'reti', 'jmp', 'jb', 'jnb', 'jc', 'jnc', 'jbc', 'ajmp', 'ljmp', 'sjmp', 'jz', 'jnz', 'cjne', 'djnz', }; keyword 'Editor_Keywords5' { 'cseg', 'dseg', 'dw', 'db', 'AND', 'OR', 'LE', 'GT', 'EQ', 'if', 'ifdef', 'ifndef', 'endif', 'else', 'public', 'extrn', 'macro', 'endm', 'end', 'org', 'proc', 'endp', 'equ', 'define', '$TT', '$DA', '$EJ', '$PW', 'db', 'dw', 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', }; # keyword '1A' { # 'AND', 'OR', 'LE', 'GT', 'EQ', # 'if', 'ifdef', 'ifndef', 'endif', 'else', # 'public', 'extrn', # 'macro', 'endm', # 'end', 'org', # 'proc', 'endp', 'equ', 'define', # '$TT', '$DA', '$EJ', '$PW', # 'db', 'dw', # 'model', 'ideal', 'codeseg', 'dataseg', 'stack', 'include', 'locals', # }; h_state 0 { 'Normal' } h_trans { 5, '-s', 'a-zA-Z_$@', 'Normal' } h_trans { 1, '<', ';', 'Comment' } h_trans { 2, '<', '\'', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '-s', '0-9', 'Number' } h_trans { 0, 'S', 'a-zA-Z0-9_$@', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '\'', 'String' } h_state 3 { 'String' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '', '"', 'String' } h_state 4 { 'Number' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, 's', 'Hh', 'Number' } h_trans { 0, '-S', '0-9A-Fa-f', 'Number' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_$@' } } mode ASM51: PLAIN { # C/C++ Mode FileNameRx = /\.\c{a51}}$/; HilitOn = 1; Colorizer = 'ASM51'; AutoIndent = 1; IndentMode = 'C'; TabSize = 8; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) SpaceTabs = 0; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } ./config/m_tcl.fte0000644000175000017500000000721311322642642012723 0ustar neilneil# # TCL keyword highlighting (initial version) # # Contributor: Wirawan Purwanto [2003-01-22] # Submitted to FTE community: 2003-05-20 # # NOTE: # All the keywords originally listed in this file were deleted: they # were 100% WRONG! They were SH keywords! # colorize TCL { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Variable', 'Lang_Variable' }, { 'Directive', 'Lang_Preprocessor' }, { 'Special', 'Lang_Control' }, }; keyword 'Editor_Keywords' { # These keywords were taken from Tcl/Tk 8.03 electronic reference # (as compiled by Charles Todd, October 1998): only TCL keywords # are included here 'after', 'append', 'array', 'binary', 'break', 'catch', 'cd', 'clock', 'close', 'concat', 'continue', 'eof', 'error', 'eval', 'exec', 'exit', 'expr', 'fblocked', 'fconfigure', 'fcopy', 'file', 'fileevent', 'filename', 'flush', 'for', 'foreach', 'format', 'gets', 'glob', 'global', 'history', 'if', 'incr', 'info', 'interp', 'join', 'lappend', 'lindex', 'linsert', 'list', 'llength', 'load', 'lrange', 'lreplace', 'lsearch', 'lsort', 'namespace', 'open', 'package', 'pid', 'pkg_mkIndex', 'proc', 'puts', 'pwd', 'read', 'regexp', 'regsub', 'rename', 'resource', 'return', 'scan', 'seek', 'set', 'socket', 'source', 'split', 'string', 'subst', 'switch', 'tell', 'time', 'trace', 'unset', 'update', 'uplevel', 'upvar', 'variable', 'vwait', 'while', # Built-ins that require package: #'registry', # on Windows only # Special commands that must be provided (or can be overridden) by # the user: 'bgerror', 'unknown', # Obsoleted commands 'case', # Not a command: don't highlight them! #'Http', 'Safe Base', 'Tcl', 'library', }; h_state 0 { 'Normal' } h_trans { 1, '-s', 'a-zA-Z0-9_', 'Normal' } h_trans { 5, '<', '$', 'Variable' } h_trans { 6, '<', '-', 'Directive' } h_trans { 7, '<', '.', 'Special' } h_trans { 2, '<', '#', 'Comment' } h_trans { 0, '<', '\\\#', 'Normal' } h_trans { 0, '<', '\\\"', 'String' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '`', 'String' } h_trans { 0, 'S', 'a-zA-Z0-9_', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 3 { 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 3, 'qQ', '\\', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '`', 'String' } h_trans { 4, 'qQ', '\\', 'String' } h_state 5 { 'Variable' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 6 { 'Directive' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 7 { 'Special' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } } mode TCL: PLAIN { # *sh FileNameRx = /\.\ctcl$/; FirstLineRx = /^\#\![^ ]*{{wish>}|{tclsh>}}/; HilitOn = 1; Colorizer = 'TCL'; MultiLineHilit = 1; AutoHilitParen = 1; AutoIndent = 1; Trim = 1; IndentMode = 'C'; SaveFolds = 2; # save fold info at end of line CommentStart = '#'; CommentEnd = ''; RoutineRegexp = /^proc +\w/; } ./config/m_make.fte0000644000175000017500000000575707656220415013076 0ustar neilneilcolorize MAKE { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'Directive', 'Lang_Control' }, { 'Command', 'Lang_Command' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Punctuation', 'Lang_Punctuation' }, { 'Label', 'Lang_Label' }, # Should be Macro }; # Macros keyword 'Lang_Label' { '__MSDOS__', '__NT__', '__OS2__', '__MAKEOPTS__', '__MAKEFILES__', }; # Directives keyword 'Lang_Control' { '.autodepend', '.symbolic', '.precious', '.ignore', '.erase', '.hold', '.silent', '.block', '.nocheck', '.continue', '.optimize', '.extensions:', '.before', '.after', }; # Commands keyword 'Lang_Command' { 'break', 'call', 'chdir', 'cd', 'cls', 'cmd', 'command', 'copy', 'ctty', 'date', 'del', 'dir', 'echo', 'echo.', 'erase', 'for', 'if', 'md', 'mkdir', 'path', 'pause', 'prompt', 'ren', 'rename', 'rmdir', 'rd', 'set', 'time', 'type', 'ver', 'verify', 'vol', # Internal command (other color might be good idea) '%null', '%stop', '%quit', '%abort', '%make', '%create', '%write', '%append', }; h_state 0 { 'Normal' } h_trans { 1, '', '#' , 'Comment' } h_trans { 2, '-^', '!', 'Normal' } h_trans { 4, '<', '$', 'Label' } h_trans { 3, 's', '=+;:@!*', 'Punctuation' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_.:%' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 2 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { -1, 0, -1, 'i', 'a-zA-Z0-9!' } h_words 'Lang_Preprocessor' { '!', 'include', 'error', 'define', 'undef', 'ifeq', 'ifneq', 'ifdef', 'ifndef', 'else', 'endif', '!include', '!error', '!define', '!undef', '!ifeq', '!ifneq', '!ifdef', '!ifndef', '!else', '!endif', } h_state 3 { 'Normal' } h_trans { 0, '', '', 'Normal' } h_state 4 { 'Label' } h_trans { 0, '$', '', 'Normal' } h_trans { 3, 's', '$#@*', ')', 'Label' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } h_state 6 { 'Label' } h_trans { 3, 's', '@*&.:', 'Label' } h_trans { 0, '', '', 'Normal' } h_state 7 { 'Label' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Normal' } } mode MAKE: PLAIN { FileNameRx = /\c{makefile}|{\.{MAK}|{MAKE}|{MK}|{MIF}$}/; FirstLineRx = /^\#\!.*make\s+-f/; HilitOn = 1; Colorizer = 'MAKE'; IndentWithTabs = 1; # use tabs for auto-indent RoutineRegexp = '^[^:\#]+:'; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } ./config/m_sh.fte0000644000175000017500000000405311524025214012544 0ustar neilneilcolorize SH { SyntaxParser = 'SH'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Control', 'Lang_Command' }, { 'Command', 'Lang_Function' }, { 'Punctuation','Lang_Punctuation' }, { 'Variable', 'Lang_Label' }, }; # keyword 'Lang_Label' { # 'PPID', 'PWD', 'OLDPWD', 'REPLY', 'UID', # 'EUID', 'GROUPS', 'BASH', 'BASH_VERSION', # 'BASH_VERSINFO', 'SHLVL', 'RANDOM', # 'SECONDS', 'LINEND', 'HISTCMD', 'DIRSTACK', # 'PIPESTATUS', 'OPTARG', 'OPTIND', 'HOSTNAME', # 'HOSTTYPE', 'OSTYPE', 'MACHTYPE', 'SHELLOPTS', # 'IFS', 'PATH', 'HOME', 'CDPATH', 'BASH_ENV', # 'MAIL', 'MAILCHECK', 'MAILPATH', 'PS1', # 'PS2', 'PS3', 'PS4', 'TIMEFORMAT', 'HISTSIZE', # 'HISTFILE', 'HISTFILESIZE', 'OPTERR', 'LANG', # 'LC_ALL', 'LC_COLLATE', 'LC_MESSAGES', # 'PROMPT_COMMAND', 'IGNOREEOF', 'TMOUT', # 'FCEDIT', 'FIGNORE', 'GLOBIGNORE', 'INPUTRC', # 'HISTCONTROL', 'HISTIGNORE', 'HOSTFILE', # # 'TERM', 'LD_LIBRARY_PATH', 'XAUTHORITY', # 'WINTERM', # }; keyword 'Editor_Keywords' { 'case', 'do', 'done', 'elif', 'else', 'esac', 'fi', 'for', 'function', 'if', 'in', 'then', 'until', 'while', 'exec', 'export', 'set', 'echo', 'exit', 'select', 'source', 'unset', 'alias', 'unalias', 'shift', 'break', 'read', 'return', }; } mode SH: PLAIN { # *sh FileNameRx = /{\.\cSH$}|{configure.{in}|{ac}}/; FirstLineRx = /^\#\![ ]*[^ ]*sh>/; RoutineRegexp = /^\s*{function\s\s*\S\S*\s*}|{\S\S*\s*\(\)}\s*\{?\s*$/; HilitOn = 1; Colorizer = 'SH'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' #'; CommentEnd = ''; } ./config/m_mvsasm.fte0000644000175000017500000000351107530515567013457 0ustar neilneilcolorize MVSASM { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { 'mov', 'push', 'pop', 'movzx', 'movsx', 'shl', 'shr', 'and', 'or', 'xor', 'not', 'add', 'sub', 'neg', 'mul', 'div', 'idiv', 'imul', 'test', 'cmp', 'inc', 'dec', 'enter', 'leave', }; h_state 0 { 'Normal' } h_trans { 1, '^', '*', 'Comment' } # '*' at bol is COMMENT h_trans { 2, '^-S', ' ', 'Label' } # word at bol is LABEL h_trans { 3, '-S', ' ', 'Normal' } # word at non-bol is INSTRUCTION h_state 1 { 'Comment' } # comment h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Label' } # first column is LABEL h_trans { 0, '$', '', 'Normal' } h_trans { 0, '-s', ' ', 'Label' } h_state 3 { 'Normal' } # keywords in second column h_trans { 0, '$', '', 'Normal' } h_trans { 1, '-s', ' ', 'Comment' } h_wtype { 1, 1, 1, '', 'a-zA-Z_' } # keywords here or global h_state 4 { 'Normal' } # eat non-keywords in second col h_trans { 0, '$', '', 'Normal' } h_trans { 1, '-s', ' ', 'Comment' } } mode MVSASM: PLAIN { FileNameRx = /\.\cMVSA$/; HilitOn = 1; Colorizer = 'MVSASM'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; } ./config/uicstyle.fte0000644000175000017500000000073207045070423013464 0ustar neilneil# C indentation style menu menu MChangeCIndentStyle { item "&Default" { ChangeTabSize 8; SetIndentWithTabs 0 SetCIndentStyle 4 0 -1 0 4 0 4 -4 0 1 -1 4 4 } item "&Linux kernel" { ChangeTabSize 8; SetIndentWithTabs 1 SetCIndentStyle 8 0 -1 0 8 0 8 -8 0 1 -1 8 8 } item "&GNU" { ChangeTabSize 8; SetIndentWithTabs 1 SetCIndentStyle 2 2 -1 0 2 0 2 -2 0 1 -1 2 2 } # more... } ./config/m_rexx.fte0000644000175000017500000002376507530515567013154 0ustar neilneil# FTE mode for editing REXX files # enhanced from the original by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 # Header Comment # Note: If the environment variable USER is set, # This macro will insert the contents after the # word "Author:" and leave the cursor after # "Purpose:". If it is not set, the macro will # fail after "Author:". sub REXX_Heading { InsertString "/*"; LineNew; InsertString "* Filename: "; InsertString $FileName; LineNew; InsertString "* Author: "; LineNew; InsertString "* Created: "; InsertDate; LineNew; InsertString "* Purpose: "; LineNew; InsertString "* Changes: "; LineNew; InsertString "*/"; 4:MoveUp; MoveLineEnd; InsertUid; 2:MoveDown; MoveLineEnd; } #Comment a blocked string sub REXX_Comment { ?MoveBlockStart; InsertString "/* "; ?MoveBlockEnd; InsertString " */"; BlockUnmark; } # Load external functions sub REXX_RexxUtil { InsertString "/* Load RexxUtil Library */"; LineNew; InsertString "If RxFuncQuery('SysLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'"; LineNew; InsertString "Call SysLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } %if(OS_OS2) sub REXX_RxSock { InsertString "/* Load RxSock Library */"; LineNew; InsertString "If RxFuncQuery('SockLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'SockLoadFuncs','RxSock','SockLoadFuncs'"; LineNew; InsertString "Call SockLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } sub REXX_RxFTP { InsertString "/* Load RxFTP Library */"; LineNew; InsertString "If RxFuncQuery('FTPLoadFuncs') Then"; LineNew; InsertString "Do"; LineNew; InsertString "Call RxFuncAdd 'FTPLoadFuncs','RxFTP','FTPLoadFuncs'"; LineNew; InsertString "Call FTPLoadFuncs"; LineNew; InsertString "End"; 2:LineNew; } %endif # Constructs sub REXX_Do { InsertString "DO [TO] [BY] [FOR] "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoUntil { InsertString "DO [TO] [BY] [FOR] UNTIL "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoWhile { InsertString "DO [TO] [BY] [FOR] WHILE "; 2:LineNew; InsertString "END"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_DoForever { InsertString "DO FOREVER"; 2:LineNew; InsertString "END"; LineNew; 2:MoveUp; MoveLineEnd; } sub REXX_If { InsertString "IF THEN"; 2:LineNew; InsertString "ELSE"; LineNew; 3:MoveUp; MoveLineStart; 3:MoveRight; } sub REXX_Select { InsertString "SELECT"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "WHEN THEN"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "OTHERWISE"; LineNew; InsertString "/* instruction */"; LineNew; InsertString "END"; LineNew; 9:MoveUp; MoveLineStart; 9:MoveRight; } colorize REXX { SyntaxParser = 'REXX'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; # REXX Keyword Instructions keyword 'Editor_Keywords' { 'ADDRESS', 'ARG', 'CALL', 'DO', 'DROP', 'EXIT', 'EXPOSE', 'FORWARD', 'GUARD', 'IF', 'INTERPRET', 'ITERATE', 'LEAVE', 'NOP', 'NUMERIC', 'OPTIONS', 'PARSE', 'PROCEDURE', 'PULL', 'PUSH', 'QUEUE', 'RAISE', 'REPLY', 'RETURN', 'SAY', 'SELECT', 'SELF', 'SIGNAL', 'SUPER', 'TRACE', 'USE', }; # Parameters for keywords and functions keyword 'Editor_Keywords2' { 'ADDITIONAL', 'ANY', 'APPEND', 'ARRAY', 'BINARY', 'BOTH', 'BY', 'CASELESS', 'CHAR', 'CLOSE', 'DATETIME', 'DIGITS', 'ELSE', 'END', 'ENGINEERING', 'ERROR', 'EXISTS', 'FAILURE', 'FLUSH', 'FOR', 'FOREVER', 'FORM', 'FUZZ', 'HALT', 'HANDLE', 'LINE', 'LOSTDIGITS', 'LOWER', 'NAME', 'NOBUFFER', 'NOMETHOD', 'NORMAL', 'NOSTRING', 'NOTREADY', 'NOVALUE', 'OBJECT', 'OFF', 'ON', 'OPEN', 'OTHERWISE', 'OVER', 'POSITION', 'QUERY', 'READ', 'RECLENGTH', 'REPLACE', 'SCIENTIFIC', 'SEEK', 'SIZE', 'SOURCE', 'STREAMTYPE', 'SYNTAX', 'SYS', 'THEN', 'TIMESTAMP', 'TO', 'UNTIL', 'UPPER', 'USER', 'VALUE', 'VAR', 'VARIABLE', 'VERSION', 'WHEN', 'WHILE', 'WITH', 'WRITE', }; # Built-in functions keyword 'Editor_Keywords3' { 'ABBREV', 'ABS', 'ADDRESS', 'ARG', 'BEEP', 'BITAND', 'BITOR', 'BITXOR', 'B2X', 'CENTER', 'CENTRE', 'CHANGESTR', 'CHARIN', 'CHAROUT', 'CHARS', 'COMPARE', 'CONDITION', 'COPIES', 'COUNTSTR', 'C2D', 'C2X', 'DATATYPE', 'DATE', 'DELSTR', 'DELWORD', 'D2C', 'D2X', 'DIRECTORY', 'ERRORTEXT', 'ENDLOCAL', 'FILESPEC', 'FORMAT', 'INSERT', 'LASTPOS', 'LEFT', 'LENGTH', 'LINEIN', 'LINEOUT', 'LINES', 'MAX', 'METHODS', 'MIN', 'OVERLAY', 'POS', 'QUEUED', 'RANDOM', 'REVERSE', 'RIGHT', 'RS', 'RXFUNCADD', 'RXFUNCDROP', 'RXFUNCQUERY', 'RXQUEUE', 'SETLOCAL', 'SIGN', 'SOURCELINE', 'SPACE', 'STREAM', 'STRIP', 'SUBSTR', 'SUBWORD', 'SYMBOL', 'TIME', 'TRACE', 'TRANSLATE', 'TRUNC', 'VERIFY', 'WORD', 'WORDINDEX', 'WORDLENGTH', 'WORDPOS', 'WORDS', 'XRANGE', 'X2B', 'X2C', 'X2D', }; } mode REXX: PLAIN { # REXX mode FileNameRx = /\.\c{CMD}|{REXX?}$/; HilitOn = 1; Colorizer = 'REXX'; TabSize = 8; AutoIndent = 1; IndentMode = 'REXX'; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; RoutineRegexp = /^[\w_]+:/; } colorize NETREXX: REXX { SyntaxParser = 'REXX'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; # keywords don't inherit? they probably should... # REXX Keyword Instructions keyword 'Editor_Keywords' { 'ADDRESS', 'ARG', 'CALL', 'CLASS', 'DO', 'DROP', 'EXIT', 'EXPOSE', 'IF', 'IMPORT', 'INTERPRET', 'ITERATE', 'LEAVE', 'LOOP', 'METHOD', 'NOP', 'NUMERIC', 'OPTIONS', 'PACKAGE', 'PARSE', 'PROCEDURE', 'PROPERTIES', 'PULL', 'PUSH', 'QUEUE', 'RETURN', 'SAY', 'SELECT', 'SIGNAL', 'TRACE', }; # Parameters for keywords and functions keyword 'Editor_Keywords2' { 'ALL', 'ABSTRACT', 'BY', 'CATCH', 'CONSTANT', 'DIGITS', 'ELSE', 'END', 'ENGINEERING', 'ERROR', 'EXTENDS', 'FAILURE', 'FINAL', 'FINALLY', 'FOR', 'FOREVER', 'FORM', 'FUZZ', 'HALT', 'IMPLEMENTS', 'INHERITABLE', 'INTERFACE', 'LABEL', 'METHODS', 'NAME', 'NATIVE', 'NOTREADY', 'NOVALUE', 'OFF', 'ON', 'OTHERWISE', 'OVER', 'PRIVATE', 'PROTECT', 'PUBLIC', 'RESULTS', 'RETURNS', 'SCIENTIFIC', 'SIGNALS', 'SOURCE', 'STATIC', 'SYNTAX', 'THEN', 'TO', 'UNTIL', 'UPPER', 'USES', 'VALUE', 'VAR', 'VERSION', 'VOLATILE', 'WHEN', 'WHILE', 'WITH', }; # Primitives and other stuff keyword 'Editor_Keywords3' { 'BOOLEAN', 'BYTE', 'CHAR', 'CROSSREF', 'DIAG', 'DOUBLE', 'FLOAT', 'INT', 'LONG', 'NOCROSSREF', 'NODIAG', 'NOFORMAT', 'NOREPLACE', 'NOSTRICTARGS', 'NOSTRICTASSIGN', 'NOSTRICTCASE', 'NOSTRICTSIGNAL', 'NOTRACE', 'NOUTF9', 'NOVERBOSE', 'NOVERBOSEX', 'NULL', 'REXX', 'SHORT', 'STRICTARGS', 'STRICTASSIGN', 'STRICTCASE', 'STRICTSIGNAL', 'UTF9', 'VERBOSE', 'VERBOSEX', }; } mode NETREXX: REXX { FileNameRx = /\.\c{NRX}$/; Colorizer = 'NETREXX'; } ./config/pal_wht.fte0000644000175000017500000001243007530515567013273 0ustar neilneil# color palette (white background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'gray:black' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'cyan:darkBlue' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'black:white' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkBlue' }, { 'Menu_ActiveChar', 'red:darkBlue' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'red:gray' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'black:white' }, # background { "fg", 'black:white' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'darkGreen:bg' }, { 'Editor_Folds1', 'darkBlue:bg' }, { 'Editor_Folds2', 'darkMagenta:bg' }, { 'Editor_Folds3', 'darkMagenta:bg' }, { 'Editor_Folds4', 'darkMagenta:bg' }, { 'Editor_HilitWord', 'darkRed:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'darkCyan:bg' }, { 'Editor_Keywords', 'darkBlue:bg' }, { 'Editor_Keywords2', 'darkCyan:bg' }, { 'Editor_Keywords3', 'darkGreen:bg' }, { 'Editor_Keywords4', 'brown:bg' }, { 'Editor_Keywords5', 'darkBlue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'brown:bg' }, { 'String', 'darkGreen:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'darkRed:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'darkMagenta:bg' }, { 'Lang_OctalNumber', 'darkMagenta:bg' }, { 'Lang_BinaryNumber', 'darkMagenta:bg' }, { 'Lang_Punctuation', 'darkCyan:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'darkGreen:bg' }, { 'Lang_Function', 'darkCyan:bg' }, { 'Lang_Label', 'darkRed:bg' }, { 'Lang_Command', 'darkCyan:bg' }, { 'Lang_Regexp', 'darkMagenta:bg' }, { 'Lang_Variable', 'darkBlue:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'darkBlue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'gray:bg' }, { 'DIFF_New', 'white:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ./config/m_c.fte0000644000175000017500000000615611333110352012356 0ustar neilneil# C mode colorize C { SyntaxParser = 'C'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { # any missing ? # standard C keywords 'asm', 'break', 'case', 'const', 'continue', 'default', 'do', 'else', 'enum', 'extern', 'for', 'goto', 'if', 'inline', 'return', 'sizeof', 'static', 'struct', 'switch', 'typedef', 'union', 'while', # C++ keywords 'catch', 'class', 'const_cast', 'delete', 'dynamic_cast', 'export', 'except', 'explicit', 'friend', 'finally', 'namespace', 'new', 'operator', 'private', 'protected', 'public', 'reinterpret_cast', 'static_cast', 'template', 'this', 'throw', 'try', 'typeid', 'type_info', 'typename', 'typeof', 'using', 'virtual', 'and', 'and_eq', 'bad_cast', 'bad_typeid', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', # types 'auto', 'char', 'double', 'float', 'int', 'long', 'register', 'short', 'signed', 'unsigned', 'void', 'volatile', '_Bool', '_Complex', 'complex', # types C++ 'mutable', 'bool', # wide char (from new C/C++ 1998/1999 standards): 'wchar_t', 'cdecl', 'pascal', '_asm', '__asm', '_far16', '__far16', '_pascal', '_cdecl', '__cdecl', '_export', '__pascal', '_stdcall', '_syscall', '__stdcall', '__syscall', '_fastcall', '__fastcall', '__export', # some gcc extensions '__asm__', '__attribute__', '__format__', '__printf__', 'int16_t', 'int32_t', 'int64_t', 'int8_t', 'intptr_t', 'ptrdiff_t', 'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t', 'size_t', 'ssize_t', # math.h 'float_t', 'double_t', }; # show these as numbers # True, TRUE, False, FALSE, NULL are commonly defined values # but they are not part of C lang keyword 'Lang_DecimalNumber' { 'true', 'True', 'TRUE', 'false', 'False', 'FALSE', 'NULL', }; } mode C: PLAIN { # C/C++ Mode FileNameRx = /\.\c{c|h|{cpp}|{cxx}|{hpp}|{cc}|{hh}|{xs}|{tcc}}$/; HilitOn = 1; Colorizer = 'C'; AutoIndent = 1; IndentMode = 'C'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; %if(UI_KB) TabSize = 8; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) SpaceTabs = 0; IndentWithTabs = 1; CursorThroughTabs = 1; DeleteKillTab = 0; DeleteKillBlock = 0; BackSpKillTab = 0; BackSpUnindents = 0; Abbreviations = 1; UndoMoves = 0; %endif } ./config/m_tex.fte0000644000175000017500000003122210052140072012723 0ustar neilneilcolorize TEX { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, { 'Symbol', 'Markup_Symbol' }, { 'Quotes', 'Markup_Quotes' }, { 'Function', 'Markup_Math' }, }; keyword 'Editor_Keywords' { 'documentstyle', 'document', 'documentclass', 'pagestyle', 'pagenumbering', 'thispagestyle', 'title', 'author', 'date', 'maketitle', 'begin', 'end', 'part', 'chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph', 'appendix', 'tableofcontents', 'listoffigures', 'listoftables', 'rm', 'em', 'bf', 'sc', 'it', 'sl', 'sf', 'tt', 'tiny', 'scriptsize', 'footnotesize', 'small', 'normalsize', 'large', 'Large', 'LARGE', 'huge', 'HUGE', 'bibitem', 'cite', 'label', 'ref', 'pageref', 'footnote', 'item', 'caption', 'kill', 'hline', 'cline', 'multicolumn', 'def', 'hspace', 'vspace', 'linebreak', 'nolinebreak', 'newpage', 'clearpage', 'pagebreak', 'nopagebreak', 'samepage', 'newcommand', 'renewcommand', 'newenvironment', 'newtheorem', 'newcounter', 'setcounter', 'addtocounter', 'value', 'stepcounter', # \the* 'newlength', 'setlength', 'addtolength', 'settowidth', 'textheight', 'textwidth', 'topmargin', 'hoffset', 'voffset', 'oddsidemargin', 'evensidemargin', 'mbox', 'makebox', 'fbos', 'framebox', 'newsavebox', 'sbox', 'savebox', 'usebox', 'raisebox', 'put', 'framebox', 'dashbox', 'line', 'vector', 'circle', 'oval', 'frame', 'shortstack', 'multiput', 'thinlines', 'thicklines', 'linethickness', 'font', 'magnification', 'magstephalf', 'magstep', 'hsize', 'vsize', 'voffset', 'hoffset', 'topskip', 'leftskip', 'rightskip', 'eject', 'vfill', 'eject', 'goodbreak', 'nobreak', 'nopagenumbers', 'headline', 'headheight', 'headsep', 'footnote', 'pageno', 'folio', 'par', 'parindent', 'noindent', 'break', 'hfill', 'break', 'line', 'rightline', 'centerline', 'includegraphics', 'enskip', 'hskip', 'hfil', 'hfill', 'hss', 'smallskip', 'vskip', 'vglue', 'vfil' ,'vfill', 'vss', 'baselineskip', 'parskip', 'topinsert', 'midinsert', 'handindent', 'footnote', 'hrule', 'vrule', 'leaders', 'hrulefill', 'settabs', 'haling', 'hbox', 'vbox', 'newbox', 'setbox', 'arccos', 'cos', 'csc', 'exp', 'ker', 'limsup', 'min', 'sinh', 'arcsin', 'cosh', 'deg', 'gcd', 'lg', 'ln', 'Pr', 'sup', 'arctan', 'cot', 'det', 'hom', 'lim', 'log', 'sec', 'tan', 'arg', 'coth', 'dim', 'inf', 'liminfo', 'max', 'sin', 'tanh', 'displaystyle', 'textstyle', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'varepsilon', 'zeta', 'eta', 'theta', 'vartheta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'o', 'pi', 'varpi', 'rho', 'varrho', 'sigma', 'varsigma', 'tau', 'upsilon', 'phi', 'varphi', 'chi', 'psi', 'omega', 'Gamma', 'Delta', 'Theta', 'Lambda', 'Xi', 'Pi', 'Sigma', 'Upsilon', 'Phi', 'Psi', 'Omega', 'aleph', 'hbar', 'imath', 'jmath', 'ell', 'wp', 'Re', 'Im', 'partial', 'infty', 'backslash', 'prime', 'emptyset', 'nabla', 'surd', 'triangle', 'angle', 'bot', 'top', 'forall', 'exists', 'neg', 'lnot', 'flat', 'natural', 'sharp', 'clubsuit', 'diamondsuit', 'heartsuit', 'spadesuit', 'pm', 'mp', 'setminus', 'cdot', 'times', 'ast', 'star', 'diamond', 'circ', 'bullet', 'triangleleft', 'cap', 'cup', 'uplus', 'sqcap', 'sqcup', 'amalg', 'div', 'wr', 'bigcirc', 'vee', 'lor', 'wedge', 'land', 'oplus', 'ominus', 'otimes', 'oslash', 'odot', 'dagger', 'ddagger', 'bigtriangleleft', 'bigtriangledown', 'sum', 'prod', 'coprod', 'int', 'oint', 'bigcap', 'bigcup', 'bigsqcup', 'bigvee', 'bigwedge', 'bigodot', 'bigotimes', 'bigoplus', 'biguplus', 'hat', 'acute', 'ddot', 'vec', 'check', 'grave', 'breve', 'tilde', 'dot', 'bar', 'widehat', 'widetilde', 'ldots', 'vdots', 'cdots', 'ddots', 'leq', 'le', 'prec', 'preceq', 'll', 'subset', 'subsetqe', 'supsetqe', 'in', 'vdash', 'smile', 'frown', 'geq', 'ge', 'succ', 'succeq', 'gg', 'supset', 'sqsubseteq', 'sqsupsetqe', 'ni', 'owns', 'dashv', 'mid', 'parallel', 'equiv', 'sim', 'simeq', 'asymp', 'approx', 'cong', 'bowtie', 'propto', 'models', 'doteq', 'perp', 'not', 'leftarrow', 'Leftarrow', 'gets', 'longleftarrow', 'Longleftarrow', 'rightarrow', 'Rightarrow', 'to', 'longrightarrow', 'Longrightarrow', 'leftrightarrow', 'Leftrightarrow', 'longleftrightarrow', 'Longleftrightarrow', 'mapsto', 'longmapsto', 'hookleftarrow', 'hookrightarrow', 'leftharpoonup', 'rightharpoonup', 'leftharpoondown', 'rightharpoondown', 'uparrow', 'Uparrow', 'downarrow', 'Downarrow', 'updownarrow', 'Updownarrow', 'nearrow', 'searrow', 'swarrow', 'nwarrow', 'lbrack', 'lfloor', 'rbrack', 'rfloor', 'lceil', 'lbrace', 'langle', 'rceil', 'rbrace', 'rangle', 'quad', 'qquad', 'Biggl', 'biggl', 'Bigl', 'bigl', 'bigr', 'Bigr', 'biggr', 'Biggr', 'lgroup', 'rgroup', 'langle', 'rangle', 'vert', 'Vert', 'uparrow', 'left', 'right', 'overline', 'overrightarrow', 'overleftarrow', 'overbrace', 'underbrace', 'atop', 'choose', 'brack', 'above', 'brace', 'pmatrix', 'matrix', 'bordermatrix', 'eqalign', 'eqno', 'eqalignno', 'quad', 'def', 'gdef', 'edef', 'newcount', 'advance', 'multiply', 'divide', 'number', 'romannumeral', 'newdimen', 'newread', 'openin', 'closein', 'input', 'endinput', 'newwrite', 'openouput', 'closeout', 'write', 'jobname', 'if', 'else', 'fi', 'ifx', 'ifeof', 'ifhmode', 'ifvmode', 'ifmmode', 'ifcat', 'ifnum', 'ifdim', 'ifodd', 'ifcase', 'or', 'loop', 'repeat', 'beginpicture', 'setcoordinatesystem', 'endpicture', 'plotheading', 'lines', 'putrule', 'linethickness', 'setlinear', 'setquadratic', 'sethistograms', 'setsolid', 'setdashes', 'setdots', 'setdashpattern', 'setplotsymbol', 'plot', 'arrow', 'put', 'multiput', 'circulararc', 'ellipticarc', 'startrotation', 'stoprotation', 'setshadegrid', 'setshadesymbol', 'shaderectangleson', 'sharerectanglesoff', 'vshade', 'setquadratic', 'hshade', 'setplotarea', 'inboundscheckon', 'inboundscheckoff', 'axis', 'setbox', 'endpicturesave', 'newdimen', 'Alph', 'AtBeginDocument', 'AtBeginDvi', 'AtEndDocument', 'AtEndOfPackage', 'Big', 'Bigg', 'Box', 'CheckCommand', 'ClassError', 'ClassInfo', 'ClassWarning', 'ClassWarningNoLine', 'DeclareErrorFont', 'DeclareFixedFont', 'DeclareFontEncoding', 'DeclareFontEncodingDefaults', 'DeclareFontFamily', 'DeclareFontShape', 'DeclareFontSubstitution', 'DeclareMathAccent', 'DeclareMathAlphabet', 'DeclareMathDelimiter', 'DeclareMathRadical', 'DeclareMathSizes', 'DeclareMathSymbol', 'DeclareMathVersion', 'DeclareOldFontCommand', 'DeclareOption', 'DeclarePreloadSizes', 'DeclareRobustCommand', 'DeclareSizeFunction', 'DeclareSymbolFont', 'DeclareSymbolFontAlphabet', 'DeclareTextAccent', 'DeclareTextAccentDefault', 'DeclareTextCommand', 'DeclareTextCommandDefault', 'DeclareTextComposite', 'DeclareTextCompositeCommand', 'DeclareTextFontCommand', 'DeclareTextSymbol', 'DeclareTextSymbolDefault', 'ExecuteOptions', 'IfFileExists', 'InputIfFileExists', 'Join', 'LoadClass', 'LoadClassWithOptions', 'MessageBreak', 'NeedsTeXFormat', 'OptionNotUsed', 'PackageError', 'PackageInfo', 'PackageWarning', 'PackageWarningNoLine', 'PassOptionsToClass', 'PassOptionsToPackage', 'ProcessOptions', 'ProvideTextCommand', 'ProvideTextCommandDefault', 'ProvidesFile', 'ProvidesPackage', 'RequirePackage', 'RequirePackageWithOptions', 'Roman', 'SetMathAlphabet', 'SetSymbolFont', 'TeX', 'TextSymbolUnavailable', 'UseTextAccent', 'UseTextSymbol', 'addcontentsline', 'addpenalty', 'addtocontents', 'addtoversion', 'addvspace', 'afterassignment', 'allocationnumber', 'allowbreak', 'alph', 'arrayrulewidth', 'arraystretch', 'baselinestretch', 'bezier', 'bfdefault', 'bfseries', 'bibcite', 'bibliography', 'bibliographystyle', 'big', 'bigbreak', 'bigg', 'bigskip', 'bigskipamount', 'bigskipamount', 'bmod', 'boldmath', 'buildrel', 'cases', 'catcode', 'center', 'centering', 'chardef', 'cleardoublepage', 'contentsline', 'countdef', 'cr', 'csname', 'depth', 'discretionary', 'displaymath', 'dospecials', 'dotfill', 'encodingdefault', 'endcsname', 'everycr', 'expandafter', 'expandafter', 'extracolsep', 'familydefault', 'familydefault', 'fbox', 'filbreak', 'flushleft', 'flushright', 'fmtname', 'fmtversion', 'fontencoding', 'fontfamily', 'fontseries', 'fontshape', 'footnotemark', 'footnoterule', 'footnotetext', 'frac', 'frenchspacing', 'fussy', 'futurelet', 'global', 'glossary', 'halign', 'height', 'hphantom', 'ifinner', 'immediate', 'include', 'includeonly', 'itdefault', 'iterate', 'kern', 'lastskip', 'leadsto', 'leavevmode', 'lefteqn', 'leftline', 'leftmark', 'let', 'lhd', 'liminf', 'lineskip', 'lower', 'lowercase', 'makeatletter', 'makeatother', 'makeglossary', 'makeindex', 'marginpar', 'markboth', 'markright', 'mathclose', 'mathop', 'mathopen', 'mathrel', 'mathstrut', 'mddefault', 'medbreak', 'medmuskip', 'medskip', 'mho', 'minipage', 'mskip', 'multispan', 'narrower', 'negthinspace', 'newfont', 'newhelp', 'newif', 'newinsert', 'newlabel', 'newlanguage', 'newline', 'newmathalphabet', 'newmuskip', 'newskip', 'newtoks', 'nocite', 'nocorrlist', 'noexpand', 'nointerlineskip', 'nolimits', 'nonfrenchspacing', 'nonumber', 'normalbaselines', 'normallineskip', 'normalmarginpar', 'null', 'numberline', 'obeylines', 'obeyspaces', 'offinterlineskip', 'onecolumn', 'openup', 'pagenumberin', 'parbox', 'penalty', 'phantom', 'pmod', 'protect', 'providecommand', 'raggedbottom', 'raggedleft', 'raggedright', 'refstepcounter', 'relax', 'removelastskip', 'renewenvironment', 'reversemarginpar', 'rhd', 'rightmark', 'rlap', 'rmdefault', 'roman', 'root', 'rq', 'rule', 'scdefault', 'secdef', 'selectfont', 'seriesdefault', 'settodepth', 'settoheight', 'sfdefault', 'shapedefault', 'showhyphens', 'showoutput', 'showoverfull', 'sldefault', 'sloppy', 'sloppypar', 'smallbreak', 'space', 'spacefactor', 'sqsubset', 'stackrel', 'stretch', 'strut', 'suppressfloats', 'symbol', 'tabskip', 'thanks', 'thefootnote', 'thickmuskip', 'thinmuskip', 'thinspace', 'today', 'tracingfonts', 'tracingoutput', 'trivlist', 'ttdefault', 'twocolumn', 'typein', 'typeout', 'unboldmath', 'undefinedpagestyle', 'underbar', 'underline', 'unlhd', 'unrhd', 'updefault', 'usecounter', 'usefont', 'usepackage', 'vcenter', 'verb', 'verbatim', 'vline', 'vphantom', 'width', 'wlog', 'xdef', }; h_state 0 { 'Normal' } h_trans { 1, '', '\\begin{verbatim}', 'Quotes' } h_trans { 2, '', '\\', 'Special' } h_trans { 0, 's', '{}', 'Special' } h_trans { 4, '', '$', 'Function' } h_trans { 5, '', '$$', 'Function' } h_trans { 3, '', '%', 'Comment' } h_state 1 { 'Quotes' } h_trans { 0, '', '\\end{verbatim}', 'Quotes' } h_state 2 { 'Tag' } h_trans { 0, 'S', 'a-zA-Z0-9_', 'Symbol' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 3 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 4 { 'Function' } h_trans { 0, '', '$', 'Function' } h_state 5 { 'Function' } h_trans { 0, '', '$$', 'Function' } #h_state 5 { 0, 'i', 'a-zA-Z', 'Keyword' } #h_trans { 0, 'S', 'a-zA-Z', 'Normal' } #h_trans { 0, '$', '', 'Normal' } } mode TEX: PLAIN { FileNameRx = /\.\c{TEX}|{STY}|{CLS}|{CLO}|{LTX}|{FD}|{DTX}$/; HilitOn = 1; Colorizer = 'TEX'; MultiLineHilit = 1; RoutineRegexp = /^\s*\\(title)|(section)|(subsection)\s*\{/; SaveFolds = 2; # save fold info at end of line CommentStart = '%'; CommentEnd = ''; } ./config/m_siod.fte0000644000175000017500000001527007530515567013114 0ustar neilneil# From: Keith Humphreys # # FTE is wonderful. # Several months ago I was looking at SIOD, and I hacked a "fte config" file # which is 98% accurate. :-) # # Anyway, as it might be of use, here it is: # ! colors probably need fixing --Mark colorize SIOD { SyntaxParser = 'SIMPLE'; # 0, 8 - black # 1, 9 - blue # 2, A - green # 3, B - cyan # 4, C - red # 5, D - magenta # 6, E - orange # 7, F - white color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Symbol', 'Lang_Command' }, { 'Comment', 'Lang_Comment' }, { 'Special', 'Lang_Control' }, }; # Hmmm, it appears that exit and quit aren't even recommended! keyword 'Editor_Keywords4' { #Scheme's essential procedures:. 'abs', 'alarm', 'and', 'append', 'apply', 'ass', 'assoc', 'assq', 'assv', 'base64decode', 'base64encode', 'begin', 'caaar', 'caadr', 'caar', 'cadar', 'caddr', 'cadr', 'car', 'cdaar', 'cdadr', 'cdar', 'cddar', 'cdddr', 'cddr', 'cdr', 'cond', 'cons-array', 'define', 'eq?', 'equal?', 'eqv?', 'eval', 'exec', 'exit', 'fclose', 'fopen', 'if', 'lambda', 'length', 'let', 'let*', 'letrec', 'list', 'load', 'max', 'min', 'member', 'memq', 'memv', 'nil', 'not', 'null?', 'number?', 'number->string', 'or', 'pair?', 'quit', 'quote', 'set!', 'set-car!', 'set-cdr!', 'string->number', 'string-length', 'string?', 'string-append', 'substring', 'symbol?', 'read', 'reverse', }; keyword 'Lang_Function' { #These are recommended by the standard. 'acos', 'asin', 'atan', 'cos', 'exp', 'log', 'sin', 'tan', 'sqrt', }; #note: varables t, nil have been removed from the standard, # but are here. keyword 'Editor_Keywords' { #These are siod extras. '%%%memref', '%%closure', '%%closure-code', '%%closure-env', '%%stack-limit', '*after-gc*', '*args*', '*catch', '*env*', '*eval-history-ptr*', '*pi*', '*plists*', '*throw', '*traced*', 'F_GETLK', 'F_SETLK', 'F_SETLKW', 'access-problem?', 'allocate-heap', 'apropos', 'aref', 'array->hexstr', 'aset', 'ash', 'atan2', 'benchmark-eval', 'benchmark-funcall1', 'benchmark-funcall2', 'bit-and', 'bit-not', 'bit-or', 'bit-xor', 'butlast', 'bytes-append', 'chdir', 'chmod', 'chown', 'closedir', 'copy-list', 'cpu-usage-limits', 'crypt', 'current-resource-usage', 'datlength', 'datref', 'decode-file-mode', 'delete-file', 'delq', 'encode-file-mode', 'encode-open-flags', 'endpwent', 'env-lookup', 'eof-val', 'errobj', 'error', 'fast-load', 'fast-print', 'fast-read', 'fast-save', 'fchmod', 'fflush', 'file-times', 'first', 'fmod', 'fnmatch', 'fork', 'fread', 'fseek', 'fstat', 'ftell', 'fwrite', 'gc', 'gc-info', 'gc-status', 'get', 'getc', 'getcwd', 'getenv', 'getgid', 'getgrgid', 'getpass', 'getpgrp', 'getpid', 'getppid', 'getpwent', 'getpwnam', 'getpwuid', 'gets', 'getuid', 'gmtime', 'hexstr->bytes', 'href', 'hset', 'html-encode', 'intern', 'kill', 'larg-default', 'last', 'last-c-error', 'lchown', 'link', 'lkey-default', 'load-so', 'localtime', 'lref-default', 'lstat', 'make-list', 'mapcar', 'md5-final', 'md5-init', 'md5-update', 'mkdatref', 'mkdir', 'mktime', 'nconc', 'nice', 'nreverse', 'nth', 'opendir', 'os-classification', 'parse-number', 'pclose', 'popen', 'pow', 'prin1', 'print', 'print-to-string', 'prog1', 'putc', 'putenv', 'putprop', 'puts', 'qsort', 'rand', 'random', 'read-from-string', 'readdir', 'readline', 'readlink', 'realtime', 'rename', 'require', 'require-so', 'rest', 'rld-pathnames', 'rmdir', 'runtime', 'save-forms', 'sdatref', 'set-eval-history', 'set-symbol-value!', 'setprop', 'setpwent', 'setuid', 'siod-lib', 'sleep', 'so-ext', 'srand', 'srandom', 'stat', 'strbreakup', 'strcat', 'strcmp', 'strcpy', 'strcspn', 'strftime', 'string-dimension', 'string-downcase', 'string-lessp', 'string-search', 'string-trim', 'string-trim-left', 'string-trim-right', 'string-upcase', 'strptime', 'strspn', 'subset', 'substring-equal?', 'swrite', 'sxhash', 'symbol-bound?', 'symbol-value', 'symbolconc', 'symlink', 'system', 't', 'the-environment', 'trace', 'trunc', 'typeof', 'unbreakupstr', 'ungetc', 'unix-ctime', 'unix-time', 'unix-time->strtime', 'unlink', 'untrace', 'url-decode', 'url-encode', 'utime', 'verbose', 'wait', 'while', 'writes', }; h_state 0 { 'Normal' } h_trans { 1, '-s', 'A-Za-z_%*', 'Normal' } #Keyword starters. h_trans { 2, '<', ';', 'Comment' } h_trans { 3, '>', '\'', 'Symbol' } h_trans { 4, '>', '0x', 'HexNumber' } h_trans { 5, '>s', '0-9', 'Number' } h_trans { 6, '>', '"', 'String' } h_trans { 0, 's', '()', 'Special' } # h_trans { 0, '', ',', 'Punctuation' } h_state 1 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 2, '<', ';', 'Comment'} h_wtype { 0, 0, 0, '', '-a-zA-Z0-9_*%:?!>' } #Keyword internals h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 3 { 'Symbol' } h_trans { 2, '<', ';', 'Comment'} h_trans { 0, '>', ' ', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_trans { 0, '>s', '()', 'Special' } h_state 4 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'String' } h_trans { 0, '<', '"', 'String' } h_trans { 6, 'q', '\\', 'String' } # 'q' "igores" next char. } mode SIOD: PLAIN { # siod Mode FileNameRx = /\.\cscm$/; HilitOn = 1; Colorizer = 'SIOD'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 0; #scheme is case insensitive. Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' ;'; CommentEnd = ''; WordChars = '-A-Za-z0-9*%:?!>'; #first noticed in m_plain.fte # RoutineRegexp = '('; } ./config/m_xml.fte0000644000175000017500000000407307530515567012755 0ustar neilneil# # basic Syntaxhighliting for xml documents # based on HTML Mode sub XML_Base { InsertString '";'; LineNew; MoveLineStart; } colorize XML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Keywords' }, { 'Command', 'Editor_Default' }, { 'Comment', 'Lang_Comment' }, { 'String', 'Lang_String' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { "DOCTYPE", "PUBLIC", }; h_state 0 { 'Normal' } h_trans { 5, '<', '"; } eventmap XML { abbrev '_xml' { KillWordPrev; InsertString ''; LineNew; MoveLineStart; Fail; } } ./config/m_sml.fte0000644000175000017500000000311507234440755012741 0ustar neilneil# SML mode # # Chris Inacio # inacio@ece.cmu.edu colorize SML { SyntaxParser = 'SIMPLE'; color { {'Normal', 'Editor_Default'}, {'Number', 'Lang_DecimalNumber'}, {'Punctuation','Lang_Preprocessor'}, {'String','Lang_String'}, {'Comment','Lang_Comment'}, {'Label','Lang_Label'}, {'Function','Lang_Function'} }; keyword 'Editor_Keywords' { 'structure', 'and', 'local', 'in', 'end', 'signature', 'functor', 'struct', 'let', 'sig', 'where type', 'val', 'eqtype', 'type', 'datatype', 'exception', 'sharing', 'include', 'fun', 'abstype', 'open', 'infix', 'infixr', 'nonfix', 'raise', 'if', 'while', 'case', 'fn', 'op', }; h_state 0 {'Normal'} h_trans {1, '>', '(*', 'Comment'} h_trans {2, '', '"', 'String'} h_trans {3, 's', '0-9', 'Number'} h_trans {0, 'S', '_a-zA-Z0-9', 'Punctuation'} h_trans {4, '-s', 'a-zA-Z_', 'Normal' } h_state 1 {'Comment'} h_trans {0, '<', '*)', 'Comment'} h_state 2 {'String'} h_trans {0, '', '"', 'String'} h_state 3 {'Number'} h_trans {0, 'S-', '0-9\.', 'Number'} h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } } mode SML: PLAIN { FileNameRx = /\.\c{SML}$/; HilitOn = 1; Colorizer = 'SML'; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; SaveFolds = 2; CommentStart = ' (*'; CommentEnd = '*)'; } ./config/m_xp.fte0000644000175000017500000000705007530515567012602 0ustar neilneil# eXPErimental C syntax parser # does everything that internal does except function( and label: # colorize XPE { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_Number' }, { 'HexNumber', 'Lang_HexNumber' }, { 'OctalNumber', 'Lang_OctalNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, }; h_state 0 { 'Normal' } h_trans { 13, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '/*', 'Comment' } h_trans { 2, '', '//', 'Comment' } h_trans { 3, '^', '#', 'CPreprocessor' } h_trans { 4, '', '"', 'String' } h_trans { 5, '', '\'', 'String' } h_trans { 10, '', '0x', 'HexNumber' } h_trans { 11, '', '0', 'OctalNumber' } h_trans { 12, 's', '0-9', 'Number' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '', '*/', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 3 { 'CPreprocessor' } h_trans { 17, '-s', 'a-zA-Z_', 'Normal' } h_trans { 0, '$', '', 'CPreprocessor' } h_trans { 3, 'qQ', '\\', 'CPreprocessor' } h_trans { 8, '', '/*', 'Comment' } h_trans { 9, '', '//', 'Comment' } h_trans { 6, '', '"', 'String' } h_trans { 7, '', '\'', 'String' } h_trans { 14, '', '0x', 'HexNumber' } h_trans { 15, '', '0', 'OctalNumber' } h_trans { 16, 's', '0-9', 'Number' } h_state 4 { 'String' } h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 5 { 'String' } h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 5, 'Qq', '\\', 'String' } h_state 6 { 'String' } h_trans { 3, '', '"', 'String' } h_trans { 3, '$', '', 'String' } h_trans { 6, 'Qq', '\\', 'String' } h_state 7 { 'String' } h_trans { 3, '', '\'', 'String' } h_trans { 3, '$', '', 'String' } h_trans { 7, 'qQ', '\\', 'String' } h_state 8 { 'Comment' } h_trans { 3, '', '*/', 'Comment' } h_state 9 { 'Comment' } h_trans { 0, '$', '', 'Comment' } h_state 10 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 11 { 'OctalNumber' } h_trans { 0, '-S', '0-7', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 12 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 13 { 'Normal' } h_trans { 0, '-S', 'a-zA-Z0-9_', 'Punctuation' } h_trans { 0, '$', '', 'Normal' } h_state 14 { 'HexNumber' } h_trans { 3, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 15 { 'OctalNumber' } h_trans { 3, '-S', '0-7', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 16 { 'Number' } h_trans { 3, '-S', '0-9', 'Normal' } h_trans { 3, '$', '', 'Normal' } h_state 17 { 'CPreprocessor' } h_trans { 3, '-S', 'a-zA-Z0-9_', 'Punctuation' } h_trans { 3, '$', '', 'Normal' } } mode XPE: PLAIN { FileNameRx = /\.\cXPE$/; HilitOn = 1; Colorizer = 'XPE'; AutoHilitParen = 1; SaveFolds = 2; # save fold info at end of line CommentStart = ' /*'; CommentEnd = '*/'; } ./config/m_html.fte0000644000175000017500000005124407723472441013120 0ustar neilneil# FTE mode for editing HTML files # maintained by m_debusk@sourceforge.com # Revision 2001-11-18 # Runs current file in browser sub HTML_View { RunProgram "netscape.exe -browser -l en_US file:///" . $FilePath; } # Runs Dave Ragget's HTML Tidy on current file sub HTML_Tidy { RunProgram "f:\\os2_apps\\tidy\\tidy.exe -m " . $FilePath; } # Basic stuff sub HTML_BR { InsertString "
      "; } sub HTML_HR { InsertString "
      "; } sub HTML_HTM { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; 2:LineNew; InsertString ""; MoveSavedPos; } sub HTML_HEAD { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } sub HTML_TITLE { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_BODY { ?MoveBlockStart; InsertString ""; 2:LineNew; ?MoveBlockEnd; SavePos; 2:LineNew; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_META { MoveFileStart; ?Find // "i"; MoveLineEnd; LineNew; InsertString ""; 15:MoveLeft } sub HTML_BASEURL { MoveFileStart; ?Find // "i"; MoveLineEnd; LineNew InsertString ""; 4:MoveLeft } sub HTML_P { ?MoveBlockStart; InsertString "

      "; ?MoveBlockEnd; InsertString "

      "; 4:MoveLeft; BlockUnmark; } sub HTML_CENTER { # shouldn't really do this, but it's convenient. ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 7:MoveLeft; } # Comment sub HTML_COMMENT { ?MoveBlockStart; InsertString ""; 4:MoveLeft; BlockUnmark; } # DTDs sub HTML_DTD_X1S { # XHTML 1.0 Strict MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_X1T { # XHTML 1.0 Transitional MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_X1F { # XHTML 1.0 Frameset MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4S { # HTML 4.01 Strict MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4T { # HTML 4.01 Transitional MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_4F { # HTML 4.01 Frameset MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_32F { # HTML 3.2 Final MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } sub HTML_DTD_2 { # HTML 2.0; Why not? MoveFileStart; LineInsert; InsertString ""; MoveFileStart; } # headers sub HTML_H1 { ?MoveBlockStart; InsertString "

      "; ?MoveBlockEnd; InsertString "

      "; 5:MoveLeft; BlockUnmark; } sub HTML_H2 { ?MoveBlockStart; InsertString "

      "; ?MoveBlockEnd; InsertString "

      "; 5:MoveLeft; BlockUnmark; } sub HTML_H3 { ?MoveBlockStart; InsertString "

      "; ?MoveBlockEnd; InsertString "

      "; 5:MoveLeft; BlockUnmark; } sub HTML_H4 { ?MoveBlockStart; InsertString "

      "; ?MoveBlockEnd; InsertString "

      "; 5:MoveLeft; BlockUnmark; } sub HTML_H5 { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } sub HTML_H6 { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } # Character Format sub HTML_B { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_STRONG { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 9:MoveLeft; BlockUnmark; } sub HTML_I { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_EM { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 5:MoveLeft; BlockUnmark; } sub HTML_BIG { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_SMALL { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 8:MoveLeft; BlockUnmark; } sub HTML_SUP { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_SUB { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_BDO { ?MoveBlockStart; InsertString ""; 6:MoveLeft; SavePos; 6:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } # Output Format sub HTML_PRE { ?MoveBlockStart; InsertString "
      "; LineNew;
          ?MoveBlockEnd; SavePos; BlockUnmark; LineNew;
          InsertString "
      "; MoveSavedPos; } sub HTML_CODE { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; #SavePos; BlockUnmark; #LineNew; InsertString ""; 7:MoveLeft; #MoveSavedPos; } sub HTML_TT { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; #SavePos; BlockUnmark; #LineNew; InsertString ""; 5:MoveLeft; #MoveSavedPos; } sub HTML_KBD { ?MoveBlockStart; InsertString ""; #LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; #LineNew; InsertString ""; MoveSavedPos; } sub HTML_VAR { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } sub HTML_SAMP { ?MoveBlockStart; InsertString ""; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString ""; MoveSavedPos; } # Blocks sub HTML_ACRONYM { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_ABBR { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_ADDRESS { ?MoveBlockStart; InsertString "
      "; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString "
      "; MoveSavedPos; } sub HTML_BLOCKQUOTE { ?MoveBlockStart; InsertString "
      "; LineNew; ?MoveBlockEnd; SavePos; BlockUnmark; LineNew; InsertString "
      "; MoveSavedPos; } sub HTML_Q { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 4:MoveLeft; BlockUnmark; } sub HTML_CITE { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 7:MoveLeft; BlockUnmark; } sub HTML_INS { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_DEL { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } # forms sub HTML_INPUT { InsertString ""; 4:MoveLeft; } sub HTML_FORM { InsertString "
      "; LineNew; HTML_INPUT; SavePos; 4:MoveRight; LineNew; InsertString "
      "; MoveSavedPos; } sub HTML_TEXTAREA { ?MoveBlockStart; InsertString ""; MoveSavedPos; } sub HTML_BUTTON { InsertString ""; 9:MoveLeft; } sub HTML_OPTION { InsertString ""; LineNew; HTML_OPTION; SavePos; 4:MoveRight; LineNew; HTML_OPTION; 4:MoveRight; LineNew; InsertString ""; MoveSavedPos; } sub HTML_LABEL { ?MoveBlockStart; InsertString ""; MoveSavedPos; } sub HTML_FIELDSET { InsertString "
      "; LineNew; HTML_INPUT; SavePos; 4:MoveRight; LineNew; InsertString "
      "; MoveSavedPos; } sub HTML_LEGEND { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 9:MoveLeft; BlockUnmark; } # lists sub HTML_DFN { ?MoveBlockStart; InsertString ""; ?MoveBlockEnd; InsertString ""; 6:MoveLeft; BlockUnmark; } sub HTML_LI { ?MoveBlockStart; InsertString "
    3. "; ?MoveBlockEnd; InsertString "
    4. "; 5:MoveLeft; BlockUnmark; } sub HTML_DT { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } sub HTML_DD { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } sub HTML_UL { ?MoveBlockStart; InsertString "
        "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } sub HTML_OL { ?MoveBlockStart; InsertString "
        "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } sub HTML_DL { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; 5:MoveLeft; BlockUnmark; } # Images sub HTML_IMG { InsertString "\"\""; 30:MoveLeft; } sub HTML_MAP { InsertString "\"\""; 41:MoveLeft; SavePos; MoveLineEnd; LineNew; InsertString ""; LineNew; InsertString "\"\""; LineNew; InsertString ""; MoveSavedPos; } sub HTML_AREA { InsertString "\"\""; MoveLineStart; } # anchors sub HTML_ANAME { ?MoveBlockStart; InsertString "
      "; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_AHREF { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; ?MoveBlockEnd; InsertString ""; BlockUnmark; MoveSavedPos; } sub HTML_LINK { InsertString ""; 20:MoveLeft } # tables sub HTML_TABLE { ?MoveBlockStart; InsertString ""; 2:MoveLeft; SavePos; 2:MoveRight; LineNew; ?MoveBlockEnd; LineNew; InsertString "
      "; BlockUnmark; MoveSavedPos; } sub HTML_CAPTION { ?MoveBlockStart; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; ?MoveBlockEnd; InsertString "
      "; ?MoveBlockEnd; InsertString "
      \tC-E A-T" { HTML_TABLE } item "&Caption \tC-E A-R" { HTML_TR } item "&Data
      \tC-E A-C" { HTML_CAPTION } item "&Header
      \tC-E A-H" { HTML_TH } item "&Row
      \tC-E A-D" { HTML_TD } } menu HTMLTags { #FOLD02 item "&Paragraph

      \tC-E C-P " { HTML_P } item "Line brea&k
      \tC-E Enter" { HTML_BR } item "Horiz.line


      \tC-E &- " { HTML_HR } item; submenu "P&hysical styles ", HTML_Physical; submenu "Logical &styles ", HTML_Logical; submenu "&Header ", HTML_Header; submenu "&Lists ", HTML_List; submenu "&Tables ", HTML_Table; item; item "Pre&formatted
      \tC-E C-F  " { HTML_PRE }
          item    "&Centered      
      \tC-E . " { HTML_CENTER } item; item "Anchor &Name \tC-E C-N " { HTML_ANAME } item "Anchor H&Ref \tC-E C-H " { HTML_AHREF } item; item "Basic document\tC-E &0 " { HTML_Base } } menu Main_HTML { #FOLD02 submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML: PLAIN { #FOLD02 MainMenu = "Main_HTML"; # menu for menubar key [C+E_0] { HTML_Base } # headers key [C+E_1] { HTML_H1 } key [C+E_2] { HTML_H2 } key [C+E_3] { HTML_H3 } key [C+E_4] { HTML_H4 } key [C+E_5] { HTML_H5 } key [C+E_6] { HTML_H6 } # physical key [C+E_C+B] { HTML_B } key [C+E_C+I] { HTML_I } key [C+E_C+T] { HTML_TT } # logical key [C+E_C+D] { HTML_DFN } key [C+E_C+E] { HTML_EM } key [C+E_C+O] { HTML_CITE } key [C+E_C+C] { HTML_CODE } key [C+E_C+K] { HTML_KBD } key [C+E_C+M] { HTML_SAMP } key [C+E_C+S] { HTML_STRONG } key [C+E_C+V] { HTML_VAR } # lists key [C+E_i] { HTML_LI } key [C+E_u] { HTML_UL } key [C+E_o] { HTML_OL } key [C+E_l] { HTML_DL } key [C+E_t] { HTML_DT } key [C+E_d] { HTML_DD } # tables key [C+E_A+T] { HTML_TABLE } key [C+E_A+C] { HTML_CAPTION } key [C+E_A+H] { HTML_TH } key [C+E_A+R] { HTML_TR } key [C+E_A+D] { HTML_TD } # anchors key [C+E_C+N] { HTML_ANAME } key [C+E_C+H] { HTML_AHREF } key [C+E_C+G] { HTML_IMG } key [C+E_C+F] { HTML_PRE } key [C+E_G-Enter] { HTML_BR } key [C+E_-] { HTML_HR } key [C+E_.] { HTML_CENTER } key [C+E_C+P] { HTML_P } # character escapes key [C+E_&] { InsertString "&"; } key [C+E_<] { InsertString "<"; } key [C+E_>] { InsertString ">"; } key [C+E_"] { InsertString """; } # hilit bug } # make sure proper eventmap is used mode HTML { EventMap = 'HTML'; } #FOLD02 # FTE #FOLD01 eventmap FTE: PLAIN { #FOLD02 key [Tab] { LineIndent; LineTrim } key [G-Enter] { LineIndent; LineNew } key [{] { SelfInsert; LineIndent } key [}] { SelfInsert; LineIndent } } # make sure proper eventmap is used mode FTE { EventMap = 'FTE'; } #FOLD02 ./config/m_sl.fte0000644000175000017500000000503507234440755012567 0ustar neilneil# SLang mode colorize sl { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; h_state 0 { 'Normal' } h_trans { 1, '', '%' , 'Comment' } h_trans { 2, '-s', 'a-zA-Z_', 'Normal' } h_trans { 3, '<', '"', 'String' } h_trans { 4, '<', '\'', 'String' } h_trans { 5, '<', '0x', 'HexNumber' } h_trans { 6, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } keyword 'Editor_Keywords' { # any missing ? 'and', 'or', 'not', 'xor', 'shl', 'shr', 'andelse', 'orelse', 'variable', 'if', 'else', '!if', 'switch', 'case', 'while', 'do', 'for', 'loop', 'forever', 'break', 'return', 'continue', 'define', 'return', 'EXIT_BLOCK', 'struct', 'typedef', 'ERROR_BLOCK' }; } mode sl: PLAIN { # SLang Mode FileNameRx = /\.\cSL$/; HilitOn = 1; Colorizer = 'sl'; AutoIndent = 1; IndentMode = 'sl'; TabSize = 3; # think twice before changing this, historically # it's been known to cause a mess in sources ;-) MatchCase = 1; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = '^define'; # RoutineRegexp = /^\w[\w_:*&~]+[\w\\s_:*&~]@\(.*\){\s*\{}?\s*$/; # RoutineRegexp = /^define \w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' %'; CommentEnd = ''; } ./config/m_py.fte0000644000175000017500000002173407667403516012611 0ustar neilneil# This Config is mostly just for colour syntax highlighting, there is # no auto-indent support in this mode. # # My python miscellany page is: http://www.vex.net/~x/python_stuff.html # Edited by Bastian Kleineidam # # Small changes/fixes by Jon Svendsen (jsvendsen@bergen.frisurf.no) colorize PYTHON { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords'}, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'CPreprocessor', 'Lang_Preprocessor' }, { 'Function', 'Lang_Function' }, { 'Label', 'Lang_Label' }, { 'Command', 'Lang_Command' }, # assembler }; keyword "Editor_Keywords" { # reserved words as of Python 2.3b1 "and", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "not", "None", "or", "pass", "print", "raise", "return", "try", "while", "yield", "True", "False", }; keyword "Editor_Keywords2" { # built-in functions as of Python 2.2.2 "__import__", "abs", "apply", "buffer", "callable", "chr", "cmp", "coerce", "compile", "complex", "delattr", "dir", "divmod", "eval", "execfile", "file", "filter", "float", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "intern", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "long", "map", "max", "min", "oct", "open", "ord", "pow", "range", "raw_input", "reduce", "reload", "repr", "round", "setattr", "slice", "str", "tuple", "type", "unichr", "unicode", "vars", "xrange", "zip", }; keyword "Editor_Keywords3" { # standard modules as of Python 2.2.2 # Python Runtime Services "sys", "gc", "weakref", "fpectl", "atexit", "types", "UserDict", "UserList", "UserString", "operator", "inspect", "traceback", "linecache", "pickle", "cPickle", "copy_reg", "shelve", "copy", "marshal", "warnings", "imp", "code", "codeop", "pprint", "repr", "new", "site", "user", "__builtin__", "__main__", # String Services "string", "re", "struct", "difflib", "fpformat", "StringIO", "cStringIO", "codecs", "unicodedata", # Miscellaneous Services "pydoc", "doctest", "unittest", "math", "cmath", "random", "whrandom", "bisect", "array", "ConfigParser", "fileinput", "xreadlines", "calendar", "cmd", "shlex", # Generic Operating System Services "os", "dircache", "stat", "statcache", "statvfs", "filecmp", "popen2", "time", "sched", "mutex", "getpass", "curses", "getopt", "tempfile", "errno", "glob", "fnmatch", "shutil", "locale", "gettext", # Optional Operating System Services "signal", "socket", "select", "thread", "threading", "Queue", "mmap", "anydbm", "dumbdbm", "dbhash", "whichdb", "bsddb", "zlib", "gzip", "zipfile", "readline", "rlcompleter", # Unix Specific Services "posix", "pwd", "grp", "crypt", "dl", "dbm", "gdbm", "termios", "TERMIOS", "tty", "pty", "fcntl", "pipes", "posixfile", "resource", "nis", "syslog", "commands", # Internet Protocols and Support "webbrowser", "cgi", "cgitb", "urllib", "urllib2", "httplib", "ftplib", "gopherlib", "poplib", "imaplib", "nntplib", "smtplib", "telnetlib", "urlparse", "SocketServer", "BaseHTTPServer", "SimpleHTTPServer", "CGIHTTPServer", "Cookie", "xmlrpclib", "SimpleXMLRPCServer", "asyncore", # Internet Data Handling "formatter", "email", "mailcap", "mailbox", "mhlib", "mimetools", "mimetypes", "MimeWriter", "mimify", "multifile", "rfc822", "base64", "binascii", "binhex", "quopri", "uu", "xdrlib", "netrc", "robotparser", # Structured Markup Processing Tools "HTMLParser", "sgmllib", "htmllib", "htmlentitydefs", "xml", "xmllib", # Multimedia Services "audioop", "imageop", "aifc", "sunau", "wave", "chunk", "colorsys", "rgbimg", "imghdr", "sndhdr", # Cryptographic Services "hmac", "md5", "sha", "mpz", "rotor", # Graphical User Interfaces with Tk "Tkinter", "Tix", "ScrolledText", "turtle", "Idle", # Restricted Execution "rexec", "Bastion", # Python Language Services "parser", "symbol", "token", "keyword", "tokenize", "tabnanny", "pyclbr", "py_compile", "compileall", "dis", "distutils", # SGI IRIX Specific Services "al", "AL", "cd", "fl", "FL", "flp", "fm", "gl", "DEVICE", "GL", "imgfile", "jpeg", # SunOS Specific Services "sunaudiodev", "SUNAUDIODEV", # MS Windows Specific Services "msvcrt", "_winreg", "winsound", }; keyword "Editor_Keywords4" { # built-in exceptions as of Python 2.2.2 # Exceptions "Exception", "StandardError", "ArithmeticError", "LookupError", "EnvironmentError", "AssertionError", "AttributeError", "EOFError", "FloatingPointError", "IOError", "ImportError", "IndexError", "KeyError", "KeywordError", "MemoryError", "NameError", "NotImplementedError", "OSError", "OverflowError", "ReferenceError", "RuntimeError", "StopIteration", "SyntaxError", "SystemError", "SystemExit", "TypeError", "UnboundLocalError", "UnicodeError", "ValueError", "WindowsError", "ZeroDivisionError", # Warnings "Warning", "UserWarning", "DeprecationWarning", "SyntaxWarning", "RuntimeWarning", }; keyword "Lang_Assembler" { "self", "spam", "monty", "python", "lemon_curry", "silly_walks", "Chapman", "Cleese", "Gilliam", "Idle", "Jones", "Palin", }; h_state 0 { 'Normal' } h_trans { 8, '', 'def ', 'Keyword' } h_trans { 9, '', 'class ', 'Keyword' } h_trans { 1, '<', '#', 'Comment' } h_trans { 2, '', '\\\\', 'String' } h_trans { 2, '>', '\\"', 'String' } h_trans { 0, '>', '"""', 'String' } h_state 3 { 'String' } h_trans { 3, '>', '\\\\', 'String' } #special case for strings like "\\" h_trans { 3, '>', '\\"', 'String' } h_trans { 11, '>', '\\', 'String' } h_trans { 0, '>', '"', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'String' } h_trans { 4, '>', '\\\\', 'String' } #special case for strings like '\\' h_trans { 4, '>', '\\\'', 'String' } h_trans { 12, '>', '\\', 'String' } h_trans { 0, '>', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 5 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' } h_state 6 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 8 { 'Command' } h_trans { 0, '', '(', 'Punctuation' } h_state 9 { 'Command' } h_trans { 0, '', ':', 'Punctuation' } h_state 10 { 'String' } h_trans { 10, '>', '\\\\', 'String' } h_trans { 10, '>', '\\\'', 'String' } h_trans { 0, '>', '\'\'\'', 'String' } h_state 11 { 'String' } h_trans { 3, '>', '', 'String' } h_state 12 { 'String' } h_trans { 4, '>', '', 'String' } } mode PYTHON: PLAIN { FileNameRx = /\.\cPY$/; HilitOn = 1; Colorizer = "PYTHON"; IndentMode = "PLAIN"; AutoIndent = 1; MultiLineHilit = 1; AutoHilitParen = 1; Trim = 1; SpaceTabs = 1; MatchCase = 1; # WordWrap = 0; # ToggleAutoIndent = 1; FirstLineRx = /^\#\!.*python/; RoutineRegexp = /def[ ]+[^ ]/; SaveFolds = 2; # save fold info at end of line CommentStart = " #"; CommentEnd = ""; } # problems... # we have no indent support at all )-: # is block comment/uncomment possible via macro? ./config/m_plain.fte0000644000175000017500000000544310043766513013252 0ustar neilneil# PLAIN mode colorize PLAIN { SyntaxParser = 'PLAIN'; color { { 'Normal', 'Editor_Default' }, }; } mode PLAIN { #WordChars = 'A-Za-z0-9_'; Abbreviations = 1; AddCR = 1; # add CR when saving AddLF = 1; # add LF when saving AutoIndent = 1; # autoindent BackSpKillBlock = 0; # to delete block if marked BackSpKillTab = 0; # backspace kills entire tabs BackSpUnindents = 1; # backspace at bol unindents Colorizer = 'PLAIN'; CursorThroughTabs = 1; DefFindOpt = 'i'; # default find options DefFindReplaceOpt = 'a'; # default find/replace options DeleteKillBlock = 0; # "" DeleteKillTab = 0; # delete kills entire tabs DetectLineSep = 1; # autodetect eol separator ExpandTabs = 1; # expand tabs on display ForceNewLine = 0; # force CR/LF on last saved line HilitOn = 0; # syntax hilit on HilitTags = 0; IndentMode = 'PLAIN'; # indentation mode IndentWithTabs = 0; # use tabs for auto-indent Insert = 1; # insert mode InsertKillBlock = 0; # inserting char kills selected block KeepBackups = 1; # save backup files LeftMargin = 1; # wrap left margin LineChar = 10; # line separator for loading LoadMargin = -1; # right margin for loading MatchCase = 0; # find text case sensitively MultiLineHilit = 0; PersistentBlocks = 1; # 1 = persistent blocks, 0 = transient RightMargin = 72; # wrap right margin SaveBookmarks = 0; # save bookmarks (off = 0, start line = 1, end line = 2, history = 3) MakeBackups = 1; # save backups of files. SeeThruSel = 0; # transparent selections ShowMarkers = 1; # visible eol/eof markers ShowTabs = 0; # show tabs as small circle on display SpaceTabs = 0; # insert tabs as spaces StripChar = 13; # remove this char at eol when loading TabSize = 8; # tab size 1-32 Trim = 0; # remove whitespace from eol when editing TrimOnSave = 0; # remove whitespace before saving Undo = 1; # undo/redo enabled UndoLimit = 1023; # num of changes to save UndoMoves = 0; # undo cursor movement commands WordWrap = 0; # word wrap (off = 0, line = 1, paragraph=2) } ./config/m_merge.fte0000644000175000017500000000145607530515712013246 0ustar neilneilcolorize MERGE { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Changed', 'MERGE_Changed' }, { 'Old', 'MERGE_Old' }, { 'New', 'MERGE_New' }, { 'Control', 'MERGE_Control' }, }; h_state 0 { 'Normal' } h_trans { 1, '^<', '<<<<<<<', 'Control' } h_state 1 { 'Changed' } h_trans { 2, '^>', '|||||||', 'Control' } h_trans { 3, '^>', '=======', 'Control' } h_state 2 { 'Old' } h_trans { 3, '^>', '=======', 'Control' } h_state 3 { 'New' } h_trans { 0, '^>', '>>>>>>>', 'Control' } } mode MERGE: PLAIN { # unix/gnu rscmerge FileNameRx = /\.\cMRG$/; HilitOn = 1; Colorizer = 'MERGE'; MultiLineHilit = 0; } ./config/m_ada.fte0000644000175000017500000000460107234440755012674 0ustar neilneilcolorize Ada { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; keyword 'Editor_Keywords' { 'abort', 'else', 'new', 'return', 'abs', 'elsif', 'not', 'reverse', 'abstract', 'end', 'null', 'accept', 'entry', 'select', 'access', 'exception', 'separate', 'aliased', 'exit', 'of', 'subtype', 'all', 'or', 'and', 'for', 'others', 'tagged', 'array', 'function', 'out', 'task', 'at', 'terminate', 'generic', 'package', 'then', 'begin', 'goto', 'pragma', 'type', 'body', 'private', 'if', 'procedure', 'case', 'in', 'protected', 'until', 'constant', 'is', 'use', 'raise', 'declare', 'range', 'when', 'delay', 'limited', 'record', 'while', 'delta', 'loop', 'rem', 'with', 'digits', 'renames', 'do', 'mod', 'requeue', 'xor', }; h_state 0 { 'Normal' } h_trans { 4, '-s', 'a-zA-Z_', 'Normal' } h_trans { 1, '', '--', 'Comment' } h_trans { 2, '', '"', 'String' } h_trans { 3, '', '\'', 'String' } h_trans { 5, 's', '0-9', 'Number' } h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_state 1 { 'Comment' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'String' } h_trans { 0, '', '"', 'String' } h_trans { 0, '$', '', 'String' } h_trans { 4, 'Qq', '\\', 'String' } h_state 3 { 'String' } h_trans { 0, '', '\'', 'String' } h_trans { 0, '$', '', 'String' } h_state 4 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' } h_state 5 { 'Number' } h_trans { 0, '-S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } } mode Ada: PLAIN { # Ada mode FileNameRx = '\\.\\c{ADS}|{ADB}$'; Colorizer = 'Ada'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 0; AutoHilitParen = 1; RoutineRegexp = /^\s*{function}|{procedure}\s/; SaveFolds = 2; # save fold info at end of line CommentStart = ' --'; CommentEnd = ''; } ./config/m_diff.fte0000644000175000017500000000204110015231631013031 0ustar neilneilcolorize DIFF { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Old', 'DIFF_Old' }, { 'New', 'DIFF_New' }, { 'Changed', 'DIFF_Changed' }, { 'CPreprocessor', 'Lang_Preprocessor' }, }; h_state 0 { 'Normal' } h_trans { 1, '^', 'New' } h_trans { 2, '^ h_trans { 4, '^<', '@@', 'CPreprocessor' } h_state 1 { 'New' } h_trans { 0, '$', '', 'Normal' } h_state 2 { 'Old' } h_trans { 0, '$', '', 'Normal' } h_state 3 { 'Changed' } h_trans { 0, '$', '', 'Normal' } # just to mark the hunk boundaries (unified diff) h_state 4 { 'CPreprocessor' } h_trans { 0, '$', '', 'Normal' } } mode DIFF: PLAIN { # unix/gnu diff FileNameRx = /\.\c{{DIFF?}|{D?PATCH}}$/; FirstLineRx = /^diff /; HilitOn = 1; Colorizer = 'DIFF'; MultiLineHilit = 0; } ./config/ui_k_ne.fte0000644000175000017500000001777710376157260013263 0ustar neilneileventmap MODEL { key [F3_G-Down] { WinNext } key [F3_G-Up] { WinPrev } key [F3_G-Left] { FilePrev } key [F3_G-Right] { FileNext } key [F3_=] { WinHSplit } key [F3_-] { WinClose } key [F3_S-X] { FileLast } key [F3_S-N] { FileOpen } key [F3_S-Q] { FileClose } key [F6_S-V] { ShowVersion } key [F9] { RunProgram "" } key [F10] { MainMenu } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } key [C+Left] { ScrollRight } key [C+Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+Enter] { CloseActivate } key [C+R] { Rescan } } eventmap CVSDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap CVS: MLIST { LocalMenu = "MCvs"; } eventmap SVNDIFF: MLIST { key [C+G-Ins] { BlockCopy } key [Esc] { FileClose } } eventmap SVN: MLIST { LocalMenu = "MSvn"; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose 0 } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } key [C+C] { ChildClose } # does NOT kill, just closes pipe } eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [F3_S-S] { FileSave } key [F3_S-E] { FileSave; FileClose } key [F3_S-I] { BlockRead } key [F3_S-B] { BlockWrite } key [F4_S-S] { BlockMarkStream } key [F4_S-U] { BlockUnmark } key [F4_S-D] { BlockCut } key [F4_S-C] { BlockCopy; BlockPaste } key [F4_S-M] { BlockCut; BlockPaste } key [F4_S-L] { BlockSelectLine } key [F4_S-E] { BlockBegin; MoveLineEnd; BlockEnd; } key [F4_S-F] { MoveBlockStart } key [F5_S-L] { ChangeRightMargin } key [F5_S-W] { ToggleWordWrap } # tri-state ! key [F5_S-F] { WrapPara } key [F5_S-T] { ChangeTabSize } key [F5_S-I] { ToggleAutoIndent } key [F6_S-G] { MoveToLine } key [F6_S-M] { MatchBracket } key [F7_S-P] { FilePrint } key [F7_S-B] { BlockPrint } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [G-Ins] { ToggleInsert } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [BackSp] { BackSpace } key [G-Del] { Delete } key [C+W] { KillWordPrev } key [A+W] { KillWord } key [C+L] { KillToLineStart } key [A+L] { KillToLineEnd } key [A+K] { KillLine } key [C+V] { BlockEnd; MoveLineStart; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; } key [A+V] { BlockEnd; MoveLineEnd; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; } key [A+U] { Undo } key [C+U] { Redo } key [C+P] { InsertChar } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } } ./config/ui_m_ne.fte0000644000175000017500000003231611326137317013244 0ustar neilneilmenu Object { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "Open &Directory\tC+M" { DirOpen } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu MCvs { item "CVS C&heck" { RunCvs "-n update" } item "CVS &Update" { RunCvs "update -d" } item "CVS &Diff" { CvsDiff "" } item "CVS &Commit" { RunCvsCommit "" } item "CVS &Add" { RunCvs "add" } item "CVS &Remove" { RunCvs "remove" } item "CVS S&tatus" { RunCvs "status -v" } item "CV&S" { Cvs } item; item "&View CVS" { ViewCvs } item "View CVS Di&ff" { ViewCvsDiff } item "View CVS &log" { ViewCvsLog } item; item "Cl&ear CVS messages" { ClearCvsMessages } } menu MSvn { item "SVN C&heck" { RunSvn "-n update" } item "SVN &Update" { RunSvn "update -d" } item "SVN &Diff" { SvnDiff "" } item "SVN &Commit" { RunSvnCommit "" } item "SVN &Add" { RunSvn "add" } item "SVN &Remove" { RunSvn "remove" } item "SVN S&tatus" { RunSvn "status -v" } item "SV&N" { Svn } item; item "&View SVN" { ViewSvn } item "View SVN Di&ff" { ViewSvnDiff } item "View SVN &log" { ViewSvnLog } item; item "Cl&ear SVN messages" { ClearSvnMessages } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } # item "&Diff" { Compile "cvs diff" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item; submenu "C&VS\tC+O_C+V", MCvs; submenu "SV&N\tC+O_C+N", MSvn; } menu Window { # item "&New " { WinNewFrame } # item; item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tShift+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item "&Next view\tF4" { WinNext } item "&Prev view\tShift+F4" { WinPrev } item; item "Sa&ve Desktop" { DesktopSave } item "Save Desktop &As" { DesktopSaveAs } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } # item "&Shell" { } } menu Help { item "&About..." { ShowVersion } } # Directory Browser menu Directory { item "&Reload\tCtrl+R" { Rescan } item "&Close\tCtrl+F10" { FileClose } item; item "&Open file...\tF3" { FileOpen } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } item "&Delete File\tCtrl+D" { DeleteFile } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } # Editor - Editing Modes # PLAIN # menus menu MChangeMode { item "&Plain" { ChangeMode 'PLAIN' } item "&Text" { ChangeMode 'TEXT' } item "&C" { ChangeMode 'C' } item "&EMail" { ChangeMode 'MSG' } item "&HTML" { ChangeMode 'HTML' } item "&IPF" { ChangeMode 'IPF' } item "&Ada" { ChangeMode 'Ada' } item "&REXX" { ChangeMode 'REXX' } item "MAKE" { ChangeMode 'MAKE' } item "&FTE" { ChangeMode 'FTE' } item "Resource" { ChangeMode 'RESOURCE' } item "&DIFF" { ChangeMode 'DIFF' } item "&MERGE" { ChangeMode 'MERGE' } item "&SH" { ChangeMode 'SH' } item "PER&L" { ChangeMode 'PERL' } item "PASCAL" { ChangeMode 'PASCAL' } item "&JAVA" { ChangeMode 'JAVA' } item "TE&X" { ChangeMode 'TEX' } item "&BIN" { ChangeMode 'BIN' } } menu MOpenInMode { item "&Plain" { FileOpenInMode 'PLAIN' } item "&Text" { FileOpenInMode 'TEXT' } item "&C" { FileOpenInMode 'C' } item "&EMail" { FileOpenInMode 'MSG' } item "&HTML" { FileOpenInMode 'HTML' } item "&IPF" { FileOpenInMode 'IPF' } item "&Ada" { FileOpenInMode 'Ada' } item "&REXX" { FileOpenInMode 'REXX' } item "MAKE" { FileOpenInMode 'MAKE' } item "&FTE" { FileOpenInMode 'FTE' } item "Resource" { FileOpenInMode 'RESOURCE' } item "&DIFF" { FileOpenInMode 'DIFF' } item "&MERGE" { FileOpenInMode 'MERGE' } item "&SH" { FileOpenInMode 'SH' } item "PER&L" { FileOpenInMode 'PERL' } item "PASCAL" { FileOpenInMode 'PASCAL' } item "&JAVA" { FileOpenInMode 'JAVA' } item "TE&X" { FileOpenInMode 'TEX' } item "&BIN" { FileOpenInMode 'BIN' } } menu File { item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; # item "Open &Binary" { FileOpenInMode 'BIN' } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "Write &To..." { FileWriteTo } # item "Sa&ve and Close\tAlt+F2" { FileSave; FileClose } item "Prin&t" { FilePrint } # Save Rain Forest item "&Close\tCtrl+F10" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "Sh&ell" { RunProgram "" } item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; # item "&Insert line\tShift+Enter" { LineInsert } item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+Enter" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } # item "Dup&licate line\tCtrl+D" { LineDuplicate } # item "Delete to line &end\tAlt+End" { KillToLineEnd } # item "Delete to li&ne start\tCtrl+Shift+BackSp" { KillToLineStart } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } item "&ASCII Table...\tCtrl+Shift+A" { ASCIITable } } menu Translate { item "&Uppercase" { BlockCaseUp } item "&Lowercase" { BlockCaseDown } item "&Togglecase" { BlockCaseToggle } item "&Rot13" { BlockTrans 'A-Za-z' 'N-ZA-Mn-za-m' } item; item "User &specified..." { BlockTrans } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; # item "Select Wor&d" { BlockSelectWord } # item "Selec&t Line" { BlockSelectLine } # item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+Q C+W" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Fold { item "&Create fold\tAlt+Gray++" { FoldCreate } item "Create folds by ®exp..." { FoldCreateByRegexp } item "&Destroy fold\tAlt+Gray+-" { FoldDestroy } item; item "&Open fold\tCtrl+Gray++" { FoldOpen } item "Open &nested folds\tCtrl+Gray+*" { FoldOpenNested } item "C&lose fold\tCtrl+Gray+-" { FoldClose } item "&Toggle fold open/close\tCtrl+Gray+/" { FoldToggleOpenClose } item; item "&Promote fold\tShift+Gray+-" { FoldPromote } item "De&mote fold\tShift+Gray++" { FoldDemote } item; item "Open &all folds\tAlt+Gray+*" { FoldOpenAll } item "Close all &folds\tAlt+Gray+/" { FoldCloseAll } item "Destro&y all folds" { FoldDestroyAll } } menu Options { submenu "Change &mode\tC+O C+M", MChangeMode; item; item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item "Highlight tags" { ToggleHilitTags; WinRefresh } item "Show &bookmarks" { ToggleShowBookmarks; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tC+F10" { FileClose } } menu DirectoryFile { item "&Selected\tEnter" { Activate } item; item "&Open...\tF3" { FileOpen } submenu "Open in &Mode...\tCtrl+F3", MOpenInMode; item "Open &Binary" { FileOpenInMode 'BIN' } item; item "&Next\tAlt+Right" { FileNext } item "&Previous\tAlt+Left" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu MessagesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu RoutinesMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu BufferListMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu EventMapViewMain { submenu "&File", Object; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Help", Help; } menu DirectoryLocal { item "&Open" { Activate } item; item "&Reload\tCtrl+R" { Rescan } item; item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } item "&/ Goto Dir\t/" { DirGoto } item "&Delete File\tCtrl+D" { DeleteFile } } menu BufferListLocal { item "&View\tEnter" { Activate } item; item "&Save\tCtrl+S" { BufListFileSave } item "&Close\tCtrl+C" { BufListFileClose } } menu RoutinesLocal { item "&View\tEnter" { Activate } } menu EventMapViewLocal { item "&Close view\tAlt+Q" { FileClose } } menu MessagesLocal { item "&View error\tEnter" { Activate } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } } ./config/mymain.fte0000644000175000017500000000054707216710540013122 0ustar neilneil# Default personal main fte config file. # The purpose of this file is to allow individual users to add extra # functionality over and above what the sysadmin may have made available # without adversely affecting other users. # include the system main config - usually in /usr/local/fte/localconfig. include 'systemmain.fte'; # Personal settings go here. ./config/m_rst.fte0000644000175000017500000005230710506730262012754 0ustar neilneil# # FTE mode for editing ReStucturedText files # # ReStucturedText homepage: http://docutils.sourceforge.net/ # # Contributed by: Sergey Pinigin # # VER: alpha 11 [2006-08-29] # # Files: # m_rst.fte Macros, colorize, mode reST (include on main.fte) # menu/m_rst.fte Menus reST (include on ui_fte.fte) # kbd/k_rst.fte Keybindings reST(include on ui_fte.fte) # # # For testing reST-mode in FTE: # You mast open in FTE *.txt from Docutils documentation # and change mode to 'reST'. # # #### SUBs #### sub RST_LISTS_1ENT { LineNew; MoveUp; MoveWordRight; MoveDown; } sub RST_CODE { InsertString "::"; 2:LineNew; MoveUp; 2:MoveRight; } sub RST_INC { LineNew; MoveLineStart; InsertString ".. include:: "; } # ROLE ======================================================================== sub RST_ROLE_EMP { InsertString ":emphasis:``"; MoveLeft; } sub RST_ROLE_LIT { InsertString ":literal:``"; MoveLeft; } sub RST_ROLE_STR { InsertString ":strong:``"; MoveLeft; } sub RST_ROLE_SUB { InsertString ":sub:``"; MoveLeft; } sub RST_ROLE_SUP { InsertString ":sup:``"; MoveLeft; } sub RST_ROLE_TIT { InsertString ":title:``"; MoveLeft; } sub RST_ROLE_PEP { InsertString ":PEP:``"; MoveLeft; } sub RST_ROLE_RFC { InsertString ":RFC:``"; MoveLeft; } sub RST_ROLE_RAW { InsertString "raw-:``"; 3:MoveLeft; } sub RST_ROLE_DRAW { LineNew; InsertString ".. role:: raw-(raw)"; LineNew; InsertString " :format: "; LineNew; 2:MoveUp; 11:MoveRight; } # Inline ====================================================================== sub RST_INLINE_EMP { InsertString "**"; MoveLeft; } sub RST_INLINE_STR { InsertString "****"; 2:MoveLeft; } sub RST_INLINE_INT { InsertString "``"; MoveLeft; } sub RST_INLINE_LIT { InsertString "````"; 2:MoveLeft; } sub RST_INLINE_HLINK { InsertString "``_"; 2:MoveLeft; } sub RST_INLINE_ELINK { InsertString "`<>`_"; 4:MoveLeft; } sub RST_INLINE_ITAG { InsertString "_``"; MoveLeft; } # not set parse sub RST_INLINE_REF { InsertString "[]_"; 2:MoveLeft; } sub RST_INLINE_REFA { InsertString "[#]_"; 2:MoveLeft; } sub RST_INLINE_REFS { InsertString "||_"; 2:MoveLeft; } # Admonitions ================================================================= sub RST_ADM_ATTE { LineNew; MoveLineStart; InsertString ".. attention:: "; } sub RST_ADM_CAUT { LineNew; MoveLineStart; InsertString ".. caution:: "; } sub RST_ADM_DANG { LineNew; MoveLineStart; InsertString ".. danger:: "; } sub RST_ADM_ERRO { LineNew; MoveLineStart; InsertString ".. error:: "; } sub RST_ADM_HINT { LineNew; MoveLineStart; InsertString ".. hint:: "; } sub RST_ADM_IMPO { LineNew; MoveLineStart; InsertString ".. important:: "; } sub RST_ADM_NOTE { LineNew; MoveLineStart; InsertString ".. note:: "; } sub RST_ADM_TIP { LineNew; MoveLineStart; InsertString ".. tip:: "; } sub RST_ADM_WARN { LineNew; MoveLineStart; InsertString ".. warning:: "; } sub RST_ADM_ADMO { LineNew; MoveLineStart; InsertString ".. admonition:: "; } sub RST_ADM_TITL { LineNew; MoveLineStart; InsertString ".. title:: "; } # Document Parts ============================================================== sub RST_PART_CON { LineNew; MoveLineStart; InsertString ".. contents:: "; } sub RST_PART_CON_ { LineNew; MoveLineStart; InsertString ".. contents:: "; LineNew; InsertString " :depth:"; LineNew; InsertString ":backlinks:"; LineNew; InsertString ":local:"; LineNew; 4:MoveUp; MoveLineEnd; } sub RST_PART_SEC { LineNew; MoveLineStart; InsertString ".. sectnum:: "; } sub RST_PART_SEC_ { LineNew; MoveLineStart; InsertString ".. sectnum:: "; LineNew; InsertString " :depth:"; LineNew; InsertString ":prefix:"; LineNew; InsertString ":suffix:"; LineNew; InsertString ":start:"; LineNew; 5:MoveUp; MoveLineEnd; } sub RST_PART_HEAD { LineNew; MoveLineStart; InsertString ".. header:: "; } sub RST_PART_FOOT { LineNew; MoveLineStart; InsertString ".. footer:: "; } # Image ======================================================================= sub RST_IMAGE_FULL{ LineNew; MoveLineStart; InsertString ".. image:: "; LineNew; InsertString " :alt:"; LineNew; InsertString ":height:"; LineNew; InsertString ":width:"; LineNew; InsertString ":scale:"; LineNew; InsertString ":align:"; LineNew; InsertString ":target:"; LineNew; 7:MoveUp; MoveLineEnd; } sub RST_IMAGE { InsertString ".. image:: "; } sub RST_FIGURE_FULL{ LineNew; MoveLineStart; InsertString ".. figure:: "; LineNew; InsertString " :figwidth:"; LineNew; InsertString ":figclass:"; LineNew; InsertString ":align:"; LineNew; 4:MoveUp; MoveLineEnd; } sub RST_FIGURE { InsertString ".. figure:: "; } # Body Elements =============================================================== sub RST_BOEL_TOPI { LineNew; MoveLineStart; InsertString ".. topic:: "; } sub RST_BOEL_SIDE { LineNew; MoveLineStart; InsertString ".. sidebar:: "; } sub RST_BOEL_LBLK { LineNew; MoveLineStart; InsertString ".. line-block:: "; } sub RST_BOEL_PLIT { LineNew; MoveLineStart; InsertString ".. parsed-literal:: "; } sub RST_BOEL_RUBR { LineNew; MoveLineStart; InsertString ".. rubric:: "; } sub RST_BOEL_EPIG { LineNew; MoveLineStart; InsertString ".. epigraph:: "; } sub RST_BOEL_HIGH { LineNew; MoveLineStart; InsertString ".. highlights:: "; } sub RST_BOEL_PQUO { LineNew; MoveLineStart; InsertString ".. pull-quote:: "; } sub RST_BOEL_COMP { LineNew; MoveLineStart; InsertString ".. compound:: "; } sub RST_BOEL_CONT { LineNew; MoveLineStart; InsertString ".. container:: "; } # Table ======================================================================= sub RST_TAB_TIT { LineNew; MoveLineStart; InsertString ".. table:: "; } sub RST_TABS_2C { LineNew; InsertString "===== ====="; LineNew; LineNew; InsertString "===== ====="; LineNew; 2:MoveUp; MoveLineEnd; } sub RST_TABS_22H { LineNew; InsertString "===== ====="; LineNew; LineNew; InsertString "===== ====="; LineNew; LineNew; LineNew; InsertString "===== ====="; LineNew; 5:MoveUp; MoveLineEnd; } sub RST_TABS_22S { LineNew; InsertString "===== ===== ======"; LineNew; LineNew; InsertString "------------ ------"; LineNew; LineNew; InsertString "===== ===== ======"; LineNew; LineNew; LineNew; InsertString "===== ===== ======"; LineNew; 7:MoveUp; MoveLineEnd; } sub RST_TABG_22 { LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; 4:MoveUp; MoveRight; } sub RST_TABG_22H { LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+===========+==========+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; InsertString "| | |" LineNew; InsertString "+-----------+----------+"; LineNew; 6:MoveUp; MoveRight; } sub RST_TABCSV { LineNew; } sub RST_TABLIST { LineNew; MoveLineStart; InsertString ".. list-table:: "; LineNew; InsertString " :widths:"; LineNew; InsertString ":header-rows:"; LineNew; InsertString ":stub-columns:"; LineNew; LineNew; InsertString "* - "; LineNew; InsertString " - "; LineNew; 2:MoveLeft; InsertString "* - "; LineNew; InsertString " - "; LineNew; 9:MoveUp; MoveLineEnd; } #csv-table #header #file #url #encoding #delim #quote #keepspace #escape sub RST_H1 { MoveLineEnd; LineNew; 100:InsertString "="; # ========= MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H2 { MoveLineEnd; LineNew; 100:InsertString "-"; # --------- MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H3 { MoveLineEnd; LineNew; 100:InsertString "\""; # """"""""" MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H4 { MoveLineEnd; LineNew; 100:InsertString "'"; # ''''''''' MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_H5 { MoveLineEnd; LineNew; 100:InsertString "`"; # ````````` MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } sub RST_T { MoveLineEnd; LineNew; 100:InsertString "="; # ========= MoveUp; MoveLineEnd; LineTrim;MoveLineEnd; MoveDown; KillToLineEnd; } colorize reST { SyntaxParser = 'SIMPLE'; %if(COLORS_BLUE_BG) color { { 'Normal', 'Editor_Default' }, # Text { 'String', 'Editor_Keywords' }, # Emphasis, literal, strong .. { 'Comment', 'Lang_Comment' }, # Comment { 'Punctuation', 'Editor_Default' }, # .,:() .. { 'Special', 'Markup_Special' }, # :: { 'Tag', 'Editor_Keywords3' }, # .. _text; .. []; __ text; _``; { 'Directive', 'Markup_Symbol' }, { 'Symbol', 'String' }, # `text`_; word_ { 'Keyword', 'Editor_Keywords' }, }; %endif %if(COLORS_BLACK_BG) color { { 'Normal', 'Editor_Default' }, # Text { 'String', 'Lang_String' }, # Emphasis, literal, strong .. { 'Comment', 'Lang_Comment' }, # Comment { 'Punctuation', 'Markup_Punctuation' }, # .,:() .. { 'Special', 'Markup_Special' }, # :: { 'Tag', 'Markup_Tag' }, # .. _text; .. []; __ text; _``; { 'Directive', 'Markup_Symbol' }, { 'Symbol', 'Markup_Control' }, # `text`_; word_ { 'Keyword', 'Editor_Keywords' }, }; %endif # directives keyword 'Editor_Keywords' { # global keywords ... 'admonition', 'image', 'figure', 'topic', 'sidebar', 'line-block', 'parsed-literal', 'rubric', 'epigraph', 'highlights', 'pull-quote', 'compound', 'container', 'table', 'csv-table', 'list-table', 'contents', 'sectnum', 'section-numbering', 'header', 'footer', 'meta', 'replace', 'unicode', 'date', 'include', 'raw', 'class', 'role', 'default-role', 'title', 'restructuredtext-test-directive', 'style' }; # parameters keyword 'Editor_Keywords2' { ':target:', ':scale:', ':height:', ':width:', ':subtitle:', ':figclass:', ':figwidth:', ':alt:', ':align:', #-("top", "middle", "bottom", "left", "center", or "right" ) ':escape:', ':keepspace:', ':quote:', ':delim:', ':header:', ':widths:', ':header-rows:', ':stub-columns:', ':local:', ':backlinks:', ':depth:', ':prefix:', ':suffix:', ':start:', ':ltrim:', ':rtrim:', ':trim:', ':literal:', ':encoding:', ':file:', ':url:' }; keyword 'Editor_Keywords5' { 'attention', 'caution', 'danger', 'error', 'hint', 'important', 'note', 'tip', 'warning' }; #============================== h_state 0 { 'Normal' } #h_trans { 0, '<', /\\/, 'Normal' } # (\*.txt) #h_trans { 0, 's', /[.,;:()"\'{}\[\]]/, 'Punctuation' } h_trans { 0, '`_ #============================== h_state 9 { 'Symbol' } h_trans { 0, '>', ' < ', 'Symbol' } h_trans { 10, '>', ' <', 'Tag' } h_trans { 0, '>', '`__', 'Symbol' } h_trans { 0, '>', '`_', 'Symbol' } # <> #============================== h_state 10 { 'Tag' } h_trans { 9, '<', '>', 'Tag' } # |data| # | Quote text #============================== h_state 11 { 'String' } h_trans { 0, '', ':`', 'Punctuation' } h_wtype { -1, 0, 0, '<', 'a-zA-Z' } h_words 'String'{ 'emphasis', 'literal', 'strong', 'pep-reference', 'PEP', 'rfc-reference', 'RFC', 'subscript', 'sub', 'superscript', 'sup', 'title-reference', 'title', 't' } #============================== h_state 16 { 'String' } h_trans { 0, '>', '`', 'Punctuation' } #.. [Text] text #============================== h_state 17 { 'Tag' } h_trans { 0, '>', ']', 'Tag' } # _`text` entry #============================== h_state 18 { 'Tag' } h_trans { 0, '', '`', 'Tag' } # Skip Grid Tables #============================== h_state 19 { 'Normal' } h_trans { 20, '$', '', 'Normal' } #============================== h_state 20 { 'Normal' } h_trans { 19, '>x', /\s*[\+\|]+/, 'Normal' } h_trans { 0, '$', '', 'Normal' } # Skip "" #============================== h_state 21 { 'Normal' } h_trans { 0, '>', '"', 'Normal' } # ``text`` entry #============================== h_state 22 { 'String' } h_trans { 0, '>', '``', 'String' } # Skip '' #============================== h_state 23 { 'Normal' } h_trans { 0, '>', '\'', 'Normal' } # first line comment #============================== h_state 24 { 'Special' } h_trans { 25, '$', '', 'Normal' } # up to EOL h_state 25 { 'Special' } h_trans { 0, '$', '', 'Normal' } # empty string h_trans { 0, ' ? @ [ \ ] ^ _ ` { | } ~ #+------------------------------+ #| paragraph | #| (ends with "::") | #+------------------------------+ #+------------------------------+ #| ">" per-line-quoted | #| ">" contiguous literal block | #+------------------------------+ # #+------+-----------------------+ #| "| " | line | #+------| continuation line | # +-----------------------+ #+-------+----------------------+ #| ".. " | "_" name ":" link | #+-------+ block | # | | # +----------------------+ #+-------+----------------------+ #| ".. " | comment | #+-------+ block | # | | # +----------------------+ # #emphasis: "*" #strong emphasis: "**" #interpreted text: "`" #inline literals: "``" #substitution references: "|" ./config/menu/0000755000175000017500000000000011621703701012062 5ustar neilneil./config/menu/m_rexx.fte0000644000175000017500000004577007260001746014105 0ustar neilneil# FTE pull-down menu for REXX mode # by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 # Decide if you want menus for libraries # Uncomment to include %define(REXXUtil) #%define(RxFTP) #%define(RxSock) menu REXX_Comments { item "&Header\theadx" { REXX_Heading } item "&Comment\tC+E c" { REXX_Comment } } menu REXX_Constructs { item "&Do\tdox" { REXX_Do } item "Do &While\tdwx" { REXX_DoWhile } item "Do &Until\tdux" { REXX_DoUntil } item "Do &Forever\tdfx" { REXX_DoForever } item "&If-Then-Else\tifx" { REXX_If } item "&Select\tselx" { REXX_Select } } # Keywords menu REXX_Call { item "&Call" { InsertString "CALL name [expression]"; } item "Call &On" { InsertString "CALL ON condition [NAME trapname]"; } item "Call O&ff" { InsertString "CALL OFF condition"; } } menu REXX_Numeric { item "&Digits" { InsertString "NUMERIC DIGITS [expression]"; } item "&Form" { InsertString "NUMERIC FORM [SCIENTIFIC | ENGINEERING | [VALUE] exp]"; } item "Fu&zz" { InsertString "NUMERIC FUZZ [exp]"; } } menu REXX_Parse { item "&Arg" { InsertString "PARSE [UPPER] ARG [template]"; } item "&LineIn" { InsertString "PARSE [UPPER] LINEIN [template]"; } item "&Pull" { InsertString "PARSE [UPPER] PULL [template]"; } item "&Source" { InsertString "PARSE [UPPER] SOURCE [template]"; } item "&Value" { InsertString "PARSE [UPPER] VALUE [expression] WITH [template]"; } item "Va&r" { InsertString "PARSE [UPPER] VAR [template]"; } item "Ver&sion" { InsertString "PARSE [UPPER] VERSION [template]"; } } menu REXX_Signal { item "&Signal" { InsertString "SIGNAL labelname"; } item "&Value" { InsertString "SIGNAL [VALUE] expression"; } item "&On" { InsertString "SIGNAL ON condition [NAME trapname]"; } item "O&ff" { InsertString "SIGNAL OFF condition"; } } menu REXX_Trace { item "&All" { InsertString "TRACE 'A'"; } item "&Commands" { InsertString "TRACE 'C'"; } item "&Error" { InsertString "TRACE 'E'"; } item "&Failure" { InsertString "TRACE 'F'"; } item "&Intermediates" { InsertString "TRACE 'I'"; } item "&Labels" { InsertString "TRACE 'L'"; } item "&Normal" { InsertString "TRACE 'N'"; } item "&Off" { InsertString "TRACE 'O'"; } item "&Results" { InsertString "TRACE 'R'"; } } menu REXX_Keywords { item "Address" { InsertString "ADDRESS [environment/value] [expression]"; } item "Ar&g" { InsertString "ARG [template]"; } submenu "&Call", REXX_Call; item "&Drop" { InsertString "DROP variable-list"; } item "E&xit" { InsertString "EXIT expression"; } item "Interpret" { InsertString "INTERPRET expression"; } item "Iterate" { InsertString "ITERATE name"; } item "Le&ave" { InsertString "LEAVE name"; } item "&NOP" { InsertString "NOP"; } submenu "Numer&ic", REXX_Numeric; item "&Options" { InsertString "OPTIONS expression"; } submenu "&Parse", REXX_Parse; item "Proc&edure" { InsertString ": PROCEDURE [EXPOSE variable-list]"; } item "Pu&ll" { InsertString "PULL [TEMPLATE]"; } item "P&ush" { InsertString "PUSH [expression]"; } item "&Queue" { InsertString "QUEUE [expression]"; } item "&Return" { InsertString "RETURN [expression]"; } item "Sa&y" { InsertString "SAY [expression]"; } submenu "&Signal", REXX_Signal; submenu "&Trace", REXX_Trace; } # Built-in Functions menu REXX_API { item "&Create Queue" { InsertString "RxQueue( Create [, queuename] )"; } item "&Delete Queue" { InsertString "RxQueue( Delete, queuename )"; } item "&Get Queue" { InsertString "RxQueue( Get )"; } item "&Set Queue" { InsertString "RxQueue( Set, newqueuename )"; } item "&Queued" { InsertString "Queued()"; } item "RxFunc&Add" { InsertString "RxFuncAdd( name, module, procedure )"; } item "RxFuncD&rop" { InsertString "RxFuncDrop( name )"; } item "RxFuncQuer&y" { InsertString "RxFuncQuery( name )"; } } menu REXX_Comp { item "Bit&And" { InsertString "BitAnd(string1 [, string2 ] [, pad ] )"; } item "Bit&Or" { InsertString "BitOr( string1 [, string2 ] [, pad ] )"; } item "Bit&Xor" { InsertString "BitXor( string1 [, string2 ] [, pad ] )"; } item "&Compare" { InsertString "Compare( string1, string2 [,pad] )"; } item "&Datatype" { InsertString "Datatype( string [, type ] )"; } item "&Translate" { InsertString "Translate(string, [[,tableo [,tablei [, pad]]]])"; } item "&Value" { InsertString "Value(name, [, [newvalue] [,selector]])"; } item "Veri&fy" { InsertString "Verify(string, reference [, [option] [,start]])"; } item "X&Range" { InsertString "XRange([start] [, end])"; } } menu REXX_Conv { item "B2X\t&1" { InsertString "B2X( binary_string )"; } item "C2D\t&2" { InsertString "C2D( string [, n] )"; } item "C2X\t&3" { InsertString "C2X( string )"; } item "D2C\t&4" { InsertString "D2C(number)[,n]"; } item "D2X\t&5" { InsertString "D2X(number[, n])"; } item "X2B\t&6" { InsertString "X2B(hexstring)"; } item "X2C\t&7" { InsertString "X2C(hexstring)"; } item "X2D\t&8" { InsertString "X2D(hextring [,n])"; } } menu REXX_Date { item "&Basedate" { InsertString "DATE('B')"; } item "&Days" { InsertString "DATE('D')"; } item "&European" { InsertString "DATE('E')"; } item "&Language" { InsertString "DATE('L')"; } item "&Month" { InsertString "DATE('M')"; } item "&Normal" { InsertString "DATE('N')"; } item "&Ordered" { InsertString "DATE('O')"; } item "&Sorted" { InsertString "DATE('S')"; } item "&USA" { InsertString "DATE('U')"; } item "&Weekday" { InsertString "DATE('W')"; } } menu REXX_Num { item "&Abs" { InsertString "Abs(number)"; } item "&Digits" { InsertString "Digits()"; } item "&Form" { InsertString "Form()"; } item "Fo&rmat" { InsertString "Format( number, [before [, after [, expp] [,expt] ]])"; } item "Fu&zz" { InsertString "Fuzz()"; } item "Ma&x" { InsertString "Max( number [, number ...] )"; } item "Mi&n" { InsertString "Min( number [, number ...] )"; } item "Rando&m" { InsertString "Random([min], [max] [, seed])"; } item "&Sign" { InsertString "Sign(number)"; } item "&Trunc" { InsertString "Trunc(number [,n])"; } } menu REXX_Stream { item "&Command" { InsertString "Stream(name, 'C]', streamcommand)"; } item "&Description" { InsertString "Stream(name, 'D')"; } item "&State" { InsertString "Stream(name, 'S')"; } } menu REXX_Strings { item "&Abbrev" { InsertString "Abbrev(information, info [,length])"; } item "Arg" { InsertString "Arg([n [, option]])"; } item "&Center" { InsertString "Center( string, length [, pad ] )"; } item "Char&In" { InsertString "CharIn( [name] [, start, length ] )"; } item "Char&Out" { InsertString "CharOut( [name] [, string, start ] )"; } item "Chars" { InsertString "Chars( [name] )"; } item "Copies" { InsertString "Copies( string, n )"; } item "&DelStr" { InsertString "DelStr( string, n, [, length] )"; } item "I&nsert" { InsertString "Insert( new, target [, [n] [, [length] [,pad]]])"; } item "&LastPos" { InsertString "LastPos( needle, haystack [,start])"; } item "Le&ft" { InsertString "Left( string, length [,pad] )"; } item "Lengt&h" { InsertString "Length( string )"; } item "Lin&eIn" { InsertString "LineIn( [name] [, [line] [,count] ] )"; } item "LineOu&t" { InsertString "LineOut( [name] [, [string] [,line]] )"; } item "Line&s" { InsertString "Lines( [name] )"; } item "O&verlay" { InsertString "Overlay(new, target [, [n] [, [length] [,pad]]])"; } item "Pos" { InsertString "Pos( needle, haystack [, start] )"; } item "&Reverse" { InsertString "Reverse( string )"; } item "Ri&ght" { InsertString "Right( string, length, [,pad] )"; } item "S&pace" { InsertString "Space( string [, [n] [,pad]] )"; } item "Strip" { InsertString "Strip(string [, [option] [, char]])"; } item "Su&bstr" { InsertString "Substr(string, n [, [length] [, pad]])"; } item "S&ymbol" { InsertString "Symbol(name)"; } } menu REXX_Sys { item "&Address" { InsertString "Address()"; } item "&Beep" { InsertString "Beep(frequency, duration)"; } item "&Condition" { InsertString "Condition( option )"; } item "&Directory" { InsertString "Directory([newdirectory])"; } item "Error&Text" { InsertString "ErrorText(n)"; } item "&EndLocal" { InsertString "EndLocal()"; } item "&FileSpec" { InsertString "FileSpec(element, filespec)"; } item "Set&Local" { InsertString "SetLocal()"; } item "&SourceLine" { InsertString "SourceLine([n])"; } item "T&race" { InsertString "Trace([option])"; } } menu REXX_Time { item "&24-Hour" { InsertString "TIME()"; } item "&Civil" { InsertString "TIME('C')"; } item "&Elapsed" { InsertString "TIME('E')"; } item "&Hours" { InsertString "TIME('H')"; } item "&Long" { InsertString "TIME('L')"; } item "&Minutes" { InsertString "TIME('M')"; } item "&Normal" { InsertString "TIME('N')"; } item "&Reset" { InsertString "TIME('R')"; } item "&Seconds" { InsertString "TIME('S')"; } } menu REXX_Word { item "&DelWord" { InsertString "DelWord( string, n [, length] )"; } item "&SubWord" { InsertString "SubWord(string, n [,length])"; } item "&Word" { InsertString "Word(string, n)"; } item "Word&Index" { InsertString "WordIndex(string, n)"; } item "Word&Length" { InsertString "WordLength(string, n)"; } item "Word&Pos" { InsertString "WordPos(phrase, string [,start])"; } item "Wor&ds" { InsertString "Words(string)"; } } menu REXX_BuiltIn { submenu "&API", REXX_API; submenu "Com&parison", REXX_Comp; submenu "&Conversion", REXX_Conv; submenu "&Date", REXX_Date; submenu "&Numbers", REXX_Num; submenu "&Stream", REXX_Stream; submenu "Strin&gs", REXX_Strings; submenu "S&ystem", REXX_Sys; submenu "&Time", REXX_Time; submenu "&Word", REXX_Word; } #REXXUtil Functions %if(REXXUtil) menu REXX_Disk { item "SysDrive&Info" { InsertString "info = SysDriveInfo(drive)"; } item "SysDrive&Map" { InsertString "map = SysDriveMap([drive], [opt])"; } item "SysFile&Delete" { InsertString "rc = SysFileDelete(file)"; } item "SysFile&Tree" { InsertString "rc = SysFileTree(filespec, stem, [options], [tattrib], [nattrib])"; } item "SysFile&Search" { InsertString "CALL SysFileSearch target, file, stem, [options]"; } item "Sys&GetEA" { InsertString "result = SysGetEA(file, name, variable)"; } item "SysM&kDir" { InsertString "rc = SysMkDir(dirspec)"; } item "Sys&PutEA" { InsertString "result = SysPutEA(file, name, value)"; } item "Sys&RmDir" { InsertString "rc = SysRmDir(dirspec)"; } item "SysSear&chPath" { InsertString "filespec = SysSearchPath(path, filename)"; } item "SysTemp&FileName" { InsertString "file = SysTempFileName(template, [filter])"; } } menu REXX_INI { item "&Set key value" { InsertString "result = SysIni([inifile], app, key, val)"; } item "&Query key value" { InsertString "result = SysIni([inifile], app, key)"; } item "&Delete key" { InsertString "result = SysIni([inifile], app, key, 'DELETE:')"; } item "Delete &application" { InsertString "result = SysIni([inifile], app, ['DELETE:'])"; } item "Query application &keys" { InsertString "result = SysIni([inifile], app, 'ALL:', 'stem')"; } item "Query a&ll apps" { InsertString "result = SysIni([inifile], 'ALL:', 'stem')"; } } menu REXX_Misc { item "Rx&MessageBox" { InsertString "action = RxMessageBox(text, [title], [button], [icon])"; } item "Sys&DropFuncs" { InsertString "CALL SysDropFuncs"; } item "Sys&GetMessage" { InsertString "msg = SysGetMessage(num, [file] [str1],...[str9])"; } item "Sys&OS2Ver" { InsertString "ver = SysOS2Ver()"; } item "Sys&Sleep" { InsertString "CALL SysSleep secs"; } item "Sys&WaitNamedPipe" { InsertString "result = SysWaitNamedPipe(name, [timeout])"; } } menu REXX_TxtScr { item "Sys&Cls" { InsertString "CALL SysCls"; } item "SysC&urPos" { InsertString "pos = SysCurPos([row, col])"; } item "SysCu&rState" { InsertString "CALL SysCurState ON/OFF"; } item "Sys&GetKey" { InsertString "key = SysGetKey([ECHO/NOECHO])"; } item "Sys&TextScreenRead" { InsertString "string = SysTextScreenRead(row, col, [len])"; } item "SysTe&xtScreenSize" { InsertString "result = SysTextScreenSize()"; } } menu REXX_WPS { item "Sys&CreateObject" { InsertString "rc = SysCreateObject(classname, title, location [,setup] [,option])"; } item "Sys&DeregisterObjectClass" { InsertString "rc = SysDeregisterObjectClass(class)"; } item "SysDe&stroyObject" { InsertString "result = SysDestroyObject(name)"; } item "Sys&QueryClassList" { InsertString "CALL SysQueryClassList stem"; } item "Sys&RegisterObjectClass" { InsertString "rc = SysRegisterObjectClass(class, module)"; } item "SysSet&Icon" { InsertString "rc = SysSetIcon(filename, iconfilename)"; } item "SysSet&ObjectData" { InsertString "rc = SysSetObjectData(name, setup)"; } item "SysCo&pyObject" {InsertString "rc = SysCopyObject(objectName, objectDest)"; } item "SysCr&eateShadow" {InsertString "rc = SysCreateShadow(objectName, objectDest)"; } item "SysMo&veObject" {InsertString "rc = SysMoveObject(objectName, objectDest)"; } item "SysS&aveObject" {InsertString "rc = SysSaveObject(name, fAsync)"; } item "SysOpe&nObject" {InsertString "rc = SysOpenObject(name, View, Flag)"; } } menu REXX_RU { item "&Load REXXUtil\tutilx" { REXX_RexxUtil } submenu "&Disk Services", REXX_Disk; submenu "&Miscellaneous", REXX_Misc; submenu "&SysIni", REXX_INI; submenu "&Text Screen Svc", REXX_TxtScr; submenu "&WPS Services", REXX_WPS; } %endif # REXXSock %if(OS_OS2) %if(RxSock) menu REXX_RS { item "&Load REXXSock\tsockx" { REXX_RxSock } item "Sock&Accept" { InsertString "socket = SockAccept(socket[,address])"; } item "Sock&Bind" { InsertString "rc = SockBind(socket,address)"; } item "Sock&Close" { InsertString "rc = SockClose(socket)"; } item "SockConnec&t" { InsertString "rc = SockConnect(socket,address)"; } item "Sock&DropFuncs" { InsertString "rc = SockDropFuncs()"; } item "Sock&GetHostByAddr" { InsertString "rc = SockGetHostByAddr(dotAddress,host[,domain])"; } item "SockGetHostBy&Name" { InsertString "rc = SockGetHostByName(nameAddress,host])"; } item "SockGetHost&Id" { InsertString "dotAddress = SockGetHostId()"; } item "SockGetP&eerName" { InsertString "rc = SockGetPeerName(socket,address)"; } item "SockGetSockNa&me" { InsertString "rc = SockGetSockName(socket,address)"; } item "SockGetSockO&pt" { InsertString "rc = SockGetSockOpt(socket,level,optVar,optVal"; } item "&SockInit" { InsertString "rc = SockInit()"; } item "SockI&octl" { InsertString "rc = SockIoctl(socket,ioctlCmd,ioctlData)"; } item "Soc&kListen" { InsertString "rc = SockListen(socket,backlog)"; } item "SockPSock_Errno" { InsertString "SockPSock_Errno([error_string])"; } item "SockRec&v" { InsertString "rc = SockRecv(socket,var,len[,flags])"; } item "SockRecv&From" { InsertString "rc = SockRecvFrom(socket,var,len[,flags],address)"; } item "SockSelect" { InsertString "rc = SockSelect(reads,writes,excepts[,timeout])"; } item "SockSend" { InsertString "rc = SockSend(socket,data[,flags])"; } item "SockSendTo" { InsertString "rc = SockSendTo(socket,data[,flags],address)"; } item "SockSetSockOpt" { InsertString "rc = SockSetSockOpt(socket,level,optVar,optVal)"; } item "SockShutDo&wn" { InsertString "rc = SockShutDown(socket,how)"; } item "SockSock_E&rrno" { InsertString "errno = SockSock_Errno()"; } item "SockSocket" { InsertString "socket = SockSocket(domain,type,protocol)"; } item "SockSoClose" { InsertString "rc = SockSoClose(socket)"; } item "SockVersion" { InsertString "vers = SockVersion()"; } } %endif # RxFTP %if(RxFTP) menu REXX_F { item "&Load REXXFTP\tftpx" { REXX_RxFTP } item "&Append to Remote File" { InsertString "rc = FtpAppend(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "&ChDir Remote" { InsertString "rc = FtpChDir(directory)"; } item "&Delete Remote File" { InsertString "FtpDelete(remoteFile)"; } item "&Remote Dir Listing" { InsertString "FtpDir(pattern,stem)"; } item "Dr&op RxFTP Functions" { InsertString "FtpDropFuncs()"; } item "Do&wnload File" { InsertString "FtpGet(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "Lo&goff" { InsertString "FtpLogoff()"; } item "Remote L&s Listing" { InsertString "FtpLs(pattern,stem)"; } item "M&kDir Remote" { InsertString "FtpMkDir(directory)"; } item "&Ping Host" { InsertString "FtpPing(host,length)"; } item "Copy by Pro&xy" { InsertString "FtpProxy(rc = FtpProxy(host1,userid1,password1,account1,host2,userid2,password2,account2,file1,file2[,'Binary'|'Ascii']))"; } item "Upload &File" { InsertString "FtpPut(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "Upload File, Uni&que" { InsertString "FtpPutUnique(localFile,remoteFile[,'Binary'|'Ascii'])"; } item "G&et Current Remote Dir" { InsertString "FtpPwd(dirName)"; } item "Se&nd a String" { InsertString "FtpQuote(quote)"; } item "Rena&me Remote File" { InsertString "FtpRename(oldFile,newFile)"; } item "RmD&ir Remote" { InsertString "FtpRmDir(directory)"; } item "&Binary or ASCII" { InsertString "FtpSetBinary('Binary'|'Ascii')"; } item "Set &User Information" { InsertString "FtpSetUser(host,userid,password[,account])"; } item "Sen&d Site Information" { InsertString "FtpSite(site)"; } item "Get Remo&te Operating System" { InsertString "FtpSys(operSys)"; } item "&Version of RxFTP API" { InsertString "FtpVersion(variable)"; } } %endif %endif menu REXX_Libraries { %if(REXXUtil) submenu "REXX&Util", REXX_RU; %endif %if(OS_OS2) %if(RxSock) submenu "REXX&Sock", REXX_RS; %endif %if(RxFTP) submenu "REXX&FTP", REXX_F; %endif %endif } menu REXXTags { submenu "&Comments", REXX_Comments; submenu "Co&nstructs", REXX_Constructs; submenu "&Keywords", REXX_Keywords; submenu "&Libraries", REXX_Libraries; submenu "&Functions", REXX_BuiltIn; } menu Main_REXX { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&REXX", REXXTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap REXX { MainMenu = "Main_REXX"; # menu for menubar key [A+R] { MainMenu 'R' } } ./config/menu/m_c.fte0000644000175000017500000000133511331412500013312 0ustar neilneil# menu definitions for C mode menu Local_C { item "&Find word\tCtrl+]" { TagFindWord } item "&Go back\tCtrl+[" { TagPop} item; item "&Unmark\tEsc" { BlockMarkStream; BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Indent line\tTab" { LineIndent } item "I&ndent block\tAlt+\\" { BlockReIndent } } eventmap C { LocalMenu = 'Local_C'; # local menu for C mode } ./config/menu/m_html.fte0000644000175000017500000002103007406006665014051 0ustar neilneil# FTE menus for editing HTML files # maintained by m_debusk@sourceforge.com # Revision 2001-11-18 # HTML menu HTML_DTD { item "XHTML 1.0 &Transitional" { HTML_DTD_X1T } item "XHTML 1.0 &Strict" { HTML_DTD_X1S } item "XHTML 1.0 &Frameset" { HTML_DTD_X1F } item; item "HTML &4.01 Transitional" { HTML_DTD_4T } item "HTML 4.0&1 Strict" { HTML_DTD_4S } item "HTML 4.&01 Frameset" { HTML_DTD_4F } item; item "HTML &3.2 Final" { HTML_DTD_32F } item; item "HTML &2.0" { HTML_DTD_2 } } menu HTML_Character { item "&Bold C-E C-B" { HTML_B } item "&Strong C-E C-S" { HTML_STRONG } item "&Italic C-E C-I" { HTML_I } item "&Emphasize C-E C-E" { HTML_EM } item "Bi&g C+E A+B" { HTML_BIG } item "S&mall C+E A+S" { HTML_SMALL } item "S&ubscript C+E A+U" { HTML_SUB } item "Superscri&pt C+E A+P" { HTML_SUP } item "Bidirecti&on C+E A+O" { HTML_BDO } } menu HTML_Output { item "Pre&formatted
        C-E C-F" { HTML_PRE }
          item    "&Code           C-E C-C" { HTML_CODE }
          item    "&Typewriter       C-E C-T" { HTML_TT }
          item    "&Kbd entry       C-E C-K" { HTML_KBD }
          item    "&Variable        C-E C-V" { HTML_VAR }
          item    "Sam&ple msg     C-E C-M" { HTML_SAMP }
      }
      
      menu HTML_Header {
          item    "&1  

      C-E 1" { HTML_H1 } item "&2

      C-E 2" { HTML_H2 } item "&3

      C-E 3" { HTML_H3 } item "&4

      C-E 4" { HTML_H4 } item "&5

      C-E 5" { HTML_H5 } item "&6
      C-E 6" { HTML_H6 } } menu HTML_List { item "List &item
    5. C-E i " { HTML_LI } item "&Unordered list C-E u " { HTML_UL } item "&Ordered list
        C-E o " { HTML_OL } item "&Definition C-E C-D" { HTML_DFN } item "Definition &list
        C-E l " { HTML_DL } item "Definition &tag
        C-E t " { HTML_DT } item "Definition D&ata
        C-E d " { HTML_DD } } menu HTML_Table { item "&Table C-E A-T " { HTML_TABLE } item "&Caption C-E A-R" { HTML_TR } item "&Data " { HTML_COL } item "Column &Group C+E A+G" { HTML_COLGROUP } item "TH&ead C+E h " { HTML_THEAD } item "TFo&ot C+E f " { HTML_TFOOT } item "TBod&y C+E b " { HTML_TBODY } } menu HTML_Colors { item "&Black " { InsertString "#000000" } item "Bl&ue " { InsertString "#0000ff" } item "&Cyan " { InsertString "#00ffff" } item "&Gray " { InsertString "#808080" } item "Gr&een " { InsertString "#008000" } item "&Lime " { InsertString "#00ff00" } item "&Magenta" { InsertString "#ff00ff" } item "M&aroon " { InsertString "#800000" } item "&Navy " { InsertString "#000080" } item "&Olive " { InsertString "#808000" } item "&Purple " { InsertString "#800080" } item "&Red " { InsertString "#ff0000" } item "&Silver " { InsertString "#c0c0c0" } item "&Teal " { InsertString "#008080" } item "&White " { InsertString "#ffffff" } item "&Yellow " { InsertString "#ffff00" } } menu HTML_Blocks { item "&Abbreviation C+E C+A" { HTML_ABBR } item "Acron&ym C+E C+Y" { HTML_ACRONYM } item "Addre&ss
        C+E A+A" { HTML_ADDRESS } item "&Blockquote
        C+E C+Q" { HTML_BLOCKQUOTE } item "&Citation C-E C-O" { HTML_CITE } item "&Deleted Text C+E A+E" { HTML_DEL } item "&Inserted Text C+E A+I" { HTML_INS } item "&Quote C+E A+Q" { HTML_Q } } menu HTML_Links { item "Anchor &Name C-E C-N" { HTML_ANAME } item "Anchor H&Ref C-E C-H" { HTML_AHREF } item "Resource &Link C+E C+L" { HTML_LINK } } menu HTML_Frames { item "&Frameset C+E 7 " { HTML_FRAMESET } item "F&rame C+E A+F" { HTML_FRAME } item "&No Frames C+E C+R" { HTML_NOFRAMES } item "&Inline Frame <iframe> " { HTML_IFRAME } } menu HTML_Input { item "&Form <form> " { HTML_FORM } item "&Input Field <input> " { HTML_INPUT } item "&Text Area <textarea> " { HTML_TEXTAREA } item "Push &Button <button> " { HTML_BUTTON } item "&Selectable list <select> " { HTML_SELECT } item "&List box item <option> " { HTML_OPTION } item "&Option group <optgroup> " { HTML_OPTGROUP } item "La&bel <label> " { HTML_LABEL } item "Fiel&dset <fieldset> " { HTML_FIELDSET } item "Fi&eldset title <legend> " { HTML_LEGEND } } menu HTML_Images { item "Ima&ge Source <img src> C-E C-G" { HTML_IMG } item "Image &Map <map> C+E A+M" { HTML_MAP } item "Image Map &Area <area> " { HTML_AREA } } menu HTML_Styles { submenu "C&olors ", HTML_Colors; item; item "&Style <style> C+E A+L" { HTML_STYLE } item "&Division <div> C+E A+V" { HTML_DIV } item "S&pan Style <span> C+E C+W" { HTML_SPAN } item "&Centered <center> C-E . " { HTML_CENTER } } menu HTML_Prog { item "&Script <script> " { HTML_SCRIPT } item "&Parameters <param> " { HTML_PARAM } item "Script &Alternative <noscript> " { HTML_NOSCRIPT } item "Ob&ject <object> C+E C+J" { HTML_OBJECT } } menu HTML_Doc { submenu "Document T&ype Definitions ", HTML_DTD; submenu "&Frames ", HTML_Frames; item; item "&Body <body> C+E 9 " { HTML_BODY } item "Declare &HTML <html> C+E C+Z" { HTML_HTM } item "Convert Te&xt C-E &x " { HTML_TXT } item "Co&mment block <!-- --> C-E c " { HTML_COMMENT } item "Hea&d <head> C+E 8 " { HTML_HEAD } item "&Title <title> " { HTML_TITLE } item "Meta &Info <meta /> " { HTML_META } item "Ba&se <base /> C+E C+U" { HTML_BASEURL } } menu HTMLTags { item "&Paragraph <p> C-E C-P" { HTML_P } item "Line brea&k <br> C-E Enter" { HTML_BR } item "Horiz. rule <hr> C-E &-" { HTML_HR } item "Basic document C-E &0" { HTML_Base } item "Basic Frame Document" { HTML_BaseFrame } item; submenu "Do&cument Tags", HTML_Doc; submenu "C&haracter Format", HTML_Character; submenu "Output &Format", HTML_Output; submenu "&Blocks", HTML_Blocks; submenu "Hea&der", HTML_Header; submenu "&Lists", HTML_List; submenu "&Tables", HTML_Table; submenu "L&inks", HTML_Links; submenu "F&orms", HTML_Input; submenu "Ima&ges", HTML_Images; submenu "St&yles", HTML_Styles; submenu "P&rogramming", HTML_Prog; } menu HTMLTools { item "&View in Browser\tF9" { FileSave; HTML_View } item "Save and &Tidy" { FileSave; HTML_Tidy; FileReload; } item "Save and &ISpell" { FileSave; RunProgram "E:\\ISPELL40\\ispell.exe " . $FilePath; FileReload; } item; item "&Shell\tAlt+F9" { RunProgram "" } item "&Run...\tCtrl+F9" { RunProgram } item; item "&Previous error\tF11" { CompilePrevError } item "&Next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } item "C&lear Messages" { ClearMessages } } menu Main_HTML { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", HTMLTools; submenu "HT&ML", HTMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap HTML { MainMenu = "Main_HTML"; # menu for menubar key [A+M] { MainMenu 'M' } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/menu/m_rst.fte�����������������������������������������������������������������������������0000644�0001750�0001750�00000011470�10506730262�013714� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE menus for editing reStructureedText files # maintained by: Sergey Pinigin # Revision: 2006-08-29 # # RST_* macros are defined in ../m_rst.fte # keybindings are defined in ../kbd/k_rst.fte # this file is included from ../ui_fte.fte menu RST_Sections { item "Section C-E &1" { RST_H1 } item "Section C-E &2" { RST_H2 } item "Section C-E &3" { RST_H3 } item "Section C-E &4" { RST_H4 } item "Section C-E &5" { RST_H5 } } menu RST_Role { item "&Emphasis C+G+Up" { RST_ROLE_EMP } item "&Strong C+G+Down" { RST_ROLE_STR } item "&Literal C+E_C+L" { RST_ROLE_LIT } item "Su&bscript " { RST_ROLE_SUB } item "Su&perscript" { RST_ROLE_SUP } item "&Title" { RST_ROLE_TIT } item "P&EP" { RST_ROLE_PEP } item "&RFC" { RST_ROLE_RFC } item; item "r&aw-X" { RST_ROLE_RAW } item "&define raw-X" { RST_ROLE_DRAW } } menu RST_INLINE { item "&Emphasis A+G+Up" { RST_INLINE_EMP } item "&Strong A+G+Down" { RST_INLINE_STR } item "&Interpreted C+E_0" { RST_INLINE_INT } item "&Literals C+E_9" { RST_INLINE_LIT } item; item "&Hyperlink ``_ C+E_C+H" { RST_INLINE_HLINK } item "Embedded &URIs`<>`_ C+E_C+U" { RST_INLINE_ELINK } item "Int. &Targets _`` C+E_C+T" { RST_INLINE_ITAG } item "Footnote &Ref.[]_ C+E_C+R" { RST_INLINE_REF } item "&Auto Ref. [#]_ C+E_C+A" { RST_INLINE_REFA } item "&Sub. Ref. ||_ C+E_C+\\" { RST_INLINE_REFS } } menu RST_ADMON { item "&Attention C+E_A+A" { RST_ADM_ATTE } item "&Caution C+E_A+C" { RST_ADM_CAUT } item "&Danger C+E_A+D" { RST_ADM_DANG } item "&Error C+E_A+E" { RST_ADM_ERRO } item "&Hint C+E_A+H" { RST_ADM_HINT } item "&Important C+E_A+I" { RST_ADM_IMPO } item "&Note C+E_A+N" { RST_ADM_NOTE } item "&Tip C+E_A+T" { RST_ADM_TIP } item "&Warning C+E_A+W" { RST_ADM_WARN } item "Tit&le C+E_A+L" { RST_ADM_TITL } item "Adm&onition C+E_A+O" { RST_ADM_ADMO } } menu RST_IMAG { item "&Image C+E_C+I" { RST_IMAGE } item "I&mage, parameters " { RST_IMAGE_FULL } item "&Figure C+E_C+F" { RST_FIGURE } item "Fi&gure, parameters " { RST_FIGURE_FULL } } #Body Elements menu RST_BODY { item "&Topic" { RST_BOEL_TOPI } item "&Sidebar" { RST_BOEL_SIDE } item "&Line Block" { RST_BOEL_LBLK } item "&Parsed Block" { RST_BOEL_PLIT } item "&Rubric" { RST_BOEL_RUBR } item "&Epigraph" { RST_BOEL_EPIG } item "&Highlights" { RST_BOEL_HIGH } item "Pull-&Quote" { RST_BOEL_PQUO } item "&Compound" { RST_BOEL_COMP } item "C&ontainer" { RST_BOEL_CONT } item; item "&Include" { RST_INC } } menu RST_TABLE { item "&Simple 2 column" { RST_TABS_2C } item "Simple 2*2,&head" { RST_TABS_22H } item "Simple 2*2,s&pan" { RST_TABS_22S } item "&Grid 2*2" { RST_TABG_22 } item "G&rid 2*2,head" { RST_TABG_22H } item "&Table title" { RST_TAB_TIT } item; item "&CSV-table" { RST_TABCSV } item "&List-table" { RST_TABLIST } } menu RST_PARTS { item "&Contents" { RST_PART_CON } item "C&ontents, options" { RST_PART_CON_ } item "&Sectnum" { RST_PART_SEC } item "S&ectnum, options" { RST_PART_SEC_ } item "&Header" { RST_PART_HEAD } item "&Footer" { RST_PART_FOOT } } #Substitution Definitions #menu RST_SDEF { # item "" { } # } menu RSTTags { submenu "&Roles", RST_Role; submenu "In&line", RST_INLINE; submenu "&Admonition", RST_ADMON; submenu "&Images", RST_IMAG; submenu "&Body Elements", RST_BODY; submenu "&Document Parts", RST_PARTS; submenu "&Sections", RST_Sections; submenu "&Tables", RST_TABLE; item "&List enter C+Enter" { RST_LISTS_1ENT } item "Literal Bloc&k " { RST_CODE } } #==================================================================== menu Main_RST { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "&reST", RSTTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap reST { MainMenu = "Main_RST"; # menu for menubar key [A+R] { MainMenu 'R' } # reload 'A+R' } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/menu/m_sgml.fte����������������������������������������������������������������������������0000644�0001750�0001750�00000003602�07045070526�014050� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SGML menu SGML_Meta { item "Ampersand" { InsertString "&amp;"; } item "Less Than\tC-E <" { InsertString "&lt;"; } item "Greater Than\tC-E >" { InsertString "&gt;"; } item "CopyRight\tC-E @" { InsertString "&copy;"; } } menu SGML_Ref { item "Reference" { SGML_REF } item "Example" { SGML_EX } item "Manual Refernce" { SGML_MRF } item "Email" { SGML_EML } item "Ftp Site" { SGML_FTPS } item "Ftp Path" { SGML_FTPP } item "HTTP Site" { SGML_HTPS } item "HTTP Path" { SGML_HTPP } item "URL" { SGML_URL } } menu SGML_List { item "Ordinary List" { SGML_ORD } item "Numbered List" { SGML_NUM } item "Tagged List" { SGML_TAG } item "Compact Style" { InsertString " compact"; } item "List Item" { InsertString "<item> "; } } menu SGML_Style { item "Strong" { SGML_BO } item "Italic" { SGML_IT } item "TT" { SGML_TT } item "VAR" { SGML_VAR } item "Package" { SGML_PAK } item "PRGN" { SGML_PGN } item "File" { SGML_FIL } } menu SGMLTags { item "Paragraph <p> " { SGML_PA } item "Section <sect> " { SGML_SE } item "Chapter <chapt> " { SGML_CH } item; submenu "Character Styles", SGML_Style; submenu "Lists", SGML_List; submenu "Cross Reference", SGML_Ref; submenu "Meta Characters", SGML_Meta; item; item "Blank Document " { SGML_Base } } menu Main_SGML { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "Fol&d", Fold; submenu "&Tools", Tools; submenu "SG&ML", SGMLTags; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } eventmap SGML { MainMenu = "Main_SGML"; # menu for menubar key [A+M] { MainMenu 'M' } } ������������������������������������������������������������������������������������������������������������������������������./config/m_clario.fte�������������������������������������������������������������������������������0000644�0001750�0001750�00000004245�07530515566�013426� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# CLARION # Contributed by: thoye@sn.no (Thore Harald Hoye) colorize CLARION { SyntaxParser = 'Ada'; # ? color { { 'Normal', 'Editor_Default' }, { 'Number', 'Lang_Number' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, }; keyword 'Editor_Keywords' { 'accept', 'and', 'begin', 'break', 'by', 'case', 'compile', 'cycle', 'do','eject', 'else', 'elsif', 'embed', 'end', 'endembed', 'execute', 'exit', 'function', 'goto', 'if', 'include', 'loop', 'member', 'not', 'of', 'omit', 'or', 'orof', 'procedure', 'program', 'return', 'routine', 'section', 'then', 'times', 'to', 'until', 'while', 'xor', }; keyword 'Editor_Keywords4' { 'application', 'code', 'detail', 'file', 'footer', 'form', 'group', 'header', 'item', 'map', 'menu', 'menubar', 'module', 'option', 'queue', 'record', 'report', 'subtitle', 'title', 'toolbar', 'view', 'window', }; keyword 'Editor_Keywords2' { 'localrequest', 'originalrequest', 'localresponse', 'windowopened', 'windowinitialized', 'forcerefresh', 'currenttab', 'globalrequest', 'requestcancelled', 'globalresponse', 'selectrecord', 'recordfiltered', }; keyword 'Editor_Keywords3' { 'initializewindow', 'refreshwindow', 'syncwindow', 'main', }; keyword 'Editor_Keywords5' { 'byte', 'short', 'ushort', 'long', 'ulong', 'sreal', 'real', 'bfloat4', 'bfloat8', 'date', 'time', 'string', 'decimal', 'pdecimal', 'pstring', 'cstring', 'group', }; } mode CLARION: PLAIN { # CLARION mode FileNameRx = '\\.\\c{CLW}$'; Colorizer = 'CLARION'; HilitOn = 1; AutoIndent = 1; IndentMode = 'PLAIN'; MatchCase = 1; Trim = 1; MultiLineHilit = 0; RoutineRegexp = /^\s*{function}|{procedure}\s/; # SaveFolds = 2; # save fold info at end of line # CommentStart = ' --'; # CommentEnd = ''; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/ab_rexx.fte��������������������������������������������������������������������������������0000644�0001750�0001750�00000003017�07260001336�013246� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# FTE Abbrevs for REXX mode # by Michael DeBusk # debu4335@eclipsetel.com # Revision March 19, 2001 eventmap REXX { # Header Comment # Note: If the environment variable USER is set, # This macro will insert the contents after the # word "Author:" and leave the cursor after # "Purpose:". If it is not set, the macro will # fail after "Author:". abbrev 'headx' { KillWordPrev; REXX_Heading; Fail; # do not insert typed character } abbrev 'utilx' { KillWordPrev; REXX_RexxUtil; Fail; # do not insert typed character } %if(OS_OS2) abbrev 'sockx' { KillWordPrev; REXX_RxSock; Fail; # do not insert typed character } abbrev 'ftpx' { KillWordPrev; REXX_RxFTP; Fail; # do not insert typed character } %endif abbrev 'dox' { KillWordPrev; REXX_Do; Fail; # do not insert typed character } abbrev 'dux' { KillWordPrev; REXX_DoUntil; Fail; # do not insert typed character } abbrev 'dwx' { KillWordPrev; REXX_DoWhile; Fail; # do not insert typed character } abbrev 'dfx' { KillWordPrev; REXX_DoForever; Fail; # do not insert typed character } abbrev 'ifx' { KillWordPrev; REXX_If; Fail; # do not insert typed character } abbrev 'selx' { KillWordPrev; REXX_Select; Fail; # do not insert typed character } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/rgbcolor.fte�������������������������������������������������������������������������������0000644�0001750�0001750�00000000702�10335712644�013435� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������object GLOBAL { RGBColor = '0:00,00,00'; RGBColor = '1:00,24,54'; RGBColor = '2:04,7c,34'; RGBColor = '3:00,7c,9c'; RGBColor = '4:98,00,00'; RGBColor = '5:00,a8,fc'; RGBColor = '6:88,88,00'; RGBColor = '7:a8,a8,a8'; RGBColor = '8:40,40,40'; RGBColor = '9:54,7c,ac'; RGBColor = 'a:54,f4,90'; RGBColor = 'b:54,e0,fc'; RGBColor = 'c:fc,68,54'; RGBColor = 'd:fc,84,b0'; RGBColor = 'e:fc,fc,54'; RGBColor = 'f:fc,fc,e4'; } ��������������������������������������������������������������./config/k_brief.fte��������������������������������������������������������������������������������0000644�0001750�0001750�00000020356�07334126010�013223� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� eventmap MODEL { key [F1_G-Down] { WinNext } key [F1_G-Up] { WinPrev } key [F2_G-Down] { WinResize +1 } key [F2_G-Up] { WinResize -1 } key [F3_G-Down] { WinHSplit } key [F3_G-Up] { WinHSplit; WinPrev } key [F4_G-Down] { WinClose; } key [F4_G-Up] { WinNext; WinClose } key [C+N] { FileNext } key [C+P] { FilePrev } key [A+B] { ViewBuffers } key [A+E] { FileOpen } key [A+H] { ViewModeMap } key [A+N] { FileNext } key [A+P] { FilePrev } key [A+X] { ExitEditor } key [A+Z] { RunProgram "" } key [A+F4] { ExitEditor } key [C+Z] { WinZoom } key [C+X] { ExitEditor } key [C+_] { FileClose } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+F5] { ShowEntryScreen } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } #key [A+F] { MainMenu 'F' } #key [A+T] { MainMenu 'T' } #key [A+W] { MainMenu 'W' } #key [A+H] { MainMenu 'H' } } # List Viewers eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveFileStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveFileEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [C+G-Left] { ScrollRight } key [C+G-Right] { ScrollLeft } key [G-Enter] { Activate } key [Space] { ActivateInOtherWindow } key [S+G-Enter] { CloseActivate } key [C+R] { Rescan } } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; LocalMenu = 'DirectoryLocal'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [Esc] { FileClose 0 } key [A+N] { MainMenu 'N' } } # Buffer List eventmap BUFFERS: MLIST { MainMenu = "BufferListMain"; LocalMenu = "BufferListLocal"; key [Esc] { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default. key [C+C] { BufListFileClose } key [G-Del] { BufListFileClose } key [C+S] { BufListFileSave } key [F2] { BufListFileSave } } # Routine List eventmap ROUTINES: MLIST { MainMenu = "RoutinesMain"; LocalMenu = "RoutinesLocal"; key [Esc] { FileClose } } eventmap MESSAGES: MLIST { MainMenu = "MessagesMain"; LocalMenu = "MessagesLocal"; key [C+C] { ChildClose } # does NOT kill, just closes pipe } # Event Map View eventmap EVENTMAPVIEW: MLIST { MainMenu = "EventMapViewMain"; LocalMenu = "EventMapViewLocal"; key [Esc] { FileClose 0 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockUnmark } key [F5] { Find } key [F6] { FindReplace } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } # key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } # key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } # key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } # key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } # key [A+G-C+Left] { MovePrevTab } # key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } #key [C+A] key [C+B] { MoveLineBottom } key [C+C] { MoveLineCenter } #key [C+E] #key [C+F] key [C+G] { ListRoutines } key [C+H] { BackSpace } key [C+I] { InsertTab } key [C+K] { KillWordPrev } key [C+L] { KillWord } #key [C+R] key [C+T] { MoveLineTop } key [C+U] { Redo } key [C+V] { InsertChar } key [C+\]] { TagFindWord } key [C+^] { MatchBracket } key [A+/] { CompleteWord } key [A+A] { BlockMarkStream } key [A+C] { BlockMarkColumn } key [A+D] { KillLine } key [A+G] { MoveToLine } key [A+I] { ToggleInsert } key [A+J] { GotoBookmark } key [A+K] { KillToLineEnd } key [A+L] { BlockMarkLine } key [A+M] { BlockMarkStream } key [A+O] { FileSaveAs } key [A+Q] { InsertChar } key [A+R] { BlockRead } key [A+S] { Find } key [A+T] { FindReplace } key [A+U] { Undo } key [A+V] { ShowVersion } key [A+W] { FileSave } #key [A+Y] { Find ?? "r" } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/systemmain.fte�����������������������������������������������������������������������������0000644�0001750�0001750�00000001064�07216710540�014014� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Default system main fte config file. # The purpose of this file is to allow the system to have customizations # suitable for the owner of the machine or the corporation as required. This # allows the sysadmin to add new functionality in the system config that # all users will get while still being able to add the new configs that will # be made available with new versions of FTE. New versions of FTE will not # overwrite customizations this way. # include the main config - usually in /usr/local/fte/config. include 'main.fte'; # Local settings go here. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/m_4gl.fte����������������������������������������������������������������������������������0000644�0001750�0001750�00000012657�07530534671�012647� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# GL mode colorize GL { # SyntaxParser = 'C'; SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'Keyword', 'Editor_Keywords' }, { 'Number', 'Lang_DecimalNumber' }, { 'HexNumber', 'Lang_HexNumber' }, { 'Punctuation', 'Lang_Punctuation' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Function', 'Lang_Function' }, # { 'CPreprocessor', 'Lang_Preprocessor' }, # { 'Label', 'Lang_Label' }, }; keyword 'Editor_Keywords' { # any missing ? 'ABSOLUTE', 'AFTER', 'ALTER', 'AND', 'ARRAY', 'AT', 'ATTRIBUTE', 'AUTONEXT', 'BEFORE', 'BEGIN', 'BOTTOM', 'BY', 'CASE', 'CHAR', 'CHARACTER', 'CLEAR', 'CLIPPED', 'CLOSE', 'COLUMNS', 'COMMIT', 'CONSTRUCT', 'CONTINUE', 'CREATE', 'CURRENT', 'CURSOR', 'DATABASE', 'DATE', 'DATETIME', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULTS', 'DEFER', 'DEFINE', 'DELETE', 'DISPLAY', 'DOUBLE PRECISION', 'DROP', 'ELSE', 'END', 'ERROR', 'EVERY', 'EXECUTE', 'EXIT', 'FETCH', 'FIELD', 'FINISH', 'FIRST', 'FLOAT', 'FLUSH', 'FOR', 'FOREACH', 'FORM', 'FORMAT', 'FREE', 'FROM', 'GLOBALS', 'GOTO', 'GRANT', 'IF', 'INITIALIZE', 'INPUT', 'INSERT', 'INT', 'INTEGER', 'INTERVAL', 'INTO', 'IS', 'KEY', 'LABEL', 'LAST', 'LEFT', 'LENGTH', 'LET', 'LIKE', 'LINE', 'LOAD', 'LOCATE', 'LOCK', 'MAIN', 'MARGIN', 'MENU', 'MESSAGE', 'MONEY', 'NEXT', 'NOT', 'NUMERIC', 'ON', 'OPEN', 'OPTIONS', 'OR', 'OTHERWISE', 'OUTPUT', 'PAGE', 'PREPARE', 'PREVIOUS', 'PRINT', 'PRINTER', 'PROGRAM', 'PROMPT', 'PUT', 'REAL', 'RECORD', 'RECOVER', 'RENAME', 'REPORT', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLFORWARD', 'ROW', 'ROWS', 'RUN', 'SCROLL', 'SELECT', 'SERIAL', 'SET', 'SLEEP', 'SMALLFLOAT', 'SMALLINT', 'START', 'THEN', 'TO', 'TOP', 'UNION', 'UNLOAD', 'UNLOCK', 'UPDATE', 'UPSHIFT', 'VALIDATE', 'WHEN', 'WHENEVER', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WITHOUT', 'WRAP', #'FUNCTION', 'CALL', }; keyword 'Editor_Keywords2' { 'BORDER', 'DATE', 'FALSE', 'INT_FLAG', 'NOTFOUND', 'NULL', 'QUIT_FLAG', 'REVERSE', 'STATUS', 'TIME', 'TODAY', 'TRUE', }; keyword 'Editor_Keywords3' { 'FGL_GETENV', 'FGL_KEYVAL', 'FGL_LASTKEY', 'FIELD_TOUCHED', 'GET_FLDBUF', }; h_state 0 { 'Normal' } h_trans {1, '<', '#', 'Comment' } h_trans {2, '<', '{', 'Comment' } h_trans {3, '<', '"', 'String' } h_trans {4, '<', '\'', 'String' } h_trans {5, '<', '0x', 'HexNumber' } h_trans {6, '<s', '0-9', 'Number'} h_trans {0, 'S', '_a-zA-Z0-9', 'Punctuation' } h_trans {7, '<', 'CALL', 'Keyword' } h_trans {7, '<', 'FUNCTION', 'Keyword' } h_trans {8, '-s', 'a-zA-Z_', 'Normal' } h_state 1 { 'Comment'} h_trans {0, '$', '', 'Comment' } h_state 2 { 'Comment' } h_trans { 0, '>', '}', 'Comment' } h_state 3 { 'String' } h_trans {0, '>', '"', 'String'} h_state 4 { 'String' } h_trans {0, '>', '\'', 'String'} h_state 5 { 'HexNumber' } h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 6 { 'Number' } h_trans { 0, 'S', '0-9', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 7 { 'Function' } h_trans { 0, '->', '(', 'Normal' } h_trans { 0, '$', '', 'Normal' } h_state 8 { 'Normal' } h_trans { 0, '$', '', 'Normal' } h_wtype { 0, 0, 0, 'S', 'a-zA-Z0-9_' } } mode GL: PLAIN { # 4GL Mode FileNameRx = /\.\c{4GL}|{4BL}$/; HilitOn = 1; Colorizer = 'GL'; AutoIndent = 1; IndentMode = 'PLAIN'; SpaceTabs = 0; Trim = 1; MultiLineHilit = 1; AutoHilitParen = 1; # RoutineRegexp = /FUNCTION/; # RoutineRegexp = /^\w[\w_:*&~]+[\w\s_:*&~]@\([^;]*$/; # RoutineRegexp = /[\w\s_:*&~]@\(*/; # RoutineRx ^\w[\w_:*&]+[\w\s_:*&]@\( # RoutineRx ^{[a-zA-Z0-9_:*&]#\s*}+\( SaveFolds = 2; # save fold info at end of line CommentStart = ' {'; CommentEnd = '}'; CursorThroughTabs = 0; DeleteKillTab = 1; DeleteKillBlock = 1; BackSpKillTab = 1; Abbreviations = 1; # IndentWithTabs = 1; # BackSpUnindents = 0; # SpaceTabs = 0; } ���������������������������������������������������������������������������������./config/m_sgml.fte���������������������������������������������������������������������������������0000644�0001750�0001750�00000014474�07530515567�013125� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# SGML markup by Patrick L. McGillan # feel free to change and send changes to package maintainer # basic document sub SGML_Base { InsertString "<!doctype debiandoc system>"; LineNew; InsertString "<debiandoc>"; LineNew; 2:MoveRight; InsertString "<book>"; LineNew; 2:MoveRight; InsertString "<titlepag>"; LineNew; 2:MoveRight; InsertString "<title></title>"; LineNew; 2:MoveRight; InsertString "<author>"; LineNew; 2:MoveRight; InsertString "<name></name>"; LineNew; InsertString "<email></email>"; LineNew; 2:MoveLeft; InsertString "</author>"; LineNew; 2:MoveLeft; InsertString "<version><date></version>"; LineNew; InsertString "<abstract>"; LineNew; InsertString "</abstract>"; LineNew; InsertString "<copyright>"; LineNew; 2:MoveRight; InsertString "<copyrightsummary>"; LineNew; InsertString "</copyrightsummary>"; LineNew; 2:MoveLeft; InsertString "</copyright>"; LineNew; 2:MoveLeft; InsertString "</titlepag>"; LineNew; InsertString "<toc>"; LineNew; InsertString "<chapt>"; LineNew; InsertString "</chapt>"; LineNew; 2:MoveLeft; InsertString "</book>"; LineNew; 2:MoveLeft; InsertString "</debiandoc>"; } sub SGML_CH { InsertString "<chapt id=\"\">"; LineNew; InsertString "<heading></heading>"; LineNew; InsertString "<p>"; SavePos; LineNew; InsertString "</chapt>"; MoveSavedPos; } sub SGML_SE { InsertString "<sect>"; } sub SGML_PA { InsertString "<p>"; } sub SGML_MRF { InsertString "<manref name=\"\" section=\"\">"; } sub SGML_EML { InsertString "<email>"; } sub SGML_FTPS { InsertString "<ftpsite>"; } sub SGML_FTPP { InsertString "<ftppath>"; } sub SGML_HTPS { InsertString "<httpsite>"; } sub SGML_HTPP { InsertString "<httppath>"; } sub SGML_URL { InsertString "<url id=\"\" name=\"\">"; } sub SGML_EX { MoveBlockStart; LineNew; InsertString "<example>"; LineNew; MoveBlockEnd; LineNew; InsertString "</example>"; BlockUnmark; } sub SGML_REF { MoveBlockStart; InsertString "<ref id=\""; MoveBlockEnd; InsertString "\">"; BlockUnmark; } sub SGML_BO { MoveBlockStart; InsertString "<strong>"; MoveBlockEnd; InsertString "</strong>"; 4:MoveLeft; BlockUnmark; } sub SGML_IT { MoveBlockStart; InsertString "<em>"; MoveBlockEnd; InsertString "</em>"; 4:MoveLeft; BlockUnmark; } sub SGML_TT { MoveBlockStart; InsertString "<tt>"; MoveBlockEnd; InsertString "</tt>"; 4:MoveLeft; BlockUnmark; } sub SGML_VAR { InsertString "<var>"; } sub SGML_PAK { InsertString "<package>"; } sub SGML_PGN { InsertString "<program>"; } sub SGML_FIL { InsertString "<file>"; } sub SGML_ORD { InsertString "<list>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</list>"; MoveSavedPos; } sub SGML_NUM { InsertString "<enumlist>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</enumlist>"; MoveSavedPos; } sub SGML_TAG { InsertString "<taglist>"; LineNew; InsertString "<item>"; SavePos; LineNew; InsertString "</taglist>"; MoveSavedPos; } colorize SGML { SyntaxParser = 'SIMPLE'; color { { 'Normal', 'Editor_Default' }, { 'String', 'Lang_String' }, { 'Comment', 'Lang_Comment' }, { 'Command', 'Markup_Punctuation' }, { 'Symbol', 'Markup_Symbol' }, { 'Tag', 'Markup_Tag' }, { 'Special', 'Markup_Special' }, }; keyword "Editor_Keywords" { # should be SGML 3.2 complete "ABSTRACT", "ARTICLE", "AUTHOR", "BF", "BOOK", "CHAPT", "CODE", "COPYRIGHT", "DATE", "DEBIANDOC", "DESCRIP", "DOCTYPE", "EM", "EMAIL", "ENUM", "ENUMLIST", "EXAMPLE", "FOOTNOTE", "FTPSITE", "FTPPATH", "HEADING", "HTMLURL", "HTTPSITE", "HTTPPATH", "IT", "ITEM", "ITEMIZE", "LABEL", "LIST", "MANREF", "NAME", "P", "PRGN", "PUBLIC", "QREF", "QUOTE", "REF", "SECT", "SECT1", "SECT2", "SECT3", "SECT4", "STRONG", "SYSTEM", "TAG", "TAGLIST", "TITLE", "TITLEPAG", "TOC", "TSCREEN", "TT", "URL", "VAR", "VERB", "VERSION", }; keyword "Editor_Keywords2" { "COMPACT", "ID", "NAME", "SECTION", }; h_state 0 { 'Normal' } h_trans { 4, '<', '<!--', 'Comment' } h_trans { 8, '<', '</', 'Command' } h_trans { 1, '<', '<', 'Command' } h_trans { 2, '<', '&', 'Symbol' } h_state 1 { 'Command' } h_trans { 0, '>', '>', 'Command' } h_trans { 0, '>', '<', 'Command' } h_trans { 0, '>', '/>', 'Command' } h_trans { 6, '<', '/', 'Command' } h_trans { 3, '<', '"', 'String' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } h_state 2 { 'Symbol' } h_trans { 0, '>', ';', 'Symbol' } h_trans { 0, '-S', '#a-zA-Z0-9', 'Symbol' } h_state 3 { 'String' } h_trans { 1, '>', '"', 'String' } h_state 4 { 'Comment' } h_trans { 5, '>', '--', 'Comment' } h_state 5 { 'Special' } h_trans { 4, '>', '--', 'Comment' } h_trans { 0, '>', '>', 'Comment' } h_state 6 { 'Symbol' } h_trans { 7, '-', '//', 'Command' } h_trans { 0, '>', '/', 'Command' } h_trans { 0, '>', '>', 'Symbol' } h_trans { 7, '>', '</', 'Command' } h_trans { 1, '>', '<', 'Command' } h_state 7 { 'Command' } h_trans { 6, '>', '/', 'Command' } h_state 8 { 'Command' } h_trans { 0, '>', '>', 'Command' } h_trans { 3, '<', '"', 'String' } h_wtype { -1, -1, -1, 'i', 'a-zA-Z0-9_\-' } } mode SGML: PLAIN { FileNameRx = /\.\c{SGML?}|{SGML?}$/; HilitOn = 1; Colorizer = "SGML"; MultiLineHilit = 1; AutoHilitParen = 1; RoutineRegexp = /\<[Hh]\d\>/; SaveFolds = 2; # save fold info at end of line CommentStart = "<!--"; CommentEnd = "-->"; WordWrap = 2; RightMargin = 85; AutoIndent = 1; Insert = 1; IndentMode = "Plain"; Trim = 1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./config/pal_blk.fte��������������������������������������������������������������������������������0000644�0001750�0001750�00000012276�10015224465�013233� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# color palette (black background) # the color palette is the definition of the symbolic colors # that are used everywhere else in the configuration files # syntax of the color specification is: # # fore back # or # symbolic_fore:symbolic_back # or # symbolic color_palette { { 'ScrollBar_Arrows', 'black:gray' }, { 'ScrollBar_Background', 'gray:black' }, { 'ScrollBar_Slider', 'black:gray' }, { 'Status_Normal', 'black:darkCyan' }, { 'Status_Active', 'black:gray' }, { 'Message_Normal', 'Status_Normal' }, { 'Message_Error', 'white:darkBlue' }, { 'Message_Bold', 'white:darkRed' }, { 'EntryField_Field', 'cyan:darkBlue' }, { 'EntryField_Prompt', 'white:darkBlue' }, { 'EntryField_Selection', 'black:darkGreen' }, { 'List_Status', 'black:gray' }, { 'List_Normal', 'gray:black' }, { 'List_Selected', 'white:darkBlue' }, { 'List_Hilited', 'white:black' }, { 'List_HilitSelect', 'white:darkBlue' }, { 'List_Marked', 'yellow:black' }, { 'List_MarkSelect', 'yellow:darkBlue' }, { 'List_MarkHilit', 'yellow:black' }, { 'List_MarkHilitSel', 'yellow:darkBlue' }, { 'ASCII_Chars', 'gray:black' }, { 'Menu_Background', 'black:gray' }, { 'Menu_ActiveItem', 'white:darkBlue' }, { 'Menu_ActiveChar', 'red:darkBlue' }, { 'Menu_NormalItem', 'black:gray' }, { 'Menu_NormalChar', 'red:gray' }, { "Choice_Title", 'white:darkBlue' }, { "Choice_Param", 'cyan:darkBlue' }, { "Choice_Background", 'gray:darkBlue' }, { "Choice_ActiveItem", 'black:darkGreen' }, { "Choice_ActiveChar", 'white:darkGreen' }, { "Choice_NormalItem", 'white:darkBlue' }, { "Choice_NormalChar", 'yellow:darkBlue' }, { "bg", 'gray:black' }, # background { "fg", 'gray:black' }, # foreground { 'Editor_Selected', 'black:darkCyan' }, { 'Editor_Markers', 'darkCyan:bg' }, { 'Editor_FoundText', 'white:darkRed' }, { 'Editor_Folds0', 'green:bg' }, { 'Editor_Folds1', 'blue:bg' }, { 'Editor_Folds2', 'magenta:bg' }, { 'Editor_Folds3', 'magenta:bg' }, { 'Editor_Folds4', 'magenta:bg' }, { 'Editor_HilitWord', 'red:bg' }, { 'Editor_Default', 'fg:bg' }, { 'Editor_Bold', 'cyan:bg' }, { 'Editor_Keywords', 'white:bg' }, { 'Editor_Keywords2', 'cyan:bg' }, { 'Editor_Keywords3', 'green:bg' }, { 'Editor_Keywords4', 'yellow:bg' }, { 'Editor_Keywords5', 'blue:bg' }, { 'Msg_Header', 'darkCyan:bg' }, { 'Msg_Quotes', 'green:bg' }, { 'Msg_Tag', 'white:bg' }, { 'Msg_Signature', 'darkCyan:bg' }, { 'Comment', 'brown:bg' }, { 'String', 'yellow:bg' }, { 'Lang_Default', 'Editor_Default' }, { 'Lang_Number', 'red:bg' }, { 'Lang_DecimalNumber', 'Lang_Number' }, { 'Lang_HexNumber', 'magenta:bg' }, { 'Lang_OctalNumber', 'magenta:bg' }, { 'Lang_BinaryNumber', 'magenta:bg' }, { 'Lang_Punctuation', 'darkCyan:bg' }, { 'Lang_String', 'String' }, { 'Lang_Comment', 'Comment' }, { 'Lang_Preprocessor', 'green:bg' }, { 'Lang_Function', 'cyan:bg' }, { 'Lang_Label', 'red:bg' }, { 'Lang_Command', 'cyan:bg' }, { 'Lang_Regexp', 'magenta:bg' }, { 'Lang_Variable', 'gray:bg' }, { 'Lang_Control', 'darkCyan:bg' }, { 'Lang_Assembler', 'blue:bg' }, # embedded assembler (Pascal) { 'Markup_Default', 'gray:bg' }, { 'Markup_Punctuation', 'darkCyan:bg' }, { 'Markup_String', 'String' }, { 'Markup_Symbol', 'green:bg' }, { 'Markup_Tag', 'cyan:bg' }, { 'Markup_Comment', 'Comment' }, { 'Markup_Special', 'red:bg' }, { 'Markup_Control', 'magenta:bg' }, { 'Markup_Quotes', 'yellow:bg' }, { 'Markup_Math', 'red:bg' }, # diff/diff3 { 'DIFF_Old', 'brown:bg' }, { 'DIFF_New', 'yellow:bg' }, { 'DIFF_Changed', 'darkCyan:bg' }, # rcsmerge { 'MERGE_Changed', 'white:bg' }, { 'MERGE_Old', 'gray:bg' }, { 'MERGE_New', 'red:bg' }, { 'MERGE_Control', 'yellow:bg' }, } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./Makefile������������������������������������������������������������������������������������������0000644�0001750�0001750�00000001001�11347737227�011320� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������PREFIX=/usr/local BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib/fte CONFIGDIR=$(LIBDIR)/config .PHONY: all install all: fte $(MAKE) -C src unix install: all sh ./install fte: fte.in Makefile sed < fte.in >$@ \ -e "s|@@CONFIGDIR@@|$(CONFIGDIR)|g" \ -e "s|@@BINDIR@@|$(BINDIR)|g" chmod a+x $@ dist: fte scripts/mkbuildlvl.pl clean: -rm -f core `find . -name '#*' -o -name 'fte-new.cnf'\ -o -name '.\#*' -o -name '.*~' -o -name '*~' -o -name 'core*'` $(MAKE) -C src -f fte-unix.mak clean �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/����������������������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�11621703711�010441� 5����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_choice.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000007717�11344266047�012733� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_choice.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_choice.h" #include "c_color.h" #include "i_view.h" #include "s_string.h" #include "sysdep.h" #include <ctype.h> #include <stdio.h> ExChoice::ExChoice(const char *ATitle, int NSel, va_list ap) : Title(ATitle), lTitle((int)Title.size()), NOpt(NSel), SOpt(NSel), lChoice(0), Cur(0), MouseCaptured(0) { for (int i = 0; i < NSel; i++) { SOpt.push_back((va_arg(ap, char *))); lChoice += SOpt.back().GetCStrLen() + 1; } char *fmt = va_arg(ap, char *); vsnprintf(Prompt, sizeof(Prompt), fmt, ap); } ExChoice::~ExChoice() { } int ExChoice::FindChoiceByPoint(int x, int y) { int W, H; Win->ConQuerySize(&W, &H); if (y != H - 1) return -1; int pos = W - lChoice; if (x < pos) return -1; for (int i = 0; i < NOpt; i++) { if (x > pos && x <= pos + SOpt[i].GetCStrLen()) return i; pos += SOpt[i].GetCStrLen() + 1; } return -1; } void ExChoice::HandleEvent(TEvent &Event) { switch (Event.What) { case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbTab | kfShift: /* fall */ case kbLeft: if (Cur == -1) Cur = 0; Cur--; if (Cur < 0) Cur = NOpt - 1; Event.What = evNone; break; case kbTab: /* fall */ case kbRight: if (Cur == -1) Cur = 0; Cur++; if (Cur >= NOpt) Cur = 0; Event.What = evNone; break; case kbHome: Cur = 0; Event.What = evNone; break; case kbEnd: Cur = NOpt - 1; Event.What = evNone; break; case kbEnter: if (Cur >= 0 && NOpt > 0) EndExec(Cur); Event.What = evNone; break; case kbEsc: EndExec(-1); Event.What = evNone; break; default: if (isAscii(Event.Key.Code)) { char s[3] = { '&', (char)(toupper((char)Event.Key.Code)), 0 }; for (int i = 0; i < NOpt; ++i) { if (strstr(SOpt[i].GetCStr(), s) != 0) { Win->EndExec(i); break; } } Event.What = evNone; } break; } break; #ifdef CONFIG_MOUSE case evMouseDown: if (!Win->CaptureMouse(1)) break; MouseCaptured = 1; Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; break; case evMouseMove: if (MouseCaptured) Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; break; case evMouseUp: if (!MouseCaptured) break; Win->CaptureMouse(0); MouseCaptured = 0; Cur = FindChoiceByPoint(Event.Mouse.X, Event.Mouse.Y); Event.What = evNone; if (Cur >= 0 && Cur < NOpt && NOpt > 0) EndExec(Cur); else Cur = 0; break; #endif } } void ExChoice::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); if (Cur != -1) { if (Cur >= NOpt) Cur = NOpt - 1; if (Cur < 0) Cur = 0; } MoveCh(B, ' ', hcChoice_Background, W); MoveStr(B, 0, W, Title.c_str(), hcChoice_Title, W); MoveChar(B, lTitle, W, ':', hcChoice_Background, 1); MoveStr(B, lTitle + 2, W, Prompt, hcChoice_Param, W); int pos = W - lChoice; for (int i = 0; i < NOpt; ++i) { TAttr color1, color2; if (i == Cur) { color1 = hcChoice_ActiveItem; color2 = hcChoice_ActiveChar; } else { color1 = hcChoice_NormalItem; color2 = hcChoice_NormalChar; } if (i == Cur) ConSetCursorPos(pos + 1, H - 1); MoveChar(B, pos, W, ConGetDrawChar(DCH_V), hcChoice_Background, 1); MoveCStr(B, pos + 1, W, SOpt[i].GetCStr(), color1, color2, W); pos += SOpt[i].GetCStrLen() + 1; } ConPutBox(0, H - 1, W, 1, B); } �������������������������������������������������./src/i_view.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000013712�11344266047�012443� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_view.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_view.h" #include "c_config.h" #include "i_ascii.h" #include "i_choice.h" #include "i_complete.h" #include "i_key.h" #include "o_buflist.h" #include "s_files.h" //#include <stdio.h> GxView::GxView(GFrame *Parent) : GView(Parent, -1, -1), Top(0), Bottom(0), MouseCaptured(0) { //fprintf(stderr, "CREATE GXVIEW %p\n", this); } GxView::~GxView() { //fprintf(stderr, "DESTROY GXVIEW %p t:%p\n", this, Top); while (Top) { ExView *V = Top; Top = Top->Next; V->Win = 0; delete V; } } void GxView::PushView(ExView *view) { int W, H; ConQuerySize(&W, &H); //fprintf(stderr, "PUSHVIEW %p %p t:%p\n", view, this, Top); view->Win = this; if (Top == 0) { Top = Bottom = view; view->Next = 0; } else { Top->Activate(0); view->Next = Top; Top = view; Top->Activate(1); } Top->Resize(W, H); } ExView *GxView::PopView() { //fprintf(stderr, "POPVIEW %p t:%p\n", this, Top); assert(Top != 0); if (Top == 0) return 0; Top->Activate(0); ExView *V = Top; Top = Top->Next; if (Top == 0) Bottom = 0; else { Top->Activate(1); Top->Repaint(); } V->Win = 0; return V; } void GxView::NewView(ExView * /*view*/) { } EEventMap *GxView::GetEventMap() { return (Top) ? Top->GetEventMap() : 0; } int GxView::ExecCommand(ExCommands Command, ExState &State) { return (Top) ? Top->ExecCommand(Command, State) : 0; } int GxView::BeginMacro() { return (Top) ? Top->BeginMacro() : 1; } int GxView::GetContext() { return (Top) ? Top->GetContext() : CONTEXT_NONE; } void GxView::HandleEvent(TEvent &Event) { GView::HandleEvent(Event); Top->HandleEvent(Event); #ifdef CONFIG_MOUSE if (Event.What & evMouse) { int W, H; ConQuerySize(&W, &H); if (Event.What != evMouseDown || Event.Mouse.Y == H - 1) { switch (Event.What) { case evMouseDown: if (CaptureMouse(1)) { MouseCaptured = 1; Event.What = evNone; } break; case evMouseMove: if (MouseCaptured) { if (Event.Mouse.Y != H - 1) ExpandHeight(Event.Mouse.Y - H + 1); Event.What = evNone; } break; case evMouseAuto: if (MouseCaptured) Event.What = evNone; break; case evMouseUp: if (MouseCaptured) { CaptureMouse(0); MouseCaptured = 0; Event.What = evNone; } break; } } } #endif } void GxView::Update() { if (Top) Top->Update(); } void GxView::Repaint() { if (Top) { Top->Repaint(); } else { TDrawBuffer B; int X, Y; ConQuerySize(&X, &Y); MoveCh(B, ' ', 0x07, X); ConPutLine(0, 0, X, Y, B); } } void GxView::Resize(int width, int height) { GView::Resize(width, height); for (ExView *V = Top; V; V = V->Next) V->Resize(width, height); } void GxView::Activate(int gotfocus) { if (Top) Top->Activate(gotfocus); GView::Activate(gotfocus); } void GxView::UpdateTitle(const char *Title, const char *STitle) { if (Parent && Parent->Active == this) Parent->ConSetTitle(Title, STitle); } int GxView::GetStr(const char *Prompt, size_t BufLen, char *Str, int HistId) { if ((HaveGUIDialogs & GUIDLG_PROMPT) && GUIDialogs) return DLGGetStr(this, Prompt, BufLen, Str, HistId, 0); return ReadStr(Prompt, BufLen, Str, 0, 1, HistId); } int GxView::GetFile(const char *Prompt, size_t BufLen, char *Str, int HistId, int Flags) { if ((HaveGUIDialogs & GUIDLG_FILE) && GUIDialogs) return DLGGetFile(this, Prompt, BufLen, Str, Flags); else return ReadStr(Prompt, BufLen, Str, CompletePath, SelectPathname, HistId); } int GxView::ReadStr(const char *Prompt, size_t BufLen, char *Str, Completer Comp, int Select, int HistId) { int rc; ExInput input(Prompt, Str, BufLen, Comp, Select, HistId); PushView(&input); if ((rc = Execute()) == 1) { strncpy(Str, input.GetLine(), BufLen - 1); Str[BufLen - 1] = 0; } PopView(); Repaint(); return rc; } int GxView::Choice(unsigned long Flags, const char *Title, int NSel, ... /* choices, format, args */) { va_list ap; int rc; if ((HaveGUIDialogs & GUIDLG_CHOICE) && GUIDialogs) { va_start(ap, NSel); rc = DLGPickChoice(this, Title, NSel, ap, Flags); va_end(ap); } else { va_start(ap, NSel); ExChoice choice(Title, NSel, ap); va_end(ap); PushView(&choice); rc = Execute(); PopView(); Repaint(); } return rc; } TKeyCode GxView::GetChar(const char *Prompt) { TKeyCode K = 0; ExKey key(Prompt); PushView(&key); if (Execute() == 1) K = key.GetKey(); PopView(); Repaint(); return K; } #ifdef CONFIG_I_SEARCH int GxView::IncrementalSearch(EView *View) { int rc; if (View->GetContext() != CONTEXT_FILE) return 0; ExISearch search((EBuffer *)View->Model); PushView(&search); rc = Execute(); PopView(); Repaint(); return rc; } #endif #ifdef CONFIG_I_ASCII int GxView::PickASCII() { int rc; ExASCII ascii; PushView(&ascii); rc = Execute(); PopView(); Repaint(); return rc; } #endif #ifdef CONFIG_I_COMPLETE int GxView::ICompleteWord(EView *View) { int rc; if (View->GetContext() != CONTEXT_FILE) return 0; ExComplete c((EBuffer *)View->Model); if (c.IsSimpleCase()) rc = c.DoCompleteWord(); else { PushView(&c); rc = Execute(); PopView(); } Repaint(); return rc; } #endif ������������������������������������������������������./src/namemaps.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000001166�11331412505�012413� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* M$VC++ !!! */ #ifndef NAMEMAPS_H #define NAMEMAPS_H #define access _access #define chmod _chmod #define chsize _chsize #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define eof _eof #define filelength _filelength #define isatty _isatty #define locking _locking #define lseek _lseek #define mktemp _mktemp #define open _open #define read _read #define setmode _setmode #define sopen _sopen #define tell _tell #define umask _umask #define unlink _unlink #define write _write #endif // NAMEMAPS_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_history.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000030736�11602724002�013154� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_history.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_history.h" #ifdef CONFIG_HISTORY #include "o_buflist.h" #include "sysdep.h" #include <stdio.h> #define HISTORY_VER "FTE History 1\n" #define MAX_INPUT_HIST 128 char HistoryFileName[256] = ""; struct HBookmark { char *Name; int Row,Col; }; struct FPosHistory { char *FileName; int Row, Col; HBookmark **Books; int BookCount; }; struct InputHistory { unsigned Count; char **Line; int *Id; }; static FPosHistory **FPHistory; static int FPHistoryCount; static InputHistory inputHistory; void ClearHistory() { /*FOLD00*/ // free filenames from all entries while (FPHistoryCount-- > 0) { free(FPHistory[FPHistoryCount]->FileName); free(FPHistory[FPHistoryCount]); } FPHistoryCount = 0; // free history list free(FPHistory); FPHistory = NULL; // free input history while (inputHistory.Count-- > 0) free(inputHistory.Line[inputHistory.Count]); inputHistory.Count = 0; free(inputHistory.Line); inputHistory.Line = NULL; free(inputHistory.Id); inputHistory.Id = NULL; } int SaveHistory(const char *FileName) { /*FOLD00*/ FILE *fp; if (!(fp = fopen(FileName, "w"))) return 0; if (setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)) != 0) goto err; if (fprintf(fp, HISTORY_VER) < 0) goto err; if (FPHistory) { // file position history int i,j; for (i = 0; i < FPHistoryCount; i++) { if (fprintf(fp, "F|%d|%d|%s\n", FPHistory[i]->Row, FPHistory[i]->Col, FPHistory[i]->FileName) < 0) goto err; for (j=0;j<FPHistory[i]->BookCount;j++) if (fprintf (fp,"B|%d|%d|%s\n", FPHistory[i]->Books[j]->Row, FPHistory[i]->Books[j]->Col, FPHistory[i]->Books[j]->Name) < 0) goto err; } } // input history, store in reverse order to preserve order when loading for (int i = inputHistory.Count - 1; i >= 0; i--) if (fprintf(fp, "I|%d|%s\n", inputHistory.Id[i], inputHistory.Line[i]) < 0) goto err; return fclose(fp) == 0 ? 1 : 0; err: fclose(fp); return 0; } int LoadHistory(const char *FileName) { /*FOLD00*/ FILE *fp; char line[2048]; char *p, *e; FPosHistory *last=NULL; HBookmark **nb; if (!(fp = fopen(FileName, "r"))) return 0; if (setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)) != 0) goto err; if (!fgets(line, sizeof(line), fp) || strcmp(line, HISTORY_VER) != 0) goto err; while (fgets(line, sizeof(line), fp) != 0) { if (line[0] == 'F' && line[1] == '|') { // file position history int r, c, L, R, M, cmp; p = line + 2; r = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; c = strtol(p = e, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; last=NULL; if (UpdateFPos(p, r, c) == 0) break; // Get current file's record for storing bookmarks L=0;R=FPHistoryCount; while (L < R) { M = (L + R) / 2; cmp = filecmp(p, FPHistory[M]->FileName); if (cmp == 0) { last=FPHistory[M]; break; } else if (cmp < 0) { R = M; } else { L = M + 1; } } } else if (line[0] == 'B' && line[1] == '|') { // bookmark history for last file if (last) { int r, c; p = line + 2; r = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; c = strtol(p = e, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; nb=(HBookmark **)realloc (last->Books,sizeof (HBookmark *)*(last->BookCount+1)); if (nb) { last->Books=nb; nb[last->BookCount]=(HBookmark *)malloc (sizeof (HBookmark)); if (nb[last->BookCount]) { nb[last->BookCount]->Row=r; nb[last->BookCount]->Col=c; nb[last->BookCount]->Name=strdup (p); last->BookCount++; } } } } else if (line[0] == 'I' && line[1] == '|') { // input history int i; p = line + 2; i = strtol(p, &e, 10); if (e == p) break; if (*e == '|') e++; else break; e = strchr(p = e, '\n'); if (e == 0) break; *e = 0; AddInputHistory(i, p); } } return (fclose(fp) == 0) ? 1 : 0; err: fclose(fp); return 0; } int UpdateFPos(const char *FileName, int Row, int Col) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M, N; FPosHistory *fp, **NH; int cmp; if (FPHistory != 0) { while (L < R) { M = (L + R) / 2; cmp = filecmp(FileName, FPHistory[M]->FileName); if (cmp == 0) { FPHistory[M]->Row = Row; FPHistory[M]->Col = Col; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } } else { FPHistoryCount = 0; L = 0; } assert(L >= 0 && L <= FPHistoryCount); fp = (FPosHistory *)malloc(sizeof(FPosHistory)); if (fp == 0) return 0; fp->Row = Row; fp->Col = Col; fp->FileName = strdup(FileName); fp->Books = NULL; fp->BookCount = 0; if (fp->FileName == 0) { free(fp); return 0; } N = 64; while (N <= FPHistoryCount) N *= 2; NH = (FPosHistory **)realloc((void *)FPHistory, N * sizeof(FPosHistory *)); if (NH == 0) { free(fp->FileName); free(fp); return 0; } FPHistory = NH; if (L < FPHistoryCount) memmove(FPHistory + L + 1, FPHistory + L, (FPHistoryCount - L) * sizeof(FPosHistory *)); FPHistory[L] = fp; FPHistoryCount++; return 1; } int RetrieveFPos(const char *FileName, int &Row, int &Col) { /*FOLD00*/ int L = 0, R = FPHistoryCount, M; int cmp; if (FPHistory == 0) return 0; while (L < R) { M = (L + R) / 2; cmp = filecmp(FileName, FPHistory[M]->FileName); if (cmp == 0) { Row = FPHistory[M]->Row; Col = FPHistory[M]->Col; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; } int AddInputHistory(int Id, const char *String) { /*FOLD00*/ char *s = NULL; // get rid of a "might not be initialised" warning int i; // First check if it is already in list for (i = 0; i < inputHistory.Count; i++) { if (inputHistory.Id[i] == Id && strcmp(String, inputHistory.Line[i]) == 0) { // Found, will be moved to the beginning of list s = inputHistory.Line[i]; break; } } if (s == NULL) { // Not in list s = strdup(String); if (inputHistory.Count < MAX_INPUT_HIST) { inputHistory.Count++; inputHistory.Line = (char **) realloc((void *) inputHistory.Line, inputHistory.Count * sizeof(char *)); inputHistory.Id = (int *) realloc((void *) inputHistory.Id, inputHistory.Count * sizeof(int *)); } else { i--; free(inputHistory.Line[inputHistory.Count - 1]); } } memmove(inputHistory.Line + 1, inputHistory.Line, i * sizeof(char *)); memmove(inputHistory.Id + 1, inputHistory.Id, i * sizeof(int *)); inputHistory.Id[0] = Id; inputHistory.Line[0] = s; return 1; } int CountInputHistory(int Id) { /*FOLD00*/ int i, c = 0; for (i = 0; i < inputHistory.Count; i++) if (inputHistory.Id[i] == Id) c++; return c; } int GetInputHistory(int Id, char *String, int len, int Nth) { /*FOLD00*/ int i = 0; assert(len > 0); while (i < inputHistory.Count) { if (inputHistory.Id[i] == Id) { Nth--; if (Nth == 0) { strncpy(String, inputHistory.Line[i], len); String[len - 1] = 0; return 1; } } i++; } return 0; } /* * Get bookmarks for given Buffer (file) from history. */ int RetrieveBookmarks(EBuffer *buffer) { /*FOLD00*/ #ifdef CONFIG_BOOKMARKS int L = 0, R = FPHistoryCount, M,i; int cmp; HBookmark *bmk; char name[256+4] = "_BMK"; EPoint P; assert(buffer!=NULL); if (FPHistoryCount==0) return 1; while (L < R) { M = (L + R) / 2; cmp = filecmp(buffer->FileName, FPHistory[M]->FileName); if (cmp == 0) { // Now "copy" bookmarks to Buffer for (i=0;i<FPHistory[M]->BookCount;i++) { bmk=FPHistory[M]->Books[i]; strcpy (name+4,bmk->Name); P.Row=bmk->Row;P.Col=bmk->Col; if (P.Row<0) P.Row=0; else if (P.Row>=buffer->RCount) P.Row=buffer->RCount-1; if (P.Col<0) P.Col=0; buffer->PlaceBookmark(name,P); } return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 1; #else return 1; #endif } /* * Store given Buffer's bookmarks to history. */ int StoreBookmarks(EBuffer *buffer) { /*FOLD00*/ #ifdef CONFIG_BOOKMARKS int L = 0, R = FPHistoryCount, M,i,j; int cmp; HBookmark *bmk; assert (buffer!=NULL); if (RetrieveFPos (buffer->FileName,i,j)==0) { // File not found in FPHistory -> add it if (UpdateFPos (buffer->FileName,0,0)==0) return 0; } // Now file is surely in FPHistory while (L < R) { M = (L + R) / 2; cmp = filecmp(buffer->FileName, FPHistory[M]->FileName); if (cmp == 0) { // First delete previous bookmarks for (i=0;i<FPHistory[M]->BookCount;i++) { bmk=FPHistory[M]->Books[i]; if (bmk->Name) free (bmk->Name); free (bmk); } free (FPHistory[M]->Books); FPHistory[M]->Books=NULL; const EBookmark* b; // Now add new bookmarks - first get # of books to store for (i=j=0;(i=buffer->GetUserBookmarkForLine(i, -1, b))>=0;j++); FPHistory[M]->BookCount=j; if (j) { // Something to store FPHistory[M]->Books=(HBookmark **)malloc (sizeof (HBookmark *)*j); if (FPHistory[M]->Books) { for (i=j=0;(i=buffer->GetUserBookmarkForLine(i, -1, b))>=0;j++) { bmk=FPHistory[M]->Books[j]=(HBookmark *)malloc (sizeof (HBookmark)); if (bmk) { bmk->Row = b->GetPoint().Row; bmk->Col = b->GetPoint().Col; bmk->Name = strdup(b->GetName()); } else { // Only part set FPHistory[M]->BookCount=j; return 0; } } return 1; } else { // Alloc error FPHistory[M]->BookCount=0; return 0; } } return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } // Should not get here #endif return 0; } #endif ����������������������������������./src/Makefile��������������������������������������������������������������������������������������0000644�0001750�0001750�00000001134�11344266042�012103� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������MAKE=make all: @echo 'What (emx, unix, cygwin, bcc2, win32ms, win32bcc5, win32mingw, djgpp2, vag)?' emx: $(MAKE) -f fte-emx.mak unix: $(MAKE) -f fte-unix.mak cygwin: $(MAKE) -f fte-cygwin-xf86.mak bcc2: $(MAKE) -f fte-bcc2.mak win32ms: nmake /f fte-msvc.mak win32mingw: $(MAKE) -f fte-mngw.mak win32bcc5: $(MAKE) -f fte-bcc5.mak djgpp2: $(MAKE) -f fte-dj2.mak vag: nmake /f fte-vag.mak .PHONY: tags tags: $(RM) -f tags find . -type f \( -name '*.cpp' -o -name '*.c' -o -name '*.h' \) | xargs ctags -a clean: $(RM) -f core *.o *~ *.gch cscope.out .depend defcfg.h defcfg.cnf tags ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/defcfg2.fte�����������������������������������������������������������������������������������0000644�0001750�0001750�00000017601�07203604605�012451� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������menu File { item "&Open...\tCtrl+O" { FileOpen } item "&Reload" { FileReload } item "&Save\tCtrl+S" { FileSave } item "Save &As..." { FileSaveAs } item "Save Al&l" { FileSaveAll } item "&Close\tCtrl+W" { FileClose } item; item "E&xit\tCtrl+Q" { ExitEditor } } menu Edit { item "&Undo\tCtrl+Z" { Undo } item "&Redo" { Redo } item; item "Cu&t\tCtrl+X" { BlockCut } item "&Copy\tCtrl+C" { BlockCopy } item "&Paste\tCtrl+V" { BlockPasteStream } } menu Search { item "&Find...\tCtrl+F" { Find } item "Find &Next\tCtrl+G" { FindRepeat } item; item "Find and &replace...\tCtrl+R" { FindReplace } item; item "&Goto line..." { MoveToLine } } menu Help { item "&About..." { ShowVersion } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Search", Search; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tCtrl+X" { BlockCut } item "&Copy\tCtrl+C" { BlockCopy } item "&Paste\tCtrl+V" { BlockPasteStream } item "Cl&ose\tAlt+Q" { FileClose } } eventmap MODEL { # basic commands, for files, directories, message view, etc. key [C+O] { FileOpen } key [C+W] { FileClose } key [F10] { MainMenu } key [S+F10] { LocalMenu } key [C+Q] { ExitEditor } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [C+S] { FileSave } key [C+C] { BlockCopy } key [C+V] { BlockPasteStream } key [C+X] { BlockCut } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+F] { Find } key [C+G] { FindRepeat } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [C+G-Ins] { BlockCopy } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+H] { MainMenu 'H' } key [A+S] { MainMenu 'S' } } colorize PLAIN { SyntaxParser = 'PLAIN'; # color { # { 'Normal', '-7' }, # }; } mode PLAIN { Colorizer = 'PLAIN'; } eventmap LIST { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [Esc] { Cancel } key [G-Enter] { Activate } } eventmap BUFFERS: LIST { key [C+F10] { FileClose } key [F2] { FileSave } } eventmap ROUTINES: LIST { } eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [G-Enter] { Activate } } menu Directory { item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } menu Messages { item "&Close\tAlt+Q" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } �������������������������������������������������������������������������������������������������������������������������������./src/i_input.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000001667�11344266047�012303� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_input.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_INPUT_H #define I_INPUT_H #include "i_oview.h" #include "console.h" typedef int (*Completer)(const char *Name, char *Completed, int Num); class ExInput: public ExViewNext { StlString Prompt; size_t MaxLen; char *Line; char *MatchStr; char *CurStr; unsigned Pos; unsigned LPos; Completer Comp; int TabCount; int HistId; int CurItem; unsigned SelStart; unsigned SelEnd; public: ExInput(const char *APrompt, const char *ALine, size_t AMaxLen, Completer AComp, int Select, int AHistId); virtual ~ExInput(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); const char* GetLine() const { return Line; } }; #endif // I_INPUT_H �������������������������������������������������������������������������./src/g_draw.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000014205�11344266046�012421� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_draw.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "console.h" #include <stdlib.h> #ifdef NTCONSOLE # define WIN32_LEAN_AND_MEAN 1 # include <windows.h> #endif size_t CStrLen(const char *p) { size_t len = 0; while (*p) { if (*p++ == '&') { if (*p != '&') continue; p++; } len++; // && is one accounted as '&' } return len; } #ifndef NTCONSOLE void MoveCh(PCell B, char CCh, TAttr Attr, size_t Count) { assert((int)Count >= 0); for (;Count > 0; B++, --Count) B->Set(CCh, Attr); } void MoveChar(PCell B, int Pos, int Width, const char CCh, TAttr Attr, size_t Count) { assert((int)Count >= 0); if (Pos < 0) { if ((int)Count < -Pos) return; Count += Pos; Pos = 0; } if (Pos >= Width) return; if ((int)Count > Width - Pos) Count = Width - Pos; for (B += Pos; Count > 0; B++, --Count) B->Set(CCh, Attr); } void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t Count) { assert((int)Count >= 0); if (Pos < 0) { if ((int)Count < -Pos) return; Count += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if ((int)Count > Width - Pos) Count = Width - Pos; for (B += Pos; Count > 0; B++, --Count) B->Set(*Ch++, Attr); } void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t MaxCount) { assert((int)MaxCount >= 0); if (Pos < 0) { if ((int)MaxCount < -Pos) return; MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if ((int)MaxCount > Width - Pos) MaxCount = Width - Pos; for (B += Pos; MaxCount > 0 && *Ch; B++, --MaxCount) B->Set(*Ch++, Attr); } void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, size_t MaxCount) { assert((int)MaxCount >= 0); TAttr attr = A0; if (Pos < 0) { if ((int)MaxCount < -Pos) return; MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if ((int)MaxCount > Width - Pos) MaxCount = Width - Pos; for (B += Pos; MaxCount > 0 && *Ch;) { if (*Ch == '&' && attr == A0) { Ch++; attr = A1; continue; } B++->Set(*Ch++, attr); attr = A0; --MaxCount; } } void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count) { assert((int)Count >= 0); if (Pos < 0) { if ((int)Count < -Pos) return; Count += Pos; Pos = 0; } if (Pos >= Width) return; if ((int)Count > Width - Pos) Count = Width - Pos; for (B += Pos; Count > 0; B++, --Count) B->SetAttr(Attr); } void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count) { assert((int)Count >= 0); if (Pos < 0) { if ((int)Count < -Pos) return; Count += Pos; Pos = 0; } if (Pos >= Width) return; if ((int)Count > Width - Pos) Count = Width - Pos; for (B += Pos; Count > 0; B++, Count--) B->SetAttr(TAttr((B->GetAttr() & 0x0F) | Attr)); } #else void MoveCh(PCell B, char Ch, TAttr Attr, size_t Count) { PCHAR_INFO p = (PCHAR_INFO) B; while (Count > 0) { p->Char.AsciiChar = Ch; p->Attributes = Attr; p++; Count--; } } void MoveChar(PCell B, int Pos, int Width, const char Ch, TAttr Attr, size_t Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; for (p += Pos; Count > 0; Count--) { p->Char.AsciiChar = Ch; p->Attributes = Attr; p++; } } void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; for (p += Pos; Count > 0; p++, --Count) { p->Char.AsciiChar = *Ch++; p->Attributes = Attr; } } void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t MaxCount) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; for (p += Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { p->Char.AsciiChar = *Ch++; p->Attributes = Attr; p++; } } void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, size_t MaxCount) { PCHAR_INFO p = (PCHAR_INFO) B; char was; //TAttr A; if (Pos < 0) { MaxCount += Pos; Ch -= Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + MaxCount > Width) MaxCount = Width - Pos; was = 0; for (p += Pos; MaxCount > 0 && (*Ch != 0); MaxCount--) { if (*Ch == '&' && !was) { Ch++; MaxCount++; was = 1; continue; } p->Char.AsciiChar = (unsigned char) (*Ch++); if (was) { p->Attributes = A1; was = 0; } else p->Attributes = A0; p++; } } void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; for (p += Pos; Count > 0; p++, --Count) p->Attributes = Attr; } void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count) { PCHAR_INFO p = (PCHAR_INFO) B; if (Pos < 0) { Count += Pos; Pos = 0; } if (Pos >= Width) return; if (Pos + Count > Width) Count = Width - Pos; for (p += Pos; Count > 0; p++, --Count) p->Attributes = ((unsigned char)(p->Attributes & 0xf)) | ((unsigned char) Attr); } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/memicmp.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000001065�11344266047�012606� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// Contributed by Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at> #include "fte.h" #include <stddef.h> #include <ctype.h> #if defined(__DJGPP__) || defined(UNIX) #ifdef __cplusplus extern "C" #endif int memicmp(const void *s1, const void *s2, size_t n) { const unsigned char *p1 = (const unsigned char *) s1; const unsigned char *p2 = (const unsigned char *) s2; for (; n-- > 0; p1++, p2++) { int c; if (*p1 != *p2 && (c = (toupper(*p1) - toupper(*p2)))) return c; } return 0; } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_buflist.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000015505�11602724002�013134� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_buflist.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_buflist.h" #include "i_modelview.h" #include "i_view.h" #include "s_string.h" #include "s_util.h" #include "sysdep.h" #include <stdio.h> BufferView *BufferList = 0; BufferView::BufferView(int createFlags, EModel **ARoot) : EList(createFlags, ARoot, "Buffers"), BList(0), BCount(0), SearchLen(0) { ModelNo = 0; // trick } BufferView::~BufferView() { if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BufferList = 0; } EEventMap *BufferView::GetEventMap() { return FindEventMap("BUFFERS"); } int BufferView::GetContext() { return CONTEXT_BUFFERS; } void BufferView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < BCount) if (Col < int(strlen(BList[Line]))) MoveStr(B, 0, Width, BList[Line] + Col, color, Width); } char* BufferView::FormatLine(int Line) { return strdup(BList[Line]); } void BufferView::UpdateList() { EModel *B = ActiveModel; int No; char s[512] = ""; if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BList = 0; BCount = 0; while (B) { BCount++; B = B->Next; if (B == ActiveModel) break; } BList = (char **) malloc(sizeof(char *) * BCount); assert(BList != 0); B = ActiveModel; No = 0; while (B) { B->GetInfo(s, sizeof(s) - 1); BList[No++] = strdup(s); B = B->Next; if (B == ActiveModel) break; if (No >= BCount) break; } Count = BCount; NeedsUpdate = 1; } EModel *BufferView::GetBufferById(int No) { EModel *B; B = ActiveModel; while (B) { if (No == 0) { return B; } No--; B = B->Next; if (B == ActiveModel) break; } return 0; } int BufferView::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExCloseActivate: { EModel *B; CancelSearch(); B = GetBufferById(Row); if (B && B != this) { View->SwitchToModel(B); delete this; return 1; } } return 0; case ExBufListFileClose: { EModel *B = GetBufferById(Row); CancelSearch(); if (B && B != this && Count > 1) { if (B->ConfQuit(View->MView->Win)) { View->DeleteModel(B); } UpdateList(); return 1; } } return 0; case ExBufListFileSave: { EModel *B = GetBufferById(Row); if (B && B->GetContext() == CONTEXT_FILE) if (((EBuffer *)B)->Save()) return 1; } return 0; case ExActivateInOtherWindow: { EModel *B = GetBufferById(Row); CancelSearch(); if (B) { View->Next->SwitchToModel(B); return 1; } } return 0; case ExBufListSearchCancel: CancelSearch(); return 1; case ExBufListSearchNext: // Find next matching line if (SearchLen) { int i = Row + 1; i = getMatchingLine(i == BCount ? 0 : i, 1); // Never returns -1 since something already found before call Row = SearchPos[SearchLen] = i; } return 1; case ExBufListSearchPrev: // Find prev matching line if (SearchLen) { int i = Row - 1; i = getMatchingLine(i == -1 ? BCount - 1 : i, -1); // Never returns -1 since something already found before call Row = SearchPos[SearchLen] = i; } return 1; default: ; } return EList::ExecCommand(Command, State); } void BufferView::HandleEvent(TEvent &Event) { int resetSearch = 1; EModel::HandleEvent(Event); switch (Event.What) { case evKeyUp: resetSearch = 0; break; case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbBackSp: resetSearch = 0; if (SearchLen > 0) { SearchString[--SearchLen] = 0; Row = SearchPos[SearchLen]; Msg(S_INFO, "Search: [%s]", SearchString); } else Msg(S_INFO, ""); break; case kbEsc: Msg(S_INFO, ""); break; default: resetSearch = 0; if (isAscii(Event.Key.Code) && (SearchLen < ExISearch::MAXISEARCH)) { char Ch = (char) Event.Key.Code; SearchPos[SearchLen] = Row; SearchString[SearchLen] = Ch; SearchString[++SearchLen] = 0; int i = getMatchingLine(Row, 1); if (i == -1) SearchString[--SearchLen] = 0; else Row = i; Msg(S_INFO, "Search: [%s]", SearchString); } break; } } if (resetSearch) SearchLen = 0; } /** * Search for next line containing SearchString starting from line 'start'. * Direction should be 1 for ascending and -1 for descending. * Returns line found or -1 if none. */ int BufferView::getMatchingLine (int start, int direction) { int i = start; do { // Find SearchString at any place in string for line i for(int j = 0; BList[i][j]; j++) if (BList[i][j] == SearchString[0] && strnicmp(SearchString, BList[i]+j, SearchLen) == 0) { return i; } i += direction; if (i == BCount) i = 0; else if (i == -1) i = BCount - 1; } while (i != start); return -1; } int BufferView::Activate(int No) { EModel *B; CancelSearch(); B = GetBufferById(No); if (B) { View->SwitchToModel(B); return 1; } return 0; } void BufferView::CancelSearch() { SearchLen = 0; Msg(S_INFO, ""); } void BufferView::GetInfo(char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d/%03d Buffers", ModelNo, Row + 1, Count); } void BufferView::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { strlcpy(ATitle, "Buffers", MaxLen); strlcpy(ASTitle, "Buffers", SMaxLen); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_view.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000003543�11344266047�012111� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_view.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_VIEW_H #define I_VIEW_H #include "gui.h" #include "c_commands.h" #include "c_bind.h" #include "i_input.h" class EView; class ExView; class EEventMap; class GxView: public GView { public: ExView *Top; ExView *Bottom; int MouseCaptured; GxView(GFrame *Parent); virtual ~GxView(); void PushView(ExView *view); ExView *PopView(); void NewView(ExView *view); EEventMap *GetEventMap(); int ExecCommand(ExCommands Command, ExState &State); virtual int GetContext(); virtual ExView* GetStatusContext() { if (Top) return Top->GetStatusContext(); else return 0; } virtual ExView* GetViewContext() { if (Top) return Top->GetViewContext(); else return 0; } virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void Update(); virtual void Repaint(); virtual void Activate(int gotfocus); virtual void Resize(int width, int height); void UpdateTitle(const char *Title, const char *STitle); int ReadStr(const char *Prompt, size_t BufLen, char *Str, Completer Comp, int Select, int HistId); int Choice(unsigned long Flags, const char *Title, int NSel, ... /* choices, format, args */); TKeyCode GetChar(const char *Prompt); #ifdef CONFIG_I_SEARCH int IncrementalSearch(EView *V); #endif #ifdef CONFIG_I_ASCII int PickASCII(); #endif #ifdef CONFIG_I_COMPLETE int ICompleteWord(EView *View); #endif int GetStr(const char *Prompt, size_t BufLen, char *Str, int HistId); int GetFile(const char *Prompt, size_t BufLen, char *Str, int HistId, int Flags); int IsModelView() { return Top ? Top->IsModelView() : 0; } }; #endif // I_VIEW_H �������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_string.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000000706�11602724002�012440� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef S_STRING_H #define S_STRING_H #include <stddef.h> size_t UnTabStr(char *dest, size_t maxlen, const char *source, size_t slen); size_t UnEscStr(char *dest, size_t maxlen, const char *source, size_t slen); #if !defined(HAVE_STRLCPY) size_t strlcpy(char *dst, const char *src, size_t size); #endif // !HAVE_STRLCPY #if !defined(HAVE_STRLCAT) size_t strlcat(char *dst, const char *src, size_t size); #endif // !HAVE_STRLCAT #endif // S_STRING_H ����������������������������������������������������������./src/fte-dj2.mak�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002032�07305167620�012372� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# MSDOS makefile for djgpp v2 and GNU make # Contributed by Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at> CC = gxx LD = gxx INCDIR = LIBDIR = #OPTIMIZE = -g OPTIMIZE = -O2 -fno-strength-reduce -fomit-frame-pointer -s CCFLAGS = -x c++ -fconserve-space $(OPTIMIZE) $(INCDIR) CCFLAGS += -Wall -W -Wsynth -Wno-unused CCFLAGS += -DDOSP32 -D__32BIT__ LDFLAGS = $(OPTIMIZE) $(LIBDIR) OEXT=o .SUFFIXES: .cpp .$(OEXT) include objs.inc CFTE_OBJS += port.$(OEXT) CFTE_OBJS += memicmp.$(OEXT) .cpp.$(OEXT): $(CC) $(CCFLAGS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) -c $< .PHONY: default all clean default all: cfte.exe fte.exe clean: -$(RM) *.o bin2c.exe cfte.exe fte.exe defcfg.cnf defcfg.h cfte.exe: $(CFTE_OBJS) $(LD) $(LDFLAGS) $(CFTE_OBJS) -o $@ defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) $< -o $@ c_config.$(OEXT): defcfg.h fte.exe: $(OBJS) $(DOSP32OBJS) $(LD) $(LDFLAGS) $^ -o $@ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_svndiff.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002051�11331412505�012561� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svndiff.h * * S.Pinigin copy o_cvsdiff.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class showing output from SVN diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #ifndef O_SVNDIFF_H #define O_SVNDIFF_H #include "fte.h" #ifdef CONFIG_OBJ_SVN #include "o_svnbase.h" class ESvnDiff:public ESvnBase { public: int CurrLine,ToLine,InToFile; char *CurrFile; ESvnDiff (int createFlags,EModel **ARoot,char *Dir,char *ACommand,char *AOnFiles); ~ESvnDiff (); void ParseFromTo (char *line,int len); virtual void ParseLine (char *line,int len); // Returns 0 if OK virtual int RunPipe (const char *Dir, const char *Command, const char *Info); virtual int ExecCommand(ExCommands Command, ExState &State); int BlockCopy (int Append); virtual int GetContext () {return CONTEXT_SVNDIFF;} virtual EEventMap *GetEventMap (); }; extern ESvnDiff *SvnDiffView; #endif // CONFIG_OBJ_SVN #endif // O_SVNDIFF_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/cfte.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000206755�11604420433�012103� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* cfte.cpp * * Copyright (c) 1994-1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_fconfig.h" #include "c_hilit.h" #include "c_mode.h" #include "console.h" #include "ftever.h" #include "s_files.h" #include "s_string.h" #include "sysdep.h" #include "c_commands.h" #include "c_cmdtab.h" #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <stdarg.h> #include <ctype.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #define slen(s) ((s) ? (strlen(s) + 1) : 0) struct ExMacroCFTE { char *Name; }; static unsigned CMacrosCFTE = 0; static ExMacroCFTE *MacrosCFTE = 0; static FILE *output = 0; static int lntotal = 0; static long offset = -1; static long pos = 0; static char XTarget[MAXPATH] = ""; static char StartDir[MAXPATH] = ""; static bool preprocess_only = false; struct CurPos { off_t sz; char *a; char *c; char *z; int line; const char *name; // filename }; static void cleanup(int xerrno) { if (output) fclose(output); if (XTarget[0] != 0) unlink(XTarget); exit(xerrno); } static void Fail(CurPos &cp, const char *s, ...) { va_list ap; char msgbuf[1024]; va_start(ap, s); vsprintf(msgbuf, s, ap); va_end(ap); fprintf(stderr, "%s:%d: Error: %s\n", cp.name, cp.line, msgbuf); cleanup(1); } static int LoadFile(const char *WhereName, const char *CfgName, int Level = 1); static void DefineWord(const char *w); static void PutObject(CurPos &cp, int xtag, size_t xlen, void *obj) { unsigned char tag = (unsigned char)xtag; unsigned short len = (unsigned short)xlen; unsigned char l[2]; if (preprocess_only == false) { l[0] = (char)len; l[1] = (char)(len >> 8); if (fwrite(&tag, 1, 1, output) != 1 || fwrite(l, 2, 1, output) != 1 || fwrite(obj, 1, len, output) != len) Fail(cp, "Disk full!"); } pos += 1 + 2 + len; if (offset != -1 && pos >= offset) Fail(cp, "Error location found at %ld", pos); } static void PutNull(CurPos &cp, int xtag) { PutObject(cp, xtag, 0, 0); } static void PutString(CurPos &cp, int xtag, char *str) { PutObject(cp, xtag, slen(str), str); } static void PutNumber(CurPos &cp, int xtag, long num) { unsigned long l = num; unsigned char b[4]; b[0] = (unsigned char)(l & 0xFF); b[1] = (unsigned char)((l >> 8) & 0xFF); b[2] = (unsigned char)((l >> 16) & 0xFF); b[3] = (unsigned char)((l >> 24) & 0xFF); PutObject(cp, xtag, 4, b); } int main(int argc, char **argv) { char Source[MAXPATH]; char Target[MAXPATH]; unsigned char b[4]; unsigned long l; int n = 0; fprintf(stderr, PROG_CFTE " " VERSION "\n" COPYRIGHT "\n"); if (argc < 2 || argc > 5) { fprintf(stderr, "Usage: " PROG_CFTE " [-o<offset>] [-p[reprocess]] " #ifndef UNIX "config/" #endif "main.fte [fte-new.cnf]\n"); exit(1); } DefineWord("OS_" #if defined(OS2) "OS2" #elif defined(UNIX) "UNIX" #elif defined(NT) "NT" #elif defined(DOSP32) "DOS32" #endif ); // setup defaults strcpy(Source, ""); strcpy(Target, "fte-new.cnf"); preprocess_only = false; offset = -1; // parse arguments for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { if ((strcmp(argv[i], "-p") == 0) || (strcmp(argv[i], "-preprocess") == 0)) preprocess_only = true; else if (strncmp(argv[i], "-o", 2) == 0) { char *p; p = argv[i]; p += 2; offset = atol(p); } else { fprintf(stderr, "Invalid option '%s'\n", argv[i]); exit(1); } } else { switch(n) { case 0: strlcpy(Source, argv[i], sizeof(Source)); break; case 1: strlcpy(Target, argv[i], sizeof(Target)); break; default: fprintf(stderr, "Invalid option '%s'\n", argv[i]); exit(1); } n++; } } if (n == 0) { fprintf(stderr, "No configuration file specified\n"); exit(1); } JustDirectory(Target, XTarget, sizeof(XTarget)); Slash(XTarget, 1); if (preprocess_only == false) { sprintf(XTarget + strlen(XTarget), "cfte%ld.tmp", (long)getpid()); output = fopen(XTarget, "wb"); if (output == 0) { fprintf(stderr, "Cannot create '%s', errno=%d!\n", XTarget, errno); cleanup(1); } b[0] = b[1] = b[2] = b[3] = 0; if (fwrite(b, sizeof(b), 1, output) != 1) { fprintf(stderr, "Disk full!"); cleanup(1); } l = VERNUM; b[0] = (unsigned char)(l & 0xFF); b[1] = (unsigned char)((l >> 8) & 0xFF); b[2] = (unsigned char)((l >> 16) & 0xFF); b[3] = (unsigned char)((l >> 24) & 0xFF); if (fwrite(b, 4, 1, output) != 1) { fprintf(stderr, "Disk full!"); cleanup(1); } pos = 2 * 4; fprintf(stderr, "Compiling to '%s'\n", Target); } else { pos = 2 * 4; } /*{ char PrevDir[MAXPATH]; sprintf(PrevDir, "%s/..", Target); ExpandPath(PrevDir, StartDir); Slash(StartDir, 1); }*/ ExpandPath("." #ifdef UNIX "." #endif , StartDir, sizeof(StartDir)); Slash(StartDir, 1); if (preprocess_only == false) { CurPos cp; char FSource[MAXPATH]; if (ExpandPath(Source, FSource, sizeof(FSource)) != 0) { fprintf(stderr, "Could not expand path %s\n", Source); exit(1); } cp.sz = 0; cp.c = 0; cp.a = cp.c = 0; cp.z = cp.a + cp.sz; cp.line = 0; cp.name = "<cfte-start>"; PutString(cp, CF_STRING, FSource); } if (LoadFile(StartDir, Source, 0) != 0) { fprintf(stderr, "\nCompile failed\n"); cleanup(1); } if (preprocess_only == true) return 0; l = CONFIG_ID; b[0] = (unsigned char)(l & 0xFF); b[1] = (unsigned char)((l >> 8) & 0xFF); b[2] = (unsigned char)((l >> 16) & 0xFF); b[3] = (unsigned char)((l >> 24) & 0xFF); fseek(output, 0, SEEK_SET); fwrite(b, 4, 1, output); fclose(output); if (unlink(Target) != 0 && errno != ENOENT) { fprintf(stderr, "Remove of '%s' failed, result left in %s, errno=%d\n", Target, XTarget, errno); exit(1); } if (rename(XTarget, Target) != 0) { fprintf(stderr, "Rename of '%s' to '%s' failed, errno=%d\n", XTarget, Target, errno); exit(1); } fprintf(stderr, "\nDone.\n"); return 0; } #define MODE_BFI(x) { #x, BFI_##x } #define MODE_BFS(x) { #x, BFS_##x } #define MODE_FLG(x) { #x, FLAG_##x } #define EVENT_FLG(x) { #x, EM_##x } #define COLORIZE_FLG(x) { #x, COL_##x } #define HILIT_CLR(x) { #x, CLR_##x } struct OrdLookup { const char *Name; int num; }; static const OrdLookup mode_num[] = { MODE_BFI(AutoIndent), MODE_BFI(Insert), MODE_BFI(DrawOn), MODE_BFI(HilitOn), MODE_BFI(ExpandTabs), MODE_BFI(Trim), MODE_BFI(TabSize), MODE_BFI(ShowTabs), MODE_BFI(LineChar), MODE_BFI(StripChar), MODE_BFI(AddLF), MODE_BFI(AddCR), MODE_BFI(ForceNewLine), MODE_BFI(HardMode), MODE_BFI(Undo), MODE_BFI(ReadOnly), MODE_BFI(AutoSave), MODE_BFI(KeepBackups), MODE_BFI(LoadMargin), MODE_BFI(UndoLimit), MODE_BFI(MatchCase), MODE_BFI(BackSpKillTab), MODE_BFI(DeleteKillTab), MODE_BFI(BackSpUnindents), MODE_BFI(SpaceTabs), MODE_BFI(IndentWithTabs), MODE_BFI(LeftMargin), MODE_BFI(RightMargin), MODE_BFI(SeeThruSel), MODE_BFI(WordWrap), MODE_BFI(ShowMarkers), MODE_BFI(CursorThroughTabs), MODE_BFI(SaveFolds), MODE_BFI(MultiLineHilit), MODE_BFI(AutoHilitParen), MODE_BFI(Abbreviations), MODE_BFI(BackSpKillBlock), MODE_BFI(DeleteKillBlock), MODE_BFI(PersistentBlocks), MODE_BFI(InsertKillBlock), MODE_BFI(UndoMoves), MODE_BFI(DetectLineSep), MODE_BFI(TrimOnSave), MODE_BFI(SaveBookmarks), MODE_BFI(HilitTags), MODE_BFI(ShowBookmarks), MODE_BFI(MakeBackups), { 0, 0 }, }; static const OrdLookup mode_string[] = { MODE_BFI(Colorizer), MODE_BFI(IndentMode), MODE_BFS(RoutineRegexp), MODE_BFS(DefFindOpt), MODE_BFS(DefFindReplaceOpt), MODE_BFS(CommentStart), MODE_BFS(CommentEnd), MODE_BFS(WordChars), MODE_BFS(CapitalChars), MODE_BFS(FileNameRx), MODE_BFS(FirstLineRx), MODE_BFS(CompileCommand), MODE_BFI(EventMap), { 0, 0 }, }; static const OrdLookup global_num[] = { #ifdef CONFIG_INDENT_C MODE_FLG(C_Indent), MODE_FLG(C_BraceOfs), MODE_FLG(C_CaseOfs), MODE_FLG(C_CaseDelta), MODE_FLG(C_ClassOfs), MODE_FLG(C_ClassDelta), MODE_FLG(C_ColonOfs), MODE_FLG(C_CommentOfs), MODE_FLG(C_CommentDelta), MODE_FLG(C_FirstLevelWidth), MODE_FLG(C_FirstLevelIndent), MODE_FLG(C_Continuation), MODE_FLG(C_ParenDelta), MODE_FLG(FunctionUsesContinuation), #endif #ifdef CONFIG_INDENT_REXX MODE_FLG(REXX_Indent), MODE_FLG(REXX_Do_Offset), #endif MODE_FLG(ScreenSizeX), MODE_FLG(ScreenSizeY), MODE_FLG(CursorInsertStart), MODE_FLG(CursorInsertEnd), MODE_FLG(CursorOverStart), MODE_FLG(CursorOverEnd), MODE_FLG(SysClipboard), MODE_FLG(OpenAfterClose), MODE_FLG(ShowVScroll), MODE_FLG(ShowHScroll), MODE_FLG(ScrollBarWidth), MODE_FLG(SelectPathname), MODE_FLG(ShowToolBar), MODE_FLG(ShowMenuBar), MODE_FLG(KeepHistory), MODE_FLG(LoadDesktopOnEntry), MODE_FLG(SaveDesktopOnExit), MODE_FLG(KeepMessages), MODE_FLG(ScrollBorderX), MODE_FLG(ScrollBorderY), MODE_FLG(ScrollJumpX), MODE_FLG(ScrollJumpY), MODE_FLG(GUIDialogs), MODE_FLG(PMDisableAccel), MODE_FLG(SevenBit), MODE_FLG(WeirdScroll), MODE_FLG(LoadDesktopMode), MODE_FLG(IgnoreBufferList), MODE_FLG(ReassignModelIds), MODE_FLG(RecheckReadOnly), MODE_FLG(CursorBlink), MODE_FLG(ShowTildeFilesInDirList), { 0, 0 }, }; static const OrdLookup global_string[] = { MODE_FLG(DefaultModeName), MODE_FLG(CompletionFilter), MODE_FLG(PrintDevice), MODE_FLG(CompileCommand), MODE_FLG(WindowFont), MODE_FLG(HelpCommand), MODE_FLG(GUICharacters), MODE_FLG(CvsCommand), MODE_FLG(CvsLogMode), MODE_FLG(SvnCommand), MODE_FLG(SvnLogMode), MODE_FLG(XShellCommand), MODE_FLG(RGBColor), { 0, 0 }, }; static const OrdLookup event_string[] = { EVENT_FLG(MainMenu), EVENT_FLG(LocalMenu), { 0, 0 }, }; static const OrdLookup colorize_string[] = { COLORIZE_FLG(SyntaxParser), { 0, 0 }, }; static const OrdLookup hilit_colors[] = { HILIT_CLR(Normal), HILIT_CLR(Keyword), HILIT_CLR(String), HILIT_CLR(Comment), HILIT_CLR(CPreprocessor), HILIT_CLR(Regexp), HILIT_CLR(Header), HILIT_CLR(Quotes), HILIT_CLR(Number), HILIT_CLR(HexNumber), HILIT_CLR(OctalNumber), HILIT_CLR(FloatNumber), HILIT_CLR(Function), HILIT_CLR(Command), HILIT_CLR(Tag), HILIT_CLR(Punctuation), HILIT_CLR(New), HILIT_CLR(Old), HILIT_CLR(Changed), HILIT_CLR(Control), HILIT_CLR(Separator), HILIT_CLR(Variable), HILIT_CLR(Symbol), HILIT_CLR(Directive), HILIT_CLR(Label), HILIT_CLR(Special), HILIT_CLR(QuoteDelim), HILIT_CLR(RegexpDelim), { 0, 0 }, }; static int Lookup(const OrdLookup *where, char *what) { int i; for (i = 0; where[i].Name != 0; i++) { if (strcmp(what, where[i].Name) == 0) return where[i].num; } // fprintf(stderr, "\nBad name: %s (i = %d)\n", what, i); return -1; } #define P_EOF 0 // end of file #define P_SYNTAX 1 // unknown #define P_WORD 2 // a-zA-Z_ #define P_NUMBER 3 // 0-9 #define P_STRING 4 // "'` #define P_ASSIGN 5 // = #define P_EOS 6 // ; #define P_KEYSPEC 7 // [] #define P_OPENBRACE 8 // { #define P_CLOSEBRACE 9 // } #define P_COLON 10 // : #define P_COMMA 11 // , #define P_QUEST 12 #define P_VARIABLE 13 // $ #define P_DOT 14 // . (concat) #define K_UNKNOWN 0 #define K_MODE 1 #define K_KEY 2 #define K_COLOR 3 #define K_KEYWORD 4 #define K_OBJECT 5 #define K_MENU 6 #define K_ITEM 7 #define K_SUBMENU 8 #define K_COMPILERX 9 #define K_EXTERN 10 #define K_INCLUDE 11 #define K_SUB 12 #define K_EVENTMAP 13 #define K_COLORIZE 14 #define K_ABBREV 15 #define K_HSTATE 16 #define K_HTRANS 17 #define K_HWORDS 18 #define K_SUBMENUCOND 19 #define K_HWTYPE 20 #define K_COLPALETTE 21 #define K_CVSIGNRX 22 #define K_SVNIGNRX 23 typedef char Word[64]; static const OrdLookup CfgKW[] = { { "mode", K_MODE }, { "eventmap", K_EVENTMAP }, { "key", K_KEY }, { "color", K_COLOR }, { "color_palette", K_COLPALETTE }, { "keyword", K_KEYWORD }, { "object", K_OBJECT }, { "menu", K_MENU }, { "item", K_ITEM }, { "submenu", K_SUBMENU }, { "CompileRx", K_COMPILERX }, { "extern", K_EXTERN }, { "include", K_INCLUDE }, { "sub", K_SUB }, { "colorize", K_COLORIZE }, { "abbrev", K_ABBREV }, { "h_state", K_HSTATE }, { "h_trans", K_HTRANS }, { "h_words", K_HWORDS }, { "h_wtype", K_HWTYPE }, { "submenucond", K_SUBMENUCOND }, { "CvsIgnoreRx", K_CVSIGNRX }, { "SvnIgnoreRx", K_SVNIGNRX }, { 0, 0 }, }; static const OrdLookup CfgVar[] = { { "FilePath", mvFilePath }, { "FileName", mvFileName }, { "FileDirectory", mvFileDirectory }, { "FileBaseName", mvFileBaseName }, { "FileExtension", mvFileExtension }, { "CurDirectory", mvCurDirectory }, { "CurRow", mvCurRow, }, { "CurCol", mvCurCol }, { "Char", mvChar }, { "Word", mvWord }, { "Line", mvLine }, { "FTEVer", mvFTEVer }, { 0, 0 }, }; static char **words = 0; static unsigned int wordCount = 0; static int DefinedWord(const char *w) { if (words == 0 || wordCount == 0) return 0; for (unsigned int i = 0; i < wordCount; i++) if (strcmp(w, words[i]) == 0) return 1; return 0; } static void DefineWord(const char *w) { if (!w || !w[0]) return ; if (!DefinedWord(w)) { words = (char **)realloc(words, sizeof (char *) * (wordCount + 1)); assert(words != 0); words[wordCount] = strdup(w); assert(words[wordCount] != 0); wordCount++; } } static int colorCount; static struct _color { char *colorName; char *colorValue; } *colors; static int DefineColor(char *name, char *value) { if (!name || !value) return 0; colors = (struct _color *)realloc(colors, sizeof (struct _color) * (colorCount + 1)); assert(colors != 0); colors[colorCount].colorName = strdup(name); colors[colorCount].colorValue = strdup(value); assert(colors != NULL); assert(colors[colorCount].colorName != 0); assert(colors[colorCount].colorValue != 0); colorCount++; return 1; } static char *DefinedColor(char *name) { if (colors == 0 || colorCount == 0) return 0; for (int i = 0; i < colorCount; i++) if (strcmp(name, colors[i].colorName) == 0) return colors[i].colorValue; return 0; } static char *GetColor(CurPos &cp, char *name) { char *c; static char color[4]; // add support for fore:back and remove it from fte itself if ((c = strchr(name, ' ')) != NULL) { } else if ((c = strchr(name, ':')) != NULL) { char clr[4]; *c++ = 0; clr[0] = GetColor(cp, name)[0]; clr[1] = ' '; clr[2] = GetColor(cp, c)[2]; clr[3] = 0; memcpy(color, clr, sizeof(color)); name = color; } else { char *p = DefinedColor(name); if (!p) Fail(cp, "Unknown symbolic color %s", name); name = p; } if (!isxdigit(name[0]) && name[1] != ' ' && !isxdigit(name[2]) && name[3] != 0) Fail(cp, "Malformed color specification: %s", name); return name; } static int GetWord(CurPos &cp, char *w) { char *p = w; int len = 0; while (len < int(sizeof(Word)) && cp.c < cp.z && ((*cp.c >= 'a' && *cp.c <= 'z') || (*cp.c >= 'A' && *cp.c <= 'Z') || (*cp.c >= '0' && *cp.c <= '9') || (*cp.c == '_'))) { *p++ = *cp.c++; len++; } if (len == sizeof(Word)) return -1; *p = 0; return 0; } static int Parse(CurPos &cp) { while (cp.c < cp.z) { switch (*cp.c) { #ifndef UNIX case '\x1A': /* ^Z :-* */ return P_EOF; #endif case '#': while (cp.c < cp.z && *cp.c != '\n') cp.c++; break; case '\n': cp.line++; lntotal++; case ' ': case '\t': case '\r': cp.c++; break; case '=': return P_ASSIGN; case ';': return P_EOS; case ',': return P_COMMA; case ':': return P_COLON; case '.': return P_DOT; case '\'': case '"': case '`': case '/': return P_STRING; case '[': return P_KEYSPEC; case '{': return P_OPENBRACE; case '}': return P_CLOSEBRACE; case '?': return P_QUEST; case '$': return P_VARIABLE; case '-': case '+': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return P_NUMBER; default: if ((*cp.c >= 'a' && *cp.c <= 'z') || (*cp.c >= 'A' && *cp.c <= 'Z') || (*cp.c == '_')) return P_WORD; else return P_SYNTAX; } } return P_EOF; } static void GetOp(CurPos &cp, int what) { switch (what) { case P_COMMA: case P_OPENBRACE: case P_CLOSEBRACE: case P_ASSIGN: case P_EOS: case P_COLON: case P_QUEST: case P_VARIABLE: case P_DOT: cp.c++; break; } } static char *GetString(CurPos &cp) { char c = *cp.c; char *p = cp.c; char *d = cp.c; int n; if (c == '[') c = ']'; cp.c++; // skip '"` while (cp.c < cp.z) { if (*cp.c == '\\') { if (c == '/') *p++ = *cp.c; cp.c++; if (cp.c == cp.z) return 0; if (c == '"') { switch (*cp.c) { case 'e': *cp.c = '\x1B'; break; case 't': *cp.c = '\t'; break; case 'r': *cp.c = '\r'; break; case 'n': *cp.c = '\n'; break; case 'b': *cp.c = '\b'; break; case 'v': *cp.c = '\v'; break; case 'a': *cp.c = '\a'; break; case 'x': cp.c++; if (cp.c == cp.z) return 0; if (*cp.c >= '0' && *cp.c <= '9') n = *cp.c - '0'; else if (*cp.c >='a' && *cp.c <= 'f') n = *cp.c - 'a' + 10; else if (*cp.c >='A' && *cp.c <= 'F') n = *cp.c - 'A' + 10; else return 0; cp.c++; if (cp.c == cp.z) cp.c--; else if (*cp.c >= '0' && *cp.c <= '9') n = n * 16 + *cp.c - '0'; else if (*cp.c >= 'a' && *cp.c <= 'f') n = n * 16 + *cp.c - 'a' + 10; else if (*cp.c >= 'A' && *cp.c <= 'F') n = n * 16 + *cp.c - 'A' + 10; else cp.c--; *cp.c = (char)n; break; } } } else if (*cp.c == c) { cp.c++; *p = 0; return d; } else if (*cp.c == '\n') { cp.line++; return 0; } else if (*cp.c == '\r') { cp.c++; if (cp.c == cp.z) return 0; } *p++ = *cp.c++; } return 0; } static int GetNumber(CurPos &cp) { int value = 0; int neg = 0; if (cp.c < cp.z && (*cp.c == '-' || *cp.c == '+')) { if (*cp.c == '-') neg = 1; cp.c++; } while (cp.c < cp.z && (*cp.c >= '0' && *cp.c <= '9')) { value = value * 10 + (*cp.c - '0'); cp.c++; } return neg ? -value : value; } static int CmdNumCFTE(const char *Cmd) { for (size_t i = 0; i < FTE_ARRAY_SIZE(Command_Table); ++i) if (strcmp(Cmd, Command_Table[i].Name) == 0) return Command_Table[i].CmdId; for (unsigned i = 0; i < CMacrosCFTE; i++) if (MacrosCFTE[i].Name && (strcmp(Cmd, MacrosCFTE[i].Name)) == 0) return i | CMD_EXT; return 0; // Nop } static int NewCommandCFTE(const char *Name) { if (Name == 0) Name = ""; MacrosCFTE = (ExMacroCFTE *) realloc(MacrosCFTE, sizeof(ExMacroCFTE) * (1 + CMacrosCFTE)); MacrosCFTE[CMacrosCFTE].Name = strdup(Name); CMacrosCFTE++; return CMacrosCFTE - 1; } static int ParseCommands(CurPos &cp, char *Name) { //if (!Name) // return 0; Word cmd; int p; long Cmd = NewCommandCFTE(Name) | CMD_EXT; long cnt; long ign = 0; PutNumber(cp, CF_INT, Cmd); GetOp(cp, P_OPENBRACE); cnt = 1; while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p == P_DOT) { GetOp(cp, P_DOT); PutNull(cp, CF_CONCAT); } else if (p == P_NUMBER) { long num = GetNumber(cp); if (Parse(cp) != P_COLON) { PutNumber(cp, CF_INT, num); } else { cnt = num; GetOp(cp, P_COLON); } } else if (p == P_WORD) { long Command; if (GetWord(cp, cmd) == -1) Fail(cp, "Syntax error"); Command = CmdNumCFTE(cmd); if (Command == 0) Fail(cp, "Unrecognised command: %s", cmd); PutNumber(cp, CF_COMMAND, Command); PutNumber(cp, CF_INT, cnt); PutNumber(cp, CF_INT, ign); ign = 0; cnt = 1; } else if (p == P_STRING) { char *s = GetString(cp); PutString(cp, CF_STRING, s); } else if (p == P_QUEST) { ign = 1; GetOp(cp, P_QUEST); } else if (p == P_VARIABLE) { GetOp(cp, P_VARIABLE); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error (variable name expected)"); Word w; if (GetWord(cp, w) != 0) Fail(cp, "Syntax error (bad variable name)"); long var = Lookup(CfgVar, w); if (var == -1) Fail(cp, "Unrecognised variable"); PutNumber(cp, CF_VARIABLE, var); } else if (p == P_EOS) { GetOp(cp, P_EOS); cnt = 1; } else Fail(cp, "Syntax error"); } GetOp(cp, P_CLOSEBRACE); return 0; } static int ParseConfigFile(CurPos &cp) { Word w = ""; char *s = 0; int p = 0; Word ObjName = "", UpMode = ""; while (1) { p = Parse(cp); switch (p) { case P_WORD: if (GetWord(cp, w) != 0) Fail(cp, "Syntax error"); switch (Lookup(CfgKW, w)) { case K_SUB: { Word Name; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, Name) != 0) Fail(cp, "Syntax error"); PutString(cp, CF_SUB, Name); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (ParseCommands(cp, strdup(Name)) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); } break; case K_MENU: { Word MenuName; //int menu = -1, item = -1; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error");; if (GetWord(cp, MenuName) != 0) Fail(cp, "Syntax error");; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_MENU, MenuName); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_ITEM: // menu::item switch (Parse(cp)) { case P_EOS: PutNull(cp, CF_ITEM); break; case P_STRING: s = GetString(cp); PutString(cp, CF_ITEM, s); break; default: Fail(cp, "Syntax error");; } if (Parse(cp) == P_EOS) { GetOp(cp, P_EOS); break; } if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); PutNull(cp, CF_MENUSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case K_SUBMENU: // menu::submenu if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) == -1) Fail(cp, "Parse failed"); PutString(cp, CF_SUBMENU, s); PutString(cp, CF_STRING, w); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; case K_SUBMENUCOND: // menu::submenu if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) == -1) Fail(cp, "Parse failed"); PutString(cp, CF_SUBMENUCOND, s); PutString(cp, CF_STRING, w); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; default: // menu:: Fail(cp, "Syntax error"); } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_EVENTMAP: { if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); PutString(cp, CF_EVENTMAP, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_KEY: // mode::key if (Parse(cp) != P_KEYSPEC) Fail(cp, "'[' expected"); s = GetString(cp); PutString(cp, CF_KEY, s); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); PutNull(cp, CF_KEYSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case K_ABBREV: if (Parse(cp) != P_STRING) Fail(cp, "String expected"); s = GetString(cp); PutString(cp, CF_ABBREV, s); switch (Parse(cp)) { case P_OPENBRACE: PutNull(cp, CF_KEYSUB); if (ParseCommands(cp, 0) == -1) Fail(cp, "Parse failed"); PutNull(cp, CF_END); break; case P_STRING: s = GetString(cp); PutString(cp, CF_STRING, s); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; default: Fail(cp, "Syntax error"); } break; default: // mode:: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { /* case P_NUMBER: { long var; long num; num = GetNumber(cp); var = LookupEventNumber(w); if (var == -1) return -1; PutObj(cp, CF_SETVAR, sizeof(long), &var); PutObj(cp, CF_INT, sizeof(long), &num); } break;*/ case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "String expected"); var = Lookup(event_string, w); if (var == -1) Fail(cp, "event_string Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) return -1; GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_COLORIZE: { long LastState = -1; if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); PutString(cp, CF_COLORIZE, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_COLOR: // mode::color if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNull(cp, CF_COLOR); while (1) { char *sname, *svalue; long cidx; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); if ((cidx = Lookup(hilit_colors, sname)) == -1) Fail(cp, "hilit_colors Lookup of '%s' failed", sname); PutNumber(cp, CF_INT, cidx); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); PutString(cp, CF_STRING, svalue); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_KEYWORD: // mode::keyword { char *colorstr, *kname; //int color; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); colorstr = GetString(cp); colorstr = GetColor(cp, colorstr); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_KEYWORD, colorstr); while (1) { if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); kname = GetString(cp); if (strlen(kname) >= CK_MAXLEN) Fail(cp, "Keyword name is too long"); PutString(cp, CF_STRING, kname); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_HSTATE: { long stateno; char *cname; long cidx; if (Parse(cp) != P_NUMBER) Fail(cp, "state index expected"); stateno = GetNumber(cp); if (stateno != LastState + 1) Fail(cp, "invalid state index"); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNumber(cp, CF_HSTATE, stateno); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); cname = GetString(cp); if ((cidx = Lookup(hilit_colors, cname)) == -1) Fail(cp, "hilit_colors Lookup of '%s' failed", cname); PutNumber(cp, CF_INT, cidx); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); LastState = stateno; } break; case K_HTRANS: { long next_state; char *opts, *match; long match_opts; char *cname; long cidx; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); next_state = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "match options expected"); opts = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "match string expected"); match = GetString(cp); PutNumber(cp, CF_HTRANS, next_state); match_opts = 0; if (strchr(opts, '^')) match_opts |= MATCH_MUST_BOL; if (strchr(opts, '$')) match_opts |= MATCH_MUST_EOL; //if (strchr(opts, 'b')) match_opts |= MATCH_MUST_BOLW; //if (strchr(opts, 'e')) match_opts |= MATCH_MUST_EOLW; if (strchr(opts, 'i')) match_opts |= MATCH_NO_CASE; if (strchr(opts, 's')) match_opts |= MATCH_SET; if (strchr(opts, 'S')) match_opts |= MATCH_NOTSET; if (strchr(opts, '-')) match_opts |= MATCH_NOGRAB; if (strchr(opts, '<')) match_opts |= MATCH_TAGASNEXT; if (strchr(opts, '>')) match_opts &= ~MATCH_TAGASNEXT; //if (strchr(opts, '!')) match_opts |= MATCH_NEGATE; if (strchr(opts, 'q')) match_opts |= MATCH_QUOTECH; if (strchr(opts, 'Q')) match_opts |= MATCH_QUOTEEOL; if (strchr(opts, 'x')) match_opts |= MATCH_REGEXP; if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); cname = GetString(cp); if ((cidx = Lookup(hilit_colors, cname)) == -1) Fail(cp, "hilit_colors Lookup of '%s' failed", cname); PutNumber(cp, CF_INT, match_opts); PutNumber(cp, CF_INT, cidx); PutString(cp, match_opts & MATCH_REGEXP ? CF_REGEXP : CF_STRING, match); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); } break; case K_HWTYPE: if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); { long options = 0; long nextKwdMatchedState; long nextKwdNotMatchedState; long nextKwdNoCharState; char *opts; char *wordChars; if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdMatchedState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdNotMatchedState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "next_state index expected"); nextKwdNoCharState = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); opts = GetString(cp); if (strchr(opts, 'i')) options |= STATE_NOCASE; if (strchr(opts, '<')) options |= STATE_TAGASNEXT; if (strchr(opts, '>')) options &= ~STATE_TAGASNEXT; if (strchr(opts, '-')) options |= STATE_NOGRAB; if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); wordChars = GetString(cp); PutNull(cp, CF_HWTYPE); PutNumber(cp, CF_INT, nextKwdMatchedState); PutNumber(cp, CF_INT, nextKwdNotMatchedState); PutNumber(cp, CF_INT, nextKwdNoCharState); PutNumber(cp, CF_INT, options); PutString(cp, CF_STRING, wordChars); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); break; case K_HWORDS: { char *colorstr, *kname; //int color; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); colorstr = GetString(cp); colorstr = GetColor(cp, colorstr); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_HWORDS, colorstr); while (1) { if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); kname = GetString(cp); PutString(cp, CF_STRING, kname); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); break; default: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { /*case P_NUMBER: { long var; long num; num = GetNumber(cp); var = LookupColorizeNumber(w); if (var == -1) return -1; PutObj(cp, CF_SETVAR, sizeof(long), &var); PutObj(cp, CF_INT, sizeof(long), &num); } break;*/ case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed"); var = Lookup(colorize_string, w); if (var == -1) Fail(cp, "colorize_string Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_MODE: // mode:: { if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); PutString(cp, CF_MODE, ObjName); UpMode[0] = 0; if (Parse(cp) == P_COLON) { GetOp(cp, P_COLON); if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, UpMode) != 0) Fail(cp, "Parse failed"); } PutString(cp, CF_PARENT, UpMode); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); //switch (Lookup(CfgKW, w)) { //default: // mode:: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { case P_NUMBER: { long var; long num; num = GetNumber(cp); var = Lookup(mode_num, w); if (var == -1) Fail(cp, "mode_num Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutNumber(cp, CF_INT, num); } break; case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed"); var = Lookup(mode_string, w); if (var == -1) Fail(cp, "mode_string Lookup of '%s' filed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: return -1; } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); // break; //} } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_OBJECT: { if (Parse(cp) != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, ObjName) != 0) Fail(cp, "Parse failed"); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutString(cp, CF_OBJECT, ObjName); while (1) { p = Parse(cp); if (p == P_CLOSEBRACE) break; if (p == P_EOF) Fail(cp, "Unexpected EOF"); if (p != P_WORD) Fail(cp, "Syntax error"); if (GetWord(cp, w) != 0) Fail(cp, "Parse failed"); switch (Lookup(CfgKW, w)) { case K_COLOR: // mode::color if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); PutNull(cp, CF_COLOR); while (1) { char *sname, *svalue; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); PutString(cp, CF_STRING, sname); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); PutString(cp, CF_STRING, svalue); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); PutNull(cp, CF_END); break; case K_COMPILERX: { long file, line, msg; char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); file = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); line = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_NUMBER) Fail(cp, "Number expected"); msg = GetNumber(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_COMPRX); PutNumber(cp, CF_INT, file); PutNumber(cp, CF_INT, line); PutNumber(cp, CF_INT, msg); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; case K_CVSIGNRX: { char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); PutNull(cp, CF_CVSIGNRX); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; case K_SVNIGNRX: { char *regexp; if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); regexp = GetString(cp); PutNull(cp, CF_SVNIGNRX); PutString(cp, CF_REGEXP, regexp); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; default: // mode:: if (Parse(cp) != P_ASSIGN) Fail(cp, "'=' expected"); GetOp(cp, P_ASSIGN); switch (Parse(cp)) { case P_NUMBER: { long var; long num; num = GetNumber(cp); var = Lookup(global_num, w); if (var == -1) Fail(cp, "global_num Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutNumber(cp, CF_INT, num); } break; case P_STRING: { long var; s = GetString(cp); if (s == 0) Fail(cp, "Parse failed"); var = Lookup(global_string, w); if (var == -1) Fail(cp, "global_string Lookup of '%s' failed", w); PutNumber(cp, CF_SETVAR, var); PutString(cp, CF_STRING, s); } break; default: Fail(cp, "Syntax error"); } if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); break; } } GetOp(cp, P_CLOSEBRACE); PutNull(cp, CF_END); } break; case K_COLPALETTE: { if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); while (1) { char *sname, *svalue; if (Parse(cp) == P_CLOSEBRACE) break; if (Parse(cp) != P_OPENBRACE) Fail(cp, "'{' expected"); GetOp(cp, P_OPENBRACE); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); sname = GetString(cp); if (Parse(cp) != P_COMMA) Fail(cp, "',' expected"); GetOp(cp, P_COMMA); if (Parse(cp) != P_STRING) Fail(cp, "String expected"); svalue = GetString(cp); svalue = GetColor(cp, svalue); if (DefineColor(sname, svalue) != 1) Fail(cp, "DefineColor failed\n"); if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); if (Parse(cp) != P_COMMA) break; else GetOp(cp, P_COMMA); } if (Parse(cp) != P_CLOSEBRACE) Fail(cp, "'}' expected"); GetOp(cp, P_CLOSEBRACE); } break; case K_INCLUDE: { char *fn; if (Parse(cp) != P_STRING) Fail(cp, "String expected"); fn = GetString(cp); if (LoadFile(cp.name, fn) != 0) Fail(cp, "Include of file '%s' failed", fn); if (Parse(cp) != P_EOS) Fail(cp, "';' expected"); GetOp(cp, P_EOS); } break; default: Fail(cp, "Syntax error"); } break; case P_EOF: return 0; default: Fail(cp, "Syntax error"); } } } static int PreprocessConfigFile(CurPos &cp) { char *wipe = NULL; char *wipe_end = NULL; bool rem_active = false; bool string_open = false; while (cp.c < cp.z) { switch(*cp.c) { case '#': if (string_open == true) break; rem_active = true; break; case '\\': cp.c++; break; case '"': case '\'': if (rem_active == true) break; string_open = !string_open; break; case '%': if (string_open == true) break; if (rem_active == true) break; wipe = cp.c; wipe_end = NULL; if (cp.c + 8 < cp.z && strncmp(cp.c, "%define(", 8) == 0) { Word w; cp.c += 8; while (cp.c < cp.z && *cp.c != ')') { GetWord(cp, w); //printf("define '%s'\n", w); DefineWord(w); if (cp.c < cp.z && *cp.c != ',' && *cp.c != ')' ) Fail(cp, "unexpected: %c", cp.c[0]); if (cp.c < cp.z && *cp.c == ',') cp.c++; } cp.c++; /* } else if (cp.c + 6 && strcmp(cp.c, "undef(", 6) == 0) { Word w; cp.c += 6; while (cp.c < cp.z && *cp.c != ')') { GetWord(cp, w); UndefWord(w); }*/ } else if (cp.c + 4 < cp.z && strncmp(cp.c, "%if(", 4) == 0) { Word w; int wasWord = 0; cp.c += 4; while (cp.c < cp.z && *cp.c != ')') { int neg = 0; if (*cp.c == '!') { cp.c++; neg = 1; } GetWord(cp, w); if (DefinedWord(w)) wasWord = 1; if (neg) wasWord = wasWord ? 0 : 1; /*if (wasWord) printf("yes '%s'\n", w); else printf("not '%s'\n", w);*/ if (cp.c < cp.z && *cp.c != ',' && *cp.c != ')' ) Fail(cp, "unexpected: %c", cp.c[0]); if (cp.c < cp.z && *cp.c == ',') cp.c++; } cp.c++; if (!wasWord) { int nest = 1; while (cp.c < cp.z) { if (*cp.c == '\n') { cp.line++; lntotal++; } else if (*cp.c == '%') { if (cp.c + 6 < cp.z && strncmp(cp.c, "%endif", 6) == 0) { cp.c += 6; if (--nest == 0) break; } if (cp.c + 3 < cp.z && strncmp(cp.c, "%if", 3) == 0) { cp.c += 3; ++nest; } } else if (*cp.c == '#') { // we really shouldn't process hashed % directives while (cp.c < cp.z && *cp.c != '\n' ) cp.c++; // workaround to make line numbering correct cp.line++; lntotal++; } cp.c++; } } } else if (cp.c + 6 < cp.z && strncmp(cp.c, "%endif", 6) == 0) { cp.c += 6; } if (cp.c < cp.z && *cp.c != '\n' && *cp.c != '\r') Fail(cp, "syntax error %30.30s", cp.c); wipe_end = cp.c; // wipe preprocessor macros with space while (wipe < wipe_end) { *wipe++ = ' '; } break; case '\n': cp.line++; rem_active = false; string_open = false; break; default:; } cp.c++; } return 0; } static int LoadFile(const char *WhereName, const char *CfgName, int Level) { int fd, rc; char *buffer = 0; struct stat statbuf; CurPos cp; char last[MAXPATH]; char Cfg[MAXPATH]; //fprintf(stderr, "Loading file %s %s\n", WhereName, CfgName); JustDirectory(WhereName, last, sizeof(last)); if (IsFullPath(CfgName)) { strlcpy(Cfg, CfgName, sizeof(Cfg)); } else { // here we will try relative to a number of places. // 1. User's .fte directory. // 2. System's "local config" directory. // 3. /usr/share/fte (FHS compliant - from Gentoo) // 3. Initial file's directory. // 4. Current directory. // This means that a user's directory will always win out, // allowing a given user to always be able to override everything, // followed by a system standard to override anything. // #'s 1 and 2 are unix-only. #ifdef UNIX // 1. User's .fte directory. char tmp[MAXPATH]; sprintf(tmp, "~/.fte/%s", CfgName); ExpandPath(tmp, Cfg, sizeof(Cfg)); //fprintf(stderr, "Looking for %s\n", Cfg); if (!FileExists(Cfg)) { // 2. try "local config". sprintf(tmp, "%slocalconfig/%s", StartDir, CfgName); ExpandPath(tmp, Cfg, sizeof(Cfg)); //fprintf(stderr, "Looking for %s\n", Cfg); if (!FileExists(Cfg)) { // 3. /usr/share/fte sprintf(tmp, "/usr/share/fte/%s", CfgName); ExpandPath(tmp, Cfg, sizeof(Cfg)); if (!FileExists(Cfg)) { sprintf(tmp, "%sconfig/%s", StartDir, CfgName); ExpandPath(tmp, Cfg, sizeof(Cfg)); //fprintf(stderr, "Looking for %s\n", Cfg); if (!FileExists(Cfg)) { sprintf(tmp, "./%s", CfgName); ExpandPath(tmp, Cfg, sizeof(Cfg)); //fprintf(stderr, "Looking for %s\n", Cfg); if (!FileExists(Cfg)) { fprintf(stderr, "Cannot find '%s' in:\n" "\t~/.fte,\n""\t%slocalconfig,\n\t/usr/share/fte,\n" "\t%sconfig, or\n" "\t.", CfgName, StartDir, StartDir); } } } } } #else // UNIX SlashDir(last); strlcat(last, CfgName, sizeof(last)); ExpandPath(last, Cfg, sizeof(Cfg)); #endif // UNIX } // puts(Cfg); //fprintf(stderr, "Loading file %s\n", Cfg); if ((fd = open(Cfg, O_RDONLY | O_BINARY)) == -1) { fprintf(stderr, "Cannot open '%s', errno=%d\n", Cfg, errno); return -1; } if (fstat(fd, &statbuf) != 0) { close(fd); fprintf(stderr, "Cannot stat '%s', errno=%d\n", Cfg, errno); return -1; } buffer = (char *) malloc((size_t)statbuf.st_size+1); if (buffer == NULL) { close(fd); return -1; } buffer[statbuf.st_size] = 0; // add null to end of buffer, NOTE: allocated statbuf.st_size + 1 if (read(fd, buffer, (size_t)statbuf.st_size) != statbuf.st_size) { close(fd); free(buffer); return -1; } close(fd); cp.sz = statbuf.st_size; cp.a = cp.c = buffer; cp.z = cp.a + cp.sz; cp.line = 1; cp.name = Cfg; // preprocess configuration file rc = PreprocessConfigFile(cp); if (rc == -1) Fail(cp, "Preprocess failed"); if (preprocess_only == true) printf("%s", cp.a); // reset pointers cp.a = cp.c = buffer; cp.z = cp.a + cp.sz; cp.line = 1; rc = ParseConfigFile(cp); // puts("End Loading file"); if (Level == 0) PutNull(cp, CF_EOF); if (rc == -1) Fail(cp, "Parse failed"); free(buffer); return rc; } �������������������./src/g_unix_pipe.cpp�������������������������������������������������������������������������������0000644�0001750�0001750�00000007122�11605364734�013467� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "sysdep.h" #include "c_config.h" #include "console.h" #include "gui.h" #include <assert.h> #include <fcntl.h> #include <signal.h> #include <sys/wait.h> #include <stdio.h> //#include <time.h> #define MAX_PIPES 20 struct GPipe { int fd; int pid; int stopped; EModel *notify; GPipe() : fd(-1), pid(0), stopped(0), notify(NULL) {} }; static GPipe Pipes[MAX_PIPES]; /* * Returns WaitFdPipe status of event. */ WaitFdPipe WaitFdPipeEvent(TEvent *Event, int fd, int fd2, int WaitTime) { struct timeval timeout; fd_set readfds; int rc, maxfd = (fd > fd2) ? fd : fd2; Event->What = evNone; FD_ZERO(&readfds); if (fd >= 0) FD_SET(fd, &readfds); if (fd2 >= 0) FD_SET(fd2, &readfds); #ifndef NO_PIPES for (int p = 0; p < MAX_PIPES; ++p) if (Pipes[p].fd != -1) { FD_SET(Pipes[p].fd, &readfds); if (Pipes[p].fd > maxfd) maxfd = Pipes[p].fd; } #endif //printf("EVENT %d: %d %d %d\n", (int)time(NULL), fd, fd2, WaitTime); timeout.tv_sec = WaitTime / 1000; timeout.tv_usec = (WaitTime % 1000) * 1000; if ((rc = select(maxfd + 1, &readfds, 0, 0, (WaitTime < 0) ? 0 : &timeout)) <= 0) return (!rc) ? FD_PIPE_TIMEOUT : FD_PIPE_ERROR; if ((fd >= 0) && FD_ISSET(fd, &readfds)) return FD_PIPE_1; if ((fd2 >= 0) && FD_ISSET(fd2, &readfds)) return FD_PIPE_2; #ifndef NO_PIPES for (int pp = 0; pp < MAX_PIPES; ++pp) { if (Pipes[pp].fd != -1 && FD_ISSET(Pipes[pp].fd, &readfds) && Pipes[pp].notify) { Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[pp].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = pp; Pipes[pp].stopped = 0; return FD_PIPE_EVENT; } //fprintf(stderr, "Pipe %d\n", Pipes[pp].fd); } #endif return FD_PIPE_ERROR; } int GUI::OpenPipe(const char *Command, EModel * notify) { //fprintf(stderr, "PIPE %s \n", Command); #ifndef NO_PIPES for (int i = 0; i < MAX_PIPES; ++i) { if (Pipes[i].fd == -1) { int pfd[2]; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *) pfd) == -1) { perror("pipe"); return -1; } switch (Pipes[i].pid = fork()) { case -1: /* fail */ perror("fork"); return -1; case 0: /* child */ // FIXME: close other opened descriptor signal(SIGPIPE, SIG_DFL); close(pfd[0]); close(0); assert(open("/dev/null", O_RDONLY) == 0); dup2(pfd[1], 1); dup2(pfd[1], 2); close(pfd[1]); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } return i; } } #endif return -1; } int GUI::SetPipeView(int id, EModel * notify) { #ifndef NO_PIPES if (id < 0 || id >= MAX_PIPES || Pipes[id].fd == -1) return 0; Pipes[id].notify = notify; #endif return 1; } /* * returns read size value from pipe reading */ ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { #ifndef NO_PIPES if (id < 0 || id >= MAX_PIPES || Pipes[id].fd == -1) return -1; ssize_t rc; if (!(rc = read(Pipes[id].fd, buffer, len))) { close(Pipes[id].fd); Pipes[id].fd = -1; return -1; } else if (rc == -1) Pipes[id].stopped = 1; return rc; #else return -1; #endif } int GUI::ClosePipe(int id) { #ifndef NO_PIPES int status = -1; if (id < 0 || id >= MAX_PIPES || Pipes[id].fd == -1) return 0; close(Pipes[id].fd); Pipes[id].fd = -1; kill(Pipes[id].pid, SIGHUP); alarm(1); waitpid(Pipes[id].pid, &status, 0); alarm(0); return (WEXITSTATUS(status) == 0); #endif return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_simple.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000023365�11331412504�012751� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_simple.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_SIMPLE #include "c_bind.h" #include "o_buflist.h" #include "s_util.h" #include "sysdep.h" int Hilit_SIMPLE(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { EColorize *col = BF->Mode->fColorize; HMachine *hm = col->hm; HILIT_VARS(col->Colors, Line); HState *st = 0; HTrans *tr = 0; int t, cc; int quotech = 0; int matchFlags; int matchLen; int nextState; char *match; int lastPos = -1; hlState entryState; int iterCount; bool reportError = true; if (hm == 0 || hm->stateCount == 0) return 0; if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; /*{ fprintf(stderr, "ColMode:%s, State:%d\n", col->Name, State); for (int s = 0; s < hm->stateCount; s++) { fprintf(stderr, "State:%d, transCount:%d, firstTrans:%d, options:%d, color:%d, nextState:%d\n", s, hm->state[s].transCount, hm->state[s].firstTrans, hm->state[s].options, hm->state[s].color, hm->state[s].nextState); } for (int t = 0; t < hm->transCount; t++) { fprintf(stderr, "Trans:%d, matchLen:%d, matchFlags:%d, nextState:%d, color:%d\n", t, hm->trans[t].matchLen, hm->trans[t].matchFlags, hm->trans[t].nextState, hm->trans[t].color); } //exit(1); sleep(5); }*/ for (i = 0; i < Line->Count; ) { // Check for infinite loops if (i == lastPos) { if (++iterCount > hm->stateCount) { // Passed the same position more times than number of states -> must be looping if (reportError) { // Report only once per line since other errors may be false alarms caused by hiliter restart reportError = false; BF->Msg(S_INFO, "Hiliter looping at line %d, column %d, entry state %d", LN + 1, i + 1, entryState); } else { // Already reported - advance by one character Color = hm->state[entryState].color; IF_TAB() else ColorNext(); } // Restart with state 0 State = 0; st = hm->state; iterCount = 1; goto next_state; } } else { lastPos = i; entryState = State; iterCount = 1; } if (quotech) { quotech = 0; } else { for (t = 0; t < st->transCount; t++) { tr = hm->trans + st->firstTrans + t; matchLen = tr->matchLen; matchFlags = tr->matchFlags; match = tr->match; nextState = tr->nextState; //fprintf(stderr, // "line:%d, char:%d (%c), len:%d, state:%d, tr:%d, st->transCount:%d, st->firstTrans:%d, nextState:%d, matchFlags:%08x\n", // LN, i, *p, len, State, t, st->transCount, st->firstTrans, nextState, matchFlags); if (len < matchLen) continue; if ((i > 0) && (matchFlags & MATCH_MUST_BOL)) continue; if ((matchFlags & (MATCH_SET | MATCH_NOTSET)) == 0) { if (matchFlags & MATCH_REGEXP) { RxMatchRes b; if (!RxExecMatch(tr->regexp, Line->Chars, Line->Count, p, &b, (matchFlags & MATCH_NO_CASE) ? 0 : RX_CASE)) continue; if (b.Open[1] != -1 && b.Close[1] != -1) matchLen = b.Open[1] - i; else matchLen = b.Close[0] - i; } else if (matchFlags & MATCH_NO_CASE) { if (memicmp(match, p, matchLen)) continue; } else { for (cc = 0; cc < matchLen; cc++) if (p[cc] != match[cc]) goto next_trans; } } else if (matchFlags & MATCH_SET) { if (!WGETBIT(match, *p)) continue; } else if (matchFlags & MATCH_NOTSET) { if (WGETBIT(match, *p)) continue; } if ((len != matchLen) && (matchFlags & MATCH_MUST_EOL)) continue; if (matchFlags & MATCH_NOGRAB) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; //fprintf(stderr, "nograb\n"); } else { if (matchFlags & MATCH_TAGASNEXT) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; } Color = tr->color; for (cc = 0; cc < matchLen; cc++) IF_TAB() else ColorNext(); if (!(matchFlags & MATCH_TAGASNEXT)) { State = nextState; if (State >= hm->stateCount) State = 0; st = hm->state + State; } if (len > 0) { if (matchFlags & MATCH_QUOTECH) quotech = 1; } else if (len == 0) { if (matchFlags & MATCH_QUOTEEOL) goto end_parse; /* see note below !! */ } } //fprintf(stderr, "next state\n"); goto next_state; next_trans: /* */; } if (st->wordChars != 0) { int j; hlState MState = State; j = 0; while (((i + j) < Line->Count) && (WGETBIT(st->wordChars, Line->Chars[i + j]))) j++; //GP (fix) Color = st->color; if (j == 0) { if (st->nextKwdNoCharState != -1) { State = st->nextKwdNoCharState; if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; goto next_state; } } else { if (st->GetHilitWord(Color, &Line->Chars[i], j) || BF->GetHilitWord(Color, &Line->Chars[i], j, BFI( BF, BFI_MatchCase ) ? 0 : 1)) { if (st->nextKwdMatchedState != -1) State = st->nextKwdMatchedState; } else { if (st->nextKwdNotMatchedState != -1) { State = st->nextKwdNotMatchedState; if (st->options & STATE_NOGRAB) { if (State >= hm->stateCount) State = 0; st = hm->state + State; Color = st->color; goto next_state; } } } if (State >= hm->stateCount) State = 0; // highlight/tag as next state if (st->options & STATE_TAGASNEXT) { MState = State; st = hm->state + State; Color = st->color; } if (StateMap) memset(StateMap + i, MState, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; if (!(st->options & STATE_TAGASNEXT)) { st = hm->state + State; Color = st->color; } goto next_state; } } } Color = st->color; IF_TAB() else ColorNext(); next_state: /* */; } /* check if there are any matches for EOL */ /* NOTE: this is skipped when Q option is used above. !! */ for (t = 0; t < st->transCount; t++) { tr = hm->trans + st->firstTrans + t; matchLen = tr->matchLen; matchFlags = tr->matchFlags; match = tr->match; nextState = tr->nextState; if (((i > 0) && (matchFlags & MATCH_MUST_BOL)) || (matchFlags & MATCH_REGEXP)) continue; //cant match eol beyond eol. //if ((len != matchLen) && (matchFlags & MATCH_MUST_EOL)) //continue; if (matchLen == 0) { State = nextState; if (State >= hm->stateCount) State = 0; break; } } end_parse: ; *ECol = C; return 0; } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/cliputil.def����������������������������������������������������������������������������������0000644�0001750�0001750�00000000166�07045070640�012754� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NAME ClipUtil WINDOWCOMPAT DESCRIPTION 'Clipboard Utility - get/put clipboard text from command line' STACKSIZE 49152 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_nodlg.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000001467�11331412503�012560� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// used in text mode versions, should never be called (just for linking) #include "gui.h" #include <stdarg.h> #include <assert.h> #include <sys/types.h> int DLGGetFile(GView * /*v*/, const char * /*Prompt*/, unsigned int /*BufLen*/, char * /*FileName*/, int /*Flags*/) { assert(1==0); return 0; } int DLGPickChoice(GView * /*v*/, const char * /*ATitle*/, int /*NSel*/, va_list /*ap*/, int /*Flags*/) { assert(1==0); return 0; } int DLGGetFind(GView * /*View*/, SearchReplaceOptions &/*sr*/) { assert(1==0); return 0; } int DLGGetFindReplace(GView * /*View*/, SearchReplaceOptions &/*sr*/) { assert(1==0); return 0; } int DLGGetStr(GView * /*View*/, const char * /*Prompt*/, unsigned int /*BufLen*/, char * /*Str*/, int /*HistId*/, int /*Flags*/) { assert(1 == 0); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/stl_fte.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000025132�11347455325�012267� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef FTE_STL_H #define FTE_STL_H // some basic types for our C++ usage // we are replacing overbloated STL //#define CONFIG_FTE_USE_STL #ifndef CONFIG_FTE_USE_STL #include <inttypes.h> #include <sys/types.h> #include <assert.h> #define FTE_BEGIN_NAMESPACE namespace fte { #define FTE_END_NAMESPACE } #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) # define _fte_printf_attr(a,b) __attribute((__format__(__printf__,a,b))) #else # define _fte_printf_attr(a,b) #endif //#include <stdio.h> FTE_BEGIN_NAMESPACE; /** * Simple class for storing SmartPointers */ template <class T, bool ARRAY = false> class aptr { public: explicit aptr(T* p) : pointer(p) {} ~aptr() { if (ARRAY) delete [] pointer ; else delete pointer; } T& operator*() const { return *pointer; } T* operator->() const { return pointer; } private: T* pointer; }; /** * Class to be used for swapping two variable of the same type */ template <class T> inline void swap(T& a, T& b) { const T tmp = a; a = b; b = tmp; } /** * Class to be used instead of line sequence: * delete p; * p = 0; */ //template <class T> inline void destroy(T*& p) { delete p; p = 0; } /** * Simple class for storing char* * * * The main reason for existance of this class is faster compilation. * We do not need overcomplicated std::string class for our purpose. * The behaviour of implemented methods should mostly match them 1:1 */ class string { public: typedef size_t size_type; static const size_type npos = ~0U; string() : str(empty_string) {} string(const char* s); string(const char* s, size_type len); string(const string& s); string(const string& s, size_type len); ~string(); char operator[](size_type i) const { return str[i]; } char& operator[](size_type i) { return str[i]; } bool operator==(const char* s) const; bool operator==(const string& s) const { return operator==(s.str); } bool operator!=(const char* s) const { return !operator==(s); } bool operator!=(const string& s) const { return !operator==(s); } bool operator<(const string& s) const; string operator+(char c) const; string operator+(const char* s) const; string operator+(const string& s) const; string& operator=(char c); string& operator=(const char* s); string& operator=(const string& s) { return (this == &s) ? *this : operator=(s.str); } string& operator+=(char c) { return append(c); } string& operator+=(const char* s) { return append(s); } string& operator+=(const string& s) { return append(s.str); } string& append(char c); string& append(const char* s); string& append(const string& s) { return append(s.str); } char* begin() { return str; } const char* begin() const { return str; } void clear() { string tmp; swap(tmp); } const char* c_str() const { return str; } char* end() { return str + size(); } const char* end() const { return str + size(); } bool empty() const { return str[0] == 0; } size_type find(const string& s, size_type startpos = 0) const; size_type find(char c) const; size_type rfind(char c) const; void insert(size_type pos, const string& s); string& erase(size_type pos = 0, size_type n = npos); size_type size() const { return slen(str); } string substr(size_type from = 0, size_type to = npos) const { return string(str + from, to); }; void swap(string& s) { fte::swap(str, s.str); } /* string extensions */ string(char s); int sprintf(const char* fmt, ...) _fte_printf_attr(2, 3); // allocates size // it will use just 1024 bytes for non _GNU_SOURCE compilation!! string& tolower(); string& toupper(); private: char* str; static char* empty_string; static inline size_type slen(const char* s) { size_type i = 0; while (s[i]) ++i; return i; } string(const char* s1, size_type sz1, const char* s2, size_type sz2); }; template<> inline void swap(fte::string& a, fte::string& b) { a.swap(b); } /* * without this operator attempt to compare const char* with string will give quite unexpected * results because of implicit usage of operator const char*() with the right operand */ inline bool operator==(const char* s1, const string& s2) { return s2 == s1; } /** * Simple vector class * * Implemented methods behaves like std::vector */ template <class Type> class vector { public: typedef const Type* const_iterator; typedef Type* iterator; typedef const Type& const_reference; typedef Type& reference; typedef size_t size_type; static const size_type invalid = ~0U; vector<Type>() : m_begin(0), m_capacity(m_begin), m_end(m_begin) { } vector<Type>(size_type prealloc) : m_begin(prealloc ? new Type[prealloc] : 0), m_capacity(m_begin + prealloc), m_end(m_begin) { } // we will not count references - we have to program with this in mind! vector<Type>(const vector<Type>& t) : m_begin(0), m_capacity(m_begin), m_end(m_begin) { copy(t.m_begin, t.m_end, t.size()); } vector<Type>& operator=(const vector<Type>& t) { if (this != &t) { vector<Type> tmp(t); swap(tmp); } return *this; } ~vector(); const_reference operator[](size_type i) const { return m_begin[i]; } reference operator[](size_type i) { return m_begin[i]; } const_iterator begin() const { return m_begin; } iterator begin() { return m_begin; } const_reference front() const { return m_begin[0]; } reference front() { return m_begin[0]; } const_iterator end() const { return m_end; } iterator end() { return m_end; } const_reference back() const { return m_end[-1]; } reference back() { return m_end[-1]; } size_type capacity() const { return m_end - m_begin; } void clear() { vector<Type> tmp; swap(tmp); } bool empty() const { return (m_begin == m_end); } iterator erase(iterator pos) { return erase(pos, pos + 1); } iterator erase(iterator first, iterator last); iterator insert(iterator pos, const Type& t) { const size_type n = pos - m_begin; insert(pos, &t, &t + 1); return m_begin + n; } void insert(iterator pos, const_iterator from, const_iterator to); void pop_back() { //printf("vector pop_back %d\n", m_size); assert(m_begin != m_end); --m_end; if (size() < capacity() / 4) internal_copy(m_begin, m_end, size() * 2); } void pop_front() { assert(m_begin != m_end); --m_end; if (size() < capacity() / 4) internal_copy(m_begin + 1, m_end, size() * 2); else for (iterator it = m_begin; it != m_end; ++it) internal_swap(it[0], it[1]); } void push_back(const_reference m) { if (m_end == m_capacity) internal_copy(m_begin, m_end, capacity() * 2); *m_end++ = m; } void reserve(size_type sz) { if (sz > capacity()) internal_copy(m_begin, m_end, sz); } void resize(size_type sz) { internal_copy(m_begin, (sz < size()) ? m_begin + sz : m_end, sz); m_end = m_begin + sz; // even empty members } size_type size() const { return m_end - m_begin; } void swap(vector<Type>& v) { fte::swap(m_begin, v.m_begin); fte::swap(m_capacity, v.m_capacity); fte::swap(m_end, v.m_end); } /* vector extensions */ size_type find(const_reference t) const { for (iterator it = m_begin; it != m_end; ++it) if (t == *it) return (it - m_begin); return invalid; } void remove(const_reference t); protected: static const size_type min_capacity = 4; Type* m_begin; Type* m_capacity; Type* m_end; void copy(const_iterator first, const_iterator last, size_type alloc); void internal_copy(iterator first, iterator last, size_type alloc); void internal_swap(Type& a, Type& b) { a = b; } }; template <class Type> vector<Type>::~vector() { delete[] m_begin; } template <class Type> void vector<Type>::copy(const_iterator first, const_iterator last, size_type alloc) { assert(size() <= alloc); vector<Type> tmp((alloc < min_capacity) ? min_capacity : alloc); for (; first != last; ++tmp.m_end, ++first) *tmp.m_end = *first; swap(tmp); } template <class Type> void vector<Type>::internal_copy(iterator first, iterator last, size_type alloc) { assert(size() <= alloc); vector<Type> tmp((alloc < min_capacity) ? min_capacity : alloc); for (; first != last; ++tmp.m_end, ++first) internal_swap(*tmp.m_end, *first); swap(tmp); } template <class Type> typename vector<Type>::iterator vector<Type>::erase(iterator first, iterator last) { assert(last <= m_end); m_end -= (last - first); for (iterator it = first; it != m_end; ++last, ++it) internal_swap(*it, *last); return first; } template <class Type> void vector<Type>::insert(iterator pos, const_iterator from, const_iterator to) { size_type isz = to - from; if (!isz) return; Type* tmp; if (m_end + isz < m_capacity) tmp = m_begin; else { size_type nc = ((size() + isz > min_capacity) ? size() + isz : min_capacity) * 2; tmp = new Type[nc]; m_capacity = tmp + nc; } iterator l = m_end; m_end = tmp + size() + isz; if (l) for (iterator it = m_end; --l >= pos;) internal_swap(*--it, *l); size_type n = pos - m_begin; for (iterator it = tmp + n; from != to; ++it, ++from) *it = *from; if (tmp != m_begin) { for (size_type i = 0; i < n; ++i) internal_swap(tmp[i], m_begin[i]); delete[] m_begin; m_begin = tmp; } } template <class Type> void vector<Type>::remove(const_reference t) { iterator from = m_begin; for (iterator it = from; it != m_end; ++it) if (t != *it) { if (from != it) internal_swap(*from, *it); ++from; } m_end = from; } template <class Type> inline void swap(fte::vector<Type>& a, fte::vector<Type>& b) { a.swap(b); } /* * partial specialization for some common types * for more effective transfers in copy constructions * instead of having two copies - we allow to swap between field values * thus we can maintain vector<string> without reallocation of string with * every size change of vector<> */ template <> inline void vector<fte::string>::internal_swap(fte::string& a, fte::string& b) { a.swap(b); } #define StlString fte::string #define StlVector fte::vector FTE_END_NAMESPACE; #else #include <string> #include <vector> #define StlString std::string #define StlVector std::vector #endif // CONFIG_FTE_USE_STL #define vector_const_iterate(type, var, i) for (StlVector<type>::const_iterator i = var.begin(); i != var.end(); ++i) #define vector_iterate(type, var, i) for (StlVector<type>::iterator i = var.begin(); i != var.end(); ++i) #endif // FTE_STL_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/ftepm.def�������������������������������������������������������������������������������������0000644�0001750�0001750�00000000136�07045071304�012235� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NAME ftepm WINDOWAPI DESCRIPTION 'FTE Text Editor - Presentation Manager GUI' STACKSIZE 49152 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_modemap.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002471�11331412505�012552� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_modemap.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_MODEMAP_H #define O_MODEMAP_H #include "o_list.h" #include "c_bind.h" class EventMapView: public EList { public: char **BList; int BCount; EEventMap *EMap; void AddLine(const char *Line); void DumpKey(const char *aPrefix, EKey *Key); void DumpMap(const char *aPrefix, EKeyMap *aKeyMap); void DumpEventMap(EEventMap *aEventMap); EventMapView(int createFlags, EModel **ARoot, EEventMap *Map); virtual ~EventMapView(); void FreeView(); void ViewMap(EEventMap *Map); virtual int ExecCommand(ExCommands Command, ExState &State); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual void UpdateList(); virtual int CanActivate(int Line); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; extern EventMapView *TheEventMapView; #endif // O_MODEMAP_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_fconfig.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002074�11331412501�012522� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_fconfig.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_FCONFIG_H #define C_FCONFIG_H #define CF_STRING 1 #define CF_INT 2 #define CF_REGEXP 3 #define CF_END 100 #define CF_SUB 101 #define CF_MENU 102 #define CF_OBJECT 103 #define CF_COMMAND 104 #define CF_ITEM 105 #define CF_SUBMENU 106 #define CF_MENUSUB 107 #define CF_MODE 108 #define CF_PARENT 109 #define CF_KEYSUB 110 #define CF_KEY 111 #define CF_COLOR 112 #define CF_KEYWORD 113 #define CF_SETVAR 114 #define CF_COMPRX 115 #define CF_EVENTMAP 116 #define CF_COLORIZE 117 #define CF_ABBREV 118 #define CF_HSTATE 119 #define CF_HTRANS 120 #define CF_HWORDS 121 #define CF_SUBMENUCOND 122 #define CF_HWTYPE 123 #define CF_VARIABLE 124 #define CF_CONCAT 125 #define CF_CVSIGNRX 126 #define CF_SVNIGNRX 127 #define CF_EOF 254 #define CONFIG_ID 0x1A1D70E1 #endif // C_FCONFIG_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_color.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000011125�11344266042�012570� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_color.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_mode.h" #include "o_routine.h" #include <stdio.h> // *INDENT-OFF* ChColor MsgColor[3] = { 0x07, 0x0B, 0x04 }; /* Status line */ ChColor hcStatus_Normal = 0x30; ChColor hcStatus_Active = 0x70; ChColor hcEntry_Field = 0x07; ChColor hcEntry_Prompt = 0x0F; ChColor hcEntry_Selection = 0x2F; /* Plain */ ChColor hcPlain_Normal = 0x07; ChColor hcPlain_Background = 0x07; ChColor hcPlain_Selected = 0x30; ChColor hcPlain_Markers = 0x03; ChColor hcPlain_Found = 0x40; ChColor hcPlain_Keyword = 0x0F; #ifdef CONFIG_FOLDS ChColor hcPlain_Folds[5] = { 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }; #endif ChColor hcPlain_HilitWord = 0x0D; #ifdef CONFIG_BOOKMARKS ChColor hcPlain_Bookmark = 0x20; #endif /* LIST */ //ChColor hcList_Border = 0x03; ChColor hcList_Status = 0x70; ChColor hcList_Normal = 0x07; ChColor hcList_Selected = 0x1F; ChColor hcList_Hilited = 0x0F; ChColor hcList_HilitSelect = 0x1F; ChColor hcList_Marked = 0xB0; ChColor hcList_MarkSelect = 0x1B; ChColor hcList_MarkHilit = 0xB1; ChColor hcList_MarkHilitSel = 0x1B; ChColor hcScrollBar_Arrows = 0x70; ChColor hcScrollBar_Back = 0x07; ChColor hcScrollBar_Fore = 0x07; ChColor hcAsciiChars = 0x07; ChColor hcMenu_Background = 0x70; ChColor hcMenu_ActiveItem = 0x1F; ChColor hcMenu_ActiveChar = 0x1C; ChColor hcMenu_NormalItem = 0x70; ChColor hcMenu_NormalChar = 0x74; ChColor hcChoice_Title = 0x1F; ChColor hcChoice_Param = 0x1B; ChColor hcChoice_Background = 0x17; ChColor hcChoice_ActiveItem = 0x20; ChColor hcChoice_ActiveChar = 0x2F; ChColor hcChoice_NormalItem = 0x1F; ChColor hcChoice_NormalChar = 0x1E; static const struct { const char* Name; ChColor* C; } Colors[] = { { "Status.Normal", &hcStatus_Normal }, { "Status.Active", &hcStatus_Active }, { "Message.Normal", &MsgColor[0] }, { "Message.Bold", &MsgColor[1] }, { "Message.Error", &MsgColor[2] }, { "Entry.Field", &hcEntry_Field }, { "Entry.Prompt", &hcEntry_Prompt }, { "Entry.Selection", &hcEntry_Selection }, { "LIST.Status", &hcList_Status }, { "LIST.Normal", &hcList_Normal }, { "LIST.Selected", &hcList_Selected }, { "LIST.Hilited", &hcList_Hilited }, { "LIST.HilitSelect", &hcList_HilitSelect }, { "LIST.Marked", &hcList_Marked }, { "LIST.MarkSelect", &hcList_MarkSelect }, { "LIST.MarkHilit", &hcList_MarkHilit }, { "LIST.MarkHilitSel", &hcList_MarkHilitSel }, { "PLAIN.Normal", &hcPlain_Normal }, { "PLAIN.Background", &hcPlain_Background }, { "PLAIN.Selected", &hcPlain_Selected }, { "PLAIN.Markers", &hcPlain_Markers }, { "PLAIN.Found", &hcPlain_Found }, { "PLAIN.Keyword", &hcPlain_Keyword }, #ifdef CONFIG_FOLDS { "PLAIN.Folds", &hcPlain_Folds[0] }, // added some backwards compatibility { "PLAIN.Folds0", &hcPlain_Folds[0] }, { "PLAIN.Folds1", &hcPlain_Folds[1] }, { "PLAIN.Folds2", &hcPlain_Folds[2] }, { "PLAIN.Folds3", &hcPlain_Folds[3] }, { "PLAIN.Folds4", &hcPlain_Folds[4] }, #endif { "PLAIN.HilitWord", &hcPlain_HilitWord }, #ifdef CONFIG_BOOKMARKS { "PLAIN.Bookmark", &hcPlain_Bookmark }, #endif { "ScrollBar.Arrows", &hcScrollBar_Arrows }, { "ScrollBar.Back", &hcScrollBar_Back }, { "ScrollBar.Fore", &hcScrollBar_Fore }, { "ASCII.Chars", &hcAsciiChars }, { "Menu.Background", &hcMenu_Background }, { "Menu.ActiveItem", &hcMenu_ActiveItem }, { "Menu.ActiveChar", &hcMenu_ActiveChar }, { "Menu.NormalItem", &hcMenu_NormalItem }, { "Menu.NormalChar", &hcMenu_NormalChar }, { "Choice.Title", &hcChoice_Title }, { "Choice.Param", &hcChoice_Param }, { "Choice.Background", &hcChoice_Background }, { "Choice.ActiveItem", &hcChoice_ActiveItem }, { "Choice.ActiveChar", &hcChoice_ActiveChar }, { "Choice.NormalItem", &hcChoice_NormalItem }, { "Choice.NormalChar", &hcChoice_NormalChar }, }; // *INDENT-ON* int SetColor(const char *ColorV, const char *Value) { unsigned int ColBg, ColFg; if (sscanf(Value, "%1X %1X", &ColFg, &ColBg) != 2) return 0; ChColor C = ChColor(ColFg | (ColBg << 4)); for (size_t i = 0; i < FTE_ARRAY_SIZE(Colors); ++i) { if (strcmp(ColorV, Colors[i].Name) == 0) { *Colors[i].C = C; return 1; } } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/pm_tool.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000001263�11331412505�012261� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PM_TOOL_H #define PM_TOOL_H #define tiBITMAP 1 #define tiSEPARATOR 2 #define tfDISABLED 1 #define tfDEPRESSED 0x8000 #define WC_MTOOLBAR "MToolBar" struct ToolBarItem { ULONG ulType; ULONG ulId; ULONG ulCommand; ULONG ulFlags; HBITMAP hBitmap; }; struct ToolBarData { USHORT cb; LONG ulCount; ToolBarItem *pItems; LONG ulDepressed; }; MRESULT EXPENTRY ToolBarProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); void RegisterToolBarClass(HAB hab); HWND CreateToolBar(HWND parent, HWND owner, ULONG id, ULONG count, ToolBarItem *items); #endif // PM_TOOL_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_i18n.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000026142�11344266043�012574� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * con_i18n.cpp * * Copyright (c) 1998, Zdenek Kabelac * * I18N support by zdenek.kabelac@gmail.com * * written as plain 'C' module and might be used * in other programs to implement I18N support */ #include "fte.h" #include "con_i18n.h" #include <X11/Xlocale.h> #include <X11/Xutil.h> #include <X11/keysym.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> /* * For now the only supported input style is root !!! * in future this should be read from resources */ #define XIM_INPUT_STYLE "Root" #define KEYMASK 0xff #define KEYBYTEMAX 0xf00 struct i18n_context_t { XIC xic; #if XlibSpecificationRelease >= 6 XIM xim; XIMStyles* xim_styles; XIMStyle input_style; #endif }; #ifdef CONFIG_HARD_REMAP /* * This part is used when your Xserver doesn't work well with XKB extension */ /* Keyboard definition file - currently only Czech national keyboard * write your own keyboard for your language * And remember - this is supposed to be used only if your Xserver * is not supporting keyboard extension */ #include "con_ikcz.h" /* * Quite a complex function to convert normal keys * to dead-keys and remapped keys */ static int i18n_key_analyze(XKeyEvent * keyEvent, KeySym * key, char *keyName, int nbytes) { static long prev_state = 0, local_switch = 0, keypos = 0, last_keypos = 0, remap = 0; long i; struct keyboardRec *kbdActual; /* Find the state of keyboard * Check for different ISO group or modifier 5 * So to activate remaping, you need to press at least * ScrollLock which is usually mapped as modifier 5 */ i = ((keyEvent->state | local_switch) & 0xFFA0); if (i != prev_state) { /* reset table position */ last_keypos = keypos = 0; prev_state = i; } if (keyEvent->type == KeyPress) { if (i && ((*key == XK_Pause) || (*key == XK_F21))) { remap = !remap; return 0; } else if (*key == XK_F23) { local_switch ^= (1UL<< 12); return 0; } } /* * Check for already remapped ISO8859-X keys * this should not normaly happen :-) * as we need to use this hack */ if ((*key > KEYMASK) && (*key < KEYBYTEMAX) || (*key > 0xffffff00)) { *key &= KEYMASK; keyName[0] = (char) *key; return 1; } /* Select keyboard map */ if (!i) kbdActual = nationalKey[0]; else if (!remap) kbdActual = nationalKey[1]; else kbdActual = nationalKey[2]; if (keyEvent->type == KeyPress) { long i = last_keypos; /* * Search for DeadKey -> do loop over all tables. * * Note: We can define ONE DeadKey and use * it for several tables sequentially */ for (;;) { i++; if ((kbdActual[0].tab == NULL) || kbdActual[i].tab == NULL) { i = 0; if (kbdActual[i].tab == NULL) { /* Looks like empty table -> IGNORE */ keypos = i; return nbytes; } } if (i == last_keypos) break; if (kbdActual[i].deadkey == *key) { keypos = kbdActual[i].next; /* Found DeadKey -> delete it * and mark actual position for next search */ last_keypos = i; keyName[0] = *key = 0; return 0; } } } else if (keypos) return 0; /* ignore key release */ /* Now we know it is not a DeadKey and we * are in selected remaping keyboard table */ /* printf("** key:%5d\tstatus:0x%x\n", *key, prev_state); */ if (*key < KEYBYTEMAX) { /* * this is selected constant and will change when * this editor will be able to write in japan :-) */ int i = 0; /* remaping only real keys */ while (kbdActual[keypos].tab[i].key_english != 0) { if (*key == kbdActual[keypos].tab[i].key_english) { *key = kbdActual[keypos].tab[i].key_remap; break; } i++; } last_keypos = keypos = kbdActual[keypos].next; /* printf("** remap: %3d %3d\n", keypos, *key); */ keyName[0] = *key && KEYMASK; return 1; } return 0; } #else /********************************************* * * * Standart methods for reading Keyboard * * * *********************************************/ /* ISO-8859-2 key-change * All these functions are for keyboard reading. * Correct displaing of this text is another thing, * but as I only need ISO-8859 encoding support, * I don't care about this (for now). */ static int i18n_key_analyze(XKeyEvent * /*keyEvent*/, KeySym * key, char *keyName, int nbytes) { KeySym t = (unsigned char) keyName[0]; /* * ISO-8859-2 is using some characters from 8859-1 and * rest of them is located between 0x100 - 0x200 in 'X' so * with ISO-8859-2 font we'll remap them down bellow < 0x100 * This is mostly true for all Latin-X alphas, just * special font to display them correctly is needed. * This jobs does Xserver - and keysymbol is returned * in the 1st. byte of keyName string. */ if ((nbytes == 1) && *key < KEYBYTEMAX) *key = t; #ifdef USE_HACK_FOR_BAD_XSERVER /* * this is really hack - but some Xservers are somewhat * strange, so we remap character manually */ else if (!nbytes && (*key > KEYMASK) && (*key < KEYBYTEMAX)) { *key &= KEYMASK; keyName[0] = *key & KEYMASK; nbytes = 1; } #endif return nbytes; } #endif /* * Initialize I18N functions - took me hours to * figure out how this works even though it was * cut & pasted from 'xterm' sources, but as 'xterm' * is using Xt Toolkit some things have to be made * different */ i18n_context_t* i18n_open(Display* display, Window win, unsigned long* mask) { *mask = 0; #if XlibSpecificationRelease >= 6 char *s, tmp[256]; int found = False; i18n_context_t* ctx = (i18n_context_t*) malloc(sizeof(i18n_context_t)); if (!ctx) { fprintf(stderr, "I18N warning: Allocation of I18N context failed\n"); return 0; } memset(ctx, 0, sizeof(i18n_context_t)); /* Locale setting taken from XtSetLanguageProc */ if (!(s = setlocale(LC_ALL, ""))) fprintf(stderr, "I18N warning: Locale not supported by C library, " "locale unchanged!\n"); if (!XSupportsLocale()) { fprintf(stderr, "I18N warning: Locale not supported by Xlib, " "locale set to C!\n"); s = setlocale(LC_ALL, "C"); } if (!XSetLocaleModifiers("")) fprintf(stderr, "I18N warning: X locale modifiers not supported, " "using default\n"); ctx->xim = XOpenIM(display, NULL, NULL, NULL); if (ctx->xim == NULL) { // there are languages without Input Methods ???? fprintf(stderr, "I18N warning: Input method not specified\n"); i18n_destroy(&ctx); return NULL; } if (XGetIMValues(ctx->xim, XNQueryInputStyle, &ctx->xim_styles, NULL) || ctx->xim_styles == NULL) { fprintf(stderr, "I18N error: Input method doesn't support any style\n"); i18n_destroy(&ctx); return NULL; } /* * This is some kind of debugging message to inform user * that something is wrong with his system */ if (s != NULL && (strstr(s, XLocaleOfIM(ctx->xim)) == NULL)) fprintf(stderr, "I18N warning: System locale: \"%s\" differs from " "IM locale: \"%s\"...\n", s, XLocaleOfIM(ctx->xim)); /* * This part is cut&paste from other sources * There is no reason to do it this way, because * the only input style currently supported is Root * but for the future extension I'll leave it here */ strcpy(tmp, XIM_INPUT_STYLE); for (s = tmp; s && !found;) { char *ns, *end; int i; while ((*s != 0) && isspace(*s)) s++; if (*s == 0) break; if ((ns = end = strchr(s, ',')) != 0) ns++; else end = s + strlen(s); while (isspace(*end)) end--; *end = '\0'; if (!strcmp(s, "OverTheSpot")) ctx->input_style = (XIMPreeditPosition | XIMStatusArea); else if (!strcmp(s, "OffTheSpot")) ctx->input_style = (XIMPreeditArea | XIMStatusArea); else if (!strcmp(s, "Root")) ctx->input_style = (XIMPreeditNothing | XIMStatusNothing); for (i = 0; (unsigned short) i < ctx->xim_styles->count_styles; i++) if (ctx->input_style == ctx->xim_styles->supported_styles[i]) //if (ctx->xim_styles->supported_styles[i] & (XIMPreeditNothing | XIMPreeditNone) && // ctx->xim_styles->supported_styles[i] & (XIMStatusNothing | XIMStatusNone)) { found = True; /* do not modify this! * unless consulted with kabi@users.sf.net */ //ctx->input_style = ctx->xim_styles->supported_styles[i]; break; } s = ns; } XFree(ctx->xim_styles); if (!found) { fprintf(stderr, "I18N error: Input method doesn't support my " "preedit type\n"); i18n_destroy(&ctx); return NULL; } /* This program only understand the Root preedit_style yet */ if (ctx->input_style != (XIMPreeditNothing | XIMStatusNothing)) { fprintf(stderr, "I18N error: This program only supports the " "'Root' preedit type\n"); i18n_destroy(&ctx); return NULL; } ctx->xic = XCreateIC(ctx->xim, XNInputStyle, ctx->input_style, XNClientWindow, win, XNFocusWindow, win, NULL); if (ctx->xic == NULL) { fprintf(stderr, "I18N error: Failed to create input context\n"); i18n_destroy(&ctx); } else if (XGetICValues(ctx->xic, XNFilterEvents, mask, NULL)) fprintf(stderr, "I18N error: Can't get Event Mask\n"); return ctx; #else return NULL; #endif } void i18n_destroy(i18n_context_t** ctx) { if (ctx && *ctx) { if ((*ctx)->xic) XDestroyIC((*ctx)->xic); if ((*ctx)->xim) XCloseIM((*ctx)->xim); free(*ctx); *ctx = NULL; } } void i18n_focus_in(i18n_context_t* ctx) { #if XlibSpecificationRelease >= 6 if (ctx && ctx->xic != NULL) XSetICFocus(ctx->xic); #endif } void i18n_focus_out(i18n_context_t* ctx) { #if XlibSpecificationRelease >= 6 if (ctx && ctx->xic != NULL) XUnsetICFocus(ctx->xic); #endif } /* * Lookup correct keysymbol from keymap event */ int i18n_lookup_sym(i18n_context_t* ctx, XKeyEvent * keyEvent, char *keyName, int keySize, KeySym * key) { static int showKeys = 0; int nbytes = 0; #if XlibSpecificationRelease >= 6 if (ctx && ctx->xic != NULL) { if (keyEvent->type == KeyPress) { Status status_return; /* No KeyRelease events here ! */ #if 1 nbytes = XmbLookupString(ctx->xic, keyEvent, keyName, keySize, key, &status_return); #else wchar_t wk; nbytes = XwcLookupString(ctx->xic, keyEvent, &wk, 1, key, &status_return); printf("code=%0X\n", wk); keySize = 1; keyName[0] = (char)wk; #endif } } else #endif do { static XComposeStatus compose_status = { NULL, 0 }; nbytes = XLookupString(keyEvent, keyName, keySize, key, &compose_status); } while (0); if (showKeys) { fprintf(stderr, "Key: 0x%04lx '%s'\tKeyEventState:0x%x\t", *key, XKeysymToString(*key), keyEvent->state); if (nbytes && isprint(keyName[0])) { keyName[nbytes] = 0; fprintf(stderr, "String:'%s' Size:%2d ", keyName, nbytes); } fputs("\n", stderr); } if (((*key == XK_F1) || (*key == XK_F11)) && ((keyEvent->state & (ShiftMask | ControlMask)) == (ShiftMask | ControlMask)) && (keyEvent->type == KeyPress)) showKeys = !showKeys; return i18n_key_analyze(keyEvent, key, keyName, nbytes); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/port.h����������������������������������������������������������������������������������������0000644�0001750�0001750�00000017601�11333110354�011576� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef PORT_PORT_H #define PORT_PORT_H #ifdef __cplusplus extern "C" { #endif #ifndef ULONG # define ULONG unsigned long #endif #ifndef UWORD # define UWORD unsigned short #endif #ifndef UBYTE # define UBYTE unsigned char #endif #ifndef boolean # define boolean int #endif #ifndef FALSE # define FALSE 0 #endif #ifndef TRUE # define TRUE 1 #endif /*--------------------------------------------------------------------------*/ /* STRUCTURES: dosxEreg is a union containing all extended registers.. */ /*--------------------------------------------------------------------------*/ #if defined(__32BIT__) #define PORT_FILLER(a) unsigned short a; #else #define PORT_FILLER(a) #endif struct dosxEreg { unsigned long eax, ebx, ecx, edx, ebp, esi, edi; unsigned short ds, es, fs, gs; unsigned long flags; }; struct dosxBreg { unsigned char al, ah; PORT_FILLER(_1) unsigned char bl, bh; PORT_FILLER(_2) unsigned char cl, ch; PORT_FILLER(_3) unsigned char dl, dh; PORT_FILLER(_4) }; struct dosxWreg { unsigned short ax; PORT_FILLER(_1) unsigned short bx; PORT_FILLER(_2) unsigned short cx; PORT_FILLER(_3) unsigned short dx; PORT_FILLER(_4) unsigned short bp; PORT_FILLER(_5) unsigned short si; PORT_FILLER(_6) unsigned short di; PORT_FILLER(_7) unsigned short ds; unsigned short es; unsigned short fs; unsigned short gs; unsigned long flags; }; /*--------------------------------------------------------------------------*/ /* STRUCTURES: dosxReg contains all usable registers. */ /*--------------------------------------------------------------------------*/ union dosxReg { struct dosxBreg h; struct dosxWreg w; struct dosxEreg x; }; /*--------------------------------------------------------------------------*/ /* DEFINES: PLRF_* defines are the processor flags. */ /*--------------------------------------------------------------------------*/ #define PLCPUF_C 0x0001 // Carry flag #define PLCPUF_P 0x0004 // Parity #define PLCPUF_A 0x0010 // Auxiliary carry #define PLCPUF_Z 0x0040 // Zero flag, #define PLCPUF_S 0x0080 // Sign flag #define PLCPUF_T 0x0100 // Trace flag #define PLCPUF_I 0x0200 // Interrupt #define PLCPUF_D 0x0400 // Direction #define PLCPUF_O 0x0800 // Overflow. /*--------------------------------------------------------------------------*/ /* DEFINES: plFnsplit() defines. */ /*--------------------------------------------------------------------------*/ #define PL_WILDCARDS 0x01 #define PL_EXTENSION 0x02 #define PL_FILENAME 0x04 #define PL_DIRECTORY 0x08 #define PL_DRIVE 0x10 /*--------------------------------------------------------------------------*/ /* DEFINES: File attributes. */ /*--------------------------------------------------------------------------*/ #define PLFA_NORMAL 0x00 /* Normal file, no attributes */ #define PLFA_RDONLY 0x01 /* Read only attribute */ #define PLFA_HIDDEN 0x02 /* Hidden file */ #define PLFA_SYSTEM 0x04 /* System file */ #define PLFA_LABEL 0x08 /* Volume label */ #define PLFA_DIREC 0x10 /* Directory */ #define PLFA_ARCH 0x20 /* Archive */ /*--------------------------------------------------------------------------*/ /* STRUCTURES: plFTime holds date/time for a file (plGetftime()). */ /*--------------------------------------------------------------------------*/ struct plFTime { unsigned ft_tsec : 5; // Two second interval unsigned ft_min : 6; // Minute unsigned ft_hour : 5; // Hour unsigned ft_day : 5; // Day unsigned ft_month : 4; // Month unsigned ft_year : 7; // Year }; /*--------------------------------------------------------------------------*/ /* STRUCTURES: plDFree holds "disk free space" info for plGetdfree(). */ /*--------------------------------------------------------------------------*/ struct plDFree { unsigned df_avail; unsigned df_total; unsigned df_bsec; unsigned df_sclus; }; /*--------------------------------------------------------------------------*/ /* DEFINES: plLocking() mode flags... */ /*--------------------------------------------------------------------------*/ #define PL_LK_UNLCK 0 // unlock the file region #define PL_LK_LOCK 1 // lock the file region #define PL_LK_NBLCK 2 // non-blocking lock #define PL_LK_RLCK 3 // lock for writing #define PL_LK_NBRLCK 4 // non-blocking lock for writing //** Hardware interface: DOS & extended DOS only!! void dosxIntr(int inr, union dosxReg* r); void dosxMemRead(void* dest, ULONG ra, unsigned nbytes); void dosxMemWrite(ULONG ra, void* src, unsigned nbytes); void dosxPMemRead(void* dest, ULONG pa, unsigned nbytes); void dosxPMemWrite(ULONG pa, void* src, unsigned nbytes); void dosxDisable(void); void dosxEnable(void); //** Disk stuff.. int plGetdisk(void); int plSetdisk(int dnr); int plGetcurdir(int drive, char *dir); //** Misc.. char *plSearchpath(char *name); int plFnsplit(const char *pathp, char *drivep, char *dirp, char *namep, char *extp); void plFnmerge(char *out, char *drive, char *dir, char *name, char *ext); /****************************************************************************/ /* */ /* Hardware portability calls. */ /* */ /****************************************************************************/ //** Mouse calls //** =========== boolean MOUSInit(void); void MOUSExit(void); void MOUSCursen(boolean enable); void MOUSPos(UWORD *x, UWORD *y, boolean *leftbutton, boolean *rightbutton); void MOUSSetpos(UWORD x, UWORD y); void MOUSSetTextCursor(UWORD screenmask, UWORD cursormask); void MOUSSaveCurs(void); void MOUSRestCurs(void); boolean MOUSIsPresent(void); ULONG MOUSPressCount(void); //** Timer calls //** =========== int plTiAlloc(unsigned long cnt); void plTiSet(int t, unsigned long cnt); void plTiFree(int t); unsigned long plTiQValue(int t); //** Thread/task based. //** ================== void plDelay(unsigned int msecs); unsigned long plTmGet(void); // Avoid using this. void plCpuRelease(void); //** Thread interface! //** ================= int plThrdStart(void (*exfn)(void*), unsigned long stksz, void* args); //** FTE specific. int fnmatch(char* pat, char* in, int vv); #ifdef DOSP32 /*--------------------------------------------------------------------------*/ /* ENUM: ePlScnType defines a screen type. */ /*--------------------------------------------------------------------------*/ enum ePlScnType { plsctUnknown, plsctMono, // Monochrome adapter / unknown type, plsctCGA, // Color graphics adapter plsctEGA, // EGA adapter, plsctVGA, // VGA adapter, plsctLast }; //** Informational functions, enum ePlScnType plScnType(void); boolean plScnIsMono(void); int plScnWidth(void); int plScnHeight(void); void plScnCursorShapeGet(int* sp, int* ep); void plScnCursorPosGet(int* xp, int* yp); //** Change parameters e.a. void plScnSetFlash(boolean on); void plScnCursorOn(boolean on); void plScnCursorShape(int start, int end); void plScnCursorPos(int x, int y); //** Writing the screen. void plScnWrite(unsigned x, unsigned y, unsigned short* buf, unsigned nch); void plScnRead(unsigned x, unsigned y, unsigned short* buf, unsigned nch); void plScnSetCell(unsigned x, unsigned y, unsigned wid, unsigned hig, UWORD cell); void plScnScrollDown(int x, int y, int ex, int ey, int nlines, UWORD fill); void plScnScrollUp(int x, int y, int ex, int ey, int nlines, UWORD fill); /****************************************************************************/ /* */ /* Keyboard interface.. */ /* */ /****************************************************************************/ struct plKbdInfo { UBYTE ki_scan; UBYTE ki_ascii; ULONG ki_flags; // PLKF_ defines, above; }; #define PLKF_SHIFT 0x0001 #define PLKF_CTRL 0x0002 #define PLKF_ALT 0x0004 #define PLKF_SCROLLLOCK 0x0008 #define PLKF_NUMLOCK 0x0010 #define PLKF_CAPSLOCK 0x0020 boolean plKbdReadF(struct plKbdInfo* ki); #endif // DOSP32 #ifdef __cplusplus }; #endif #endif // PORT_PORT_H �������������������������������������������������������������������������������������������������������������������������������./src/icons/����������������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�11621703711�011554� 5����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/icons/fte48x48.xpm����������������������������������������������������������������������������0000644�0001750�0001750�00000006532�11323117515�013606� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * const fte48x48_xpm[] = { "48 48 45 1", ". c None", "+ c #150000", "@ c #2A0000", "# c #6A0000", "$ c #D40000", "% c #800000", "& c #FF0000", "* c #A00000", "= c #350000", "- c #0B0000", "; c #F40000", "> c #EA0000", ", c #B50000", "' c #6B0000", ") c #CA0000", "! c #950000", "~ c #8B0000", "{ c #C00000", "] c #750000", "^ c #4B0000", "/ c #400000", "( c #DF0000", "_ c #8A0000", ": c #7F0000", "< c #120000", "[ c #040000", "} c #590000", "| c #7C0000", "1 c #6E0000", "2 c #270000", "3 c #D80000", "4 c #3C0000", "5 c #E60000", "6 c #830000", "7 c #ED0000", "8 c #A70000", "9 c #600000", "0 c #230000", "a c #070000", "b c #FB0000", "c c #B10000", "d c #200000", "e c #920000", "f c #840000", "g c #9F0000", "................................................", "...+@@@@@@@@@@@+................................", "...#$$$$$$$$$$$#................................", "...%&&&&&&&&&&&*=-..............................", "...%&&;>>>>>>>>,'+..............................", "...%&&)!!!!!!!!~'+..............................", "...%&&{]^///////=-..............................", "...%&&{'+.......................................", "...%&&{'+.......................................", "...%&&(,_:::/...................................", "...%&&&&&&&&_<[.................................", "...%&&&&&&&&,}<.................................", "...%&&({{{{{*'+.................................", "...%&&{|1''''}<.................................", "...%&&{12++++<[.................................", "...%&&{'+....../::::::::::::::/.................", "...%&&{'+......%&&&&&&&&&&&&&&_<[...............", "...%&&{'+......%&&&&&&&&&&&&&&,}<...............", "...%&&{'+....../_,{{{(&&({{{{{*'+...............", "...%&&{'+.......<}''',&&{|1''''}<...............", "...%&&{'+.......[<+++_&&{12++++<[...............", ".../_,*'+............%&&{'+.....................", "....<}'}<............%&&{'+.....................", "....[<+<[............%&&{'+.....................", ".....................%&&{'+.....................", ".....................%&&{'+.....................", ".....................%&&{'+.....................", ".....................%&&{'+....+#::::::::::#+...", ".....................%&&{'+....@$&&&&&&&&&&34-..", ".....................%&&{'+....@$&&&&&&&&&&56=..", ".....................%&&{'+....@$&;){{{{{{{,~/..", ".....................%&&{'+....@$&>!]''''''''=..", ".....................%&&{'+....@$&>!^++++++++-..", "...................../_,*'+....@$&>!/...........", "......................<}'}<....@$&789@@@0a......", "......................[<+<[....@$&b7($$$c0......", "...............................@$&&&&&&&(9d.....", "...............................@$&b7>>>>3e/.....", "...............................@$&78!!!!ef/.....", "...............................@$&>!9/////d.....", "...............................@$&>!/...........", "...............................@$&>!/...........", "...............................@$&;)g::::::#+...", "...............................@$&&&&&&&&&&34-..", "...............................@$&&&&&&&&&&56=..", "...............................+#*{{{{{{{{{,~/..", ".................................='''''''''''=..", ".................................-+++++++++++-.."}; ����������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/icons/ftepm.ico�������������������������������������������������������������������������������0000644�0001750�0001750�00000006420�07172436241�013374� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BA(���x�������CI�����à�� ��� �@������ÿÿÿCI�����à�� ��� � ������€���€�€€���€€�€�€€€€€ÌÌÌÿ���ÿ�ÿÿ���ÿÿ�ÿ�ÿÿÿÿÿBA(���ð�������CI�����à�� ���� ������ÿÿÿCI�����`�� ����������€���€�€€���€€�€�€€€€€ÌÌÌÿ���ÿ�ÿÿ���ÿÿ�ÿ�ÿÿÿÿÿBA(���h����CI�����à�� ���(�P������ÿÿÿCI�����`�� ���(�(������€���€�€€���€€�€�€€€€€ÌÌÌÿ���ÿ�ÿÿ���ÿÿ�ÿ�ÿÿÿÿÿBA(���������CI��� � �€ �� ����(������ÿÿÿCI��� � � �� ����������€���€�€€���€€�€�€€€€€ÌÌÌÿ���ÿ�ÿÿ���ÿÿ�ÿ�ÿÿÿÿÿ��������������������������������������������������������������������������������������������������������������������������������ÿÿÿÿÿÿüÿÿøÿÿøÿÿøÿÿÿøÿÿÿøÿÿøÿÿøÿþxÿÿüxÿÿüxÿüxÿüxÿüÿÿüÿÿüÿçüÿÇüÿÇàÿÇÀÿÇÀÿÇÿÿÿÀÿÿÀÿÿÀÿÿÿÇÿÿÿÇÿÿÿÀÿÿÀÿÿÀ?ÿÿÿÿÿÿ���������������������������DDDD����������� ÌÌÌÄ����������� ÌÌÌÀ����������� Ä�������������� Ä�������������� ÄDD������������ ÌÌÄ������������ ÌÌÀ���������@� Ä�����������Ì@� Ä�����������Ì@� ÄDDD��������Ì@� ÌÌÌÄ��������Ì@� ÌÌÌÀ��������Ì@��������������Ì@��������������Ì@��������@����Ì@��������Ì@����Ì@��������Ì@��DÌDD@������Ì@��ÌÌÌÌÌ@������Ì@��ÌÌÌÌÌ�������Ì@��������������ÌDD@������������ÌÌÌ@������������ÌÌÌ�������������Ì@��������������Ì@��������������ÌDDD@�����������ÌÌÌÌ@�����������ÌÌÌÌ�������������������������������������������������������������������������������������������ÿÿ��ÿá��ÿï��ÿï��ÿã��þï��þá��þÿ��þÿ��¾ÿ��¸?��¿ÿ��ÿ��¿ÿ��‡ÿ��ÿÿ��������������� ÌÀ����� ������� ������� Ì���� � ����� � ÌÀ��� ������� ���� �� ���� � ÌÌ��� ������� Ì������ ������� ÌÀ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ÿÿÿÿÿ���ÿÿÿà���ÿÿÿÀ���ÿÿÿÀ���ÿÿÿÀ���ÿÿÿÃÿ���ÿÿÿÃÿ���ÿÿÿÃÿ���ÿÿÿÀ���ÿÿÿÀ���ÿÿÿÀ?���ÿÿÇÃÿ���ÿÿ‡Ãÿ���ÿÿ‡Ãÿ���ÿÿ‡À���ÿÿ‡À���ÿÿ‡À���ÿÿ‡À���ÿÿ‡ÿÿ���ÿÿ‡ÿÿ���ÿÿ‡ÿÿ���ÿÿ‡ÿÿ���ãÿ‡ÿÿ���Ãÿ‡ÿÿ���Ãü�?ÿ���Ãð�?ÿ���Ãð�?ÿ���Ãð�ÿ���Ãÿÿÿÿ���Àÿÿÿ���Àÿÿÿ���Àÿÿÿ���À?ÿÿÿ���Ãÿÿÿÿ���Ãÿÿÿÿ���Àÿÿÿ���Àÿÿÿ���Àÿÿÿ���Àÿÿÿ���ÿÿÿÿÿ������������������������������������DDDD@��������������ÌÌÌÌÌ@��������������ÌÌÌÌÌ@��������������ÌÌÌÌÌ���������������ÌÄ������������������ÌÄ������������������ÌÄ������������������ÌÄDD@���������������ÌÌÌÌ@���������������ÌÌÌÌ������������D@��ÌÄ������������� Ì@��ÌÄ������������� Ì@��ÌÄ������������� Ì@��ÌÄDDD@��������� Ì@��ÌÌÌÌÌ@��������� Ì@��ÌÌÌÌÌ@��������� Ì@��ÌÌÌÌÌ���������� Ì@����������������� Ì@����������������� Ì@����������������� Ì@����������D����� Ì@����������ÌÄ����� Ì@����������ÌÄ����DLÌDDD��������ÌÄ���ÌÌÌÌÌÌÄ��������ÌÄ���ÌÌÌÌÌÌÄ��������ÌÄ���ÌÌÌÌÌÌÀ��������ÌÄ������������������ÌÄDD@���������������ÌÌÌÌ@���������������ÌÌÌÌ@���������������ÌÌÌÌ����������������ÌÄ������������������ÌÄ������������������ÌÄDDD@��������������ÌÌÌÌÌ@��������������ÌÌÌÌÌ@��������������ÌÌÌÌÌ������������������������������������������������������������������������������������������������������������������ÿÿð�ÿø0�ÿûð�ÿûð�ÿøp�ÿûð�ÿ»ð�ÿ»ð�ÿ¸0�ÿ¿ð�ÿ¿ð�¿¿ð�¿¿ð�¼ð�¿ÿð�‡ÿð�¿ÿð�¿ÿð�ÿð�ÿÿð������������������� ÌÌ��������� ����������� ����������� ÌÀ��������� ��������� � ��������� � ��������� � ÌÌ������� ����������� ������� ��� ������� ��� ������� ��ÌÌÌÀ����� ����������� ÌÀ��������� ����������� ����������� ÌÌÀ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/icons/ftewin32.ico����������������������������������������������������������������������������0000644�0001750�0001750�00000004276�07374135435�013736� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ������¨�����(��� ���@���������€����������������������@���€���ÿ���� ��@ ��€ ��ÿ ���@��@@��€@��ÿ@���`��@`��€`��ÿ`���€��@€��€€��ÿ€��� ��@ ��€ ��ÿ ���À��@À��€À��ÿÀ���ÿ��@ÿ��€ÿ��ÿÿ���� �@� �€� �ÿ� �� �@ �€ �ÿ ��@ �@@ �€@ �ÿ@ ��` �@` �€` �ÿ` ��€ �@€ �€€ �ÿ€ ��  �@  �€  �ÿ  ��À �@À �€À �ÿÀ ��ÿ �@ÿ �€ÿ �ÿÿ ���@�@�@�€�@�ÿ�@�� @�@ @�€ @�ÿ @��@@�@@@�€@@�ÿ@@��`@�@`@�€`@�ÿ`@��€@�@€@�€€@�ÿ€@�� @�@ @�€ @�ÿ @��À@�@À@�€À@�ÿÀ@��ÿ@�@ÿ@�€ÿ@�ÿÿ@���`�@�`�€�`�ÿ�`�� `�@ `�€ `�ÿ `��@`�@@`�€@`�ÿ@`��``�@``�€``�ÿ``��€`�@€`�€€`�ÿ€`�� `�@ `�€ `�ÿ `��À`�@À`�€À`�ÿÀ`��ÿ`�@ÿ`�€ÿ`�ÿÿ`���€�@�€�€�€�ÿ�€�� €�@ €�€ €�ÿ €��@€�@@€�€@€�ÿ@€��`€�@`€�€`€�ÿ`€��€€�@€€�€€€�ÿ€€�� €�@ €�€ €�ÿ €��À€�@À€�€À€�ÿÀ€��ÿ€�@ÿ€�€ÿ€�ÿÿ€��� �@� �€� �ÿ� ��  �@  �€  �ÿ  ��@ �@@ �€@ �ÿ@ ��` �@` �€` �ÿ` ��€ �@€ �€€ �ÿ€ ��  �@  �€  �ÿ  ��À �@À �€À �ÿÀ ��ÿ �@ÿ �€ÿ �ÿÿ ���À�@�À�€�À�ÿ�À�� À�@ À�€ À�ÿ À��@À�@@À�€@À�ÿ@À��`À�@`À�€`À�ÿ`À��€À�@€À�€€À�ÿ€À�� À�@ À�€ À�ÿ À��ÀÀ�@ÀÀ�€ÀÀ�ÿÀÀ��ÿÀ�@ÿÀ�€ÿÀ�ÿÿÀ���ÿ�@�ÿ�€�ÿ�ÿ�ÿ�� ÿ�@ ÿ�€ ÿ�ÿ ÿ��@ÿ�@@ÿ�€@ÿ�ÿ@ÿ��`ÿ�@`ÿ�€`ÿ�ÿ`ÿ��€ÿ�@€ÿ�€€ÿ�ÿ€ÿ�� ÿ�@ ÿ�€ ÿ�ÿ ÿ��Àÿ�@Àÿ�€Àÿ�ÿÀÿ��ÿÿ�@ÿÿ�€ÿÿ�ÿÿÿ��������������������������������������������������������������������������������������àààààààà������������������������àààààààà������������������������àà������������������������������àà������������������������������àà������������������������������àààààà��������������������������àààààà��������������������������àà�����������������������àà�����àà�����������������������àà�����àà�����������������������àà�����àààààààà�����������������àà�����àààààààà�����������������àà������������������������������àà������������������������������àà������������������������������àà������������������àà����������àà������������������àà����������àà������������������àà������àààààààààà��������������àà������àààààààààà��������������àà������������������������������àà������������������������������àààààà��������������������������àààààà��������������������������àà������������������������������àà������������������������������àà������������������������������àààààààà������������������������àààààààà������������������������������������������������������ÿÿÿÿÿÿüÿÿøÿÿøÿÿøÿÿÿøÿÿÿøÿÿøÿÿøÿþxÿÿüxÿÿüxÿüxÿüxÿüÿÿüÿÿüÿçüÿÇüÿÇàÿÇÀÿÇÀÿÇÿÿÿÀÿÿÀÿÿÀÿÿÿÇÿÿÿÇÿÿÿÀÿÿÀÿÿÀ?ÿÿÿÿÿÿ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/icons/fte64x64.xpm����������������������������������������������������������������������������0000644�0001750�0001750�00000010755�11323117515�013604� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * const fte64x64_xpm[] = { "64 64 9 1", ". c None", "+ c #400000", "@ c #800000", "# c #FF0000", "$ c #A00000", "% c #200000", "& c #C00000", "* c #DF0000", "= c #600000", "................................................................", "................................................................", "....+@@@@@@@@@@@@@@@+...........................................", "....@###############@...........................................", "....@###############$+%.........................................", "....@###############&@+.........................................", "....@###*&&&&&&&&&&&$@+.........................................", "....@###&@@@@@@@@@@@@@+.........................................", "....@###&@=+++++++++++%.........................................", "....@###&@+.....................................................", "....@###&@+.....................................................", "....@###&@+.....................................................", "....@###*&$@@@@@+...............................................", "....@###########@...............................................", "....@###########$+%.............................................", "....@###########&@+.............................................", "....@###*&&&&&&&$@+.............................................", "....@###&@@@@@@@@@+.............................................", "....@###&@=+++++++%.............................................", "....@###&@+.....................................................", "....@###&@+.........+@@@@@@@@@@@@@@@@@@@+.......................", "....@###&@+.........@###################@.......................", "....@###&@+.........@###################$+%.....................", "....@###&@+.........@###################&@+.....................", "....@###&@+.........+@$&&&&&*###*&&&&&&&$@+.....................", "....@###&@+...........+@@@@@&###&@@@@@@@@@+.....................", "....@###&@+...........%+++++$###&@=+++++++%.....................", "....@###&@+.................@###&@+.............................", "....+@$&$@+.................@###&@+.............................", "......+@@@+.................@###&@+.............................", "......%+++%.................@###&@+.............................", "............................@###&@+.............................", "............................@###&@+.............................", "............................@###&@+.............................", "............................@###&@+.............................", "............................@###&@+.............................", "............................@###&@+.......+@@@@@@@@@@@@@@@+.....", "............................@###&@+.......@###############@.....", "............................@###&@+.......@###############$+%...", "............................@###&@+.......@###############&@+...", "............................@###&@+.......@###*&&&&&&&&&&&$@+...", "............................@###&@+.......@###&@@@@@@@@@@@@@+...", "............................@###&@+.......@###&@=+++++++++++%...", "............................@###&@+.......@###&@+...............", "............................+@$&$@+.......@###&@+...............", "..............................+@@@+.......@###&@+...............", "..............................%+++%.......@###*&$@@@@@+.........", "..........................................@###########@.........", "..........................................@###########$+%.......", "..........................................@###########&@+.......", "..........................................@###*&&&&&&&$@+.......", "..........................................@###&@@@@@@@@@+.......", "..........................................@###&@=+++++++%.......", "..........................................@###&@+...............", "..........................................@###&@+...............", "..........................................@###&@+...............", "..........................................@###*&$@@@@@@@@@+.....", "..........................................@###############@.....", "..........................................@###############$+%...", "..........................................@###############&@+...", "..........................................+@$&&&&&&&&&&&&&$@+...", "............................................+@@@@@@@@@@@@@@@+...", "............................................%+++++++++++++++%...", "................................................................"}; �������������������./src/icons/fte16x16.xpm����������������������������������������������������������������������������0000644�0001750�0001750�00000001055�11323117515�013567� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * const fte16x16_xpm[] = { "16 16 9 1", ". c None", "+ c #800000", "@ c #FF0000", "# c #C00000", "$ c #400000", "% c #200000", "& c #600000", "* c #A00000", "= c #DF0000", ".++++...........", ".@###$..........", ".@$.............", ".@@@%...........", ".@&$%...........", ".@$..@@@@@%.....", ".@$..%$@&$%.....", ".%%....@$.......", ".......@$.......", ".......@$.+@@@*.", ".......@$.+#$$$.", ".......%%.+=+$..", "..........+=#*..", "..........+#....", "..........+@@@*.", "...........$$$$."}; �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/icons/fte32x32.xpm����������������������������������������������������������������������������0000644�0001750�0001750�00000002456�11323117515�013571� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* XPM */ static const char * const ftepm[] = { /* width height ncolors chars_per_pixel */ "32 32 3 1", /* colors */ " c None", "! c #FF0000", "# c #800000", /* pixels */ " ", " !!!!!!!! ", " !!!!!!!!# ", " !!####### ", " !!# ", " !!# ", " !!!!!! ", " !!!!!!# ", " !!##### ", " !!# ", " !!# !!!!!!!!!! ", " !!# !!!!!!!!!!# ", " !!# ###!!##### ", " !!# !!# ", " ## !!# ", " !!# ", " !!# ", " !!# ", " !!# !!!!!!!! ", " !!# !!!!!!!!# ", " !!# !!####### ", " !!# !!# ", " ## !!# ", " !!!!!! ", " !!!!!!# ", " !!##### ", " !!# ", " !!# ", " !!!!!!!! ", " !!!!!!!!# ", " ######## ", " " }; ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_routine.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000006254�11602724002�013152� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_routine.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_routine.h" #ifdef CONFIG_OBJ_ROUTINE #include "i_view.h" #include "o_buflist.h" #include "s_string.h" #include "sysdep.h" #include <stdio.h> RoutineView::RoutineView(int createFlags, EModel **ARoot, EBuffer *AB) : EList(createFlags, ARoot, "Routines"), Buffer(AB) { if (Buffer->rlst.Count == 0) Buffer->ScanForRoutines(); int Row = Buffer->VToR(Buffer->CP.Row); for (int i = Buffer->rlst.Count - 1; i >= 0; --i) if (Row >= Buffer->rlst.Lines[i]) { Row = i; break; } char CTitle[256]; snprintf(CTitle, sizeof(CTitle), "Routines %s: %d", Buffer->FileName, Buffer->rlst.Count); SetTitle(CTitle); }; RoutineView::~RoutineView() { Buffer->Routines = 0; } EEventMap *RoutineView::GetEventMap() { return FindEventMap("ROUTINES"); } int RoutineView::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExRescan: Buffer->ScanForRoutines(); UpdateList(); return 1; case ExActivateInOtherWindow: if (Row < Buffer->rlst.Count) { View->Next->SwitchToModel(Buffer); Buffer->CenterPosR(0, Buffer->rlst.Lines[Row]); return 1; } return 0; case ExCloseActivate: return 0; default: ; } return EList::ExecCommand(Command, State); } void RoutineView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if ((int)Buffer->RLine(Buffer->rlst.Lines[Line])->Count > Col) { char str[1024]; size_t len; len = UnTabStr(str, sizeof(str), Buffer->RLine(Buffer->rlst.Lines[Line])->Chars, Buffer->RLine(Buffer->rlst.Lines[Line])->Count); if ((int)len > Col) MoveStr(B, 0, Width, str + Col, color, len - Col); } } char* RoutineView::FormatLine(int Line) { PELine L = Buffer->RLine(Buffer->rlst.Lines[Line]); char *p = (char *) malloc(L->Count + 1); if (p) { memcpy(p, L->Chars, L->Count); p[L->Count] = 0; } return p; } int RoutineView::Activate(int No) { if (No >= Buffer->rlst.Count) return 0; View->SwitchToModel(Buffer); Buffer->CenterPosR(0, Buffer->rlst.Lines[No]); return 1; } void RoutineView::RescanList() { Buffer->ScanForRoutines(); UpdateList(); NeedsRedraw = 1; } void RoutineView::UpdateList() { Count = Buffer->rlst.Count; } int RoutineView::GetContext() { return CONTEXT_ROUTINES; } void RoutineView::GetName(char *AName, size_t MaxLen) { strlcpy(AName, "Routines", MaxLen); } void RoutineView::GetInfo(char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d/%03d Routines (%s)", ModelNo, Row + 1, Count, Buffer->FileName); } void RoutineView::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { snprintf(ATitle, MaxLen, "Routines: %s", Buffer->FileName); strlcpy(ASTitle, "Routines", SMaxLen); } #endif // CONFIG_OBJ_ROUTINE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_regex.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000103604�11344266046�012576� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_regex.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_regex.h" #include "sysdep.h" #include <ctype.h> #include <stdio.h> #include <stdlib.h> //#define DEBUG static int RegCount = 0; // *INDENT-OFF* #ifdef DEBUG static void RxDump(int N, RxNode *n); #endif static RxNode *NewNode(int aWhat) { RxNode *N = (RxNode *) malloc(sizeof(RxNode)); if (N) { memset(N, 0, sizeof(RxNode)); N->fWhat = (short)aWhat; } return N; } static RxNode *NewChar(char Ch) { RxNode *A = NewNode(RE_CHAR); if (A) { A->fChar = (char *)malloc(1); A->fLen = 1; A->fChar[0] = Ch; } return A; } static RxNode *NewEscape(const char **const Regexp) { char Ch = **Regexp; ++*Regexp; switch (Ch) { case 0: return 0; case 'a': Ch = '\a'; break; case 'b': Ch = '\b'; break; case 'f': Ch = '\f'; break; case 'n': Ch = '\n'; break; case 'r': Ch = '\r'; break; case 't': Ch = '\t'; break; case 'v': Ch = '\v'; break; case 'e': Ch = 27; break; case 's': return NewNode(RE_WSPACE); case 'S': return NewNode(RE_NWSPACE); case 'U': return NewNode(RE_UPPER); case 'L': return NewNode(RE_LOWER); case 'w': return NewNode(RE_WORD); case 'W': return NewNode(RE_NWORD); case 'd': return NewNode(RE_DIGIT); case 'D': return NewNode(RE_NDIGIT); case 'C': return NewNode(RE_CASE); case 'c': return NewNode(RE_NCASE); case 'N': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = N * 100; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N * 10; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; case 'o': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = N * 64; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N * 8; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; case 'x': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = N << 4; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = A + N; Ch = (char)A; } break; } return NewChar(Ch); } #define NNN 32 // 8 * 32 = 256 (match set) #define SETOP(set,n) \ do { \ set[(unsigned char)(n) >> 3] |= (unsigned char)(1 << ((unsigned char)(n) & 7)); \ } while (0) static RxNode *NewSet(const char ** const Regexp) { unsigned char set[NNN]; int s = 0; int c = 0; unsigned int i, xx; unsigned char Ch, C1 = 0, C2 = 0; int doset = 0; memset(set, 0, sizeof(set)); s = 1; if (**Regexp == '^') { s = 0; ++*Regexp; } c = 0; while (**Regexp) { switch (Ch = *((*Regexp)++)) { case ']': if (doset == 1) return 0; { RxNode *N = NewNode(s?RE_INSET:RE_NOTINSET); N->fChar = (char *) malloc(sizeof(set)); N->fLen = sizeof(set); if (N->fChar == 0) return 0; memcpy(N->fChar, (char *) set, sizeof(set)); return N; } case '\\': switch (Ch = *((*Regexp)++)) { case 0: return 0; case 'a': Ch = '\a'; break; case 'b': Ch = '\b'; break; case 'f': Ch = '\f'; break; case 'n': Ch = '\n'; break; case 'r': Ch = '\r'; break; case 't': Ch = '\t'; break; case 'v': Ch = '\v'; break; case 'e': Ch = 27; break; case 'N': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = N * 100; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N * 10; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 'o': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = N * 64; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N * 8; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 7) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 'x': { unsigned int N = 0; unsigned int A = 0; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = N << 4; if (**Regexp == 0) return 0; N = toupper(**Regexp) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; (*Regexp)++; A = A + N; Ch = (unsigned char)A; } break; case 's': c += 4; SETOP(set, '\n'); SETOP(set, '\t'); SETOP(set, ' '); SETOP(set, '\r'); continue; case 'S': for (xx = 0; xx <= 255; xx++) { if (xx != ' ' && xx != '\t' && xx != '\n' && xx != '\r') { c++; SETOP(set, xx); } } continue; case 'w': for (xx = 0; xx <= 255; xx++) { if (isalnum(xx)) { c++; SETOP(set, xx); } } break; case 'W': for (xx = 0; xx <= 255; xx++) { if (!isalnum(xx)) { c++; SETOP(set, xx); } } break; case 'd': for (xx = 0; xx <= 255; xx++) { if (isdigit(xx)) { c++; SETOP(set, xx); } } break; case 'D': for (xx = 0; xx <= 255; xx++) { if (!isdigit(xx)) { c++; SETOP(set, xx); } } break; case 'U': for (xx = 'A'; xx <= 'Z'; xx++) { c++; SETOP(set, xx); } continue; case 'L': for (xx = 'a'; xx <= 'z'; xx++) { c++; SETOP(set, xx); } continue; } break; } if (doset == 0 && ((**Regexp) == '-')) { doset = 1; C1 = Ch; ++*Regexp; continue; } else if (doset == 1) { C2 = Ch; if (C2 < C1) return 0; for(i = C1; i <= C2; i++) SETOP(set, i); doset = 0; continue; } c++; SETOP(set, Ch); } return 0; } static int AddNode(RxNode **F, RxNode **N, RxNode *A) { if (A) { if (*F) { (*N)->fNext = A; A->fPrev = (*N); *N = A; } else { (*N) = (*F) = A; A->fPrev = A->fNext = 0; } return 1; } return 0; } static int CountWidth(RxNode *N) { int w = 0; while (N) { if (N->fWhat < 32) w += 0; else if (N->fWhat >= 32 && N->fWhat < 64) w += 1; N = N->fNext; } return w; } static int MakeSub(RxNode **F, RxNode **N, char What) { //printf("MakeSub: %c\n", What); if (*N) { RxNode *No; RxNode *New; RxNode *Jump, *Skip; RxNode *Last = (*N); if (Last->fWhat & RE_GROUP) { RxNode *P = Last->fPrev; int C = 1; while ((C > 0) && P) { //puts("backtracking...-----"); //RxDump(0, P); if (P->fWhat & RE_GROUP) { if (P->fWhat & RE_CLOSE) C++; else C--; } Last = P; if (C == 0) break; P = P->fPrev; } //printf("P = %s, c = %d", P ? "ok":"null", C); if (C != 0) return 0; } assert(Last); if (What != '?' && What != '|') if (CountWidth(Last) == 0) { // puts("FAILED count"); return 0; } switch (What) { case '?': /* BRANCH x NOTHING */ New = NewNode(RE_BRANCH | RE_GREEDY | What); No = NewNode(RE_NOTHING); if (!New || !No) return 0; No->fPrev = *N; if (*N) (*N)->fNext = No; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; *N = No; //puts("BRANCH ?"); break; case '*': case '@': New = NewNode(RE_BRANCH | What | ((What == '*') ? RE_GREEDY : 0)); Jump = NewNode(RE_JUMP); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fNext = No; Jump->fPrev = *N; if (*N) (*N)->fNext = Jump; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; *N = No; //puts("BRANCH *"); break; case '#': case '+': New = NewNode(RE_BRANCH | What | ((What == '+') ? RE_GREEDY : 0)); Skip = NewNode(RE_JUMP); Jump = NewNode(RE_JUMP); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fPrev = *N; Jump->fNext = No; Skip->fNext = New; New->fPrev = Skip; if (*N) (*N)->fNext = Jump; New->fNext = Last; Skip->fPrev = Last->fPrev; Last->fPrev = New; if (Skip->fPrev) { Skip->fPrev->fNext = Skip; } else { *F = Skip; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; Skip->fPtr = Last; *N = No; //puts("BRANCH +"); break; case '|': New = NewNode(RE_BRANCH | RE_GREEDY | What); Jump = NewNode(RE_BREAK); No = NewNode(RE_NOTHING); if (!New || !No || !Jump) return 0; No->fPrev = Jump; Jump->fNext = No; Jump->fPrev = *N; if (*N) (*N)->fNext = Jump; New->fNext = Last; New->fPrev = Last->fPrev; Last->fPrev = New; if (New->fPrev) { New->fPrev->fNext = New; } else { *F = New; } New->fPtr = No; No->fPtr = New; Jump->fPtr = New; *N = No; //puts("BRANCH |"); break; } return 1; } return 0; } #define CHECK(n) do { if ((n) == 0) { return 0;} } while (0) static RxNode *RxComp(const char **const Regexp) { RxNode *F = 0; RxNode *N = 0; int C; char Ch; while (**Regexp) { // puts(*Regexp); switch (Ch = (*(*Regexp)++)) { case '?': case '*': case '+': case '@': case '#': case '|': CHECK(MakeSub(&F, &N, Ch)); break; case '}': case ')': return F; case '{': CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_OPEN))); CHECK(AddNode(&F, &N, RxComp(Regexp))); while (N->fNext) N = N->fNext; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_CLOSE))); break; case '(': C = ++RegCount; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_OPEN | RE_MEM | C))); CHECK(AddNode(&F, &N, RxComp(Regexp))); while (N->fNext) N = N->fNext; CHECK(AddNode(&F, &N, NewNode(RE_GROUP | RE_CLOSE | RE_MEM | C))); break; case '\\':CHECK(AddNode(&F, &N, NewEscape(Regexp))); break; case '[': CHECK(AddNode(&F, &N, NewSet(Regexp))); break; case '^': CHECK(AddNode(&F, &N, NewNode(RE_ATBOL))); break; case '$': CHECK(AddNode(&F, &N, NewNode(RE_ATEOL))); break; case '.': CHECK(AddNode(&F, &N, NewNode(RE_ANY))); break; case '<': CHECK(AddNode(&F, &N, NewNode(RE_ATBOW))); break; case '>': CHECK(AddNode(&F, &N, NewNode(RE_ATEOW))); break; default: --*Regexp; CHECK(AddNode(&F, &N, NewChar(**Regexp))); ++*Regexp; break; } } return F; } static RxNode *RxOptimize(RxNode *rx) { return rx; } RxNode *RxCompile(const char *Regexp) { RxNode *n = 0, *x; if (Regexp == 0) return 0; RegCount = 0; n = RxComp(&Regexp); if (n == 0) return 0; n = RxOptimize(n); x = n; while (x->fNext) x = x->fNext; x->fNext = NewNode(RE_END); return n; } void RxFree(RxNode *n) { RxNode *p; while (n) { p = n; n = n->fNext; switch (p->fWhat) { case RE_INSET: case RE_NOTINSET: case RE_CHAR: free(p->fChar); break; default: break; } free(p); } } #define ChClass(x) (((((x) >= 'A') && ((x) <= 'Z')) || (((x) >= 'a') && ((x) <= 'z')) || (((x) >= '0') && ((x) <= '9')))?1:0) static RxMatchRes *match; static const char *bop; static const char *eop; static int flags = RX_CASE; static const char *rex; int RxMatch(RxNode *rx) { RxNode *n = rx; //printf(">>"); while (n) { //printf("%-50.50s\n", rex); //RxDump(1, n); switch (n->fWhat) { case RE_NOTHING: break; case RE_CASE: flags |= RX_CASE; break; case RE_NCASE: flags &= ~RX_CASE; break; case RE_ATBOL: if (rex != bop) return 0; break; case RE_ATEOL: if (rex != eop) return 0; break; case RE_ANY: if (rex == eop) return 0; rex++; break; case RE_WSPACE: if (rex == eop) return 0; if (*rex != ' ' && *rex != '\n' && *rex != '\r' && *rex != '\t') return 0; rex++; break; case RE_NWSPACE: if (rex == eop) return 0; if (*rex == ' ' || *rex == '\n' || *rex == '\r' || *rex == '\t') return 0; rex++; break; case RE_WORD: if (rex == eop) return 0; if (!isalnum(*rex)) return 0; rex++; break; case RE_NWORD: if (rex == eop) return 0; if (isalnum(*rex)) return 0; rex++; break; case RE_DIGIT: if (rex == eop) return 0; if (!isdigit(*rex)) return 0; rex++; break; case RE_NDIGIT: if (rex == eop) return 0; if (isdigit(*rex)) return 0; rex++; break; case RE_UPPER: if (rex == eop) return 0; if (!isupper(*rex)) return 0; rex++; break; case RE_LOWER: if (rex == eop) return 0; if (!islower(*rex)) return 0; rex++; break; case RE_ATBOW: if (rex >= eop) return 0; if (rex > bop) { if ((ChClass(*rex) != 1) || (ChClass(*(rex-1)) != 0)) return 0; } break; case RE_ATEOW: if (rex <= bop) return 0; if (rex < eop) { if ((ChClass(*rex) != 0) || (ChClass(*(rex-1)) != 1)) return 0; } break; case RE_CHAR: if (rex == eop) return 0; if (flags & RX_CASE) { if (*n->fChar != *rex) return 0; if (memcmp(rex, n->fChar, n->fLen) != 0) return 0; } else { for (int i = 0; i < n->fLen; i++) if (toupper(rex[i]) != toupper(n->fChar[i])) return 0; } rex += n->fLen; break; case RE_INSET: if (rex == eop) return 0; if ((n->fChar[(unsigned char)(*rex) >> 3] & (1 << ((unsigned char)(*rex) & 7))) == 0) return 0; rex++; break; case RE_NOTINSET: if (rex == eop) return 0; if (n->fChar[(unsigned char)(*rex) >> 3] & (1 << ((unsigned char)(*rex) & 7))) return 0; rex++; break; case RE_JUMP: n = n->fPtr; continue; case RE_END: return 1; case RE_BREAK: n = n->fNext; if (n->fNext == 0) break; n = n->fNext; if (n->fWhat & RE_BRANCH) { while ((n->fWhat & RE_BRANCH) && n->fPtr && ((n->fWhat & 0xFF) == '|')) n = n->fPtr->fNext; } if (n->fWhat & RE_GROUP) { int C = 1; n = n->fNext; while ((C > 0) && n) { if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_OPEN) C++; else C--; } if (C == 0) break; n = n->fNext; } } break; default: if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_MEM) { const char *save = rex; int b = n->fWhat & 0xFF; int fl = flags; if (RxMatch(n->fNext) == 0) { flags = fl; if (n->fWhat & RE_OPEN) match->Open[b] = -1; else match->Close[b] = -1; return 0; } if (n->fWhat & RE_OPEN) { // if (match->Open[b] == -1) match->Open[b] = (int) (save - bop); } else { // if (match->Close[b] == -1) match->Close[b] = (int) (save - bop); } return 1; } } else if (n->fWhat & RE_BRANCH) { const char *save = rex; int fl = flags; if ((n->fWhat & RE_GREEDY) == 0) { if (RxMatch(n->fPtr) == 1) return 1; flags = fl; rex = save; } else { if (RxMatch(n->fNext) == 1) return 1; flags = fl; rex = save; n = n->fPtr; continue; } } break; } n = n->fNext; } /* NOTREACHED */ assert(1 == 0 /* internal regexp error */); return 0; } int RxTry(RxNode *rx, const char *s) { int fl = flags; rex = s; for (int i = 0; i < NSEXPS; i++) match->Open[i] = match->Close[i] = -1; if (RxMatch(rx)) { match->Open[0] = (int) (s - bop); match->Close[0] = (int) (rex - bop); return 1; } flags = fl; return 0; } int RxExecMatch(RxNode *Regexp, const char *Data, size_t Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt) { if (Regexp == 0) return 0; match = Match; bop = Data; eop = Data + Len; flags = RxOpt; return RxTry(Regexp, Start); } int RxExec(RxNode *Regexp, const char *Data, size_t Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt) { int Ch; if (Regexp == 0) return 0; match = Match; bop = Data; eop = Data + Len; flags = RxOpt; for (int i = 0; i < NSEXPS; i++) Match->Open[i] = Match->Close[i] = -1; switch (Regexp->fWhat) { // this should be more clever case RE_ATBOL: // match is anchored return RxTry(Regexp, Start); case RE_CHAR: // search for a character to match Ch = Regexp->fChar[0]; if (Start == eop) break; if (flags & RX_CASE) { while (1) { while (Start < eop && *Start != Ch) Start++; if (Start == eop) break; if (RxTry(Regexp, Start)) return 1; if (++Start == eop) break; } } else { Ch = toupper(Ch); while (1) { while (Start < eop && toupper(*Start) != Ch) Start++; if (Start == eop) break; if (RxTry(Regexp, Start)) return 1; if (++Start == eop) break; } } break; default: // (slow) do { if (RxTry(Regexp, Start)) return 1; } while (Start++ < eop); break; } return 0; } #define FLAG_UP_CASE 1 #define FLAG_DOWN_CASE 2 #define FLAG_UP_NEXT 4 #define FLAG_DOWN_NEXT 8 static int add(size_t *len, char **s, const char *a, size_t alen, int &flag) { size_t NewLen = *len + alen; size_t i; NewLen = NewLen * 2; if (alen == 0) return 0; if (*s) { *s = (char *) realloc(*s, NewLen); assert(*s); memcpy(*s + *len, a, alen); } else { *s = (char *) malloc(NewLen); assert(*s); memcpy(*s, a, alen); *len = 0; } if (flag & FLAG_UP_CASE) { char *p = *s + *len; for (i = 0; i < alen; i++) { *p = (char)toupper(*p); p++; } } else if (flag & FLAG_DOWN_CASE) { char *p = *s + *len; for (i = 0; i < alen; i++) { *p = (char)tolower(*p); p++; } } if (flag & FLAG_UP_NEXT) { char *p = *s + *len; *p = (char)toupper(*p); flag &= ~FLAG_UP_NEXT; } else if (flag & FLAG_DOWN_NEXT) { char *p = *s + *len; *p = (char)tolower(*p); flag &= ~FLAG_DOWN_NEXT; } *len += alen; return 0; } int RxReplace(const char *rep, const char *Src, size_t /*len*/, RxMatchRes match, char **Dest, size_t *Dlen) { size_t dlen = 0; char *dest = 0; char Ch; int n; int flag = 0; *Dest = 0; *Dlen = 0; // add(&dlen, &dest, Src, match.Open[0]); while (*rep) { switch (Ch = *rep++) { // case '&': // add(&dlen, &dest, Src + match.Open[0], match.Close[0] - match.Open[0], flag); // break; case '\\': switch (Ch = *rep++) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = Ch - 48; if (match.Open[n] != -1 && match.Close[n] != -1) { add(&dlen, &dest, Src + match.Open[n], match.Close[n] - match.Open[n], flag); } else return -1; break; case 0: if (dest) free(dest); return -1; // error case 'r': Ch = '\r'; add(&dlen, &dest, &Ch, 1, flag); break; case 'n': Ch = '\n'; add(&dlen, &dest, &Ch, 1, flag); break; case 'b': Ch = '\b'; add(&dlen, &dest, &Ch, 1, flag); break; case 'a': Ch = '\a'; add(&dlen, &dest, &Ch, 1, flag); break; case 't': Ch = '\t'; add(&dlen, &dest, &Ch, 1, flag); break; case 'U': flag |= FLAG_UP_CASE; break; case 'u': flag |= FLAG_UP_NEXT; break; case 'L': flag |= FLAG_DOWN_CASE; break; case 'l': flag |= FLAG_DOWN_NEXT; break; case 'E': case 'e': flag &= ~(FLAG_UP_CASE | FLAG_DOWN_CASE); break; case 'x': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; rep++; A = N << 4; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) N = N + 48 - 65 + 10; if (N > 15) return 0; rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; case 'd': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = N * 100; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = N * 10; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 9) { free(dest); return 0; } rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; case 'o': { int N = 0; int A = 0; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = N * 64; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = N * 8; if (*rep == 0) { free(dest); return 0; } N = toupper(*rep) - 48; if (N > 7) { free(dest); return 0; } rep++; A = A + N; Ch = (char)A; } add(&dlen, &dest, &Ch, 1, flag); break; default: add(&dlen, &dest, &Ch, 1, flag); break; } break; default: add(&dlen, &dest, &Ch, 1, flag); break; } } // add(&dlen, &dest, Src + match.Close[0], len - match.Close[0]); *Dlen = dlen; *Dest = dest; return 0; } #ifdef DEBUG static void RxDump(int N, RxNode *n) { while (n) { for (int i = 0; i < N; i++) printf(" "); switch (n->fWhat) { case RE_NOTHING: printf("NOTHING\n"); break; case RE_CHAR: printf("CHAR '%.1s'\n", n->fChar); break; case RE_ATBOL: printf("^\n"); break; case RE_ATEOL: printf("$\n"); break; case RE_ANY: printf(".\n"); break; case RE_INSET: printf("[\n"/*, n->fChar*/); break; case RE_NOTINSET: printf("[^\n"/*, n->fChar*/); break; case RE_ATBOW: printf("<\n"); break; case RE_ATEOW: printf(">\n"); break; case RE_WSPACE: printf("WSPACE\n"); break; case RE_NWSPACE: printf("NWSPACE\n"); break; case RE_UPPER: printf("UPPER\n"); break; case RE_LOWER: printf("LOWER\n"); break; case RE_JUMP: printf("JUMP\n"); break; case RE_BREAK: printf("BREAK\n"); break; case RE_END: printf("END\n"); break; default: if (n->fWhat & RE_GROUP) { if (n->fWhat & RE_MEM) { if (n->fWhat & RE_OPEN) printf("( %d\n", n->fWhat & 0xFF); if (n->fWhat & RE_CLOSE) printf(") %d\n", n->fWhat & 0xFF); } else { if (n->fWhat & RE_OPEN) printf("{\n"); if (n->fWhat & RE_CLOSE) printf("}\n"); } } else if (n->fWhat & RE_BRANCH) { if (n->fWhat & RE_GREEDY) { printf("%c\n", n->fWhat & 0xFF); } else { printf("%c\n", n->fWhat & 0xFF); } } else { printf("???????????????\n"); } break; } n = n->fNext; } } #define TEST(rc,rx,st) \ strcpy(line,st); \ assert((a = RxCompile(rx)) != 0); \ puts("\n--- " rx " -- " st " -- "); \ RxDump(0,a);\ assert(rc == RxExec(a, line, strlen(line), line, &b)); \ RxFree(a); int main() { RxNode *a; RxMatchRes b; char line[1024]; TEST(1, "a", "a"); TEST(0, "b", "a"); TEST(1, "aaaa", "aaaa"); TEST(0, "bbbb", "aaaa"); TEST(1, ".", "a"); TEST(0, ".", ""); TEST(1, "a..", "axx"); TEST(0, "a..", "b.."); TEST(1, "a?b", "ab"); TEST(1, "a?b", "xb"); TEST(0, "a?C", "xb"); TEST(1, "{aa}?b", "aab"); TEST(1, "{aa}?b", "xab"); TEST(0, "{aa}?C", "xxb"); TEST(1, "^aa", "aa"); TEST(0, "^aa", "baa"); TEST(1, "^aa$" ,"aa"); TEST(0, "^aa$", "baab"); TEST(1, "a*b", "aaab"); TEST(0, "a*b", "aaaa"); TEST(1, "{aa}*b", "aaab"); TEST(0, "{aa}*b", "aaaa"); TEST(1, "b+", "bb"); TEST(1, "b+", "b"); TEST(0, "b+", "a"); TEST(1, "^b+$", "b"); TEST(0, "^b+$", "aba"); TEST(1, "a|b", " a"); TEST(1, "a|b", " b"); TEST(0, "a|b", " c"); TEST(1, "a|b|c|d|e", " a "); TEST(1, "a|b|c|d|e", " c "); TEST(1, "a|b|c|d|e", " e "); TEST(0, "a|b|c|d|e", " x "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " a "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " c "); TEST(1, "{a}|{b}|{c}|{d}|{e}", " e "); TEST(0, "{a}|{b}|{c}|{d}|{e}", " x "); TEST(1, "^xx{alpha}|{beta}xx$", "xxalphaxx"); TEST(1, "^xx{alpha}|{beta}xx$", "xxbetaxx"); TEST(1, "[a-z]", "aaa"); TEST(1, "^{Error}|{Warning}", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+)", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} ([a-z.]#) ([0-9]#)", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+) ([0-9]+): (.*)$", "Warning search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^{Error}|{Warning} (.+) ([0-9]+): (.*)$", "Error search.cpp 35: Conversion may lose significant digits in function AskReplace()"); TEST(1, "^([a-z]+ +)*\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s+)+\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s*)+\\(", "blabla bla bla bla("); TEST(1, "^([a-z]+\\s+)+\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+\\s*)+\\(", "blabla bla bla bla("); TEST(1, "^([a-z]# #)*\\(", "blabla bla bla bla ("); TEST(1, "^([a-z]+ @)@\\(", "blabla bla bla bla ("); TEST(1, "^[\\x20-\\xFF]+$", "blabla"); TEST(1, "{a{a{a{a|a}|{a|a}a}a}a|a}", "aaaaaaaaaaaaaaaaa"); while (1) { printf("Regexp: "); fflush(stdout); gets(line); if (!*line) break; a = RxCompile(line); RxDump(0, a); printf("String: "); fflush(stdout); gets(line); printf("rc = %d\n", RxExec(a, line, strlen(line), line, &b)); for (int i = 0; i < NSEXPS; i++) { if (b.Open[i] != -1) { printf("%d: %d %d\n", i, b.Open[i], b.Close[i]); } } RxFree(a); } return 0; } #endif // *INDENT-ON* ����������������������������������������������������������������������������������������������������������������������������./src/i_oview.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000003206�11344266047�012264� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_oview.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_OVIEW_H #define I_OVIEW_H #include "console.h" #include "c_commands.h" class GxView; class EEventMap; class ExState; class ExView { protected: public: GxView *Win; ExView *Next; ExView(); virtual ~ExView(); virtual EEventMap *GetEventMap(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void Activate(int gotfocus); virtual int GetContext(); virtual ExView *GetViewContext(); virtual ExView *GetStatusContext(); virtual int BeginMacro(); virtual void EndExec(int NewResult); virtual void HandleEvent(TEvent &Event); virtual int IsModelView(); virtual void RepaintView(); virtual void RepaintStatus(); virtual void Resize(int width, int height); virtual void UpdateView(); virtual void UpdateStatus(); int IsActive(); void Repaint(); void Update(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConShowCursor(); int ConHideCursor(); int ConSetCursorSize(int Start, int End); }; /* Implement most common used methods for ExView *Next */ class ExViewNext: public ExView { public: virtual ExView *GetViewContext(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void UpdateView(); }; #endif // I_OVIEW_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte.h�����������������������������������������������������������������������������������������0000644�0001750�0001750�00000001463�11602724002�011367� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* fte.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef FTE_H #define FTE_H #ifdef LINUX /* * for support of large file sizes on 32bit system * here is the solution for linux and glibc */ #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE 1 #endif #include "feature.h" #include "sysdep.h" #include <inttypes.h> #include <sys/types.h> #include <assert.h> #include <string.h> #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) #include <crtdbg.h> #define new new( _CLIENT_BLOCK, __FILE__, __LINE__) #endif //_DEBUG && MSVC && MSVCDEBUG #define FTE_ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #include "stl_fte.h" #endif // FTE_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_c.cpp���������������������������������������������������������������������������������������0000644�0001750�0001750�00000142110�11344266046�011704� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_c.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_C #include "c_bind.h" #include "o_buflist.h" #include "sysdep.h" #include <ctype.h> #define PRINTF(x) //printf x #define ISNAME(x) (isalnum(x) || ((x) == '_')) #define ISUPPER(x, c) ((x) == (c) || ((x) == (c + 'a' - 'A'))) enum { hsC_Normal, hsC_Comment, hsC_CommentL, hsC_Keyword = 4, hsC_String1 = 10, hsC_String2, hsC_CPP, hsC_CPP_Comm, hsC_CPP_String1, hsC_CPP_String2, hsC_CPP_ABrace, hsC_Tripplet }; int Hilit_C(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; int was_include = 0; for(i = 0; i < Line->Count;) { if (*p != ' ' && *p != '\t') firstnw++; IF_TAB() else { PRINTF(("STATE %d\n", State)); switch(State) { default: case hsC_Tripplet: case hsC_Normal: if (ISUPPER(*p, 'L') && p[1] == '"') { State = hsC_String2; Color = CLR_String; goto hilit2; } else if (ISUPPER(*p, 'L') && p[1] == '\'') { State = hsC_String1; Color = CLR_String; goto hilit2; } else if (isalpha(*p) || *p == '_') { for (j = 0; (((i + j) < Line->Count) && ISNAME(Line->Chars[i + j])); j++) ; if (BF->GetHilitWord(Color, &Line->Chars[i], j)) { //Color = hcC_Keyword; State = hsC_Keyword; } else { int x = i + j; while (x < Line->Count && isspace(Line->Chars[x])) x++; PRINTF(("LABEL %c %d\n", Line->Chars[x], x)); if (x < Line->Count && Line->Chars[x] == '(') { Color = CLR_Function; } else if (State == hsC_Normal && (x < Line->Count) && (Line->Chars[x] == ':' && (x == Line->Count - 1 || Line->Chars[x + 1] != ':')) && firstnw == 1) { Color = CLR_Label; PRINTF(("___LABEL %c %d\n", Line->Chars[x], x)); } else Color = CLR_Normal; State = hsC_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsC_Normal; continue; } else if ((len >= 2) && (*p == '/') && (p[1] == '*')) { State = hsC_Comment; Color = CLR_Comment; goto hilit2; } else if ((len >= 2) && (*p == '/') && (p[1] == '/')) { State = hsC_CommentL; Color = CLR_Comment; goto hilit2; } else if (isdigit(*p)) { // check if it is not floating point number 0.08! if ((len >= 2) && (*p == '0') && p[1] != '.') { if (ISUPPER(p[1], 'X')) { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); } else /* assume it's octal */ { Color = CLR_Number; ColorNext(); while (len && ('0' <= *p && *p <= '7')) ColorNext(); // if we hit a non-octal, stop hilighting it. if (len && ('8' <= *p && *p <= '9')) { Color = CLR_Normal; while (len && !isspace(*p)) ColorNext(); continue; } } } else /* assume it's decimal/floating */ { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); // if it ends with 'f', the number can't have more extras. if (len && (ISUPPER(*p, 'F'))) { ColorNext(); continue; } } // allowed extras: u, l, ll, ul, ull, lu, llu int colored_u = 0; if (len && (ISUPPER(*p, 'U'))) { ColorNext(); colored_u = 1; } if (len && (ISUPPER(*p, 'L'))) { ColorNext(); if (len && (ISUPPER(*p, 'L'))) ColorNext(); if (! colored_u && len && (ISUPPER(*p, 'U'))) ColorNext(); } continue; } else if (*p == '\'') { State = hsC_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsC_String2; Color = CLR_String; goto hilit; } else if (firstnw == 1 && *p == '#') { State = hsC_CPP; Color = CLR_CPreprocessor; goto hilit; } else if (*p == '?') { State = hsC_Tripplet; Color = CLR_Punctuation; PRINTF(("----FOUND TRIPPLET\n")); goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; PRINTF(("----FOUND PUNKT\n")); goto hilit; } Color = CLR_Normal; goto hilit; case hsC_Comment: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (p[1] == '/')) { ColorNext(); ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_CPP_Comm: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (p[1] == '/')) { ColorNext(); ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP_ABrace: Color = CLR_String; if (*p == '>') { Color = CLR_CPreprocessor; State = hsC_CPP; } goto hilit; case hsC_CommentL: Color = CLR_Comment; goto hilit; case hsC_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '\'') { ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsC_Normal; continue; } goto hilit; case hsC_CPP_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '\'') { ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsC_CPP; continue; } goto hilit; case hsC_CPP: if (ISNAME(*p)) { j = 0; Color = CLR_CPreprocessor; while (((i + j) < Line->Count) && (ISNAME(Line->Chars[i+j]))) j++; if (j == 7 && memcmp(Line->Chars + i, "include", 7) == 0) was_include = 1; if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; continue; } else if ((len >= 2) && (*p == '/') && (*(p+1) == '*')) { State = hsC_CPP_Comm; Color = CLR_Comment; goto hilit2; } else if ((len >= 2) && (*p == '/') && (*(p+1) == '/')) { State = hsC_CommentL; Color = CLR_Comment; hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (isdigit(*p)) { if ((len >= 2) && (*p == '0')) { if (ISUPPER(p[1], 'X')) { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); } else /* assume it's octal */ { Color = CLR_Number; ColorNext(); while (len && ('0' <= *p && *p <= '7')) ColorNext(); // if we hit a non-octal, stop hilighting it. if (len && ('8' <= *p && *p <= '9')) { Color = CLR_Normal; while (len && !isspace(*p)) ColorNext(); continue; } } } else /* assume it's decimal/floating */ { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); // if it ends with 'f', the number can't have more extras. if (len && (ISUPPER(*p, 'F'))) goto hilit; } // allowed extras: u, l, ll, ul, ull, lu, llu int colored_u = 0; if (len && (ISUPPER(*p, 'U'))) { ColorNext(); colored_u = 1; } if (len && (ISUPPER(*p, 'L'))) { ColorNext(); if (len && (ISUPPER(*p, 'L'))) ColorNext(); if (! colored_u && len && (ISUPPER(*p, 'U'))) ColorNext(); } continue; } else if (*p == '\'') { State = hsC_CPP_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsC_CPP_String2; Color = CLR_String; goto hilit; } else if (*p == '<' && was_include) { ColorNext(); State = hsC_CPP_ABrace; continue; } else { Color = CLR_CPreprocessor; goto hilit; } } } } if (State == hsC_CommentL) State = hsC_Normal; if ((len1 == 0) || (*last != '\\')) { switch(State) { case hsC_String1: case hsC_String2: case hsC_CPP: case hsC_CPP_String1: case hsC_CPP_String2: State = hsC_Normal; break; } } *ECol = C; return 0; } int IsState(hsState *Buf, hsState State, size_t Len) { for (;Len > 0; Buf++, --Len) if (*Buf != State) return 0; return 1; } int LookAt(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord, int CaseInsensitive) { size_t Len = strlen(What); if (Row < 0 || Row >= B->RCount) { PRINTF(("Row out of range: %d vs %d\n", Row, B->RCount)); return 0; } char* pLine = B->RLine(Row)->Chars; unsigned uLineLength = B->RLine(Row)->Count; Pos = B->CharOffset(B->RLine(Row), Pos); if (Pos + strlen(What) > uLineLength) return 0; if (NoWord && uLineLength > Pos + Len && ISNAME(pLine[Pos + Len])) return 0; PRINTF(("Check against [%c]\n", What)); if ((CaseInsensitive && memicmp(pLine + Pos, What, Len) == 0) || (!CaseInsensitive && memcmp(pLine + Pos, What, Len) == 0)) { int StateLen; hsState *StateMap; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return 0; if( IsState(StateMap + Pos, State, strlen(What) ) ) return 1; } return 0; } #ifdef CONFIG_INDENT_C int C_Indent = 4; int C_BraceOfs = 0; int C_ParenDelta = -1; int C_CaseOfs = 0; int C_CaseDelta = 4; int C_ClassOfs = 0; int C_ClassDelta = 4; int C_ColonOfs = 0;//-4; int C_CommentOfs = 0; int C_CommentDelta = 1; int C_FirstLevelWidth = -1; int C_FirstLevelIndent = 4; int C_Continuation = 4; int FunctionUsesContinuation = 0; // this is global, unfortunately -- FIX !!! int EBuffer::SetCIndentStyle(ExState &State) { if (State.GetIntParam(View, &C_Indent) == 0) return 0; if (State.GetIntParam(View, &C_BraceOfs) == 0) return 0; if (State.GetIntParam(View, &C_ParenDelta) == 0) return 0; if (State.GetIntParam(View, &C_CaseOfs) == 0) return 0; if (State.GetIntParam(View, &C_CaseDelta) == 0) return 0; if (State.GetIntParam(View, &C_ClassOfs) == 0) return 0; if (State.GetIntParam(View, &C_ClassDelta) == 0) return 0; if (State.GetIntParam(View, &C_ColonOfs) == 0) return 0; if (State.GetIntParam(View, &C_CommentOfs) == 0) return 0; if (State.GetIntParam(View, &C_CommentDelta) == 0) return 0; if (State.GetIntParam(View, &C_FirstLevelWidth) == 0) return 0; if (State.GetIntParam(View, &C_FirstLevelIndent) == 0) return 0; if (State.GetIntParam(View, &C_Continuation) == 0) return 0; return 1; } #define C_INDENT C_Indent #define C_BRACE_OFS C_BraceOfs #define C_PAREN_DELTA C_ParenDelta #define C_CASE_OFS C_CaseOfs #define C_CASE_DELTA C_CaseDelta #define C_CLASS_OFS C_ClassOfs #define C_CLASS_DELTA C_ClassDelta #define C_COLON_OFS C_ColonOfs #define C_COMMENT_OFS C_CommentOfs #define C_COMMENT_DELTA C_CommentDelta #define C_CONTINUATION C_Continuation #define C_FIRST_INDENT C_FirstLevelIndent #define C_FIRST_WIDTH C_FirstLevelWidth #define FIND_IF 0x0001 #define FIND_SEMICOLON 0x0002 #define FIND_COMMA 0x0004 #define FIND_COLON 0x0008 #define FIND_ELSE 0x0010 #define FIND_FOR 0x0020 #define FIND_WHILE 0x0040 #define FIND_ENDBLOCK 0x0080 //#define FIND_BEGINBLOCK 0x0100 #define FIND_CLASS 0x0200 #define FIND_CASE 0x0400 #define FIND_SWITCH 0x0800 #define FIND_QUESTION 0x1000 static int CheckLabel(EBuffer *B, int Line) { PELine L = B->RLine(Line); int P = B->CharOffset(L, B->LineIndented(Line)); int Cnt = 0; PRINTF(("CHECKING LABEL\n")); if (Line > 0 && B->RLine(Line - 1)->StateE != hsC_Normal) return 0; while ((P < L->Count) && (L->Chars[P] == ' ' || L->Chars[P] == 9)) P++; while (P < L->Count) { if (Cnt > 0) if (L->Chars[P] == ':' && (Cnt == 1 || L->Chars[P + 1] != ':')) { PRINTF(("CHECKING LABEL -> 1!\n")); return 1; } if (!ISNAME(L->Chars[P])) { PRINTF(("NONCHECKING LABEL -> 0\n")); return 0; } Cnt++; P++; } PRINTF(("CHECKING LABEL -> 0\n")); return 0; } static int SearchBackMatch(int Count, EBuffer *B, int Row, hsState State, const char *Open, const char *Close, int *OPos, int *OLine, int matchparens = 0, int bolOnly = 0) { char *P; int L; const size_t LOpen = strlen(Open); const size_t LClose = strlen(Close); int StateLen; hsState *StateMap; int CountX[3] = { 0, 0, 0 }; int didMatch = 0; *OLine = Row; *OPos = 0; while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return -1; for (int Pos = (int)L - 1; Pos >= 0; Pos--) { if (P[Pos] != ' ' && P[Pos] != 9) { if (StateMap[Pos] == hsC_Normal) { switch (P[Pos]) { case '{': CountX[0]--; break; case '}': CountX[0]++; break; case '(': CountX[1]--; break; case ')': CountX[1]++; break; case '[': CountX[2]--; break; case ']': CountX[2]++; break; } } if (!matchparens || (CountX[0] == 0 && CountX[1] == 0 && CountX[2] == 0)) { if (LOpen + Pos <= L) { if (IsState(StateMap + Pos, State, LOpen)) { if (memcmp(P + Pos, Open, LOpen) == 0) Count++; if (Count == 0) { if (bolOnly) didMatch = 1; else { *OPos = B->ScreenPos(B->RLine(Row), Pos); *OLine = Row; free(StateMap); return B->LineIndented(Row); } } } if (LClose + Pos <= L) { if (IsState(StateMap + Pos, State, LClose)) { if (memcmp(P + Pos, Close, LClose) == 0) Count--; } } } } } } if (bolOnly && didMatch && CountX[1] == 0 && CountX[2] == 0) { *OPos = 0; *OLine = Row; free(StateMap); return B->LineIndented(Row); } if (StateMap) free(StateMap); Row--; } return -1; } static int FindPrevIndent(EBuffer *B, int &RowP, int &ColP, char &CharP, int Flags) { //LOG << "Flags: " << hex << Flags << dec << ENDLINE; int StateLen; hsState *StateMap = 0; char *P; int L; int Count[4] = { 0, // { } 0, // ( ) 0, // [ ] 0, // if/else (one if for each else) }; assert(RowP >= 0 && RowP < B->RCount); L = B->RLine(RowP)->Count; if (ColP >= L) ColP = L - 1; assert(ColP >= -1 && ColP <= L); char BolChar = ' '; int BolCol = -1; int BolRow = -1; while (RowP >= 0) { P = B->RLine(RowP)->Chars; L = B->RLine(RowP)->Count; StateMap = NULL; if (B->GetMap(RowP, &StateLen, &StateMap) == 0) { //LOG << "Can't get state maps" << ENDLINE; return 0; } if (L > 0) while (ColP >= 0) { //LOG << "ColP: " << ColP << " State: " << (int)StateMap[ColP] << ENDLINE; if (StateMap[ColP] == hsC_Normal) { //LOG << "CharP: " << BinChar(P[ColP]) << " BolChar: " << BinChar(BolChar) << // " BolRow: " << BolRow << // " BolCol: " << BolCol << // ENDLINE; switch (CharP = P[ColP]) { case '{': if (BolChar == ':' || BolChar == ',') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); return 1; } if (TEST_ZERO) { free(StateMap); return 1; } Count[0]--; break; case '}': if (BolChar == ':' || BolChar == ',') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); return 1; } if (BolChar == ';') { CharP = BolChar; ColP = BolCol; RowP = BolRow; free(StateMap); return 1; } if (ColP == 0) { /* speed optimization */ free(StateMap); return 1; } if (TEST_ZERO && (Flags & FIND_ENDBLOCK)) { free(StateMap); return 1; } Count[0]++; break; case '(': if (TEST_ZERO) { free(StateMap); return 1; } Count[1]--; break; case ')': Count[1]++; break; case '[': if (TEST_ZERO) { free(StateMap); return 1; } Count[2]--; break; case ']': Count[2]++; break; case ':': if (ColP >= 1 && P[ColP - 1] == ':') { // skip :: ColP -= 2; continue; } /* pass through (case:)*/ case ',': case ';': if (TEST_ZERO && BolChar == ' ') { if ((CharP == ';' && (Flags & FIND_SEMICOLON)) || (CharP == ',' && (Flags & FIND_COMMA)) || (CharP == ':' && (Flags & FIND_COLON))) { BolChar = CharP; BolCol = ColP; BolRow = RowP; // this should be here // if not say why ??? //free(StateMap); //return 1; } } if (BolChar == ',' && CharP == ':') { BolChar = ' '; BolCol = -1; BolRow = -1; break; } if ((BolChar == ':' || BolChar == ',') && (CharP == ';'/* || CharP == ','*/)) { CharP = ':'; ColP = BolCol; RowP = BolRow; free(StateMap); return 1; } break; case '?': if ((Flags & FIND_QUESTION)) { PRINTF(("FOUND ?")); if (BolChar == ':' || BolChar == ',') { BolChar = ' '; BolCol = -1; BolRow = -1; } } break; } } else if (StateMap[ColP] == hsC_Keyword && (BolChar == ' ' || BolChar == ':')) { if (L - ColP >= 2 && IsState(StateMap + ColP, hsC_Keyword, 2) && memcmp(P + ColP, "if", 2) == 0) { //puts("\nif"); if (Count[3] > 0) Count[3]--; if (Flags & FIND_IF) { if (TEST_ZERO) { CharP = 'i'; free(StateMap); return 1; } } } if (L - ColP >= 4 && IsState(StateMap + ColP, hsC_Keyword, 4) && memcmp(P + ColP, "else", 4) == 0) { //puts("\nelse\x7"); if (Flags & FIND_ELSE) { if (TEST_ZERO) { CharP = 'e'; free(StateMap); return 1; } } Count[3]++; } if (TEST_ZERO) { if ((Flags & FIND_FOR) && L - ColP >= 3 && IsState(StateMap + ColP, hsC_Keyword, 3) && memcmp(P + ColP, "for", 3) == 0) { CharP = 'f'; free(StateMap); return 1; } if ((Flags & FIND_WHILE) && L - ColP >= 5 && IsState(StateMap + ColP, hsC_Keyword, 5) && memcmp(P + ColP, "while", 5) == 0) { CharP = 'w'; free(StateMap); return 1; } if ((Flags & FIND_SWITCH) && L - ColP >= 6 && IsState(StateMap + ColP, hsC_Keyword, 6) && memcmp(P + ColP, "switch", 6) == 0) { CharP = 's'; free(StateMap); return 1; } if (((Flags & FIND_CASE) || (BolChar == ':')) && (((L - ColP >= 4) && IsState(StateMap + ColP, hsC_Keyword, 4) && memcmp(P + ColP, "case", 4) == 0) || ((L - ColP >= 7) && IsState(StateMap + ColP, hsC_Keyword, 7) && memcmp(P + ColP, "default", 7) == 0))) { CharP = 'c'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); return 1; } if (((Flags & FIND_CLASS) || (BolChar == ':')) && (L - ColP >= 5 && IsState(StateMap + ColP, hsC_Keyword, 5) && memcmp(P + ColP, "class", 5) == 0)) { CharP = 'l'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); return 1; } if (((Flags & FIND_CLASS) || (BolChar == ':')) && ((L - ColP >= 6 && IsState(StateMap + ColP, hsC_Keyword, 6) && memcmp(P + ColP, "public", 6) == 0) || ((L - ColP >= 7) && IsState(StateMap + ColP, hsC_Keyword, 7) && memcmp(P + ColP, "private", 7) == 0) || ((L - ColP >= 9) && IsState(StateMap + ColP, hsC_Keyword, 9) && memcmp(P + ColP, "protected", 9) == 0))) { CharP = 'p'; if (BolChar == ':') { CharP = BolChar; ColP = BolCol; RowP = BolRow; } free(StateMap); return 1; } } } ColP--; } free(StateMap); if (BolChar != ' ' && BolChar != ':' && BolChar != ',') { CharP = BolChar; ColP = BolCol; return 1; } RowP--; if (RowP >= 0) { L = B->RLine(RowP)->Count; ColP = L - 1; } } #undef TEST_ZERO return 0; } #define SKIP_FORWARD 0 #define SKIP_BACK 1 #define SKIP_MATCH 2 #define SKIP_LINE 4 #define SKIP_TOBOL 8 static int SkipWhite(EBuffer *B, int Bottom, int &Row, int &Col, int Flags) { char *P; int L; int StateLen; hsState *StateMap; int Count[3] = { 0, 0, 0 }; assert (Row >= 0 && Row < B->RCount); L = B->RLine(Row)->Count; if (Col >= L) Col = L; assert (Col >= -1 && Col <= L) ; while (Row >= 0 && Row < B->RCount) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return 0; if (L > 0) for ( ; Col >= 0 && Col < L; Col += ((Flags & SKIP_BACK) ? -1 : +1)) { if (P[Col] == ' ' || P[Col] == '\t') continue; if (StateMap[Col] != hsC_Normal && StateMap[Col] != hsC_Keyword && StateMap[Col] != hsC_String1 && StateMap[Col] != hsC_String2) continue; if (StateMap[Col] == hsC_Normal && (Flags & SKIP_MATCH)) { switch (P[Col]) { case '{': Count[0]--; continue; case '}': Count[0]++; continue; case '(': Count[1]--; continue; case ')': Count[1]++; continue; case '[': Count[2]--; continue; case ']': Count[2]++; continue; } } if (Count[0] == 0 && Count[1] == 0 && Count[2] == 0 && !(Flags & SKIP_TOBOL)) { free(StateMap); return 1; } } free(StateMap); if (Count[0] == 0 && Count[1] == 0 && Count[2] == 0 && (Flags & SKIP_TOBOL)) return 1; if (Flags & SKIP_LINE) { return 1; } if (Flags & SKIP_BACK) { Row--; if (Row >= 0) { L = B->RLine(Row)->Count; Col = L - 1; } } else { if (Row + 1 >= Bottom) return 1; Row++; Col = 0; } } return 0; } static int IndentNormal(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0; int Pos, L; if (LookAt(B, Line, 0, "case", hsC_Keyword) || LookAt(B, Line, 0, "default", hsC_Keyword)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L) + C_CASE_OFS; return I; } else if (LookAt(B, Line, 0, "public:", hsC_Keyword, 0) || LookAt(B, Line, 0, "private:", hsC_Keyword, 0) || LookAt(B, Line, 0, "protected:", hsC_Keyword, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L) + C_CLASS_OFS; return I; } else if (LookAt(B, Line, 0, "else", hsC_Keyword)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Keyword, "if", "else", &Pos, &L, 1); return I; } else if (LookAt(B, Line, 0, "}", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "{", "}", &Pos, &L, 0, 1); return I; } else if (LookAt(B, Line, 0, ")", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "(", ")", &Pos, &L); if (C_PAREN_DELTA >= 0) return I + C_PAREN_DELTA; else return Pos; } else if (LookAt(B, Line, 0, "]", hsC_Normal, 0)) { I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, "[", "]", &Pos, &L); if (C_PAREN_DELTA >= 0) return I + C_PAREN_DELTA; else return Pos; } else { char CharP = ' '; // char FirstCharP = ' '; int RowP = Line; int ColP = -1; int PrevRowP = RowP; int PrevColP = ColP; int FirstRowP; int FirstColP; int ContinuationIndent = 0; if (SkipWhite(B, Line, PrevRowP, PrevColP, SKIP_BACK) != 1) return 0; PrevColP++; //LOG << "PrevRowP=" << PrevRowP << ", PrevColP=" << PrevColP << ENDLINE; if (FindPrevIndent(B, RowP, ColP, CharP, FIND_IF | FIND_ELSE | FIND_FOR | FIND_WHILE | FIND_SWITCH | FIND_CASE | //FIND_CLASS | FIND_COLON | FIND_SEMICOLON | FIND_COMMA | FIND_ENDBLOCK) != 1) { //LOG << "Found: " << ENDLINE; if (RowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I = 0; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I += C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; } FirstRowP = RowP; FirstColP = ColP; // FirstCharP = CharP; //LOG << "FirstRowP=" << FirstRowP << ", FirstColP=" << FirstColP << // ", CharP=" << BinChar(CharP) << ENDLINE; switch (CharP) { case 'c': I = B->LineIndented(RowP) + C_CONTINUATION; return I; case '(': case '[': if (C_PAREN_DELTA >= 0) { I = B->LineIndented(FirstRowP) + C_PAREN_DELTA; } else { ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | SKIP_LINE) != 1) return 0; if (ColP < B->LineChars(RowP) || !FunctionUsesContinuation) { char strLeft[2] = { CharP, 0 }; char strRight[2] = { CharP == '(' ? ')' : ']', 0 }; I = SearchBackMatch(-1, B, Line - 1, hsC_Normal, strLeft, strRight, &Pos, &L); I = Pos + 1; } else { I = B->LineIndented(RowP) + C_CONTINUATION; } } return I; case '{': ColP++; if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; ColP--; ColP--; if (SkipWhite(B, Line, RowP, ColP, SKIP_BACK | SKIP_TOBOL | SKIP_MATCH) != 1) return 0; I = B->LineIndented(RowP); if (B->LineIndented(FirstRowP) <= C_FIRST_WIDTH) I += C_FIRST_INDENT; else I += C_INDENT; PRINTF(("'{' indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; else I += ContinuationIndent; return I; case ',': I = B->LineIndented(FirstRowP); return I; case '}': ColP++; ColP++; /*---nobreak---*/ case ';': ColP--; if (FindPrevIndent(B, RowP, ColP, CharP, ((CharP == ',') ? FIND_COMMA | FIND_COLON : //(CharP == ';') ? FIND_SEMICOLON | FIND_COLON : FIND_SEMICOLON | FIND_COLON)) != 1) { if (FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I = 0; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I += C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; } PRINTF(("';' Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); switch (CharP) { case ',': case ';': case '{': case ':': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; //ColP--; //if (SkipWhite(B, RowP, ColP, SKIP_BACK) != 1) //if (CharP == ':') { // I -= C_COLON_OFS; //} PRINTF(("';' indent : Line=%d, RowP=%d, ColP=%d, CharP=%c Ind=%d\n", Line, RowP, ColP, CharP, I)); I = B->LineIndented(RowP); if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { //I -= C_BRACE_OFS; ContinuationIndent = 0; } if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= 0; //C_BRACE_OFS; else if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && !LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I += C_BRACE_OFS; else if (!LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; break; case '(': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | SKIP_LINE) != 1) return 0; I = B->ScreenPos(B->RLine(RowP), ColP); break; default: I = B->LineIndented(RowP); break; } PRINTF(("';' -- indent : Line=%d, RowP=%d, ColP=%d, CharP=%c Ind2=%d\n", Line, RowP, ColP, CharP, I)); // else // if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) // I += C_INDENT - C_BRACE_OFS; return I + ContinuationIndent; #if 1 case ':': ColP--; PRINTF(("COL-- %d\n", ColP)); if (FindPrevIndent(B, RowP, ColP, CharP, FIND_SEMICOLON | FIND_COLON | FIND_QUESTION | FIND_CLASS | FIND_CASE) != 1) { PRINTF(("FOUNPRE \n")); if (FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; return 0 + ContinuationIndent; } PRINTF(("':' Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); switch (CharP) { case ':': /*ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; I = B->LineIndented(RowP);// - C_COLON_OFS; PRINTF(("':' 0 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break;*/ case '{': case ';': ColP++; if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) return 0; I = B->LineIndented(RowP); PRINTF(("!!! FirstRowP=%d, PrevRowP=%d, RowP=%d, I=%d\n", FirstRowP, PrevRowP, RowP, I)); PRINTF(("!!! FirstColP=%d, PrevColP=%d, ColP=%d\n", FirstColP, PrevColP, ColP)); if (CheckLabel(B, RowP)) { PRINTF(("CHECKEDLABEL1\n")); I -= C_COLON_OFS; } else if (PrevRowP == RowP && FirstRowP == PrevRowP && FirstColP + 1 == PrevColP) I += C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= 0;//C_BRACE_OFS; else if (LookAt(B, Line, 0, "{", hsC_Normal, 0) && !LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I += C_BRACE_OFS; else if (!LookAt(B, Line, 0, "{", hsC_Normal, 0) && LookAt(B, RowP, ColP, "{", hsC_Normal, 0)) I -= C_BRACE_OFS; PRINTF(("':' 1 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c BRACE %d\n", Line, RowP, ColP, CharP, I)); break; case 'p': ColP++; //if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) // return 0; I = B->LineIndented(RowP) + C_CLASS_DELTA; // if (FirstRowP == RowP) { // I += C_CLASS_DELTA; /// if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { /// I += C_INDENT - C_BRACE_OFS; /// } // } PRINTF(("':' 2 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break; case 'l': ColP++; I = B->LineIndented(RowP) + C_BRACE_OFS; //C_CLASS_OFS + C_CLASS_DELTA; break; case 'c': ColP++; // if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD) != 1) // return 0; I = B->LineIndented(RowP) + C_CASE_DELTA; // if (FirstRowP == RowP) { // I += C_CASE_DELTA; /// if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { /// I += C_INDENT - C_BRACE_OFS; /// } // } PRINTF(("':' 3 indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); break; default: I = B->LineIndented(RowP); break; } if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { //I -= C_INDENT - C_BRACE_OFS; ContinuationIndent = 0; } PRINTF(("':' -- indent : Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); return I + ContinuationIndent; #endif case 'i': case 's': case 'f': case 'e': case 'w': I = B->LineIndented(RowP); switch (CharP) { case 'i': ColP += 2; break; // if case 'f': ColP += 3; break; // for case 'e': ColP += 4; break; // else case 'w': ColP += 5; break; // while case 's': ColP += 6; break; // switch } PRINTF(("'ifews' -- indent 1: Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (SkipWhite(B, Line, RowP, ColP, SKIP_FORWARD | (CharP != 'e' ? SKIP_MATCH : 0)) != 1) return 0; if (RowP >= Line) { RowP = Line; ColP = -1; } else ColP--; if (SkipWhite(B, Line, RowP, ColP, SKIP_BACK) != 1) return 0; ColP++; PRINTF(("'ifews' -- indent 2: Line=%d, RowP=%d, ColP=%d, CharP=%c\n", Line, RowP, ColP, CharP)); if (((PrevRowP != RowP) || ((PrevRowP == RowP) && (PrevColP != ColP))) && FirstRowP != PrevRowP) ContinuationIndent = C_CONTINUATION; I += C_INDENT; if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { I -= C_INDENT - C_BRACE_OFS; ContinuationIndent = 0; } return I + ContinuationIndent; // default: return 0; } } return 0; } static int IndentComment(EBuffer *B, int Row, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0, R; //puts("Comment"); if (Row > 0) { R = Row - 1; while (R >= 0) { if (B->RLine(R)->Count == 0) R--; else { I = B->LineIndented(R); break; } } if (B->RLine(Row - 1)->StateE == hsC_Comment) if (LookAt(B, Row - 1, I, "/*", hsC_Comment, 0)) I += C_COMMENT_DELTA; if (B->RLine(Row - 1)->StateE == hsC_CPP_Comm) if (LookAt(B, Row - 1, I, "/*", hsC_CPP_Comm, 0)) I += C_COMMENT_DELTA; } return I; } static int IndentCPP(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { if (LookAt(B, Line, 0, "#", hsC_CPP, 0)) return 0; else return C_INDENT; } int Indent_C(EBuffer *B, int Line, int PosCursor) { int I; hsState *StateMap = NULL; int StateLen = 0; int OI; OI = I = B->LineIndented(Line); if (Line == 0) { I = 0; } else { if (I != 0) B->IndentLine(Line, 0); if (B->GetMap(Line, &StateLen, &StateMap) == 0) return 0; switch (B->RLine(Line - 1)->StateE) { case hsC_Comment: case hsC_CPP_Comm: I = IndentComment(B, Line, StateLen, StateMap); break; case hsC_CPP: /*case hsC_CPP_Comm:*/ case hsC_CPP_String1: case hsC_CPP_String2: case hsC_CPP_ABrace: I = C_INDENT; break; default: if (StateLen > 0) { // line is not empty if (StateMap[0] == hsC_CPP || StateMap[0] == hsC_CPP_Comm || StateMap[0] == hsC_CPP_String1 || StateMap[0] == hsC_CPP_String2 || StateMap[0] == hsC_CPP_ABrace) { I = IndentCPP(B, Line, StateLen, 0); } else { I = IndentNormal(B, Line, StateLen, StateMap); if ((StateMap[0] == hsC_Comment || StateMap[0] == hsC_CommentL || StateMap[0] == hsC_CPP_Comm) && ((LookAt(B, Line, 0, "/*", hsC_Comment, 0) || LookAt(B, Line, 0, "/*", hsC_CPP_Comm, 0) || LookAt(B, Line, 0, "//", hsC_CommentL, 0)))) { I += C_COMMENT_OFS; } else if (CheckLabel(B, Line)) { if (LookAt(B, Line, 0, "case", hsC_Keyword) || LookAt(B, Line, 0, "default", hsC_Keyword) || LookAt(B, Line, 0, "public:", hsC_Keyword, 0) || LookAt(B, Line, 0, "private:", hsC_Keyword, 0) || LookAt(B, Line, 0, "protected:", hsC_Keyword, 0)) ; else I += C_COLON_OFS; } //else if (LookAt(B, Line, 0, "{", hsC_Normal, 0)) { // I -= C_INDENT - C_BRACE_OFS; //} } } else { I = IndentNormal(B, Line, 0, NULL); } break; } } if (StateMap) free(StateMap); if (I >= 0) B->IndentLine(Line, I); else I = 0; if (PosCursor == 1) { int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; if (X > B->LineLen(Line)) { X = B->LineLen(Line); if (X < I) X = I; } if (B->SetPosR(X, Line) == 0) return 0; } else if (PosCursor == 2) { if (B->SetPosR(I, Line) == 0) return 0; } return 1; } #endif // CONFIG_INDENT_C #endif // CONFIG_HILIT_C ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clipprog.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000002676�07045070636�013007� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clipprog.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define INCL_DOS #define INCL_PM #include <os2.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <process.h> #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 HAB hab; HMQ hmq; QMSG qmsg; HMTX hmtxSyn; HEV hevGet; HEV hevPut; HEV hevEnd; HMUX hmuxWait; void clipsrv(void *foo) { HAB hab; HMQ hmq; ULONG Cmd; ULONG len; char *text; void *shmem = "the text"; hab = NULLHANDLE; if ((WinOpenClipbrd(hab) == TRUE) && ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0)) { DosGetSharedMem(text, PAG_READ); len = strlen(text); puts(text); } WinCloseClipbrd(hab); len = strlen(shmem); if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE | OBJ_GETTABLE); strcpy(text, shmem); } if (WinOpenClipbrd(hab) == TRUE) { if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); WinCloseClipbrd(hab); } } int main() { clipsrv(NULL); return 0; } ������������������������������������������������������������������./src/e_regex.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000007765�11602724002�012242� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_regex.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef E_REGEX_H #define E_REGEX_H #include <stddef.h> /* * Operator: * * ^ Match the beginning of line * $ Match the end of line * . Match any character * [ ] Match characters in set * [^ ] Match characters not in set * ? Match previous pattern 0 or 1 times (greedy) * | Match previous or next pattern * @ Match previous pattern 0 or more times (non-greedy) * # Match previous pattern 1 or more times (non-greedy) * * Match previous pattern 0 or more times (greedy) * + Match previous pattern 1 or more times (greedy) * { } Group characters to form one pattern * ( ) Group and remember * \ Quote next character (only of not a-z) * < Match beginning of a word * > Match end of a word * \x## Match character with ASCII code ## (hex) * \N### Match ascii code ### (dec) * \o### Match ascii code * \a Match \a * \b Match \b * \f Match \f * \n Match 0x0a (lf) * \r Match 0x0d (cr) * \t Match 0x09 (tab) * \v Match \v * \e Match escape (^E) * \s Match whitespace (cr/lf/tab/space) * \S Match nonwhitespace (!\S) * \w Match word character * \W Match non-word character * \d Match digit character * \D Match non-digit character * \U Match uppercase * \L Match lowercase * \C Match case sensitively from here on * \c Match case ingnore from here on */ // *INDENT-OFF* #define RE_NOTHING 0 // nothing #define RE_JUMP 1 // jump to #define RE_BREAK 2 // break | #define RE_ATBOL 3 // match at beginning of line #define RE_ATEOL 4 // match at end of line #define RE_ATBOW 5 // match beginning of word #define RE_ATEOW 6 // match end of word #define RE_CASE 7 // match case sensitively from here #define RE_NCASE 8 // ignore case from here. #define RE_END 31 // end of regexp #define RE_ANY (32 + 1) // match any character #define RE_INSET (32 + 2) // match if in set #define RE_NOTINSET (32 + 3) // match if not in set #define RE_CHAR (32 + 4) // match character string #define RE_WSPACE (32 + 5) // match whitespace #define RE_NWSPACE (32 + 6) // match whitespace #define RE_UPPER (32 + 7) // match uppercase #define RE_LOWER (32 + 8) // match lowercase #define RE_DIGIT (32 + 9) // match digit #define RE_NDIGIT (32 + 10) // match non-digit #define RE_WORD (32 + 11) // match word #define RE_NWORD (32 + 12) // match non-word #define RE_GROUP 256 // grouping #define RE_OPEN 512 // open ( #define RE_CLOSE 1024 // close ) #define RE_MEM 2048 // store () match #define RE_BRANCH 4096 #define RE_GREEDY 2048 // do a greedy match (as much as possible) #define NSEXPS 64 // for replace only 0-9 #define RX_CASE 1 // matchcase // *INDENT-ON* struct RxNode { short fWhat; short fLen; RxNode *fPrev; RxNode *fNext; union { char *fChar; RxNode *fPtr; }; }; struct RxMatchRes { int Open[NSEXPS]; // -1 = not matched int Close[NSEXPS]; }; RxNode *RxCompile(const char *Regexp); int RxExecMatch(RxNode *Regexp, const char *Data, size_t Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt = RX_CASE); int RxExec(RxNode *Regexp, const char *Data, size_t Len, const char *Start, RxMatchRes *Match, unsigned int RxOpt = RX_CASE); int RxReplace(const char *rep, const char *Src, size_t len, RxMatchRes match, char **Dest, size_t *Dlen); void RxFree(RxNode *Node); #endif // E_REGEX_H �����������./src/e_line.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000011457�11602724002�012403� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_line.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_buflist.h" #include "sysdep.h" ELine::ELine(size_t ACount, const char *AChars) : Count(ACount), Chars(NULL) #ifdef CONFIG_SYNTAX_HILIT , StateE(0) #endif { Allocate(Count); if (AChars) memcpy(Chars, AChars, Count); else memset(Chars, ' ', Count); } ELine::ELine(char *AChars, size_t ACount) : Count(ACount), Chars(AChars) #ifdef CONFIG_SYNTAX_HILIT , StateE(0) #endif { } ELine::~ELine() { free(Chars); } int ELine::Allocate(size_t Bytes) { Chars = (char*)realloc(Chars, Bytes | CHAR_TRESHOLD); return (Chars != NULL); } int EBuffer::ScreenPos(ELine *L, int Offset) { int ExpandTabs = BFI(this, BFI_ExpandTabs); int TabSize = BFI(this, BFI_TabSize); if (!ExpandTabs) return Offset; char *p = L->Chars; int Len = L->Count; int Pos = 0; int Ofs = Offset; if (Ofs > Len) { while (Len > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); Len--; } Pos += Ofs - L->Count; } else while (Ofs > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); Ofs--; } return Pos; } int EBuffer::CharOffset(ELine *L, int ScreenPos) { int ExpandTabs = BFI(this, BFI_ExpandTabs); int TabSize = BFI(this, BFI_TabSize); if (!ExpandTabs) return ScreenPos; int Pos = 0; int Ofs = 0; char *p = L->Chars; int Len = L->Count; while (Len > 0) { if (*p++ != '\t') Pos++; else Pos = NextTab(Pos, TabSize); if (Pos > ScreenPos) return Ofs; Ofs++; Len--; } return Ofs + ScreenPos - Pos; } int EBuffer::Allocate(int ACount) { PELine *L; if (ACount > 10 * 1024 * 1024) // FIXME: - let's crash, before OOOM kills us return 0; L = (PELine *) realloc(LL, sizeof(PELine) * (ACount + 1)); if (!L && ACount != 0) return 0; RAllocated = ACount; LL = L; return 1; } int EBuffer::MoveRGap(int RPos) { int GapSize = RAllocated - RCount; if (RGap == RPos) return 1; if (RPos < 0 || RPos > RCount) return 0; if (RGap < RPos) { if (RPos - RGap == 1) LL[RGap] = LL[RGap + GapSize]; else memmove(LL + RGap, LL + RGap + GapSize, sizeof(PELine) * (RPos - RGap)); } else { if (RGap - RPos == 1) LL[RPos + GapSize] = LL[RPos]; else memmove(LL + RPos + GapSize, LL + RPos, sizeof(PELine) * (RGap - RPos)); } RGap = RPos; return 1; } int EBuffer::AllocVis(int ACount) { int *V = (int *) realloc(VV, sizeof(int) * (ACount + 1)); if (!V && ACount != 0) return 0; VAllocated = ACount; VV = V; return 1; } int EBuffer::MoveVGap(int VPos) { int GapSize = VAllocated - VCount; if (VGap == VPos) return 1; if (VPos < 0 || VPos > VCount) return 0; if (VGap < VPos) { if (VPos - VGap == 1) VV[VGap] = VV[VGap + GapSize]; else memmove(VV + VGap, VV + VGap + GapSize, sizeof(VV[0]) * (VPos - VGap)); } else { if (VGap - VPos == 1) { VV[VPos + GapSize] = VV[VPos]; } else { memmove(VV + VPos + GapSize, VV + VPos, sizeof(VV[0]) * (VGap - VPos)); } } VGap = VPos; return 1; } int EBuffer::RToV(int No) { int L = 0, R = VCount, M, V; if (No > Vis(VCount - 1) + VCount - 1) // beyond end return -1; if (No < VCount) // no folds before (direct match) if (Vis(No) == 0) return No; while (L < R) { M = (L + R) / 2; V = Vis(M) + M; if (V == No) return M; if (V > No) R = M; else L = M + 1; } return -1; } int EBuffer::RToVN(int No) { int L = 0, R = VCount, M, V; if (No == RCount) return VCount; if (No > Vis(VCount - 1) + VCount - 1) return VCount - 1; if (No < VCount) if (Vis(No) == 0) return No; while (L < R) { M = (L + R) / 2; V = Vis(M) + M; if (V == No) return M; else if (V > No) R = M; else { if (M == VCount - 1) return M; else if (Vis(M + 1) + M + 1 > No) return M; L = M + 1; } } return R; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_color.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000003252�11331412501�012224� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_color.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_COLOR_H #define C_COLOR_H #include "c_mode.h" extern ChColor hcStatus_Normal; extern ChColor hcStatus_Active; extern ChColor hcPlain_Normal; extern ChColor hcPlain_Background; extern ChColor hcPlain_Selected; extern ChColor hcPlain_Markers; extern ChColor hcPlain_Found; extern ChColor hcPlain_Keyword; extern ChColor hcPlain_Folds[5]; extern ChColor hcPlain_HilitWord; extern ChColor hcPlain_Bookmark; extern ChColor hcEntry_Field; extern ChColor hcEntry_Prompt; extern ChColor hcEntry_Selection; //extern ChColor hcList_Border; extern ChColor hcList_Status; extern ChColor hcList_Normal; extern ChColor hcList_Selected; extern ChColor hcList_Hilited; extern ChColor hcList_HilitSelect; extern ChColor hcList_Marked; extern ChColor hcList_MarkSelect; extern ChColor hcList_MarkHilit; extern ChColor hcList_MarkHilitSel; extern ChColor hcScrollBar_Arrows; extern ChColor hcScrollBar_Back; extern ChColor hcScrollBar_Fore; extern ChColor hcAsciiChars; extern ChColor hcMenu_Background; extern ChColor hcMenu_ActiveItem; extern ChColor hcMenu_ActiveChar; extern ChColor hcMenu_NormalItem; extern ChColor hcMenu_NormalChar; extern ChColor hcChoice_Title; extern ChColor hcChoice_Param; extern ChColor hcChoice_Background; extern ChColor hcChoice_ActiveItem; extern ChColor hcChoice_ActiveChar; extern ChColor hcChoice_NormalItem; extern ChColor hcChoice_NormalChar; extern ChColor MsgColor[3]; int SetColor(const char *ChColor, const char *Value); #endif // C_COLOR_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/log.h�����������������������������������������������������������������������������������������0000644�0001750�0001750�00000020102�11331412505�011362� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������// // General Logging... IN A CLASS! :-) // /******************************************************************** The author, Darin McBride, explicitly places this module under the LGPL license. This module must remain free for use, but will not cause software that uses it to be required to be under the GPL or any of its derivitives. ********************************************************************/ /** Class-based, OO-based logging This is intended to be used as a trace utility in C++, if you follow the following conventions. Note that all macros are intended to work like function calls - so you still need the terminating semicolon. At the top of each function, you must use STARTFUNC(x). The parameter to this macro is the name of the function. For example, STARTFUNC("main"). At the end of each function, or wherever you return from, use one of: ENDFUNCRC - trace the return code ENDFUNCRC_SAFE - same as above, but can be used when returning the value of something with side effects ENDFUNCAS - trace the return code, but pretend it's a different type ENDFUNCAS_SAFE - trace the return code of something with side effects, as if it were another type. Finally, to log trace points throughout your code, use the LOG() macro as if it were an ostream. To terminate each line, do not use endl, but use the ENDLINE macro. Yes, currently it's the same thing, but I'm reserving the right to change that in the future. For example: int main() { STARTFUNC("main"); LOG << "About to call foo" << ENDLINE; SomeObjectType baz; foo(baz); ENDFUNCRC(0); // no return - the macro does this for us. } void foo(SomeObjectType bar) { STARTFUNC("foo") // assumes bar has some meaningful way to be put into an ostream: LOG << "bar = " << bar << ENDLINE; // as void, no need to endfunc. } ENDFUNCRC_SAFE is used such as: ENDFUNCRC_SAFE(foo++); // side effect only happens once. // was: return foo++ The AS versions are only used to log as a different type than it currently is. For example, to log a HANDLE as if it were an unsigned long: HANDLE foo; ENDFUNCAS(unsigned long, foo); // was: return foo Finally, ENDFUNCAS_SAFE: ENDFUNCAS_SAFE(HANDLE, unsigned long, GetNextHandle()); // was: return GetNextHandle() */ #ifndef LOGGING_HPP #define LOGGING_HPP #if defined(NO_NEW_CPP_FEATURES) #include <fstream.h> #include <assert.h> #else #include <fstream> #include <cassert> #endif #ifndef FTE_NO_LOGGING #if !defined(NO_NEW_CPP_FEATURES) using namespace std; #endif /** * GlobalLog handles the actual logging. */ class GlobalLog { friend class FunctionLog; private: char* m_strLogFile; ofstream m_ofsLog; bool m_bOpened; int indent; ostream& operator()(); public: GlobalLog() : m_strLogFile(NULL), m_bOpened(false) {} GlobalLog(char const* strLogFile); virtual ~GlobalLog(); void SetLogFile(char const* strNewLogFile); operator bool() { return !m_ofsLog.fail(); } protected: bool OpenLogFile(); // actually open it }; extern GlobalLog globalLog; /** * FunctionLog is the local object that handles logging inside a function. * All work is put through here. */ class FunctionLog { private: GlobalLog& log; char const* func; int myIndentLevel; char indentChar; public: // Enter: FunctionLog(GlobalLog& gl, const char* funcName, unsigned long line); // Exit: ~FunctionLog(); // RC? ostream& RC(unsigned long line); private: ostream& OutputLine() { return OutputIndent(log()) << '[' << func << "] "; } public: // output line. ostream& OutputLine(unsigned long line) { return OutputLine() << '{' << line << "} "; } private: ostream& OutputIndent(ostream& os); }; #define LOGOBJNAME functionLog__obj #define LOG LOGOBJNAME.OutputLine(__LINE__) #define ENDLINE endl #define STARTFUNC(func) FunctionLog LOGOBJNAME(globalLog, func, __LINE__) #define ENDFUNCRC(rc) do { LOGOBJNAME.RC(__LINE__) << (rc) << ENDLINE; return (rc); } while (0) #define ENDFUNCRC_SAFE(type,rc) do { type LOG__RC = (rc); LOGOBJNAME.RC(__LINE__) << LOG__RC << ENDLINE; return LOG__RC; } while (0) #define ENDFUNCAS(type,rc) do { LOGOBJNAME.RC(__LINE__) << (type)(rc) << ENDLINE; return (rc); } while (0) #define ENDFUNCAS_SAFE(logtype,rctype,rc) do { rctype LOG__RC = (rc); LOGOBJNAME.RC(__LINE__) << (logtype)LOG__RC << ENDLINE; return LOG__RC; } while (0) #define BOOLYESNO(x) ((x) ? "YES" : "NO") /********************************************************************/ /* Utility ostream functions. These are functions that only have anything to do with logging because logging is the only place we use IO streams. They're here to make tracing easier to capture more information. ********************************************************************** FUNCTION BinChar(char) CLASS IO Manipulator SAMPLE LOG << "this char is: " << BinChar(CharP) << ENDLINE; DESCRIPTION BinChar will insert the character followed by the hex value in brackets. If the character is non-printable, it will display as a dot. ********************************************************************** FUNCTION FillChar(char, length) CLASS IO Manipulator SAMPLE LOG << FillChar('*', 50) << ENDLINE; DESCRIPTION FillChar is available for pretty-printing. Use sparingly, if at all. ********************************************************************** FUNCTION LOGBINARYDATA(char*, int len) CLASS Macro SAMPLE LOG << "The value of some_binary_data is:" << ENDLINE LOGBINARYDATA(some_binary_data, int len); DESCRIPTION This macro will log some structure or array in basically a memory-dump style: 8 characters, followed by 8 hex values. If any character is non-printable, it will display as a dot. ********************************************************************** */ #define DECLARE_OSTREAM_FUNC1(type1) \ class ostream_func1_##type1 { \ private: \ ostream& (*osfunc)(ostream&, type1 const&); \ type1 const& o1; \ public: \ ostream_func1_##type1(ostream& (*osfunc_)(ostream&, type1 const&), type1 const& o1_) : osfunc(osfunc_), o1(o1_) {} \ ostream& operator()(ostream& os) const { return osfunc(os, o1); } \ }; \ inline ostream& operator <<(ostream& os, ostream_func1_##type1 const& ofunc) \ { return ofunc(os); } #define DECLARE_OSTREAM_FUNC2(type1,type2) \ class ostream_func2_##type1##_##type2 { \ private: \ ostream& (*osfunc)(ostream&, type1 const&, type2 const&); \ type1 const& o1; \ type2 const& o2; \ public: \ ostream_func2_##type1##_##type2(ostream& (*osfunc_)(ostream&, type1 const&, type2 const&), \ type1 const& o1_, type2 const& o2_) : \ osfunc(osfunc_), o1(o1_), o2(o2_) {} \ ostream& operator()(ostream& os) const { return osfunc(os, o1, o2); } \ }; \ inline ostream& operator <<(ostream& os, ostream_func2_##type1##_##type2 const& ofunc) \ { return ofunc(os); } DECLARE_OSTREAM_FUNC1(char); DECLARE_OSTREAM_FUNC2(char, size_t); ostream& Log__osBinChar(ostream&, char const&); inline ostream_func1_char BinChar(char c) { return ostream_func1_char(Log__osBinChar, c); } ostream& Log__osFillChar(ostream&, char const&, size_t const&); inline ostream_func2_char_size_t FillChar(char const& c, size_t const& num) { return ostream_func2_char_size_t(Log__osFillChar, c, num); } void Log__BinaryData(FunctionLog&, void* bin_data, size_t len, unsigned long line); #define LOGBINARYDATA(bin_data,len) Log__BinaryData(LOGOBJNAME,bin_data,len, __LINE__) #else // defined FTE_NO_LOGGING #include <iostream> #define LOG while (0) { std::cout #define ENDLINE std::endl; } #define STARTFUNC(func) #define ENDFUNCRC(rc) return rc #define ENDFUNCRC_SAFE(type,rc) return rc #define ENDFUNCAS(type,rc) return rc #define ENDFUNCAS_SAFE(logtype,rctype,rc) return rc #define BOOLYESNO(x) ((x) ? "YES" : "NO") //Replacements for utility functions. #define BinChar(c) c #define LOGBINARYDATA(b,l) #endif // FTE_NO_LOGGING #endif // LOGGING_HPP ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/cliputil.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000002361�11344266043�013000� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* cliputil.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "clip.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXCLIPTEXT 256 * 1024 /* just for demo */ char buffer[MAXCLIPTEXT]; int main(int argc, char **argv) { ClipData cd; int i; if ((argc == 2) && (strcmp(argv[1], "-s") == 0)) { cd.fLen = fread(buffer, 1, MAXCLIPTEXT, stdin); cd.fChar = buffer; if (PutClipText(&cd) == -1) { fprintf(stderr, "Coult not set clipboard text\n"); return 1; } } else if (argc == 1) { if (GetClipText(&cd) == 0) { if ((cd.fLen != 0) && cd.fChar) { printf("%s", cd.fChar); } } else { fprintf(stderr, "Could not get clipboard text\n"); return 1; } } else { fprintf(stderr, "Usage: %s {-s}\n" "\n" "Examples:\n" " cliputil | more\n" " dir | cliputil -s\n", argv[0]); return 1; } return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/egui.h����������������������������������������������������������������������������������������0000644�0001750�0001750�00000005055�11344266046�011557� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* egui.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef EGUI_H #define EGUI_H #include "gui.h" #include "c_bind.h" // KeySel class EEventMap; class EKeyMap; class GxView; class ExState; class EView; class EFrame: public GFrame { public: EEventMap *CMap; EModel *CModel; EFrame(int XSize, int YSize); virtual ~EFrame(); virtual void Update(); virtual void UpdateMenu(); }; class EGUI: public GUI { public: EKeyMap *ActiveMap; EKeyMap *OverrideMap; char CharMap[32]; EGUI(int &argc, char **argv, int XSize, int YSize); virtual ~EGUI(); virtual int ExecCommand(GxView *view, ExCommands Command, ExState &State); virtual int ExecMacro(GxView *view, int Macro); virtual int BeginMacro(GxView *view); void SetMsg(const char *Msg); void SetOverrideMap(EKeyMap *aMap, const char *ModeName); void SetMap(EKeyMap *aMap, KeySel *ks); // void CharEvent(TEvent &Event, char Ch); void DispatchKey(GxView *view, TEvent &Event); void DispatchCommand(GxView *view, TEvent &Event); virtual void DispatchEvent(GFrame *frame, GView *view, TEvent &Event); int FileCloseX(EView *View, int CreateNew, int XClose = 0); int FileClose(EView *View, ExState &State); int FileCloseAll(EView *View, ExState &State); int WinNext(GxView *view); int WinPrev(GxView *view); int WinHSplit(GxView *View); int WinClose(GxView *View); int WinZoom(GxView *View); int WinResize(ExState &State, GxView *View); int ExitEditor(EView *View); int FrameNew(); int FrameClose(GxView *View); int FrameNext(GxView *View); int FramePrev(GxView *View); int ShowEntryScreen(); int RunProgram(ExState &State, GxView *view); int RunProgramAsync(ExState &State, GxView *view); int MainMenu(ExState &State, GxView *View); int ShowMenu(ExState &State, GxView *View); int LocalMenu(GxView *View); int DesktopSaveAs(ExState &State, GxView *View); int findDesktop(char *argv[]); void DoLoadDesktopOnEntry(int &argc, char **argv); void EditorInit(); int CmdLoadFiles(int &argc, char **argv); int InterfaceInit(int &argc, char **argv); void DoLoadHistoryOnEntry(int &argc, char **argv); void DoSaveHistoryOnExit(); void EditorCleanup(); virtual int Start(int &argc, char **argv); virtual void Stop(); }; #endif // EGUI_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_cvslog.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000003125�11331412502�012405� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * e_cvslog.h * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Subclass of EBuffer for writing log for CVS commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #ifndef E_CVSLOG_H #define E_CVSLOG_H #include "e_buffer.h" #ifdef CONFIG_OBJ_CVS #include "c_config.h" class ECvsLog:public EBuffer { public: ECvsLog (int createFlags,EModel **ARoot,char *Directory,char *OnFiles); ~ECvsLog (); // List files into buffer // p - line where to print // fCount - number of files which will be printed // title - title // cnt - total number of files // position - positions of files in list // len - length of files // status - status of files // list - list of filenames // incexc - status of files to print/not to print // exc - incexc is exclusion void ListFiles(int &p, const int fCount, const char *title, int cnt, const int *position, const int *len, const char *status, const char *list, const char *excinc, const int exc = 0); virtual int CanQuit (); virtual int ConfQuit (GxView *V,int multiFile=0); virtual EViewPort *CreateViewPort (EView *V); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; extern ECvsLog *CvsLogView; #endif // CONFIG_OBJ_CVS #endif // E_CVSLOG_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_perl.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000065763�11605370242�012440� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_perl.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* * Perl Mode * * TODO: * here documents, formats * OS/2 EXTPROC..., * UNIX #! starts hilit ? * POD highlighting (need two keyword sets). * some tab handling (in & foo, etc -- if allowed)/ */ #include "fte.h" #ifdef CONFIG_HILIT_PERL #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define X_BIT 0x80 /* set if last was number, var, */ #define X_MASK 0x7F #define X_NOT(state) (!((state) & X_BIT)) #define kwd(x) (isalnum(x) || (x) == '_') #define IS_OBRACE(x) \ ((x) == '(' || (x) == '{' || (x) == '<' || (x) == '[') #define NUM_BRACE(x) \ ( \ (x) == '(' ? 0U : \ (x) == '{' ? 1U : \ (x) == '<' ? 2U : \ (x) == '[' ? 3U : 0U \ ) #define GET_BRACE(x) \ ( \ (x) == 0 ? '(' : \ (x) == 1 ? '{' : \ (x) == 2 ? '<' : \ (x) == 3 ? '[' : 0 \ ) #define IS_MBRACE(y,x) \ ( \ ((y) == '(' && (x) == ')') || \ ((y) == '{' && (x) == '}') ||\ ((y) == '<' && (x) == '>') ||\ ((y) == '[' && (x) == ']') \ ) #define QCHAR(state) ((char)(((state) >> 8) & 0xFF)) #define QSET(state, ch) ((unsigned short)((unsigned short)(state) | (((unsigned short)(ch)) << 8))) #define hsPerl_Punct 0 #define hsPerl_Comment 1 #define hsPerl_Normal 30 #define hsPerl_Keyword 4 #define hsPerl_String1 10 #define hsPerl_String2 11 #define hsPerl_StringBk 22 #define hsPerl_Variable 23 #define hsPerl_Number 24 #define hsPerl_Function 25 #define hsPerl_RegexpM 26 #define hsPerl_RegexpS1 28 #define hsPerl_RegexpS2 29 #define hsPerl_Docs 31 #define hsPerl_Data 32 #define hsPerl_RegexpS3 33 #define hsPerl_Quote1Op 35 #define hsPerl_Quote1 36 #define hsPerl_Quote1M 37 #define hsPerl_Regexp1Op 38 #define hsPerl_Regexp1 39 #define hsPerl_Regexp1M 40 #define hsPerl_Regexp2Op 41 #define hsPerl_Regexp2 42 #define hsPerl_Regexp2M 43 #define hsPerl_HereDoc 44 // hack (eod not detected properly) enum PerlOps { opQ, opQQ, opQW, opQX, opQR, opM, opS, opTR }; /*#define opQ 1 #define opQQ 2 #define opQW 3 #define opQX 4 #define opM 5 #define opS 6 #define opTR 7*/ int Hilit_PERL(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int firstnw = 0; int op; int setHereDoc = 0; int inSub = 0; #define MAXSEOF 100 static char hereDocKey[MAXSEOF]; C = 0; NC = 0; int isEOHereDoc = 0; if ((State & X_MASK) == hsPerl_HereDoc) { isEOHereDoc = (strlen(hereDocKey) == (size_t)len && strncmp(hereDocKey, Line->Chars, len) == 0) || (strlen(hereDocKey) == (size_t)len - 1 && Line->Chars[len - 1] == '\r' && strncmp(hereDocKey, Line->Chars, len - 1) == 0 ); if (isEOHereDoc) State = hsPerl_Normal | (State & X_BIT); } for(i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; if (*p == '{' && inSub) inSub = 0; IF_TAB() else { // printf("State = %d pos = %d", State, i); fflush(stdout); switch (State & X_MASK) { default: case hsPerl_Normal: if (i == 0 && X_NOT(State) && len == 8 && p[0] == '_' && p[1] == '_' && p[2] == 'D' && p[3] == 'A' && p[4] == 'T' && p[5] == 'A' && p[6] == '_' && p[7] == '_') { State = hsPerl_Data; Color = CLR_Comment; hilit6: ColorNext(); hilit5: ColorNext(); hilit4: ColorNext(); //hilit3: ColorNext(); hilit2: ColorNext(); hilit: ColorNext(); continue; } else if ( i == 0 && X_NOT(State) && len == 7 && p[0] == '_' && p[1] == '_' && p[2] == 'E' && p[3] == 'N' && p[4] == 'D' && p[5] == '_' && p[6] == '_') { State = hsPerl_Data; Color = CLR_Comment; } else if ( i == 0 && X_NOT(State) && (*p == '=') && len > 5 && ( strncmp(p+1, "begin", 5) == 0 ) ) { State = hsPerl_Docs; Color = CLR_Comment; goto hilit6; } else if ( i == 0 && X_NOT(State) && (*p == '=') && len > 4 && ( strncmp(p+1, "head", 4) == 0 || strncmp(p+1, "item", 4) == 0 || strncmp(p+1, "over", 4) == 0 || strncmp(p+1, "back", 4) == 0 ) ) { State = hsPerl_Docs; Color = CLR_Comment; goto hilit5; } else if ( i == 0 && X_NOT(State) && (*p == '=') && len > 3 && ( strncmp(p+1, "pod", 3) == 0 || strncmp(p+1, "for", 3) == 0 || strncmp(p+1, "end", 3) == 0 || 0 ) ) { State = hsPerl_Docs; Color = CLR_Comment; goto hilit4; } else if (isalpha(*p) || *p == '_') { op = -1; j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_' || Line->Chars[i + j] == '\'')) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j)) { //Color = hcPERL_Keyword; State = hsPerl_Keyword; if (strncmp(p, "sub", 3) == 0) { inSub = 1; } } else { int x; x = i + j; while ((x < Line->Count) && ((Line->Chars[x] == ' ') || (Line->Chars[x] == 9))) x++; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsPerl_Normal; } if (j == 1) { if (*p == 'q') op = opQ; else if (*p == 's' || *p == 'y') op = opS; else if (*p == 'm') op = opM; } else if (j >= 2) { if (*p == 'q') { if (p[1] == 'q') op = opQQ; else if (p[1] == 'w') op = opQW; else if (p[1] == 'r') op = opQR; else if (p[1] == 'x') op = opQX; } else if (*p == 't' && p[1] == 'r') op = opTR; if (op != -1 && j > 2 && p[2] == '\'') j = 2; else if (op != -1 && kwd(p[2])) op = -1; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; switch (op) { case opQ: State = hsPerl_Quote1Op; // q{} operator Color = CLR_Punctuation; continue; case opQQ: case opQW: case opQX: State = hsPerl_Quote1Op; // qq{} qx{} qw{} operators Color = CLR_Punctuation; continue; case opM: case opQR: State = hsPerl_Regexp1Op; // m{} qr{} operator Color = CLR_Punctuation; continue; case opTR: State = hsPerl_Regexp2Op; // tr{} operators Color = CLR_RegexpDelim; continue; case opS: State = hsPerl_Regexp2Op; // s{}{} operator Color = CLR_Punctuation; continue; default: State = hsPerl_Normal; continue; } } else if (len >= 2 && ((*p == '-' && p[1] == '-') || (*p == '+' && p[1] == '+'))) { hlState s = State; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = s; continue; } else if (inSub && *p == '(') { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); Color = CLR_Variable; while (*p != ')' && len) ColorNext(); State = hsPerl_Normal; continue; } else if (len >= 2 && *p == '&' && (p[1] == '&' || isspace(p[1]))) { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = hsPerl_Normal; continue; } else if (*p == '&' && (len < 2 || p[1] != '&') && X_NOT(State)) { State = hsPerl_Function; Color = CLR_Function; ColorNext(); while ((len > 0) && (*p == '$' || *p == '@' || *p == '*' || *p == '%' || *p == '\\')) ColorNext(); while ((len > 0) && (isalnum(*p) || *p == '_' || *p == '\'')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if ((*p == '$' || *p == '*') && (len > 1) && (p[1] == '"')) { State = hsPerl_Variable; Color = CLR_Variable; ColorNext(); ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (*p == '*' && len > 1 && p[1] == '*') { hlState s = State; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); ColorNext(); State = s; continue; } else if (*p == '$' || *p == '@' || *p == '\\' || (len > 2 && (*p == '%' || *p == '*') && X_NOT(State)) ) { char var_type = *p; State = hsPerl_Variable; Color = CLR_Variable; ColorNext(); while ((len > 0) && ((*p == ' ') || (*p == '\t'))) { IF_TAB() else ColorNext(); } /*while ((len > 0) && (*p == '$' || *p == '@' || *p == '*' || *p == '%' || *p == '\\')) ColorNext();*/ char first = *p; if (len > 0 && *p != ' ' && *p != '\t' && *p != '"') ColorNext(); // the following are one-character-ONLY if ( (var_type == '$' && strchr("_&`'+*.!/|,\\\";#%=-~:?<>()[]", first) != NULL) || (var_type == '@' && strchr("_", first) != NULL) ) { // nothing. } // the following are one-or-two-characters-ONLY else if (first == '^') { if (len > 0 && isalpha(*p)) ColorNext(); } else if (first == '{') { UntilMatchBrace(first, ColorNext()); } else { while ((len > 0) && (isalnum(*p) || (first == '{' && (*p == '^' || *p == '}')) || *p == '_' || *p == '\'') ) ColorNext(); } State = hsPerl_Normal | X_BIT; continue; } else if ((len >= 2) && (*p == '0') && (*(p+1) == 'x')) { State = hsPerl_Number; Color = CLR_Number; ColorNext(); ColorNext(); while (len && (isxdigit(*p) || *p == '_')) ColorNext(); // if (len && (toupper(*p) == 'U')) ColorNext(); // if (len && (toupper(*p) == 'L')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (isdigit(*p)) { State = hsPerl_Number; Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || (*p == 'e' || *p == 'E' || *p == '_'))) ColorNext(); // if (len && (toupper(*p) == 'U')) ColorNext(); // if (len && (toupper(*p) == 'L')) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (*p == '\'') { State = QSET(hsPerl_String1, '\''); Color = CLR_String; goto hilit; } else if (*p == '"') { State = QSET(hsPerl_String2, '"'); Color = CLR_String; goto hilit; } else if (*p == '<' && len > 2 && p[1] == '<') { int offset = 2; while (p[offset] == '"' || p[offset] == '\'' || isspace(p[offset]) || 0) { ++offset; } if (p[offset] == '_' || (toupper(p[offset]) >= 'A' && toupper(p[offset]) <= 'Z')) { int hereDocKeyLen; setHereDoc++; for (hereDocKeyLen = 0; hereDocKeyLen < len && ( p[offset + hereDocKeyLen] == '_' || (toupper(p[offset + hereDocKeyLen]) >= 'A' && toupper(p[offset + hereDocKeyLen]) <= 'Z') ); ++hereDocKeyLen) { hereDocKey[hereDocKeyLen] = p[offset + hereDocKeyLen]; } hereDocKey[hereDocKeyLen] = '\0'; State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal; continue; } } else if (*p == '`') { State = QSET(hsPerl_StringBk, '`'); Color = CLR_String; goto hilit; } else if (*p == '#') { State = hsPerl_Comment | (State & X_BIT); continue; } else if (X_NOT(State) && *p == '/') { State = QSET(hsPerl_Regexp1, '/'); Color = CLR_RegexpDelim; goto hilit; } else if (X_NOT(State) && *p == '-' && len >= 2 && isalpha(p[1]) ) { Color = CLR_Normal; // default. if (strchr("wrxoRWXOezsfdlpSbctugkTB", p[1]) != NULL) { Color = CLR_Punctuation; // new default. if (len > 2) { switch(p[2]) { case '_': // there may be others... Color = CLR_Normal; break; default: if (isalnum(p[2])) Color = CLR_Normal; break; } } } ColorNext(); ColorNext(); State = hsPerl_Normal; continue; } else if (*p == ')' || *p == ']') { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal | X_BIT; continue; } else if (ispunct(*p)) { State = hsPerl_Punct; Color = CLR_Punctuation; ColorNext(); State = hsPerl_Normal; continue; } Color = CLR_Normal; goto hilit; case hsPerl_Quote1Op: if (*p != ' ' && !kwd(*p)) { if (IS_OBRACE(*p)) { State = QSET(hsPerl_Quote1M, (1U << 2) | NUM_BRACE(*p)); } else { State = QSET(hsPerl_Quote1, *p); } Color = CLR_QuoteDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Punctuation; goto hilit; case hsPerl_Quote1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_QuoteDelim; ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_Quote1M: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_QuoteDelim; ColorNext(); State = hsPerl_Normal | X_BIT; } else goto hilit; continue; } goto hilit; case hsPerl_Regexp1Op: if (*p != ' ') { // && !kwd(*p)) { if (IS_OBRACE(*p)) State = QSET(hsPerl_Regexp1M, (1U << 2) | NUM_BRACE(*p)); else State = QSET(hsPerl_Regexp1, *p); Color = CLR_RegexpDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Regexp; goto hilit; case hsPerl_Regexp1: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_RegexpDelim; ColorNext(); Color = CLR_Punctuation; while (len > 0 && isalpha(*p)) ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_Regexp1M: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_RegexpDelim; ColorNext(); Color = CLR_Punctuation; while (len > 0 && isalpha(*p)) ColorNext(); State = hsPerl_Normal | X_BIT; } else goto hilit; continue; } goto hilit; case hsPerl_Regexp2Op: if (*p != ' ') { // && !kwd(*p)) { if (IS_OBRACE(*p)) State = QSET(hsPerl_Regexp2M, (1U << 2) | NUM_BRACE(*p)); else State = QSET(hsPerl_Regexp2, *p); Color = CLR_RegexpDelim; goto hilit; } else if (kwd(*p)) { State = hsPerl_Normal | X_BIT; continue; } Color = CLR_Regexp; goto hilit; case hsPerl_Regexp2: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { Color = CLR_RegexpDelim; ColorNext(); /*State = hsPerl_Normal | X_BIT;*/ State = QSET(hsPerl_Regexp1, QCHAR(State)); continue; } goto hilit; case hsPerl_Regexp2M: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (GET_BRACE(QCHAR(State) & 3) == *p) { State += 1 << (2 + 8); goto hilit; } else if (IS_MBRACE(GET_BRACE(QCHAR(State) & 3), *p)) { State -= 1 << (2 + 8); if ((QCHAR(State) >> 2) == 0) { Color = CLR_RegexpDelim; ColorNext(); /*State = hsPerl_Normal | X_BIT;*/ State = hsPerl_Regexp1Op; } else goto hilit; continue; } goto hilit; case hsPerl_Data: Color = CLR_Comment; goto hilit; case hsPerl_HereDoc: if (!isEOHereDoc) { Color = CLR_String; goto hilit; } Color = CLR_Punctuation; setHereDoc = QCHAR(State); while (len > 0) ColorNext(); State = hsPerl_Normal | (State & X_BIT); continue; case hsPerl_Docs: Color = CLR_Comment; if (i == 0 && *p == '=' && len > 3 && p[1] == 'c' && p[2] == 'u' && p[3] == 't') { ColorNext(); ColorNext(); ColorNext(); ColorNext(); State = hsPerl_Normal; Color = CLR_Normal; continue; } goto hilit; case hsPerl_Comment: Color = CLR_Comment; goto hilit; case hsPerl_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; case hsPerl_StringBk: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == QCHAR(State)) { ColorNext(); State = hsPerl_Normal | X_BIT; continue; } goto hilit; } } } if ((State & X_MASK) == hsPerl_Comment) State = hsPerl_Normal | (State & X_BIT); if (setHereDoc) State = QSET(hsPerl_HereDoc | (State & X_BIT), setHereDoc - 1); *ECol = C; return 0; } #endif // CONFIG_HILIT_PERL �������������./src/con_x11.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000205607�11602724002�012422� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_x11.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * I18N & XMB support added by kabi@users.sf.net */ #include "c_config.h" #include "con_i18n.h" #include "gui.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include "sysdep.h" #include <X11/Xproto.h> #include <X11/Xatom.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #include <X11/XF86keysym.h> #include <X11/Xos.h> #ifdef USE_XTINIT #include <X11/Intrinsic.h> #endif #ifdef HPUX #include <X11R5/X11/HPkeysym.h> #else #ifdef HAVE_HPKEYSYM #include <HPkeysym.h> #else #define XK_ClearLine 0x1000FF6F #define XK_InsertLine 0x1000FF70 #define XK_DeleteLine 0x1000FF71 #define XK_InsertChar 0x1000FF72 #define XK_DeleteChar 0x1000FF73 #define XK_BackTab 0x1000FF74 #define XK_KP_BackTab 0x1000FF75 #endif // HPKEYSYM #endif // HPUX #ifdef WINHCLX #include <X11/XlibXtra.h> /* HCL - HCLXlibInit */ #endif //#undef CONFIG_X11_XICON #ifdef CONFIG_X11_XICON #include <X11/xpm.h> #define ICON_COUNT 4 #include "icons/fte16x16.xpm" #include "icons/fte32x32.xpm" #include "icons/fte48x48.xpm" #include "icons/fte64x64.xpm" #endif // CONFIG_X11_XICON #ifdef WINNT #include <winsock.h> #define NO_PIPES #define NO_SIGNALS #else #include <unistd.h> #include <sys/wait.h> #include <sys/time.h> #endif #include <fcntl.h> #include <signal.h> #include <stdlib.h> #include <sys/types.h> #include <time.h> #if defined(AIX) #include <strings.h> #endif #include <stdio.h> #include <stdarg.h> #define MAX_SCRWIDTH 255 #define MAX_SCRHEIGHT 255 #define MIN_SCRWIDTH 20 #define MIN_SCRHEIGHT 6 #define SELECTION_INCR_LIMIT 0x1000 #define SELECTION_XFER_LIMIT 0x1000 #define SELECTION_MAX_AGE 10 class ColorXGC; // times in miliseconds static const unsigned int MouseAutoDelay = 40; static const unsigned int MouseAutoRepeat = 200; static const long MouseMultiClick = 300; static int setUserPosition; static int initX, initY; static int ScreenCols = 80; static int ScreenRows = 40; static int CursorX; static int CursorY; static int CursorVisible = 1; static int CursorStart, CursorEnd; static unsigned long CursorLastTime; // Cursor flashing interval, in msecs static const unsigned int CursorFlashInterval = 300; static TCell *ScreenBuffer; static int Refresh; // res_name can be set with -name switch static char res_name[20] = "fte"; static char res_class[] = "Fte"; static Display *display; static Atom wm_protocols; static Atom wm_delete_window; static Atom XA_CLIPBOARD; static Atom proptype_targets; static Atom proptype_text; static Atom proptype_compound_text; static Atom proptype_utf8_string; static Atom proptype_incr; static Window win; static Atom prop_selection; static XSizeHints size_hints; // program now contains both modes if available // some older Xservers don't like XmbDraw... static XFontStruct* font_struct; static ColorXGC* colorXGC; #ifdef CONFIG_X11_XMB static int useXMB = true; static XFontSet font_set; static int FontCYD; #else static int useXMB; #endif static i18n_context_t* i18n_ctx; static int useI18n = true; static int FontCX, FontCY; static XColor Colors[16]; static char winTitle[256] = "FTE"; static char winSTitle[256] = "FTE"; static unsigned char* CurSelectionData[3]; static int CurSelectionLen[3]; static int CurSelectionOwn[3]; static Time now; struct IncrementalSelectionInfo { IncrementalSelectionInfo *next; unsigned char *data; int len; int pos; Atom requestor; Atom property; Atom type; time_t lastUse; }; static IncrementalSelectionInfo *incrementalSelections; static Bool gotXError; static void SendSelection(XEvent *notify, Atom property, Atom type, unsigned char *data, size_t len, Bool privateData); static int ErrorHandler(Display *, XErrorEvent *ee) { gotXError = True; return 1; } static Atom GetXClip(int clipboard) { switch (clipboard) { case 1: return XA_PRIMARY; case 2: return XA_SECONDARY; default: return XA_CLIPBOARD; } } static int GetFTEClip(Atom clip) { if (clip == XA_CLIPBOARD) return 0; if (clip == XA_PRIMARY) return 1; if (clip == XA_SECONDARY) return 2; return -1; } static const struct { unsigned short r, g, b; } dcolors[] = { { 0, 0, 0 }, // black { 0, 0, 160 }, // darkBlue { 0, 160, 0 }, // darkGreen { 0, 160, 160 }, // darkCyan { 160, 0, 0 }, // darkRed { 160, 0, 160 }, // darkMagenta { 160, 160, 0 }, // darkYellow { 204, 204, 204 }, // paleGray { 160, 160, 160 }, // darkGray { 0, 0, 255 }, // blue { 0, 255, 0 }, // green { 0, 255, 255 }, // cyan { 255, 0, 0 }, // red { 255, 0, 255 }, // magenta { 255, 255, 0 }, // yellow { 255, 255, 255 }, // white }; static void SetColor(int i) { assert (0 <= i && i <= 15); if (RGBColorValid[i]) { Colors[i].blue = (unsigned short)((RGBColor[i].b << 8) | RGBColor[i].b); Colors[i].green = (unsigned short)((RGBColor[i].g << 8) | RGBColor[i].g); Colors[i].red = (unsigned short)((RGBColor[i].r << 8) | RGBColor[i].r); } else { Colors[i].blue = (unsigned short)((dcolors[i].b << 8) | dcolors[i].b); Colors[i].green = (unsigned short)((dcolors[i].g << 8) | dcolors[i].g); Colors[i].red = (unsigned short)((dcolors[i].r << 8) | dcolors[i].r); } Colors[i].flags = DoRed | DoGreen | DoBlue; } static int InitXColors(Colormap colormap) { long d = 0x7FFFFFFF, d1; XColor clr; long d_red, d_green, d_blue; long u_red, u_green, u_blue; for (int i = 0; i < 16; ++i) { SetColor(i); if (XAllocColor(display, colormap, &Colors[i]) == 0) { SetColor(i); unsigned long pix = 0xFFFFFFFF; int num = DisplayCells(display, DefaultScreen(display)); for (int j = 0; j < num; ++j) { clr.pixel = j; XQueryColor(display, colormap, &clr); d_red = (clr.red - Colors[i].red) >> 3; d_green = (clr.green - Colors[i].green) >> 3; d_blue = (clr.blue - Colors[i].blue) >> 3; //fprintf(stderr, "%d:%d dr:%d, dg:%d, db:%d\n", i, j, d_red, d_green, d_blue); u_red = d_red / 100 * d_red * 3; u_green = d_green / 100 * d_green * 4; u_blue = d_blue / 100 * d_blue * 2; //fprintf(stderr, "%d:%d dr:%u, dg:%u, db:%u\n", i, j, u_red, u_green, u_blue); d1 = u_red + u_blue + u_green; if (d1 < 0) d1 = -d1; if (pix == ~0UL || d1 < d) { pix = j; d = d1; } } if (pix == 0xFFFFFFFF) { fprintf(stderr, "Color search failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } clr.pixel = pix; XQueryColor(display, colormap, &clr); Colors[i] = clr; if (XAllocColor(display, colormap, &Colors[i]) == 0) { fprintf(stderr, "Color alloc failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } /*colormap = XCreateColormap(display, win, DefaultVisual(display, screen), AllocNone); for (i = 0; i < 16; i++) { SetColor(i); XAllocColor(display, colormap, &Colors[i]); } XSetWindowColormap(display, win, colormap); return 0;*/ } } /* clear backgroud to background color when the windows is obscured * its looks more pleasant before the redraw event does its job */ XSetWindowBackground(display, win, ((Colors[0].blue & 0xff00) << 8) | ((Colors[0].green & 0xff00)) | ((Colors[0].red & 0xff00) >> 8)); return 1; } class ColorXGC { unsigned long mask; XGCValues gcv; GC GCs[256]; Region reg; void clear() { if (reg) XDestroyRegion(reg); for (unsigned i = 0; i < 256; ++i) if (GCs[i]) XFreeGC(display, GCs[i]); } public: ColorXGC() : mask(GCForeground | GCBackground), reg(0) { if (!useXMB) { gcv.font = font_struct->fid; mask |= GCFont; } memset(&GCs, 0, sizeof(GCs)); } ~ColorXGC() { clear(); } GC& GetGC(unsigned i) { assert(i < FTE_ARRAY_SIZE(GCs)); if (!GCs[i]) { gcv.foreground = Colors[i % 16].pixel; gcv.background = Colors[i / 16].pixel; GCs[i] = XCreateGC(display, win, mask, &gcv); if (reg) XSetRegion(display, GCs[i], reg); } return GCs[i]; } void SetRegion(Region r) { clear(); memset(&GCs, 0, sizeof(GCs)); reg = r; } }; #ifdef CONFIG_X11_XMB static int TryLoadFontset(const char *fs) { char *def = NULL; char **miss = NULL; int nMiss = 0; if (font_set) return 0; if (!fs || !*fs) return 0; if (!(font_set = XCreateFontSet(display, fs, &miss, &nMiss, &def))) { fprintf(stderr, "XFTE Warning: unable to open font \"%s\":\n" " Missing count: %d\n", fs, nMiss); for(int i = 0; i < nMiss; i++) fprintf(stderr, " %s\n", miss[i]); if (def != NULL) fprintf(stderr, " def_ret: %s\n", def); } //else fprintf(stderr, "fonts %p %d %p\n", miss, nMiss, def); if (nMiss) XFreeStringList(miss); return (font_set != NULL); } #endif // CONFIG_X11_XMB static int InitXFonts() { char *fs = getenv("VIOFONT"); if (!fs && WindowFont[0] != 0) fs = WindowFont; if (!useXMB) { font_struct = NULL; if (fs) { char *s = strchr(fs, ','); if (s) *s = 0; font_struct = XLoadQueryFont(display, fs); } if (!font_struct && !(font_struct = XLoadQueryFont(display, "8x13")) && !(font_struct = XLoadQueryFont(display, "fixed"))) return 0; FontCX = font_struct->max_bounds.width; FontCY = font_struct->max_bounds.ascent + font_struct->max_bounds.descent; } #ifdef CONFIG_X11_XMB else { if (!TryLoadFontset(getenv("VIOFONT")) && !TryLoadFontset(WindowFont) && !TryLoadFontset("-misc-*-r-normal-*") && !TryLoadFontset("*fixed*")) return 0; XFontSetExtents *xE = XExtentsOfFontSet(font_set); FontCX = xE->max_logical_extent.width; FontCY = xE->max_logical_extent.height; // handle descending (comes in negative form) FontCYD = -(xE->max_logical_extent.y); // printf("Font X:%d\tY:%d\tD:%d\n", FontCX, FontCY, FontCYD); } #endif // CONFIG_X11_XMB return 1; } static int SetupXWindow(int argc, char **argv) { #ifdef WINHCLX HCLXlibInit(); /* HCL - Initialize the X DLL */ #endif #ifdef USE_XTINIT XtAppContext app_context; XtToolkitInitialize(); app_context = XtCreateApplicationContext(); if (( display = XtOpenDisplay(app_context, NULL, argv[0], "xfte", NULL, 0, &argc, argv)) == NULL) DieError(1, "%s: Can't open display\n", argv[0]); #else const char *ds = getenv("DISPLAY"); if (!ds) DieError(1, "$DISPLAY not set? This version of fte must be run under X11."); if ((display = XOpenDisplay(ds)) == NULL) DieError(1, "XFTE Fatal: could not open display: %s!", ds); #endif Colormap colormap = DefaultColormap(display, DefaultScreen(display)); XSetWindowAttributes wattr; wattr.win_gravity = NorthWestGravity; wattr.bit_gravity = NorthWestGravity; wattr.save_under = False; wattr.backing_store = NotUseful; wattr.background_pixel = BlackPixel(display, DefaultScreen(display)); // this is correct behavior if (initX < 0) initX = DisplayWidth(display, DefaultScreen(display)) + initX; if (initY < 0) initY = DisplayHeight(display, DefaultScreen(display)) + initY; win = XCreateWindow(display, DefaultRootWindow(display), initX, initY, // ScreenCols * FontCX, ScreenRows * FontCY, 0, // at this moment we don't know the exact size // but we need to open a window - so pick up 1 x 1 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWBackingStore | CWBackPixel | CWSaveUnder | CWBitGravity | CWWinGravity, &wattr); unsigned long mask = 0; i18n_ctx = (useI18n) ? i18n_open(display, win, &mask) : 0; if (!InitXFonts()) DieError(1, "XFTE Fatal: could not open any font!"); /* >KeyReleaseMask shouldn't be set for correct key mapping */ /* we set it anyway, but not pass to XmbLookupString -- mark */ mask |= ExposureMask | StructureNotifyMask | VisibilityChangeMask | FocusChangeMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PropertyChangeMask; XSelectInput(display, win, mask); wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False); assert(wm_protocols != None); wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); assert(wm_delete_window != None); prop_selection = XInternAtom(display, "fte_clip", False); assert(prop_selection != None); XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False); assert(XA_CLIPBOARD != None); proptype_targets = XInternAtom(display, "TARGETS", False); assert(proptype_targets != None); proptype_text = XInternAtom(display, "TEXT", False); assert(proptype_text != None); proptype_compound_text = XInternAtom(display, "COMPOUND_TEXT", False); assert(proptype_compound_text != None); proptype_utf8_string = XInternAtom(display, "UTF8_STRING", False); assert(proptype_utf8_string != None); proptype_incr = XInternAtom(display, "INCR", False); assert(proptype_incr != None); size_hints.flags = PResizeInc | PMinSize | PBaseSize; size_hints.width_inc = FontCX; size_hints.height_inc = FontCY; size_hints.min_width = MIN_SCRWIDTH * FontCX; size_hints.min_height = MIN_SCRHEIGHT * FontCY; size_hints.base_width = 0; size_hints.base_height = 0; if (setUserPosition) size_hints.flags |= USPosition; XSetStandardProperties(display, win, winTitle, winTitle, 0, NULL, 0, &size_hints); XClassHint class_hints; class_hints.res_name = res_name; class_hints.res_class = res_class; XSetClassHint(display, win, &class_hints); XSetWMProtocols(display, win, &wm_delete_window, 1); if (!InitXColors(colormap)) return 0; colorXGC = new ColorXGC(); XWMHints wm_hints; wm_hints.flags = InputHint | StateHint; wm_hints.input = True; wm_hints.initial_state = NormalState; #ifdef CONFIG_X11_XICON // Set icons using _NET_WM_ICON property XpmAttributes attributes; attributes.valuemask = 0;//XpmColormap | XpmDepth | XpmCloseness; //attributes.colormap = colormap; //attributes.depth = DefaultDepth(display, DefaultScreen(display)); //attributes.closeness = 40000; //attributes.exactColors = False; // Set icon using WMHints if (XpmCreatePixmapFromData(display, win, const_cast<char**>(fte16x16_xpm), &wm_hints.icon_pixmap, &wm_hints.icon_mask, &attributes) == XpmSuccess) wm_hints.flags |= IconPixmapHint | IconMaskHint; static const char * const *xpmData[ICON_COUNT] = { fte16x16_xpm, ftepm, fte48x48_xpm, fte64x64_xpm }; XpmImage xpmImage[ICON_COUNT]; CARD32 *xpmColors[ICON_COUNT] = { NULL, NULL, NULL, NULL }; int i, iconBufferSize = 0; unsigned int j; // Load icons as XpmImage instances and create their colormaps for (i = 0; i < ICON_COUNT; i++) { XpmImage &xpm = xpmImage[i]; CARD32 *&colors = xpmColors[i]; if (XpmCreateXpmImageFromData(const_cast<char**>(xpmData[i]), &xpm, NULL) != XpmSuccess) break; iconBufferSize += 2 + xpm.width * xpm.height; if (!(colors = (CARD32 *)malloc(xpm.ncolors * sizeof(CARD32)))) { // Need to clear here as cleanup at the end checks for colors[i] to see if XPM was loaded XpmFreeXpmImage(&xpm); break; } // Decode all colors for (j = 0; j < xpm.ncolors; j++) { XColor xc; char *c = xpm.colorTable[j].c_color; if (c == NULL) c = xpm.colorTable[j].g_color; if (c == NULL) c = xpm.colorTable[j].g4_color; if (c == NULL) c = xpm.colorTable[j].m_color; if (c == NULL) c = xpm.colorTable[j].symbolic; if (c == NULL) // Unknown color colors[j] = 0; else if (strcmp(c, "None") == 0) // No color - see thru colors[j] = 0; else if (XParseColor(display, colormap, c, &xc)) { // Color parsed successfully ((char *)(colors + j))[0] = (char)(xc.blue >> 8); ((char *)(colors + j))[1] = (char)(xc.green >> 8); ((char *)(colors + j))[2] = (char)(xc.red >> 8); ((char *)(colors + j))[3] = (char)0xff; } else // Color parsing failed colors[j] = 0; } } if (i == ICON_COUNT) { // Everything OK, can create property // XChangeProperty takes 32-bit entities in long array // (which is 64bit on x86_64) long *iconBuffer = (long *)malloc(iconBufferSize * sizeof(long) + 16); if (iconBuffer) { long *b = iconBuffer; for (i = 0; i < ICON_COUNT; i++) { XpmImage &xpm = xpmImage[i]; CARD32 *&colors = xpmColors[i]; *b++ = xpm.width; *b++ = xpm.height; for (j = 0; j < xpm.width * xpm.height; j++) *b++ = colors[xpm.data[j]]; } Atom at = XInternAtom(display, "_NET_WM_ICON", False); if (at != None) XChangeProperty(display, win, at, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)iconBuffer, iconBufferSize); free(iconBuffer); } } // Cleanup for (i = 0; i < ICON_COUNT; i++) { if (xpmColors[i]) { free(xpmColors[i]); XpmFreeXpmImage(xpmImage + i); } } #endif // CONFIG_X11_XICON XSetWMHints(display, win, &wm_hints); XResizeWindow(display, win, ScreenCols * FontCX, ScreenRows * FontCY); XMapRaised(display, win); // -> Expose return 1; } #define CursorXYPos(x, y) (ScreenBuffer + ((x) + ((y) * ScreenCols))) static void DebugShowArea(int X, int Y, int W, int H, int clr) { return; fprintf(stderr, "Draw %02d X:%2d Y:%2d W:%2d x H:%2d\n", clr, X, Y, W, H); XFillRectangle(display, win, colorXGC->GetGC(clr), X * FontCX, Y * FontCY, W * FontCX, H * FontCY / ((clr == 13) ? 2 : 1)); XEvent e; while (XCheckTypedWindowEvent(display, win, GraphicsExpose, &e)) XNextEvent(display, &e); usleep(2000); } static void DrawCursor(int Show) { if (CursorVisible) { TCell *Cell = CursorXYPos(CursorX, CursorY); // Check if cursor is on or off due to flashing if (CursorBlink) Show &= (CursorLastTime % (CursorFlashInterval * 2)) > CursorFlashInterval; int attr = Cell->GetAttr() ^ (Show ? 0xff : 0); char ch = (char) Cell->GetChar(); if (!useXMB) XDrawImageString(display, win, colorXGC->GetGC(attr), CursorX * FontCX, font_struct->max_bounds.ascent + CursorY * FontCY, &ch, 1); #ifdef CONFIG_X11_XMB else XmbDrawImageString(display, win, font_set, colorXGC->GetGC(attr), CursorX * FontCX, FontCYD + CursorY * FontCY, &ch, 1); #endif #if 0 if (Show) { int cs = (CursorStart * FontCY + FontCY / 2) / 100; int ce = (CursorEnd * FontCY + FontCY / 2) / 100; XFillRectangle (display, win, GCs[p[1]], CursorX * FontCX, CursorY * FontCY + cs, FontCX, ce - cs); } #endif } } int ConInit(int XSize, int YSize) { if (XSize != -1) ScreenCols = XSize; if (YSize != -1) ScreenRows = YSize; if (!(ScreenBuffer = new TCell[ScreenCols * ScreenRows])) return 0; #ifndef NO_SIGNALS signal(SIGALRM, SIG_IGN); signal(SIGPIPE, SIG_IGN); #endif return 1; } int ConDone() { delete[] ScreenBuffer; ScreenBuffer = 0; return 1; } int ConSuspend() { return 1; } int ConContinue() { return 1; } int ConClear() { TDrawBuffer B; MoveCh(B, ' ', 0x07, ScreenCols); return ConPutLine(0, 0, ScreenCols, ScreenRows, B); } int ConSetTitle(const char *Title, const char *STitle) { char buf[sizeof(winTitle)] = {0}; JustFileName(Title, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Title, buf, sizeof(buf)); snprintf(winTitle, sizeof(winTitle), "FTE - %s%s%s", buf, buf[0] ? " - " : "", Title); strlcpy(winSTitle, STitle, sizeof(winSTitle)); XSetStandardProperties(display, win, winTitle, winSTitle, 0, NULL, 0, NULL); return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, winTitle, MaxLen); strlcpy(STitle, winSTitle, SMaxLen); return 1; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { assert(X >= 0 && W >= 0 && Y >= 0 && H >= 0); if (X >= ScreenCols || Y >= ScreenRows) { //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); return 0; } //XClearArea(display, win, X, Y, W * FontCX, H * FontCY, False); //DebugShowArea(X, Y, W, H, 13); //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); if (W > ScreenCols) W = ScreenCols; if (H > ScreenRows) H = ScreenRows; for (int i = 0; i < H; ++i) { char temp[ScreenCols + 1]; TCell* pCell = CursorXYPos(X, Y + i); int x = 0, l; while (x < W) { if (!Refresh && Cell[x] == pCell[x]) { x++; continue; } TAttr attr = Cell[x].GetAttr(); for (l = 0; (x + l) < W && l < (int)sizeof(temp) - 1; ++l) { const unsigned p = x + l; if (attr != Cell[p].GetAttr()) break; if (!Refresh && Cell[p] == pCell[p]) break; // find larges not yet printed string with same attributes pCell[p] = Cell[p]; char& ch = temp[l]; switch (Cell[p].GetChar()) { // remap needs to be done in upper layer case '\t': ch = (char)3; break; // HT //case '\n': ch = (char)9; break; // NL //case '\r': ch = (char)5; break; // CR default: ch = Cell[p].GetChar(); } } if (!useXMB) XDrawImageString(display, win, colorXGC->GetGC(attr), (X + x) * FontCX, font_struct->max_bounds.ascent + (Y + i) * FontCY, temp, l); #ifdef CONFIG_X11_XMB else XmbDrawImageString(display, win, font_set, colorXGC->GetGC(attr), (X + x) * FontCX, FontCYD + (Y + i) * FontCY, temp, l); #endif //DebugShowArea(x, Y + i, l, 1, 13); //temp[l] = 0; printf("%s\n", temp); x += l; } if (i + Y == CursorY) DrawCursor(1); Cell += W; } return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; Cell += W, ++i) memcpy(Cell, CursorXYPos(X, Y + i), W * sizeof(TCell)); return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; ++i) if (ConPutBox(X, Y + i, W, 1, Cell) != 0) return 0; return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; for (int i = 0; i < W; i++) B[i] = Cell; ConPutLine(X, Y, W, H, B); return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { int l; TCell Cell(' ', Fill); DrawCursor(0); if (Way == csUp) { DebugShowArea(X, (Y + Count), W, (H - Count), 14); XCopyArea(display, win, win, colorXGC->GetGC(0), X * FontCX, (Y + Count) * FontCY, W * FontCX, (H - Count) * FontCY, X * FontCX, Y * FontCY); for (l = 0; l < H - Count; ++l) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l + Count), W * sizeof(TCell)); //l = H - Count; //fprintf(stderr, "X:%d Y:%d W:%d H:%d c:%d\n", X, Y, W, H, Count); //ConGetBox(0, Y + Count, ScreenCols, H - Count, CursorXYPos(0, Y)); //if (Count > 1 && ConSetBox(X, Y + l, W, Count, Cell) == -1) // return -1; } else if (Way == csDown) { DebugShowArea(X, Y, W, (H - Count), 15); XCopyArea(display, win, win, colorXGC->GetGC(0), X * FontCX, Y * FontCY, W * FontCX, (H - Count) * FontCY, X * FontCX, (Y + Count) * FontCY); for (l = H - 1; l >= Count; --l) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l - Count), W * sizeof(TCell)); //if (Count > 1 && ConSetBox(X, Y, W, Count, Cell) == -1) // return -1; } DrawCursor(1); return 1; } int ConSetSize(int X, int Y) { TCell* NewBuffer = new TCell[X * Y]; int MX = (X < ScreenCols) ? X : ScreenCols; int MY = (Y < ScreenRows) ? Y : ScreenRows; for (int i = 0; i < MY; i++) memcpy(NewBuffer + X * i, CursorXYPos(0, i), MX * sizeof(TCell)); delete[] ScreenBuffer; ScreenBuffer = NewBuffer; ScreenCols = X; ScreenRows = Y; //ConPutBox(0, 0, ScreenCols, ScreenRows, (PCell) ScreenBuffer); //if (Refresh == 0) // XResizeWindow(display, win, ScreenCols * FontCX, ScreenRows * FontCY); return 1; } int ConQuerySize(int *X, int *Y) { *X = ScreenCols; *Y = ScreenRows; return 1; } int ConSetCursorPos(int X, int Y) { DrawCursor(0); CursorX = X; CursorY = Y; DrawCursor(1); return 1; } int ConQueryCursorPos(int *X, int *Y) { *X = CursorX; *Y = CursorY; return 1; } int ConShowCursor() { CursorVisible = 1; DrawCursor(1); return 1; } int ConHideCursor() { DrawCursor(0); CursorVisible = 0; return 1; } int ConCursorVisible() { return CursorVisible; } int ConSetCursorSize(int Start, int End) { CursorStart = Start; CursorEnd = End; DrawCursor(CursorVisible); return 1; } int ConSetMousePos(int /*X*/, int /*Y*/) { return 1; } static int LastMouseX = -1, LastMouseY = -1; int ConQueryMousePos(int *X, int *Y) { if (X) *X = LastMouseX; if (Y) *Y = LastMouseY; return 1; } int ConShowMouse() { printf("Show\n"); return 1; } int ConHideMouse() { printf("Hide\n"); return 1; } int ConMouseVisible() { return 1; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 3; return 1; } #if 0 static void UpdateWindow1(Region reg) { Refresh = 1; colorXGC->SetRegion(reg); //XRectangle rect; //XClipBox(reg, &rect); //ConPutBox(rect.x, rect.y, rect.width/FontCX + 1, rect.height/FontCY + 1, // (PCell) CursorXYPos(rect.x, rect.y)); ConPutBox(0, 0, ScreenCols, ScreenRows, CursorXYPos(0, 0)); colorXGC->SetRegion(0); Refresh = 0; } #endif static void UpdateWindow(int xx, int yy, int ww, int hh) { if (xx + ww > ScreenCols) ww = ScreenCols - xx; if (yy + hh > ScreenRows) hh = ScreenRows - yy; //DebugShowArea(xx, yy, ww, hh, 14); Refresh = 1; for (int i = 0; i < hh; i++) ConPutBox(xx, yy + i, ww, 1, CursorXYPos(xx, yy + i)); Refresh = 0; } static void ResizeWindow(int ww, int hh) { int ox = ScreenCols; int oy = ScreenRows; ww /= FontCX; if (ww < 4) ww = 4; hh /= FontCY; if (hh < 2) hh = 2; if (ScreenCols != ww || ScreenRows != hh) { Refresh = 0; ConSetSize(ww, hh); Refresh = 1; #if 1 if (ox < ScreenCols) UpdateWindow(ox, 0, (ScreenCols - ox), ScreenRows); if (oy < ScreenRows) UpdateWindow(0, oy, ScreenCols, (ScreenRows - oy)); #endif //UpdateWindow(0, 0, ScreenCols, ScreenRows); Refresh = 0; } } static const struct { int keysym; int keycode; } key_table[] = { { XK_Escape, kbEsc }, { XK_Tab, kbTab }, { XK_Return, kbEnter }, { XK_Pause, kbPause }, { XK_BackSpace, kbBackSp }, { XK_Home, kbHome }, { XK_Up, kbUp }, { XK_Prior, kbPgUp }, { XK_Left, kbLeft }, { XK_Right, kbRight }, { XK_End, kbEnd }, { XK_Down, kbDown }, { XK_Next, kbPgDn }, { XK_Select, kbEnd }, { XK_Delete, kbDel }, { XK_Insert, kbIns }, { XK_KP_Delete, kbDel | kfGray }, { XK_KP_Insert, kbIns | kfGray }, { XK_KP_Enter, kbEnter | kfGray }, { XK_KP_Add, '+' | kfGray }, { XK_KP_Subtract, '-' | kfGray }, { XK_KP_Multiply, '*' | kfGray }, { XK_KP_Divide, '/' | kfGray }, { XK_KP_Begin, kbPgUp | kfGray | kfCtrl }, { XK_KP_Home, kbHome | kfGray }, { XK_KP_Up, kbUp | kfGray }, { XK_KP_Prior, kbPgUp | kfGray }, { XK_KP_Left, kbLeft | kfGray }, { XK_KP_Right, kbRight | kfGray }, { XK_KP_End, kbEnd | kfGray }, { XK_KP_Down, kbDown | kfGray }, { XK_KP_Next, kbPgDn| kfGray }, { XF86XK_Back, kbLeft | kfAlt }, { XF86XK_Forward, kbRight | kfAlt }, { XK_Num_Lock, kbNumLock }, { XK_Caps_Lock, kbCapsLock }, { XK_Print, kbPrtScr }, { XK_Shift_L, kbShift }, { XK_Shift_R, kbShift | kfGray }, { XK_Control_L, kbCtrl }, { XK_Control_R, kbCtrl | kfGray }, { XK_Alt_L, kbAlt }, { XK_Alt_R, kbAlt | kfGray }, { XK_Meta_L, kbAlt }, { XK_Meta_R, kbAlt | kfGray }, { XK_F1, kbF1 }, { XK_F2, kbF2 }, { XK_F3, kbF3 }, { XK_F4, kbF4 }, { XK_F5, kbF5 }, { XK_F6, kbF6 }, { XK_F7, kbF7 }, { XK_F8, kbF8 }, { XK_F9, kbF9 }, { XK_F10, kbF10 }, { XK_F11, kbF11 }, { XK_F12, kbF12 }, { XK_KP_0, '0' | kfGray }, { XK_KP_1, '1' | kfGray }, { XK_KP_2, '2' | kfGray }, { XK_KP_3, '3' | kfGray }, { XK_KP_4, '4' | kfGray }, { XK_KP_5, '5' | kfGray }, { XK_KP_6, '6' | kfGray }, { XK_KP_7, '7' | kfGray }, { XK_KP_8, '8' | kfGray }, { XK_KP_9, '9' | kfGray }, { XK_KP_Decimal, '.' | kfGray }, // HP keysyms { XK_ClearLine, kbDel | kfShift | kfGray }, { XK_InsertLine, kbIns | kfCtrl | kfGray }, { XK_DeleteLine, kbIns | kfShift | kfGray }, { XK_InsertChar, kbIns | kfGray }, { XK_DeleteChar, kbDel | kfGray }, { XK_BackTab, kbTab | kfShift }, { XK_KP_BackTab, kbTab | kfShift }, { 0, 0 } }; static void ConvertKeyToEvent(KeySym key, KeySym key1, char */*keyname*/, char */*keyname1*/, int etype, int state, TEvent *Event) { unsigned int myState = 0; switch (etype) { case KeyPress: Event->What = evKeyDown; break; case KeyRelease: Event->What = evKeyUp; break; default: Event->What = evNone; return; } if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; //if (state & Mod2Mask) myState |= kfAlt; // NumLock if (state & (Mod1Mask | Mod3Mask | Mod4Mask | Mod5Mask)) myState |= kfAlt; /* modified kabi@users.sf.net * for old method * if (!KeyAnalyze((etype == KeyPress), state, &key, &key1)) * return; */ //printf("key: %d ; %d ; %d\n", (int)key, (int)key1, state); if (key < 256 || (key1 < 256 && (myState == kfAlt || myState == (kfAlt | kfShift)))) { if (myState & kfAlt) key = key1; if (myState == kfShift) myState = 0; if (myState & (kfAlt | kfCtrl)) if ((key >= 'a') && (key <= 'z')) key += ('A' - 'a'); if ((myState & kfCtrl) && key < 32) key += 64; Event->Key.Code = key | myState; return; } else { for (size_t i = 0; i < FTE_ARRAY_SIZE(key_table); ++i) { long k; if ((int) key1 == key_table[i].keysym) { k = key_table[i].keycode; if (k < 256) if (myState == kfShift) myState = 0; Event->Key.Code = k | myState; return; } } } //printf("Unknown key: %ld %s %d %d\n", key, keyname, etype, state); Event->What = evNone; } static TEvent LastMouseEvent = { evNone }; #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) static void ConvertClickToEvent(int type, int xx, int yy, int button, int state, TEvent *Event, Time mtime) { static unsigned long LastClickTime = 0; static short LastClickCount = 0; static unsigned long LastClick = 0; unsigned int myState = 0; unsigned long CurTime = mtime; //printf("Mouse x:%d y:%d %d\n", xx, yy, type); if (type == MotionNotify) Event->What = evMouseMove; else if (type == ButtonPress) Event->What = evMouseDown; else Event->What = evMouseUp; Event->Mouse.X = xx / FontCX; Event->Mouse.Y = yy / FontCY; if (Event->What == evMouseMove) if (LastMouseX == Event->Mouse.X && LastMouseY == Event->Mouse.Y) { Event->What = evNone; return; } LastMouseX = Event->Mouse.X; LastMouseY = Event->Mouse.Y; Event->Mouse.Buttons = 0; if (type == MotionNotify) { if (state & Button1Mask) Event->Mouse.Buttons |= 1; if (state & Button2Mask) Event->Mouse.Buttons |= 4; if (state & Button3Mask) Event->Mouse.Buttons |= 2; } else { switch (button) { case Button1: Event->Mouse.Buttons |= 1; break; case Button2: Event->Mouse.Buttons |= 4; break; case Button3: Event->Mouse.Buttons |= 2; break; case Button4: case Button5: if (type == ButtonPress) { Event->What = evCommand; Event->Msg.Param1 = (state & ShiftMask) ? 1 : 3; // fix core to use count Event->Msg.Command = (button == Button4) ? cmVScrollUp : cmVScrollDown; } return; } } Event->Mouse.Count = 1; if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; if (state & (Mod1Mask | Mod3Mask | Mod4Mask | Mod5Mask)) myState |= kfAlt; //if (state & Mod2Mask) myState |= kfAlt; Event->Mouse.KeyMask = myState; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; LastClickTime = CurTime; } LastMouseEvent = *Event; } static void ProcessXEvents(TEvent *Event) { XEvent event; Event->What = evNone; XNextEvent(display, &event); #if 0 // debug - print event name static const char * const event_names[] = { "", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify" }; fprintf(stderr, "event %d - %s\n", event.type, event_names[event.type]); #endif if (XFilterEvent(&event, None)) return; if (event.xany.window != win) { if (event.type == PropertyNotify && event.xproperty.state == PropertyDelete) { // Property change on different window - try to find matching incremental selection request IncrementalSelectionInfo *isi, *prev_isi = NULL; for (isi = incrementalSelections; isi; prev_isi = isi, isi = isi->next) { if (isi->requestor == event.xproperty.window && isi->property == event.xproperty.atom) { // Found selection request - send more data int send = isi->len - isi->pos; send = send < SELECTION_XFER_LIMIT ? send : SELECTION_XFER_LIMIT; XChangeProperty(display, isi->requestor, isi->property, isi->type, 8, PropModeAppend, isi->data + isi->pos, send); isi->pos += send; isi->lastUse = time(NULL); if (send == 0) { // Was sent - remove from memory if (prev_isi) prev_isi->next = isi->next; else incrementalSelections = isi->next; XFree(isi->data); delete isi; } break; } } } return; } switch (event.type) { case MappingNotify: XRefreshKeyboardMapping(&event.xmapping); break; case Expose: case GraphicsExpose: { XRectangle rect; #if 0 #define MAXREGS 5 // idea here is to create limited set of intersection free bounding boxes // though it would need some more thing about combining them together smartly Region region[MAXREGS]; memset(region, 0, sizeof(region)); //state = XEventsQueued(display, QueuedAfterReading); fprintf(stderr, "Events Expose %d\n", state); do { rect.x = (short) event.xexpose.x / FontCX; rect.y = (short) event.xexpose.y / FontCY; rect.width = (short) event.xexpose.width / FontCX + 1; rect.height= (short) event.xexpose.height / FontCY + 1; fprintf(stderr, "Region %hd %hd %hd %hd\n", rect.x, rect.y, rect.width, rect.height); for (int i = 0; i < MAXREGS; ++i) if (!region[i] || (i == (MAXREGS - 1)) || XRectInRegion(region[i], rect.x, rect.y, rect.width, rect.height)) { if (!region[i]) region[i] = XCreateRegion(); XUnionRectWithRegion(&rect, region[i], region[i]); fprintf(stderr, "-> region %d\n", i); break; } } while (XCheckTypedWindowEvent(display, win, event.type, &event)); for (int j = 0; region[j] && j < MAXREGS; ++j) { XClipBox(region[j], &rect); XDestroyRegion(region[j]); UpdateWindow(rect.x, rect.y, rect.width + 1, rect.height + 1); } #else Region region = XCreateRegion(); //state = XEventsQueued(display, QueuedAfterReading); fprintf(stderr, "Events Expose %d\n", state); //XFlush(display); //XSync(display, 0); //int cnt = 0; const int maxx = ScreenCols * FontCX; const int maxy = ScreenRows * FontCY; do { if (event.xexpose.x < maxx && event.xexpose.y < maxy) { rect.x = (short) event.xexpose.x; rect.y = (short) event.xexpose.y; rect.width = (short) event.xexpose.width; rect.height= (short) event.xexpose.height; XUnionRectWithRegion(&rect, region, region); } //fprintf(stderr, "EXPOSE %d:%d x:%3d y:%3d w:%3d h:%3d\n", cnt++, event.xexpose.count, // event.xexpose.x / FontCX, event.xexpose.y / FontCY, // event.xexpose.width / FontCX + 1, event.xexpose.height / FontCY + 1); } while (XCheckTypedWindowEvent(display, win, event.type, &event)); // get clipping bounding box for all Exposed areas // this seems to be much faster the using clipped regions for drawing XClipBox(region, &rect); XDestroyRegion(region); UpdateWindow(rect.x / FontCX, rect.y / FontCY, rect.width / FontCX + 2, rect.height / FontCY + 2); //UpdateWindow1(region); #endif } break; case ConfigureNotify: while (XCheckTypedWindowEvent(display, win, event.type, &event)) XSync(display, 0); // wait for final resize ResizeWindow(event.xconfigure.width, event.xconfigure.height); Event->What = evCommand; Event->Msg.Command = cmResize; break; case ButtonPress: case ButtonRelease: now = event.xbutton.time; ConvertClickToEvent(event.type, event.xbutton.x, event.xbutton.y, event.xbutton.button, event.xbutton.state, Event, event.xmotion.time); break; case FocusIn: if (i18n_ctx) i18n_focus_in(i18n_ctx); break; case FocusOut: if (i18n_ctx) i18n_focus_out(i18n_ctx); break; case KeyPress: // case KeyRelease: { char keyName[32]; char keyName1[32]; KeySym key, key1; XEvent event1 = event; event1.xkey.state &= ~(ShiftMask | ControlMask | Mod1Mask /* | Mod2Mask*/ | Mod3Mask | Mod4Mask | Mod5Mask); now = event.xkey.time; if (!i18n_ctx || event.type == KeyRelease) { XLookupString(&event.xkey, keyName, sizeof(keyName), &key, 0); } else { i18n_lookup_sym(i18n_ctx, &event.xkey, keyName, sizeof(keyName), &key); if (!key) break; } XLookupString(&event1.xkey, keyName1, sizeof(keyName1), &key1, 0); //fprintf(stderr, "event.state = %d %s %08X\n", event.xkey.state, keyName, (int)key); //fprintf(stderr, "keyev.state = %d %s %08X\n", event1.xkey.state, keyName1, (int)key1); //key1 = XLookupKeysym(&event1.xkey, 0); ConvertKeyToEvent(key, key1, keyName, keyName1, event.type, event.xkey.state, Event); } break; case MotionNotify: now = event.xmotion.time; ConvertClickToEvent(event.type, event.xmotion.x, event.xmotion.y, 0, event.xmotion.state, Event, event.xmotion.time); break; case ClientMessage: if (event.xclient.message_type == wm_protocols && event.xclient.format == 32 && (Atom)event.xclient.data.l[0] == wm_delete_window) { Event->What = evCommand; Event->Msg.Command = cmClose; } break; case SelectionClear: { int clip = GetFTEClip(event.xselectionclear.selection); if (clip >= 0) { Window owner = XGetSelectionOwner(display, GetXClip(clip)); if (owner != win) { if (CurSelectionData[clip] != NULL) free(CurSelectionData[clip]); CurSelectionData[clip] = NULL; CurSelectionLen[clip] = 0; CurSelectionOwn[clip] = 0; } } } break; case SelectionRequest: { // SelectionRequest: // owner - selection owner (should be fte window) // selection - selection (clipboard) // target - target type to which the selection should be converted // property - target property - place data to this property of requestor's window, set correct type // requestor - selection requestor // time - request time - owner should provide selection if it owned it at this time // Note: Old clients use None property - in this case the right property is stored in target field. // On error refuse request by sending notification with None property. // // SelectionNotify: // requestor - // selection - should be copied from request // target - -- copy -- // property - -- copy -- or None if on error - request could not be fulfilled // time - -- copy -- static unsigned char empty[] = ""; XEvent notify; Bool notifySent = False; int clip = GetFTEClip(event.xselectionrequest.selection); notify.type = SelectionNotify; notify.xselection.requestor = event.xselectionrequest.requestor; notify.xselection.selection = event.xselectionrequest.selection; notify.xselection.target = event.xselectionrequest.target; notify.xselection.time = event.xselectionrequest.time; // Prefill for "unknown/bad request" case notify.xselection.property = None; if (clip >= 0) { if (event.xselectionrequest.target == proptype_targets) { // Return targets - to what types data can be rendered Atom type_list[] = { XA_STRING, proptype_text #ifdef CONFIG_X11_XMB , proptype_compound_text #ifdef X_HAVE_UTF8_STRING , proptype_utf8_string #endif #endif }; XChangeProperty(display, event.xselectionrequest.requestor, event.xselectionrequest.property, XA_ATOM, 32, PropModeReplace, (unsigned char *)&type_list, FTE_ARRAY_SIZE(type_list)); notify.xselection.property = event.xselectionrequest.property; #ifdef CONFIG_X11_XMB } else if (event.xselectionrequest.target == XA_STRING) { #else } else if (event.xselectionrequest.target == XA_STRING || event.xselectionrequest.target == proptype_text) { #endif // No conversion, just the string we have (in fact we should convert to ISO Latin-1) SendSelection(&notify, event.xselectionrequest.property, XA_STRING, (CurSelectionData[clip] ? CurSelectionData[clip] : empty), CurSelectionLen[clip], False); notifySent = True; #ifdef CONFIG_X11_XMB } else { // Convert to requested type XTextProperty text_property; char *text_list[1] = {(char *)(CurSelectionData[clip] ? CurSelectionData[clip] : empty)}; int style = event.xselectionrequest.target == XA_STRING ? XStringStyle : event.xselectionrequest.target == proptype_text ? XStdICCTextStyle : event.xselectionrequest.target == proptype_compound_text ? XCompoundTextStyle : #ifdef X_HAVE_UTF8_STRING event.xselectionrequest.target == proptype_utf8_string ? XUTF8StringStyle : #endif -1; if (style != -1) { // Can convert if (XmbTextListToTextProperty(display, text_list, 1, (XICCEncodingStyle) style, &text_property) == Success) { if (text_property.format == 8) { // SendSelection supports only 8-bit data (should be always, just safety check) SendSelection(&notify, event.xselectionrequest.property, text_property.encoding, text_property.value, text_property.nitems, True); notifySent = True; } else { // Bad format - just cleanup XFree(text_property.value); } } } #endif } } if (!notifySent) XSendEvent(display, notify.xselection.requestor, False, 0L, &notify); // Now clean too old incremental selections IncrementalSelectionInfo *isi = incrementalSelections, *prev_isi = NULL; time_t tnow = time(NULL); while (isi) { if (isi->lastUse + SELECTION_MAX_AGE < tnow) { IncrementalSelectionInfo *next_isi = isi->next; if (prev_isi) prev_isi->next = isi->next; else incrementalSelections = isi->next; XFree(isi->data); delete isi; isi = next_isi; } else { prev_isi = isi; isi = isi->next; } } } break; } } static void FlashCursor () { struct timeval tv; unsigned long OldTime = CursorLastTime; if (!CursorBlink || gettimeofday(&tv, NULL) != 0) return; CursorLastTime = tv.tv_sec * 1000 + tv.tv_usec / 1000; if (OldTime / CursorFlashInterval != CursorLastTime / CursorFlashInterval) DrawCursor(CursorVisible); } static TEvent Pending = { evNone }; int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { static TEvent Queued = { evNone }; int rc; FlashCursor(); Event->What = evNone; if (Queued.What != evNone) { *Event = Queued; if (Delete) Queued.What = evNone; if (Event->What & EventMask) return 1; Queued.What = evNone; } Event->What = evNone; if (Pending.What != evNone) { *Event = Pending; if (Delete) Pending.What = evNone; if (Event->What & EventMask) return 1; Pending.What = evNone; } // We can't sleep for too much since we have to flash the cursor if (CursorBlink && ((WaitTime == -1) || (WaitTime > (int)CursorFlashInterval))) WaitTime = CursorFlashInterval; Event->What = evNone; while (Event->What == evNone) { while (XPending(display) > 0) { FlashCursor(); ProcessXEvents(Event); if (Event->What != evNone) { while ((Event->What == evMouseMove) && (Queued.What == evNone)) { while ((rc = XPending(display)) > 0) { ProcessXEvents(&Queued); if (Queued.What != evMouseMove) break; *Event = Queued; Queued.What = evNone; } if (rc <= 0) break; } } if (!Delete) Pending = *Event; if (Event->What & EventMask) return 1; Pending.What = evNone; Event->What = evNone; } if ((WaitTime == -1 || WaitTime > (int)MouseAutoDelay) && (LastMouseEvent.What == evMouseAuto) && (EventMask & evMouse)) { if ((rc = WaitFdPipeEvent(Event, ConnectionNumber(display), -1, MouseAutoDelay)) == FD_PIPE_TIMEOUT) { *Event = LastMouseEvent; return 1; } } else if ((WaitTime == -1 || WaitTime > (int)MouseAutoRepeat) && (LastMouseEvent.What == evMouseDown || LastMouseEvent.What == evMouseMove) && (LastMouseEvent.Mouse.Buttons) && (EventMask & evMouse)) { if ((rc = WaitFdPipeEvent(Event, ConnectionNumber(display), -1, MouseAutoRepeat)) == FD_PIPE_TIMEOUT) { LastMouseEvent.What = evMouseAuto; *Event = LastMouseEvent; return 1; } } else rc = WaitFdPipeEvent(Event, ConnectionNumber(display), -1, (WaitTime < 1000) ? WaitTime : 1001); if (rc == FD_PIPE_TIMEOUT || rc == FD_PIPE_ERROR) return 0; // pipe event has evNotify } return 1; } int ConPutEvent(const TEvent& Event) { Pending = Event; return 1; } int ConFlush() { XFlush(display); return 1; } int ConGrabEvents(TEventMask /*EventMask*/) { return 1; } static int WaitForXEvent(int eventType, XEvent *event) { time_t time_started = time(NULL); while (!XCheckTypedWindowEvent(display, win, eventType, event)) { usleep(1000); time_t tnow = time(NULL); if (time_started > tnow) time_started = tnow; if (tnow - time_started > 5) return 0; } return 1; } static void SendSelection(XEvent *notify, Atom property, Atom type, unsigned char *data, size_t len, Bool privateData) { int (*oldHandler)(Display *, XErrorEvent *); size_t i, send; // Install error handler oldHandler = XSetErrorHandler(ErrorHandler); gotXError = False; if (len < SELECTION_INCR_LIMIT) { // Send fully - set property by appending smaller chunks for (i = 0; !gotXError && i < len; i += SELECTION_XFER_LIMIT) { send = len - i; send = send < SELECTION_XFER_LIMIT ? send : SELECTION_XFER_LIMIT; XChangeProperty(display, notify->xselection.requestor, property, type, 8, PropModeReplace, data + i, (int)send); } if (!gotXError) notify->xselection.property = property; XSendEvent(display, notify->xselection.requestor, False, 0L, notify); } else { // Send incrementally IncrementalSelectionInfo *isi = new IncrementalSelectionInfo; isi->next = incrementalSelections; isi->len = (int)len; isi->pos = 0; isi->requestor = notify->xselection.requestor; isi->property = property; isi->type = type; isi->lastUse = time(NULL); if (privateData) { // Private data - use directly isi->data = data; // Mark data non-private so XFree() at the end won't remove it privateData = False; } else { // Non-private data - need to make copy isi->data = (unsigned char *)malloc(len); if (isi->data != NULL) memcpy(isi->data, data, len); } if (isi->data != NULL) { // Data ready - put to list and send response incrementalSelections = isi; // Request receiving requestor's property changes XSelectInput(display, notify->xselection.requestor, PropertyChangeMask); // Send total size XChangeProperty(display, notify->xselection.requestor, property, proptype_incr, 32, PropModeReplace, (unsigned char *)&len, 1); notify->xselection.property = property; } // Send also in case of error - with None property XSendEvent(display, notify->xselection.requestor, False, 0L, notify); } // Restore error handler XSetErrorHandler(oldHandler); // Cleanup if (privateData) XFree(data); } static int ConvertSelection(Atom selection, Atom type, int *len, char **data) { XEvent event; Atom actual_type; int actual_format, retval; unsigned long nitems, bytes_after; unsigned char *d; // Make sure property does not exist XDeleteProperty(display, win, prop_selection); // Request clipboard data XConvertSelection(display, selection, type, prop_selection, win, now); // Wait for SelectionNotify if (!WaitForXEvent(SelectionNotify, &event) || event.xselection.property != prop_selection) return 0; // Consume event sent when property was set by selection owner WaitForXEvent(PropertyNotify, &event); // Check the value - size, type etc. retval = XGetWindowProperty(display, win, prop_selection, 0, 0, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &d); XFree(d); if (retval != Success) return 0; if (actual_type == proptype_incr) { // Incremental data size_t pos, buffer_len; unsigned char *buffer; // Get selection length and allocate buffer XGetWindowProperty(display, win, prop_selection, 0, 8, True, proptype_incr, &actual_type, &actual_format, &nitems, &bytes_after, &d); buffer_len = *(int *)d; buffer = (unsigned char *)malloc(buffer_len); XFree(d); // Cannot exit right now if data == NULL since we need to complete the handshake // Now read data pos = 0; while (1) { // Wait for new value notification do { if (!WaitForXEvent(PropertyNotify, &event)) { free(buffer); return 0; } } while (event.xproperty.state != PropertyNewValue); // Get value size XGetWindowProperty(display, win, prop_selection, 0, 0, False, type, &actual_type, &actual_format, &nitems, &bytes_after, &d); XFree(d); // Get value and delete property XGetWindowProperty(display, win, prop_selection, 0, nitems + bytes_after, True, type, &actual_type, &actual_format, &nitems, &bytes_after, &d); if (nitems && buffer) { // Data received and have buffer if (nitems > (unsigned int)(buffer_len - pos)) { // More data than expected - realloc buffer size_t new_len = pos + nitems; unsigned char *new_buffer = (unsigned char *)malloc(new_len); if (new_buffer) memcpy(new_buffer, buffer, buffer_len); free(buffer); buffer = new_buffer; buffer_len = new_len; } if (buffer) memcpy(buffer + pos, d, nitems); pos += nitems; } XFree(d); if (nitems == 0) { // No more data - done if (!buffer) // No buffer - failed return 0; // Buffer OK - exit loop and continue to data conversion nitems = pos; d = buffer; break; } } } else // Obtain the data from property if (XGetWindowProperty(display, win, prop_selection, 0, nitems + bytes_after, True, type, &actual_type, &actual_format, &nitems, &bytes_after, &d) != Success) return 0; // Now convert data to char string (uses nitems and d) if (actual_type == XA_STRING) { // String - propagate directly out of this function // This propagation is not safe since it expects XFree() to be the same as free(). // Rather we should make a copy of the received data. The similar applies to data // propagated from INCR branch above - they are allocated by malloc() but get freed // by XFree() after Xmb conversion below. *data = (char *)d; *len = (int)nitems; } else { #ifdef CONFIG_X11_XMB // Convert data to char * string XTextProperty text; char **list; int list_count; text.value = d; text.encoding = actual_type; text.format = actual_format; text.nitems = nitems; *data = NULL; // NULL indicates failure retval = XmbTextPropertyToTextList(display, &text, &list, &list_count); XFree(d); if (retval >= 0) { // Conversion OK - now we'll concat all the strings together int i; // Get total length first *len = 0; for (i = 0; i < list_count; i++) { *len += (int)strlen(list[i]); } // Allocate *data = (char *)malloc(*len + 1); if (*data != NULL) { // Concat strings char *s = *data; for (i = 0; i < list_count; i++) { strcpy(s, list[i]); s += strlen(s); } } // Cleanup XFreeStringList(list); } if (!*data) return 0; // failed #else return 0; #endif } // OK return 1; } int GetXSelection(int *len, char **data, int clipboard) { if (CurSelectionOwn[clipboard]) { if (!(*data = (char *) malloc(CurSelectionLen[clipboard]))) return 0; memcpy(*data, CurSelectionData[clipboard], CurSelectionLen[clipboard]); *len = CurSelectionLen[clipboard]; return 1; } Atom clip = GetXClip(clipboard); if (XGetSelectionOwner(display, clip) != None) { // Get data - try various formats #ifdef CONFIG_X11_XMB #ifdef X_HAVE_UTF8_STRING if (ConvertSelection(clip, proptype_utf8_string, len, data)) return 1; #endif if (ConvertSelection(clip, proptype_compound_text, len, data)) return 1; #endif return ConvertSelection(clip, XA_STRING, len, data); } *data = XFetchBytes(display, len); return (*data != NULL); } int SetXSelection(int len, char *data, int clipboard) { Atom clip = GetXClip(clipboard); if (CurSelectionData[clipboard]) free(CurSelectionData[clipboard]); // We need CurSelectionData zero-terminated so XmbTextListToTextProperty can work CurSelectionData[clipboard] = (unsigned char *)malloc(len + 1); if (!CurSelectionData[clipboard]) { CurSelectionLen[clipboard] = 0; return 0; } CurSelectionLen[clipboard] = len; memcpy(CurSelectionData[clipboard], data, CurSelectionLen[clipboard]); CurSelectionData[clipboard][len] = 0; if (CurSelectionLen[clipboard] < 64 * 1024) XStoreBytes(display, data, len); XSetSelectionOwner(display, clip, win, CurrentTime); if (XGetSelectionOwner(display, clip) == win) CurSelectionOwn[clipboard] = 1; return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { int o = 1; for (int c = 1; c < argc; c++) { if (strcmp(argv[c], "-font") == 0) { if (c + 1 < argc) strlcpy(WindowFont, argv[++c], 63);// ugly } else if (strcmp(argv[c], "-geometry") == 0) { if (c + 1 < argc) { XParseGeometry(argv[++c], &initX, &initY, (unsigned*) &ScreenCols, (unsigned*) &ScreenRows); if (ScreenCols > MAX_SCRWIDTH) ScreenCols = MAX_SCRWIDTH; else if (ScreenCols < MIN_SCRWIDTH) ScreenCols = MIN_SCRWIDTH; if (ScreenRows > MAX_SCRHEIGHT) ScreenRows = MAX_SCRHEIGHT; else if (ScreenRows < MIN_SCRHEIGHT) ScreenRows = MIN_SCRHEIGHT; setUserPosition = 1; } } else if ((strcmp(argv[c], "-noxmb") == 0) || (strcmp(argv[c], "--noxmb") == 0)) useXMB = 0; else if ((strcmp(argv[c], "-noi18n") == 0) || (strcmp(argv[c], "--noi18n") == 0)) useI18n = 0; else if (strcmp(argv[c], "-name") == 0) { if (c + 1 < argc) strlcpy(res_name, argv [++c], sizeof(res_name)); } else argv[o++] = argv[c]; } argc = o; argv[argc] = 0; if (::ConInit(XSize, YSize) && SetupXWindow(argc, argv)) gui = this; else gui = NULL; fArgc = argc; fArgv = argv; } GUI::~GUI() { i18n_destroy(&i18n_ctx); delete colorXGC; colorXGC = 0; #ifdef CONFIG_X11_XMB if (font_set) XFreeFontSet(display, font_set); #endif if (font_struct) XFreeFont(display, font_struct); XDestroyWindow(display, win); XCloseDisplay(display); for (int i=0; i<3; i++) { if (CurSelectionData[i] != NULL) { free(CurSelectionData[i]); } } ::ConDone(); } int GUI::ConSuspend() { return ::ConSuspend(); } int GUI::ConContinue() { return ::ConContinue(); } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int mode, char *Command) { char Cmd[1024]; strlcpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return (system(Cmd) == 0); } char ConGetDrawChar(unsigned int idx) { static const char *tab = NULL; static size_t len = 0; if (!tab) { tab = GetGUICharacters("X11","\x0D\x0C\x0E\x0B\x12\x19\x18\x15\x16\x17\x0f>\x1F\x01\x12\x01\x01 \x02\x01\x01"); len = strlen(tab); } assert(idx < len); return tab[idx]; } �������������������������������������������������������������������������������������������������������������������������./src/o_directory.h���������������������������������������������������������������������������������0000644�0001750�0001750�00000003250�11344266047�013144� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_directory.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_DIRECTORY_H #define O_DIRECTORY_H #include "fte.h" #ifdef CONFIG_OBJ_DIRECTORY #include "i_search.h" #include "o_list.h" #include "s_direct.h" class EDirectory: public EList { public: StlString Path; FileInfo **Files; int FCount; int SearchLen; char SearchName[ExISearch::MAXISEARCH]; int SearchPos[ExISearch::MAXISEARCH]; EDirectory(int createFlags, EModel **ARoot, char *aPath); virtual ~EDirectory(); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char *FormatLine(int Line); virtual int IsHilited(int Line); virtual void RescanList(); // virtual void UpdateList(); virtual void FreeList(); virtual int CanActivate(int Line); virtual int Activate(int No); virtual void GetName(char *AName, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); int isDir(int No); int FmChDir(const char* Name); int FmLoad(const char* Name, EView *View); int FmRmDir(const char* Name); int ChangeDir(ExState &State); int RescanDir(); }; #endif // CONFIG_OBJ_DIRECTORY #endif // O_DIRECTORY_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_directory.cpp�������������������������������������������������������������������������������0000644�0001750�0001750�00000033752�11604421633�013502� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_directory.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include <stdio.h> #include <time.h> #include "o_directory.h" #include "c_config.h" #include "c_commands.h" #include "c_history.h" #include "i_modelview.h" #include "i_view.h" #include "log.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #ifdef CONFIG_OBJ_DIRECTORY EDirectory::EDirectory(int createFlags, EModel **ARoot, char *aPath) : EList(createFlags, ARoot, aPath), Files(0), FCount(0), SearchLen(0) { char XPath[MAXPATH]; ExpandPath(aPath, XPath, sizeof(XPath)); Slash(XPath, 1); Path = XPath; RescanList(); } EDirectory::~EDirectory() { if (Files) { for (int i = 0; i < FCount; i++) delete Files[i]; free(Files); } } EEventMap *EDirectory::GetEventMap() { return FindEventMap("DIRECTORY"); } void EDirectory::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { char s[1024]; MoveCh(B, ' ', color, Width); if (Files && Line >= 0 && Line < FCount) { int Year, Mon, Day, Hour, Min, Sec; struct tm *t; time_t tim; off_t Size = Files[Line]->Size(); char SizeStr[16]; char ModeStr[11]; tim = Files[Line]->MTime(); t = localtime(&tim); if (t) { Year = t->tm_year + 1900; Mon = t->tm_mon + 1; Day = t->tm_mday; Hour = t->tm_hour; Min = t->tm_min; Sec = t->tm_sec; } else { Year = Mon = Day = Hour = Min = Sec = 0; } if (Size >= 10 * 1024 * 1024) { Size /= 1024; if (Size >= 1024 * 1024) sprintf(SizeStr, "%7ldM", (long)(Size / 1024)); else sprintf(SizeStr, "%7ldK", (long)Size); } else sprintf(SizeStr, "%8ld", (long) Size); #ifdef UNIX if (Files[Line]->Mode() >= 0) { const int mode = Files[Line]->Mode(); ModeStr[0] = mode & S_IFDIR ? 'd' : '-'; ModeStr[1] = mode & S_IRUSR ? 'r' : '-'; ModeStr[2] = mode & S_IWUSR ? 'w' : '-'; ModeStr[3] = mode & S_IXUSR ? 'x' : '-'; ModeStr[4] = mode & S_IRGRP ? 'r' : '-'; ModeStr[5] = mode & S_IWGRP ? 'w' : '-'; ModeStr[6] = mode & S_IXGRP ? 'x' : '-'; ModeStr[7] = mode & S_IROTH ? 'r' : '-'; ModeStr[8] = mode & S_IWOTH ? 'w' : '-'; ModeStr[9] = mode & S_IXOTH ? 'x' : '-'; ModeStr[10] = '\0'; } else ModeStr[0] = '\0'; #endif int l = snprintf(s, sizeof(s), #ifdef UNIX "%10s " #endif "%04d/%02d/%02d %02d:%02d:%02d %s %s%c", #ifdef UNIX ModeStr, #endif Year, Mon, Day, Hour, Min, Sec, SizeStr, Files[Line]->Name(), (Files[Line]->Type() == fiDIRECTORY) ? SLASH : ' '); if (l > 0 && Col < l) MoveStr(B, 0, Width, s + Col, color, Width); } } int EDirectory::IsHilited(int Line) { return (Line >= 0 && Line < FCount) ? Files[Line]->Type() == fiDIRECTORY : 0; } int _LNK_CONV FileNameCmp(const void *a, const void *b) { const FileInfo *A = *(const FileInfo **)a; const FileInfo *B = *(const FileInfo **)b; if (!(A->Type() == fiDIRECTORY) && (B->Type() == fiDIRECTORY)) return 1; if ((A->Type() == fiDIRECTORY) && !(B->Type() == fiDIRECTORY)) return -1; return filecmp(A->Name(), B->Name()); } void EDirectory::RescanList() { char Dir[256]; char Name[256]; int DirCount = 0; unsigned long SizeCount = 0; FileFind *ff; FileInfo *fi; int rc; if (Files) FreeList(); Count = 0; FCount = 0; if (JustDirectory(Path.c_str(), Dir, sizeof(Dir)) != 0) return; JustFileName(Path.c_str(), Name, sizeof(Name)); // we don't want any special information about symbolic links, just to browse files ff = new FileFind(Dir, "*", ffDIRECTORY | ffHIDDEN | ffLINK); if (ff == 0) return ; rc = ff->FindFirst(&fi); while (rc == 0) { assert(fi != 0); if ( strcmp(fi->Name(), ".") != 0 && ( ShowTildeFilesInDirList || fi->Name()[strlen(fi->Name())-1] != '~' ) ) { Files = (FileInfo **)realloc((void *)Files, ((FCount | 255) + 1) * sizeof(FileInfo *)); if (Files == 0) { delete fi; delete ff; return; } Files[FCount] = fi; SizeCount += Files[FCount]->Size(); if (fi->Type() == fiDIRECTORY && (strcmp(fi->Name(), "..") != 0)) DirCount++; Count++; FCount++; } else delete fi; rc = ff->FindNext(&fi); } delete ff; { char CTitle[256]; sprintf(CTitle, "%d files%c%d dirs%c%lu bytes%c%-200.200s", FCount, ConGetDrawChar(DCH_V), DirCount, ConGetDrawChar(DCH_V), SizeCount, ConGetDrawChar(DCH_V), Dir); SetTitle(CTitle); } qsort(Files, FCount, sizeof(FileInfo *), FileNameCmp); NeedsRedraw = 1; } void EDirectory::FreeList() { if (Files) { for (int i = 0; i < FCount; i++) delete Files[i]; free(Files); } Files = 0; FCount = 0; } int EDirectory::isDir(int No) { char FilePath[MAXPATH]; JustDirectory(Path.c_str(), FilePath, sizeof(FilePath)); Slash(FilePath, 1); strlcat(FilePath, Files[No]->Name(), sizeof(FilePath)); return IsDirectory(FilePath); } int EDirectory::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExActivateInOtherWindow: SearchLen = 0; Msg(S_INFO, ""); if (Files && Row >= 0 && Row < FCount) if (!isDir(Row)) return FmLoad(Files[Row]->Name(), View->Next); return 0; case ExRescan: return RescanDir(); case ExDirGoUp: SearchLen = 0; Msg(S_INFO, ""); FmChDir(SDOT SDOT); return 1; case ExDirGoDown: SearchLen = 0; Msg(S_INFO, ""); if (Files && Row >= 0 && Row < FCount) { if (isDir(Row)) { FmChDir(Files[Row]->Name()); return 1; } } return 0; case ExDirGoto: SearchLen = 0; Msg(S_INFO, ""); return ChangeDir(State); case ExDirGoRoot: SearchLen = 0; Msg(S_INFO, ""); FmChDir(SSLASH); return 1; case ExDirSearchCancel: // Kill search when moving SearchLen = 0; Msg(S_INFO, ""); return 1; case ExDirSearchNext: // Find next matching file, search is case in-sensitive while sorting is sensitive if (SearchLen) { for (int i = Row + 1; i < FCount; i++) { if (strnicmp(SearchName, Files[i]->Name(), SearchLen) == 0) { Row = i; break; } } } return 1; case ExDirSearchPrev: // Find prev matching file, search is case in-sensitive while sorting is sensitive if (SearchLen) { for (int i = Row - 1; i >= 0; i--) { if (strnicmp(SearchName, Files[i]->Name(), SearchLen) == 0) { Row = i; break; } } } return 1; case ExDeleteFile: SearchLen = 0; Msg(S_INFO, ""); return FmRmDir(Files[Row]->Name()); default: ; } return EList::ExecCommand(Command, State); } int EDirectory::Activate(int No) { SearchLen = 0; Msg(S_INFO, ""); if (Files && No >= 0 && No < FCount) { if (isDir(No)) { FmChDir(Files[No]->Name()); return 0; } else { return FmLoad(Files[No]->Name(), View); } } return 1; } void EDirectory::HandleEvent(TEvent &Event) { STARTFUNC("EDirectory::HandleEvent"); int resetSearch = 0; EModel::HandleEvent(Event); switch (Event.What) { case evKeyUp: resetSearch = 0; break; case evKeyDown: LOG << "Key Code: " << kbCode(Event.Key.Code) << ENDLINE; resetSearch = 1; switch (kbCode(Event.Key.Code)) { case kbBackSp: LOG << "Got backspace" << ENDLINE; resetSearch = 0; if (SearchLen > 0) { SearchName[--SearchLen] = 0; Row = SearchPos[SearchLen]; Msg(S_INFO, "Search: [%s]", SearchName); } else Msg(S_INFO, ""); break; case kbEsc: Msg(S_INFO, ""); break; default: resetSearch = 0; // moved here - its better for user // otherwice there is no way to find files like i_ascii if (isAscii(Event.Key.Code) && (SearchLen < ExISearch::MAXISEARCH)) { char Ch = (char) Event.Key.Code; int Found; LOG << " -> " << BinChar(Ch) << ENDLINE; SearchPos[SearchLen] = Row; SearchName[SearchLen] = Ch; SearchName[++SearchLen] = 0; Found = 0; LOG << "Comparing " << SearchName << ENDLINE; for (int i = Row; i < FCount; i++) { LOG << " to -> " << Files[i]->Name() << ENDLINE; if (strnicmp(SearchName, Files[i]->Name(), SearchLen) == 0) { Row = i; Found = 1; break; } } if (Found == 0) SearchName[--SearchLen] = 0; Msg(S_INFO, "Search: [%s]", SearchName); } break; } } if (resetSearch) { SearchLen = 0; } LOG << "SearchLen = " << SearchLen << ENDLINE; } int EDirectory::RescanDir() { char CName[256] = ""; if (Row >= 0 && Row < FCount) strcpy(CName, Files[Row]->Name()); Row = 0; RescanList(); if (CName[0] != 0) { for (int i = 0; i < FCount; i++) { if (filecmp(Files[i]->Name(), CName) == 0) { Row = i; break; } } } return 1; } int EDirectory::FmChDir(const char *Name) { char Dir[256]; char CName[256] = ""; if (strcmp(Name, SSLASH) == 0) { JustRoot(Path.c_str(), Dir, sizeof(Dir)); } else if (strcmp(Name, SDOT SDOT) == 0) { Slash(&Path[0], 0); JustFileName(Path.c_str(), CName, sizeof(CName)); JustDirectory(Path.c_str(), Dir, sizeof(Dir)); } else { JustDirectory(Path.c_str(), Dir, sizeof(Dir)); Slash(Dir, 1); strlcat(Dir, Name, sizeof(Dir)); } Slash(Dir, 1); Path = Dir; Row = 0; RescanList(); if (CName[0] != 0) { for (int i = 0; i < FCount; i++) { if (filecmp(Files[i]->Name(), CName) == 0) { Row = i; break; } } } UpdateTitle(); return 1; } int EDirectory::FmRmDir(char const* Name) { char FilePath[MAXPATH]; strlcpy(FilePath, Path.c_str(), sizeof(FilePath) - 2); Slash(FilePath, 1); strlcat(FilePath, Name, sizeof(FilePath)); int choice = View->MView->Win->Choice(GPC_CONFIRM, "Remove File", 2, "O&K", "&Cancel", "Remove %s?", Name); if (choice == 0) { if (unlink(FilePath) == 0) { // put the cursor to the previous row --Row; // There has to be a more efficient way of doing this ... return RescanDir(); } Msg(S_INFO, "Failed to remove %s", Name); return 0; } Msg(S_INFO, "Cancelled"); return 0; } int EDirectory::FmLoad(const char *Name, EView *XView) { char FilePath[256]; JustDirectory(Path.c_str(), FilePath, sizeof(FilePath)); Slash(FilePath, 1); strcat(FilePath, Name); return FileLoad(0, FilePath, NULL, XView); } void EDirectory::GetName(char *AName, size_t MaxLen) { strlcpy(AName, Path.c_str(), MaxLen); if (MaxLen) Slash(AName, 0); } void EDirectory::GetPath(char *APath, size_t MaxLen) { strlcpy(APath, Path.c_str(), MaxLen); if (MaxLen) Slash(APath, 0); } void EDirectory::GetInfo(char *AInfo, size_t /*MaxLen*/) { char buf[256] = {0}; char winTitle[256] = {0}; JustFileName(Path.c_str(), buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Path.c_str(), buf, sizeof(buf)); if (buf[0] != 0) // if there is a file/dir name, stick it in here. { strlcat(winTitle, buf, sizeof(winTitle)); strlcat(winTitle, "/ - ", sizeof(winTitle)); } strlcat(winTitle, Path.c_str(), sizeof(winTitle)); sprintf(AInfo, "%2d %04d/%03d %-150s", ModelNo, Row + 1, FCount, winTitle); /* sprintf(AInfo, "%2d %04d/%03d %-150s", ModelNo, Row + 1, FCount, Path);*/ } void EDirectory::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { if (!MaxLen) return; strlcpy(ATitle, Path.c_str(), MaxLen); char P[MAXPATH]; strlcpy(P, Path.c_str(), sizeof(P)); Slash(P, 0); JustDirectory(P, ASTitle, SMaxLen); Slash(ASTitle, 1); } int EDirectory::ChangeDir(ExState &State) { char Dir[MAXPATH]; char Dir2[MAXPATH]; if (State.GetStrParam(View, Dir, sizeof(Dir)) == 0) { strlcpy(Dir, Path.c_str(), sizeof(Dir)); if (View->MView->Win->GetStr("Set directory", sizeof(Dir), Dir, HIST_PATH) == 0) return 0; } if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1) return 0; #if 0 // is this needed for other systems as well ? Slash(Dir2, 1); #endif Path = Dir2; Row = -1; UpdateTitle(); return RescanDir(); } int EDirectory::GetContext() { return CONTEXT_DIRECTORY; } char *EDirectory::FormatLine(int /*Line*/) { return 0; }; int EDirectory::CanActivate(int /*Line*/) { return 1; } #endif ����������������������./src/c_config.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000003242�11604417546�012373� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_config.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_CONFIG_H #define C_CONFIG_H #include "sysdep.h" extern int ScreenSizeX; extern int ScreenSizeY; extern int CursorInsSize[2]; extern int CursorOverSize[2]; extern bool CursorBlink; extern int SystemClipboard; extern int OpenAfterClose; extern int ShowMenuBar; extern int ShowToolBar; extern int SelectPathname; extern char DefaultModeName[32]; extern int WSStyleSearch; extern char PrintDevice[MAXPATH]; extern char CompileCommand[256]; extern int KeepHistory; extern int LoadDesktopOnEntry; extern int SaveDesktopOnExit; extern int KeepMessages; extern int ScrollBorderX; extern int ScrollBorderY; extern int ScrollJumpX; extern int ScrollJumpY; extern int GUIDialogs; extern int SevenBit; extern int WeirdScroll; extern int LoadDesktopMode; extern char HelpCommand[128]; extern char *ConfigSourcePath; extern char ConfigFileName[MAXPATH]; extern int IgnoreBufferList; extern char CvsCommand[256]; extern char CvsLogMode[32]; extern char SvnCommand[256]; extern char SvnLogMode[32]; extern int ReassignModelIds; extern int RecheckReadOnly; extern char XShellCommand[256]; extern int ShowTildeFilesInDirList; const char *GetGUICharacters(const char *which, const char *defChars); int LoadConfig(int argc, char **argv, char *CfgFileName); int GetIndentMode(const char *Str); int GetHilitMode(const char *Str); int UseDefaultConfig(); int AddCRegexp(int file, int line, int msg, const char *regexp); int LoadFile(char *WhereName, char *CfgName); #endif // C_CONFIG_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/pmdlg.h���������������������������������������������������������������������������������������0000644�0001750�0001750�00000001130�07045071610�011711� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define IDD_PROMPT 300 #define IDS_PROMPT 301 #define IDE_FIELD 302 #define IDD_FINDREPLACE 201 #define IDD_FIND 202 #define IDL_FIND 211 #define IDL_REPLACE 212 #define IDE_FIND 221 #define IDE_REPLACE 222 #define IDC_IGNORECASE 231 #define IDC_REGEXPS 232 #define IDC_WORDS 233 #define IDC_BLOCK 234 #define IDC_GLOBAL 235 #define IDC_REVERSE 236 #define IDC_ALLOCCURENCES 237 #define IDC_NOPROMPTING 238 #define IDC_JOINLINE 239 #define IDC_DELETELINE 240 #define IDD_FILEDLG 500 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_djgpp2.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000000770�11331412502�012634� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_djgpp2.cpp * * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Contributed by Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at> */ // djgpp2 specific routines #include "c_bind.h" #include "o_model.h" #include "sysdep.h" int EView::SysShowHelp(ExState &State, const char *word) { Msg(S_ERROR, "Not yet implemented"); return 0; } ��������./src/e_loadsave.cpp��������������������������������������������������������������������������������0000644�0001750�0001750�00000054301�11602724002�013245� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_loadsave.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_cvslog.h" #include "e_svnlog.h" #include "i_modelview.h" #include "i_view.h" #include "s_util.h" #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> int EBuffer::Load() { return LoadFrom(FileName); } int EBuffer::Reload() { int R = VToR(CP.Row), C = CP.Col; if (!LoadFrom(FileName)) return 0; SetNearPosR(C, R); return 1; } int EBuffer::Save() { if (BFI(this, BFI_ReadOnly)) { Msg(S_ERROR, "File is read-only."); return 0; } if (BFI(this, BFI_TrimOnSave)) FileTrim(); return SaveTo(FileName); } char FileBuffer[RWBUFSIZE]; int EBuffer::LoadFrom(const char *AFileName) { int fd; ssize_t len = 0, partLen; unsigned long numChars = 0, Lines = 0; char *p, *e, *m = NULL; int lm = 0; int lf; int SaveUndo, SaveReadOnly; int first = 1; int strip = BFI(this, BFI_StripChar); int lchar = BFI(this, BFI_LineChar); int margin = BFI(this, BFI_LoadMargin); FileOk = 0; fd = open(AFileName, O_RDONLY | O_BINARY, 0); if (fd == -1) { if (errno != ENOENT) { Msg(S_INFO, "Could not open file %s (errno=%d, %s).", AFileName, errno, strerror(errno)); } else { Msg(S_INFO, "New file %s.", AFileName); } Loaded = 1; return 0; } Loading = 1; Clear(); BlockUnmark(); SaveUndo = BFI(this, BFI_Undo); SaveReadOnly = BFI(this, BFI_ReadOnly); BFI(this, BFI_Undo) = 0; BFI(this, BFI_ReadOnly) = 0; while ((len = read(fd, FileBuffer, sizeof(FileBuffer))) > 0) { if (first) { first = 0; if (BFI(this, BFI_DetectLineSep)) { int was_lf = 0, was_cr = 0; for (int c = 0; c < len; c++) { if (FileBuffer[c] == '\n') { was_lf++; break; } else if (FileBuffer[c] == '\r') { was_cr++; if (was_cr == 2) break; } } /* !!! fails if first line > 32k * ??? set first to 1 in that case ? */ if (was_cr || was_lf) { BFI(this, BFI_StripChar) = -1; BFI(this, BFI_LoadMargin) = -1; BFI(this, BFI_AddLF) = 0; BFI(this, BFI_AddCR) = 0; if (was_lf) { BFI(this, BFI_LineChar) = '\n'; BFI(this, BFI_AddLF) = 1; if (was_cr) { BFI(this, BFI_StripChar) = '\r'; BFI(this, BFI_AddCR) = 1; } } else if (was_cr) { BFI(this, BFI_LineChar) = '\r'; BFI(this, BFI_AddCR) = 1; } else { BFI(this, BFI_LineChar) = -1; BFI(this, BFI_LoadMargin) = 64; } strip = BFI(this, BFI_StripChar); lchar = BFI(this, BFI_LineChar); margin = BFI(this, BFI_LoadMargin); } } } p = FileBuffer; do { if (lchar != -1) { // do we have a LINE delimiter e = (char *)memchr((void *)p, lchar, FileBuffer - p + len); if (e == NULL) { e = FileBuffer + len; lf = 0; } else lf = 1; } else if (margin != -1) { // do we have a right margin for wrap if (FileBuffer + len >= p + margin) { e = p + margin; lf = 1; } else { e = FileBuffer + len; lf = 0; } } else { e = FileBuffer + len; lf = 0; } partLen = e - p; // # of chars in buffer for current line m = (char *)realloc((void *)m, (lm + partLen) + CHAR_TRESHOLD); if (m == NULL) goto fail; memcpy(m + lm, p, partLen); lm += partLen; numChars += partLen; if (lf) { // there is a new line, add it to buffer if (lm == 0 && !m && !(m = (char *)malloc(CHAR_TRESHOLD))) goto fail; #if 0 { // support for VIM tabsize commands char *t = strstr(m,"vi:ts="); int ts = 0; if (t && isdigit(t[6])) ts = atoi(&t[6]); if (ts > 0 && ts <= 16) BFI(this, BFI_TabSize) = ts; } #endif // Grow the line table if required, if (RCount == RAllocated) if (!Allocate(RCount ? (RCount * 2) : 1)) goto fail; if (!(LL[RCount++] = new ELine(m, lm))) goto fail; RGap = RCount; lm = 0; m = NULL; Lines++; } p = e; if (lchar != -1) // skip LINE terminator/separator p++; } while (lf); Msg(S_INFO, "Loading: %d lines, %d bytes.", Lines, numChars); } if ((RCount == 0) || (lm > 0) || !BFI(this, BFI_ForceNewLine)) { if (lm == 0 && m == NULL && (m = (char *)malloc(CHAR_TRESHOLD)) == 0) goto fail; // Grow the line table if required, if (RCount == RAllocated) if (Allocate(RCount ? (RCount * 2) : 1) == 0) goto fail; if ((LL[RCount++] = new ELine(m, lm)) == 0) goto fail; m = NULL; RGap = RCount; } // Next time when you introduce something like this // check all code paths - as the whole memory management // is broken - you have forget to clear 'm' two line above comment! // kabi@users.sf.net // this bug has caused serious text corruption which is the worst // thing for text editor if (m) free(m); m = NULL; // initialize folding array. // TODO: allocate only when folds are actually used. // needs fixing a lot of code in other places. VCount = RCount; VGap = VCount; if (AllocVis(VCount ? VCount : 1) == 0) goto fail; memset(VV, 0, VCount * sizeof(int)); if (strip != -1) { // strip CR character from EOL if specified // TODO: this should be done during load above to improve performance for (int l = 0; l < RCount; l++) { if (LL[l]->Count > 0) if (LL[l]->Chars[LL[l]->Count - 1] == strip) LL[l]->Count--; } } if ((BFI(this, BFI_SaveFolds) != 0) || BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { int len_start = 0, len_end = 0; int level = 0, open = 0; int l; int pos = -1, startpos; char foldnum[3] = "00"; if (BFS(this, BFS_CommentStart) == 0) len_start = 0; else len_start = strlen(BFS(this, BFS_CommentStart)); if (BFS(this, BFS_CommentEnd) == 0) len_end = 0; else len_end = strlen(BFS(this, BFS_CommentEnd)); // How folds and bookmarks are saved in line comment: // // CommentStart((FOLD)|(fold)nn)?(BOOK(bookmark)+xllllb)?CommentEnd // // After comment start there can be a fold - open or closed - with level number (nn - decimal). // Then bookmarks can follow marked by BOOK "keyword". Last bookmark is terminated by 'x' // character followed by total length of bookmark info (llll - hex) and character 'b'. The // total length is needed when looking for comment start from the line end. // Each bookmark has format "ccccllname" - cccc (hex) is bookmark column, ll (hex) is length // of bookmark name and then the name itself follows. // // Example: FOLD01BOOK000a05mark1001005mark2x001ab // // Open first level fold, bookmark "mark1" at column 10 and bookmark "mark2" at column 16. // At the end is length of string from BOOK up to end of mark2 - 26 (0x1a). for (l = RCount - 1; l >= 0; l--) { if (LL[l]->Count >= len_start + len_end + 6) { for (int where = 1; where < 3; where++) { // where == 1 - start-of-line // where == 2 - end-of-line open = -1; level = -1; if (BFI(this, BFI_SaveFolds) != where && BFI(this, BFI_SaveBookmarks) != where) continue; if (where == 1) { pos = 0; } else { pos = LL[l]->Count - len_end; // Check if line ends with end comment (if defined) if (len_end != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentEnd), len_end) != 0) continue; // Locate position of comment start - skip bookmarks and fold if (BFI(this, BFI_SaveBookmarks) == 2 && pos - 10 >= 0 && LL[l]->Chars[pos-1] == 'b') { char numbuf[5]; int i; memcpy(numbuf, LL[l]->Chars + pos - 5, 4); numbuf[4] = 0; if (1 != sscanf(numbuf, "%x", &i)) continue; pos -= i + 6; if (pos < 0) continue; } if (BFI(this, BFI_SaveFolds) == 2 && pos - 6 >= 0 && (memcmp(LL[l]->Chars + pos - 6, "FOLD", 4) == 0 || memcmp(LL[l]->Chars + pos - 6, "fold", 4) == 0)) pos -= 6; pos -= len_start; } // Check comment start if (pos < 0 || (len_start != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentStart), len_start) != 0)) continue; // Check comment length - leave empty in file if (LL[l]->Count - pos == len_start + len_end) continue; startpos = pos; pos += len_start; // We have starting position after comment start // Now we will read fold and/or bookmark info and check // for end of comment (if where == 2, it must end at EOLN) // This code is not very good, since on error we stop // parsing comments (and leave it in file), but everything // already done is not undone (e.g. bookmarks, folds) // Folds come always first if (BFI(this, BFI_SaveFolds) == where && (pos + len_end + 6 <= LL[l]->Count)) { if (memcmp(LL[l]->Chars + pos, "FOLD", 4) == 0) { open = 1; } else if (memcmp(LL[l]->Chars + pos, "fold", 4) == 0) { open = 0; } else open = -1; } if (open != -1) { foldnum[0] = LL[l]->Chars[pos + 4]; foldnum[1] = LL[l]->Chars[pos + 4 + 1]; if (1 != sscanf(foldnum, "%2d", &level)) level = -1; if (!isdigit(LL[l]->Chars[pos + 4]) || !isdigit(LL[l]->Chars[pos + 5])) level = -1; if (level == -1 || open >= 100) continue; pos += 6; } // Now get bookmarks if (BFI(this, BFI_SaveBookmarks) == where && (pos + len_end + 10 <= LL[l]->Count) && memcmp(LL[l]->Chars + pos, "BOOK", 4) == 0) { int error = 0; int i, col, startBook; char numbuf[5], buf[256]; startBook = pos; pos += 4; while (pos + len_end + 6 + 6 <= LL[l]->Count) { // Read column memcpy(numbuf, LL[l]->Chars + pos, 4); numbuf[4] = 0; pos += 4; if (1 != sscanf(numbuf, "%x", &col)) { error = 1; break; } // Read length memcpy(numbuf, LL[l]->Chars + pos, 2); numbuf[2] = 0; pos += 2; if (1 != sscanf(numbuf, "%x", &i)) { error = 1; break; } if (pos + i + 6 + len_end > LL[l]->Count || i == 0) { error = 1; break; } if (i) { memcpy(buf, LL[l]->Chars + pos, i); buf[i] = 0; pos += i; if (PlaceUserBookmark(buf, EPoint(l, col)) == 0) goto fail; } if (LL[l]->Chars[pos] == 'x') { // Read total length (just test for correctness) memcpy(numbuf, LL[l]->Chars + pos + 1, 4); numbuf[4] = 0; if (1 != sscanf(numbuf, "%x", &i)) { error = 1; break; } if (i != pos - startBook || LL[l]->Chars[pos + 5] != 'b') error = 1; else pos += 6; break; } } // Stop parsing this comment if error occured if (error) continue; } // And last: check, if comment is properly terminated if (pos + len_end > LL[l]->Count) continue; if (len_end != 0 && memcmp(LL[l]->Chars + pos, BFS(this, BFS_CommentEnd), len_end) != 0) continue; // Not at EOLN, but should be (comment at EOLN) if (where == 2 && LL[l]->Count != pos + len_end) continue; pos += len_end; // Create fold if whole comment was successfully parsed if (open != -1) { int f; if (!FoldCreate(l)) goto fail; f = FindFold(l); assert(f != -1); FF[f].level = (char)(level & 0xFF); if (open == 0) if (!FoldClose(l)) goto fail; } // Now remove parsed comment from line memmove(LL[l]->Chars + startpos, LL[l]->Chars + pos, LL[l]->Count - pos); LL[l]->Count -= pos - startpos; } } } } if (SetPosR(0, 0) == 0) return 0; BFI(this, BFI_Undo) = SaveUndo; BFI(this, BFI_ReadOnly) = SaveReadOnly; if (stat(FileName, &FileStatus) == -1) { memset(&FileStatus, 0, sizeof(FileStatus)); FileOk = 0; goto fail; } else { if (!(FileStatus.st_mode & (S_IWRITE | S_IWGRP | S_IWOTH))) BFI(this, BFI_ReadOnly) = 1; else BFI(this, BFI_ReadOnly) = 0; } close(fd); FileOk = 1; Modified = 0; Loading = 0; Loaded = 1; Draw(0, -1); Msg(S_INFO, "Loaded %s.", AFileName); return 1; fail: free(m); BFI(this, BFI_Undo) = SaveUndo; BFI(this, BFI_ReadOnly) = SaveReadOnly; close(fd); Loading = 0; Draw(0, -1); View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error loading %s.", AFileName); return 0; } int EBuffer::SaveTo(const char *AFileName) { char ABackupName[MAXPATH]; struct stat StatBuf; FILE *fp; int l; PELine L; unsigned long ByteCount = 0, OldCount = 0; int f; char fold[64]; unsigned int foldlen = 0; int bindex; unsigned int blen = 0; char book[1024] = "BOOK"; unsigned int len_start = 0, len_end = 0; if (FileOk && (stat(FileName, &StatBuf) == 0)) { if (FileStatus.st_size != StatBuf.st_size || FileStatus.st_mtime != StatBuf.st_mtime) { switch (View->MView->Win->Choice(GPC_ERROR, "File Changed on Disk", 2, "&Save", "&Cancel", "%s", FileName)) { case 0: break; case 1: case -1: default: return 0; } } } if (RCount <= 0) return 0; #ifdef CONFIG_BACKUP // make only backups when user have requested a one if (BFI(this, BFI_MakeBackups) != 0) { Msg(S_INFO, "Backing up %s...", AFileName); if (MakeBackup(AFileName, (char *)ABackupName) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Could not create backup file."); return 0; } } #endif Msg(S_INFO, "Writing %s...", AFileName); fp = 0; #ifdef OS2 // to preserve EA's ? fp = fopen(AFileName, "r+b"); if (fp != 0) #if defined(__IBMCPP__) || defined(__WATCOMC__) if ( chsize (fileno(fp), 0) != 0) #else if (ftruncate(fileno(fp), 0) != 0) #endif // __IBMCPP__ || __WATCOMC__ goto erroropen; #endif // OS2 if (fp == 0) fp = fopen(AFileName, "wb"); if (fp == 0) goto erroropen; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); // Some initializations (to speed-up saving) if (BFS(this, BFS_CommentStart)) len_start = strlen(BFS(this, BFS_CommentStart)); if (BFS(this, BFS_CommentEnd)) len_end = strlen(BFS(this, BFS_CommentEnd)); for (l = 0; l < RCount; l++) { L = RLine(l); f = FindFold(l); foldlen = 0; // format fold if ((f != -1) && (BFI(this, BFI_SaveFolds) != 0)) { foldlen = sprintf(fold, FF[f].open ? "FOLD%02d" : "fold%02d", FF[f].level); } bindex = 0; blen = 0; #ifdef CONFIG_BOOKMARKS if (BFI(this, BFI_SaveBookmarks) == 1 || BFI(this, BFI_SaveBookmarks) == 2) { const EBookmark* eb; blen = 4; // Just after "BOOK" while ((bindex = GetUserBookmarkForLine(bindex, l, eb)) != -1) { size_t l = strlen(eb->GetName()); // Skip too long bookmarks if (l > 256 || blen + l + 6 + 6 > sizeof(book)) continue; blen += sprintf(book + blen, "%04x%02x%s", eb->GetPoint().Col, (int)l, eb->GetName()); } if (blen != 4) blen += sprintf(book + blen, "x%04xb", blen); else blen = 0; // Signal, that no bookmarks were saved } #endif // what - write at 1 = beginning / 2 = end of line for (int what = 1; what < 3; what++) { if ((BFI(this, BFI_SaveFolds) == what && foldlen) || (BFI(this, BFI_SaveBookmarks) == what && blen) ) { if (len_start) { if (fwrite(BFS(this, BFS_CommentStart), 1, len_start, fp) != len_start) goto fail; ByteCount += len_start; } if (BFI(this, BFI_SaveFolds) == what && foldlen) { if (fwrite(fold, 1, foldlen, fp) != foldlen) goto fail; ByteCount += foldlen; } #ifdef CONFIG_BOOKMARKS if (BFI(this, BFI_SaveBookmarks) == what && blen) { if (fwrite(book, 1, blen, fp) != blen) goto fail; ByteCount += blen; } #endif if (len_end) { if (fwrite(BFS(this, BFS_CommentEnd), 1, len_end, fp) != len_end) goto fail; ByteCount += len_end; } } if (what == 1) { // write data if ((int)(fwrite(L->Chars, 1, L->Count, fp)) != L->Count) goto fail; ByteCount += L->Count; } } // write eol if ((l < RCount - 1) || BFI(this, BFI_ForceNewLine)) { if (BFI(this, BFI_AddCR) == 1) { if (fputc('\r', fp) < 0) goto fail; ByteCount++; } if (BFI(this, BFI_AddLF) == 1) { if (fputc('\n', fp) < 0) goto fail; ByteCount++; } } if (ByteCount > OldCount + 65536) { Msg(S_INFO, "Saving: %d lines, %d bytes.", l, ByteCount); OldCount = ByteCount; } } if (fclose(fp) != 0) goto failclose; Modified = 0; FileOk = 1; if (stat(FileName, &FileStatus) == -1) { memset(&FileStatus, 0, sizeof(FileStatus)); FileOk = 0; goto failclose; } Msg(S_INFO, "Wrote %s.", AFileName); // make only backups when user have requested a one if (BFI(this, BFI_MakeBackups) != 0) { if (BFI(this, BFI_KeepBackups) == 0 #ifdef CONFIG_OBJ_CVS // No backups for CVS logs || this == CvsLogView #endif #ifdef CONFIG_OBJ_SVN // No backups for SVN logs || this == SvnLogView #endif ) { unlink(ABackupName); } } return 1; fail: fclose(fp); failclose: unlink(AFileName); if (rename(ABackupName, AFileName) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error renaming backup file to original!"); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error writing file, backup restored."); } return 0; erroropen: View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Error writing %s (errno=%d).", AFileName, errno); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte2.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000034153�11602724002�012006� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* fte.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #if defined(UNIX) /* Some paths where to also look for the rc-file */ /* How many */ #define UNIX_RCPATHS 3 /* Actual locations */ static const char * const Unix_RCPaths[UNIX_RCPATHS]={ "/usr/local/etc/fte/system.fterc", "/etc/fte/system.fterc", "/usr/X11R6/lib/X11/xfte/system.fterc", }; #endif /* UNIX */ static void Usage() { printf("Usage: " PROGRAM " [-!] [-?] [--help] [-h] [-crdnm] files...\n" "Version: " VERSION " " COPYRIGHT "\n" " You may distribute under the terms of either the GNU General Public\n" " License or the Artistic License, as specified in the README file.\n" "\n" "Options:\n" " -- End of options, only files remain.\n" " -+ Next option is file.\n" " -? Display usage.\n" " -h Display usage.\n" " --help Display usage.\n" " -! Ignore config file, use builtin defaults (also -c).\n" " -c[<.cnf>] Use specified configuration file (no arg=builtin).\n" #ifdef CONFIG_DESKTOP " -d[<.dsk>] Load/Save desktop from <.dsk> (no arg=disable desktop).\n" #endif /* #ifdef CONFIG_HISTORY " -h[<.his>] Load/Save history from <.his> (no arg=disable history).\n" #endif */ " -m[<mode>] Override mode for remaining files (no arg=no override).\n" " -l<line>[,<col>] Go to line (and column) in next file.\n" " -r Open next file as read-only.\n" #ifdef CONFIG_TAGS " -T[<tagfile>] Load tags file at startup.\n" " -t<tag> Locate specified tag.\n" #endif // " -p Load files into already running FTE.\n" ); } /* * findPathExt() returns a ^ to the suffix in a file name string. If the * name contains a suffix, the pointer ^ts to the suffix' dot character, * if the name has no suffix the pointer points to the NUL terminator of * the file name string. * .lib: CBASE.LIB */ static char *findPathExt(char *filename) { char *p, *sps; for (p = filename, sps = NULL; *p; p++) { if (ISSLASH(*p)) sps = NULL; if (*p == '.') sps = p; } if (sps == NULL) sps = p; return sps; } #if defined(OS2) && defined(__EMX__) // argv[0] on emx does not contain full path #define INCL_DOS #include <os2.h> char *getProgramName(char *name) { char ProgramName[MAXPATH]; PTIB tib; PPIB pib; DosGetInfoBlocks(&tib, &pib); if (DosQueryModuleName(pib->pib_hmte, sizeof(ProgramName), ProgramName) != 0) return name; return strdup(ProgramName); } #endif static int GetConfigFileName(int argc, char **argv, char *ConfigFileName) { int i; char CfgName[MAXPATH] = ""; if (ConfigFileName[0] == 0) { #if defined(UNIX) // ? use ./.fterc if by current user ? ExpandPath("~/.fterc", CfgName); #elif defined(DOS) || defined(DOSP32) strcpy(CfgName, argv[0]); strcpy(findPathExt(CfgName), ".cnf"); #elif defined(OS2) || defined(NT) char home[MAXPATH] = ""; char *ph; #if defined(OS2) ph = getenv("HOME"); if (ph) strcpy(home, ph); #endif #if defined(NT) ph = getenv("HOMEDRIVE"); if (ph) strcpy(home, ph); ph = getenv("HOMEPATH"); if (ph) strcat(home, ph); #endif if (home[0]) { strcpy(CfgName, home); Slash(CfgName, 1); strcat(CfgName, "fte.cnf"); } if (!home[0] || access(CfgName, 0) != 0) { strcpy(CfgName, argv[0]); strcpy(findPathExt(CfgName), ".cnf"); } #endif strcpy(ConfigFileName, CfgName); } // printf("Trying '%s'...",ConfigFileName); if (access(ConfigFileName, 0) == 0) { // printf("success, loading!\n"); return 1; } // printf("failed!\n"); #if defined(UNIX_RCPATHS) for (i=0;i<UNIX_RCPATHS;i++) { // printf("Trying '%s'...",Unix_RCPaths[i]); if (access(Unix_RCPaths[i],0) == 0) { // printf("success, loading!\n"); strcpy(ConfigFileName,Unix_RCPaths[i]); return 1; } // printf("failed!\n"); } #endif // printf("No config-file found!\n"); return 0; } static int CmdLoadConfiguration(int &argc, char **argv) { int ign = 0; int QuoteAll = 0, QuoteNext = 0; int Arg; char ConfigFileName[MAXPATH] = ""; for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (stricmp(argv[Arg],"--help")==0) { Usage(); return 0; } else if (argv[Arg][1] == '-') { QuoteAll = 1; } else if (argv[Arg][1] == '!') { ign = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; } else if (argv[Arg][1] == 'c') { if (argv[Arg][2]) strcpy(ConfigFileName, argv[Arg] + 2); else ign = 1; } else if (argv[Arg][1] == '?') { Usage(); return 0; } else if (argv[Arg][1] == 'h') { Usage(); return 0; } } } if (GetConfigFileName(argc, argv, ConfigFileName) == 0) ; // should we default to internal (NOT?) if (ign) { if (UseDefaultConfig() == -1) DieError(1, "Error in internal configuration??? FATAL!"); } else { if (LoadConfig(argc, argv, ConfigFileName) == -1) DieError(1, "Failed to find any configuration file.\n" "Use '-c' option."); } for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-') { QuoteAll = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; #ifdef CONFIG_DESKTOP } else if (argv[Arg][1] == 'd') { strcpy(DesktopFileName, argv[Arg] + 2); if (DesktopFileName[0] == 0) { LoadDesktopOnEntry = 0; SaveDesktopOnExit = 0; } else { LoadDesktopOnEntry = 1; } #endif #ifdef CONFIG_HISTORY } else if (argv[Arg][1] == 'h') { strcpy(HistoryFileName, argv[Arg] + 2); if (HistoryFileName[0] == 0) { KeepHistory = 0; } else { KeepHistory = 1; } #endif } } } return 1; } static int CmdLoadFiles(int &argc, char **argv) { int QuoteNext = 0; int QuoteAll = 0; int GotoLine = 0; int LineNum = 1; int ColNum = 1; int ModeOverride = 0; char Mode[32]; int LCount = 0; int ReadOnly = 0; for (int Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-') { QuoteAll = 1; } else if (argv[Arg][1] == '!') { // handled before } else if (argv[Arg][1] == 'c') { // ^ } else if (argv[Arg][1] == 'd') { // ^ } else if (argv[Arg][1] == 'h') { // ^ } else if (argv[Arg][1] == '+') { QuoteNext = 1; } else if (argv[Arg][1] == '#' || argv[Arg][1] == 'l') { LineNum = 1; ColNum = 1; if (strchr(argv[Arg], ',')) { GotoLine = (2 == sscanf(argv[Arg] + 2, "%d,%d", &LineNum, &ColNum)); } else { GotoLine = (1 == sscanf(argv[Arg] + 2, "%d", &LineNum)); } // printf("Gotoline = %d, line = %d, col = %d\n", GotoLine, LineNum, ColNum); } else if (argv[Arg][1] == 'r') { ReadOnly = 1; } else if (argv[Arg][1] == 'm') { if (argv[Arg][2] == 0) { ModeOverride = 0; } else { ModeOverride = 1; strcpy(Mode, argv[Arg] + 2); } } else if (argv[Arg][1] == 'T') { TagsAdd(argv[Arg] + 2); } else if (argv[Arg][1] == 't') { TagGoto(0, argv[Arg] + 2); } else if (argv[Arg][1] == '?') { Usage(); return 0; } else { DieError(2, "Invalid command line option %s", argv[Arg]); return 0; } } else { char Path[MAXPATH]; if (ExpandPath(argv[Arg], Path) == 0 && IsDirectory(Path)) { new EDirectory(&MM, Path); assert(MM != 0); //VV->SwitchToModel(MM); } else { if (ModeOverride) { if (MultiFileLoad(argv[Arg], Mode, 0) == 0) return 0; } else { if (MultiFileLoad(argv[Arg], 0, 0) == 0) return 0; } if (((EBuffer *)MM)->Loaded == 0) ((EBuffer *)MM)->Load(); if (GotoLine) { GotoLine = 0; ((EBuffer *)MM)->SetNearPosR(ColNum - 1, LineNum - 1); } else { int r, c; if (RetrieveFPos(((EBuffer *)MM)->FileName, r, c) == 1) ((EBuffer *)MM)->SetNearPosR(c, r); } if (ReadOnly) { ReadOnly = 0; BFI(((EBuffer *)MM), BFI_ReadOnly) = 1; } } QuoteNext = 0; MM = MM->Next; LCount++; } } while (LCount-- > 0) MM = MM->Prev; return 1; } #ifdef CONFIG_HISTORY static void DoLoadHistoryOnEntry(int &argc, char **argv) { if (HistoryFileName[0] == 0) { #ifdef UNIX ExpandPath("~/.fte-history", HistoryFileName); #else JustDirectory(argv[0], HistoryFileName); strcat(HistoryFileName, "fte.his"); #endif } else { char p[256]; ExpandPath(HistoryFileName, p); if (IsDirectory(p)) { Slash(p, 1); #ifdef UNIX strcat(p, ".fte-history"); #else strcat(p, "fte.his"); #endif } strcpy(HistoryFileName, p); } if (KeepHistory && FileExists(HistoryFileName)) LoadHistory(HistoryFileName); } static void DoSaveHistoryOnExit() { if (KeepHistory && HistoryFileName[0] != 0) SaveHistory(HistoryFileName); } #endif #ifdef CONFIG_DESKTOP void DoLoadDesktopOnEntry(int &argc, char **argv) { if (DesktopFileName[0] == 0) { #ifdef UNIX if (FileExists(".fte-desktop")) { ExpandPath(".fte-desktop", DesktopFileName); } else { ExpandPath("~/.fte-desktop", DesktopFileName); } #else if (FileExists("fte.dsk")) { ExpandPath("fte.dsk", DesktopFileName); } else { JustDirectory(argv[0], DesktopFileName); strcat(DesktopFileName, "fte.dsk"); } #endif } else { char p[MAXPATH]; ExpandPath(DesktopFileName, p); if (IsDirectory(p)) { Slash(p, 1); #ifdef UNIX strcat(p, ".fte-desktop"); #else strcat(p, "fte.dsk"); #endif } strcpy(DesktopFileName, p); } if (LoadDesktopOnEntry && FileExists(DesktopFileName)) LoadDesktop(DesktopFileName); } #endif static void EditorInit() { SS = new EBuffer((EModel **)&SS, "Scrap"); BFI(SS, BFI_Undo) = 0; // disable undo for clipboard MM = 0; } static void EditorCleanup() { EModel *B, *N, *A; EView *BW, *NW, *AW; if (MM) { B = A = MM; while (B != A) { N = B->Next; delete B; B = N; } } MM = 0; delete SS; SS = 0; if (VV) { BW = AW = VV; while (BW != AW) { NW = BW->Next; delete BW; BW = NW; } } VV = 0; } static int InterfaceInit(int &argc, char **argv) { GxView *view; ExModelView *edit; new EGUI(argc, argv, ScreenSizeX, ScreenSizeY); if (gui == 0) DieError(1, "Failed to initialize display\n"); new EFrame(ScreenSizeX, ScreenSizeY); if (frames == 0) DieError(1, "Failed to create window\n"); //frames->SetMenu("Main"); //?? view = new GxView(frames); if (view == 0) DieError(1, "Failed to create view\n"); VV = new EView(MM); assert(VV != 0); edit = new ExModelView(VV); if (!edit) return 0; view->PushView(edit); return 1; } static void InterfaceCleanup() { while (frames) delete frames; delete gui; } int main(int argc, char **argv) { #if defined(__EMX__) argv[0] = getProgramName(argv[0]); #endif if (CmdLoadConfiguration(argc, argv) == 0) return 1; #ifdef CONFIG_HISTORY DoLoadHistoryOnEntry(argc, argv); #endif EditorInit(); #ifdef CONFIG_DESKTOP DoLoadDesktopOnEntry(argc, argv); #endif if (CmdLoadFiles(argc, argv) == 0) return 3; if (MM == 0) { #ifdef CONFIG_OBJ_DIRECTORY char Path[MAXPATH]; GetDefaultDirectory(0, Path, sizeof(Path)); MM = new EDirectory(&MM, Path); assert(MM != 0); //VV->SwitchToModel(MM); #else Usage(); return 1; #endif } if (!InterfaceInit(argc, argv)) return 2; gui->Run(); // here starts the PM second thread, so the above blocks the SIQ ;-( #ifdef CONFIG_HISTORY DoSaveHistoryOnExit(); #endif EditorCleanup(); InterfaceCleanup(); #if defined(OS2) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_history.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000003051�11331412501�012604� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_history.h * * Copyright (c) 1994-1996, Marko Macek * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_HISTORY_H #define C_HISTORY_H #include "fte.h" #ifdef CONFIG_HISTORY #ifdef UNIX #define HISTORY_NAME ".fte-history" #else #define HISTORY_NAME "fte.his" #endif extern char HistoryFileName[256]; void ClearHistory(); int SaveHistory(const char *FileName); int LoadHistory(const char *FileName); int UpdateFPos(const char *FileName, int Row, int Col); int RetrieveFPos(const char *FileName, int &Row, int &Col); int AddInputHistory(int Id, const char *String); int CountInputHistory(int Id); int GetInputHistory(int Id, char *String, int maxlen, int Nth); // some platforms don't know about EBuffer yet class EBuffer; /* * Get bookmarks for given Buffer (file) from history. */ int RetrieveBookmarks(EBuffer *buf); /* * Store given Buffer's bookmarks to history. */ int StoreBookmarks(EBuffer *buf); /* history values */ #define HIST_DEFAULT 0 #define HIST_PATH 1 #define HIST_SEARCH 2 #define HIST_POSITION 3 #define HIST_SETUP 4 #define HIST_SHELL 5 #define HIST_COMPILE 6 #define HIST_SEARCHOPT 7 #define HIST_BOOKMARK 8 #define HIST_REGEXP 9 #define HIST_TRANS 10 #define HIST_TAGFILES 11 #define HIST_CVS 12 #define HIST_CVSDIFF 13 #define HIST_CVSCOMMIT 14 #define HIST_SVN 15 #define HIST_SVNDIFF 16 #define HIST_SVNCOMMIT 17 #endif // CONFIG_HISTORY #endif // C_HISTORY_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_direct.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000026477�11602724002�012754� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* s_direct.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // TODO: on OS/2 choose between UNIX and OS/2 style patterns (now OS/2 only) // TODO: on OS/2 fetch multiple entries at once and cache them for speed #include "s_direct.h" #include "s_files.h" #include <sys/stat.h> #include <time.h> #ifdef OS2 #define INCL_BASE #include <os2.h> #endif #ifdef NT #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #endif #if defined(DOSP32) || (defined(NT) && defined(USE_DIRENT)) // NT ? # include "port.h" #endif #ifdef DJGPP #include <sys/stat.h> static int my_stat(const char *name, struct stat *s) { unsigned short f = _djstat_flags; // speed up directory access by turning off unused stat functionality _djstat_flags |= _STAT_INODE; _djstat_flags |= _STAT_EXEC_EXT; _djstat_flags |= _STAT_EXEC_MAGIC; _djstat_flags |= _STAT_DIRSIZE; //_djstat_flags |= _STAT_ROOT_TIME; _djstat_flags &= ~_STAT_ROOT_TIME; _djstat_flags |= _STAT_WRITEBIT; int r = stat(name,s); _djstat_flags = f; return r; } #endif FileInfo::FileInfo(const char *Name, int Type, off_t Size, time_t MTime, int Mode) : name(Name), size(Size), mtime(MTime), type(Type), mode(Mode) { } FileInfo::~FileInfo() { } FileFind::FileFind(const char *aDirectory, const char *aPattern, int aFlags) : Directory(new char[strlen(aDirectory) + 1]), Flags(aFlags) { strcpy(Directory, aDirectory); Slash(Directory, 0); if (aPattern) { Pattern = new char[strlen(aPattern) + 1]; strcpy(Pattern, aPattern); } else { Pattern = 0; } #if defined(USE_DIRENT) //#if defined(UNIX) || defined(DOSP32) || defined(NT) dir = 0; #elif defined(OS2) && !defined(USE_DIRENT) dir = 0; #elif defined(NT) && !defined(USE_DIRENT) dir = 0; #endif } FileFind::~FileFind() { delete [] Directory; if (Pattern) delete [] Pattern; //#if defined(UNIX) || defined(DOSP32) || defined(NT) #if defined(USE_DIRENT) if (dir) closedir(dir); #elif defined(OS2) && !defined(USE_DIRENT) if (dir) DosFindClose(dir); #elif defined(NT) && !defined(USE_DIRENT) if (dir) FindClose((HANDLE)dir); #endif } int FileFind::FindFirst(FileInfo **fi) { //#if defined(UNIX) || defined(NT) || defined(DOSP32) #if defined(USE_DIRENT) if (dir) closedir(dir); if ((dir = opendir(Directory)) == 0) return -1; return FindNext(fi); #elif defined(OS2) && !defined(USE_DIRENT) char fullpattern[MAXPATH]; HDIR hdir = HDIR_CREATE; ULONG attr = FILE_ARCHIVED | FILE_READONLY; ULONG count = 1; FILEFINDBUF3 find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if (dir) DosFindClose(dir); if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? JoinDirFile(fullpattern, Directory, (Pattern) ? Pattern : "*"); if ((rc = DosFindFirst(fullpattern, &hdir, attr, &find, sizeof(find), &count, FIL_STANDARD)) != 0) { //fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = hdir; if (count != 1) return -1; name = find.achName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } memset(&t, 0, sizeof(t)); t.tm_year = find.fdateLastWrite.year + 80; // ugh! t.tm_mon = find.fdateLastWrite.month - 1; t.tm_mday = find.fdateLastWrite.day; t.tm_hour = find.ftimeLastWrite.hours; t.tm_min = find.ftimeLastWrite.minutes; t.tm_sec = find.ftimeLastWrite.twosecs * 2; // ugh! t.tm_isdst = -1; *fi = new FileInfo(name, (find.attrFile & FILE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.cbFile, mktime(&t)); return 0; #elif defined(NT) && !defined(USE_DIRENT) #if defined(USE_VCFIND) char fullpattern[MAXPATH]; _finddata_t find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if (dir) _findclose(dir); /*if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? */ if (Pattern) JoinDirFile(fullpattern, Directory, Pattern); else JoinDirFile(fullpattern, Directory, "*"); if ((rc = _findfirst(fullpattern, &find)) == -1) { // fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = rc; name = find.name; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } *fi = new FileInfo(name, (find.attrib & _A_SUBDIR) ? fiDIRECTORY : fiFILE, find.size, find.time_create); return 0; #else char fullpattern[MAXPATH]; WIN32_FIND_DATA find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; SYSTEMTIME st; FILETIME localft; // needed for time conversion int rc; if (dir) _findclose(dir); /*if (Flags & ffDIRECTORY) attr |= FILE_DIRECTORY; if (Flags & ffHIDDEN) attr |= FILE_HIDDEN | FILE_SYSTEM; // separate ? */ JoinDirFile(fullpattern, Directory, (Pattern) ? Pattern : "*"); if ((rc = (int) FindFirstFile(fullpattern, &find)) < 0) { //fprintf(stderr, "%s: %d\n\n", fullpattern, rc); return -1; } dir = rc; name = find.cFileName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } /* * since filetime is in UTC format we need to convert it first to * localtime and when we have "correct" time we can use it. */ FileTimeToLocalFileTime(&find.ftLastWriteTime, &localft); FileTimeToSystemTime(&localft, &st); t.tm_year = st.wYear - 1900; t.tm_mon = st.wMonth - 1; // in system time january is 1... t.tm_mday = st.wDay; t.tm_hour = st.wHour; t.tm_min = st.wMinute; t.tm_sec = st.wSecond; t.tm_isdst = -1; *fi = new FileInfo(name, (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.nFileSizeLow, // !!! mktime(&t)); return 0; #endif #endif } int FileFind::FindNext(FileInfo **fi) { //#if defined(UNIX) || defined(NT) || defined(DOSP32) #if defined(USE_DIRENT) struct dirent *dent; char fullpath[MAXPATH]; char *name; *fi = 0; again: if ((dent = readdir(dir)) == NULL) return -1; name = dent->d_name; if (name[0] == '.') if (!(Flags & ffHIDDEN)) goto again; if (Pattern && fnmatch(Pattern, dent->d_name, 0) != 0) goto again; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, dent->d_name); name = fullpath; } if (Flags & ffFAST) { *fi = new FileInfo(name, fiUNKNOWN, 0, 0); } else { struct stat st; if (!(Flags & ffFULLPATH)) // need it now JoinDirFile(fullpath, Directory, dent->d_name); if (Flags && ffLINK) { // if we are handling location of symbolic links, lstat cannot be used // instead use normal stat if ( #if defined(DJGPP) my_stat #else stat #endif (fullpath, &st) != 0 && 0) goto again; } else { if ( #if defined(DJGPP) my_stat #elif defined(UNIX) // must use lstat if available lstat #else stat #endif (fullpath, &st) != 0 && 0) goto again; } if (!(Flags & ffDIRECTORY) && S_ISDIR(st.st_mode)) goto again; *fi = new FileInfo(name, S_ISDIR(st.st_mode) ? fiDIRECTORY : fiFILE, st.st_size, st.st_mtime, st.st_mode ); } //printf("ok\n"); return 0; #elif defined(OS2) && !defined(USE_DIRENT) ULONG count = 1; FILEFINDBUF3 find; // need to improve to fetch multiple entries at once char fullpath[MAXPATH]; char *name; struct tm t; int rc; if ((rc = DosFindNext(dir, &find, sizeof(find), &count)) != 0) { //fprintf(stderr, "%d\n\n", rc); return -1; } if (count != 1) return -1; name = find.achName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } memset((void *)&t, 0, sizeof(t)); t.tm_year = find.fdateLastWrite.year + 80; t.tm_mon = find.fdateLastWrite.month - 1; t.tm_mday = find.fdateLastWrite.day; t.tm_hour = find.ftimeLastWrite.hours; t.tm_min = find.ftimeLastWrite.minutes; t.tm_sec = find.ftimeLastWrite.twosecs * 2; // ugh! t.tm_isdst = -1; *fi = new FileInfo(name, (find.attrFile & FILE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.cbFile, mktime(&t)); return 0; #elif defined(NT) && !defined(USE_DIRENT) #if defined(USE_VCFIND) _finddata_t find; char fullpath[MAXPATH]; char *name; struct tm t; int rc; if ((rc = _findnext(dir, &find)) != 0) { // fprintf(stderr, "%d\n\n", rc); return -1; } name = find.name; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } *fi = new FileInfo(name, (find.attrib & _A_SUBDIR) ? fiDIRECTORY : fiFILE, find.size, find.time_create); return 0; #else WIN32_FIND_DATA find; char fullpath[MAXPATH]; char *name; struct tm t; SYSTEMTIME st; FILETIME localft; // needed for time conversion int rc; if ((rc = FindNextFile((HANDLE)dir, &find)) != TRUE) { //fprintf(stderr, "%d\n\n", rc); return -1; } name = find.cFileName; if (Flags & ffFULLPATH) { JoinDirFile(fullpath, Directory, name); name = fullpath; } /* * since filetime is in UTC format we need to convert it first to * localtime and when we have "correct" time we can use it. */ FileTimeToLocalFileTime(&find.ftLastWriteTime, &localft); FileTimeToSystemTime(&localft, &st); t.tm_year = st.wYear - 1900; t.tm_mon = st.wMonth - 1; // in system time january is 1... t.tm_mday = st.wDay; t.tm_hour = st.wHour; t.tm_min = st.wMinute; t.tm_sec = st.wSecond; t.tm_isdst = -1; *fi = new FileInfo(name, (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? fiDIRECTORY : fiFILE, find.nFileSizeLow, mktime(&t)); return 0; #endif // put code here #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/mkdefcfg.pl�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002035�11160327165�012547� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!perl -w $n = 1; $buf = ""; $out = ""; local($infile, $outfile) = @ARGV; if(defined($infile)) {open(INFILE, "<$infile"); } else { open(INFILE, "<&STDIN"); } if(defined($outfile)) {open(OUTFILE, ">$outfile"); } else { open(OUTFILE, ">&STDOUT"); } print OUTFILE "/* do not edit */\nstatic const unsigned char DefaultConfig[] = {\n"; binmode INFILE; # NT needs this local($len); while (($len = read(INFILE, $buf, 256)) > 0) { #$buf =~ s/(.)/sprintf "0x%02X", ord($1))/goe; #for ($i = 0; $i < $len; $i++) { # $out .= sprintf "0x%02X", ord(substr($buf, $i, 1,)); # if ($n++ % 10) { # $out .= ", "; # } else { # $out .= ",\n"; # } #} @c = split(//, $buf); for ($i = 0; $i < $len; $i++) { $out .= sprintf("0x%02X", ord($c[$i])); if ($n++ % 10) { $out .= ", "; } else { $out .= ",\n"; } } print OUTFILE $out; $out = ""; print STDERR "."; } print OUTFILE "\n};\n"; close(INFILE); close(OUTFILE); print STDERR "\n"; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_mode.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000007206�11344266042�012403� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_mode.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_bind.h" #include "c_config.h" #include <fcntl.h> EBufferFlags DefaultBufferFlags = { { 1, // AutoIndent 1, // InsertOn 0, // DrawOn 1, // HilitOn 1, // ExpandTabs 0, // Trim 8, // TabSize HILIT_PLAIN, // HilitMode INDENT_PLAIN, // IndentMode 0, // ShowTab 10, // LineChar #if !defined(UNIX) 13, // StripChar #else -1, #endif 1, // AddLine #if !defined(UNIX) 1, // AddStrip #else 0, #endif 0, // ForceNewLine 0, // HardMode 1, // UndoRedo 0, // ReadOnly 0, // AutoSave 1, // KeepBackups -1, // LoadMargin 256, // Max Undo/Redo Commands 1, // MatchCase 0, // BackKillTab 0, // DelKillTab 1, // BackSpUnindent 0, // SpaceTabs 1, // IndentWTabs 1, // Wrap.LeftMargin 72, // Wrap.RightMargin 0, // See Thru Sel 0, // WordWrap 0, // ShowMarkers 1, // CursorThroughTabs 0, // Save Folds 0, // MultiLineHilit 0, // AutoHilitParen 0, // Abbreviations 0, // BackSpKillBlock 0, // DeleteKillBlock 1, // PersistentBlocks 0, // InsertKillBlock 0, // EventMap 0, // UndoMoves #ifdef UNIX 0, // DetectLineSep #else 1, #endif 0, // trim on save 0, // save bookmarks 1, // HilitTags 0, // ShowBookmarks 1 // MakeBackups }, { 0, // Routine Regexp 0, // DefFindOpt 0, // DefFindReplaceOpt 0, // comment start (folds) 0, // comment end (folds) 0, // filename rx 0, // firstline rx 0 // compile command } }; EMode *GetModeForName(const char *FileName) { EMode *m; RxMatchRes RM; int fd; for (m = Modes; m; m = m->fNext) if (RxExec(m->MatchNameRx, FileName, strlen(FileName), FileName, &RM) == 1) return m; if ((fd = open(FileName, O_RDONLY)) != -1) { char buf[81]; int l = read(fd, buf, sizeof(buf) - 1); close(fd); if (l > 0) { int i; for (i = 0; i < l && buf[i] != '\n'; ++i) ; buf[i] = 0; for (m = Modes; m; m = m->fNext) if (RxExec(m->MatchLineRx, buf, i, buf, &RM) == 1) return m; } } if ((m = FindMode(DefaultModeName))) return m; for (m = Modes; m && m->fNext; m = m->fNext) ; return m; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/commands.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000001341�11331412501�012735� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* commands.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_model.h" #include "s_files.h" #include "sysdep.h" int GetDefaultDirectory(EModel *M, char *Path, size_t MaxLen) { if (M) M->GetPath(Path, MaxLen); if (!M || Path[0] == 0) if (ExpandPath(".", Path, MaxLen) == -1) return 0; SlashDir(Path); return 1; } int SetDefaultDirectory(EModel *M) { char Path[MAXPATH]; if (GetDefaultDirectory(M, Path, sizeof(Path)) == 0) return 0; if (ChangeDir(Path) == -1) return 0; return 1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_plain.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000005631�11344266047�012574� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_plain.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsPLAIN_Normal 0 int Hilit_Plain(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine* Line, hlState& State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); #ifdef CONFIG_WORD_HILIT int j = 0; if (BF->Mode->fColorize->Keywords.TotalCount > 0 || BF->GetWordCount() > 0) { /* words have to be hilited, go slow */ for(i = 0; i < Line->Count;) { IF_TAB() else { if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(Color, Line->Chars + i, j, 1)) ; else { Color = CLR_Normal; State = hsPLAIN_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsPLAIN_Normal; Color = CLR_Normal; continue; } ColorNext(); continue; } } } else #endif // CONFIG_WORD_HILIT if (ExpandTabs) { /* use slow mode */ for (i = 0; i < Line->Count;) { IF_TAB() else { ColorNext(); } } } else { /* fast mode */ if (Pos < Line->Count) { if (Pos + Width < Line->Count) { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, HILIT_CLRD(), Width); if (StateMap) memset(StateMap, State, Line->Count); } else { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, HILIT_CLRD(), Line->Count - Pos); if (StateMap) memset(StateMap, State, Line->Count); } } C = Line->Count; } *ECol = C; State = 0; return 0; } int Indent_Plain(EBuffer *B, int Line, int PosCursor) { int OI = B->LineIndented(Line); B->IndentLine(Line, B->LineIndented(Line - 1)); if (PosCursor) { int I = B->LineIndented(Line); int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; B->SetPosR(X, Line); } return 1; } �������������������������������������������������������������������������������������������������������./src/s_files.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000003062�11602724002�012232� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* s_files.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef S_FILES_H #define S_FILES_H #include <stddef.h> #define SDOT "." #ifdef UNIX #define SLASH '/' #define SSLASH "/" #define ISSLASH(c) ((c) == SLASH) #define ISSEP(c) ((c) == SLASH) #endif #if defined(OS2) || defined(NT) || defined(DOS) || defined(DOSP32) #if defined(DJGPP) #define SLASH '/' #define SSLASH "/" #else #define SLASH '\\' #define SSLASH "\\" #endif #define ISSLASH(c) (((c) == '/') || ((c) == '\\')) #define ISSEP(c) (((c) == ':') || ISSLASH(c)) #endif char *Slash(char *Path, int Add); char *SlashDir(char *Path); int ExpandPath(const char *Path, char *Expanded, size_t ExpandSize); int CompletePath(const char *Path, char *Completed, int Num); int IsSameFile(const char *Path1, const char *Path2); int JustDirectory(const char *Path, char *Dir, size_t DirSize); int JustFileName(const char *Path, char *Name, size_t NameSize); int JustLastDirectory(const char *Path, char *Dir, size_t DirSize); int JustRoot(const char *Path, char *Root, size_t RootSize); int FileExists(const char *Path); int IsFullPath(const char *Path); int IsDirectory(const char *Path); const char *ShortFName(const char *Path, size_t len); int ChangeDir(const char *Dir); int JoinDirFile(char *Dest, const char *Dir, const char *Name); char *SepRChr(const char *Dir); int RelativePathName(const char *Dir, const char *Path, char *RelPath); #endif // S_FILES_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/objs.inc��������������������������������������������������������������������������������������0000644�0001750�0001750�00000005217�11602724002�012071� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������CFTE_OBJS =\ cfte.$(OEXT)\ s_files.$(OEXT)\ s_string.$(OEXT) OBJS =\ commands.$(OEXT)\ c_bind.$(OEXT)\ c_color.$(OEXT)\ c_config.$(OEXT)\ c_desktop.$(OEXT)\ c_hilit.$(OEXT)\ c_history.$(OEXT)\ c_mode.$(OEXT)\ egui.$(OEXT)\ e_block.$(OEXT)\ e_buffer.$(OEXT)\ e_cmds.$(OEXT)\ e_cvslog.$(OEXT)\ e_file.$(OEXT)\ e_fold.$(OEXT)\ e_line.$(OEXT)\ e_loadsave.$(OEXT)\ e_mark.$(OEXT)\ e_print.$(OEXT)\ e_redraw.$(OEXT)\ e_regex.$(OEXT)\ e_search.$(OEXT)\ e_svnlog.$(OEXT)\ e_tags.$(OEXT)\ e_trans.$(OEXT)\ e_undo.$(OEXT)\ fte.$(OEXT)\ gui.$(OEXT)\ g_draw.$(OEXT)\ g_menu.$(OEXT)\ h_ada.$(OEXT)\ h_c.$(OEXT)\ h_catbs.$(OEXT)\ h_fte.$(OEXT)\ h_ipf.$(OEXT)\ h_make.$(OEXT)\ h_msg.$(OEXT)\ h_pascal.$(OEXT)\ h_perl.$(OEXT)\ h_plain.$(OEXT)\ h_rexx.$(OEXT)\ h_sh.$(OEXT)\ h_simple.$(OEXT)\ h_tex.$(OEXT)\ indent.$(OEXT)\ i_ascii.$(OEXT)\ i_choice.$(OEXT)\ i_complete.$(OEXT)\ i_input.$(OEXT)\ i_key.$(OEXT)\ i_modelview.$(OEXT)\ i_oview.$(OEXT)\ i_search.$(OEXT)\ i_view.$(OEXT)\ log.$(OEXT)\ o_buffer.$(OEXT)\ o_buflist.$(OEXT)\ o_cvs.$(OEXT)\ o_cvsbase.$(OEXT)\ o_cvsdiff.$(OEXT)\ o_directory.$(OEXT)\ o_list.$(OEXT)\ o_messages.$(OEXT)\ o_model.$(OEXT)\ o_modemap.$(OEXT)\ o_routine.$(OEXT)\ o_svn.$(OEXT)\ o_svnbase.$(OEXT)\ o_svndiff.$(OEXT)\ stl_string.$(OEXT)\ s_direct.$(OEXT)\ s_files.$(OEXT)\ s_string.$(OEXT)\ s_util.$(OEXT)\ view.$(OEXT) OS2OBJS =\ e_os2.$(OEXT) VIOOBJS = $(OS2OBJS)\ clip_os2.$(OEXT)\ clip_pmv.$(OEXT)\ con_os2.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ menu_text.$(OEXT) PMOBJS = $(OS2OBJS)\ clip_os2.$(OEXT)\ clip_pm.$(OEXT)\ g_pm.$(OEXT) UNIXOBJS =\ e_unix.$(OEXT)\ memicmp.$(OEXT) XOBJS = $(UNIXOBJS)\ clip_x11.$(OEXT)\ con_i18n.$(OEXT)\ con_x11.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ g_unix_pipe.$(OEXT)\ menu_text.$(OEXT) QOBJS = $(UNIXOBJS)\ clip_x11.$(OEXT)\ g_qt.$(OEXT)\ g_qt_dlg.$(OEXT) SOBJS = $(UNIXOBJS)\ clip_no.$(OEXT)\ con_slang.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ g_unix_pipe.$(OEXT)\ menu_text.$(OEXT) NOBJS = $(UNIXOBJS)\ clip_no.$(OEXT)\ con_ncurses.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ g_unix_pipe.$(OEXT)\ menu_text.$(OEXT) VOBJS = $(UNIXOBJS)\ clip_no.$(OEXT)\ con_linux.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ g_unix_pipe.$(OEXT)\ menu_text.$(OEXT) MOBJS = $(UNIXOBJS)\ clip_no.$(OEXT)\ g_motif.$(OEXT)\ g_nodlg.$(OEXT) NTOBJS =\ clip_os2.$(OEXT)\ con_nt.$(OEXT)\ e_win32.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ menu_text.$(OEXT) DOSP32OBJS =\ clip_no.$(OEXT)\ con_dosx.$(OEXT)\ e_djgpp2.$(OEXT)\ g_nodlg.$(OEXT)\ g_text.$(OEXT)\ memicmp.$(OEXT)\ menu_text.$(OEXT)\ port.$(OEXT)\ portdos.$(OEXT) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_fte.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000013005�11331412504�012224� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_fte.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_FTE #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> // These states should match those in h_c.cpp to let autoindentation work #define hsFTE_Normal 0 #define hsFTE_Comment 1 #define hsFTE_Keyword 4 #define hsFTE_String1 10 #define hsFTE_String2 11 #define hsFTE_CPP 12 #define hsFTE_Regexp 15 #define hsFTE_KeySpec 16 int Hilit_FTE(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; C = 0; NC = 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch(State) { default: case hsFTE_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j)) { State = hsFTE_Keyword; } else { Color = CLR_Normal; State = hsFTE_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsFTE_Normal; continue; } else if (*p == '#') { State = hsFTE_Comment; Color = CLR_Comment; goto hilit; } else if (*p == '%') { State = hsFTE_CPP; Color = CLR_CPreprocessor; goto hilit; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); if (len && (toupper(*p) == 'U')) ColorNext(); if (len && (toupper(*p) == 'L')) ColorNext(); continue; } else if (*p == '\'') { State = hsFTE_String1; Color = CLR_String; goto hilit; } else if (*p == '[') { State = hsFTE_KeySpec; Color = CLR_Command; goto hilit; } else if (*p == '"') { State = hsFTE_String2; Color = CLR_String; goto hilit; } else if (*p == '/') { State = hsFTE_Regexp; Color = CLR_Regexp; goto hilit; } else if (ispunct(*p)) { Color = CLR_Punctuation; ColorNext(); continue; } Color = CLR_Normal; ColorNext(); continue; case hsFTE_Comment: Color = CLR_Comment; goto hilit; case hsFTE_CPP: Color = CLR_CPreprocessor; goto hilit; case hsFTE_String1: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (*p == '\'') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_String2: Color = CLR_String; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '"') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_KeySpec: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == ']') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; case hsFTE_Regexp: Color = CLR_Regexp; if ((len >= 2) && (*p == '\\')) { goto hilit2; } else if (*p == '/') { ColorNext(); State = hsFTE_Normal; continue; } goto hilit; } } } if (State == hsFTE_Comment) State = hsFTE_Normal; if ((len1 == 0) || (*last != '\\')) { switch(State) { case hsFTE_CPP: case hsFTE_String1: case hsFTE_String2: case hsFTE_KeySpec: case hsFTE_Regexp: State = hsFTE_Normal; break; } } *ECol = C; return 0; } #endif // CONFIG_HILIT_FTE ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-xwin.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000013363�07203604605�012705� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# fte-unix.make modified to be generic enough to work with WINNT or UNIX # versions of FTE to build # Versions: # xfte - using XLib (the most stable) # vfte - for Linux console directly (with limitations, see con_linux.cpp) #WINNT ESUF=.exe OEXT=obj OUTFLAG = -out: OUTEXEFLAG = /Fe #UNIX #ESUF= #OEXT=o #OUTFLAG = -o #OUTEXEFLAG = -o # -o must have a space after it above .SUFFIXES: .cpp .$(OEXT) TARGETS = xfte$(ESUF) #TARGETS = vfte$(ESUF) xfte$(ESUF) PRIMARY = xfte$(ESUF) # Comment or uncoment this two flags below if # you want to use: # Keyboard remaping by XFTE #REMAPFLAG = -DUSE_HARD_REMAP # Drawing fonts with locale support #XMBFLAG = -DUSE_XMB # System X11R6 is compiled with X_LOCALE #SYSTEM_X_LOCALE = -DX_LOCALE I18NOPTIONS = $(XMBFLAG) $(REMAPFLAG) $(SYSTEM_X_LOCALE) # Optionally, you can define: # -DDEFAULT_INTERNAL_CONFIG to use internal config by default # -DUSE_XTINIT to use XtInitialize on init APPOPTIONS = -DDEFAULT_INTERNAL_CONFIG -DUSE_XTINIT #gcc/g++ #COPTIONS = -Wall -Wpointer-arith -Wconversion -Wwrite-strings \ # -Wmissing-prototypes -Wmissing-declarations -Winline #CC = g++ #LD = g++ # try this for smaller/faster code and less dependencies #CC = g++ -fno-rtti -fno-exceptions #LD = gcc -fno-rtti -fno-exceptions # choose your os here ####################################################################### #MSVC/EXCEED XDK X_BASE = C:\win32app\Exceed\xdk X_LIBS = -LIBPATH:$(X_BASE)\lib \ HCLXm.lib HCLMrm.lib HCLXmu.lib HCLXt.lib Xlib.lib hclshm.lib xlibcon.lib \ # Xm.lib Mrm.lib Xmu.lib Xt.lib Xlib.lib hclshm.lib xlibcon.lib XINCDIR = -I:$(X_BASE)\include #optimize #OPTIMIZE = /Ox -DNDEBUG #debug #OPTIMIZE = /Od /Zi -D_DEBUG #LDOPTIMIZE = /DEBUG CC = cl LD = link CCFLAGS = $(OPTIMIZE) -DNT -DMSVC $(INCDIR) -DWIN32 -D_CONSOLE -DWINHCLX \ -nologo -W3 -J -DNONXP -DWINNT -D_X86_ -MD -Op -W3 -QIfdiv -GX \ $(XINCDIR) LDFLAGS = $(LDOPTIMIZE) $(LIBDIR) -nologo Advapi32.lib User32.lib Wsock32.lib \ -map /NODEFAULTLIB:libc.lib $(X_LIBS) ####################################################################### # Linux #UOS = -DLINUX #XLIBDIR = -L/usr/X11/lib ####################################################################### # HP/UX #UOS = -DHPUX -D_HPUX_SOURCE -DCAST_FD_SET_INT #UOS = -DHPUX -D_HPUX_SOURCE #CC = CC +a1 #LD = CC #CC = aCC #LD = aCC #XLIBDIR = -L/usr/lib/X11R6 #XINCDIR = -I/usr/include/X11R5 #XLIBDIR = -L/usr/lib/X11R5 #MINCDIR = -I/usr/include/Motif1.2 #MLIBDIR = -L/usr/lib/Motif1.2 SINCDIR = -I/usr/include/slang ####################################################################### # AIX #UOS = -DAIX -D_BSD_INCLUDES # not recently tested (it did work) #CC = xlC #LD = xlC ####################################################################### # Irix # missing fnmatch, but otherwise ok (tested only on 64bit) # 6.x has fnmatch now ;-) # uncomment below to use SGI CC compiler #UOS = -DIRIX #CC = CC #LD = CC #COPTIONS = -xc++ ####################################################################### # SunOS (Solaris) #UOS = -DSUNOS #CC = CC #LD = CC #XINCDIR = -I/usr/openwin/include #XLIBDIR = -L/usr/openwin/lib ####################################################################### # for SCO CC # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # If you have problems with the program "cfte" # try to compile this program without optimalization -O2 # use just -O # #UOS = -DSCO #CC = CC -b elf #LD = $(CC) #XLIBDIR = -L/usr/X11R6/lib #SOCKETLIB = -lsocket #COPTIONS = +.cpp ####################################################################### # NCR #CC = cc -Hnocopyr #LD = cc -Hnocopyr #COPTIONS = -w3 #UOS = -DNCR #XINCDIR = -I../../include #SOCKETLIB = -lsocket -lnsl -lc -lucb ####################################################################### #QTDIR = /users/markom/qt #QLIBDIR = -L$(QTDIR)/lib #QINCDIR = -I$(QTDIR)/include #QINCDIR = -I/usr/include/qt MOC = moc #LIBDIR = #INCDIR = #OPTIMIZE = -O -g #OPTIMIZE = -O2 #OPTIMIZE = -O2 -s #UNIX #CCFLAGS = $(OPTIMIZE) $(I18NOPTIONS) $(COPTIONS) -DUNIX $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) $(SINCDIR) #LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) $(QLIBDIR) $(MLIBDIR) include objs.inc #UNIX # need -lXt below if USE_XTINIT #XLIBS = -lX11 -Xt $(SOCKETLIB) #VLIBS = -lgpm -lncurses # -ltermcap outdated by ncurses #SLIBS = -lslang #QLIBS = -lqt #MLIBS = -lXm -lXp -lXt -lXpm -lXext .cpp.$(OEXT): $(CC) $(CCFLAGS) $(APPOPTIONS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) $(APPOPTIONS) -c $< .cpp.moc: $(MOC) $< -o $@ all: cfte$(ESUF) $(TARGETS) # rm -f fteln -s $(PRIMARY) fte cfte$(ESUF): cfte.$(OEXT) s_files.$(OEXT) $(LD) $(LDFLAGS) cfte.$(OEXT) s_files.$(OEXT) $(OUTFLAG)cfte$(ESUF) c_config.$(OEXT): defcfg.h #defcfg.h: defcfg.cnf # perl mkdefcfg.pl <defcfg.cnf >defcfg.h defcfg.h: defcfg.cnf bin2c$(ESUF) bin2c$(ESUF) defcfg.cnf >defcfg.h bin2c$(ESUF): bin2c.cpp $(CC) $(CCFLAGS) $(OUTEXEFLAG)bin2c$(ESUF) bin2c.cpp DEFAULT_FTE_CONFIG = simple.fte #DEFAULT_FTE_CONFIG = defcfg.fte #DEFAULT_FTE_CONFIG = defcfg2.fte #DEFAULT_FTE_CONFIG = ../config/main.fte defcfg.cnf: $(DEFAULT_FTE_CONFIG) cfte$(ESUF) cfte$(ESUF) $(DEFAULT_FTE_CONFIG) defcfg.cnf xfte$(ESUF): $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) $(OUTFLAG)xfte$(ESUF) qfte$(ESUF): g_qt.moc g_qt_dlg.moc $(OBJS) $(QOBJS) $(LD) $(LDFLAGS) $(OBJS) $(QOBJS) $(QLIBS) $(XLIBS) $(OUTFLAG)qfte$(ESUF) vfte$(ESUF): $(OBJS) $(VOBJS) $(LD) $(LDFLAGS) $(OBJS) $(VOBJS) $(VLIBS) $(OUTFLAG)vfte$(ESUF) mfte$(ESUF): $(OBJS) $(MOBJS) $(LD) $(LDFLAGS) $(OBJS) $(MOBJS) $(MLIBS) $(XLIBS) $(OUTFLAG)mfte$(ESUF) g_qt.$(OEXT): g_qt.moc g_qt_dlg.$(OEXT): g_qt_dlg.moc clean: rm -f *.$(OEXT) $(TARGETS) defcfg.h defcfg.cnf cfte$(ESUF) fte$(ESUF) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_os2.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000003564�11602724002�012662� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_os2.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "e_buffer.h" #include "clip.h" int GetPMClip(int clipboard) { ClipData cd; unsigned int i, j, l, dx; EPoint P; if (clipboard != 0) // only one clipboard supported return 0; if (!GetClipText(&cd)) return 0; SSBuffer->Clear(); j = 0; l = 0; for (i = 0; i < cd.fLen; i++) { if (cd.fChar[i] == 0x0A) { SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (cd.fChar[i-1] == 0x0D)) dx++; SSBuffer->InsertLine(P, i - j - dx, cd.fChar + j); j = i + 1; } } if (j < cd.fLen) { // remainder i = cd.fLen; SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (cd.fChar[i-1] == 0x0D)) dx++; SSBuffer->InsText(P.Row, P.Col, i - j - dx, cd.fChar + j); j = i + 1; } // now that we don't need cd.fChar anymore, free it free(cd.fChar); return 1; } int PutPMClip(int clipboard) { char *p = NULL; int l = 0; PELine L; int Len; ClipData cd; int rc; if (clipboard != 0) // only one clipboard supported return 0; for (int i = 0; i < SSBuffer->RCount; i++) { L = SSBuffer->RLine(i); p = (char *)realloc(p, l + (Len = L->Count) + 2); memcpy(p + l, L->Chars, L->Count); l += Len; if (i < SSBuffer->RCount - 1) { p[l++] = 13; p[l++] = 10; } } p = (char *)realloc(p, l + 1); p[l++] = 0; cd.fChar = p; cd.fLen = l; rc = PutClipText(&cd); free(p); return rc; } ��������������������������������������������������������������������������������������������������������������������������������������������./src/con_tty.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000014134�11333277523�012303� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef CON_TTY_H #define CON_TTY_H /* * Handling escape sequencies is quite complex * easiest seems to be the use of sequence table * instead of creating complex if/else code, * though there are some obviously visible bitmasks */ #include "fte.h" #include "conkbd.h" #include <ctype.h> #include <stdio.h> // fprintf #include <stdlib.h> #include <string.h> struct TTYDecodeSeq { char seq[8]; int key; }; // *INDENT-OFF* static const TTYDecodeSeq tty_seq_table_c[] = { /* '%' replaced with 2..8 with modified Alt | Ctrl | Shift */ { "[1;%A", kbUp }, { "[%A", kbUp }, { "[A", kbUp }, { "[a", kfShift | kbUp }, { "[1;%B", kbDown }, { "[%B", kbDown }, { "[B", kbDown }, { "[b", kfShift | kbDown }, { "[1;%C", kbRight }, { "[%C", kbRight }, { "[C", kbRight }, { "[c", kfShift | kbRight }, { "[1;%D", kbLeft }, { "[%D", kbLeft }, { "[D", kbLeft }, { "[d", kfShift | kbLeft }, { "[1;%F", kbEnd }, { "[%F", kbEnd }, { "[F", kbEnd }, { "[1;%H", kbHome }, { "[%H", kbHome }, { "[H", kbHome }, { "[1;%P", kbF1 }, { "[1;%Q", kbF2 }, { "[1;%R", kbF3 }, { "[1;%S", kbF4 }, { "[15;%~", kbF5 }, { "[15~", kbF5 }, { "[17;%~", kbF6 }, { "[17~", kbF6 }, { "[18;%~", kbF7 }, { "[18~", kbF7 }, { "[19;%~", kbF8 }, { "[19~", kbF8 }, { "[20;%~", kbF9 }, { "[20~", kbF9 }, { "[21;%~", kbF10 }, { "[21~", kbF10 }, { "[23;%~", kbF11 }, { "[23~", kbF11 }, { "[24;%~", kbF12 }, { "[24~", kbF12 }, { "[1;%~", kbHome }, { "[1~", kbHome }, { "[2;%~", kbIns }, { "[2~", kbIns }, { "[3;%~", kbDel }, { "[3~", kbDel }, { "[4;%~", kbEnd }, { "[4~", kbEnd }, { "[5;%~", kbPgUp }, { "[5~", kbPgUp }, { "[6;%~", kbPgDn }, { "[6~", kbPgDn }, { "[V", kbPgUp }, { "[v", kbPgUp }, { "[25~", kfShift | kbF1 }, { "[26~", kfShift | kbF2 }, { "[28~", kfShift | kbF3 }, { "[29~", kfShift | kbF4 }, { "[31~", kfShift | kbF5 }, { "[32~", kfShift | kbF6 }, { "[33~", kfShift | kbF7 }, { "[34~", kfShift | kbF8 }, { "[[A", kbF1 }, { "[[B", kbF2 }, { "[[C", kbF3 }, { "[[D", kbF4 }, { "[[E", kbF5 }, { "[P", kbPrtScr }, { "[Z", kfShift | kbTab }, { "O%A", kbUp }, { "O%B", kbDown }, { "O%C", kbRight }, { "O%D", kbLeft }, { "OF", kbEnd }, { "Ow", kbEnd }, { "OH", kbHome }, { "O1;%P", kbF1 }, { "O%P", kbF1 }, { "OP", kbF1 }, { "O1;%Q", kbF2 }, { "O%Q", kbF2 }, { "OQ", kbF2 }, { "O1;%R", kbF3 }, { "O%R", kbF3 }, { "OR", kbF3 }, { "O1;%S", kbF4 }, { "O%S", kbF4 }, { "OS", kbF4 }, }; // *INDENT-ON* /* Sorted via qsort in runtime so there is NO const here! */ static struct TTYDecodeSeq tty_esc_seq[FTE_ARRAY_SIZE(tty_seq_table_c) * 7]; static unsigned tty_seq_size = 0; static int TTYCompSeq(const void *a, const void *b) { int c = strcmp(((const TTYDecodeSeq*)a)->seq, ((const TTYDecodeSeq*)b)->seq); if (c == 0) { tty_seq_size = 0; fprintf(stderr, "ERROR: tty_seq_table_c contains duplicate Escape sequence \"%s\"!\n", ((const TTYDecodeSeq*)a)->seq); } return c; } static inline int TTYParseEsc(const char *seq) { if (seq[1] == 0) { char ch = seq[0]; if (ch < 32) { switch (ch) { case 0: return kbEsc; case '\b': return (kfAlt | kbBackSp); case '\t': return (kfShift | kbTab); case '\n': return (kfAlt | kbEnter); case 27: return (kfAlt | kbEsc); default: return (kfAlt | kfCtrl | (ch + 'A' - 1)); } } else if (ch == 0x7f) return kfAlt | kbBackSp; else if (ch >= 'a' && ch <= 'z') return (kfAlt | (ch + 'A' - 'a')); else if (ch >= 'A' && ch <= 'Z') return (kfAlt | kfShift | ch); // FIXME: depends on keyboard mapping else if (strchr("`1234567890-=[];'\\,./", ch)) return (kfAlt | ch); else if (strchr("~!@#$%%^&*()_+{}:\"|<>?", ch)) return (kfAlt | kfShift | ch); } // standard routine for binary search unsigned i, H = 0, L = 0; unsigned R = tty_seq_size; while (L < R) { int c; H = L + (R - L) / 2; //if ((c = strcmp(seq, tty_esc_seq[H].seq)) == 0) { // replace strcmp with direct char compare for (i = 0; (!(c = (seq[i] - tty_esc_seq[H].seq[i])) && tty_esc_seq[H].seq[i]); ++i) ; if (c == 0 && tty_esc_seq[H].seq[i] == 0) { //fprintf(stderr, "Found key: 0x%x %s %s\n", // tty_esc_seq[H].key, tty_esc_seqast [H].seq, seq); return tty_esc_seq[H].key; } else if (c < 0) R = H; else // (c > 0) L = H + 1; } // for detecting unknown Esq sequences - sfte 2>/tmp/newesc //fprintf(stderr, "FIXME: Unknown Esc sequence: \"%s\"\n", seq); for (int i = 0; seq[i]; ++i) fprintf(stderr, "FIXME: Unknown Esc sequence: \"%d %x %c\"\n", seq[i], seq[i], isprint(seq[i]) ? seq[i] : ' '); return kbEsc; } /* * Create table from template and replace '%' with character numbers * from '2' to '8' with appropriate Alt, Ctrl, Shift modifiers */ static inline int TTYInitTable(void) { for (unsigned i = 0; i < sizeof(tty_seq_table_c)/sizeof(tty_seq_table_c[0]); ++i) { for (unsigned j = '2'; j <= '8'; ++j) { static const int kf[] = { kfShift, // '2' kfAlt, kfAlt | kfShift, kfCtrl, kfCtrl | kfShift, kfCtrl | kfAlt, kfAlt | kfCtrl | kfShift // '8' }; char *rep; tty_esc_seq[tty_seq_size].key = tty_seq_table_c[i].key; if (!(rep = strchr(strcpy(tty_esc_seq[tty_seq_size].seq, tty_seq_table_c[i].seq), '%'))) { tty_seq_size++; break; } rep[0] = (char)j; tty_esc_seq[tty_seq_size++].key |= kf[j - '2']; } } qsort(tty_esc_seq, tty_seq_size, sizeof(TTYDecodeSeq), TTYCompSeq); if (!tty_seq_size) return 1; return 0; #if 0 const char * const test[] = { "[1;2A", "OF", "ODS", "[1;8R", 0 }; for (unsigned i = 0; test[i]; i++) fprintf(stderr, "search %s %d\n", test[i], TTYParseEsc(test[i])); for (unsigned i = 0; i < tty_seq_size; ++i) fprintf(stderr, "%d %s %x\n", i, tty_esc_seq[i].seq, tty_esc_seq[i].key); return 1; #endif } #endif // CON_TTY_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_input.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000017473�11602724002�012623� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_input.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_color.h" #include "c_config.h" #include "c_history.h" #include "i_view.h" #include "o_buflist.h" #include "s_util.h" #include <ctype.h> ExInput::ExInput(const char *APrompt, const char *ALine, size_t ABufLen, Completer AComp, int Select, int AHistId) : Prompt(APrompt), MaxLen(ABufLen - 1), Line(new char[MaxLen + 1]), MatchStr(new char[MaxLen + 1]), CurStr(new char[MaxLen + 1]), LPos(0), Comp(AComp), TabCount(0), HistId(AHistId), CurItem(0), SelStart(0), SelEnd(0) { assert(ABufLen > 0); Line[MaxLen] = 0; strncpy(Line, ALine, MaxLen); Pos = strlen(Line); if (Select) SelEnd = Pos; } ExInput::~ExInput() { delete[] Line; delete[] MatchStr; delete[] CurStr; } void ExInput::HandleEvent(TEvent &Event) { switch (Event.What) { case evKeyDown: switch (kbCode(Event.Key.Code)) { case kbLeft: if (Pos > 0) Pos--; common: SelStart = SelEnd = 0; TabCount = 0; Event.What = evNone; break; case kbRight: Pos++; goto common; case kbLeft | kfCtrl: if (Pos > 0) { Pos--; while (Pos > 0) { if (isalnum(Line[Pos]) && !isalnum(Line[Pos - 1])) break; Pos--; } } goto common; case kbRight | kfCtrl: while (Line[Pos]) if (!isalnum(Line[Pos++]) && (isalnum(Line[Pos]))) break; goto common; case kbHome: Pos = 0; goto common; case kbEnd: Pos = strlen(Line); goto common; case kbEsc: EndExec(0); goto common; case kbEnter: #ifdef CONFIG_HISTORY AddInputHistory(HistId, Line); #endif EndExec(1); goto common; case kbBackSp | kfCtrl | kfShift: Pos = 0; Line[0] = 0; goto common; case kbBackSp | kfCtrl: if (Pos > 0) { if (Pos > strlen(Line)) { Pos = strlen(Line); } else { char Ch; if (Pos > 0) do { Pos--; memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); if (Pos == 0) break; Ch = Line[Pos - 1]; } while (Pos > 0 && Ch != '\\' && Ch != '/' && Ch != '.' && isalnum(Ch)); } } goto common; case kbBackSp: case kbBackSp | kfShift: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } if (Pos <= 0) break; Pos--; if (Pos < strlen(Line)) memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); TabCount = 0; Event.What = evNone; break; case kbDel: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } if (Pos < strlen(Line)) memmove(Line + Pos, Line + Pos + 1, strlen(Line + Pos + 1) + 1); TabCount = 0; Event.What = evNone; break; case kbDel | kfCtrl: if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; break; } Line[Pos] = 0; goto common; case kbIns | kfShift: case 'V' | kfCtrl: { if (SystemClipboard) GetPMClip(0); if (SSBuffer == 0) break; if (SSBuffer->RCount == 0) break; if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; } size_t len = SSBuffer->LineChars(0); if (strlen(Line) + len < MaxLen) { memmove(Line + Pos + len, Line + Pos, strlen(Line + Pos) + 1); memcpy(Line + Pos, SSBuffer->RLine(0)->Chars, len); Pos += len; TabCount = 0; Event.What = evNone; } } break; #ifdef CONFIG_HISTORY case kbUp: if (CurItem == 0) strcpy(CurStr, Line); CurItem += 2; /* fall */ case kbDown: SelStart = SelEnd = 0; if (CurItem == 0) break; CurItem--; { int cnt = CountInputHistory(HistId); if (CurItem > cnt) CurItem = cnt; if (CurItem < 0) CurItem = 0; if (!CurItem || !GetInputHistory(HistId, Line, MaxLen, CurItem)) strcpy(Line, CurStr); Pos = strlen(Line); } Event.What = evNone; break; #endif case kbTab | kfShift: TabCount -= 2; /* fall */ case kbTab: if (Comp) { char *Str2 = (char*)alloca(MaxLen + 1); int n; TabCount++; if (TabCount < 1) TabCount = 1; if ((TabCount == 1) && (kbCode(Event.Key.Code) == kbTab)) strcpy(MatchStr, Line); n = Comp(MatchStr, Str2, TabCount); if ((n > 0) && (TabCount <= n)) { strcpy(Line, Str2); Pos = strlen(Line); } else if (TabCount > n) TabCount = n; } SelStart = SelEnd = 0; Event.What = evNone; break; case 'Q' | kfCtrl: Event.What = evKeyDown; Event.Key.Code = Win->GetChar(0); default: { char Ch; if (GetCharFromEvent(Event, &Ch) && (strlen(Line) < MaxLen)) { if (SelStart < SelEnd) { memmove(Line + SelStart, Line + SelEnd, strlen(Line + SelEnd) + 1); Pos = SelStart; SelStart = SelEnd = 0; } memmove(Line + Pos + 1, Line + Pos, strlen(Line + Pos) + 1); Line[Pos++] = Ch; TabCount = 0; Event.What = evNone; } } break; } Event.What = evNone; break; } } void ExInput::RepaintStatus() { TDrawBuffer B; int W, H, FLen, FPos; ConQuerySize(&W, &H); FPos = Prompt.size() + 2; FLen = W - FPos; if (Pos > strlen(Line)) Pos = strlen(Line); //if (Pos < 0) Pos = 0; if (LPos + FLen <= Pos) LPos = Pos - FLen + 1; if (Pos < LPos) LPos = Pos; MoveChar(B, 0, W, ' ', hcEntry_Field, W); MoveStr(B, 0, W, Prompt.c_str(), hcEntry_Prompt, FPos); MoveChar(B, FPos - 2, W, ':', hcEntry_Prompt, 1); MoveStr(B, FPos, W, Line + LPos, hcEntry_Field, FLen); MoveAttr(B, FPos + SelStart - LPos, W, hcEntry_Selection, SelEnd - SelStart); ConSetCursorPos(FPos + Pos - LPos, H - 1); ConPutBox(0, H - 1, W, 1, B); ConShowCursor(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_text.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000074217�11602724002�012445� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_text.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_color.h" #include "c_mode.h" #include "gui.h" #include "sysdep.h" #include <signal.h> #include <stdarg.h> #include <stdio.h> int ShowVScroll = 1; int ShowHScroll = 1; int ShowMenuBar = 1; int ShowToolBar = 0; unsigned long HaveGUIDialogs = 0; // no gui dialogs in text gui GFrame *frames = 0; GUI *gui = 0; GView *MouseCapture = 0; GView *FocusCapture = 0; TEvent NextEvent = { 0 }; #define sfFocus 1 class UpMenu; extern int ExecMainMenu(TEvent &E, char sub); extern int ExecVertMenu(int x, int y, int id, TEvent &E, UpMenu *up); class GViewPeer { public: GView *View; int wX, wY, wW, wH, wState; int cX, cY, cVisible, cStart, cEnd; int sbVstart, sbVamount, sbVtotal, sbVupdate; int sbHstart, sbHamount, sbHtotal, sbHupdate; int SbVBegin, SbVEnd, SbHBegin, SbHEnd; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); #ifdef CONFIG_MOUSE int CaptureMouse(int grab); #endif int CaptureFocus(int grab); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int DrawScrollBar(); int UpdateCursor(); }; class GFramePeer { public: int fW, fH; GFrame *Frame; GFramePeer(GFrame *aFrame, int Width, int Height); ~GFramePeer(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); }; /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) : View(view), wX(0), wY(0), wW(XSize), wH(YSize), wState(0), cX(0), cY(0), cVisible(1), cStart(0), // % cEnd(100), sbVstart(0), sbVamount(0), sbVtotal(0), sbVupdate(1), sbHstart(0), sbHamount(0), sbHtotal(0), sbHupdate(1) { } GViewPeer::~GViewPeer() { #ifdef CONFIG_MOUSE if (MouseCapture == View) MouseCapture = 0; #endif if (FocusCapture == View) FocusCapture = 0; } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return ::ConPutBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return ::ConGetBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return ::ConPutLine(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return ::ConSetBox(X + wX, Y + wY, W, H, Cell); } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return ::ConScroll(Way, X + wX, Y + wY, W, H, Fill, Count); } int GViewPeer::ConSetSize(int X, int Y) { wW = X; wH = Y; return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; if (Y >= wH) Y = wH - 1; cX = X; cY = Y; if (wState & sfFocus) return ::ConSetCursorPos(cX + wX, cY + wY); return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; if (wState & sfFocus) return ::ConShowCursor(); return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; if (wState & sfFocus) return ::ConHideCursor(); return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } int GViewPeer::ConSetCursorSize(int Start, int End) { cStart = Start; cEnd = End; if (wState & sfFocus) return ::ConSetCursorSize(Start, End); return 1; } #ifdef CONFIG_MOUSE int GViewPeer::CaptureMouse(int grab) { if (MouseCapture == 0) { if (!grab) return 0; MouseCapture = View; } else { if (grab || MouseCapture != View) return 0; MouseCapture = 0; } return 1; } #endif int GViewPeer::CaptureFocus(int grab) { if (FocusCapture == 0) { if (!grab) return 0; FocusCapture = View; } else { if (grab || FocusCapture != View) return 0; FocusCapture = 0; } return 1; } int GViewPeer::ExpandHeight(int DeltaY) { if (View->Parent->Top == View->Next) return 0; if (DeltaY + wH < 3) DeltaY = - (wH - 3); if (View->Next->Peer->wH - DeltaY < 3) DeltaY = View->Next->Peer->wH - 3; View->Peer->ConSetSize(wW, wH + DeltaY); View->Next->Peer->wY += DeltaY; assert(View->Next->Peer->wY >= 0); View->Next->Peer->ConSetSize(View->Next->Peer->wW, View->Next->Peer->wH - DeltaY); View->Resize(View->Peer->wW, View->Peer->wH); View->Next->Resize(View->Next->Peer->wW, View->Next->Peer->wH); return 1; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; sbVupdate = 1; } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; sbHupdate = 1; } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetCursorSize(cStart, cEnd); if (cVisible) ConShowCursor(); else ConHideCursor(); return 1; } int GViewPeer::DrawScrollBar() { TDrawBuffer B; int NRows, NCols, I; int W, H; char fore = ConGetDrawChar(DCH_HFORE); char back = ConGetDrawChar(DCH_HBACK); ConQuerySize(&W, &H); if (ShowVScroll && H > 1) { MoveCh(B, ConGetDrawChar(DCH_AUP), hcScrollBar_Arrows, 1); ConPutBox(W, 0, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ADOWN), hcScrollBar_Arrows, 1); ConPutBox(W, H - 1, 1, 1, B); NRows = H - 2; if (sbVtotal <= NRows) { SbVBegin = 0; SbVEnd = NRows - 1; } else { SbVBegin = NRows * sbVstart / sbVtotal; SbVEnd = SbVBegin + NRows * sbVamount / sbVtotal; } for (I = 0; I < NRows; I++) { if (I >= SbVBegin && I <= SbVEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(W, I + 1, 1, 1, B); } } if (ShowHScroll && W > 1) { MoveCh(B, ConGetDrawChar(DCH_ALEFT), hcScrollBar_Arrows, 1); ConPutBox(0, H, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ARIGHT), hcScrollBar_Arrows, 1); ConPutBox(W - 1, H, 1, 1, B); NCols = W - 2; if (sbHtotal <= NCols) { SbHBegin = 0; SbHEnd = NCols - 1; } else { SbHBegin = NCols * sbHstart / sbHtotal; SbHEnd = SbHBegin + NCols * sbHamount / sbHtotal; } // could be made faster for (I = 0; I < NCols; I++) { if (I >= SbHBegin && I <= SbHEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(I + 1, H, 1, 1, B); } } if (ShowVScroll && ShowHScroll) { MoveCh(B, ' ', hcScrollBar_Arrows, 1); ConPutBox(W, H, 1, 1, B); } return 1; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) : Parent(parent), Next(0), Prev(0), Peer(new GViewPeer(this, XSize, YSize)) { if (Parent) Parent->AddView(this); //fprintf(stderr, "CREATE GVIEW %p\n", this); } GView::~GView() { if (Parent) Parent->RemoveView(this); delete Peer; //fprintf(stderr, "DESTROY GVIEW %p\n", this); } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { if (Peer->ConSetSize(X, Y)) { Resize(X, Y); return 1; } return 0; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } int GView::ConSetCursorSize(int Start, int End) { return Peer->ConSetCursorSize(Start, End); } #ifdef CONFIG_MOUSE int GView::CaptureMouse(int grab) { return Peer->CaptureMouse(grab); } #endif int GView::CaptureFocus(int grab) { return Peer->CaptureFocus(grab); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &/*Event*/) { } void GView::Resize(int /*width*/, int /*height*/) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; int didFocus = 0; if (FocusCapture == 0) { if (!CaptureFocus(1)) return 0; didFocus = 1; } else if (FocusCapture != this) return 0; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; if (didFocus) CaptureFocus(0); return NewResult; } int GView::IsActive() { return (Parent->Active == this); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else { Peer->wState &= ~sfFocus; } Repaint(); } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *aFrame, int Width, int Height) { Frame = aFrame; if (Width != -1 && Height != -1) ConSetSize(Width, Height); ConQuerySize(&fW, &fH); } GFramePeer::~GFramePeer() { } int GFramePeer::ConSetSize(int X, int Y) { return ::ConSetSize(X, Y); } int GFramePeer::ConQuerySize(int *X, int *Y) { ::ConQuerySize(&fW, &fH); if (X) *X = fW; if (Y) *Y = fH; return 1; } //int GFrame::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(X, Y); // if (ShowVScroll) // --*X; //} int GFramePeer::ConSetTitle(const char *Title, const char *STitle) { ::ConSetTitle(Title, STitle); return 1; } int GFramePeer::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { return ::ConGetTitle(Title, MaxLen, STitle, SMaxLen); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) : Top(0), Active(0), Menu(0) { if (frames == 0) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { //fprintf(stderr, "DELETE GFRAME %p %p\n", Next, this); delete Peer; if (Next == this) { frames = 0; } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; } free(Menu); } int GFrame::ConSetTitle(const char *Title, const char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; newview->Peer->wX = 0; ConQuerySize(&newview->Peer->wW, &dmy); if (ShowVScroll) newview->Peer->wW--; newview->Peer->wY = view->Peer->wY + view->Peer->wH / 2; assert(newview->Peer->wY >= 0); newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2; if (ShowHScroll) { newview->Peer->wY++; newview->Peer->wH--; } view->Peer->wH /= 2; view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); InsertView(view, newview); return 1; } int GFrame::ConCloseView(GView * /*view*/) { return 1; } int GFrame::ConResizeView(GView * /*view*/, int /*DeltaY*/) { return 1; } int GFrame::AddView(GView *view) { //fprintf(stderr, "GFRAME ADDVIEW %p, t %p a %p\n", view, Top, Active); if (Active != 0) return ConSplitView(Active, view); int W, H; view->Parent = this; view->Prev = view->Next = 0; view->Peer->wX = 0; view->Peer->wY = (ShowMenuBar) ? 1 : 0; ConQuerySize(&W, &H); if (ShowMenuBar) H--; if (ShowVScroll) W--; if (ShowHScroll) H--; view->ConSetSize(W, H); InsertView(Top, view); return 1; } void GFrame::Update() { UpdateMenu(); for (GView *v = Active; v; v = v->Next) { v->Update(); if ((ShowVScroll || ShowHScroll) && (v->Peer->sbVupdate || v->Peer->sbHupdate)) { v->Peer->DrawScrollBar(); v->Peer->sbVupdate = 0; v->Peer->sbHupdate = 0; } if (v->Next == Active) break; } } void GFrame::UpdateMenu() { if (ShowMenuBar) DrawMenuBar(); } void GFrame::Repaint() { if (ShowMenuBar) DrawMenuBar(); for (GView *v = Active; v; v = v->Next) { v->Repaint(); if (ShowVScroll || ShowHScroll) { v->Peer->DrawScrollBar(); v->Peer->sbVupdate = 0; v->Peer->sbHupdate = 0; } if (v->Next == Active) break; } } void GFrame::InsertView(GView *prev, GView *view) { if (!view) return; if (prev) { view->Prev = prev; view->Next = prev->Next; prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; if (Top == view) { Top = view->Next; Top->Peer->wY -= view->Peer->wH; assert(Top->Peer->wY >= 0); Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH + (ShowHScroll ? 1 : 0)); } else { view->Prev->ConSetSize(view->Prev->Peer->wW, view->Prev->Peer->wH + view->Peer->wH + (ShowHScroll ? 1 : 0)); } if (Active == view) { Active = view->Prev; Active->Activate(1); } } } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; if (FocusCapture != 0) return ; else if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { if (c) c->Activate(0); if (Active) Active->Activate(1); } } int GFrame::SelectView(GView *view) { if (!Top) return 0; if (FocusCapture != 0) view = view; if (Active) Active->Activate(0); Active = view; if (Active) Active->Activate(1); return 1; } void GFrame::Resize(int width, int height) { if (!Top) return; int count = 1; for (GView *V = Top->Next; V != Top; V = V->Next) count++; if (height < 2 * count + 2 || width < 16) { ::ConSetSize(16, 2 * count + 1); return; } if (ShowVScroll) width--; if (ShowHScroll) height--; //fprintf(stderr, "Resize: %d %d c:%d\n", width, height, count); for (GView *V = Top->Prev; V != Top; V = V->Prev) { int h, y; h = V->Peer->wH; y = V->Peer->wY; if (y >= height - 2) { y = height - 2; } if (y + h != height) { h = height - y; } V->Peer->wY = y; V->ConSetSize(width, h); height = y; } if (ShowMenuBar) height--; Top->ConSetSize(width, height); Repaint(); // fprintf(stderr, "Resize: %d %d Done\n", width, height); } int GFrame::ExecMainMenu(char Sub) { NextEvent.What = evCommand; NextEvent.Msg.Command = cmMainMenu; NextEvent.Msg.Param1 = Sub; return 1; } int GFrame::SetMenu(const char *Name) { free(Menu); Menu = strdup(Name); return 1; } void GFrame::Show() { } void GFrame::Activate() { frames = this; } int GUI::ConGrabEvents(TEventMask /*EventMask*/) { return 1; } void GUI::DispatchEvent(GFrame * /*frame*/, GView *view, TEvent &Event) { if (Event.What != evNone) if (view) view->HandleEvent(Event); } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { if (view) *view = 0; return ::ConGetEvent(EventMask, Event, WaitTime, Delete); } int GUI::ConPutEvent(const TEvent& Event) { return ::ConPutEvent(Event); } int GUI::ConFlush() { return 1; } static inline int scrollBreak(TEvent &E) { #if defined(DOS) || defined(DOSP32) // workaround until mouse code in con_dosx.cpp is finished return (E.What != evMouseDown); #else return (E.What == evMouseUp); #endif } static void HandleVScroll(GView *view, TEvent &E) { int y; int wY, wH; TEvent E1; y = E.Mouse.Y; wY = view->Peer->wY; wH = view->Peer->wH; if (y == wY) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollUp; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y == wY + wH - 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollDown; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y < wY + view->Peer->SbVBegin + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollPgUp; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (y > wY + view->Peer->SbVEnd + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollPgDn; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else { int delta = y - 1 - view->Peer->SbVBegin - wY; do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmVScrollMove; E1.Msg.Param1 = (E.Mouse.Y - wY - 1 - delta + 1) * view->Peer->sbVtotal / (wH - 2); // printf("YPos = %d %d %d \n\x7", E.Mouse.Y, wY, delta); gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } E.What = evNone; } static void HandleHScroll(GView *view, TEvent &E) { int x; int wX, wW; TEvent E1; x = E.Mouse.X; wX = view->Peer->wX; wW = view->Peer->wW; if (x == wX) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollLeft; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x == wX + wW - 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollRight; E1.Msg.Param1 = 1; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x < wX + view->Peer->SbHBegin + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollPgLt; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else if (x > wX + view->Peer->SbHEnd + 1) { do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollPgRt; gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } else { int delta = x - 1 - view->Peer->SbHBegin - wX; do { E1.What = evCommand; E1.Msg.View = view; E1.Msg.Command = cmHScrollMove; E1.Msg.Param1 = (E.Mouse.X - wX - 1 - delta + 1) * view->Peer->sbHtotal / (wW - 2); // printf("YPos = %d %d %d \n\x7", E.Mouse.Y, wY, delta); gui->DispatchEvent(frames, view, E1); frames->Update(); do { ConGetEvent(evMouse | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, view, E); } while (E.What & evNotify); if (scrollBreak(E)) break; } while (1); } E.What = evNone; } void GUI::ProcessEvent() { TEvent E; E = NextEvent; if (E.What != evNone) NextEvent.What = evNone; if (E.What == evNone && (!ConGetEvent(evMouse | evCommand | evKeyboard, &E, 0, 1, 0) || E.What == evNone)) { frames->Update(); while (!ConGetEvent(evMouse | evCommand | evKeyboard, &E, -1, 1, 0) || (E.What == evMouseMove && E.Mouse.Buttons == 0)); } if (E.What != evNone) { GView *view = frames->Active; if (E.What & evMouse) { if (E.What == evMouseDown && E.Mouse.Y == 0 && ShowMenuBar && MouseCapture == 0 && FocusCapture == 0) { frames->Update(); // sync before menu if (!ExecMainMenu(E, 0)) { if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } // fprintf(stderr, "Command got = %d\n", E.Msg.Command); } if (E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0) { GView *V = frames->Active; while (V) { if (E.Mouse.Y >= V->Peer->wY && E.Mouse.Y < V->Peer->wY + V->Peer->wH + (ShowHScroll ? 1 : 0)) { frames->SelectView(V); view = V; break; } V = V->Next; if (V == frames->Active) break; } } if (ShowVScroll && ShowHScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.Y == view->Peer->wY + view->Peer->wH && E.Mouse.X == view->Peer->wX + view->Peer->wW) { } else { if (ShowVScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.X == view->Peer->wX + view->Peer->wW) { HandleVScroll(view, E); return ; } if (ShowHScroll && E.What == evMouseDown && MouseCapture == 0 && FocusCapture == 0 && E.Mouse.Y == view->Peer->wY + view->Peer->wH) { HandleHScroll(view, E); return ; } } if (E.What & evMouse) { E.Mouse.Y -= view->Peer->wY; E.Mouse.X -= view->Peer->wX; } } if (E.What == evCommand) { switch (E.Msg.Command) { case cmResize: { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } break; case cmMainMenu: { char Sub = (char)E.Msg.Param1; frames->Update(); // sync before menu if (!::ExecMainMenu(E, Sub)) {; if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } } break; case cmPopupMenu: { long id = E.Msg.Param1; int Cols, Rows; if (id == -1) return; frames->ConQuerySize(&Cols, &Rows); int x = Cols / 2, y = Rows / 2; #ifdef CONFIG_MOUSE ConQueryMousePos(&x, &y); #endif frames->Update(); // sync before menu if (::ExecVertMenu(x, y, id, E, 0) != 1) { if (E.What == evCommand && E.Msg.Command == cmResize) { int X, Y; ConQuerySize(&X, &Y); frames->Resize(X, Y); } E.What = evNone; } } break; } } if (E.What != evNone) DispatchEvent(frames, view, E); } } int GUI::Run() { if (!Start(fArgc, fArgv)) return 0; for (doLoop = 1; doLoop;) ProcessEvent(); Stop(); return 1; } int GUI::multiFrame() { return 0; } void DieError(int rc, const char *msg, ...) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); fprintf(stderr, "\n"); exit(rc); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_nt.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000162704�11602724002�012432� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_nt.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* some functionality is now shared with g_text.cpp and g_draw.cpp */ /* new os/2 code needs to be merged with this */ /* the console APIs on win'95 seem to be really screwed up */ /* * 10/13/96 Jal: * Rebuilt for Windows NT, generic; no port/Watcom code should * be needed to compile (jal). * Removed most mouse handling code (unnecessary), added pipe handler by * porting the OS/2 version to NT. * Solved some bugs with regard to the TCell problem. * * 10/28/96 Jal: * Started to replace threaded pipe code with nonthreaded code, using * overlapped I/O. * * Wed Jan 15 1997 (Jal): * - The Grey-Alt-+ key and some other keys were not recognised. This * was because NT didn't mark these as "enhanced" keys. Now the code * translates some (scancode,ascii) pairs to the enhanced keyboard. * The table was already present! * - To solve the "flashing cursor" problem: now doesn't enter FTE * mainloop when console returns empty action.. * */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <process.h> #include <signal.h> #include <wincon.h> #include <ctype.h> #include <stdio.h> #include "sysdep.h" #include "console.h" #include "gui.h" #include "s_files.h" #include "s_string.h" #include "c_config.h" #define True 1 #define False 0 static int Initialized = 0; static int MousePresent = 0; static int CursorVisible = 1; /* 1 means visible */ static int MouseVisible = 0; /* 0 means hidden */ static TEvent MouseEv = { evNone }; static TEvent EventBuf = { evNone }; //static TEventMask EventMask; static HANDLE ConOut; static HANDLE ConIn; static HANDLE OurConOut; static DWORD OldConsoleMode; static int LastMouseX = 0; static int LastMouseY = 0; //static int isWin95 = 0; static char winTitle[256] = "FTE"; static char winSTitle[256] = "FTE"; int codepage; #define dbm(x) //printf(x), Sleep(3000) #if 0 void dbg(const char* s, ...) /*FOLD00*/ { } #else void dbg(const char* s, ...) /*FOLD00*/ { char buf[256]; va_list args; va_start(args, s); vsprintf(buf, s, args); va_end(args); OutputDebugString(buf); } #endif static void DrawCursor(int Show) { /*FOLD00*/ CONSOLE_CURSOR_INFO cci; GetConsoleCursorInfo(OurConOut, &cci); cci.bVisible = Show ? TRUE : FALSE; SetConsoleCursorInfo(OurConOut, &cci); } #define NUMITEMS(x) (sizeof(x) / sizeof(x[0])) #if 1 /* * Translation table 1: translate (scan,asciicode) of the input event to a * valid FTE keystroke. This is used because NT sometimes "forgets" to flag * special keys as "enhanced" (grey) keys.. */ static struct { USHORT CharScan; TKeyCode KeyCode; } TransCharScan[] = { { 0x0100, kbEsc }, { 0x011B, kbEsc }, { 0x1C0D, kbEnter }, { 0x1C0A, kbEnter }, { 0x1C00, kbEnter }, { 0xE00D, kbEnter | kfGray }, { 0xA600, kbEnter | kfGray }, { 0xE00A, kbEnter | kfGray }, { 0x0E08, kbBackSp }, { 0x0E7F, kbBackSp }, { 0x0E00, kbBackSp }, { 0x0F09, kbTab }, { 0x9400, kbTab }, { 0xA500, kbTab }, { 0x0F00, kbTab }, { 0x4E00, '+' | kfGray }, { 0x9000, '+' | kfGray }, { 0x4E2B, '+' | kfGray }, { 0x4A00, '-' | kfGray }, { 0x8E00, '-' | kfGray }, { 0x4A2D, '-' | kfGray }, { 0x3700, '*' | kfGray }, { 0x9600, '*' | kfGray }, { 0x372A, '*' | kfGray }, { 0xE02F, '/' | kfGray }, { 0xA400, '/' | kfGray }, { 0x9500, '/' | kfGray }, { 0x0300, 0 } }; #endif #if 0 static struct { int ScanCode; TKeyCode KeyCode; } TransScan[] = { { 0x78, '1' }, { 0x79, '2' }, { 0x7A, '3' }, { 0x7B, '4' }, { 0x7C, '5' }, { 0x7D, '6' }, { 0x7E, '7' }, { 0x7F, '8' }, { 0x80, '9' }, { 0x81, '0' }, { 0x10, 'Q' }, { 0x11, 'W' }, { 0x12, 'E' }, { 0x13, 'R' }, { 0x14, 'T' }, { 0x15, 'Y' }, { 0x16, 'U' }, { 0x17, 'I' }, { 0x18, 'O' }, { 0x19, 'P' }, { 0x1E, 'A' }, { 0x1F, 'S' }, { 0x20, 'D' }, { 0x21, 'F' }, { 0x22, 'G' }, { 0x23, 'H' }, { 0x24, 'J' }, { 0x25, 'K' }, { 0x26, 'L' }, { 0x2C, 'Z' }, { 0x2D, 'X' }, { 0x2E, 'C' }, { 0x2F, 'V' }, { 0x30, 'B' }, { 0x31, 'N' }, { 0x32, 'M' }, { 0x29, '`' }, { 0x82, '-' }, { 0x83, '=' }, { 0x2B, '\\' }, { 0x1A, '[' }, { 0x1B, ']' }, { 0x27, ';' }, { 0x28, '\'' }, { 0x33, ',' }, { 0x34, '.' }, { 0x35, '/' }, { 0x37, '*' }, { 0x4E, '+' }, { 0x4A, '-' }, { 0x3B, kbF1 }, { 0x3C, kbF2 }, { 0x3D, kbF3 }, { 0x3E, kbF4 }, { 0x3F, kbF5 }, { 0x40, kbF6 }, { 0x41, kbF7 }, { 0x42, kbF8 }, { 0x43, kbF9 }, { 0x44, kbF10 }, { 0x85, kbF11 }, { 0x86, kbF12 }, { 0x54, kbF1 }, { 0x55, kbF2 }, { 0x56, kbF3 }, { 0x57, kbF4 }, { 0x58, kbF5 }, { 0x59, kbF6 }, { 0x5A, kbF7 }, { 0x5B, kbF8 }, { 0x5C, kbF9 }, { 0x5D, kbF10 }, { 0x87, kbF11 }, { 0x88, kbF12 }, { 0x5E, kbF1 }, { 0x5F, kbF2 }, { 0x60, kbF3 }, { 0x61, kbF4 }, { 0x62, kbF5 }, { 0x63, kbF6 }, { 0x64, kbF7 }, { 0x65, kbF8 }, { 0x66, kbF9 }, { 0x67, kbF10 }, { 0x89, kbF11 }, { 0x8A, kbF12 }, { 0x68, kbF1 }, { 0x69, kbF2 }, { 0x6A, kbF3 }, { 0x6B, kbF4 }, { 0x6C, kbF5 }, { 0x6D, kbF6 }, { 0x6E, kbF7 }, { 0x6F, kbF8 }, { 0x70, kbF9 }, { 0x71, kbF10 }, { 0x8B, kbF11 }, { 0x8C, kbF12 }, { 0x47, kbHome }, { 0x48, kbUp }, { 0x49, kbPgUp }, { 0x4B, kbLeft }, { 0x4C, kbCenter}, { 0x4D, kbRight }, { 0x4F, kbEnd }, { 0x50, kbDown }, { 0x51, kbPgDn }, { 0x52, kbIns }, { 0x53, kbDel }, { 0x77, kbHome }, { 0x8D, kbUp }, { 0x84, kbPgUp }, { 0x73, kbLeft }, { 0x74, kbRight }, { 0x75, kbEnd }, { 0x91, kbDown }, { 0x76, kbPgDn }, { 0x92, kbIns }, { 0x93, kbDel }, { 0x97, kbHome | kfGray }, { 0x98, kbUp | kfGray }, { 0x99, kbPgUp | kfGray }, { 0x9B, kbLeft | kfGray }, { 0x9D, kbRight | kfGray }, { 0x9F, kbEnd | kfGray }, { 0xA0, kbDown | kfGray }, { 0xA1, kbPgDn | kfGray }, { 0xA2, kbIns | kfGray }, { 0xA3, kbDel | kfGray } }; #endif struct { SHORT VirtCode; unsigned long KeyCode; } VirtTab[] = { { 112, kbF1 }, { 113, kbF2 }, { 114, kbF3 }, { 115, kbF4 }, { 116, kbF5 }, { 117, kbF6 }, { 118, kbF7 }, { 119, kbF8 }, { 120, kbF9 }, { 121, kbF10 }, { 122, kbF11 }, { 123, kbF12 }, { 35, kbEnd }, { 36, kbHome }, { 33, kbPgUp }, { 34, kbPgDn }, { 38, kbUp }, { 37, kbLeft }, { 39, kbRight }, { 40, kbDown }, { 45, kbIns }, { 46, kbDel }, { 27, kbEsc }, { 13, kbEnter }, { 8, kbBackSp }, { 32, kbSpace }, { 9, kbTab }, { 0, 0 } }; static const char shftwrng[] = "~!@#$%^&*()_+{}|:\"<>?"; static const char shftright[] = "`1234567890-=[]\\;',./"; int ReadConsoleEvent(TEvent *E) /*FOLD00*/ { /* * Reads and interprets the console event. It is called when console input * handle is signalled. To prevent flashing cursors this routine returns * F if there's nothing to do; this causes the caller to loop without * returning to the FTE mainloop. */ INPUT_RECORD inp; DWORD nread; TKeyCode Ch = 0; TKeyCode flg = 0; ULONG flags; int I, i; ReadConsoleInput(ConIn, &inp, 1, &nread); if (nread != 1) return False; // Nothing read after signal?? switch (inp.EventType) { case WINDOW_BUFFER_SIZE_EVENT: //** Resized the window. Make FTE use the new size.. frames->Resize(inp.Event.WindowBufferSizeEvent.dwSize.X, inp.Event.WindowBufferSizeEvent.dwSize.Y); frames->Repaint(); return True; case KEY_EVENT: if (inp.Event.KeyEvent.bKeyDown) { if ((inp.Event.KeyEvent.dwControlKeyState & CAPSLOCK_ON) && inp.Event.KeyEvent.wVirtualKeyCode != 106 && inp.Event.KeyEvent.wVirtualKeyCode != 109 && inp.Event.KeyEvent.wVirtualKeyCode != 107) { if (!(inp.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)) { for (i=0; shftwrng[i]; i++) { if (inp.Event.KeyEvent.uChar.AsciiChar == shftwrng[i]) { inp.Event.KeyEvent.uChar.AsciiChar = shftright[i]; break; } } } else { for (i=0; shftright[i]; i++) { if (inp.Event.KeyEvent.uChar.AsciiChar == shftright[i]) { inp.Event.KeyEvent.uChar.AsciiChar = shftwrng[i]; break; } } } } } //** Skip shift, control and alt key stuff. switch(inp.Event.KeyEvent.wVirtualKeyCode) { case VK_SHIFT: case VK_CONTROL: case VK_MENU: case VK_PAUSE: case VK_CAPITAL: case VK_LWIN: case VK_RWIN: case VK_APPS: return False; } //** Distill FTE flags from the NT flags. This fails for some keys //** because NT has an oddity with enhanced keys (Alt-Grey-+ etc). // from chaac: Please do not toutch RIGHT_ALT_PRESSED handling, // in some keyboard ALT-GR is used for special characters. flags = inp.Event.KeyEvent.dwControlKeyState; if (flags & (/*RIGHT_ALT_PRESSED |*/ LEFT_ALT_PRESSED)) flg |= kfAlt; if (flags & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) flg |= kfCtrl; if (flags & (RIGHT_ALT_PRESSED)) flg &= ~kfCtrl; if (flags & SHIFT_PRESSED) flg |= kfShift; if (flags & ENHANCED_KEY) flg |= kfGray; #if 0 dbg("key1: %s, vk=%x, vscan=%x, flags=%x, rep=%d, ascii=%x (%c).\n", inp.Event.KeyEvent.bKeyDown ? "down" : "up", inp.Event.KeyEvent.wVirtualKeyCode, inp.Event.KeyEvent.wVirtualScanCode, flags, inp.Event.KeyEvent.wRepeatCount, inp.Event.KeyEvent.uChar.AsciiChar, inp.Event.KeyEvent.uChar.AsciiChar); #endif Ch = 0; // handle special case when user with scandinavian keyboard presses // alt-gr + special key and then spacebar if (inp.Event.KeyEvent.bKeyDown) { if ((inp.Event.KeyEvent.wVirtualKeyCode == 0x20) && (inp.Event.KeyEvent.wVirtualScanCode == 0x39)) { switch(inp.Event.KeyEvent.uChar.AsciiChar) { case '~': Ch = '~'; break; case '^': Ch = '^'; break; case '`': Ch = '`'; break; case 'ï': Ch = 'ï'; break; } } } //** Translate VK codes to FTE codes, if (Ch == 0) { for (I = 0; I < sizeof(VirtTab)/sizeof(VirtTab[0]); I++) if (VirtTab[I].VirtCode == inp.Event.KeyEvent.wVirtualKeyCode) { Ch = VirtTab[I].KeyCode; break; } } //** Not a virtual key-> do charscan translation, if needed; if(Ch == 0) { unsigned int cc = ((inp.Event.KeyEvent.wVirtualScanCode << 8) | (unsigned char)inp.Event.KeyEvent.uChar.AsciiChar); for(I = 0; I < NUMITEMS(TransCharScan); I++) { if(cc == TransCharScan[I].CharScan) { Ch = TransCharScan[I].KeyCode; break; } } } if (Ch == 0) { if ((Ch = (TKeyCode) (unsigned char)inp.Event.KeyEvent.uChar.AsciiChar) != 0) { if (flg & kfAlt) Ch = toupper(Ch); } } if (Ch == 0) //** Odd: cannot distill keycode. return False; if (flg & kfCtrl) if (Ch < 32) Ch += 64; E->Key.Code = Ch | flg; // Set FTE keycode, E->What = inp.Event.KeyEvent.bKeyDown ? evKeyDown : evKeyUp; return True; case MOUSE_EVENT: LastMouseX = E->Mouse.X = inp.Event.MouseEvent.dwMousePosition.X; LastMouseY = E->Mouse.Y = inp.Event.MouseEvent.dwMousePosition.Y; flags = inp.Event.MouseEvent.dwControlKeyState; if (flags & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) flg |= kfAlt; if (flags & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) flg |= kfCtrl; if (flags & SHIFT_PRESSED) flg |= kfShift; E->Mouse.KeyMask = flg; E->Mouse.Buttons = (unsigned short)inp.Event.MouseEvent.dwButtonState; E->Mouse.Count = 1; if (inp.Event.MouseEvent.dwEventFlags & DOUBLE_CLICK) E->Mouse.Count = 2; if ((inp.Event.MouseEvent.dwEventFlags & MOUSE_WHEELED) == MOUSE_WHEELED) { E->What = evCommand; E->Msg.View = 0; E->Msg.Model = 0; E->Msg.Param2 = 0; // Scroll: // (The SDK does not tell how to determine whether the wheel // was scrolled up or down. Found an example on: // http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles5.html if (inp.Event.MouseEvent.dwButtonState & 0xFF000000) { // Wheel down if (flg & kfShift) { // Translate to horizontal scroll. E->Msg.Command = (flg & kfCtrl) ? cmHScrollPgRt : cmHScrollRight; } else { // Translate to vertical scroll. E->Msg.Command = (flg & kfCtrl) ? cmVScrollPgDn : cmVScrollDown; } } else { // Wheel up if (flg & kfShift) { // Translate to horizontal scroll. E->Msg.Command = (flg & kfCtrl) ? cmHScrollPgLt : cmHScrollLeft; } else { // Translate to vertical scroll. E->Msg.Command = (flg & kfCtrl) ? cmVScrollPgUp : cmVScrollUp; } } E->Msg.Param1 = (flg & kfCtrl) ? 1 : 3; // 1 page / 3 lines return True; } if (inp.Event.MouseEvent.dwEventFlags == MOUSE_MOVED) { E->What = evMouseMove; //puts("Move"); } else { static unsigned short mb = 0; if (inp.Event.MouseEvent.dwButtonState & ~mb) { E->What = evMouseDown; E->Mouse.Buttons = ((unsigned short)inp.Event.MouseEvent.dwButtonState) & ~mb; //puts("Down"); } else { E->What = evMouseUp; E->Mouse.Buttons = mb & ~((unsigned short)inp.Event.MouseEvent.dwButtonState); //puts("Up"); } mb = (unsigned short)inp.Event.MouseEvent.dwButtonState; } return True; } return False; } int ConInit(int /*XSize*/, int /*YSize*/) { /*FOLD00*/ if (Initialized) return 1; EventBuf.What = evNone; MousePresent = 0; //MOUSInit(); //** Get NT/Win95 flag, OSVERSIONINFO oi; oi.dwOSVersionInfoSize = sizeof(oi); GetVersionEx((LPOSVERSIONINFO) &oi); //isWin95 = (oi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); ConOut = GetStdHandle(STD_OUTPUT_HANDLE); ConIn = GetStdHandle(STD_INPUT_HANDLE); codepage = GetConsoleCP(); GetConsoleMode(ConIn, &OldConsoleMode); SetConsoleMode(ConIn, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); OurConOut = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); ConContinue(); Initialized = 1; return 1; } int ConDone() { /*FOLD00*/ ConSuspend(); CloseHandle(OurConOut); return 1; } int ConSuspend() { /*FOLD00*/ SetConsoleActiveScreenBuffer(ConOut); SetConsoleMode(ConIn, OldConsoleMode); return 1; } int ConContinue() { /*FOLD00*/ SetConsoleActiveScreenBuffer(OurConOut); GetConsoleMode(ConIn, &OldConsoleMode); SetConsoleMode(ConIn, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); SetConsoleOutputCP(codepage); SetConsoleCP(codepage); return 1; } int ConClear() { /*FOLD00*/ int W, H; TDrawBuffer B; MoveChar(B, 0, ConMaxCols, ' ', 0x07, 1); if (!ConQuerySize(&W, &H) || !ConSetBox(0, 0, W, H, B[0])) return 0; return 1; } #if 0 // Mouse control not necessary when using console functions. /*--------------------------------------------------------------------------*/ /* CLASS: tMouHelp is used to control mouse cursor visibility during */ /* screen updates. */ /*--------------------------------------------------------------------------*/ class tMouHelp { protected: int mh_x, mh_y; // Current mouse position / 0 int mh_valid; int mh_disabled; // T if mouse should be re-enabled. public: tMouHelp() : mh_x(0), mh_y(0), mh_valid(FALSE), mh_disabled(FALSE) {} ~tMouHelp() { if(MouseVisible && mh_disabled) DrawMouse(1); } void disIfLine(int x, int w, int y) { if(mh_disabled) return; if(! mh_valid) { ConQueryMousePos(&mh_x, &mh_y); mh_valid = TRUE; } if(y == mh_y && mh_x >= x && mh_x < x+y) { mh_disabled= TRUE; DrawMouse(0); } } }; #endif int ConPutBox(int X, int Y, int W, int H, PCell Cell) /*FOLD00*/ { int I; PCell p = Cell; COORD corg, csize; SMALL_RECT rcl; BOOL rc; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left= X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); rc = WriteConsoleOutput(OurConOut, (PCHAR_INFO)p, csize, corg, &rcl); if (rc != TRUE) { //("WriteConsoleOutput %d\n", rc); } p += W; } return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) /*FOLD00*/ { int I; USHORT WW = W << 1; PCell p = Cell; COORD corg, csize; SMALL_RECT rcl; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); ReadConsoleOutput(OurConOut, (PCHAR_INFO)p, csize, corg, &rcl); p += W; } return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) /*FOLD00*/ { int I; COORD corg, csize; SMALL_RECT rcl; BOOL rc; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// + (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// + (isWin95 ? 1 : 0); rc = WriteConsoleOutput(OurConOut, (PCHAR_INFO)Cell, csize, corg, &rcl); if (rc != TRUE) { //printf("WriteConsoleOutput %d\n", rc); } } return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) /*FOLD00*/ { int I; COORD corg, csize; SMALL_RECT rcl; TDrawBuffer B; I = W; while (I-- > 0) B[I] = Cell; for (I = 0; I < H; I++) { corg.X = corg.Y = 0; csize.X = W; csize.Y = 1; rcl.Left = X; rcl.Top = I + Y; rcl.Bottom = I + Y;// - (isWin95 ? 1 : 0); rcl.Right = X + W - 1;// - (isWin95 ? 1 : 0); WriteConsoleOutput(OurConOut, (PCHAR_INFO)B, csize, corg, &rcl); } return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) /*FOLD00*/ { TCell FillCell; SMALL_RECT rect, clip; COORD dest; MoveCh(&FillCell, ' ', Fill, 1); clip.Left = X; clip.Top = Y; clip.Right = X + W - 1; clip.Bottom = Y + H - 1; rect = clip; dest.X = X; dest.Y = Y; switch (Way) { case csUp: rect.Top += Count; break; case csDown: rect.Bottom -= Count; dest.Y += Count; break; case csLeft: rect.Left += Count; break; case csRight: rect.Right += Count; dest.X += Count; break; } ScrollConsoleScreenBuffer(OurConOut, &rect, &clip, dest, (PCHAR_INFO)&FillCell); return 1; } int ConSetSize(int X, int Y) { /*FOLD00*/ return 0; } int ConQuerySize(int *X, int *Y) { /*FOLD00*/ CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(OurConOut, &csbi); *X = csbi.dwSize.X; *Y = csbi.dwSize.Y; dbg("Console size (%u,%u)\n", *X, *Y); return 1; } int ConSetCursorPos(int X, int Y) { /*FOLD00*/ COORD xy; xy.X = X; xy.Y = Y; SetConsoleCursorPosition(OurConOut, xy); return 1; } int ConQueryCursorPos(int *X, int *Y) { /*FOLD00*/ CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(OurConOut, &csbi); *X = csbi.dwCursorPosition.X; *Y = csbi.dwCursorPosition.Y; return 1; } int ConShowCursor() { /*FOLD00*/ CursorVisible = 1; DrawCursor(1); return 1; } int ConHideCursor() { /*FOLD00*/ CursorVisible = 0; DrawCursor(0); return 1; } int ConCursorVisible() { /*FOLD00*/ return (CursorVisible == 1); } int ConSetCursorSize(int Start, int End) { /*FOLD00*/ return 0; } int ConSetMousePos(int X, int Y) { /*FOLD00*/ return 0; } int ConQueryMousePos(int *X, int *Y) { /*FOLD00*/ *X = LastMouseX; *Y = LastMouseY; // NT does not have this ? (not needed anyway, but check mouse hiding above). return 1; } int ConShowMouse() { /*FOLD00*/ MouseVisible = 1; return (MousePresent != 0); } int ConHideMouse() { /*FOLD00*/ MouseVisible = 0; return (MousePresent != 0); } int ConMouseVisible() { /*FOLD00*/ return (MouseVisible == 1); } int ConQueryMouseButtons(int *ButtonCount) { /*FOLD00*/ return 1; } int ConPutEvent(const TEvent& Event) { /*FOLD00*/ EventBuf = Event; return 1; } int ConFlush() { /*FOLD00*/ return 1; } int ConGrabEvents(TEventMask EventMask) { /*FOLD00*/ return 1; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { /*FOLD00*/ if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(TCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 1; } int RestoreScreen() { /*FOLD00*/ if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { /*FOLD00*/ fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { /*FOLD00*/ RestoreScreen(); if (SavedScreen) free(SavedScreen); ::ConDone(); gui = 0; } int GUI::ConSuspend() { /*FOLD00*/ RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue() { /*FOLD00*/ SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { /*FOLD00*/ TEvent E; ConHideMouse(); RestoreScreen(); SetConsoleActiveScreenBuffer(ConOut); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); SetConsoleActiveScreenBuffer(OurConOut); ConShowMouse(); if (frames) frames->Repaint(); return 1; } char ConGetDrawChar(unsigned int index) { /*FOLD00*/ static const char *tab=NULL; if (!tab) { tab=GetGUICharacters ("WindowsNT","Ú¿ÀÙijÂôÁÅ\x1Aúı°\x1B\x1A"); } assert(index < strlen(tab)); return tab[index]; } int GUI::RunProgram(int mode, char *Command) { /*FOLD00*/ int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv( "COMSPEC" ); // we don't want ctrl-c or ctrl-break to exit our editor... signal(SIGBREAK, SIG_IGN); signal(SIGINT, SIG_IGN); rc = system(Command); // restore handlers back to default handlers signal(SIGBREAK, SIG_DFL); signal(SIGINT, SIG_DFL); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } int ConSetTitle(const char *Title, const char *STitle) { /*FOLD00*/ char buf[sizeof(winTitle)] = {0}; JustFileName(Title, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Title, buf, sizeof(buf)); strlcpy(winTitle, "FTE - ", sizeof(winTitle)); if (buf[0] != 0) // if there is a file/dir name, stick it in here. { strlcat(winTitle, buf, sizeof(winTitle)); strlcat(winTitle, " - ", sizeof(winTitle)); } strlcat(winTitle, Title, sizeof(winTitle)); strlcpy(winSTitle, STitle, sizeof(winSTitle)); SetConsoleTitle (winTitle); return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { /*FOLD00*/ strlcpy(Title, winTitle, MaxLen); strlcpy(STitle, winSTitle, SMaxLen); return 1; } #if 0 /****************************************************************************/ /* */ /* CODING: Pipe handler. */ /* */ /****************************************************************************/ /*--------------------------------------------------------------------------*/ /* STATIC GLOBALS. */ /*--------------------------------------------------------------------------*/ #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 #define PIPEBUF_SZ 4096 class NTHandle { protected: HANDLE nth_h; public: operator HANDLE() { return nth_h; } void close() { if(nth_h != INVALID_HANDLE_VALUE) { CloseHandle(nth_h); nth_h = INVALID_HANDLE_VALUE; } } NTHandle() { nth_h = INVALID_HANDLE_VALUE; } ~NTHandle() { close(); } NTHandle(const HANDLE& h) : nth_h(h) {} NTHandle(const NTHandle& nth); // UNDEFINED (no assgn) NTHandle& operator =(const NTHandle& nth); // UNDEFINED (no assgn) NTHandle& operator =(const HANDLE nth) { close(); nth_h = nth; return *this; } }; class GPipe { public: int p_used; int p_id; char* p_buffer; int p_buflen; int p_bufused; int p_bufpos; EModel* p_notify; char* p_command; int p_retcode; int p_doterm; //** NT specific. HANDLE p_proc_h; // Handle of spawned process, HANDLE pipeDataRead; HANDLE pipeStartRead; HANDLE pipeMutex; HANDLE p_pipe_ph; // Input pipe (read by FTE) HANDLE p_child_ph; // Client side's handle (written to by spawned) DWORD p_read_len; // #bytes read in overlapped I/O int p_io_posted; // T when overlapped I/O is posted, int p_completed; // T when client process closed down. int p_has_data; // T when OVERLAPPED completed. static GPipe pipe_ar[MAX_PIPES]; public: int open(char *Command, EModel *notify); int close(); int read(void *buffer, int len); int getEvent(TEvent* event); protected: int createPipe(); void releasePipe(); int runCommand(); void closeProc(); int handlePost(); int postRead(); public: static GPipe* getFreePipe(); static GPipe* getPipe(int id); }; GPipe GPipe::pipe_ar[MAX_PIPES]; /* * getFreePipe() locates an unused GPipe structure. It also assigns it's ID. */ GPipe* GPipe::getFreePipe() /*FOLD00*/ { int i; for(i = 0; i < MAX_PIPES; i++) { if(! pipe_ar[i].p_used) { pipe_ar[i].p_id = i; // Set pipenr, return pipe_ar + i; } } return NULL; // No free pipe } GPipe* GPipe::getPipe(int id) /*FOLD00*/ { if (id < 0 || id > MAX_PIPES) return NULL; if(! pipe_ar[id].p_used) return NULL; return pipe_ar + id; } int GPipe::createPipe() /*FOLD00*/ { /* * Called from open() to create and open the server and the client pipes. */ static int PCount = 0; //HANDLE hchild; char pipename[50]; int ok; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); // Security descriptor for INHERIT. sa.lpSecurityDescriptor = 0; sa.bInheritHandle = 1; #if 1 if (CreatePipe(&p_pipe_ph, &p_child_ph, &sa, 0) == FALSE) return FALSE; Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); #else //** Create the named pipe, and handle the SERVER (edit)'s end... sprintf(pipename, "\\\\.\\pipe\\fte%d\\child%d", getpid(), PCount); p_pipe_ph = CreateNamedPipe(pipename, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 1, // nMaxInstances, 0, PIPEBUF_SZ, 1000, 0); if(p_pipe_ph == INVALID_HANDLE_VALUE) return FALSE; PCount++; /* * Client side: get a connection to the server's pipe. Do this before the * call to ConnectNamedPipe() to prevent it from blocking. */ #if 1 p_child_ph = CreateFile(pipename, GENERIC_WRITE, 0, &sa, OPEN_EXISTING, 0, 0); #else p_child_ph = CreateFile("_test", GENERIC_WRITE|GENERIC_READ, 0, &sa, CREATE_ALWAYS, 0, 0); #endif if(p_child_ph == INVALID_HANDLE_VALUE) dbm("CreateFile(client_side_pipe) has failed"); else { //** Server side: aquire connection.. ok = TRUE; if(! ConnectNamedPipe(p_pipe_ph, 0)) // Get connect; { if(GetLastError() != ERROR_PIPE_CONNECTED) ok = FALSE; } //** Connect worked? if(!ok) dbm("ConnectNmPipe() has failed"); else return TRUE; // All opened & ready for action! //** Something went wrong. CloseHandle(p_child_ph); // Close child: was inh. DisconnectNamedPipe(p_pipe_ph); // Force disconnection of client (-) CloseHandle(p_child_ph); } CloseHandle(p_pipe_ph); #endif return FALSE; // Something has failed. } void GPipe::releasePipe() /*FOLD00*/ { /* * releasePipe() releases all that createPipe() allocates. It's usually * called when an error causes the process to abort. */ if(p_child_ph != INVALID_HANDLE_VALUE) { CloseHandle(p_child_ph); p_child_ph = INVALID_HANDLE_VALUE; } if(p_pipe_ph != 0) { //DisconnectNamedPipe(p_pipe_ph); CloseHandle(p_pipe_ph); p_pipe_ph = INVALID_HANDLE_VALUE; } } int GPipe::runCommand() /*FOLD00*/ { /* * runCommand() takes the child pipe, dups it onto stdout and stderr while * saving their old assignments, then it spawns */ int ok; char* comspec, *args, tbuf[256]; HANDLE errh; PROCESS_INFORMATION pi; STARTUPINFO si; const char nt4[] = "4nt.exe"; ok = FALSE; comspec = getenv("COMSPEC"); /* * BUG workaround: When using 4NT, it doesn't properly reassign stderr! * This is a bug in 4NT, so if comspec *is* 4nt use cmd.exe instead... */ if(comspec == 0) return -1; int l = strlen(comspec); if(strnicmp(comspec + (l- sizeof(nt4)+1), nt4, sizeof(nt4)-1) == 0) { //** It's 4DOS all right.. args = getenv("SystemRoot"); if(args== 0) return -1; strlcpy(tbuf, args, sizeof(tbuf)); // Get to c:\winnt strlcat(tbuf, "\\system32\\cmd.exe", sizeof(tbuf)); comspec = tbuf; } int argslen = strlen(comspec) + strlen(p_command) + 120; args = (char *)malloc(argslen); if(args == 0) dbm("malloc() failed for command line.."); else { //** Form a command line for the process; strlcpy(args, comspec, argslen); strlcat(args, " /c ", argslen); strlcat(args, p_command, argslen); //** Dup the child handle to get separate handles for stdout and err, if (DuplicateHandle(GetCurrentProcess(), p_child_ph, // Source, GetCurrentProcess(), &errh, // Destination, 0, True, // Same access, inheritable DUPLICATE_SAME_ACCESS)); { /* Set up members of STARTUPINFO structure. */ memset(&si, 0, sizeof(si)); si.cb = sizeof(STARTUPINFO); si.lpReserved = NULL; si.lpReserved2 = NULL; si.cbReserved2 = 0; si.lpDesktop = NULL; /* si.dwFlags = STARTF_USESTDHANDLES; #if 1 si.hStdOutput = p_child_ph; si.hStdError = errh; si.hStdInput = INVALID_HANDLE_VALUE; #else si.hStdOutput = errh; si.hStdError = p_child_ph; si.hStdInput = INVALID_HANDLE_VALUE; #endif*/ if(CreateProcess(NULL, args, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { ok = TRUE; CloseHandle(pi.hThread); // Thread handle not needed p_proc_h = pi.hProcess; // Return process handle (to get RC) } CloseHandle(errh); // Close error handle, } else dbm("DupHandle for stderr failed."); free(args); // Release command line. } // SetConsoleMode(horgout, ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); //** And last but not least: close the child handle. CloseHandle(p_child_ph); p_child_ph = INVALID_HANDLE_VALUE; return ok; } void GPipe::closeProc() /*FOLD00*/ { /* * closeProc() gets called when a read fails. It assumes the process has * ended, retrieves the process return code, then it closes all handles. * The state is set to p_completed. */ DWORD ec; dbg("[closeProc] "); if(! GetExitCodeProcess(p_proc_h, &ec)) ec = 0xabcd; p_retcode = ec; // Save return code of process, if(p_proc_h != INVALID_HANDLE_VALUE) // Close process, { CloseHandle(p_proc_h); p_proc_h = INVALID_HANDLE_VALUE; } //** Close the main pipe, if(p_pipe_ph != INVALID_HANDLE_VALUE) { CloseHandle(p_pipe_ph); p_pipe_ph = INVALID_HANDLE_VALUE; } p_completed = TRUE; p_has_data = TRUE; } int GPipe::startRead() /*FOLD00*/ { /* * postRead() checks if an overlapped READ needs to be posted by checking * the io_posted flag. If that's clear and no termination or closed flag * is set then a new overlapped I/O request is issued. */ p_has_data = FALSE; dbg("[postRead "); if(p_io_posted || p_completed) dbg("no action: %s] ", p_io_posted ? "posted" : "complete"); else { p_ovl.hEvent = p_data_evh; // Signal this when done, if(!ReadFile(p_pipe_ph, p_buffer, p_buflen, &p_read_len, NULL)) { DWORD ec = GetLastError(); if(ec != ERROR_IO_PENDING) { //** Something's wrong. Treat as closed pipe for now. closeProc(); // Close pipe, complete stuff... dbg("postfail] "); return FALSE; // And return failure. } } p_io_posted = TRUE; // Handle pending ioresult. dbg("posted] "); } return TRUE; } int GPipe::open(char* command, EModel* notify) /*FOLD00*/ { memset(&p_ovl, 0, sizeof(p_ovl)); // Clear overlapped, p_bufused = 0; p_bufpos = 0; p_io_posted = FALSE; p_has_data = FALSE; p_completed = FALSE; // T if client closed. p_doterm = FALSE; p_buflen = PIPE_BUFLEN; p_notify = notify; p_doterm = FALSE; p_pipe_ph = INVALID_HANDLE_VALUE; p_child_ph = INVALID_HANDLE_VALUE; if( (p_command = strdup(command)) == 0) return -1; //** Allocate the read buffer; if ((p_buffer = (char*) malloc(p_buflen)) != 0) { if ((pipeDataRead = CreateEvent(0, 1, 0, 0)) == 0) { dbm("CreateEvent(data_evh) failed."); goto fail; } if ((pipeStartRead = CreateEvent(0, 1, 0, 0)) == 0) { dbm("CreateEvent(data_evh) failed."); goto fail; } if ((pipeMutex = CreateMutex(NULL, FALSE, NULL)) == NULL) { dbm("Failed pipe mutex"); goto fail; } else { if(createPipe()) // Create server & client pipe. { if(! postRead()) dbm("postRead() initial failed."); else { if(runCommand()) { p_used = TRUE; return p_id; } } releasePipe(); // Release pipes, } CloseHandle(p_data_evh); } free(p_buffer); } free(p_command); return -1; } int GPipe::close() /*FOLD00*/ { /* * close() disconnects from the spawned task, closes the pipe and releases * all stuff. */ if(! p_used) return -1; if(! p_completed) // Overlapped I/O not complete yet? { //** We *must* wait till the overlapped I/O completes, if(p_io_posted) { GetOverlappedResult(p_pipe_ph, &p_ovl, &p_read_len, TRUE); p_io_posted = FALSE; } } p_completed= TRUE; //** Now close all that might be pending, free(p_buffer); free(p_command); releasePipe(); // Close all pipe stuff, if(p_proc_h != INVALID_HANDLE_VALUE) { CloseHandle(p_proc_h); p_proc_h = INVALID_HANDLE_VALUE; } CloseHandle(pipeStartRead); CloseHandle(pipeDataRead); CloseHandle(pipeMutex); p_used = FALSE; return p_retcode; } int GPipe::read(void *buffer, int len) /*FOLD00*/ { /* * read() is called to get the current data from the pipe. It takes the * #bytes read and returns them. It returns data till the buffer is * exhausted. If the process is completed it returns -1; else it returns * the #bytes read. It returns 0 if the buffer's empty. */ dbg("[read "); if(p_has_data) { if(p_bufpos < p_read_len) // Data in buffer? { unsigned l; l = p_read_len - p_bufpos; // Try to output all, if(l > len) l = len; memcpy(buffer, p_buffer+p_bufpos, l); // Copy data from the buffer, p_bufpos += l; dbg("%u data] ", l); return l; // Data returned, } //** There's nothing left in the buffer. Is the task complete? if(p_completed) { dbg("no data, complete] "); return -1; } if(! postRead()) { dbg("post failed-> complete] "); return -1; } dbg("nodata, post] "); return 0; } else if(p_completed) { dbg("completed] "); return -1; } dbg("nothing] "); return 0; } int GPipe::getEvent(TEvent* event) /*FOLD00*/ { dbg("[getpipeevent: "); event->What = evNone; if(! p_used || p_notify == 0) return 0; // No data. if(! handlePost()) return 0; // Again: no data, //** This pipe has data! event->What = evNotify; event->Msg.View = 0; event->Msg.Model = p_notify; event->Msg.Command = cmPipeRead; event->Msg.Param1 = p_id; dbg("ok] "); return 1; } /* * NT Pipe handler - overview * ========================== * The NT pipe handler uses overlapped I/O to read console events. * * OpenPipe(): * When the pipe is opened, one of the pipe structures is allocated and set * to used. Then an event semaphore (reset_manual) is created. This semaphore * will be signalled when data is available on the input pipe which gathers * the spawned tasks's output. * * Then a pipe is created, opened for the client side and stdout and stderr * are redirected therein. After that the client task is spawned. * * If the spawn succeeds an overlapped READ is posted for the pipe; then the * OpenPipe function returns. * * ConGetEvent(): * The ConGetEvent() handler does a WaitForMultipleObjects() on the console * handle and all pipe handles currently active. If a pipe has data the * overlapped result is gotten, and the output is sent to the message window. * Then, if the thread didn't finish, a new overlapped read is posted. * * */ int GUI::OpenPipe(const char *Command, EModel *notify) /*FOLD00*/ { GPipe* gp; if( (gp = GPipe::getFreePipe()) == 0) return -1; // Out of pipes. return gp->open(Command, notify); // And ask the pipe to init. } int GUI::SetPipeView(int id, EModel *notify) /*FOLD00*/ { GPipe* p; if( (p = GPipe::getPipe(id)) == 0) return -1; p->lock(); p->p_notify = notify; p->unlock(); return 0; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) /*FOLD00*/ { //int l; GPipe* p; if( (p = GPipe::getPipe(id)) == 0) return -1; return p->read(buffer, len); } int GUI::ClosePipe(int id) /*FOLD00*/ { GPipe* p; if( (p = GPipe::getPipe(id)) == 0) return -1; return p->close(); } static int GetPipeEvent(int id, TEvent *Event) /*FOLD00*/ { //int i; GPipe* p; if( (p = GPipe::getPipe(id)) == 0) return -1; return p->getEvent(Event); } #else #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; HANDLE Thread; HANDLE Access; HANDLE ResumeRead; HANDLE NewData; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; DWORD RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; static int CreatePipeChild(HANDLE &child, HANDLE &hPipe, char *Command) { //static int PCount = 0; int arglen = 0; HANDLE hChildPipe; BOOL rc; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); // Security descriptor for INHERIT. sa.lpSecurityDescriptor = 0; sa.bInheritHandle = 1; rc = CreatePipe(&hPipe, &hChildPipe, &sa, 0); if (rc != TRUE) return -1; int ok; char* comspec, *args, tbuf[256]; //HANDLE errh; PROCESS_INFORMATION pi; STARTUPINFO si; HANDLE hNul; const char nt4[] = "4nt.exe"; ok = FALSE; comspec = getenv("COMSPEC"); /* * BUG workaround: When using 4NT, it doesn't properly reassign stderr! * This is a bug in 4NT, so if comspec *is* 4nt use cmd.exe instead... */ if (comspec == 0) return -1; int l = strlen(comspec); if (strnicmp(comspec + (l- sizeof(nt4)+1), nt4, sizeof(nt4)-1) == 0) { //** It's 4DOS all right.. args = getenv("SystemRoot"); if(args== 0) return -1; strlcpy(tbuf, args, sizeof(tbuf)); // Get to c:\winnt strlcat(tbuf, "\\system32\\cmd.exe", sizeof(tbuf)); comspec = tbuf; } int argslen = strlen(comspec) + strlen(Command) + 120; args = (char *)malloc(argslen); if(args == 0) dbm("malloc() failed for command line.."); else { //** Form a command line for the process; strlcpy(args, comspec, argslen); strlcat(args, " /c ", argslen); strlcat(args, Command, argslen); //** Dup the child handle to get separate handles for stdout and err, /*if (DuplicateHandle(GetCurrentProcess(), hChildPipe, GetCurrentProcess(), &errh, 0, True, DUPLICATE_SAME_ACCESS))*/ //fprintf(stderr, "open NUL\n"); hNul = CreateFile("NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); //fprintf(stderr, "starting %s\n", args); if (hNul != NULL) { /* Set up members of STARTUPINFO structure. */ memset(&si, 0, sizeof(si)); si.cb = sizeof(STARTUPINFO); si.lpReserved = NULL; si.lpReserved2 = NULL; si.cbReserved2 = 0; si.lpDesktop = NULL; si.dwFlags = STARTF_USESTDHANDLES; #if 1 si.hStdOutput = hChildPipe; si.hStdError = hChildPipe; si.hStdInput = hNul;//INVALID_HANDLE_VALUE; #else si.hStdOutput = errh; si.hStdError = hChildPipe; si.hStdInput = INVALID_HANDLE_VALUE; #endif if (CreateProcess(NULL, args, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) == TRUE) { ok = TRUE; CloseHandle(pi.hThread); // Thread handle not needed //fprintf(stderr, "create process success\n"); child = pi.hProcess; // Return process handle (to get RC) } else //fprintf(stderr, "create process failed %d\n" + GetLastError()); CloseHandle(hNul); // Close error handle, } else dbm("DupHandle for stderr failed."); free(args); } CloseHandle(hChildPipe); return 0; } static DWORD __stdcall PipeThread(void *p) { GPipe *pipe = (GPipe *)p; BOOL rc; DWORD used; HANDLE child; HANDLE hfPipe; rc = CreatePipeChild(child, hfPipe, pipe->Command); if (rc != 0) { //fprintf(stderr, "Failed CreatePipeChild\n"); WaitForSingleObject(pipe->Access, INFINITE); pipe->reading = 0; SetEvent(pipe->NewData); ReleaseMutex(pipe->Access); return 0; } //fprintf(stderr, "Pipe: Begin: %d %s\n", pipe->id, pipe->Command); while (1) { //fprintf(stderr, "Waiting on pipe\n"); rc = ReadFile(hfPipe, pipe->buffer, pipe->buflen, &used, NULL); if (rc != TRUE) { //fprintf(stderr, "ReadFile failed %d %ld", GetLastError(), used); used = 0; } WaitForSingleObject(pipe->Access, INFINITE); //fprintf(stderr, "Waiting on mutex\n"); pipe->bufused = used; //fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); ResetEvent(pipe->ResumeRead); if (pipe->bufused == 0) break; if (pipe->notify) { SetEvent(pipe->NewData); pipe->stopped = 0; } ReleaseMutex(pipe->Access); if (pipe->DoTerm) break; //fprintf(stderr, "Waiting on sem\n"); WaitForSingleObject(pipe->ResumeRead, INFINITE); //fprintf(stderr, "Read: Released mutex\n"); if (pipe->DoTerm) break; } CloseHandle(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); rc = WaitForSingleObject(child, INFINITE); GetExitCodeProcess(child, &pipe->RetCode); CloseHandle(child); pipe->reading = 0; SetEvent(pipe->NewData); ReleaseMutex(pipe->Access); //fprintf(stderr, "Read: Released mutex\n"); return 1; } int GUI::OpenPipe(const char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) return -1; if ((Pipes[i].Access = CreateMutex(NULL, FALSE, NULL)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if ((Pipes[i].ResumeRead = CreateEvent(0, 1, 0, 0)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].Access); return -1; } if ((Pipes[i].NewData = CreateEvent(0, 1, 0, 0)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].ResumeRead); CloseHandle(Pipes[i].Access); return -1; } DWORD tid; if ((Pipes[i].Thread = CreateThread(NULL, 32768, &PipeThread, &Pipes[i], 0, &tid)) == NULL) { free(Pipes[i].Command); free(Pipes[i].buffer); CloseHandle(Pipes[i].ResumeRead); CloseHandle(Pipes[i].Access); CloseHandle(Pipes[i].NewData); return -1; } Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; WaitForSingleObject(Pipes[id].Access, INFINITE); //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; ReleaseMutex(Pipes[id].Access); return 1; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { ssize_t l; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES || Pipes[id].used == 0) return -1; //fprintf(stderr, "Read: Waiting on mutex\n"); //ConContinue(); WaitForSingleObject(Pipes[id].Access, INFINITE); //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; //fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; //fprintf(stderr, "Read: posting sem\n"); SetEvent(Pipes[id].ResumeRead); } } else if (Pipes[id].reading == 0) l = -1; else { l = 0; // DosBeep(200, 200); } //fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); ReleaseMutex(Pipes[id].Access); //fprintf(stderr, "Read: Released mutex\n"); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; SetEvent(Pipes[id].ResumeRead); WaitForSingleObject(&Pipes[id].Thread, INFINITE); } free(Pipes[id].buffer); free(Pipes[id].Command); CloseHandle(Pipes[id].NewData); CloseHandle(Pipes[id].ResumeRead); CloseHandle(Pipes[id].Access); CloseHandle(Pipes[id].Thread); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; //ConContinue(); return (Pipes[id].RetCode == 0); } int GetPipeEvent(int i, TEvent *Event) { Event->What = evNone; if (Pipes[i].used == 0) return 0; if (Pipes[i].notify == 0) return 0; ResetEvent(Pipes[i].NewData); //fprintf(stderr, "Pipe New Data: %d\n", i); Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[i].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = i; return 1; } #endif int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) /*FOLD00*/ { //** Any saved events left? if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 1; } if (MouseEv.What != evNone) { *Event = MouseEv; if (Delete) MouseEv.What = evNone; return 1; } //** Now block and wait for a new event on the console handle and all pipes, HANDLE o_ar[1 + MAX_PIPES]; DWORD rc; int i, nh; EventBuf.What = evNone; Event->What = evNone; //** Fill the handle array with all active handles for pipes && console, o_ar[0] = ConIn; for(i = 0, nh = 1; i < MAX_PIPES; i++) { // For all possible pipes if (Pipes[i].used) o_ar[nh++] = Pipes[i].NewData; } for(;;) { rc = WaitForMultipleObjects(nh, o_ar, FALSE, WaitTime); if (rc != WAIT_FAILED && (rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0+nh)) { i = rc - WAIT_OBJECT_0; // Get item that signalled new data if (i == 0) { // Was console? if (ReadConsoleEvent(Event)) // Get console, return 1; // And exit if valid, } else { GetPipeEvent(i - 1, Event); // Read data from pipe. return 1; } } else return 0; // Something's wrong! } } #include "clip.h" int GetClipText(ClipData *cd) { int rc = 0; cd->fLen = 0; cd->fChar = NULL; if (OpenClipboard(NULL)) { HANDLE hmem; if ((hmem = GetClipboardData(CF_TEXT)) != NULL) { LPVOID data; if ((data = GlobalLock(hmem)) != NULL) { int len = strlen((char *)data); cd->fChar = (char *)malloc(len); if (cd->fChar != NULL) { cd->fLen = len; memcpy(cd->fChar, data, len); rc = 1; } GlobalUnlock(hmem); } } CloseClipboard(); } return rc; } int PutClipText(ClipData *cd) { int rc = 0; if (OpenClipboard(NULL)) { if (EmptyClipboard()) { HGLOBAL hmem; if ((hmem = GlobalAlloc(GMEM_MOVEABLE, cd->fLen + 1)) != NULL) { LPVOID data; if ((data = GlobalLock(hmem)) != NULL) { memcpy(data, cd->fChar, cd->fLen); ((char *)data)[cd->fLen] = 0; GlobalUnlock(hmem); if (SetClipboardData(CF_TEXT, hmem)) rc = 1; } } } CloseClipboard(); } return rc; } ������������������������������������������������������������./src/o_model.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000010661�11602724002�012562� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_model.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_model.h" #include "c_config.h" #include "i_modelview.h" #include "i_view.h" #include "s_util.h" #include <stdio.h> // vsnprintf EModel* ActiveModel = 0; EModel *FindModelID(EModel *Model, int ID) { for (EModel *M = Model; M; M = M->Next) { if (M->ModelNo == ID) return M; if (M->Next == Model) break; } return 0; } static int GetNewModelID(EModel *B) { static int lastid = -1; if (ReassignModelIds) lastid = 0; // 0 is used by buffer list while (FindModelID(B, ++lastid) != 0) ; return lastid; } EModel::EModel(int createFlags, EModel **ARoot) : Root(ARoot), View(0), ModelNo(-1) { if (Root) { if (*Root) { if (createFlags & cfAppend) { Prev = *Root; Next = (*Root)->Next; } else { Next = *Root; Prev = (*Root)->Prev; } Prev->Next = this; Next->Prev = this; } else Prev = Next = this; if (!(createFlags & cfNoActivate)) *Root = this; } else Prev = Next = this; ModelNo = GetNewModelID(this); } EModel::~EModel() { //printf("Delete model %p\n", this); for (EModel *D = this; D; D = D->Next) { D->NotifyDelete(this); if (D->Next == this) break; } if (Next != this) { Prev->Next = Next; Next->Prev = Prev; if (*Root == this) *Root = Next; } else *Root = 0; } void EModel::AddView(EView *V) { //fprintf(stderr, "****Add view %p n:(%p) -> %p\n", V, V ? V->NextView : NULL, this); RemoveView(V); if (V) V->NextView = View; View = V; //fprintf(stderr, "Add view %p -> %p\n", View, this); } void EModel::RemoveView(EView *V) { EView **X = &View; //fprintf(stderr, "Remove view %p n:(%p) <- %p, v:%p\n", V, V ? V->NextView : NULL, this, View); if (!V) return; while (*X) { if ((*X) == V) { //(*X)->NextView = 0; *X = V->NextView; return; } X = (&(*X)->NextView); } } void EModel::SelectView(EView *V) { RemoveView(V); AddView(V); } EViewPort *EModel::CreateViewPort(EView * /*V*/) { return 0; } int EModel::ExecCommand(ExCommands /*Command*/, ExState &/*State*/) { return 0; } void EModel::HandleEvent(TEvent &/*Event*/) { } void EModel::Msg(int level, const char *s, ...) { char msgbuftmp[MSGBUFTMP_SIZE]; va_list ap; if (View == 0) return; va_start(ap, s); vsnprintf(msgbuftmp, sizeof(msgbuftmp), s, ap); va_end(ap); if (level != S_BUSY) View->SetMsg(msgbuftmp); } int EModel::CanQuit() { return 1; } int EModel::ConfQuit(GxView * /*V*/, int /*multiFile*/) { return 1; } int EModel::GetContext() { return CONTEXT_NONE; } EEventMap *EModel::GetEventMap() { return 0; } int EModel::BeginMacro() { return 1; } void EModel::GetName(char *AName, size_t /*MaxLen*/) { *AName = 0; } void EModel::GetPath(char *APath, size_t /*MaxLen*/) { *APath = 0; } void EModel::GetInfo(char *AInfo, size_t /*MaxLen*/) { *AInfo = 0; } void EModel::GetTitle(char *ATitle, size_t /*MaxLen*/, char *ASTitle, size_t /*SMaxLen*/) { *ATitle = 0; *ASTitle = 0; } void EModel::NotifyPipe(int /*PipeId*/) { } void EModel::NotifyDelete(EModel * /*Deleted*/) { } void EModel::DeleteRelated() { } void EModel::UpdateTitle() { char Title[256]; char STitle[256]; GetTitle(Title, sizeof(Title), STitle, sizeof(STitle)); for (EView *V = View; V; V = V->NextView) V->MView->Win->UpdateTitle(Title, STitle); } int EModel::GetStrVar(int var, char *str, size_t buflen) { switch (var) { case mvCurDirectory: return GetDefaultDirectory(this, str, buflen); } return 0; } int EModel::GetIntVar(int /*var*/, int * /*value*/) { return 0; } EViewPort::EViewPort(EView *V) : View(V), ReCenter(0) { } EViewPort::~EViewPort() {} void EViewPort::HandleEvent(TEvent &/*Event*/) { } void EViewPort::UpdateView() { } void EViewPort::RepaintView() { } void EViewPort::UpdateStatus() { } void EViewPort::RepaintStatus() { } void EViewPort::GetPos() { } void EViewPort::StorePos() { } void EViewPort::Resize(int /*Width*/, int /*Height*/) {} �������������������������������������������������������������������������������./src/e_undo.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000026643�11344266046�012440� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_undo.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_undo.h" #include "o_buflist.h" #include "s_util.h" #include "sysdep.h" #include <stdio.h> int EBuffer::NextCommand() { if (Match.Row != -1) { Draw(Match.Row, Match.Row); Match.Col = Match.Row = -1; } if (View) View->SetMsg(0); #ifdef CONFIG_UNDOREDO return BeginUndo(); #else return 1; #endif } #ifdef CONFIG_UNDOREDO int EBuffer::PushBlockData() { if (BFI(this, BFI_Undo) == 0) return 1; if (PushULong(BB.Col) == 0) return 0; if (PushULong(BB.Row) == 0) return 0; if (PushULong(BE.Col) == 0) return 0; if (PushULong(BE.Row) == 0) return 0; if (PushULong(BlockMode) == 0) return 0; if (PushUChar(ucBlock) == 0) return 0; return 1; } int EBuffer::BeginUndo() { US.NextCmd = 1; return 1; } int EBuffer::EndUndo() { int N = US.Num - 1; assert(N >= 0); if (N >= 1) { int Order = 1; while (Order < N) Order <<= 1; US.Data = (void **) realloc(US.Data, sizeof(void *) * Order); US.Top = (int *) realloc(US.Top, sizeof(int) * Order); US.Num--; } else { free(US.Data); US.Data = 0; free(US.Top); US.Top = 0; US.Num = 0; } return 1; } int EBuffer::PushULong(unsigned long l) { // static unsigned long x = l; return PushUData(&l, sizeof(unsigned long)); } int EBuffer::PushUChar(unsigned char ch) { return PushUData(&ch, sizeof(unsigned char)); } int EBuffer::PushUData(const void *data, size_t len) { int N; int Order = 1; // printf("UPUSH: %d %c\n", len, *(char *)data); fflush(stdout); if (BFI(this, BFI_Undo) == 0) return 0; if (US.Record == 0) return 1; if (US.NextCmd || US.Num == 0 || US.Data == 0 || US.Top == 0) { N = US.Num; if ((BFI(this, BFI_UndoLimit) == -1) || (US.Undo) || (US.Num < BFI(this, BFI_UndoLimit))) { N++; US.Data = (void **) realloc(US.Data, sizeof(void *) * (N | 255)); US.Top = (int *) realloc(US.Top, sizeof(int) * (N | 255)); if (US.Num == US.UndoPtr && !US.Undo) US.UndoPtr++; US.Num++; } else { N = US.Num; free(US.Data[0]); memmove(US.Data, US.Data + 1, (N - 1) * sizeof(US.Data[0])); memmove(US.Top, US.Top + 1, (N - 1) * sizeof(US.Top[0])); } assert(US.Data); assert(US.Top); N = US.Num - 1; US.Data[N] = 0; US.Top[N] = 0; if (US.NextCmd == 1) { US.NextCmd = 0; // puts("\x7"); if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; // puts("\x7"); } US.NextCmd = 0; } N = US.Num - 1; assert(N >= 0); if (US.Undo == 0) US.UndoPtr = US.Num; while (Order < (US.Top[N] + len)) Order <<= 1; US.Data[N] = realloc(US.Data[N], Order); memcpy((char *) US.Data[N] + US.Top[N], data, len); US.Top[N] += len; return 1; } int EBuffer::GetUData(int No, int pos, void **data, size_t len) { int N; if (No == -1) N = US.Num - 1; else N = No; if (BFI(this, BFI_Undo) == 0) return 0; if (N < 0) return 0; if (US.Data[N] == 0) return 0; if (US.Top[N] == 0) return 0; if (pos == -1) pos = US.Top[N]; if (pos == 0) return 0; // printf("N,pos = %d,%d len = %d\n", N, pos, len); assert(pos >= len); *data = ((char *) US.Data[N]) + pos - len; return 1; } #define UGETC(rc,no,pos,what) \ do { void *d; \ rc = GetUData(no, pos, &d, sizeof(unsigned char)); \ *(unsigned char *)&what = *(unsigned char *)d; \ pos -= (int) sizeof(unsigned char); \ } while (0) #define UGET(rc,no,pos,what) \ do { void *d; \ rc = GetUData(no, pos, &d, sizeof(what)); \ memcpy(&what, d, sizeof(what)); \ pos -= (int) sizeof(what); \ } while (0) int EBuffer::Undo(int undo) { unsigned char UndoCmd; int rc; unsigned long Line; unsigned long Len; unsigned long ACount; unsigned long Col; void *data; int No; int Pos; if (BFI(this, BFI_Undo) == 0) return 0; if (undo) No = US.UndoPtr - 1; else No = US.Num - 1; Pos = US.Top[No]; if (No == 0 && Pos == 0) { //puts("bottom"); return 0; } // for (int i = 0; i < Pos; i++) { // printf("%d: %d\n", i, ((char *)US.Data[No])[i]); // } // printf("Undo %d %d,%d\n", undo, No, Pos); fflush(stdout); // fprintf(stderr, "\nNo = %d, Num = %d\n", No, US.Num); UGETC(rc, No, Pos, UndoCmd); while (rc == 1) { // printf("%d Undo %d %d,%d\n", UndoCmd, undo, No, Pos); fflush(stdout); // for (int i = 0; i < Pos; i++) { // printf("%d: %d\n", i, ((char *)US.Data[No])[i]); // } switch (UndoCmd) { case ucInsLine: UGET(rc, No, Pos, Line); if (rc == 0) return 0; // printf("\tDelLine %d\n", Line); if (DelLine(Line) == 0) return 0; break; case ucDelLine: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Len); if (rc == 0) return 0; if (GetUData(No, Pos, &data, Len) == 0) return 0; // printf("\tInsLine %d\n", Line); if (InsLine(Line, 0) == 0) return 0; // printf("\tInsText %d - %d\n", Line, Len); if (InsText(Line, 0, Len, (char *) data) == 0) return 0; Pos -= Len; break; case ucInsChars: UGET(rc, No, Pos, ACount); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; // printf("\tDelChars %d %d %d\n", Line, Col, ACount); if (DelChars(Line, Col, ACount) == 0) return 0; break; case ucDelChars: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; // printf("\tInsChars %d %d %d\n", Line, Col, ACount); if (InsChars(Line, Col, ACount, (char *) data) == 0) return 0; Pos -= ACount; break; case ucPosition: UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, Col); if (rc == 0) return 0; // printf("\tSetPos %d %d\n", Line, Col); if (SetPos(Col, Line) == 0) return 0; break; case ucBlock: { EPoint P; unsigned long l; // printf("\tBlock\n"); UGET(rc, No, Pos, l); if (rc == 0) return 0; if (BlockMode != (int)l) BlockRedraw(); BlockMode = (int)l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Row = (int)l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Col = (int)l; if (SetBE(P) == 0) return 0; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Row = (int)l; UGET(rc, No, Pos, l); if (rc == 0) return 0; P.Col = (int)l; if (SetBB(P) == 0) return 0; } break; case ucFoldCreate: // puts("ucFoldCreate"); UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldDestroy(Line) == 0) return 0; break; case ucFoldDestroy: // puts("ucFoldDestroy"); { unsigned int level; int ff; UGET(rc, No, Pos, Line); if (rc == 0) return 0; UGET(rc, No, Pos, level); if (rc == 0) return 0; if (FoldCreate(Line) == 0) return 0; ff = FindFold(Line); assert(ff != -1); FF[ff].level = (unsigned char) level; } break; case ucFoldPromote: // puts("ucFoldPromote"); UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldDemote(Line) == 0) return 0; break; case ucFoldDemote: // puts("ucFoldDemote"); UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldPromote(Line) == 0) return 0; break; case ucFoldOpen: // puts("ucFoldOpen"); UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldClose(Line) == 0) return 0; break; case ucFoldClose: // puts("ucFoldClose"); UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (FoldOpen(Line) == 0) return 0; break; case ucModified: // printf("\tModified\n"); Modified = 0; break; case ucPlaceUserBookmark: //puts ("ucPlaceUserBookmark"); UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; Pos -= ACount; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; // if (Col == -1 || Line == -1) { if (Col == (unsigned long)-1 || Line == (unsigned long)-1) { if (RemoveUserBookmark ((const char *)data)==0) return 0; } else { if (PlaceUserBookmark ((const char *)data,EPoint (Line,Col))==0) return 0; } break; case ucRemoveUserBookmark: //puts("ucRemoveUserBookmark"); UGET(rc, No, Pos, ACount); if (rc == 0) return 0; if (GetUData(No, Pos, &data, ACount) == 0) return 0; Pos -= ACount; UGET(rc, No, Pos, Col); if (rc == 0) return 0; UGET(rc, No, Pos, Line); if (rc == 0) return 0; if (PlaceUserBookmark ((const char *)data,EPoint (Line,Col))==0) return 0; break; default: fprintf(stderr, "Oops: invalid undo command %d.\n", UndoCmd); return 0; //assert(1 == "Oops: invalid undo command.\n"[0]); } // puts("\tok"); // fprintf(stderr, "\nNo = %d, Num = %d\n", No, US.Num); UGETC(rc, No, Pos, UndoCmd); } if (undo) US.UndoPtr--; else { US.UndoPtr++; free(US.Data[No]); if (EndUndo() == 0) return 0; } return 1; } int EBuffer::Redo() { int rc; if (BFI(this, BFI_Undo) == 0) return 0; // US.NextCmd = 0; // disable auto push position if (US.Num == 0 || US.UndoPtr == US.Num) { Msg(S_INFO, "Nothing to redo."); return 0; } US.Record = 0; rc = Undo(0); US.Record = 1; return rc; } int EBuffer::Undo() { int rc; if (BFI(this, BFI_Undo) == 0) return 0; assert(US.Num >= 0); assert(US.UndoPtr >= 0); if (US.Num == 0 || US.UndoPtr == 0) { Msg(S_INFO, "Nothing to undo."); return 0; } US.Undo = 1; rc = Undo(1); US.Undo = 0; return rc; } #endif ���������������������������������������������������������������������������������������������./src/c_bind.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000043035�11602724002�012363� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_bind.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_bind.h" #include "s_string.h" #include "sysdep.h" #include <ctype.h> ////////////////////////////////////////////////////////////////////////////// EMode *Modes = 0; EEventMap *EventMaps = 0; int CMacros = 0; ExMacro *Macros = 0; ////////////////////////////////////////////////////////////////////////////// #include "c_cmdtab.h" ////////////////////////////////////////////////////////////////////////////// static const struct { const char Name[8]; TKeyCode Key; } KeyList[] = { { "Esc", kbEsc }, { "Tab", kbTab }, { "Space", kbSpace }, { "Enter", kbEnter }, { "BackSp", kbBackSp }, { "F1", kbF1 }, { "F2", kbF2 }, { "F3", kbF3 }, { "F4", kbF4 }, { "F5", kbF5 }, { "F6", kbF6 }, { "F7", kbF7 }, { "F8", kbF8 }, { "F9", kbF9 }, { "F10", kbF10 }, { "F11", kbF11 }, { "F12", kbF12 }, { "Left", kbLeft }, { "Right", kbRight }, { "Up", kbUp }, { "Down", kbDown }, { "Home", kbHome }, { "End", kbEnd }, { "PgUp", kbPgUp }, { "PgDn", kbPgDn }, { "Ins", kbIns }, { "Del", kbDel }, { "Center", kbCenter }, { "Break", kbBreak }, { "Pause", kbPause }, { "PrtScr", kbPrtScr }, { "SysReq", kbSysReq }, }; static int ParseKey(const char *Key, KeySel &ks) { TKeyCode KeyFlags = 0; ks.Mask = 0; ks.Key = 0; while (Key[0] && ((Key[1] == '+') || (Key[1] == '-'))) { if (Key[1] == '-') { switch (Key[0]) { case 'A': ks.Mask |= kfAlt; break; case 'C': ks.Mask |= kfCtrl; break; case 'S': ks.Mask |= kfShift; break; case 'G': ks.Mask |= kfGray; break; case 'X': ks.Mask |= kfSpecial; break; } } else if (Key[1] == '+') { switch (Key[0]) { case 'A': KeyFlags |= kfAlt; break; case 'C': KeyFlags |= kfCtrl; break; case 'S': KeyFlags |= kfShift; break; case 'G': KeyFlags |= kfGray; break; case 'X': KeyFlags |= kfSpecial; break; } } Key += 2; } for (size_t i = 0; i < FTE_ARRAY_SIZE(KeyList); ++i) if (strcmp(Key, KeyList[i].Name) == 0) { ks.Key = KeyList[i].Key; break; } if (ks.Key == 0) ks.Key = *Key; if ((KeyFlags & kfCtrl) && !(KeyFlags & kfSpecial)) { if (ks.Key < 256) { if (ks.Key < 32) ks.Key += 64; else ks.Key = toupper(ks.Key); } } ks.Key |= KeyFlags; return 0; } int GetKeyName(char *Key, size_t KeySize, KeySel &ks) { strlcpy(Key, "", KeySize); if (ks.Key & kfAlt) strlcat(Key, "A+", KeySize); if (ks.Mask & kfAlt) strlcat(Key, "A-", KeySize); if (ks.Key & kfCtrl) strlcat(Key, "C+", KeySize); if (ks.Mask & kfCtrl) strlcat(Key, "C-", KeySize); if (ks.Key & kfGray) strlcat(Key, "G+", KeySize); if (ks.Mask & kfGray) strlcat(Key, "G-", KeySize); if (ks.Key & kfShift) strlcat(Key, "S+", KeySize); if (ks.Mask & kfShift) strlcat(Key, "S-", KeySize); if (keyCode(ks.Key) < 256) { char c[2] = { (char)ks.Key, 0 }; //if (ks.Key & kfCtrl) // if (c[0] < ' ') // c[0] += '@'; if (c[0] == 32) strlcat(Key, "Space", KeySize); else strlcat(Key, c, KeySize); } else { for (size_t i = 0; i < FTE_ARRAY_SIZE(KeyList); ++i) if (KeyList[i].Key == keyCode(ks.Key)) { strlcat(Key, KeyList[i].Name, KeySize); break; } } return 0; } const char *GetCommandName(int Command) { if (Command & CMD_EXT) { Command &= ~CMD_EXT; if ((Command < 0) || (Command >= CMacros)) return "?INVALID?"; if (Macros[Command].Name) return Macros[Command].Name; else return "?NONE?"; } for (size_t i = 0; i < FTE_ARRAY_SIZE(Command_Table); ++i) if (Command_Table[i].CmdId == Command) return Command_Table[i].Name; return "?invalid?"; } int CmdNum(const char *Cmd) { for (size_t i = 0; i < FTE_ARRAY_SIZE(Command_Table); ++i) if (strcmp(Cmd, Command_Table[i].Name) == 0) return Command_Table[i].CmdId; for (int i = 0; i < CMacros; i++) if (Macros[i].Name && (strcmp(Cmd, Macros[i].Name)) == 0) return i | CMD_EXT; return 0; // Nop } EMode *FindMode(const char *Name) { EMode *m = Modes; //fprintf(stderr, "Searching mode %s\n", Name); while (m) { if (strcmp(Name, m->fName) == 0) return m; m = m->fNext; } return 0; } EEventMap *FindEventMap(const char *Name) { EEventMap *m = EventMaps; //fprintf(stderr, "Searching map %s\n", Name); while (m) { if (strcmp(Name, m->Name) == 0) return m; m = m->Next; } return 0; } EEventMap *FindActiveMap(EMode *Mode) { while (Mode) { if (Mode->fEventMap) return Mode->fEventMap; Mode = Mode->fParent; } return 0; } EKey *SetKey(EEventMap *aMap, const char *aKey) { EKeyMap **map = &aMap->KeyMap, *pm, *parent = 0; EKey *k; char Key[256]; char *p, *d; EEventMap *xm = aMap; // printf("Setting key %s\n", Key); strcpy(Key, aKey); // if mode has parent, get parent keymap while (xm && xm->Parent && (parent == 0)) { parent = xm->Parent->KeyMap; // printf("%s : %s : %d\n", xm->fName, xm->fParent->fName, parent); xm = xm->Parent; } d = Key; while (d) { // parse key combination p = d; d = strchr(p, '_'); if (d) { if (d[1] == 0 || d[1] == '_') d++; if (*d == 0) d = 0; else { *d = 0; d++; } } // if lastkey if (d == 0) { k = new EKey(p); if (*map) { (*map)->AddKey(k); } else { *map = new EKeyMap(); (*map)->fParent = parent; (*map)->AddKey(k); } return k; } else { // if introductory key if (*map == 0) { // first key in mode, create map // printf("new map key = %s, parent %d\n", p, parent); k = new EKey(p, 0); *map = new EKeyMap(); (*map)->fParent = parent; (*map)->AddKey(k); } else { KeySel ks; ParseKey(p, ks); if ((k = (*map)->FindKey(ks.Key)) == 0) { // check if key exists // add it if not k = new EKey(p, 0); (*map)->AddKey(k); } } map = &k->fKeyMap; // set current map to key's map // get parent keymap pm = parent; parent = 0; // printf("Searching %s\n", p); while (pm) { // while exists KeySel ks; EKey *pk; ParseKey(p, ks); if ((pk = pm->FindKey(ks.Key)) != 0) { // if key exists, find parent of it parent = pk->fKeyMap; // printf("Key found %d\n", parent); break; } pm = pm->fParent; // otherwise find parent of current keymap } } } return 0; } static void InitWordChars() { static int init = 0; if (init == 0) { for (int i = 0; i < 256; i++) // isalnum??? //if (isdigit(i) || isalpha(i) // || (i >= 'A' && i <= 'Z') // || (i >= 'a' && i <= 'z') || (i == '_')) { if (isalnum(i) || (i == '_')) { WSETBIT(DefaultBufferFlags.WordChars, i, 1); // Can someone tell me why we check A through Z? // This won't work should someone port to EBCDIC (why, though?) // besides, isupper is usually a #define that will compile to something // even faster. if (/*(i >= 'A' && i <= 'Z') || */ isupper(i)) WSETBIT(DefaultBufferFlags.CapitalChars, i, 1); } init = 1; } } void SetWordChars(char *w, const char *s) { const char *p = s; memset(w, 0, 32); while (p && *p) { if (*p == '\\') { p++; if (*p == 0) return; } else if (p[1] == '-') { if (p[2] == 0) return ; for (int i = p[0]; i < p[2]; i++) WSETBIT(w, i, 1); p += 2; } WSETBIT(w, *p, 1); p++; } } EMode::EMode(EMode *aMode, EEventMap *Map, const char *aName) : fNext(0), fName(strdup(aName)), fEventMap(Map), fParent(aMode) { InitWordChars(); if (aMode) { #ifdef CONFIG_SYNTAX_HILIT fColorize = aMode->fColorize; #endif Flags = aMode->Flags; // duplicate strings in flags to allow them be freed for (int i=0; i<BFS_COUNT; i++) { if (aMode->Flags.str[i] != 0) Flags.str[i] = strdup(aMode->Flags.str[i]); } MatchName = 0; MatchLine = 0; MatchNameRx = 0; MatchLineRx = 0; if (aMode->MatchName) { MatchName = strdup(aMode->MatchName); MatchNameRx = RxCompile(MatchName); } if (aMode->MatchLine) { MatchLine = strdup(aMode->MatchLine); MatchLineRx = RxCompile(MatchLine); } } else { MatchName = 0; MatchLine = 0; MatchNameRx = 0; MatchLineRx = 0; #ifdef CONFIG_SYNTAX_HILIT fColorize = 0; #endif Flags = DefaultBufferFlags; // there is no strings in default settings... } } EMode::~EMode() { // fEventMap is just pointer to EventMaps list, so do not destroy it // fColorize is also just a pointer free(fName); free(MatchName); RxFree(MatchNameRx); free(MatchLine); RxFree(MatchLineRx); // free strings from flags for (unsigned i = 0; i < BFS_COUNT; i++) free(Flags.str[i]); } EKeyMap::EKeyMap() : fParent(NULL), fKeys(NULL) { } EKeyMap::~EKeyMap() { // free keys EKey *e; while ((e = fKeys) != NULL) { fKeys = fKeys->fNext; delete e; } } void EKeyMap::AddKey(EKey *aKey) { aKey->fNext = fKeys; fKeys = aKey; } static int MatchKey(TKeyCode aKey, KeySel aSel) { long flags = aKey & ~ 0xFFFF; long key = aKey & 0xFFFF; flags &= ~kfAltXXX; if (flags & kfShift) { if (key < 256) { if (flags == kfShift) flags &= ~kfShift; else if (isascii(key)) key = toupper(key); } } if ((flags & kfCtrl) && !(flags & kfSpecial)) if (key < 32) key += 64; flags &= ~aSel.Mask; if (aSel.Mask & kfShift) { if (key < 256) if (isascii(key)) key = toupper(key); } aKey = key | flags; if (aKey == aSel.Key) return 1; return 0; } EKey *EKeyMap::FindKey(TKeyCode aKey) { EKey *p = fKeys; while (p) { if (MatchKey(aKey, p->fKey)) return p; p = p->fNext; } return 0; } EEventMap::EEventMap(const char *AName, EEventMap *AParent) { Name = strdup(AName); Parent = AParent; KeyMap = 0; Next = EventMaps; EventMaps = this; memset(Menu, 0, sizeof(Menu)); memset(abbrev, 0, sizeof(abbrev)); } EEventMap::~EEventMap() { free(Name); // free menu[] for (int i = 0; i < EM_MENUS; i++) free(Menu[i]); #ifdef CONFIG_ABBREV // free Abbrev's EAbbrev *ab; for (int i = 0; i < ABBREV_HASH; i++) while ((ab = abbrev[i]) != NULL) { abbrev[i] = abbrev[i]->next; delete ab; } #endif // free keymap's delete KeyMap; } void EEventMap::SetMenu(int which, const char *What) { if (which < 0 || which >= EM_MENUS) return; if (Menu[which] != 0) free(Menu[which]); Menu[which] = strdup(What); } char *EEventMap::GetMenu(int which) { if (which < 0 || which >= EM_MENUS) return 0; if (Menu[which] || Parent == 0) return Menu[which]; else return Parent->GetMenu(which); } #ifdef CONFIG_ABBREV int EEventMap::AddAbbrev(EAbbrev *ab) { int i = HashStr(ab->Match, ABBREV_HASH); ab->next = abbrev[i]; abbrev[i] = ab; return 1; } EAbbrev *EMode::FindAbbrev(const char *string) { EEventMap *Map = fEventMap; EAbbrev *ab; int i; if (string == 0) return 0; i = HashStr(string, ABBREV_HASH); while (Map) { ab = Map->abbrev[i]; while (ab != 0) { if (ab->Match && (strcmp(string, ab->Match) == 0)) return ab; ab = ab->next; } Map = Map->Parent; } return 0; } #endif EKey::EKey(const char *aKey) : Cmd(-1), fKeyMap(0), fNext(0) { ParseKey(aKey, fKey); } EKey::EKey(const char *aKey, EKeyMap *aKeyMap) : Cmd(-1), fKeyMap(aKeyMap), fNext(0) { ParseKey(aKey, fKey); } EKey::~EKey() { // if there is child keymaps delete them delete fKeyMap; } #ifdef CONFIG_ABBREV EAbbrev::EAbbrev(const char *aMatch, const char *aReplace) : next(0), Cmd(-1), Match(strdup(aMatch)), Replace(strdup(aReplace)) { } EAbbrev::EAbbrev(const char *aMatch, int aCmd) : next(0), Cmd(aCmd), Match(strdup(aMatch)), Replace(0) { } EAbbrev::~EAbbrev() { free(Match); free(Replace); } #endif int AddCommand(int no, int Command, int count, int ign) { if (count == 0) return 0; if (Command == 0) return 0; Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_COMMAND; Macros[no].cmds[Macros[no].Count].u.num = Command; Macros[no].cmds[Macros[no].Count].repeat = short(count); Macros[no].cmds[Macros[no].Count].ign = short(ign); Macros[no].Count++; return 1; } int AddString(int no, const char *String) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_STRING; Macros[no].cmds[Macros[no].Count].u.string = strdup(String); Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddNumber(int no, long number) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_NUMBER; Macros[no].cmds[Macros[no].Count].u.num = number; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddConcat(int no) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_CONCAT; Macros[no].cmds[Macros[no].Count].u.num = 0; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int AddVariable(int no, int number) { Macros[no].cmds = (CommandType *)realloc(Macros[no].cmds, sizeof(CommandType) * (Macros[no].Count + 1)); Macros[no].cmds[Macros[no].Count].type = CT_VARIABLE; Macros[no].cmds[Macros[no].Count].u.num = number; Macros[no].cmds[Macros[no].Count].repeat = 0; Macros[no].cmds[Macros[no].Count].ign = 0; Macros[no].Count++; return 1; } int NewCommand(const char *Name) { Macros = (ExMacro *) realloc(Macros, sizeof(ExMacro) * (1 + CMacros)); Macros[CMacros].Count = 0; Macros[CMacros].cmds = 0; Macros[CMacros].Name = (Name != NULL) ? strdup(Name) : 0; CMacros++; return CMacros - 1; } int ExState::GetStrParam(EView *view, char *str, size_t maxlen) { if (Macro == -1 || Pos == -1 || Pos >= Macros[Macro].Count) return 0; if (Macros[Macro].cmds[Pos].type == CT_STRING) { if (maxlen > 0) strlcpy(str, Macros[Macro].cmds[Pos].u.string, maxlen); Pos++; } else if (view && Macros[Macro].cmds[Pos].type == CT_VARIABLE) { //puts("variable\x7"); if (view->GetStrVar(Macros[Macro].cmds[Pos].u.num, str, maxlen) == 0) return 0; Pos++; } else return 0; if (Pos < Macros[Macro].Count) { if (Macros[Macro].cmds[Pos].type == CT_CONCAT) { Pos++; size_t len = strlen(str); if (len >= maxlen) return 0; size_t left = maxlen - len; //puts("concat\x7"); if (GetStrParam(view, str + len, left) == 0) return 0; } } return 1; } int ExState::GetIntParam(EView *view, int *value) { if (Macro == -1 || Pos == -1 || Pos >= Macros[Macro].Count) return 0; if (Macros[Macro].cmds[Pos].type == CT_NUMBER) { *value = Macros[Macro].cmds[Pos].u.num; Pos++; } else if (view && Macros[Macro].cmds[Pos].type == CT_VARIABLE) { if (view->GetIntVar(Macros[Macro].cmds[Pos].u.num, value) == 0) return 0; Pos++; } else return 0; return 1; } int HashStr(const char *p, int maxim) { unsigned int i = 1; while (p && *p) i += i ^ (i << 3) ^ (unsigned int)(*p++) ^ (i >> 3); return i % maxim; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/ftepm.rc��������������������������������������������������������������������������������������0000644�0001750�0001750�00000001133�07045071304�012101� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <os2.h> ICON 1 icons\ftepm.ico BITMAP 101 bmps\exit.bmp BITMAP 102 bmps\open.bmp BITMAP 103 bmps\save.bmp BITMAP 104 bmps\close.bmp BITMAP 105 bmps\prev.bmp BITMAP 106 bmps\last.bmp BITMAP 107 bmps\next.bmp BITMAP 108 bmps\undo.bmp BITMAP 109 bmps\redo.bmp BITMAP 110 bmps\cut.bmp BITMAP 111 bmps\copy.bmp BITMAP 112 bmps\paste.bmp BITMAP 113 bmps\pastecol.bmp BITMAP 114 bmps\errprev.bmp BITMAP 115 bmps\errnext.bmp BITMAP 116 bmps\tagfind.bmp BITMAP 117 bmps\tagnext.bmp BITMAP 118 bmps\tagprev.bmp BITMAP 119 bmps\tagpop.bmp MENU 1 BEGIN MENUITEM "Quit", 100 END rcinclude pmdlg.rc �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_list.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000041651�11602724002�012440� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_list.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_list.h" #include "c_color.h" #include "c_config.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include <stdio.h> EListPort::EListPort(EList *L, EView *V) : EViewPort(V), List(L), OldRow(-1), OldTopRow(-1), OldLeftCol(-1), OldCount(-1) { GetPos(); } EListPort::~EListPort() { StorePos(); } void EListPort::StorePos() { List->Row = Row; List->TopRow = TopRow; List->LeftCol = LeftCol; List->NeedsUpdate = 1; } void EListPort::GetPos() { Row = List->Row; TopRow = List->TopRow; LeftCol = List->LeftCol; } void EListPort::HandleEvent(TEvent &Event) { int W = 1; int H = 1; EViewPort::HandleEvent(Event); if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } switch (Event.What) { case evCommand: switch (Event.Msg.Command) { case cmVScrollUp: List->ScrollDown(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollDown: List->ScrollUp(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollPgUp: List->MovePageUp(); Event.What = evNone; break; case cmVScrollPgDn: List->MovePageDown(); Event.What = evNone; break; case cmVScrollMove: { int ypos; ypos = List->Row - List->TopRow; List->TopRow = Event.Msg.Param1; List->Row = List->TopRow + ypos; } Event.What = evNone; break; case cmHScrollLeft: List->ScrollRight(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollRight: List->ScrollLeft(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollPgLt: List->ScrollRight(W); Event.What = evNone; break; case cmHScrollPgRt: List->ScrollLeft(W); Event.What = evNone; break; case cmHScrollMove: List->LeftCol = Event.Msg.Param1; Event.What = evNone; break; } break; #ifdef CONFIG_MOUSE case evMouseDown: case evMouseUp: case evMouseMove: case evMouseAuto: HandleMouse(Event); #endif break; } } #ifdef CONFIG_MOUSE void EListPort::HandleMouse(TEvent &Event) { int W, H; int x, y, xx, yy; View->MView->ConQuerySize(&W, &H); x = Event.Mouse.X; y = Event.Mouse.Y; yy = y + TopRow; xx = x + LeftCol; // if (yy >= Selected) yy = Window->Buffer->VCount - 1; if (yy < 0) yy = 0; if (xx < 0) xx = 0; switch (Event.What) { case evMouseDown: if (Event.Mouse.Y == H - 1) break; if (View->MView->Win->CaptureMouse(1)) View->MView->MouseCaptured = 1; else break; if (Event.Mouse.Buttons == 1) if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); if (Event.Mouse.Count == 2) { if (List->CanActivate(List->Row)) { View->MView->Win->CaptureMouse(0); if (List->Activate() == 1) { //View->MView->EndExec(1); } } } } if (Event.Mouse.Buttons == 2) if (yy < List->Count && yy >= 0) List->SetPos(yy, LeftCol); Event.What = evNone; break; case evMouseAuto: case evMouseMove: if (View->MView->MouseCaptured) { if (Event.Mouse.Buttons == 1 || Event.Mouse.Buttons == 2) if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); } Event.What = evNone; } break; case evMouseUp: if (View->MView->MouseCaptured) View->MView->Win->CaptureMouse(0); else break; if (Event.Mouse.Buttons == 2) { EEventMap *Map = View->MView->Win->GetEventMap(); const char *MName = 0; if (yy < List->Count && yy >= 0) { List->SetPos(yy, LeftCol); } if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->MView->Win->Parent->PopupMenu(MName); } View->MView->MouseCaptured = 0; Event.What = evNone; break; } } #endif void EListPort::UpdateView() { if (OldLeftCol != LeftCol || OldTopRow != TopRow || OldCount != List->Count) List->NeedsRedraw = List->NeedsUpdate = 1; if (List->NeedsUpdate) { List->UpdateList(); List->FixPos(); if (List->View == View) GetPos(); if (OldLeftCol != LeftCol || OldTopRow != TopRow || OldCount != List->Count) List->NeedsRedraw = List->NeedsUpdate = 1; PaintView(List->NeedsRedraw); OldRow = Row; OldTopRow = TopRow; OldLeftCol = LeftCol; OldCount = List->Count; List->NeedsUpdate = 0; List->NeedsRedraw = 0; } } void EListPort::RepaintView() { PaintView(1); OldRow = Row; OldTopRow = TopRow; OldLeftCol = LeftCol; OldCount = List->Count; List->NeedsUpdate = 0; List->NeedsRedraw = 0; } void EListPort::PaintView(int PaintAll) { TDrawBuffer B; int I; ChColor color; int W, H; if (List->NeedsRedraw) PaintAll = 1; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->ConQuerySize(&W, &H); H--; if (View->MView->Win->GetViewContext() != View->MView) return; for (I = 0; I < H; I++) { if (PaintAll || I + TopRow == Row || I + TopRow == OldRow) { int mark = List->IsMarked(I + TopRow); int hilit = List->IsHilited(I + TopRow); color = ((Row == I + TopRow) && View->MView->Win->IsActive()) ? (mark ? (hilit ? hcList_MarkHilitSel : hcList_MarkSelect ): (hilit ? hcList_HilitSelect : hcList_Selected)) : (mark ? (hilit ? hcList_MarkHilit : hcList_Marked) : (hilit ? hcList_Hilited : hcList_Normal)); MoveChar(B, 0, W, ' ', color, W); if (I + TopRow < List->Count) List->DrawLine(B, I + TopRow, LeftCol, color, W); View->MView->ConPutBox(0, I, W, 1, B); } } } void EListPort::UpdateStatus() { RepaintStatus(); } void EListPort::RepaintStatus() { TDrawBuffer B; char s[80]; int W, H; char SColor; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->ConQuerySize(&W, &H); assert(W >= 0 && H >= 0 && W < 1000 && H < 1000); List->UpdateList(); List->FixPos(); if (List->View == View) GetPos(); if (View->MView->Win->GetStatusContext() != View->MView) return; View->MView->Win->SetSbVPos(TopRow, H, List->Count + (WeirdScroll ? H - 1 : 0)); View->MView->Win->SetSbHPos(LeftCol, W, 1024 + (WeirdScroll ? W - 1 : 0)); if (View->MView->IsActive()) // hack SColor = hcStatus_Active; else SColor = hcStatus_Normal; MoveCh(B, ' ', SColor, W); if (View->CurMsg == 0) { if (List->Title) MoveStr(B, 0, W, List->Title, SColor, W); sprintf(s, "%c%d/%d", ConGetDrawChar(DCH_V), Row + 1, List->Count); MoveStr(B, W - strlen(s), W, s, SColor, W); } else { MoveStr(B, 0, W, View->CurMsg, SColor, W); } View->MView->ConPutBox(0, H - 1, W, 1, B); if (View->MView->Win->GetStatusContext() == View->MView && View->MView->Win->IsActive()) View->MView->Win->ConSetCursorPos(0, Row - TopRow); } EList::EList(int createFlags, EModel **ARoot, const char *aTitle) : EModel(createFlags, ARoot), Title(strdup(aTitle)), Row(0), LeftCol(0), TopRow(0), Count(0), MouseCaptured(0), MouseMoved(0), NeedsUpdate(1), NeedsRedraw(1) { } EList::~EList() { free(Title); } EViewPort *EList::CreateViewPort(EView *V) { V->Port = new EListPort(this, V); AddView(V); return V->Port; } EListPort *EList::GetViewVPort(EView *V) { return (EListPort *)V->Port; } EListPort *EList::GetVPort() { return (EListPort *)View->Port; } void EList::SetTitle(const char *ATitle) { free(Title); Title = strdup(ATitle); if (View && View->MView) View->MView->RepaintStatus(); } int EList::ExecCommand(ExCommands Command, ExState &State) { int W = 1; int H = 1; if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } FixPos(); switch (Command) { case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExScrollLeft: return ScrollLeft(8); case ExScrollRight: return ScrollRight(8); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExRescan: RescanList(); return 1; case ExActivate: return Activate(); case ExListMark: return Mark(); case ExListUnmark: return Unmark(); case ExListToggleMark: return ToggleMark(); case ExListMarkAll: return MarkAll(); case ExListUnmarkAll: return UnmarkAll(); case ExListToggleMarkAll: return ToggleMarkAll(); default: ; } return EModel::ExecCommand(Command, State); } EEventMap *EList::GetEventMap() { return FindEventMap("LIST"); } void EList::HandleEvent(TEvent &/*Event*/) { } void EList::DrawLine(PCell /*B*/, int /*Line*/, int /*Col*/, ChColor /*color*/, int /*Width*/) { } char *EList::FormatLine(int /*Line*/) { return 0; } void EList::RescanList() {} void EList::UpdateList() { NeedsUpdate = 1; } void EList::FreeList() {} void EList::FixPos() { int W, H; int OTopRow = TopRow; int OLeftCol = LeftCol; int ORow = Row; if (View == 0 || View->MView == 0 || View->MView->Win == 0) return ; View->MView->Win->ConQuerySize(&W, &H); H--; //int scrollJumpX = Min(ScrollJumpX, W / 2); int scrollJumpY = Min(ScrollJumpY, H / 2); //int scrollBorderX = Min(ScrollBorderX, W / 2); int scrollBorderY = Min(ScrollBorderY, H / 2); if (LeftCol < 0) LeftCol = 0; if (Row >= Count) Row = Count - 1; if (!WeirdScroll) if (TopRow + H > Count) TopRow = Count - H; if (Row < 0) Row = 0; if (GetVPort()->ReCenter) { TopRow = Row - H / 2; GetVPort()->ReCenter = 0; } if (TopRow + scrollBorderY > Row) TopRow = Row - scrollJumpY + 1 - scrollBorderY; if (TopRow + H - scrollBorderY <= Row) TopRow = Row - H + 1 + scrollJumpY - 1 + scrollBorderY; if (TopRow < 0) TopRow = 0; if (OTopRow != TopRow || OLeftCol != LeftCol || ORow != Row) { NeedsRedraw = 1; NeedsUpdate = 1; } } int EList::GetContext() { return CONTEXT_LIST; }; int EList::BeginMacro() { return 1; } int EList::CanActivate(int /*Line*/) { return 1; } int EList::Activate(int /*No*/) { return 0; } int EList::IsHilited(int /*Line*/) { return 0; } int EList::IsMarked(int /*Line*/) { return 0; } int EList::Mark(int /*Line*/) { return 1; } int EList::Unmark(int /*Line*/) { return 1; } int EList::SetPos(int ARow, int ACol) { Row = ARow; LeftCol = ACol; NeedsUpdate = 1; return 1; } int EList::MoveLeft() { if (LeftCol == 0) return 0; LeftCol--; NeedsUpdate = 1; return 1; } int EList::MoveRight() { LeftCol++; NeedsUpdate = 1; return 1; } int EList::MoveUp() { if (Row == 0) return 0; Row--; NeedsUpdate = 1; return 1; } int EList::MoveDown() { if (Row == Count - 1) return 0; Row++; NeedsUpdate = 1; return 1; } int EList::MoveLineStart() { if (LeftCol != 0) { NeedsUpdate = 1; LeftCol = 0; } return 1; } // Move current column position to end of line, if line is shorter, stay at // begining of line, if it is long enough move it to end and subtract // screen width / 2 from actual length int EList::MoveLineEnd() { int W, H, len; View->MView->Win->ConQuerySize(&W, &H); H--; len = GetRowLength(Row); if (len < W) { if (LeftCol != 0) { LeftCol = 0; NeedsUpdate = 1; } } else if (LeftCol != len - W/2) { LeftCol = len - W/2; NeedsUpdate = 1; } return 1; } int EList::MovePageUp() { int W, H; if (Row == 0) return 0; View->MView->Win->ConQuerySize(&W, &H); H--; Row -= H; TopRow -= H; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return 1; } int EList::MovePageDown() { int W, H; if (Row == Count - 1) return 0; View->MView->Win->ConQuerySize(&W, &H); H--; Row += H; TopRow += H; if (Row >= Count) Row = Count - 1; if (TopRow > Row) TopRow = Row; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return 1; } int EList::ScrollRight(int Cols) { if (LeftCol >= Cols) { LeftCol -= Cols; NeedsUpdate = 1; } else if (LeftCol != 0) { LeftCol = 0; NeedsUpdate = 1; } else return 0; return 1; } int EList::ScrollLeft(int Cols) { LeftCol += Cols; NeedsUpdate = 1; return 1; } int EList::ScrollUp(int Rows) { if (TopRow == Count - 1) return 0; TopRow += Rows; Row += Rows; if (Row >= Count) Row = Count - 1; if (Row < 0) Row = 0; if (TopRow > Row) TopRow = Row; NeedsUpdate = 1; return 1; } int EList::ScrollDown(int Rows) { if (TopRow == 0) return 0; TopRow -= Rows; Row -= Rows; if (Row < 0) Row = 0; if (TopRow < 0) TopRow = 0; NeedsUpdate = 1; return 1; } int EList::MovePageStart() { if (Row <= TopRow) return 0; Row = TopRow; NeedsUpdate = 1; return 1; } int EList::MovePageEnd() { int W, H; if (Row == Count - 1) return 1; View->MView->Win->ConQuerySize(&W, &H); H--; if (Row == TopRow + H - 1) return 1; Row = TopRow + H - 1; if (Row >= Count) Row = Count - 1; if (Row < 0) Row = 0; NeedsUpdate = 1; return 1; } int EList::MoveFileStart() { if (Row == 0 && LeftCol == 0) return 1; Row = 0; LeftCol = 0; NeedsUpdate = 1; return 1; } int EList::MoveFileEnd() { if (Row == Count - 1 && LeftCol == 0) return 0; Row = Count - 1; if (Row < 0) Row = 0; NeedsUpdate = 1; LeftCol = 0; return 1; } int EList::Activate() { if (Count > 0) if (CanActivate(Row)) if (Activate(Row) == 1) return 1; return 0; } int EList::Mark() { if (Count > 0 && ! IsMarked(Row) && Mark(Row) == 1) { NeedsRedraw = 1; return 1; } else return 0; } int EList::Unmark() { if (Count > 0 && IsMarked(Row) && Unmark(Row) == 1) { NeedsRedraw = 1; return 1; } else return 0; } int EList::ToggleMark() { if (Count > 0) { if (IsMarked(Row)) { if (Unmark(Row) == 1) { NeedsRedraw = 1; return 1; } } else { if (Mark(Row) == 1) { NeedsRedraw = 1; return 1; } } } return 0; } int EList::MarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (! IsMarked(i)) if (Mark(i) != 1) return 0; } return 1; } int EList::UnmarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (IsMarked(i)) if (Unmark(i) != 1) return 0; } return 1; } int EList::ToggleMarkAll() { NeedsRedraw = 1; for (int i = 0; i < Count; i++) { if (IsMarked(i)) { if (Unmark(i) != 1) return 0; } else { if (Mark(i) != 1) return 0; } } return 1; } ���������������������������������������������������������������������������������������./src/o_svn.h���������������������������������������������������������������������������������������0000644�0001750�0001750�00000002761�11331412505�011740� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svn.h * * S.Pinigin copy o_cvs.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class providing access to most of SVN commands. */ #ifndef O_SVN_H #define O_SVN_H #include "o_svnbase.h" #ifdef CONFIG_OBJ_SVN class ESvn:public ESvnBase { public: char *LogFile; int Commiting; ESvn (int createFlags,EModel **ARoot,char *Dir,char *ACommand,char *AOnFiles); ESvn (int createFlags,EModel **ARoot); ~ESvn (); void RemoveLogFile (); // Return marked files in allocated space separated list char *MarkedAsList (); // Return SVN status char of file or 0 if unknown // (if char is lowercase, state was guessed from last command invoked upon file) char GetFileStatus(const char *file); virtual void ParseLine (char *line,int len); // Returns 0 if OK virtual int RunPipe(const char *Dir, const char *Command, const char *OnFiles); virtual void ClosePipe (); // Start commit process (opens message buffer), returns 0 if OK int RunCommit(const char *Dir, const char *Command, const char *OnFiles); // Finish commit process (called on message buffer close), returns 0 if OK int DoneCommit (int commit); virtual int CanQuit (); virtual int ConfQuit (GxView *V,int multiFile); virtual int GetContext () {return CONTEXT_SVN;} virtual EEventMap *GetEventMap (); }; extern ESvn *SvnView; #endif // CONFIG_OBJ_SVN #endif // O_SVN_H ���������������./src/indent.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000001474�11331412504�012427� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* indent.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_buffer.h" #ifdef CONFIG_INDENT_SIMPLE /* place holder */ int Indent_SIMPLE(EBuffer *B, int Line, int /*PosCursor*/) { int Pos, Old; if (Line == 0) { Pos = 0; } else { if (B->RLine(Line - 1)->StateE == 0) { Pos = B->LineIndented(Line - 1); } else { // for comments, strings, etc, use same as prev line. Pos = B->LineIndented(Line - 1); } } Old = B->LineIndented(Line); if (Pos < 0) Pos = 0; if (Pos != Old) if (B->IndentLine(Line, Pos) == 0) return 0;; return 1; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_choice.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000001767�11344266047�012377� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_choice.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_CHOICE_H #define I_CHOICE_H #include "i_oview.h" #include <stdarg.h> class ExChoice: public ExViewNext { struct option { StlString str; int len; option() : len(0) {} option(const char *s) : str(s), len((int)CStrLen(s)) {} const char* GetCStr() { return str.c_str(); }; int GetCStrLen() { return len; } }; StlString Title; int lTitle; char Prompt[160]; int NOpt; StlVector<option> SOpt; int lChoice; int Cur; int MouseCaptured; int FindChoiceByPoint(int x, int y); public: ExChoice(const char *ATitle, int NSel, va_list ap /* choices, format, args */); virtual ~ExChoice(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); }; #endif // I_CHOICE_H ���������./src/o_buflist.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002267�11344266047�012617� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_buflist.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_BUFLIST_H #define O_BUFLIST_H #include "o_list.h" #include "i_search.h" class BufferView: public EList { public: char **BList; int BCount; int SearchLen; char SearchString[ExISearch::MAXISEARCH]; int SearchPos[ExISearch::MAXISEARCH]; BufferView(int createFlags, EModel **ARoot); virtual ~BufferView(); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual void UpdateList(); EModel *GetBufferById(int No); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void HandleEvent(TEvent &Event); int getMatchingLine (int start, int direction); virtual int Activate(int No); void CancelSearch(); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; #endif // O_BUFLIST_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_qt.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000152401�11602724002�012075� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_qt.cpp * * Copyright (c) 1994-1996, Marko Macek * Copyright (c) 2010, Zdenek Kabelac * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Only a demo code - not really fully functional */ #include "gui.h" #include "s_string.h" #include "sysdep.h" #include <qapp.h> #include <qclipbrd.h> #include <qframe.h> #include <qkeycode.h> #include <qmenubar.h> #include <qpainter.h> #include <qscrbar.h> #include <qtimer.h> #include <qwidget.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <fcntl.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #include <unistd.h> #define DEBUGX(x) //#define DEBUGX(x) printf x #define EDIT_BORDER 2 #define SCROLLBAR_SIZE 16 #define MAX_PIPES 4 typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; //XtInputId input; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #define sfFocus 1 class QEText: public QWidget { Q_OBJECT public: GViewPeer *view; QEText(GViewPeer *peer, QWidget *parent = 0, const char *name = 0); virtual ~QEText(); protected: void handleKeyPressEvent(QKeyEvent *qe); void ActiveEvent(TEvent &Event); void handleMouse(QMouseEvent *qe); virtual void resizeEvent(QResizeEvent *qe); virtual void paintEvent(QPaintEvent *qe); virtual void mousePressEvent(QMouseEvent *qe); virtual void mouseMoveEvent(QMouseEvent *qe); virtual void mouseReleaseEvent(QMouseEvent *qe); virtual void keyPressEvent(QKeyEvent *qe); virtual void focusInEvent(QFocusEvent *qe); virtual void focusOutEvent(QFocusEvent *qe); }; class QEView: public QFrame { Q_OBJECT public: GViewPeer *view; QEText *text; QScrollBar *horz; QScrollBar *vert; QEView(GViewPeer *peer, QWidget *parent = 0, const char *name = 0); virtual ~QEView(); void ActiveEvent(TEvent &Event); void setViewPos(int x, int y, int w, int h); //protected: // virtual void resizeEvent(QResizeEvent *qe); protected slots: void sbHmoveLeft(); void sbHmoveRight(); void sbHpageLeft(); void sbHpageRight(); void sbHmoveTo(int pos); void sbVmoveUp(); void sbVmoveDown(); void sbVpageUp(); void sbVpageDown(); void sbVmoveTo(int pos); }; class QEFrame : public QFrame { Q_OBJECT public: QMenuBar *menubar; QEFrame(GFramePeer *peer, QWidget *parent = 0, const char *name = 0); QMenuBar *CreateMenuBar(QWidget *parent, int Id); QPopupMenu *CreatePopup(QWidget *parent, int Id, int do_connect); protected: virtual void resizeEvent(QResizeEvent *qe); virtual void closeEvent(QCloseEvent *qe); public slots: void selectedMain(int id); void timerDone(); private: GFramePeer *frame; }; class GViewPeer { public: QEView *qView; GC GCs[256]; GView *View; // int wX, wY; int wW, wH, wState, wRefresh; int cX, cY, cVisible, cStart, cEnd; int sbVstart, sbVamount, sbVtotal; int sbHstart, sbHamount, sbHtotal; int VertPos, HorzPos; unsigned char *ScreenBuffer; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int AllocBuffer(); void DrawCursor(/*QPainter *painter, */int Show); void UpdateWindow(int xx, int yy, int ww, int hh); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int UpdateCursor(); int PMShowCursor(); int PMHideCursor(); int PMSetCursorPos(); }; class GFramePeer { public: GFrame *Frame; QEFrame *qFrame; GFramePeer(GFrame *aFrame, int Width, int Height); ~GFramePeer(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); void MapFrame(); void ShowFrame(); }; int ShowVScroll = 1; int ShowHScroll = 0; int ShowMenuBar = 1; int ShowToolBar = 0; GFrame *frames = 0; GUI *gui = 0; static GView *MouseCapture = 0; static GView *FocusCapture = 0; static int cxChar = 1; static int cyChar = 1; //static int fmAscent; static int FinalExit = 0; static TEvent EventBuf = { evNone }; struct qEvent { TEvent event; struct qEvent *next; }; TEvent NextEvent = { evNone }; static const QColor colors[16] = { Qt::black, Qt::darkBlue, Qt::darkGreen, Qt::darkCyan, Qt::darkRed, Qt::darkMagenta, Qt::darkYellow, Qt::gray, Qt::darkGray, Qt::blue, Qt::green, Qt::cyan, Qt::red, Qt::magenta, Qt::yellow, Qt::white }; static XFontStruct *fontStruct; static Display *display; static QPoint LastMousePos; //static int LastMouseX = -1, LastMouseY = -1; static qEvent *event_head = 0; static qEvent *event_tail = 0; static int qPutEvent(TEvent &Event) { qEvent *q = new qEvent; q->event = Event; q->next = 0; if (event_tail) { event_tail->next = q; event_tail = q; } else { event_head = event_tail = q; } FinalExit = 0; qApp->exit_loop(); return 0; } static int qHasEvent() { return event_head ? 1 : 0; } static void qGetEvent(TEvent &Event) { qEvent *q = event_head; Event = q->event; event_head = q->next; if (!event_head) event_tail = 0; delete q; } QEView::QEView(GViewPeer *peer, QWidget *parent, const char *name) : QFrame(parent, name), view(peer), text(new QEText(peer, this)), horz(new QScrollBar(QScrollBar::Horizontal, parent, 0)), vert(new QScrollBar(QScrollBar::Vertical, parent, 0)) { CHECK_PTR(text); CHECK_PTR(horz); CHECK_PTR(vert); horz->show(); vert->show(); setFrameStyle(Panel|Sunken); setLineWidth(EDIT_BORDER); connect(vert, SIGNAL(valueChanged(int)), SLOT(sbVmoveTo(int))); connect(vert, SIGNAL(sliderMoved(int)), SLOT(sbVmoveTo(int))); connect(vert, SIGNAL(prevLine()), SLOT(sbVmoveUp())); connect(vert, SIGNAL(nextLine()), SLOT(sbVmoveDown())); connect(vert, SIGNAL(prevPage()), SLOT(sbVpageUp())); connect(vert, SIGNAL(nextPage()), SLOT(sbVpageDown())); connect(horz, SIGNAL(valueChanged(int)), SLOT(sbHmoveTo(int))); connect(horz, SIGNAL(sliderMoved(int)), SLOT(sbHmoveTo(int))); connect(horz, SIGNAL(prevLine()), SLOT(sbHmoveLeft())); connect(horz, SIGNAL(nextLine()), SLOT(sbHmoveRight())); connect(horz, SIGNAL(prevPage()), SLOT(sbHpageLeft())); connect(horz, SIGNAL(nextPage()), SLOT(sbHpageRight())); } QEView::~QEView() { delete horz; delete vert; } void QEView::setViewPos(int x, int y, int w, int h) { setGeometry(x, y, w - SCROLLBAR_SIZE, h - SCROLLBAR_SIZE); text->setGeometry(contentsRect()); vert->setGeometry(x + w - SCROLLBAR_SIZE, y, SCROLLBAR_SIZE, h - SCROLLBAR_SIZE); horz->setGeometry(x, y + h - SCROLLBAR_SIZE, w - SCROLLBAR_SIZE, SCROLLBAR_SIZE); } void QEView::ActiveEvent(TEvent &Event) { if (!view->View->IsActive()) view->View->Parent->SelectView(view->View); qPutEvent(Event); } void QEView::sbHmoveLeft() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmHScrollLeft; NextEvent.Msg.Param1 = 1; ActiveEvent(NextEvent); } void QEView::sbHmoveRight() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmHScrollRight; NextEvent.Msg.Param1 = 1; ActiveEvent(NextEvent); } void QEView::sbHpageLeft() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmHScrollPgLt; ActiveEvent(NextEvent); } void QEView::sbHpageRight() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmHScrollPgRt; ActiveEvent(NextEvent); } void QEView::sbHmoveTo(int pos) { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmHScrollMove; NextEvent.Msg.Param1 = pos; ActiveEvent(NextEvent); } void QEView::sbVmoveUp() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmVScrollUp; NextEvent.Msg.Param1 = 1; ActiveEvent(NextEvent); } void QEView::sbVmoveDown() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmVScrollDown; NextEvent.Msg.Param1 = 1; ActiveEvent(NextEvent); } void QEView::sbVpageUp() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmVScrollPgUp; ActiveEvent(NextEvent); } void QEView::sbVpageDown() { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmVScrollPgDn; ActiveEvent(NextEvent); } void QEView::sbVmoveTo(int pos) { NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmVScrollMove; NextEvent.Msg.Param1 = pos; ActiveEvent(NextEvent); } QEText::QEText(GViewPeer *peer, QWidget *parent, const char *name): QWidget(parent, name) { view = peer; setFocusPolicy(QWidget::StrongFocus); setMinimumSize(100, 80); DEBUGX(("QEText %p\n", this)); } QEText::~QEText() { } void QEText::resizeEvent(QResizeEvent *qe) { int X, Y; DEBUGX(("A: %p\n", qe)); QWidget::resizeEvent(qe); DEBUGX(("B\n")); X = qe->size().width(); Y = qe->size().height(); //qe->size().height() - frameWidth() * 2; DEBUGX(("Resize %d, %d\n", X, Y)); X /= cxChar; Y /= cyChar; DEBUGX(("!! Resize %d, %d\n", X, Y)); if (X > 0 && Y > 0) { view->ConSetSize(X, Y); NextEvent.What = evCommand; NextEvent.Msg.View = view->View; NextEvent.Msg.Command = cmResize; qPutEvent(NextEvent); } } void QEText::paintEvent(QPaintEvent *qe) { DEBUGX(("Paint %p\n", qe)); view->UpdateWindow(qe->rect().x(), qe->rect().y(), qe->rect().width(), qe->rect().height()); } void QEText::handleMouse(QMouseEvent *qe) { int event = qe->button(); int state = qe->state(); int X = (qe->pos().x()/* - frameWidth()*/) / cxChar; int Y = (qe->pos().y()/* - frameWidth()*/) / cyChar; NextEvent.Mouse.View = view->View; LastMousePos = mapToGlobal(qe->pos()); switch (qe->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonDblClick: if (!view->View->IsActive()) view->View->Parent->SelectView(view->View); NextEvent.What = evMouseDown; break; case QEvent::MouseButtonRelease: NextEvent.What = evMouseUp; break; case QEvent::MouseMove: NextEvent.What = evMouseMove; break; default: return ; } NextEvent.Mouse.Buttons = 0; if (NextEvent.What == evMouseMove) { if (state & LeftButton) NextEvent.Mouse.Buttons |= 1; if (state & RightButton) NextEvent.Mouse.Buttons |= 2; if (state & MidButton) NextEvent.Mouse.Buttons |= 4; } else { if (event & LeftButton) NextEvent.Mouse.Buttons |= 1; if (event & RightButton) NextEvent.Mouse.Buttons |= 2; if (event & MidButton) NextEvent.Mouse.Buttons |= 4; } NextEvent.Mouse.KeyMask = 0; if (state & ShiftButton) NextEvent.Mouse.KeyMask |= kfShift; if (state & ControlButton) NextEvent.Mouse.KeyMask |= kfCtrl; if (state & AltButton) NextEvent.Mouse.KeyMask |= kfAlt; NextEvent.Mouse.Count = 1; if (qe->type() == QEvent::MouseButtonDblClick) NextEvent.Mouse.Count = 2; NextEvent.Mouse.X = X; NextEvent.Mouse.Y = Y; qPutEvent(NextEvent); } void QEText::mousePressEvent(QMouseEvent *qe) { handleMouse(qe); } void QEText::mouseMoveEvent(QMouseEvent *qe) { handleMouse(qe); } void QEText::mouseReleaseEvent(QMouseEvent *qe) { handleMouse(qe); } static const struct { unsigned int q_code; TKeyCode keyCode; } key_table[] = { { Qt::Key_Escape, kbEsc }, { Qt::Key_Tab, kbTab }, { Qt::Key_Backtab, kbTab | kfShift }, { Qt::Key_Backspace, kbBackSp }, { Qt::Key_Return, kbEnter }, { Qt::Key_Enter, kbEnter }, { Qt::Key_Insert, kbIns }, { Qt::Key_Delete, kbDel }, { Qt::Key_Pause, kbPause }, { Qt::Key_Print, kbPrtScr }, { Qt::Key_SysReq, kbSysReq }, { Qt::Key_Home, kbHome }, { Qt::Key_End, kbEnd }, { Qt::Key_Left, kbLeft }, { Qt::Key_Up, kbUp }, { Qt::Key_Right, kbRight }, { Qt::Key_Down, kbDown }, { Qt::Key_Prior, kbPgUp }, { Qt::Key_Next, kbPgDn }, { Qt::Key_Shift, kbShift | kfModifier }, { Qt::Key_Control, kbCtrl | kfModifier }, { Qt::Key_Meta, kbAlt | kfModifier }, { Qt::Key_Alt, kbAlt | kfModifier }, { Qt::Key_CapsLock, kbCapsLock | kfModifier }, { Qt::Key_NumLock, kbNumLock | kfModifier }, { Qt::Key_ScrollLock, kbScrollLock | kfModifier }, { Qt::Key_F1, kbF1 }, { Qt::Key_F2, kbF2 }, { Qt::Key_F3, kbF3 }, { Qt::Key_F4, kbF4 }, { Qt::Key_F5, kbF5 }, { Qt::Key_F6, kbF6 }, { Qt::Key_F7, kbF7 }, { Qt::Key_F8, kbF8 }, { Qt::Key_F9, kbF9 }, { Qt::Key_F10, kbF10 }, { Qt::Key_F11, kbF11 }, { Qt::Key_F12, kbF12 }, }; void QEText::ActiveEvent(TEvent &Event) { if (!view->View->IsActive()) view->View->Parent->SelectView(view->View); qPutEvent(Event); } void QEText::handleKeyPressEvent(QKeyEvent *qe) { TKeyCode keyCode; TKeyCode keyFlags; int state = qe->state(); int ascii = qe->ascii(); unsigned int key = qe->key(); DEBUGX(("key: %d, ascii: %d(%c) state:%X\n", qe->key(), qe->ascii(), qe->ascii(), qe->state())); keyFlags = 0; if (state & ShiftButton) keyFlags |= kfShift; if (state & ControlButton) keyFlags |= kfCtrl; if (state & AltButton) keyFlags |= kfAlt; keyCode = 0; for (size_t i = 0; i < FTE_ARRAY_SIZE(key_table); ++i) if (key == key_table[i].q_code) { keyCode = key_table[i].keyCode; break; } if (keyCode == 0 && ascii != 0) { if (keyFlags & (kfCtrl | kfAlt)) { keyCode = toupper(ascii); } else { keyCode = ascii; } } if (keyCode == 0) { QWidget::keyPressEvent(qe); return; } DEBUGX(("key: %d, flags:%d\n", (int)keyCode, (int)keyFlags)); NextEvent.What = evKeyDown; NextEvent.Key.View = view->View; NextEvent.Key.Code = keyCode | keyFlags; qPutEvent(NextEvent); } void QEText::keyPressEvent(QKeyEvent *qe) { handleKeyPressEvent(qe); } //void QEFrame::keyPressEvent(QKeyEvent *qe) { // frame->Frame->Active->Peer->qView->handleKeyPressEvent(qe); //} void QEText::focusInEvent(QFocusEvent *qe) { repaint(FALSE); } void QEText::focusOutEvent(QFocusEvent *qe) { repaint(FALSE); } QEFrame::QEFrame(GFramePeer *peer, QWidget *parent, const char *name): QFrame(parent, name) { frame = peer; menubar = 0; //setAcceptFocus(TRUE); } void QEFrame::resizeEvent(QResizeEvent *qe) { int y = 0; int x = 0; int h = qe->size().height(); int w = qe->size().width(); int count, cur; int cy, ch; GView *p; if (menubar) { h -= menubar->height(); y += menubar->height(); } p = frame->Frame->Top; count = 0; if (p) do { count++; p = p->Next; } while (p != frame->Frame->Top); DEBUGX(("count: %d size: %d %d\n", count, w, h)); p = frame->Frame->Top; cur = 0; if (p) do { ch = h / count; if (p->Next == frame->Frame->Top) ch = h - (h / count) * (count - 1); cy = y + h * cur / count; cur++; DEBUGX(("setting: %d %d %d %d\n", x, cy, w, ch)); p->Peer->qView->setViewPos(x, cy, w, ch); p = p->Next; } while (p != frame->Frame->Top); // frame->Frame->Top->Peer->qView->SetViewGeom(x, y, w, h); } void QEFrame::closeEvent(QCloseEvent *qe) { DEBUGX(("Close Selected: %p\n", qe)); NextEvent.What = evCommand; NextEvent.Msg.View = frame->Frame->Active; NextEvent.Msg.Command = cmClose; qPutEvent(NextEvent); } void QEFrame::selectedMain(int id) { DEBUGX(("Menu Selected: %d\n", id)); NextEvent.What = evCommand; NextEvent.Msg.View = frame->Frame->Active; NextEvent.Msg.Command = id; qPutEvent(NextEvent); } #include "g_qt.moc" #if 0 void ProcessXEvents(XEvent *event, TEvent *Event, GViewPeer *Peer) { XAnyEvent *anyEvent = (XAnyEvent *) event; XExposeEvent *exposeEvent = (XExposeEvent *) event; XButtonEvent *buttonEvent = (XButtonEvent *) event; XKeyEvent *keyEvent = (XKeyEvent *) event; XKeyEvent keyEvent1; XConfigureEvent *configureEvent = (XConfigureEvent *) event; XGraphicsExposeEvent *gexposeEvent = (XGraphicsExposeEvent *) event; XMotionEvent *motionEvent = (XMotionEvent *) event; KeySym key, key1; int state; char keyName[32]; char keyName1[32]; static int hasConfig = 0; Event->What = evNone; Event->Msg.View = Peer->View; switch (event->type) { case ButtonRelease: case ButtonPress: LastRelease = *buttonEvent; ConvertClickToEvent(event->type, buttonEvent->x, buttonEvent->y, buttonEvent->button, buttonEvent->state, Event, motionEvent->time); break; case KeyPress: case KeyRelease: state = keyEvent->state; keyEvent1 = *keyEvent; keyEvent1.state &= ~(ShiftMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask); XLookupString(keyEvent, keyName, sizeof(keyName), &key, 0); XLookupString(&keyEvent1, keyName1, sizeof(keyName1), &key1, 0); //key1 = XLookupKeysym(keyEvent, 0); ConvertKeyToEvent(key, key1, keyName, event->type, state, Event); break; case MotionNotify: ConvertClickToEvent(event->type, motionEvent->x, motionEvent->y, 0, motionEvent->state, Event, motionEvent->time); break; } } static void CloseWindow(Widget w, GFramePeer *frame, XEvent *event, Boolean *cont) { if (event->type != ClientMessage || ((XClientMessageEvent *)event)->data.l[0] != WM_DELETE_WINDOW) { return ; } NextEvent.What = evCommand; NextEvent.Msg.Command = cmClose; *cont = False; } #endif /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) : View(view), wW(XSize), wH(YSize), wState(0), wRefresh(0), cX(-1), cY(-1), cVisible(1), cStart(0), // % cEnd(100), sbVstart(0), sbVamount(0), sbVtotal(0), sbHstart(0), sbHamount(0), sbHtotal(0), VertPos(-1), HorzPos(-1), ScreenBuffer(0) { for (int jj = 0; jj < 256; jj++) GCs[jj] = 0; qView = new QEView(this, frames->Peer->qFrame); qView->show(); } GViewPeer::~GViewPeer() { //delete qView; // auto deleted } int GViewPeer::AllocBuffer() { int i; unsigned char *p; ScreenBuffer = (unsigned char *)malloc(2 * wW * wH); if (ScreenBuffer == NULL) return -1; for (i = 0, p = ScreenBuffer; i < wW * wH; i++) { *p++ = 32; *p++ = 0x07; } return 0; } #define InRange(x,a,y) (((x) <= (a)) && ((a) < (y))) #define CursorXYPos(x,y) (ScreenBuffer + ((x) + ((y) * wW)) * 2) void GViewPeer::DrawCursor(/*QPainter *painter, */int Show) { if (!(View && View->Parent)) return ; if (qView->text->winId() == 0) return ; if (!(wState & sfFocus)) Show = 0; if (cX >= wW || cY >= wW || cX + 1 > wW || cY + 1 > wH) { DEBUGX(("bounds %d %d\n", wW, wH)); return; } DEBUGX(("DrawCursor %d %d\n", cX, cY)); // if (!XtIsManaged(TextWin)) return ; if (cVisible && cX >= 0 && cY >= 0) { unsigned char* p = CursorXYPos(cX, cY); unsigned char attr; attr = p[1]; //if (Show) attr = ((((attr << 4) & 0xF0)) | (attr >> 4)) ^ 0x77; if (Show) attr = (attr ^ 0x77); if (GCs[attr] == 0) { XGCValues gcv; gcv.foreground = colors[attr & 0xF].pixel(); gcv.background = colors[(attr >> 4) & 0xF].pixel(); gcv.font = fontStruct->fid; GCs[attr] = XCreateGC(display, qView->text->winId(), GCForeground | GCBackground | GCFont, &gcv); } XDrawImageString(display, qView->text->winId(), GCs[attr & 0xFF], /*qView->frameWidth() +*/ cX * cxChar, /*qView->frameWidth() +*/ fontStruct->max_bounds.ascent + cY * cyChar, (char *)p, 1); /*inter->setPen(colors[attr & 0xF]); painter->setBackgroundColor(colors[(attr >> 4) & 0xF]); painter->drawText(qView->frameWidth() + cX * cxChar, qView->frameWidth() + cY * cyChar + fmAscent, p, 1);*/ } } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { int i; unsigned char temp[256], attr; unsigned char *p, *ps, *c, *ops; int len, x, l, ox, olen, skip; //int local_painter = 0; if (!(View && View->Parent)) return 1; if (qView->text->winId() == 0) return 1; //if (Visibility == VisibilityFullyObscured) // return - 1; if (X >= wW || Y >= wH || X + W > wW || Y + H > wH) { DEBUGX(("bounds %d %d\n",wW, wH)); return -1; } /*if (qView->Painter == 0) { DEBUGX(("{{{ New painter\n")); qView->Painter = new QPainter(); qView->Painter->begin(qView); local_painter = 1; } qView->Painter->setBackgroundMode(OpaqueMode); qView->Painter->setFont(Font);*/ DEBUGX(("PutBox %d | %d %d %d %d | %d %d\n", wRefresh, X, Y, W, H, wW, wH)); for (i = 0; i < H; i++) { len = W; p = CursorXYPos(X, Y + i); ps = (unsigned char *) Cell; x = X; while (len > 0) { if (!wRefresh) { c = CursorXYPos(x, Y + i); skip = 0; ops = ps; ox = x; olen = len; while ((len > 0) && (*(unsigned short *) c == *(unsigned short *)ps)) x++, len--, ps+=2, c+=2, skip++; if (len <= 0) break; if (skip <= 4) { ps = ops; x = ox; len = olen; } } p = ps; l = 1; temp[0] = *ps++; attr = *ps++; while ((l < len) && ((unsigned char) (ps[1]) == attr)) { temp[l++] = *ps++; ps++; } /*qView->Painter->setPen(colors[attr & 0xF]); qView->Painter->setBackgroundColor(colors[(attr >> 4) & 0xF]); qView->Painter->drawText(qView->frameWidth() + x * cxChar, qView->frameWidth() + (Y + i) * cyChar + fmAscent, (char *)temp, l);*/ if (GCs[attr] == 0) { XGCValues gcv; gcv.foreground = colors[attr & 0xF].pixel(); gcv.background = colors[(attr >> 4) & 0xF].pixel(); gcv.font = fontStruct->fid; GCs[attr] = XCreateGC(display, qView->text->winId(), GCForeground | GCBackground | GCFont, &gcv); } XDrawImageString(display, qView->text->winId(), GCs[attr & 0xFF], /*qView->frameWidth() +*/ x * cxChar, /*qView->frameWidth() +*/ fontStruct->max_bounds.ascent + (Y + i) * cyChar, (char *)temp, l); x += l; len -= l; } p = CursorXYPos(X, Y + i); memmove(p, Cell, W * sizeof(TCell)); if (i + Y == cY) DrawCursor(1); Cell += W; } /*if (local_painter) { DEBUGX(("}}} Destroying painter\n")); qView->Painter->end(); delete qView->Painter; qView->Painter = 0; }*/ DEBUGX(("done putbox\n")); return 0; } void GViewPeer::UpdateWindow(int xx, int yy, int ww, int hh) { PCell p; int i; ww /= cxChar; ww += 2; hh /= cyChar; hh += 2; xx /= cxChar; yy /= cyChar; if (xx + ww > wW) ww = wW - xx; if (yy + hh > wH) hh = wH - yy; wRefresh = 1; p = (PCell) CursorXYPos(xx, yy); for (i = 0; i < hh; i++) { ConPutBox(xx, yy + i, ww, 1, p); p += wW; } //XFlush(display); wRefresh = 0; } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { memcpy(Cell, CursorXYPos(X, Y + i), 2 * W); Cell += W; } return 0; } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { int i; for (i = 0; i < H; i++) { if (ConPutBox(X, Y + i, W, 1, Cell) != 0) return -1; } return 0; } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; int i; for (i = 0; i < W; i++) B[i] = Cell; ConPutLine(X, Y, W, H, B); return 0; } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell Cell; int l; int fw = 0; //qView->frameWidth(); if (qView->text->winId() == 0) return 1; if (GCs[Fill] == 0) { XGCValues gcv; gcv.foreground = colors[Fill & 0xF].pixel(); gcv.background = colors[(Fill >> 4) & 0xF].pixel(); gcv.font = fontStruct->fid; GCs[Fill] = XCreateGC(display, qView->text->winId(), GCForeground | GCBackground | GCFont, &gcv); } MoveCh(&Cell, ' ', Fill, 1); DrawCursor(0); if (Way == csUp) { XCopyArea(display, qView->text->winId(), qView->text->winId(), GCs[Fill], fw + X * cxChar, fw + (Y + Count) * cyChar, W * cxChar, (H - Count) * cyChar, fw + X * cxChar, fw + Y * cyChar ); for (l = 0; l < H - Count; l++) { memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l + Count), 2 * W); } if (ConSetBox(X, Y + H - Count, W, Count, Cell) == -1) return -1; } else if (Way == csDown) { XCopyArea(display, qView->text->winId(), qView->text->winId(), GCs[Fill], fw + X * cxChar, fw + Y * cyChar, W * cxChar, (H - Count) * cyChar, fw + X * cxChar, fw + (Y + Count)* cyChar ); for (l = H - 1; l >= Count; l--) { memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l - Count), 2 * W); } if (ConSetBox(X, Y, W, Count, Cell) == -1) return -1; } DrawCursor(1); return 0; /*TCell Cell; int l; MoveCh(&Cell, ' ', Fill, 1); QPainter painter; painter.begin(qView); painter.setBackgroundMode(OpaqueMode); painter.setFont(Font); DrawCursor(&painter, 0); if (Way == csUp) { bitBlt(qView, qView->frameWidth() + X * cxChar, qView->frameWidth() + Y * cyChar, qView, qView->frameWidth() + X * cxChar, qView->frameWidth() + (Y + Count) * cyChar, W * cxChar, (H - Count) * cyChar, CopyROP, TRUE); for (l = 0; l < H - Count; l++) { memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l + Count), 2 * W); } } else if (Way == csDown) { bitBlt(qView, qView->frameWidth() + X * cxChar, qView->frameWidth() + (Y + Count) * cyChar, qView, qView->frameWidth() + X * cxChar, qView->frameWidth() + Y * cyChar, W * cxChar, (H - Count) * cyChar, CopyROP, TRUE); for (l = H - 1; l >= Count; l--) { memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l - Count), 2 * W); } } DrawCursor(&painter, 1); painter.end(); if (Way == csUp) { ConSetBox(X, Y, W, Count, Cell); } else if (Way == csDown) { ConSetBox(X, Y + H - Count, W, Count, Cell); } return 0;*/ } int GViewPeer::ConSetSize(int X, int Y) { unsigned char *NewBuffer; unsigned char *p; int i; int MX, MY; p = NewBuffer = (unsigned char *) malloc(X * Y * 2); if (NewBuffer == NULL) return -1; for (i = 0; i < X * Y; i++) { *p++ = ' '; *p++ = 0x07; } if (ScreenBuffer) { MX = wW; if (X < MX) MX = X; MY = wH; if (Y < MY) MY = Y; if (X < MX) MX = X; p = NewBuffer; for (i = 0; i < MY; i++) { memcpy(p, CursorXYPos(0, i), MX * 2); p += X * 2; } free(ScreenBuffer); } ScreenBuffer = NewBuffer; wW = X; wH = Y; wRefresh = 1; View->Resize(wW, wH); ConPutBox(0, 0, wW, wH, (PCell) ScreenBuffer); wRefresh = 0; // if (Refresh == 0) // qView->setSize(0, // XResizeWindow(display, win, ScreenCols * cxChar, ScreenRows * cyChar); qView->show(); return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; if (Y >= wH) Y = wH - 1; /*QPainter painter; painter.begin(qView); painter.setBackgroundMode(OpaqueMode); painter.setFont(Font);*/ DrawCursor(0); cX = X; cY = Y; DrawCursor(1); //painter.end(); return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; // DrawCursor(1); return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; // DrawCursor(0); return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } int GViewPeer::ConSetCursorSize(int Start, int End) { cStart = Start; cEnd = End; if (wState & sfFocus) return 1; //PMSetCursorSize(Start, End); else return 1; } int GViewPeer::ExpandHeight(int DeltaY) { return 0; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; if (View->Parent == 0) return 0; if (Amount < 1 || Start + Amount > Total) { qView->vert->setRange(0, 0); qView->vert->setSteps(0, 0); qView->vert->setValue(0); } else { qView->vert->setRange(0, Total - Amount); qView->vert->setSteps(1, Amount); qView->vert->setValue(Start); } } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; if (View->Parent == 0) return 0; if (Amount < 1 || Start + Amount > Total) { qView->horz->setRange(0, 0); qView->horz->setSteps(0, 0); qView->horz->setValue(0); } else { qView->horz->setRange(0, Total - Amount); qView->horz->setSteps(1, Amount); qView->horz->setValue(Start); } } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetCursorSize(cStart, cEnd); if (cVisible) ConShowCursor(); else ConHideCursor(); return 1; } int GViewPeer::PMShowCursor() { return 1; } int GViewPeer::PMHideCursor() { return 1; } int GViewPeer::PMSetCursorPos() { return 1; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) : Parent(parent), Next(0), Prev(0), Peer(new GViewPeer(this, XSize, YSize)) { if (Parent) Parent->AddView(this); } GView::~GView() { if (Parent) Parent->RemoveView(this); delete Peer; } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { if (Peer->ConSetSize(X, Y)) ; // Resize(X, Y); else return 0; return 1; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } int GView::ConSetCursorSize(int Start, int End) { return Peer->ConSetCursorSize(Start, End); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &Event) { } void GView::Resize(int width, int height) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; return NewResult; } int GView::IsActive() { return (Parent->Active == this); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else { Peer->wState &= ~sfFocus; } Repaint(); } int GView::CaptureMouse(int grab) { if (MouseCapture == 0) { if (grab) MouseCapture = this; else return 0; } else { if (grab || MouseCapture != this) return 0; else MouseCapture = 0; } return 1; } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *aFrame, int Width, int Height) { Frame = aFrame; qFrame = new QEFrame(this, 0, 0); CHECK_PTR(qFrame); if (Width != -1 && Height != -1) ConSetSize(Width, Height); } GFramePeer::~GFramePeer() { delete qFrame; } int GFramePeer::ConSetSize(int X, int Y) { //return ::ConSetSize(X, Y); return 0; } int GFramePeer::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(&fW, &fH); // if (X) *X = fW; // if (Y) *Y = fH; return 1; } //int GFrame::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(X, Y); // if (ShowVScroll) // --*X; //} int GFramePeer::ConSetTitle(const char *Title, const char *STitle) { qFrame->setCaption(Title); qFrame->setIconText(STitle); return 1; } int GFramePeer::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, qFrame->caption(), MaxLen); strlcpy(STitle, qFrame->iconText(), SMaxLen); return 1; } void GFramePeer::MapFrame() { qApp->setMainWidget(qFrame); qFrame->menubar->show(); int menubarHeight = qFrame->menubar->height(); qFrame->setMinimumSize(30 * cxChar + SCROLLBAR_SIZE + EDIT_BORDER * 2, 8 * cyChar + SCROLLBAR_SIZE + EDIT_BORDER * 2 + menubarHeight); qFrame->setMaximumSize(160 * cxChar + SCROLLBAR_SIZE + EDIT_BORDER * 2, 100 * cyChar + SCROLLBAR_SIZE + EDIT_BORDER * 2 + menubarHeight); qFrame->resize(80 * cxChar + SCROLLBAR_SIZE + EDIT_BORDER * 2, 40 * cyChar + SCROLLBAR_SIZE + EDIT_BORDER * 2 + menubarHeight); qFrame->show(); // qFrame->setSizeIncrement(cxChar, cyChar); { XSizeHints hints; hints.flags = PBaseSize | PResizeInc; hints.width_inc = cxChar; hints.height_inc = cyChar; hints.base_width = SCROLLBAR_SIZE + EDIT_BORDER * 2; hints.base_height = SCROLLBAR_SIZE + EDIT_BORDER * 2 + menubarHeight; XSetWMNormalHints(display, qFrame->winId(), &hints); } } void GFramePeer::ShowFrame() { qFrame->show(); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) { Menu = 0; if (frames == 0) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Top = Active = 0; Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { if (Peer) { delete Peer; Peer = 0; } if (Next == this) { frames = 0; // DEBUGX(("No more frames\x7\x7\n")); } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; } Next = Prev = 0; } int GFrame::ConSetTitle(const char *Title, const char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; // newview->Peer->wX = 0; ConQuerySize(&newview->Peer->wW, &dmy); // newview->Peer->wY = view->Peer->wY + view->Peer->wH / 2; newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2; view->Peer->wH /= 2; InsertView(view, newview); view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); return 0; } int GFrame::ConCloseView(GView *view) { return 0; } int GFrame::ConResizeView(GView *view, int DeltaY) { return 0; } int GFrame::AddView(GView *view) { if (Top != 0) { return ConSplitView(Top, view); } else { // int W, H; view->Parent = this; view->Prev = view->Next = 0; // view->Peer->wX = 0; // view->Peer->wY = 0; // ConQuerySize(&W, &H); // view->ConSetSize(W, H); InsertView(Top, view); return 0; } } void GFrame::Update() { GView *v = Active; UpdateMenu(); while (v) { v->Update(); v = v->Next; if (v == Active) break; } } void GFrame::UpdateMenu() { } void GFrame::Repaint() { GView *v = Active; while (v) { v->Repaint(); v = v->Next; if (v == Active) break; } } void GFrame::InsertView(GView *Prev, GView *view) { if (!view) return ; if (Prev) { view->Prev = Prev; view->Next = Prev->Next; Prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return ; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; if (Top == view) { Top = view->Next; // Top->Peer->wY -= view->Peer->wH; // Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH); } else { // view->Prev->ConSetSize(view->Prev->Peer->wW, // view->Prev->Peer->wH + view->Peer->wH); } if (Active == view) { Active = view->Prev; Active->Activate(1); } } } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; else if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { c->Activate(0); Active->Activate(1); } //if (Active) // XtSetKeyboardFocus(Peer->PanedWin, Active->Peer->TextWin); } int GFrame::SelectView(GView *view) { if (Top == 0) return 0; if (FocusCapture != 0 || MouseCapture != 0) return 0; if (Active) Active->Activate(0); Active = view; if (Active) Active->Activate(1); //if (Active) // XtSetKeyboardFocus(Peer->PanedWin, Active->Peer->TextWin); return 1; } void GFrame::Resize(int width, int height) { if (!Top) return; if (width < 8 || height < 2) return; if (Top == Top->Next) { Top->ConSetSize(width, height); } else { } } void GFrame::Show() { Update(); Peer->MapFrame(); } void GFrame::Activate() { frames = this; Update(); Peer->ShowFrame(); } QPopupMenu *QEFrame::CreatePopup(QWidget *parent, int Id, int do_connect) { QPopupMenu *menu = new QPopupMenu(parent); CHECK_PTR(menu); //menu->setFont(QFont("Helvetica", 12, QFont::Bold)); for (unsigned i = 0; i < Menus[Id].Count; ++i) { if (Menus[Id].Items[i].Name) { //puts(Menus[Id].Items[i].Name); if (Menus[Id].Items[i].SubMenu != -1) { QPopupMenu *submenu = CreatePopup(0, Menus[Id].Items[i].SubMenu, 0); CHECK_PTR(submenu); menu->insertItem(Menus[Id].Items[i].Name, submenu); } else { menu->insertItem(Menus[Id].Items[i].Name, Menus[Id].Items[i].Cmd); } } else { menu->insertSeparator(); } } if (do_connect) connect(menu, SIGNAL(activated(int)), SLOT(selectedMain(int))); return menu; } QMenuBar *QEFrame::CreateMenuBar(QWidget *parent, int Id) { QMenuBar *menu = new QMenuBar(parent); CHECK_PTR(menu); //menu->setFont(QFont("Helvetica", 12, QFont::Bold)); for (unsigned i = 0; i < Menus[Id].Count; ++i) { if (Menus[Id].Items[i].Name) { //puts(Menus[Id].Items[i].Name); if (Menus[Id].Items[i].SubMenu != -1) { QPopupMenu *submenu = CreatePopup(0, Menus[Id].Items[i].SubMenu, 0); CHECK_PTR(submenu); menu->insertItem(Menus[Id].Items[i].Name, submenu); } else { menu->insertItem(Menus[Id].Items[i].Name, Menus[Id].Items[i].Cmd); } } else { menu->insertSeparator(); } } connect(menu, SIGNAL(activated(int)), SLOT(selectedMain(int))); return menu; } int GFrame::SetMenu(const char *Name) { int id = GetMenuId(Name); if (Menu) free(Menu); Menu = strdup(Name); if (Peer->qFrame->menubar) { delete Peer->qFrame->menubar; Peer->qFrame->menubar = 0; } DEBUGX(("setting main menu: %s, id=%d\n", Name, id)); Peer->qFrame->menubar = Peer->qFrame->CreateMenuBar(Peer->qFrame, id); //Peer->qFrame->menubar->setFrameStyle(QFrame::Raised | QFrame::Panel); //Peer->qFrame->menubar->setLineWidth(1); Peer->qFrame->menubar->show(); return 1; } int GFrame::ExecMainMenu(char Sub) { return 0; } int GFrame::PopupMenu(const char *Name) { int id = GetMenuId(Name); QPopupMenu *popup = Peer->qFrame->CreatePopup(0, id, 1); popup->popup(LastMousePos); return 1; } void QEFrame::timerDone() { FinalExit = 0; qApp->exit_loop(); } // GUI GUI::GUI(int &argc, char **argv, int XSize, int YSize) : fArgc(argc), fArgv(argv) { new QApplication(argc, argv); display = qt_xdisplay(); char *fs = getenv("VIOFONT"); fontStruct = NULL; if (fs == 0 && WindowFont[0] != 0) fs = WindowFont; if (fs) fontStruct = XLoadQueryFont(display, fs); if (fontStruct == NULL) fontStruct = XLoadQueryFont(display, "8x13"); if (fontStruct == NULL) fontStruct = XLoadQueryFont(display, "fixed"); if (fontStruct == NULL) return; cxChar = fontStruct->max_bounds.width; cyChar = fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent; gui = this; } GUI::~GUI() { gui = 0; } int GUI::ConGrabEvents(TEventMask EventMask) { return 0; } void GUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { if (Event.What != evNone) { if (view) view->HandleEvent(Event); } } int GUI::ConSuspend() { return 0; } int GUI::ConContinue() { return 0; } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { //return ::ConGetEvent(EventMask, Event, WaitTime, Delete, view); assert(1 == 0); return 0; } int GUI::ConPutEvent(const TEvent& Event) { EventBuf = Event; return 0; } int GUI::ConFlush() { return 0; } void GUI::ProcessEvent() { static int need_update = 1; /* should process until no more events, * but this is close enough */ if (need_update) QTimer::singleShot(10, frames->Peer->qFrame, SLOT(timerDone())); FinalExit = 1; NextEvent.What = evNone; qApp->enter_loop(); if (FinalExit && NextEvent.What == evNone) { DEBUGX(("Final exit\n")); //delete frames; //frames = 0; //return ; } if (need_update) { DEBUGX(("Updating\n")); frames->Update(); need_update = 0; } while (doLoop && qHasEvent()) { NextEvent.What = evNone; qGetEvent(NextEvent); DEBUGX(("Got event: %d\n", (int)NextEvent.What)); if (NextEvent.What == evMouseDown) { DEBUGX(("x:%d, y:%d, buttons:%d\n", NextEvent.Mouse.X, NextEvent.Mouse.Y, NextEvent.Mouse.Buttons)); } DispatchEvent(frames, NextEvent.Msg.View, NextEvent); NextEvent.What = evNone; need_update = 1; } } int GUI::Run() { if (Start(fArgc, fArgv) == 0) { doLoop = 1; frames->Show(); while (doLoop) ProcessEvent(); Stop(); return 0; } return 1; } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int mode, char *Command) { char Cmd[1024] = {0}; //strncpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return system(Cmd); } /*void PipeCallback(GPipe *pipe, int *source, int *input) { if (pipe && pipe->notify && *source == pipe->fd) { NextEvent.What = evNotify; NextEvent.Msg.View = frames->Active; NextEvent.Msg.Model = pipe->notify; NextEvent.Msg.Command = cmPipeRead; NextEvent.Msg.Param1 = pipe->id; pipe->stopped = 0; } DEBUGX(("Pipe %d\n", *source)); } */ int GUI::OpenPipe(const char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *)pfd) == -1) return -1; switch (Pipes[i].pid = fork()) { case -1: /* fail */ return -1; case 0: /* child */ close(pfd[0]); close(0); dup2(pfd[1], 1); dup2(pfd[1], 2); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } //Pipes[i].input = // XtAppAddInput(AppContext, Pipes[i].fd, XtInputReadMask, PipeCallback, &Pipes[i]); Pipes[i].used = 1; DEBUGX(("Pipe Open: %d\n", i)); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; DEBUGX(("Pipe View: %d %p\n", id, notify)); Pipes[id].notify = notify; if (notify != Pipes[id].notify) { if (notify) { //Pipes[id].input = // XtAppAddInput(AppContext, Pipes[id].fd, XtInputReadMask, PipeCallback, &Pipes[id]); } else { //if (Pipes[id].input != 0) { // XtRemoveInput(Pipes[id].input); // Pipes[id].input = 0; //} } } return 0; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { ssize_t rc; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; DEBUGX(("Pipe Read: Get %d %d\n", id, (int)len)); rc = read(Pipes[id].fd, buffer, len); DEBUGX(("Pipe Read: Got %d %d\n", id, (int)len)); if (rc == 0) { //if (Pipes[id].input != 0) { //XtRemoveInput(Pipes[id].input); // Pipes[id].input = 0; // } close(Pipes[id].fd); return -1; } if (rc == -1) Pipes[id].stopped = 1; return rc; } int GUI::ClosePipe(int id) { int status; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; waitpid(Pipes[id].pid, &status, 0); DEBUGX(("Pipe Close: %d\n", id)); Pipes[id].used = 0; return WEXITSTATUS(status); } int GUI::multiFrame() { return 1; } int GetXSelection(int *len, char **data, int clipboard) { QClipboard *cb = QApplication::clipboard(); const char *text; QClipboard::Mode mode; switch (clipboard) { case 0: mode = QClipboard::Clipboard; break; case 1: mode = QClipboard::Selection; break; default: // not supported return -1; } text = cb->text(mode); if (text == 0) return -1; *len = (int)strlen(text); *data = (char *)malloc(*len); if (*data == 0) return -1; memcpy(*data, text, *len); return 0; } int SetXSelection(int len, char *data, int clipboard) { QClipboard* cb = QApplication::clipboard(); char *text = (char *)malloc(len + 1); QClipboard::Mode mode; if (text == 0) return -1; switch (clipboard) { case 0: mode = QClipboard::Clipboard; break; case 1: mode = QClipboard::Selection; break; default: // not supported return -1; } memcpy(text, data, len); text[len] = 0; cb->setText(text, mode); free(text); return 0; } void DieError(int rc, const char *msg, ...) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); exit(rc); } char ConGetDrawChar(unsigned int index) { static const char tab[] = "\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12\x01\x01 \x02"; assert(index < sizeof(tab) - 1); return tab[index]; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_buffer.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000065335�11602724002�012731� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_buffer.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_buffer.h" #include "c_bind.h" #include "c_config.h" #include "c_history.h" #include "e_mark.h" #include "e_undo.h" #include "i_modelview.h" #include "i_view.h" #include "o_routine.h" #include "s_util.h" EBuffer *SSBuffer = 0; // scrap buffer (clipboard) /////////////////////////////////////////////////////////////////////////////// EBuffer::EBuffer(int createFlags, EModel **ARoot, const char * /*AName*/) : EModel(createFlags, ARoot), FileName(0), Modified(0), TP(0,0), CP(0,0), BB(-1,-1), BE(-1,-1), PrevPos(-1, -1), SavedPos(-1, -1), BlockMode(bmStream), ExtendGrab(0), AutoExtend(0), Loaded(0), Loading(0), RAllocated(0), RGap(0), RCount(0), LL(0), VAllocated(0), VGap(0), VCount(0), VV(0), #ifdef CONFIG_FOLDS FCount(0), FF(0), #endif Match(-1, -1), MatchLen(0), MatchCount(0), MinRedraw(-1), MaxRedraw(-1), RedrawToEos(0) { #ifdef CONFIG_UNDOREDO US.Num = 0; US.Data = 0; US.Top = 0; US.UndoPtr = 0; US.NextCmd = 1; US.Record = 1; US.Undo = 0; #endif #ifdef CONFIG_OBJ_ROUTINE rlst.Count = 0; rlst.Lines = 0; Routines = 0; #endif //Name = strdup(AName); Allocate(0); AllocVis(0); Mode = GetModeForName(""); Flags = (Mode->Flags); BFI(this, BFI_Undo) = 0; BFI(this, BFI_ReadOnly) = 0; #ifdef CONFIG_SYNTAX_HILIT StartHilit = 0; EndHilit = -1; HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); #endif InsertLine(CP,0,0); /* there should always be at least one line in the edit buffer */ Flags = (Mode->Flags); Modified = 0; } EBuffer::~EBuffer() { #ifdef CONFIG_HISTORY if (FileName != 0 && Loaded) { UpdateFPos(FileName, VToR(CP.Row), CP.Col); #ifdef CONFIG_BOOKMARKS if (BFI (this,BFI_SaveBookmarks)==3) StoreBookmarks(this); #endif } #endif if (FileName && Loaded) markIndex.storeForBuffer(this); Clear(); if (LL) free(LL); //free(Name); if (FileName) free(FileName); #ifdef CONFIG_BOOKMARKS vector_iterate(EBookmark*, BMarks, it) delete *it; #endif #ifdef CONFIG_OBJ_ROUTINE if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } DeleteRelated(); #endif } void EBuffer::DeleteRelated() { #ifdef CONFIG_OBJ_ROUTINE if (Routines) { ::ActiveView->DeleteModel(Routines); Routines = 0; } #endif } int EBuffer::Clear() { Modified = 1; #ifdef CONFIG_SYNTAX_HILIT EndHilit = -1; StartHilit = 0; WordList.clear(); #endif #ifdef CONFIG_OBJ_ROUTINE rlst.Count = 0; if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } #endif if (LL) { for (int i = 0; i < RCount; i++) delete LL[GapLine(i, RGap, RCount, RAllocated)]; free(LL); LL = 0; } RCount = RAllocated = RGap = 0; VCount = VAllocated = VGap = 0; if (VV) { free(VV); VV = 0; } #ifdef CONFIG_UNDOREDO FreeUndo(); #endif #ifdef CONFIG_FOLDS if (FCount != 0) { free(FF); FCount = 0; FF = 0; } #endif return 0; } #ifdef CONFIG_UNDOREDO int EBuffer::FreeUndo() { for (int j = 0; j < US.Num; j++) free(US.Data[j]); free(US.Top); free(US.Data); US.Num = 0; US.Data = 0; US.Top = 0; US.Undo = 0; US.Record = 1; US.UndoPtr = 0; return 1; } #endif int EBuffer::Modify() { // if RecheckReadOnly is activated do readonly checking when necessary if (RecheckReadOnly != 0) { if (BFI(this, BFI_ReadOnly)) { // File might have been toggled writable outside the editor, or // you might do what I do, and do a Tools/Run/"p4 edit Filename.cpp" // from inside FTE, and it's a pain to manually reopen the file, so // recheck writability here instead. Note that we don't check the // converse, since in reality this is rarely a problem, and the // file save routines will check this (oh well). --ryan. struct stat StatBuf; if ((FileName != 0) && FileOk && (stat(FileName, &StatBuf) == 0)) { if (!(StatBuf.st_mode & (S_IWRITE | S_IWGRP | S_IWOTH))) BFI(this, BFI_ReadOnly) = 1; else BFI(this, BFI_ReadOnly) = 0; } } } if (BFI(this, BFI_ReadOnly)) { Msg(S_ERROR, "File is read-only."); return 0; } if (Modified == 0) { struct stat StatBuf; if ((FileName != 0) && FileOk && (stat(FileName, &StatBuf) == 0)) { if (FileStatus.st_size != StatBuf.st_size || FileStatus.st_mtime != StatBuf.st_mtime) { View->MView->Win->Choice(GPC_ERROR, "Warning! Press Esc!", 0, "File %-.55s changed on disk!", FileName); switch (View->MView->Win->Choice(0, "File Changed on Disk", 2, "&Modify", "&Cancel", "%s", FileName)) { case 0: break; case 1: case -1: default: return 0; } } } #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) if (PushUChar(ucModified) == 0) return 0; #endif } Modified++; if (Modified == 0) Modified++; return 1; } int EBuffer::LoadRegion(EPoint * /*A*/, int /*FH*/, int /*StripChar*/, int /*LineChar*/) { return 0; } /* int EBuffer::AddLine(const char *AChars) { if (InsLine(Pos.Row, 0) == 0) return 0; if (InsText(Pos.Row, Pos.Col, ACount, AChars) == 0) return 0; return 1; } */ int EBuffer::InsertLine(const EPoint& Pos, size_t ACount, const char *AChars) { if (!InsLine(Pos.Row, 0)) return 0; return InsText(Pos.Row, Pos.Col, ACount, AChars); } int EBuffer::UpdateMark(EPoint &M, int Type, int Row, int Col, int Rows, int Cols) { switch (Type) { case umInsert: /* text inserted */ switch (BlockMode) { case bmLine: case bmColumn: if (M.Row >= Row) M.Row += Rows; break; case bmStream: if (Cols) { if (M.Row == Row) if (M.Col >= Col) M.Col += Cols; } if (Rows) { if (M.Row >= Row) M.Row += Rows; } break; } break; case umDelete: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row >= Row) { if (InRange(Row, M.Row, Row + Rows)) M.Row = Row; else M.Row -= Rows; } break; case bmStream: if (Cols) { if (M.Row == Row) if (M.Col >= Col) { if (M.Col < Col + Cols) M.Col = Col; else M.Col -= Cols; } } if (Rows) { if (M.Row >= Row) { if (M.Row < Row + Rows) { M.Row = Row; M.Col = 0; } else M.Row -= Rows; } } } break; case umSplitLine: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row == Row) { if (Col <= M.Col) { M.Row++; M.Col -= Col; } } else if (M.Row > Row) M.Row++; break; case bmStream: if (M.Row == Row) { if (Col <= M.Col) { M.Row++; M.Col -= Col; } } else if (M.Row > Row) M.Row++; break; } break; case umJoinLine: switch (BlockMode) { case bmLine: case bmColumn: if (M.Row == Row + 1) M.Row--; else if (M.Row > Row) M.Row--; break; case bmStream: if (M.Row == Row + 1) { M.Row--; M.Col += Col; } else if (M.Row > Row) M.Row--; break; } break; } return 1; } int EBuffer::UpdateMarker(int Type, int Row, int Col, int Rows, int Cols) { EPoint OldBB = BB, OldBE = BE; EView *V; UpdateMark(SavedPos, Type, Row, Col, Rows, Cols); UpdateMark(PrevPos, Type, Row, Col, Rows, Cols); UpdateMark(BB, Type, Row, Col, Rows, Cols); UpdateMark(BE, Type, Row, Col, Rows, Cols); V = View; while (V) { if (V->Model != this) assert(1 == 0); if (V != View) { EPoint M; M = GetViewVPort(V)->TP; UpdateMark(GetViewVPort(V)->TP, Type, Row, Col, Rows, Cols); GetViewVPort(V)->TP.Col = M.Col; UpdateMark(GetViewVPort(V)->CP, Type, Row, Col, Rows, Cols); } V = V->NextView; } #ifdef CONFIG_OBJ_ROUTINE for (int i = 0; i < rlst.Count && rlst.Lines; i++) { EPoint M; M.Col = 0; M.Row = rlst.Lines[i]; UpdateMark(M, Type, Row, Col, Rows, Cols); rlst.Lines[i] = M.Row; } #endif #ifdef CONFIG_FOLDS for (int f = 0; f < FCount; f++) { EPoint M; M.Col = 0; M.Row = FF[f].line; UpdateMark(M, Type, Row, Col, Rows, Cols); FF[f].line = M.Row; } #endif #ifdef CONFIG_BOOKMARKS vector_iterate(EBookmark*, BMarks, it) UpdateMark((*it)->GetPoint(), Type, Row, Col, Rows, Cols); #endif if (OldBB.Row != BB.Row) { int MinL = Min(OldBB.Row, BB.Row); int MaxL = Max(OldBB.Row, BB.Row); if (MinL != -1 && MaxL != -1) Draw(MinL, MaxL); } if (OldBE.Row != BE.Row) { int MinL = Min(OldBE.Row, BE.Row); int MaxL = Max(OldBE.Row, BE.Row); if (MinL != -1 && MaxL != -1) Draw(MinL, MaxL); } return 1; } int EBuffer::ValidPos(EPoint Pos) { if ((Pos.Col >= 0) && (Pos.Row >= 0) && (Pos.Row < VCount)) return 1; return 0; } int EBuffer::RValidPos(EPoint Pos) { if ((Pos.Col >= 0) && (Pos.Row >= 0) && (Pos.Row < RCount)) return 1; return 0; } int EBuffer::AssertLine(int Row) { if (Row == RCount) if (!InsLine(RCount, 0)) return 0; return 1; } int EBuffer::SetFileName(const char *AFileName, const char *AMode) { FileOk = 0; free(FileName); FileName = strdup(AFileName); Mode = 0; if (AMode) { if (!(Mode = FindMode(AMode))) { StlString AMODE(AMode); AMODE.toupper(); Mode = FindMode(AMODE.c_str()); } } if (Mode == 0) Mode = GetModeForName(AFileName); assert(Mode != 0); Flags = (Mode->Flags); #ifdef CONFIG_SYNTAX_HILIT HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); #endif UpdateTitle(); return FileName?1:0; } int EBuffer::SetPos(int Col, int Row, int tabMode) { if (!VCount) return 1; assert (Col >= 0 && Row >= 0 && Row < VCount); #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1 && BFI(this, BFI_UndoMoves) == 1) { if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; } #endif if (AutoExtend) { BlockExtendBegin(); AutoExtend = 1; } PrevPos = CP; PrevPos.Row = (CP.Row < VCount) ? VToR(CP.Row) : (CP.Row - VCount + RCount); CP.Row = Row; CP.Col = Col; if (AutoExtend) { BlockExtendEnd(); AutoExtend = 1; } // if (View && View->Model == this ) { // View->GetVPort(); // } if (BFI(this, BFI_CursorThroughTabs) == 0) { if (tabMode == tmLeft) { if (MoveTabStart() == 0) return 0; } else if (tabMode == tmRight) { if (MoveTabEnd() == 0) return 0; } } if (ExtendGrab == 0 && AutoExtend == 0 && BFI(this, BFI_PersistentBlocks) == 0) { if (CheckBlock() == 1) if (BlockUnmark() == 0) return 0; } return 1; } int EBuffer::SetPosR(int Col, int Row, int tabMode) { assert (Row >= 0 && Row < RCount && Col >= 0); int L = RToV(Row); if (L == -1) if (ExposeRow(Row) == 0) return 0; L = RToV(Row); return SetPos(Col, L, tabMode); } int EBuffer::SetNearPos(int Col, int Row, int tabMode) { if (Row >= VCount) Row = VCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return SetPos(Col, Row, tabMode); } int EBuffer::SetNearPosR(int Col, int Row, int tabMode) { if (Row >= RCount) Row = RCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return SetPosR(Col, Row, tabMode); } int EBuffer::CenterPos(int Col, int Row, int tabMode) { assert(Row >= 0 && Row < VCount && Col >= 0); if (SetPos(Col, Row, tabMode) == 0) return 0; if (View && View->Model == this) { Row -= GetVPort()->Rows / 2; if (Row < 0) Row = 0; Col -= GetVPort()->Cols - 8; if (Col < 0) Col = 0; if (GetVPort()->SetTop(Col, Row) == 0) return 0; GetVPort()->ReCenter = 1; } return 1; } int EBuffer::CenterPosR(int Col, int Row, int tabMode) { int L; assert(Row >= 0 && Row < RCount && Col >= 0); L = RToV(Row); if (L == -1) if (ExposeRow(Row) == 0) return 0; L = RToV(Row); return CenterPos(Col, L, tabMode); } int EBuffer::CenterNearPos(int Col, int Row, int tabMode) { if (Row >= VCount) Row = VCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return CenterPos(Col, Row, tabMode); } int EBuffer::CenterNearPosR(int Col, int Row, int tabMode) { if (Row >= RCount) Row = RCount - 1; if (Row < 0) Row = 0; if (Col < 0) Col = 0; return CenterPosR(Col, Row, tabMode); } int EBuffer::LineLen(int Row) { assert(Row >= 0 && Row < RCount); PELine L = RLine(Row); return ScreenPos(L, L->Count); } int EBuffer::LineChars(int Row) { assert(Row >= 0 && Row < RCount); return RLine(Row)->Count; } int EBuffer::DelLine(int Row, int DoMark) { int VLine; int GapSize; // printf("DelLine: %d\n", Row); if (Row < 0) return 0; if (Row >= RCount) return 0; if (Modify() == 0) return 0; VLine = RToV(Row); if (VLine == -1) if (ExposeRow(Row) == 0) return 0; VLine = RToV(Row); assert(VLine != -1); #ifdef CONFIG_FOLDS if (FindFold(Row) != -1) { if (FoldDestroy(Row) == 0) return 0; } #endif VLine = RToV(Row); assert(VLine != -1); #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushUData(RLine(Row)->Chars, RLine(Row)->Count) == 0) return 0; if (PushULong(RLine(Row)->Count) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelLine) == 0) return 0; } #endif if (DoMark) UpdateMarker(umDelete, Row, 0, 1, 0); //puts("Here"); Draw(Row, -1); Hilit(Row); assert(RAllocated >= RCount); if (RGap != Row) if (MoveRGap(Row) == 0) return 0; GapSize = RAllocated - RCount; delete LL[RGap + GapSize]; LL[RGap + GapSize] = 0; RCount--; GapSize++; if (RAllocated - RAllocated / 2 > RCount) { memmove(LL + RGap + GapSize - RAllocated / 3, LL + RGap + GapSize, sizeof(PELine) * (RCount - RGap)); if (Allocate(RAllocated - RAllocated / 3) == 0) return 0; } assert(VAllocated >= VCount); if (VGap != VLine) if (MoveVGap(VLine) == 0) return 0; GapSize = VAllocated - VCount; VV[VGap + GapSize] = 0; VCount--; GapSize++; if (VAllocated - VAllocated / 2 > VCount) { memmove(VV + VGap + GapSize - VAllocated / 3, VV + VGap + GapSize, sizeof(VV[0]) * (VCount - VGap)); if (AllocVis(VAllocated - VAllocated / 3) == 0) return 0; } return 1; } int EBuffer::InsLine(int Row, int DoAppend, int DoMark) { PELine L; int VLine = -1; // printf("InsLine: %d\n", Row); //if (! LL) // return 0; if (Row < 0) return 0; if (Row > RCount) return 0; if (Modify() == 0) return 0; if (DoAppend) { Row++; } if (Row < RCount) { VLine = RToV(Row); if (VLine == -1) if (ExposeRow(Row) == 0) return 0; VLine = RToV(Row); assert(VLine != -1); } else { VLine = VCount; } L = new ELine(0, (char *)0); if (L == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushULong(Row) == 0) return 0; if (PushUChar(ucInsLine) == 0) return 0; } #endif if (DoMark) UpdateMarker(umInsert, Row, 0, 1, 0); Draw(Row, -1); Hilit(Row); VLine = RToVN(Row); assert(RCount <= RAllocated); // printf("++ %d G:C:A :: %d - %d - %d\n", Row, RGap, RCount, RAllocated); if (RCount == RAllocated) { if (Allocate(RCount ? (RCount * 2) : 1) == 0) return 0; memmove(LL + RAllocated - (RCount - RGap), LL + RGap, sizeof(PELine) * (RCount - RGap)); } if (RGap != Row) if (MoveRGap(Row) == 0) return 0; LL[RGap] = L; RGap++; RCount++; // printf("-- %d G:C:A :: %d - %d - %d\n", Row, RGap, RCount, RAllocated); assert(VCount <= VAllocated); if (VCount == VAllocated) { if (AllocVis(VCount ? (VCount * 2) : 1) == 0) return 0; memmove(VV + VAllocated - (VCount - VGap), VV + VGap, sizeof(VV[0]) * (VCount - VGap)); } if (VGap != VLine) if (MoveVGap(VLine) == 0) return 0; VV[VGap] = Row - VGap; VGap++; VCount++; /* if (AllocVis(VCount + 1) == 0) return 0; memmove(VV + VLine + 1, VV + VLine, sizeof(VV[0]) * (VCount - VLine)); VCount++; Vis(VLine, Row - VLine);*/ return 1; } int EBuffer::DelChars(int Row, int Ofs, size_t ACount) { PELine L; // printf("DelChars: %d:%d %d\n", Row, Ofs, ACount); if (Row < 0) return 0; if (Row >= RCount) return 0; L = RLine(Row); if (Ofs < 0) return 0; if (Ofs >= L->Count) return 0; if (Ofs + ACount >= L->Count) ACount = L->Count - Ofs; if (ACount == 0) return 1; if (Modify() == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushUData(L->Chars + Ofs, ACount) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelChars) == 0) return 0; } #endif if (L->Count > Ofs + ACount) memmove(L->Chars + Ofs, L->Chars + Ofs + ACount, L->Count - Ofs - ACount); L->Count -= ACount; if (L->Allocate(L->Count) == 0) return 0; Draw(Row, Row); Hilit(Row); // printf("OK\n"); return 1; } int EBuffer::InsChars(int Row, int Ofs, size_t ACount, const char *Buffer) { PELine L; // printf("InsChars: %d:%d %d\n", Row, Ofs, ACount); assert(Row >= 0 && Row < RCount && Ofs >= 0); L = RLine(Row); if (Ofs < 0) return 0; if (Ofs > L->Count) return 0; if (ACount == 0) return 1; if (Modify() == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushULong(Row) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushUChar(ucInsChars) == 0) return 0; } #endif if (L->Allocate(L->Count + ACount) == 0) return 0; if (L->Count > Ofs) memmove(L->Chars + Ofs + ACount, L->Chars + Ofs, L->Count - Ofs); if (Buffer == 0) memset(L->Chars + Ofs, ' ', ACount); else memmove(L->Chars + Ofs, Buffer, ACount); L->Count += ACount; Draw(Row, Row); Hilit(Row); // printf("OK\n"); return 1; } int EBuffer::UnTabPoint(int Row, int Col) { ELine *L; int Ofs, Pos, TPos; assert(Row >= 0 && Row < RCount && Col >= 0); L = RLine(Row); Ofs = CharOffset(L, Col); if (Ofs >= L->Count) return 1; if (L->Chars[Ofs] != '\t') return 1; Pos = ScreenPos(L, Ofs); if (Pos < Col) { TPos = NextTab(Pos, BFI(this, BFI_TabSize)); if (DelChars(Row, Ofs, 1) != 1) return 0; if (InsChars(Row, Ofs, TPos - Pos, 0) != 1) return 0; } return 1; } int EBuffer::ChgChars(int Row, int Ofs, size_t ACount, const char * /*Buffer*/) { PELine L; assert(Row >= 0 && Row < RCount && Ofs >= 0); L = RLine(Row); if (Ofs < 0) return 0; if (Ofs > L->Count) return 0; if (ACount == 0) return 1; if (Modify() == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushUData(L->Chars + Ofs, ACount) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushUChar(ucDelChars) == 0) return 0; if (PushULong(Row) == 0) return 0; if (PushULong(Ofs) == 0) return 0; if (PushULong(ACount) == 0) return 0; if (PushUChar(ucInsChars) == 0) return 0; } #endif Hilit(Row); Draw(Row, Row); return 1; } int EBuffer::DelText(int Row, int Col, size_t ACount, int DoMark) { int L, B, C; // printf("DelTExt: %d:%d %d\n", Row, Col, ACount); assert(Row >= 0 && Row < RCount && Col >= 0); if (Modify() == 0) return 0; if (ACount == 0) return 1; L = LineLen(Row); if (Col >= L) return 1; if (ACount == -1 || ACount + Col > L) ACount = L - Col; if (UnTabPoint(Row, Col) == 0) return 0; if (UnTabPoint(Row, Col + ACount) == 0) return 0; B = CharOffset(RLine(Row), Col); C = CharOffset(RLine(Row), Col + ACount); if ((ACount > 0) && (B != -1) && (C != -1)) { if (DelChars(Row, B, C - B) == 0) return 0; if (DoMark) UpdateMarker(umDelete, Row, Col, 0, ACount); } // printf("OK\n"); return 1; } int EBuffer::InsText(int Row, int Col, size_t ACount, const char *ABuffer, int DoMark) { int B, L; // printf("InsText: %d:%d %d\n", Row, Col, ACount); assert(Row >= 0 && Row < RCount && Col >= 0); if (ACount == 0) return 1; if (Modify() == 0) return 0; if (DoMark) UpdateMarker(umInsert, Row, Col, 0, ACount); L = LineLen(Row); if (L < Col) { if (InsChars(Row, RLine(Row)->Count, Col - L, 0) == 0) return 0; } else if (UnTabPoint(Row, Col) == 0) return 0; B = CharOffset(RLine(Row), Col); if (InsChars(Row, B, ACount, ABuffer) == 0) return 0; // printf("OK\n"); return 1; } int EBuffer::PadLine(int Row, size_t Length) { size_t L; L = LineLen(Row); if (L < Length) if (InsChars(Row, RLine(Row)->Count, Length - L, 0) == 0) return 0; return 1; } int EBuffer::InsLineText(int Row, int Col, size_t ACount, int LCol, PELine Line) { int Ofs, Pos, TPos, C, B, L; //fprintf(stderr, "\n\nInsLineText: %d:%d %d %d", Row, Col, ACount, LCol); assert(Row >= 0 && Row < RCount && Col >= 0 && LCol >= 0); if (BFI(this, BFI_ReadOnly) == 1) return 0; L = ScreenPos(Line, Line->Count); if (LCol >= L) return 1; if (ACount == -1) ACount = L - LCol; if (ACount + LCol > L) ACount = L - LCol; if (ACount == 0) return 1; assert(ACount > 0); B = Ofs = CharOffset(Line, LCol); if (Ofs < Line->Count && Line->Chars[Ofs] == '\t') { Pos = ScreenPos(Line, Ofs); if (Pos < LCol) { TPos = NextTab(Pos, BFI(this, BFI_TabSize)); if (InsText(Row, Col, TPos - LCol, 0) == 0) return 0; Col += TPos - LCol; ACount -= TPos - LCol; LCol = TPos; B++; } } C = Ofs = CharOffset(Line, LCol + ACount); if (Ofs < Line->Count && Line->Chars[Ofs] == '\t') { Pos = ScreenPos(Line, Ofs); if (Pos < LCol + ACount) { if (InsText(Row, Col, LCol + ACount - Pos, 0) == 0) return 0; } } //fprintf(stderr, "B = %d, C = %d\n", B, C); C -= B; if (C <= 0) return 1; if (InsText(Row, Col, C, Line->Chars + B) == 0) return 0; // printf("OK\n"); return 1; } int EBuffer::SplitLine(int Row, int Col) { int VL; assert(Row >= 0 && Row < RCount && Col >= 0); if (BFI(this, BFI_ReadOnly) == 1) return 0; VL = RToV(Row); if (VL == -1) if (ExposeRow(Row) == 0) return 0; if (Row > 0) { VL = RToV(Row - 1); if (VL == -1) if (ExposeRow(Row - 1) == 0) return 0; } VL = RToV(Row); assert(VL != -1); if (Col == 0) { if (InsLine(Row, 0, 1) == 0) return 0; } else { UpdateMarker(umSplitLine, Row, Col, 0, 0); if (InsLine(Row, 1, 0) == 0) return 0; #ifdef CONFIG_SYNTAX_HILIT RLine(Row)->StateE = short((Row > 0) ? RLine(Row - 1)->StateE : 0); #endif if (Col < LineLen(Row)) { int P, L; //if (RLine(Row)->ExpandTabs(Col, -2, &Flags) == 0) return 0; if (UnTabPoint(Row, Col) != 1) return 0; P = CharOffset(RLine(Row), Col); L = LineLen(Row); if (InsText(Row + 1, 0, RLine(Row)->Count - P, RLine(Row)->Chars + P, 0) == 0) return 0; if (DelText(Row, Col, L - Col, 0) == 0) return 0; } } Draw(Row, -1); Hilit(Row); return 1; } int EBuffer::JoinLine(int Row, int Col) { int Len, VLine; if (BFI(this, BFI_ReadOnly) == 1) return 0; if (Row < 0 || Row >= RCount - 1) return 0; if (Col < 0) return 0; Len = LineLen(Row); if (Col < Len) Col = Len; VLine = RToV(Row); if (VLine == -1) { if (ExposeRow(Row) == 0) return 0; if (ExposeRow(Row + 1) == 0) return 0; } VLine = RToV(Row); if (Col == 0 && RLine(Row)->Count == 0) { if (DelLine(Row, 1) == 0) return 0; } else { if (InsText(Row, Col, RLine(Row + 1)->Count, RLine(Row + 1)->Chars, 0) == 0) return 0; if (DelLine(Row + 1, 0) == 0) return 0; UpdateMarker(umJoinLine, Row, Col, 0, 0); } Draw(Row, -1); Hilit(Row); return 1; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/portdos.c�������������������������������������������������������������������������������������0000644�0001750�0001750�00000056134�07045071641�012315� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * portdos.c: Portable calls for DOS * ================================== * (C)1996 by F.Jalvingh; Public domain. * (C)1997 by Markus F.X.J. Oberhumer; Public domain. * * $Header: /cvsroot/fte/fte/src/portdos.c,v 1.1.1.1 2000/01/30 17:23:45 captnmark Exp $ * * $Log: portdos.c,v $ * Revision 1.1.1.1 2000/01/30 17:23:45 captnmark * initial import * */ #include "port.h" #include <assert.h> #include <string.h> #if defined(DOS) || defined(DOSP32) #include <dos.h> #if defined(__DJGPP__) #include <pc.h> #include <dpmi.h> #include <go32.h> #include <sys/movedata.h> #define inp inportb #define outp outportb #endif struct plScnInfo { int s_inited; // T when current status is known. int s_wid, s_hig; // Current screen size enum ePlScnType s_type; // Current screen type, boolean s_ismono; // T when black- and white. boolean s_isbright; //** Cursor info, boolean s_curinit; boolean s_curon; // T when cursor is visible int s_cur_x, s_cur_y; // Current cursor position, int s_curstart, // Start of cursor blob, s_curend; // End of blob; UWORD s_iobase; #if defined(__DOS4G__) || defined(__DJGPP__) ULONG s_pbase; // Physical base address of video memory #else UWORD s_pseg; // Segment of video memory #endif }; /*--------------------------------------------------------------------------*/ /* STATIC GLOBALS.. */ /*--------------------------------------------------------------------------*/ static struct plScnInfo plScnI; static void plScnInit(void); /* * between() returns a # between bounds. */ static int between(int x, int low, int hig) { if(x < low) return low; else if(x > hig) return hig; return x; } /****************************************************************************/ /* */ /* CODING: Screen type determination for DOS.. */ /* */ /****************************************************************************/ /* * This is very important for the working of the DOS interface. It determines * the screen type, and derives some stuff from that: * - screen base address (i/o port) * - video memory address (for direct I/O to the screen). */ /* * VgaMonoMonitor() returns T if the monitor attached to a VGA adaptor is a * monochrome monitor. */ static boolean VgaMonoMonitor(void) { union dosxReg r; memset(&r, 0, sizeof(r)); // Clear all unused regs, r.w.ax = 0x1a00; // Function 1A subfunction 00 dosxIntr(0x10, &r); // Call VGA BIOS, if(r.h.al != 0x1a) return FALSE; // Assume color if call not supported, if(r.h.bl == 0x01 || r.h.bl == 0x05 || r.h.bl == 0x07 ||r.h.bl == 0x0B) return TRUE; // These types are MONO, else return FALSE; } /* * biosisVGA() returns TRUE if a VGA-card is found. */ static boolean biosisVGA(void) { boolean isvga; outp(0x3ce, 8); // Bit mask register, outp(0x3cf, 1); // Test mask, (1) outp(0x3ce, 8); // Bit mask register again, if(inp(0x3cf) == 1) // Can we read the same value? isvga = TRUE; // Yes -> is VGA! else isvga = FALSE; outp(0x3ce, 8); // Bit mask register last time, outp(0x3cf, 0xff); // All on (default value) return isvga; } /* * biosisEGA() returns TRUE if the card is an EGA card (or a VGA card). */ static boolean biosisEGA(void) { union dosxReg r; UBYTE ega; //** Get EGA BIOS byte. dosxMemRead(&ega, 0x00400087ul, 1); // Read EGA BIOS sysvar, if(! (ega & 0x08)) // There's an active EGA in the system! { //** EGA is active: do EGA bios call.. memset(&r, 0, sizeof(r)); r.h.ah = 0x12; // EGA BIOS Get info, r.h.bl = 0x10; // Get info r.h.bh = 0xff; // Inpossible return value, dosxIntr(0x10, &r); // Call EGA BIOS, if(r.h.bh != 0xff) // EGA found? return TRUE; // Yes! } return FALSE; } /* * biosisMono() returns TRUE if the BIOS is currently in MONO mode. This * is the mode selected with the MODE co80 or MODE MONO command. For EGA and * VGA cards this mode doesn't tell a thing about the MONITOR attached!!! */ static boolean biosisMono(void) { union dosxReg r; //** Call the BIOS get video mode memset(&r, 0, sizeof(r)); r.w.ax = 0x0f00; dosxIntr(0x10, &r); r.h.al &= 0x7f; // Mask out DONT-CLEAR bit, if(r.h.al == 7) return TRUE; // Monochrome screen if(r.h.al == 2 || r.h.al == 3) return FALSE;// Color screen, return TRUE; // All else: return MONO } /* * getPrimaryType() returns the primary card type. */ static enum ePlScnType getPrimaryType() { if(biosisEGA()) // Minimal EGA? return biosisVGA() ? plsctVGA : plsctEGA; return biosisMono() ? plsctMono : plsctCGA; } /* * getType() determines the screen type. */ static void getType(void) { enum ePlScnType sct; sct = getPrimaryType(); // Get primary screen type; switch(sct) { default: plScnI.s_ismono = biosisMono(); break; case plsctVGA: plScnI.s_ismono = VgaMonoMonitor(); break; } //** Determine hardware addresses.. #if defined(__DJGPP__) plScnI.s_pbase = ScreenPrimary; #elif defined(__DOS4G__) plScnI.s_pbase = plScnI.s_ismono ? 0xb0000 : 0xb8000; #elif defined(__MSDOS__) plScnI.s_pseg = plScnI.s_ismono ? 0xb000 : 0xb800; #endif plScnI.s_iobase = plScnI.s_ismono ? 0x3b4 : 0x3d4; plScnI.s_type = sct; } /****************************************************************************/ /* */ /* CODING: Screen - Other base helper calls.. */ /* */ /****************************************************************************/ /* * getSize() inquires the BIOS about the screen size. */ static void getSize(void) { union dosxReg r; //** Get the current width of the screen, memset(&r, 0, sizeof(r)); r.w.ax = 0x0f00; // Get current video mode, dosxIntr(0x10, &r); // Video BIOS plScnI.s_wid = between(r.h.ah, 80, 256); if(plScnI.s_type < plsctEGA) // For all lower as EGA use 25 height plScnI.s_hig = 25; else { r.w.ax = 0x1130; // Get FONT information, r.w.bx = 0; dosxIntr(0x10, &r); r.h.dl += 1; // For some reason it reports 1 too small, plScnI.s_hig = between(r.h.dl, 25, 128); } } /* * getCurInfo() gets the current cursor info: position and shape, visibility. */ static void getCurInfo(void) { union dosxReg r; //** Ask the BIOS for the current cursor shape, memset(&r, 0, sizeof(r)); r.w.ax = 0x0300; // Get cursor shape, r.w.bx = 0; // Page 0 dosxIntr(0x10, &r); plScnI.s_cur_x = r.h.dl; plScnI.s_cur_y = r.h.dh; plScnI.s_curstart = r.h.ch; plScnI.s_curend = r.h.cl; if(! plScnI.s_curinit) // Cursor state not initialized? { plScnI.s_curon = TRUE; // Default to cursor ON, plScnI.s_curinit= TRUE; } } /* * plScnInit() is called to get most of the info required to do screen I/O. * Depending on the "inited" flag it will get the current screen size, the * mode, cursor shape and visibility etc. */ static void plScnInit(void) { if(plScnI.s_inited) return; // Exit immediately if already inited, getType(); // ALWAYS get TYPE 1st! getSize(); // Get current mode (screen size) getCurInfo(); plScnI.s_inited = TRUE; // Don't init again. } /* * plScnSetFlash() is called to SET/CLEAR the flash/bright indicator. */ void plScnSetFlash(boolean on) { union dosxReg r; memset(&r, 0, sizeof(r)); r.w.ax = 0x1003; r.w.bx = on ? 1 : 0; // Set HILITE or FLASH mode. dosxIntr(0x10, &r); plScnI.s_isbright = !on; // Set ISBRIGHT mode flag. } #if defined(__DJGPP__) static void ScreenSetCursorShape(int shape) { __dpmi_regs reg; reg.h.ah = 0x01; reg.h.al = ScreenMode(); reg.x.cx = shape & 0x7f1f; __dpmi_int(0x10, &reg); } #else /* * cardOut().. */ static void cardOut(int port, int val) { outp(plScnI.s_iobase, port); outp(plScnI.s_iobase + 1, val); } #endif /* * plScnCursorOn() switches the cursor ON or OFF. */ void plScnCursorOn(boolean on) { UWORD v; plScnInit(); plScnI.s_curon = on; v = (UWORD) ( ((plScnI.s_curstart & 0xff) << 8) | (plScnI.s_curend & 0xff)); if(! on) v |= 0x2000; // Disable if required.. #if defined(__DJGPP__) ScreenSetCursorShape(v); #else dosxDisable(); cardOut(10, v >> 8); cardOut(11, v & 0xff); if(! on) { cardOut(14, 20); cardOut(15, 0); } dosxEnable(); #endif } /* * plScnCursorShape() sets the cursor shape. */ void plScnCursorShape(int start, int end) { plScnInit(); plScnI.s_curstart = start; plScnI.s_curend = end; plScnCursorOn(plScnI.s_curon); // Switch cursor on/off; sets shape. } /* * plScnCursorShapeGet() */ void plScnCursorShapeGet(int* sp, int* ep) { getCurInfo(); *sp = plScnI.s_curstart; *ep = plScnI.s_curend; } /* * plScnCursorPos() sets the cursor's position. */ void plScnCursorPos(int x, int y) { #if defined(__DJGPP__) ScreenSetCursor(y,x); #else UWORD soff; plScnInit(); soff= (UWORD) (y * plScnI.s_wid + x); dosxDisable(); cardOut(14, (soff >> 8)); cardOut(15, soff & 0xff); dosxEnable(); plScnI.s_cur_x = x; plScnI.s_cur_y = y; #endif } /* * plScnCursorPosGet() */ void plScnCursorPosGet(int* xp, int* yp) { // getCurInfo(); *xp = plScnI.s_cur_x; *yp = plScnI.s_cur_y; } /****************************************************************************/ /* */ /* DJGPP implementation. */ /* */ /****************************************************************************/ #if defined(__DJGPP__) // Protected Mode void plScnWrite(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); movedata(_my_ds(), (unsigned) buf, _dos_ds, plScnI.s_pbase+(((y * plScnI.s_wid) + x)*2), nch*2); } void plScnRead(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); movedata(_dos_ds, plScnI.s_pbase+((y * plScnI.s_wid) + x)*2, _my_ds(), (unsigned) buf, nch*2); } static void moveVm(unsigned to, unsigned from, unsigned len) { movedata(_dos_ds, plScnI.s_pbase + from*2, _dos_ds, plScnI.s_pbase + to*2, len*2); } /****************************************************************************/ /* */ /* CODING: Dos4GW implementation.. */ /* */ /****************************************************************************/ #elif defined(__DOS4G__) void plScnWrite(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); memcpy((UBYTE*) plScnI.s_pbase+(((y * plScnI.s_wid) + x)*2), buf, nch<<1); } void plScnRead(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); memcpy(buf, (UBYTE*)plScnI.s_pbase+(((y * plScnI.s_wid) + x)*2), nch<<1); } static void moveVm(unsigned to, unsigned from, unsigned len) { memcpy((UBYTE*) plScnI.s_pbase+to*2, (UBYTE*) plScnI.s_pbase+from*2, len*2); } /****************************************************************************/ /* */ /* REAL MODE implementation. */ /* */ /****************************************************************************/ #elif defined(__MSDOS__) // REAL Mode #include <dos.h> void plScnWrite(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); memcpy(MK_FP(plScnI.s_pseg, ((y * plScnI.s_wid) + x)*2), buf, nch<<1); } void plScnRead(unsigned x, unsigned y, unsigned short* buf, unsigned nch) { plScnInit(); memcpy(buf, MK_FP(plScnI.s_pseg, ((y * plScnI.s_wid) + x)*2), nch<<1); } static void moveVm(unsigned to, unsigned from, unsigned len) { memcpy(MK_FP(plScnI.s_pseg, to*2), MK_FP(plScnI.s_pseg, from*2), len << 1); } #endif /****************************************************************************/ /* */ /* CODING: Screen - Shared Base functions. */ /* */ /****************************************************************************/ /* * plScnWidth() returns the width of the screen. */ int plScnWidth(void) { plScnInit(); return plScnI.s_wid; } /* * plScnHeight() returns the current height of the screen. */ int plScnHeight(void) { plScnInit(); return plScnI.s_hig; } /* * plScnType() returns the current screen type. */ enum ePlScnType plScnType(void) { plScnInit(); return plScnI.s_type; } /* * plScnIsMono() returns T if the screen is a MONO screen. */ boolean plScnIsMono(void) { plScnInit(); return plScnI.s_ismono; } /****************************************************************************/ /* */ /* CODING: Screen - Set and Scroll functions. */ /* */ /****************************************************************************/ #define BUFSZ 150 /* * plScnSetCell() */ void plScnSetCell(unsigned x, unsigned y, unsigned wid, unsigned hig, UWORD cell) { UWORD buf[BUFSZ], *p, *pend; unsigned len, lleft, px; //** Fill buffer, len = wid; if(len > BUFSZ) len = BUFSZ; p = buf; pend= p + len; while(p < pend) *p++ = cell; // Set as much as needed, //** For all lines, while(hig-- > 0) { //** For the current line, lleft = wid; px = x; while(lleft > 0) { len = lleft; // Determine #bytes from buf to use, if(len > BUFSZ) len = BUFSZ; plScnWrite(px, y, buf, len); px += len; lleft -= len; } y++; } } /* * plScnScrollUp() scrolls the region specified UP. */ void plScnScrollUp(int x, int y, int ex, int ey, int nlines, UWORD fill) { int from, to; //** Calculate the from and to offsets; to = y*plScnI.s_wid + x; // TO is top-of-window, from= to + nlines*plScnI.s_wid; // FROM is #lines further down, while(y < ey-nlines) { moveVm(to, from, (ex-x)); to += plScnI.s_wid; from+= plScnI.s_wid; y++; } plScnSetCell(x, y, (ex-x), nlines, fill); // Clear bottom. } /* * plScnScrollDown() scrolls the region DOWN. */ void plScnScrollDown(int x, int y, int ex, int ey, int nlines, UWORD fill) { int from, to, len; //** Scrolling down: move from bottom to top; to = ey * plScnI.s_wid + x; from= to - plScnI.s_wid*nlines; while(ey > y) { ey--; // Back one line; from -= plScnI.s_wid; to -= plScnI.s_wid; moveVm(to, from, (ex-x)); } plScnSetCell(x, y, (ex-x), nlines, fill); } /****************************************************************************/ /* */ /* CODING: Keyboard interface for DOS and DOS extender(s).. */ /* */ /****************************************************************************/ /* * Memo to self: I've changed the "get character" request code from the 00h * and 01h to 10h and 11h (extended keyboard). I should inquire the BIOS about * the availability of these calls, but preliminary tests show that most * BIOSes lie about the keyboard type, or do not implement the required * int15 calls proper. * Should work for most modern machines! */ /* * kbHasChar() returns T if a character is present in the keyboard buffer. It * is checked by comparing the keyboard queue ptrs in the bios segment. */ static boolean kbHasChar(void) { UWORD p1, p2; union dosxReg r; #if 0 // Switched off for extended kbd support. dosxMemRead(&p1, 0x0040001aul, 2); // Get 1st keybd pointer, dosxMemRead(&p2, 0x0040001cul, 2); // And 2nd, if(p1 == p2) return FALSE; // Exit if not ok; #endif //** Now ask if a real code is available by non-destructive qry of bios. memset(&r, 0, sizeof(r)); // Clear unused registers, r.w.ax = 0x1100; // !! Was 0x0100 dosxIntr(0x16, &r); // Call keyboard shit. if(r.w.flags & 0x40) return FALSE; // Z flag SET -> no data return TRUE; } /* * kbDosRead() does a destructive read by calling BIOS call 16H code 0. */ static boolean kbDosRead(struct plKbdInfo* ki) { union dosxReg r; UBYTE v; memset(&r, 0, sizeof(r)); // Make sure all segregs are 0 r.w.ax = 0x1000; // Was 0x0, now extended dosxIntr(0x16, &r); if((r.x.flags & 0x40) == 0) // Z flag NOT set? { ki->ki_scan = r.h.ah; ki->ki_ascii= r.h.al; dosxMemRead(&v, 0x00400017ul, 1); ki->ki_flags= (v & 0x03) ? PLKF_SHIFT : 0; if(v & 0x08) ki->ki_flags |= PLKF_ALT; if(v & 0x04) ki->ki_flags |= PLKF_CTRL; if(v & 0x10) ki->ki_flags |= PLKF_SCROLLLOCK; if(v & 0x20) ki->ki_flags |= PLKF_NUMLOCK; if(v & 0x40) ki->ki_flags |= PLKF_CAPSLOCK; return TRUE; } return FALSE; } /* * kbDosIdle() */ static void kbDosIdle(void) { union dosxReg r; memset(&r, 0, sizeof(r)); dosxIntr(0x28, &r); } /* * plKbdReadF() does a non-waiting read of the keyboard. */ boolean plKbdReadF(struct plKbdInfo* ki) { if(kbHasChar()) { if(kbDosRead(ki)) return TRUE; } kbDosIdle(); return FALSE; } /****************************************************************************/ /* */ /* CODING: Mouse - Dos MOUSE interface (Mou calls). */ /* */ /****************************************************************************/ /*--------------------------------------------------------------------------*/ /* DEFINES: Mouse command codes. */ /*--------------------------------------------------------------------------*/ #define MC_RESET 0x0000 #define MC_CURSEN 0x0001 /* Enable cursor position */ #define MC_CURSDI 0x0002 /* Disable cursor */ #define MC_GETCUR 0x0003 /* Get cursor position */ #define MC_SETCUR 0x0004 /* Set cursor position */ #define MC_GETBPRESS 0x0005 /* Get button press state */ #define MC_GETBRELEASE 0x0006 /* Button release state */ #define MC_SETXRANGE 0x0007 /* Set X cursor range */ #define MC_SETYRANGE 0x0008 /* Set Y cursor range */ #define MC_GRCURSOR 0x0009 /* Set Graphic cursor style */ #define MC_TXCURSOR 0x000a /* Set text mode cursor style */ #define MC_GETMOTION 0x000b /* Get mouse motion # */ #define MC_SETEVENT 0x000c /* DefiNE event handler location */ #define MC_LPENABLE 0x000d /* Enable light pen emulation */ #define MC_LPDISABLE 0x000e /* Disable light pen emulation */ #define MC_SETSENS 0x000f /* Set sensitivity (mousemove/pixel) */ #define MC_CDRANGE 0x0010 /* Disable cursor in given range */ #define MC_DBLSPEEDTH 0x0013 /* DefiNE double-speed treshold */ static ULONG MouseCursorState; /* Mouse saved cursor state */ static boolean MousePresent; // T if mouse was located at init. static ULONG MousePressCount; // #times the mouse was clicked. /* * MOUSIsPresent() returns T if the mouse is present. It can be called only * when the MOUSInit call has been done. */ boolean MOUSIsPresent(void) { return MousePresent; } /* * MOUSPressCount() */ ULONG MOUSPressCount(void) { return MousePressCount; } /* * MOUSInit() initializes the mouse driver. It returns FALSE if no mouse's * present. When it's not called by the user program no mouse support * is given.. */ boolean MOUSInit(void) { // UBYTE *p; union dosxReg r; if(! MousePresent) /* If not already called */ { #if 0 // No vector for EXTENDERS /**** Get the contents of interrupt 33H ****/ p = (UBYTE *)getvect(0x33); if(p == NULL || *p == 0xcf) return FALSE; #endif /**** Mouse driver present: Call the mouse driver ****/ memset(&r, 0, sizeof(r)); r.w.ax = MC_RESET; dosxIntr(0x33, &r); if(r.w.ax != 0) /* Mouse attached? */ { MousePresent = TRUE; MOUSSetTextCursor(0, 0); /* Use default text cursor */ } MouseCursorState= 0; /* Cursor invisible */ } else assert(0); return MousePresent; /* Return mouse state */ } /* * MOUSExit() doesn't do a thing but is called to maintain compatibility. */ void MOUSExit(void) { MousePresent = FALSE; MouseCursorState= 0; } /* * MOUSCursen() enables/disables the mouse cursor. It takes notice of the * previous state and calls the routine ONLY if the state needs a change. */ void MOUSCursen(boolean enable) { union dosxReg r; if(MousePresent) { if( (enable && !(MouseCursorState & 1)) || (!enable && (MouseCursorState & 1))) { memset(&r, 0, sizeof(r)); r.w.ax = enable ? MC_CURSEN : MC_CURSDI; dosxIntr(0x33, &r); if(enable) MouseCursorState |= 1; else MouseCursorState &= ~1; } } } /* * MOUSSaveCurs() saves the current cursor state. */ void MOUSSaveCurs(void) { ULONG state; state = MouseCursorState & 1; MouseCursorState = (MouseCursorState << 1) | state; } /* * MOUSRestCurs() restores the last cursor state. */ void MOUSRestCurs(void) { ULONG nstate; nstate = MouseCursorState >> 1; // Get new state of cursor, MOUSCursen((boolean) (nstate & 1) ); // Make mouse's new state, MouseCursorState = nstate; // And set the new state. } /* * MOUSPos() returns the current mouse position and the button states. */ void MOUSPos(UWORD *x, UWORD *y, boolean *leftbutton, boolean *rightbutton) { union dosxReg r; if(MousePresent) { memset(&r, 0, sizeof(r)); r.w.ax = MC_GETCUR; dosxIntr(0x33, &r); if(leftbutton != NULL) *leftbutton = (r.w.bx & 1) != 0; if(rightbutton != NULL) *rightbutton = (r.w.bx & 2) != 0; if(x != NULL) *x = r.w.cx; if(y != NULL) *y = r.w.dx; } } /* * MOUSSetpos() sets a new mouse cursor position */ void MOUSSetpos(UWORD x, UWORD y) { union dosxReg r; if(MousePresent) { r.w.ax = MC_SETCUR; r.w.cx = x; r.w.dx = y; dosxIntr(0x33, &r); } } /* * MOUSSetTextCursor() sets the text cursor style. It always selects a * software cursor and, if both screenmask and cursormask are zero it * selects an inverse 'o' (0x09) as cursor character. */ void MOUSSetTextCursor(UWORD screenmask, UWORD cursormask) { union dosxReg r; if(MousePresent) { memset(&r, 0, sizeof(r)); r.w.ax = MC_TXCURSOR; /* Define text cursor command */ r.w.bx = 0; /* Software text cursor */ if(screenmask == 0 && cursormask == 0) { #if 0 r.w.cx = 0x0000; /* Screen mask value: all bits OFF */ r.w.dx = 0x1f09; /* Cursor mask: an 'o' */ #endif r.w.cx = 0x7700; /* Screen mask value */ r.w.dx = 0x77fe; /* Cursor: a blob */ } else { r.w.cx = screenmask; r.w.dx = cursormask; } dosxIntr(0x33, &r); } } /* * MOUSPressed() returns TRUE when the mouse key was pressed AND: * a. The mouse key has been released since the last call OR * b. The mouse position has changed. * It returns the new mouse coordinates in character positions. */ boolean MOUSPressed(UWORD *x, UWORD *y) { boolean leftbutton; static boolean waspressed; static UWORD lx, ly; if(MousePresent) { MOUSPos(x, y, &leftbutton, NULL); /* Get current mouse pos & state */ *x /= 8; /* Scale to characters */ *y /= 8; /* Idem */ if(leftbutton) /* Key pressed? */ { /**** Key was pressed! Have the coords changed since the last ****/ /**** time? ****/ if(*x == lx && *y == ly && waspressed) return FALSE; /* Nothing changed */ lx = *x; ly = *y; waspressed= TRUE; return TRUE; } else waspressed = FALSE; } return FALSE; } #endif // DOS || DOSP32 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_messages.cpp��������������������������������������������������������������������������������0000644�0001750�0001750�00000037372�11602724002�013301� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_messages.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_messages.h" #ifdef CONFIG_OBJ_MESSAGES #include "c_commands.h" #include "c_config.h" #include "i_view.h" #include "o_buflist.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include <stdio.h> #define MAXREGEXP 32 EMessages *CompilerMsgs = 0; struct Error { EBuffer *Buf; StlString file; StlString msg; StlString text; int line; int hilit; Error(const char *fn, int ln, const char *mesg, const char *txt, int hlt) : Buf(0), file(fn), msg(mesg), text(txt), line(ln), hilit(hlt) {} }; static int NCRegexp = 0; static struct { int RefFile; int RefLine; int RefMsg; RxNode *rx; } CRegexp[MAXREGEXP]; int AddCRegexp(int file, int line, int msg, const char *regexp) { //fprintf(stderr, "ADD EXP %d: %s %d %d %d\n", NCRegexp, regexp, file, line, msg); if (NCRegexp >= MAXREGEXP) return 0; CRegexp[NCRegexp].RefFile = file; CRegexp[NCRegexp].RefLine = line; CRegexp[NCRegexp].RefMsg = msg; if ((CRegexp[NCRegexp].rx = RxCompile(regexp)) == NULL) { return 0; } NCRegexp++; return 1; } void FreeCRegexp() { while (NCRegexp--) RxFree(CRegexp[NCRegexp].rx); } EMessages::EMessages(int createFlags, EModel **ARoot, const char *ADir, const char *ACommand) : EList(createFlags, ARoot, "Messages"), Running(1), BufLen(0), BufPos(0), ReturnCode(-1), MatchCount(0) { CompilerMsgs = this; RunPipe(ADir, ACommand); } EMessages::~EMessages() { gui->ClosePipe(PipeId); FreeErrors(); CompilerMsgs = 0; } void EMessages::NotifyDelete(EModel *Deleting) { vector_iterate(Error*, ErrList, it) { if ((*it)->Buf == Deleting) { /* NOT NEEDED! char bk[16]; sprintf(bk, "_MSG.%d", i); ((EBuffer *)Deleting)->RemoveBookmark(bk); */ (*it)->Buf = 0; } } } void EMessages::FindErrorFiles() { unsigned i = 0; vector_iterate(Error*, ErrList, it) { if ((*it)->Buf == 0 && (*it)->file.empty()) FindErrorFile(i); ++i; } } void EMessages::FindErrorFile(unsigned err) { assert(err < ErrList.size()); if (ErrList[err]->file.empty()) return; ErrList[err]->Buf = 0; EBuffer *B = FindFile(ErrList[err]->file.c_str()); if (B == 0) return; if (B->Loaded == 0) return; AddFileError(B, err); } void EMessages::AddFileError(EBuffer *B, unsigned err) { assert(err < ErrList.size()); char bk[16]; sprintf(bk, "_MSG.%d", err); EPoint P(ErrList[err]->line - 1, 0); if (P.Row >= B->RCount) P.Row = B->RCount - 1; if (P.Row < 0) P.Row = 0; if (B->PlaceBookmark(bk, P) == 1) ErrList[err]->Buf = B; } void EMessages::FindFileErrors(EBuffer *B) { unsigned i = 0; vector_iterate(Error*, ErrList, it) { if ((*it)->Buf == 0 && !(*it)->file.empty()) { if (filecmp(B->FileName, (*it)->file.c_str()) == 0) AddFileError(B, i); } ++i; } } int EMessages::RunPipe(const char *ADir, const char *ACommand) { if (!KeepMessages) FreeErrors(); Command = ACommand; Directory = ADir; MatchCount = 0; ReturnCode = -1; Running = 1; BufLen = BufPos = 0; Row = (int)ErrList.size() - 1; char s[2 * MAXPATH * 4]; sprintf(s, "[running '%s' in '%s']", ACommand, ADir); AddError(0, -1, 0, s); sprintf(s, "Messages [%s]: %s", ADir, ACommand); SetTitle(s); ChangeDir(ADir); PipeId = gui->OpenPipe(ACommand, this); return 0; } EEventMap *EMessages::GetEventMap() { return FindEventMap("MESSAGES"); } int EMessages::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddError(0, -1, 0, s); return 1; case ExActivateInOtherWindow: ShowError(View->Next, Row); return 1; case ExFind: fprintf(stderr, "FIND\n"); return 1; default: ; } return EList::ExecCommand(Command, State); } void EMessages::AddError(const char *file, int line, const char *msg, const char *text, int hilit) { ErrList.push_back(new Error(file, line, msg, text, hilit)); //fprintf(stderr, "Error %s %d %s %s\n", file, line, msg, text); FindErrorFile((unsigned)ErrList.size() - 1); if ((int)ErrList.size() > Count) if (Row >= Count - 1) Row = (int)ErrList.size() - 1; UpdateList(); } void EMessages::FreeErrors() { unsigned i = 0; vector_iterate(Error*, ErrList, it) { if ((*it)->Buf != 0) { char bk[16]; sprintf(bk, "_MSG.%d", i); (*it)->Buf->RemoveBookmark(bk); } delete *it; i++; } ErrList.clear(); BufLen = BufPos = 0; } int EMessages::GetLine(char *Line, size_t maxim) { ssize_t rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } if (rc > 0) BufLen += rc; } l = maxim - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; UnEscStr(Line, maxim, MsgBuf + BufPos, p - (MsgBuf + BufPos)); //strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; UnEscStr(Line, maxim, MsgBuf + BufPos, l); //memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } static void getWord(char* dest, const char* pin) { char *pout, *pend; char ch, ec; while (*pin == ' ' || *pin == '\t') pin++; pout = dest; pend = dest + 256 - 1; if (*pin == '\'' || *pin == '"' || *pin == '`') { ec = *pin++; if (ec == '`') ec = '\''; for (;;) { ch = *pin++; if (ch == '`') ch = '\''; if (ch == ec || ch == 0) break; if (pout < pend) *pout++ = ch; } if (ch == 0) pin--; } else { for(;;) { ch = *pin++; if (ch == ' ' || ch == '\t' || ch == 0) break; if (pout < pend) *pout++ = ch; } } *pout = 0; } void EMessages::GetErrors() { char line[4096]; RxMatchRes RM; //int retc; int i, n; int didmatch = 0; int WasRunning = Running; char fn[256]; //fprintf(stderr, "Reading pipe\n"); while (GetLine(line, sizeof(line))) { size_t len = strlen(line); if (len > 0 && line[len - 1] == '\n') line[--len] = 0; didmatch = 0; for (i = 0; i < NCRegexp; i++) { if (RxExec(CRegexp[i].rx, line, len, line, &RM) == 1) { char ln[256]; char msg[256]; char fn1[256]; char fn2[256]; char *file; n = CRegexp[i].RefFile; unsigned s = RM.Close[n] - RM.Open[n]; if (s < sizeof(fn)) memcpy(fn, line + RM.Open[n], s); else s = 0; fn[s] = 0; n = CRegexp[i].RefLine; s = RM.Close[n] - RM.Open[n]; if (s < sizeof(ln)) memcpy(ln, line + RM.Open[n], s); else s = 0; ln[s] = 0; n = CRegexp[i].RefMsg; s = RM.Close[n] - RM.Open[n]; if (s < sizeof(msg)) memcpy(msg, line + RM.Open[n], s); else s = 0; msg[s] = 0; //fprintf(stderr, "File:%s msg:%s rex:%d c:%d o:%d>%s<8\nTXT:%s\n", fn, ln, i, RM.Close[n], RM.Open[n], msg, line); if (IsFullPath(fn)) file = fn; else { /* * for now - try only with top most dir * later we might try to find the file in all stacked dirs * as with parallel makes it's hard to guess the right directory path */ strlcpy(fn1, DirLevel.size() ? DirLevel.back().c_str() : Directory.c_str(), sizeof(fn1)); Slash(fn1, 1); strlcat(fn1, fn, sizeof(fn1)); if (ExpandPath(fn1, fn2, sizeof(fn2)) == 0) file = fn2; else file = fn1; } AddError(file, atoi(ln), msg, line, 1); didmatch = 1; MatchCount++; break; } } if (!didmatch) { AddError(0, -1, 0, line); //** Quicky: check for gnumake 'entering directory' //** make[x]: entering directory `xxx' //** make[x]: leaving... static const char t1[] = "entering directory"; static const char t2[] = "leaving directory"; const char *pin; if ( (pin = strstr(line, "]:")) != 0) { //** It *is* some make line.. Check for 'entering'.. pin += 2; while (*pin == ' ') pin++; if (strnicmp(pin, t1, sizeof(t1)-1) == 0) { // Entering? //** Get the directory name from the line, pin += sizeof(t1)-1; getWord(fn, pin); //dbg("entering %s", fn); if (*fn) //** Indeed entering directory! Link in list, DirLevel.push_back(fn); } else if (strnicmp(pin, t2, sizeof(t2)-1) == 0) { // Leaving? pin += sizeof(t2)-1; getWord(fn, pin); // Get dirname, //dbg("leaving %s", fn); int found = 0; for (unsigned i = DirLevel.size(); i-- > 0;) { /* * remove leaved director from our list of Dirs * as many users runs make in parallel mode * we might get pretty mangled order of dirs * so remove the last added with the same name */ if (stricmp(DirLevel[i].c_str(), fn) == 0) { DirLevel.erase(DirLevel.begin() + i); found++; break; } } if (!found) { //** Mismatch filenames -> error, and revoke stack. //dbg("mismatch on %s", fn); AddError(0, -1, 0, "fte: mismatch in directory stack!?"); //** In this case we totally die the stack.. DirLevel.clear(); } } } } } //fprintf(stderr, "Reading Stopped\n"); if (!Running && WasRunning) { char s[30]; sprintf(s, "[done, status=%d]", ReturnCode); AddError(0, -1, 0, s); } //UpdateList(); //NeedsUpdate = 1; } int EMessages::CompilePrevError(EView *V) { if (!ErrList.size()) { V->Msg(S_INFO, "No errors."); return 0; } while (Row > 0) { Row--; if (ErrList[Row]->line != -1 && !ErrList[Row]->file.empty()) { ShowError(V, Row); return 1; } } V->Msg(S_INFO, "No previous error."); return 0; } int EMessages::CompileNextError(EView *V) { if (!ErrList.size()) { V->Msg(S_INFO, (Running) ? "No errors (yet)." : "No errors."); return 0; } while ((Row + 1) < (int)ErrList.size()) { Row++; if (ErrList[Row]->line != -1 && !ErrList[Row]->file.empty()) { ShowError(V, Row); return 1; } } V->Msg(S_INFO, (Running) ? "No more errors (yet)." : "No more errors."); return 0; } int EMessages::Compile(char * /*Command*/) { return 0; } void EMessages::ShowError(EView *V, unsigned err) { if (err < ErrList.size()) { if (!ErrList[err]->file.empty()) { // should check if relative path // possibly scan for (gnumake) directory info in output if (ErrList[err]->Buf) { char bk[16]; V->SwitchToModel(ErrList[err]->Buf); sprintf(bk, "_MSG.%d", err); ErrList[err]->Buf->GotoBookmark(bk); } else { if (FileLoad(0, ErrList[err]->file.c_str(), 0, V) == 1) { V->SwitchToModel(ActiveModel); ((EBuffer *)ActiveModel)->CenterNearPosR(0, ErrList[err]->line - 1); } } if (!ErrList[err]->msg.empty()) V->Msg(S_INFO, "%s", ErrList[err]->msg.c_str()); else V->Msg(S_INFO, "%s", ErrList[err]->text.c_str()); } } } void EMessages::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < (int)ErrList.size()) if (Col < int(ErrList[Line]->text.size())) { char str[1024]; size_t len; len = UnTabStr(str, sizeof(str), ErrList[Line]->text.c_str(), ErrList[Line]->text.size()); if ((int)len > Col) MoveStr(B, 0, Width, str + Col, color, Width); } } char* EMessages::FormatLine(int Line) { if (Line < (int)ErrList.size()) return strdup(ErrList[Line]->text.c_str()); return 0; } int EMessages::IsHilited(int Line) { return (Line >= 0 && Line < (int)ErrList.size()) ? ErrList[Line]->hilit : 0; } void EMessages::UpdateList() { Count = (int)ErrList.size(); EList::UpdateList(); } int EMessages::Activate(int /*No*/) { //assert(No == Row); //Row = No; ShowError(View, Row); return 1; } int EMessages::CanActivate(int Line) { //return (Line < (int)ErrList.size()); return (Line < (int)ErrList.size() && (!ErrList[Line]->file.empty() || ErrList[Line]->line != -1)) ? 1 : 0; } void EMessages::NotifyPipe(int APipeId) { //fprintf(stderr, "Got notified"); if (APipeId == PipeId) GetErrors(); } void EMessages::GetName(char *AName, size_t MaxLen) { strlcpy(AName, "Messages", MaxLen); } void EMessages::GetInfo(char *AInfo, size_t /*MaxLen*/) { sprintf(AInfo, "%2d %04d/%03d Messages: %d (%s)", ModelNo,Row, Count, MatchCount, Command.c_str()); } void EMessages::GetPath(char *APath, size_t MaxLen) { strlcpy(APath, Directory.c_str(), MaxLen); Slash(APath, 0); } void EMessages::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { snprintf(ATitle, MaxLen, "Messages: %s", Command.c_str()); strlcpy(ASTitle, "Messages", SMaxLen); } // get row length for specified row, used in MoveLineEnd to get actual row length size_t EMessages::GetRowLength(int ARow) { if ((ARow >= 0) && (ARow < (int)ErrList.size())) return ErrList[ARow]->text.size(); return 0; } #endif // CONFIG_OBJ_MESSAGES ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_tex.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000005341�11344266047�012267� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_tex.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_TEX #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsTEX_Normal 0 #define hsTEX_Tag 1 #define hsTEX_Comment 2 #define hsTEX_Special 3 int Hilit_TEX(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int j; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { case hsTEX_Normal: Color = CLR_Normal; if (*p == '%') { State = hsTEX_Comment; Color = CLR_Comment; goto hilit; } else if (*p == '\\') { State = hsTEX_Tag; Color = CLR_Tag; ColorNext(); continue; } else if (*p == '{' || *p == '}' || *p == '$' || *p == '&' || *p == '|') { State = hsTEX_Special; Color = CLR_Special; ColorNext(); State = hsTEX_Normal; continue; } goto hilit; case hsTEX_Tag: Color = CLR_Tag; if (isalpha(*p)) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j])/* || (Line->Chars[i + j] == '_')*/) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j, 0)) { } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = CLR_Normal; State = hsTEX_Normal; continue; } ColorNext(); Color = CLR_Normal; State = hsTEX_Normal; continue; case hsTEX_Comment: goto hilit; default: State = hsTEX_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if (State == hsTEX_Comment) State = hsTEX_Normal; *ECol = C; return 0; } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/�����������������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�11621703711�011402� 5����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/save.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013052� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��„��„��„��„��„��„��„��„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÿÿÿ„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÿÿÿ„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÿÿÿ„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿ��„��ÿÿÿ„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/tagnext.bmp������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013566� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/paste.bmp��������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013230� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿÿ��ÿ��ÿ��ÿ��ÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿÿÿÿ����ÿÿÿ��ÿ��ÿ��ÿ��ÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿ������������������ÿÿÿ����ÿÿÿ��ÿ��ÿ��ÿ��ÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿÿÿÿ����ÿÿÿ��ÿ��ÿ��ÿ��ÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/errprev.bmp������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013601� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������ÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/tagpop.bmp�������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013406� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÿ��ÿ��ÿ��ÿ��ÿ��ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/undo.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013061� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��„��„��„��„��„��„��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��„��„��„��„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/prev.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013070� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/next.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013072� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/redo.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013045� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��„��„��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��„��„��„��„��„��„��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��„��„��„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��ÿ��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄��„��„��„��„��„��„��„��ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/open.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013055� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ������������������������������������������ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎ������������„‚„ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ������������������������ÎÏÎÎÏÎÎÏ΄‚„���„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/last.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013057� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎ���������ÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎ���������ÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/errnext.bmp������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013603� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������ÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/copy.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013066� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ�������������������������������ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿ�������������������������ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/cut.bmp����������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�012707� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������„‚„„‚„„‚„„‚„������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„������„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„ÎÏ΄‚„„‚„ÎÏ΄‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„ÎÏÎÎÏÎ������ÎÏÎÎÏ΄‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„ÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏ΄‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏ΄‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏ΄‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/exit.bmp���������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013065� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ�ÿÿÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ������������������������������������������ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���„‚„ÎÏÎ������������„‚„ÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ������������������������ÎÏÎÎÏÎÎÏ΄‚„���„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏ΄‚„���„‚„„‚„ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/tagprev.bmp������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013564� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/close.bmp��������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013221� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/pastecol.bmp�����������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013726� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���������������������������ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿ������������������ÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿ����ÿÿÿ���ÿÿÿ���ÿÿÿ���ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ����ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ�ÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���„‚„„‚„„‚„„‚„���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bmps/tagfind.bmp������������������������������������������������������������������������������0000644�0001750�0001750�00000003416�07172436240�013530� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BMN�������N���@�����������������������������������������������������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎ������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ��ÿÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ��ÿÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎ��ÿ��ÿ��ÿ��ÿ��ÿÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ��ÿÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎ��ÿÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ���������������ÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎÎÏÎ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-mngw.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000002454�07303566613�012676� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # FTE makefile for use with the MinGW toolchain # # Please note that the common GNU Make 3.77 port for MinGW is broken # and does not process this makefile correctly . Get a working Make 3.79.1 # from http://www.nextgeneration.dk/gnu/ # # The author, Jon Svendsen, explicitly places this module # in the Public Domain # INCDIR = LIBDIR = OPTIMIZE = -O -s MT = -Zmt CC = g++ LD = g++ # uncomment this if you don't have fileutils installed # RM = del OEXT=o DEFS=-DNT -DNTCONSOLE -DMINGW CCFLAGS = $(OPTIMIZE) -x c++ -Wall $(DEFS) $(INCDIR) -pipe LDFLAGS = $(OPTIMIZE) $(LIBDIR) -Wl,-static .SUFFIXES: .cpp .$(OEXT) include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) -c $< all: cfte.exe fte.exe cfte.exe: $(CFTE_OBJS) $(LD) $(LDFLAGS) $(CFTE_OBJS) -o cfte.exe $(LIBS) defcfg.cnf: defcfg.fte cfte.exe -"./cfte.exe" defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe -"./bin2c.exe" defcfg.cnf >defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) bin2c.cpp -o bin2c.exe c_config.$(OEXT): defcfg.h fte.exe: $(OBJS) $(NTOBJS) -$(LD) $(LDFLAGS) $(OBJS) $(NTOBJS) -o fte.exe $(LIBS) clean: -$(RM) fte.exe cfte.exe bin2c.exe defcfg.cnf defcfg.h $(OBJS) $(NTOBJS) $(CFTE_OBJS)��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_make.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000003640�11331412504�012367� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_make.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_MAKE #include "c_bind.h" #include "o_buflist.h" #define hsMAKE_Normal 0 #define hsMAKE_Comment 1 #define hsMAKE_DotCmd 2 #define hsMAKE_Command 3 int Hilit_MAKE(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; char *last = p + len1 - 1; for(i = 0; i < Line->Count;) { if (i == 0 && *p == 9) { State = hsMAKE_Command; Color = CLR_Command; } IF_TAB() else { if (i == 0) { if (*p == '.') { State = hsMAKE_DotCmd; Color = CLR_Directive; goto hilit; } else if (*p == '#') { State = hsMAKE_Comment; Color = CLR_Comment; goto hilit; } } switch(State) { case hsMAKE_Comment: Color = CLR_Comment; goto hilit; case hsMAKE_DotCmd: Color = CLR_Directive; goto hilit; case hsMAKE_Command: Color = CLR_Command; goto hilit; default: State = hsMAKE_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if((len1 == 0) || (*last != '\\')) { if (State == hsMAKE_Comment || State == hsMAKE_DotCmd || State == hsMAKE_Command) State = hsMAKE_Normal; } *ECol = C; return 0; } #endif ������������������������������������������������������������������������������������������������./src/pm_tool.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000036573�07255213352�012641� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #define InRange(a,x,b) (((a) <= (x)) && ((x) < (b))) #define Min(a,b) (((a) < (b))?(a):(b)) #define Max(a,b) (((a) > (b))?(a):(b)) #define TYBORDER 6 // border on top and bottom of icon (all of it) #define TXBORDER 6 #define TXSEPARATOR 4 #define TYICON 24 #define TXICON 24 MRESULT EXPENTRY ToolBarProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { if (msg == WM_CREATE) { WinSetWindowPtr(hwnd, QWL_USER, PVOIDFROMMP(mp1)); } else { ToolBarData *td = (ToolBarData *)WinQueryWindowPtr(hwnd, QWL_USER); ToolBarItem *items = td->pItems; switch (msg) { case WM_DESTROY: free(td); free(items); break; case WM_PAINT: { HPS hps; RECTL rcl; POINTL ptl; SWP swp; int xpos, ypos, item; WinQueryWindowPos(hwnd, &swp); hps = WinBeginPaint(hwnd, 0, &rcl); /* top outside 3D border */ if (rcl.yBottom < 1) { GpiSetColor(hps, CLR_DARKGRAY); ptl.x = rcl.xLeft; ptl.y = 0; GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 2); GpiLine(hps, &ptl); } /* bottom outside 3D border */ if (rcl.yTop >= swp.cy - 1 - 1) { GpiSetColor(hps, CLR_WHITE); ptl.x = Max(rcl.xLeft, 1); ptl.y = swp.cy - 1; GpiMove(hps, &ptl); ptl.x = rcl.xRight; GpiLine(hps, &ptl); } /* 3D corners */ GpiSetColor(hps, CLR_PALEGRAY); ptl.x = 0; ptl.y = 0; GpiSetPel(hps, &ptl); ptl.x = swp.cx - 1; ptl.y = swp.cy - 1; GpiSetPel(hps, &ptl); /* bottom space */ if (rcl.yBottom < TYBORDER - 1) { for (ptl.y = 1; ptl.y < TYBORDER - 2; ptl.y++) { ptl.x = Max(rcl.xLeft, 1); GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 1); GpiLine(hps, &ptl); } } /* top space */ if (rcl.yTop >= swp.cy - TYBORDER + 2) { for (ptl.y = swp.cy - TYBORDER + 2; ptl.y < swp.cy - 1; ptl.y++) { ptl.x = Max(rcl.xLeft, 1); GpiMove(hps, &ptl); ptl.x = Min(rcl.xRight, swp.cx - 1); GpiLine(hps, &ptl); } } /* left outside 3D border */ if (rcl.xLeft < 1) { GpiSetColor(hps, CLR_WHITE); ptl.y = Max(1, rcl.yBottom); ptl.x = 0; GpiMove(hps, &ptl); ptl.y = rcl.yTop; GpiLine(hps, &ptl); } /* right outside 3D border */ if (rcl.xRight >= swp.cx - 1) { GpiSetColor(hps, CLR_DARKGRAY); ptl.y = rcl.yBottom; ptl.x = swp.cx - 1; GpiMove(hps, &ptl); ptl.y = Min(swp.cy - 2, rcl.yTop); GpiLine(hps, &ptl); } /* left border */ if (rcl.xLeft < TXBORDER - 2) { GpiSetColor(hps, CLR_PALEGRAY); for (ptl.x = 1; ptl.x < TXBORDER - 2; ptl.x++) { ptl.y = Max(1, rcl.yBottom); GpiMove(hps, &ptl); ptl.y = Min(swp.cy - 2, rcl.yTop); GpiLine(hps, &ptl); } } /* draw toolbar items */ xpos = TXBORDER; ypos = TYBORDER; for (item = 0; item < td->ulCount; item++) { if (items[item].ulType == tiBITMAP) { if (rcl.xRight >= xpos - 2 && rcl.xLeft <= xpos + TXICON + 1) { GpiSetColor(hps, CLR_BLACK); ptl.x = xpos - 2; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = xpos + TXICON + 1; ptl.y = ypos + TYICON + 1; GpiBox(hps, DRO_OUTLINE, &ptl, 0, 0); if (item == td->ulDepressed && (items[item].ulFlags & tfDEPRESSED)) { ptl.x = xpos + 1; ptl.y = ypos - 1; WinDrawBitmap(hps, items[item].hBitmap, 0, &ptl, 0, 0, (items[item].ulFlags & tfDISABLED) ? DBM_INVERT: DBM_NORMAL); GpiSetColor(hps, CLR_DARKGRAY); ptl.x = xpos - 1; ptl.y = ypos - 1; GpiMove(hps, &ptl); ptl.y = ypos + TYICON; GpiLine(hps, &ptl); ptl.x = xpos + TXICON; GpiLine(hps, &ptl); ptl.y--; GpiMove(hps, &ptl); ptl.x = xpos; GpiLine(hps, &ptl); ptl.y = ypos - 1; GpiLine(hps, &ptl); } else { ptl.x = xpos; ptl.y = ypos; WinDrawBitmap(hps, items[item].hBitmap, 0, &ptl, 0, 0, (items[item].ulFlags & tfDISABLED) ? DBM_INVERT: DBM_NORMAL); GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 1; GpiSetPel(hps, &ptl); GpiSetColor(hps, CLR_WHITE); ptl.y++; GpiMove(hps, &ptl); ptl.y = ypos + TYICON; GpiLine(hps, &ptl); ptl.x = xpos + TXICON - 1; GpiLine(hps, &ptl); GpiSetColor(hps, CLR_PALEGRAY); ptl.x++; GpiSetPel(hps, &ptl); ptl.y--; GpiSetColor(hps, CLR_DARKGRAY); GpiMove(hps, &ptl); ptl.y = ypos - 1; GpiLine(hps, &ptl); ptl.x = xpos; GpiLine(hps, &ptl); } } xpos += TXICON + 3; } else if (items[item].ulType == tiSEPARATOR) { if (rcl.xRight >= xpos - 1 && rcl.xLeft <= xpos + TXSEPARATOR + 1) { GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = xpos + TXSEPARATOR + 1; ptl.y = ypos + TYICON + 1; GpiBox(hps, DRO_FILL, &ptl, 0, 0); } xpos += TXSEPARATOR + 3; } } GpiSetColor(hps, CLR_PALEGRAY); ptl.x = xpos - 1; ptl.y = ypos - 2; GpiMove(hps, &ptl); ptl.x = swp.cx - 2; ptl.y = swp.cy - TYBORDER + 1; GpiBox(hps, DRO_FILL, &ptl, 0, 0); WinEndPaint(hps); } break; case WM_ADJUSTWINDOWPOS: { PSWP pswp = (PSWP)PVOIDFROMMP(mp1); pswp->cy = TYBORDER + TYICON + TYBORDER; } break; case WM_BUTTON1DOWN: case WM_BUTTON1DBLCLK: { int item; POINTL ptl; RECTL rcl; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; for (item = 0; item < td->ulCount; item++) { if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y && td->pItems[item].ulType == tiBITMAP && (td->pItems[item].ulFlags & tfDISABLED) == 0) { td->ulDepressed = item; td->pItems[item].ulFlags |= tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); WinSetCapture(HWND_DESKTOP, hwnd); break; } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } } break; case WM_MOUSEMOVE: { STARTFUNC("ToolBarProc[WM_MOUSEMOVE]"); int item; POINTL ptl; RECTL rcl; if (td->ulDepressed == -1) break; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; LOG << "Depressed: " << td-> ulDepressed << ENDLINE; for (item = 0; item < td->ulCount; item++) { LOG << "Checking item " << item << ENDLINE; LOG << " pItem -> " << (void*)(td->pItems + item) << ENDLINE; if (item == td->ulDepressed) { if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y) { if ((td->pItems[item].ulFlags & tfDEPRESSED) == 0) { td->pItems[item].ulFlags |= tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); } } else { if (td->pItems[item].ulFlags & tfDEPRESSED) { td->pItems[item].ulFlags &= ~tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); } } break; } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } } break; case WM_BUTTON1UP: { int item; POINTL ptl; RECTL rcl; if (td->ulDepressed == -1) break; ptl.x = (LONG) SHORT1FROMMP(mp1); ptl.y = (LONG) SHORT2FROMMP(mp1); rcl.yBottom = TYBORDER - 1; rcl.yTop = TYBORDER + TYICON + 1; rcl.xLeft = TXBORDER - 1; rcl.xRight = TXBORDER + TXICON + 1; for (item = 0; item < td->ulCount; item++) { if (item == td->ulDepressed) { WinSetCapture(HWND_DESKTOP, (HWND)0); if (rcl.xLeft <= ptl.x && rcl.yBottom <= ptl.y && rcl.xRight >= ptl.x && rcl.yTop >= ptl.y && td->pItems[item].ulFlags & tfDEPRESSED) { td->pItems[item].ulFlags &= ~tfDEPRESSED; WinInvalidateRect(hwnd, &rcl, FALSE); // message WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), WM_COMMAND, MPFROM2SHORT(td->pItems[item].ulCommand, 0), MPFROM2SHORT(CMDSRC_OTHER, TRUE)); break; } } if (td->pItems[item].ulType == tiBITMAP) { rcl.xLeft += TXICON + 3; rcl.xRight += TXICON + 3; } else if (td->pItems[item].ulType == tiSEPARATOR) { rcl.xLeft += TXSEPARATOR + 3; rcl.xRight += TXSEPARATOR + 3; } } td->ulDepressed = -1; } break; } } return WinDefWindowProc(hwnd, msg, mp1, mp2); } void RegisterToolBarClass(HAB hab) { assert(WinRegisterClass(hab, WC_MTOOLBAR, (PFNWP)ToolBarProc, CS_SIZEREDRAW, sizeof(void *)) == TRUE); } HWND CreateToolBar(HWND parent, HWND owner, ULONG id, ULONG count, ToolBarItem *items) { STARTFUNC("CreateToolBar"); ToolBarData *td; HWND hwnd; td = (ToolBarData *)malloc(sizeof(ToolBarData)); if (td == 0) return 0; td->pItems = (ToolBarItem *)malloc(sizeof(ToolBarItem) * count); if (td->pItems == 0) { free(td); return 0; } td->cb = sizeof(ToolBarData); td->ulCount = count; td->ulDepressed = (LONG)-1; memcpy((void *)td->pItems, (void *)items, sizeof(ToolBarItem) * count); hwnd = WinCreateWindow(parent, WC_MTOOLBAR, "ToolBar", WS_VISIBLE, 0, 0, 0, 0, owner, HWND_TOP, id, td, 0); //free(td); <-- Don't do this here as now the window owns the memory! return hwnd; } �������������������������������������������������������������������������������������������������������������������������������������./src/i_modelview.cpp�������������������������������������������������������������������������������0000644�0001750�0001750�00000003013�11344266047�013455� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_modelview.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_modelview.h" #include "o_routine.h" //#include <stdio.h> ExModelView::ExModelView(EView *AView) : View(AView), MouseCaptured(0), MouseMoved(0) { //fprintf(stderr, "Create ExModel %p View %p\n", this, View); View->MView = this; } ExModelView::~ExModelView() { //fprintf(stderr, "Delete ExModel %p View %p\n", this, View); //if (View->MView == this) // View->MView = 0; delete View; } int ExModelView::GetContext() { return View->GetContext(); } void ExModelView::Activate(int gotfocus) { ExView::Activate(gotfocus); View->Activate(gotfocus); } EEventMap *ExModelView::GetEventMap() { return View->GetEventMap(); } int ExModelView::ExecCommand(ExCommands Command, ExState &State) { return View->ExecCommand(Command, State); } int ExModelView::BeginMacro() { return View->BeginMacro(); } void ExModelView::HandleEvent(TEvent &Event) { ExView::HandleEvent(Event); View->HandleEvent(Event); } void ExModelView::UpdateView() { View->UpdateView(); } void ExModelView::RepaintView() { View->RepaintView(); } void ExModelView::RepaintStatus() { View->RepaintStatus(); } void ExModelView::UpdateStatus() { View->UpdateStatus(); } void ExModelView::Resize(int width, int height) { View->Resize(width, height); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_pm.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000352472�11602724002�012077� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_pm.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* * here's how it works: * there's one visible and one object window per view * events are forwarded from the visible on to object window and pulled * into the editor from the worker thread (there's only one, FTE * editor core is single-threaded). * SIQ is never blocked. * the only problem is that window doesn't repaint correctly after resize, * until the worker thread finishes processing, but we can't really * do anything with this as the editor core is not thread-safe. */ #define INCL_WIN #define INCL_GPI #define INCL_VIO #define INCL_AVIO #define INCL_DOS #define INCL_DOSERRORS #include "c_color.h" #include "c_commands.h" #include "c_config.h" #include "c_history.h" #include "c_mode.h" #include "ftever.h" #include "gui.h" #include "log.h" #include "s_files.h" #include "s_string.h" #include "sysdep.h" #include <ctype.h> #include <os2.h> #include <process.h> #include <stdarg.h> #include <stdio.h> #define PM_STACK_SIZE (96 * 1024) #define UWM_NOTIFY (WM_USER + 1) #define UWM_DESTROY (WM_USER + 2) #define UWM_DESTROYHWND (WM_USER + 3) #define UWM_DROPPEDFILE (WM_USER + 4) #define UWM_FILEDIALOG (WM_USER + 5) #define UWM_DLGBOX (WM_USER + 6) #define UWM_PROCESSDLG (WM_USER + 7) #define UWM_CHOICE (WM_USER + 8) #define UWM_CREATECHILD (WM_USER + 9) #define UWM_CREATEWORKER (WM_USER + 10) #define UWM_CREATEFRAME (WM_USER + 11) #define UWM_CREATEMAINMENU (WM_USER + 12) #define UWM_CREATEPOPUPMENU (WM_USER + 13) #define CURSOR_TYPE (CURSOR_FLASH | CURSOR_SOLID) //#define SIZER_HEIGHT 4 #define FID_MTOOLBAR 10001 #define MAXXSIZE 160 #define MAXYSIZE 96 #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; TID tid; HMTX Access; HEV ResumeRead; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; int RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #define sfFocus 1 typedef struct _PMPTR { // for passing pointers to winprocs USHORT len; void *p; } PMPTR; class GViewPeer; struct PMData { GViewPeer *Peer; HVPS hvps; HPS hps; SHORT cxChar; SHORT cyChar; HWND hwndWorker; }; class GViewPeer { public: GView *View; // int wX, wY; int wW, wH, wState; int cX, cY, cVisible, cStart, cEnd; int sbVstart, sbVamount, sbVtotal; int sbHstart, sbHamount, sbHtotal; HWND hwndView; HWND hwndVscroll, hwndHscroll; HWND hwndWorker; PMData *pmData; int OldMouseX, OldMouseY; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int UpdateCursor(); int PMShowCursor(); int PMHideCursor(); int PMSetCursorPos(); }; class GFramePeer { public: GFrame *Frame; HWND hwndFrame; HWND menuBar; HWND hwndToolBar; PFNWP oldFrameProc; GFramePeer(GFrame *aFrame, int Width, int Height); ~GFramePeer(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); void MapFrame(); void ShowFrame(); void SizeFrame(); }; int ShowVScroll = 1; int ShowHScroll = 0; int ShowMenuBar = 1; int ShowToolBar = 1; unsigned long HaveGUIDialogs = GUIDLG_FILE | GUIDLG_CHOICE | GUIDLG_FIND | GUIDLG_FINDREPLACE | GUIDLG_PROMPT; extern int PMDisableAccel; GFrame *frames = 0; GUI *gui = 0; GView *MouseCapture = 0; GView *FocusCapture = 0; static HEV WorkerStarted, StartInterface; HWND CreatePMMainMenu(HWND parent, HWND owner, char *Name); HWND CreatePMMenu(HWND parent, HWND owner, int menu, int id, int style); HWND CreateToolBar(HWND parent, HWND owner, int id); MRESULT EXPENTRY FrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); //MRESULT EXPENTRY SizerWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY AVIOWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); MRESULT EXPENTRY CreatorWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); HAB hab = 0; HAB habW = 0; static char szClient[] = "EViewer"; static char szObject[] = "EWorker"; static char szCreator[] = "ECreator"; //static char szSizeBar[] = "ESizeBar" // TODO static ULONG flFrame = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MAXBUTTON | FCF_HIDEBUTTON | FCF_SHELLPOSITION | FCF_TASKLIST | // FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_MENU | FCF_ICON; SWP swp; HMQ hmq = 0; HMQ hmqW = 0; HMTX hmtxPMData = 0; ULONG cxScreen, cyScreen, cyTitleBar, //cyMenuBar, cxBorder, cyBorder, cxScrollBar, cyScrollBar; SHORT reportSize = 1; TEvent EventBuf = { evNone }; HWND hwndCreatorUser, hwndCreatorWorker; char dragname[CCHMAXPATH]; #ifdef OLD_PMMENUTOOLBAR /* implemented using menus */ struct { int id; HBITMAP handle; int cmd; int flags; } tools[] = { // { 101, 0, ExExitEditor, MIS_BITMAP }, // { 0, 0, 0, MIS_SEPARATOR }, { 102, 0, ExFileOpen, MIS_BITMAP }, { 103, 0, ExFileSave, MIS_BITMAP }, { 104, 0, ExFileClose, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 105, 0, ExFilePrev, MIS_BITMAP }, { 106, 0, ExFileLast, MIS_BITMAP }, { 107, 0, ExFileNext, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 108, 0, ExUndo, MIS_BITMAP }, { 109, 0, ExRedo, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 110, 0, ExBlockCut, MIS_BITMAP }, { 111, 0, ExBlockCopy, MIS_BITMAP }, { 112, 0, ExBlockPasteStream, MIS_BITMAP }, { 113, 0, ExBlockPasteColumn, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 114, 0, ExCompilePrevError, MIS_BITMAP }, { 115, 0, ExCompileNextError, MIS_BITMAP }, { 0, 0, 0, MIS_SEPARATOR }, { 116, 0, ExTagFindWord, MIS_BITMAP }, { 119, 0, ExTagPop, MIS_BITMAP }, { 117, 0, ExTagNext, MIS_BITMAP }, { 118, 0, ExTagPrev, MIS_BITMAP }, }; HWND CreateToolBar(HWND parent, HWND owner, int id) { HWND menu; int i; MENUITEM item; HPS ps; menu = WinCreateWindow(parent, WC_MENU, "menu", WS_VISIBLE | MS_ACTIONBAR, 0, 0, 0, 0, owner, HWND_TOP, id, 0, 0); //WinEnableWindowUpdate(hmenu, FALSE); ps = WinGetPS(menu); for (i = 0; i < sizeof(tools)/sizeof(tools[0]); i++) { if (tools[i].handle == 0 && (tools[i].flags & MIS_BITMAP)) { tools[i].handle = GpiLoadBitmap(ps, NULLHANDLE, tools[i].id, 0, 0); } memset((void *)&item, 0, sizeof(item)); item.iPosition = i; item.hwndSubMenu = 0; item.afStyle = tools[i].flags; item.id = tools[i].cmd + 16384 + 8192; item.afAttribute = 0; item.hItem = tools[i].handle; WinSendMsg(menu, MM_INSERTITEM, MPFROMP(&item), MPFROMP(0)); } WinReleasePS(ps); return menu; } #else #include "pm_tool.h" #include "pm_tool.cpp" #define CMD(x) ((x) + 16384 + 8192) ToolBarItem tools[] = { // { tiBITMAP, 101, CMD(ExExitEditor), 0, 0 }, { tiBITMAP, 102, CMD(ExFileOpen), 0, 0 }, { tiBITMAP, 103, CMD(ExFileSave), 0, 0 }, { tiBITMAP, 104, CMD(ExFileClose), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 105, CMD(ExFilePrev), 0, 0 }, { tiBITMAP, 106, CMD(ExFileLast), 0, 0 }, { tiBITMAP, 107, CMD(ExFileNext), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 108, CMD(ExUndo), 0, 0 }, { tiBITMAP, 109, CMD(ExRedo), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 110, CMD(ExBlockCut), 0, 0 }, { tiBITMAP, 111, CMD(ExBlockCopy), 0, 0 }, { tiBITMAP, 112, CMD(ExBlockPasteStream), 0, 0 }, { tiBITMAP, 113, CMD(ExBlockPasteColumn), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 114, CMD(ExCompilePrevError), 0, 0 }, { tiBITMAP, 115, CMD(ExCompileNextError), 0, 0 }, { tiSEPARATOR, 0, 0, 0, 0}, { tiBITMAP, 116, CMD(ExTagFindWord), 0, 0 }, { tiBITMAP, 119, CMD(ExTagPop), 0, 0 }, { tiBITMAP, 117, CMD(ExTagNext), 0, 0 }, { tiBITMAP, 118, CMD(ExTagPrev), 0, 0 }, }; HWND CreateToolBar(HWND parent, HWND owner, int id) { STARTFUNC("CreateToolBar{g_pm.cpp}"); static int reged = 0; HPS hps; unsigned int i; if (!reged) { RegisterToolBarClass(hab); reged = 1; } hps = WinGetPS(parent); for (i = 0; i < sizeof(tools)/sizeof(tools[0]); i++) { if (tools[i].hBitmap == 0 && (tools[i].ulType == tiBITMAP)) tools[i].hBitmap = GpiLoadBitmap(hps, NULLHANDLE, tools[i].ulId, 0, 0); } WinReleasePS(hps); return CreateToolBar(parent, owner, id, sizeof(tools)/sizeof(tools[0]), tools); } #endif HWND CreatePMMenu(HWND parent, HWND owner, int menu, int id, int style) { HWND hmenu; int i; MENUITEM item; char s[256]; char *p; hmenu = WinCreateWindow(parent, WC_MENU, "menu", style & ~MS_CONDITIONALCASCADE, 0, 0, 0, 0, owner, HWND_TOP, id, 0, 0); //WinEnableWindowUpdate(hmenu, FALSE); for (i = 0; i < Menus[menu].Count; i++) { memset((void *)&item, 0, sizeof(item)); item.iPosition = i; item.hwndSubMenu = 0; if (Menus[menu].Items[i].Name) { if (Menus[menu].Items[i].SubMenu != -1) { item.afStyle = MIS_SUBMENU | MIS_TEXT; item.hwndSubMenu = CreatePMMenu(HWND_DESKTOP, owner, Menus[menu].Items[i].SubMenu, 0, (Menus[menu].Items[i].Cmd == SUBMENU_CONDITIONAL) ? MS_CONDITIONALCASCADE : 0); { static ids = 1000; item.id = ids++; if (ids == 7000) { ids = 1000; } } } else { item.afStyle = MIS_TEXT; item.id = (Menus[menu].Items[i].Cmd & 0xFFFF) + 8192; // ? } } else { item.afStyle = MIS_SEPARATOR; item.id = 0; } item.afAttribute = 0; item.hItem = 0; if (Menus[menu].Items[i].Name) { strcpy(s, Menus[menu].Items[i].Name); p = strchr(s, '&'); if (p) (*p) = '~'; p = (char *)&s; } else { p = 0; } WinSendMsg(hmenu, MM_INSERTITEM, MPFROMP(&item), MPFROMP(p)); if (i == 0 && style == MS_CONDITIONALCASCADE) { WinSetWindowBits(hmenu, QWL_STYLE, MS_CONDITIONALCASCADE, MS_CONDITIONALCASCADE); WinSendMsg(hmenu, MM_SETDEFAULTITEMID, MPFROMSHORT(item.id), 0); } } //WinEnableWindowUpdate(hmenu, TRUE); return hmenu; } HWND CreatePMMainMenu(HWND parent, HWND owner, char *Name) { int id = GetMenuId(Name); HWND main; assert (id != -1); main = CreatePMMenu(parent, owner, id, FID_MENU, MS_ACTIONBAR); return main; } #include "pmdlg.h" void InsertHistory(HWND hwnd, int id, int maxlen) { int i, count; char *str; count = CountInputHistory(id); str = (char *)malloc(maxlen + 1); if (str == 0) return; for (i = 0; i < count; i++) { if (GetInputHistory(id, str, maxlen, i + 1) == 1) WinInsertLboxItem(hwnd, LIT_END, str); } free(str); } MRESULT EXPENTRY FileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { FILEDLG *dlg; dlg = (FILEDLG *)WinQueryWindowULong(hwnd, QWL_USER); switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); InsertHistory(WinWindowFromID(hwnd, DID_FILENAME_ED), HIST_PATH, MAXPATH); WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("FTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ((dlg->fl & FDS_SAVEAS_DIALOG) ? "FileSaveDlg" : "FileOpenDlg"), hwnd); break; } return WinDefFileDlgProc(hwnd, msg, mp1, mp2); } int DLGGetFile(GView *View, const char *Prompt, unsigned int BufLen, char *FileName, int Flags) { FILEDLG dlg; memset((void *)&dlg, 0, sizeof(dlg)); dlg.cbSize = sizeof(dlg); dlg.fl = /*FDS_CENTER |*/ FDS_CUSTOM | ((Flags & GF_SAVEAS) ? FDS_SAVEAS_DIALOG : FDS_OPEN_DIALOG); dlg.pszTitle = (char*)Prompt; strcpy(dlg.szFullFile, FileName); dlg.hMod = NULLHANDLE; dlg.usDlgId = IDD_FILEDLG; dlg.pfnDlgProc = FileDlgProc; if (!LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_FILEDIALOG, MPFROMP(&dlg), 0))) return 0; if (dlg.lReturn == DID_OK) { strlcpy(FileName, dlg.szFullFile, BufLen); AddInputHistory(HIST_PATH, FileName); return 1; } return 0; } typedef struct { char *Title; int NSel; va_list ap; int Flags; } ChoiceInfo; static int DoChoice(HWND hwndFrame, ChoiceInfo *choice) { char msg[1024]; char Prompt[1024]; char *fmt; char *p; int rc; HWND hwndDlg; HWND hwndStatic; HWND hwndButton[40]; int cyBorder, cxBorder; SWP swp, swp1; int i, x, y; ULONG flFrame = FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER; HPS ps; int xw, yw, nx, ny; RECTL tr; int cp, cd; char msgbox[100]; int SPC = 4; sprintf(msgbox, "MsgBox: %s", choice->Title); cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME); cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME); hwndDlg = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrame, 0, choice->Title, 0, 0, 0, 0); WinSendMsg(hwndDlg, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSetOwner(hwndDlg, hwndFrame); x = SPC; for (i = 0; i < choice->NSel; i++) { char button[60]; strcpy(button, va_arg(choice->ap, char *)); p = strchr(button, '&'); if (p) *p = '~'; hwndButton[i] = WinCreateWindow(hwndDlg, WC_BUTTON, button, WS_VISIBLE | BS_PUSHBUTTON | BS_AUTOSIZE | ((i == 0) ? BS_DEFAULT | WS_TABSTOP | WS_GROUP: 0), cxBorder + x, SPC + cyBorder, 0, 0, hwndDlg, ((i == 0) ? HWND_TOP: hwndButton[i - 1]), 200 + i, NULL, NULL); WinQueryWindowPos(hwndButton[i], &swp); x += SPC + swp.cx; } fmt = va_arg(choice->ap, char *); vsprintf(msg, fmt, choice->ap); strlcpy((PCHAR)Prompt, msg, sizeof(Prompt)); hwndStatic = WinCreateWindow(hwndDlg, WC_STATIC, Prompt, WS_VISIBLE | SS_TEXT | DT_TOP | DT_LEFT | DT_WORDBREAK, 0, 0, 0, 0, hwndDlg, HWND_TOP, 100, NULL, NULL); WinRestoreWindowPos("FTEPM", msgbox, hwndDlg); xw = cxScreen / 2; if (x - SPC > xw) xw = x - SPC; yw = 0; ps = WinGetPS(hwndStatic); cp = 0; for (;;) { tr.xLeft = 0; tr.xRight = xw; tr.yTop = cyScreen / 2; tr.yBottom = 0; cd = WinDrawText(ps, -1, (Prompt + cp), &tr, 0, 0, DT_LEFT | DT_TOP | DT_WORDBREAK | DT_TEXTATTRS | DT_QUERYEXTENT | DT_EXTERNALLEADING); if (!cd) break; cp += cd; yw += tr.yTop - tr.yBottom; } WinReleasePS(ps); WinSetWindowPos(hwndStatic, 0, cxBorder + SPC, cyBorder + SPC + swp.cy + SPC, xw, yw, SWP_MOVE | SWP_SIZE); WinQueryWindowPos(hwndStatic, &swp1); WinQueryWindowPos(hwndButton[0], &swp); nx = cxBorder + SPC + xw + SPC + cxBorder; ny = cyBorder + SPC + swp.cy + SPC + swp1.cy + SPC + cyTitleBar + cyBorder; WinQueryWindowPos(hwndDlg, &swp); x = swp.x; y = swp.y + swp.cy - ny; if (y < cyBorder) y = - cyBorder; if (y + ny >= cyScreen + cyBorder) y = cyScreen - ny + cyBorder; if (x + nx >= cxScreen + cxBorder) x = cxScreen - nx + cxBorder; if (x < -cxBorder) x = -cxBorder; WinSetWindowPos(hwndDlg, 0, x, y, nx, ny, SWP_SIZE | SWP_SHOW | SWP_MOVE | SWP_ACTIVATE); WinSubclassWindow(hwndDlg, (PFNWP) WinDefDlgProc); if (choice->Flags & (GPC_ERROR | GPC_FATAL)) WinAlarm(HWND_DESKTOP, WA_ERROR); else if (choice->Flags & (GPC_CONFIRM)) WinAlarm(HWND_DESKTOP, WA_NOTE); else if (choice->Flags & (GPC_WARNING)) WinAlarm(HWND_DESKTOP, WA_WARNING); rc = LONGFROMMR(WinSendMsg(hwndFrame, UWM_PROCESSDLG, MPFROMLONG(hwndDlg), 0)); WinStoreWindowPos("FTEPM", msgbox, hwndDlg); WinSendMsg(hwndFrame, UWM_DESTROYHWND, MPFROMLONG(hwndDlg), 0); if (rc == DID_CANCEL || rc == DID_ERROR) return choice->NSel - 1; if (rc >= 200 && rc < choice->NSel + 200) return rc - 200; return 0; } /* reimplemented most of the WinMessageBox code to get store/restore position to work */ int DLGPickChoice(GView *View, const char *ATitle, int NSel, va_list ap, int Flags) { ChoiceInfo choice; choice.Title = (char *)ATitle; choice.NSel = NSel; choice.ap = ap; choice.Flags = Flags; return LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_CHOICE, MPFROMP(&choice), 0)); } static struct { char *Title; char *Entry; int MaxLen; int HistId; } PromptInfo; MRESULT EXPENTRY PromptDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSendDlgItemMsg(hwnd, IDE_FIELD, EM_SETTEXTLIMIT, MPFROMLONG(PromptInfo.MaxLen), 0); WinSetDlgItemText(hwnd, IDE_FIELD, PromptInfo.Entry); InsertHistory(WinWindowFromID(hwnd, IDE_FIELD), PromptInfo.HistId, PromptInfo.MaxLen); WinSetDlgItemText(hwnd, IDS_PROMPT, PromptInfo.Title); WinSetWindowText(hwnd, PromptInfo.Title); WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("FTEPM", "PromptDlg", hwnd); return WinDefDlgProc(hwnd, msg, mp1, mp2); case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: WinQueryDlgItemText(hwnd, IDE_FIELD, PromptInfo.MaxLen, PromptInfo.Entry); PromptInfo.Entry[PromptInfo.MaxLen - 1] = 0; AddInputHistory(PromptInfo.HistId, PromptInfo.Entry); WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", "PromptDlg", hwnd); WinDismissDlg(hwnd, TRUE); return (MRESULT)FALSE; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", "PromptDlg", hwnd); WinDismissDlg(hwnd, FALSE); return (MRESULT)FALSE; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", "PromptDlg", hwnd); /* passthru */ default: return WinDefDlgProc(hwnd, msg, mp1, mp2); } return (MRESULT)FALSE; } int DLGGetStr(GView *View, const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags) { assert(BufLen > 0); PromptInfo.MaxLen = BufLen - 1; PromptInfo.Title = (char *)Prompt; PromptInfo.Entry = Str; PromptInfo.HistId = HistId; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, MPFROMP(PFNWP(PromptDlgProc)), MPFROMLONG(IDD_PROMPT))) != DID_OK) return 0; return 1; } static SearchReplaceOptions SearchOpt; static int ReplaceDlg = 0; MRESULT EXPENTRY FindDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: WinSendMsg(hwnd, WM_SETICON, MPFROMLONG(WinLoadPointer(HWND_DESKTOP, 0, 1)), 0); WinSendDlgItemMsg(hwnd, IDE_FIND, EM_SETTEXTLIMIT, MPFROMLONG(MAXSEARCH), 0); WinSetDlgItemText(hwnd, IDE_FIND, SearchOpt.strSearch); InsertHistory(WinWindowFromID(hwnd, IDE_FIND), HIST_SEARCH, MAXSEARCH); WinCheckButton(hwnd, IDC_IGNORECASE, (SearchOpt.Options & SEARCH_NCASE) ? 1 : 0); WinCheckButton(hwnd, IDC_REGEXPS, (SearchOpt.Options & SEARCH_RE) ? 1 : 0); WinCheckButton(hwnd, IDC_WORDS, (SearchOpt.Options & SEARCH_WORD) ? 1 : 0); WinCheckButton(hwnd, IDC_BLOCK, (SearchOpt.Options & SEARCH_BLOCK) ? 1 : 0); WinCheckButton(hwnd, IDC_GLOBAL, (SearchOpt.Options & SEARCH_GLOBAL) ? 1 : 0); WinCheckButton(hwnd, IDC_REVERSE, (SearchOpt.Options & SEARCH_BACK) ? 1 : 0); WinCheckButton(hwnd, IDC_ALLOCCURENCES, (SearchOpt.Options & SEARCH_ALL) ? 1 : 0); WinCheckButton(hwnd, IDC_JOINLINE, (SearchOpt.Options & SEARCH_JOIN) ? 1: 0); if (ReplaceDlg) { WinSendDlgItemMsg(hwnd, IDE_REPLACE, EM_SETTEXTLIMIT, MPFROMLONG(MAXSEARCH), 0); WinSetDlgItemText(hwnd, IDE_REPLACE, SearchOpt.strReplace); InsertHistory(WinWindowFromID(hwnd, IDE_REPLACE), HIST_SEARCH, MAXSEARCH); WinCheckButton(hwnd, IDC_NOPROMPTING, (SearchOpt.Options & SEARCH_NASK) ? 1 : 0); } else { WinCheckButton(hwnd, IDC_DELETELINE, (SearchOpt.Options & SEARCH_DELETE) ? 1 : 0); } WinInvalidateRect(hwnd, 0, TRUE); WinRestoreWindowPos("FTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); return WinDefDlgProc(hwnd, msg, mp1, mp2); case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: SearchOpt.ok = 1; SearchOpt.resCount = 0; SearchOpt.Options = 0; strcpy(SearchOpt.strReplace, ""); WinQueryDlgItemText(hwnd, IDE_FIND, MAXSEARCH, SearchOpt.strSearch); SearchOpt.strSearch[MAXSEARCH - 1] = 0; AddInputHistory(HIST_SEARCH, SearchOpt.strSearch); if (WinQueryButtonCheckstate(hwnd, IDC_IGNORECASE)) SearchOpt.Options |= SEARCH_NCASE; if (WinQueryButtonCheckstate(hwnd, IDC_REGEXPS)) SearchOpt.Options |= SEARCH_RE; if (WinQueryButtonCheckstate(hwnd, IDC_WORDS)) SearchOpt.Options |= SEARCH_WORD; if (WinQueryButtonCheckstate(hwnd, IDC_BLOCK)) SearchOpt.Options |= SEARCH_BLOCK; if (WinQueryButtonCheckstate(hwnd, IDC_GLOBAL)) SearchOpt.Options |= SEARCH_GLOBAL; if (WinQueryButtonCheckstate(hwnd, IDC_REVERSE)) SearchOpt.Options |= SEARCH_BACK; if (WinQueryButtonCheckstate(hwnd, IDC_ALLOCCURENCES)) SearchOpt.Options |= SEARCH_ALL; if (WinQueryButtonCheckstate(hwnd, IDC_JOINLINE)) SearchOpt.Options |= SEARCH_JOIN; if (ReplaceDlg) { WinQueryDlgItemText(hwnd, IDE_REPLACE, MAXSEARCH, SearchOpt.strReplace); SearchOpt.strReplace[MAXSEARCH - 1] = 0; AddInputHistory(HIST_SEARCH, SearchOpt.strReplace); SearchOpt.Options |= SEARCH_REPLACE; if (WinQueryButtonCheckstate(hwnd, IDC_NOPROMPTING)) SearchOpt.Options |= SEARCH_NASK; } else { if (WinQueryButtonCheckstate(hwnd, IDC_DELETELINE)) SearchOpt.Options |= SEARCH_DELETE; } WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); WinDismissDlg(hwnd, TRUE); return (MRESULT)FALSE; case DID_CANCEL: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); WinDismissDlg(hwnd, FALSE); return (MRESULT)FALSE; } break; case WM_CLOSE: WinShowWindow(hwnd, FALSE); WinStoreWindowPos("FTEPM", ReplaceDlg ? "ReplaceDlg" : "FindDlg", hwnd); /* passthru */ default: return WinDefDlgProc(hwnd, msg, mp1, mp2); } return (MRESULT)FALSE; } int DLGGetFind(GView *View, SearchReplaceOptions &sr) { SearchOpt = sr; ReplaceDlg = 0; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, PVOIDFROMMP(PFNWP(FindDlgProc)), MPFROMLONG(IDD_FIND))) != DID_OK) return 0; sr = SearchOpt; return 1; } int DLGGetFindReplace(GView *View, SearchReplaceOptions &sr) { SearchOpt = sr; ReplaceDlg = 1; if (LONGFROMMR(WinSendMsg(View->Parent->Peer->hwndFrame, UWM_DLGBOX, PVOIDFROMMP(PFNWP(FindDlgProc)), MPFROMLONG(IDD_FINDREPLACE))) != DID_OK) return 0; sr = SearchOpt; return 1; } struct { int vk; TKeyCode kc; char *name; } lvirt[] = { { VK_F1, kbF1, "F1" }, { VK_F2, kbF2, "F2" }, { VK_F3, kbF3, "F3" }, { VK_F4, kbF4, "F4" }, { VK_F5, kbF5, "F5" }, { VK_F6, kbF6, "F6" }, { VK_F7, kbF7, "F7" }, { VK_F8, kbF8, "F8" }, { VK_F9, kbF9, "F9" }, { VK_F10, kbF10, "F10" }, { VK_F11, kbF11, "F11" }, { VK_F12, kbF12, "F12" }, { VK_ESC, kbEsc, "Esc" }, { VK_ENTER, kbEnter | kfGray, "Enter" }, { VK_NEWLINE, kbEnter, "Enter" }, { VK_BACKSPACE, kbBackSp, "BackSp" }, { VK_SPACE, kbSpace, "Space" }, { VK_TAB, kbTab, "Tab" }, { VK_BACKTAB, kbTab | kfShift, "Tab" }, { VK_UP, kbUp, "Up" }, { VK_DOWN, kbDown, "Down" }, { VK_LEFT, kbLeft, "Left" }, { VK_RIGHT, kbRight, "Right" }, { VK_HOME, kbHome, "Home" }, { VK_END, kbEnd, "End" }, { VK_PAGEDOWN, kbPgDn, "PgDn" }, { VK_PAGEUP, kbPgUp, "PgUp" }, { VK_INSERT, kbIns, "Ins" }, { VK_DELETE, kbDel, "Del" }, { VK_CTRL, kbCtrl | kfModifier, "Ctrl" }, { VK_ALT, kbAlt | kfModifier, "Alt" }, { VK_ALTGRAF, kbAlt | kfModifier, "Alt" }, { VK_SHIFT, kbShift | kfModifier, "Shift" }, { VK_CAPSLOCK, kbCapsLock | kfModifier, "CapsLock" }, { VK_NUMLOCK, kbNumLock | kfModifier, "NumLock" }, { VK_SCRLLOCK, kbScrollLock | kfModifier, "ScrollLock" }, { VK_BREAK, kbBreak, "Break" }, { VK_PAUSE, kbPause, "Pause" }, { VK_PRINTSCRN, kbPrtScr, "PrtScr" }, { VK_SYSRQ, kbSysReq, "SysReq", }, }; char *ConvertKey(int ch, int virt, int flags, int scan, TEvent &Event) { int keyFlags = 0; static char name[40]; char keyname[40]; TKeyCode keyCode = 0; strcpy(keyname, "UNKNOWN"); //printf("ch:%d, virt:%d, flags:%d, scan:%d\n", ch, virt, flags, scan); name[0] = 0; if (flags & KC_CTRL) keyFlags |= kfCtrl; if (flags & KC_ALT) keyFlags |= kfAlt; if (flags & KC_SHIFT) keyFlags |= kfShift; if ((ch != 0xE0) && ((ch & 0xFF) == 0xE0)) keyFlags |= kfGray; if (keyFlags == kfAlt) {// do not produce anything on alt+XXX switch (scan) { case 71: case 72: case 73: case 75: case 76: case 77: case 79: case 80: case 81: case 82: case 83: return name; } } if (ch != 0 && (flags & KC_CHAR)) { switch (scan) { case 71: case 72: case 73: case 75: case 76: case 77: case 79: case 80: case 81: case 82: case 83: virt = 0; } } { int i; for (i = 0; i < (sizeof(lvirt)/sizeof(lvirt[0])); i++) if (lvirt[i].vk == virt) { keyCode = lvirt[i].kc; strcpy(keyname, lvirt[i].name); break; } } if (keyCode == 0) { char c[2]; if( ch == 0 && scan == 86 ){ // Fix for OS/2 bug with UK keyboard layout // This is shift-'\' (to the left of Z), which returns 0 ch = '|'; } c[0] = char(ch); c[1] = 0; if (ch == '+' && scan == 78) keyCode = '+' | kfGray; else if (ch == '-' && scan == 74) keyCode = '-' | kfGray; else if (ch == '*' && scan == 55) keyCode = '*' | kfGray; else if (ch == '/' && scan == 92) keyCode = '/' | kfGray; else { keyCode = ch; //if (keyFlags == kfShift) // keyFlags = 0; } keyname[0] = 0; if (keyCode & kfGray) strcpy(keyname, "G+"); strcat(keyname, c); } if ((keyFlags & (kfAlt | kfSpecial | kfGray)) == kfAlt) { if (keyCode >= 'a' && keyCode <= 'z') keyCode -= 'a' - 'A'; } if ((keyFlags & (kfCtrl | kfAlt | kfSpecial | kfGray)) == kfCtrl) { if (keyCode >= 'a' && keyCode < 'a' + 32) keyCode -= 'a' - 1; else if (keyCode >= 'A' && keyCode < 'A' + 32) keyCode -= 'A' - 1; } if (keyFlags & kfCtrl) if (keyCode < 32) keyCode += 64; keyCode |= keyFlags; if (keyCode & kfKeyUp) strcat(name, "UP "); else strcat(name, "DN "); if (keyCode & kfAlt) strcat(name, "A+"); if (keyCode & kfCtrl) strcat(name, "C+"); if (keyCode & kfGray) strcat(name, "G+"); if (keyCode & kfShift) strcat(name, "S+"); strcat(name, keyname); Event.What = evKeyDown; if (flags & KC_KEYUP) { keyFlags |= kfKeyUp; Event.What = evKeyUp; } Event.Key.Code = keyCode; return name; } MRESULT CreateChild(HWND parent, GViewPeer *peer, PMData *pmData) { PMPTR ptr; ptr.len = sizeof(PMPTR); ptr.p = pmData; peer->hwndView = WinCreateWindow(parent, szClient, "FTE", WS_VISIBLE, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, FID_CLIENT, (void *)&ptr, NULL); assert(peer->hwndView != NULLHANDLE); peer->hwndVscroll = WinCreateWindow(parent, WC_SCROLLBAR, "", WS_VISIBLE | SBS_VERT | SBS_AUTOTRACK, 0, 0, 0, 0, peer->hwndView, HWND_TOP, 0, (void *)&ptr, NULL); assert(peer->hwndVscroll != NULLHANDLE); peer->hwndHscroll = WinCreateWindow(parent, WC_SCROLLBAR, "", WS_VISIBLE | SBS_HORZ | SBS_AUTOTRACK, 0, 0, 0, 0, peer->hwndView, HWND_TOP, 0, (void *)&ptr, NULL); assert(peer->hwndHscroll != NULLHANDLE); return (MRESULT)TRUE; } BOOL CalcFrameSWP(HWND hwnd, PSWP pswp, BOOL bFrame) { BOOL bSuccess; RECTL rcl; rcl.xLeft = pswp->x; rcl.yBottom = pswp->y; rcl.xRight = pswp->x + pswp->cx; rcl.yTop = pswp->y + pswp->cy; bSuccess = WinCalcFrameRect(hwnd, &rcl, bFrame); pswp->x = rcl.xLeft; pswp->y = rcl.yBottom; pswp->cx = rcl.xRight - rcl.xLeft; pswp->cy = rcl.yTop - rcl.yBottom; return bSuccess; } MRESULT EXPENTRY FrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { GFramePeer *peer = (GFramePeer *) WinQueryWindowULong(hwnd, QWL_USER); if (peer) switch (msg) { case UWM_DESTROY: WinDestroyWindow(hwnd); return 0; case UWM_DESTROYHWND: WinDestroyWindow(LONGFROMMP(mp1)); return 0; case UWM_FILEDIALOG: return MRFROMLONG(WinFileDlg(HWND_DESKTOP, hwnd, (FILEDLG *)PVOIDFROMMP(mp1))); case UWM_DLGBOX: return MRFROMLONG(WinDlgBox(HWND_DESKTOP, hwnd, PFNWP(PVOIDFROMMP(mp1)), 0, LONGFROMMP(mp2), NULL)); case UWM_PROCESSDLG: return MRFROMLONG(WinProcessDlg(HWNDFROMMP(mp1))); case UWM_CHOICE: return MRFROMLONG(DoChoice(hwnd, (ChoiceInfo *)PVOIDFROMMP(mp1))); case UWM_CREATECHILD: //DosBeep(2500, 1000); return CreateChild(hwnd, (GViewPeer *)PVOIDFROMMP(mp1), (PMData *)PVOIDFROMMP(mp2)); case WM_TRANSLATEACCEL: // check for keys not to be translated { QMSG *qmsg = (QMSG *)mp1; USHORT vk = SHORT2FROMMP((qmsg->mp2)); USHORT fl = (USHORT)(SHORT1FROMMP((qmsg->mp1)) & (KC_ALT | KC_SHIFT | KC_CTRL | KC_KEYUP)); USHORT ch = SHORT1FROMMP((qmsg->mp2)); if ((vk == VK_MENU || vk == VK_F1) && fl == 0 || vk == VK_NEWLINE && fl == KC_ALT || vk == VK_ENTER && fl == KC_ALT || vk == VK_SPACE && fl == KC_ALT) return (MRESULT)FALSE; if ((ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') && (fl & KC_ALT)) return (MRESULT)FALSE; if (PMDisableAccel) if (fl & KC_ALT) if (vk >= VK_F1 && vk <= VK_F24) return (MRESULT)FALSE; } break; /*case WM_CALCFRAMERECT: { PRECTL rcl = (PRECTL)PVOIDFROMMP(mp1); USHORT isFrame = SHORT1FROMMP(mp2); BOOL fSuccess = LONGFROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); if (ShowToolBar && fSuccess) { SWP swpToolBar; HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); if (isFrame) rcl->yTop -= swpToolBar.cy; else rcl->yTop += swpToolBar.cy; } return MRFROMLONG(fSuccess); }*/ case WM_QUERYTRACKINFO: { MRESULT mr; mr = peer->oldFrameProc(hwnd, msg, mp1, mp2); if (mr == (MRESULT)FALSE) return mr; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if ((SHORT1FROMMP(mp1) & TF_MOVE) != TF_MOVE) { PTRACKINFO pti; pti = (PTRACKINFO) PVOIDFROMMP(mp2); pti->cxGrid = peer->Frame->Top->Peer->pmData->cxChar; pti->cyGrid = peer->Frame->Top->Peer->pmData->cyChar; pti->cxKeyboard = peer->Frame->Top->Peer->pmData->cxChar; pti->cyKeyboard = peer->Frame->Top->Peer->pmData->cyChar; pti->fs |= TF_GRID; } DosReleaseMutexSem(hmtxPMData); return mr; } case WM_MINMAXFRAME: { PSWP pswp = (PSWP) PVOIDFROMMP(mp1); if (pswp->fl & SWP_MAXIMIZE) { GView *v; int cnt; SWP swpMenu; SWP swpToolBar; HWND hwndMenu = WinWindowFromID(hwnd, FID_MENU); HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndMenu, &swpMenu); swpMenu.x = 0; swpMenu.y = 0; swpMenu.cx = cxScreen - 2 * cxBorder; swpMenu.cy = cyScreen; WinSendMsg(hwndMenu, WM_ADJUSTWINDOWPOS, MPFROMP(&swpMenu), MPARAM(0)); if (ShowToolBar) { WinQueryWindowPos(hwndToolBar, &swpToolBar); swpToolBar.x = 0; swpToolBar.y = 0; swpToolBar.cx = cxScreen - 2 * cxBorder; swpToolBar.cy = cyScreen; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); pswp->cx = cxScreen - cxScrollBar; pswp->cy = cyScreen - cyTitleBar - swpMenu.cy - swpToolBar.cy; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } pswp->cy -= cnt * cyScrollBar; if (pswp->cy < 0) pswp->cy = 0; if (v) { pswp->cx /= v->Peer->pmData->cxChar; if (pswp->cx > MAXXSIZE) pswp->cx = MAXXSIZE; pswp->cx *= v->Peer->pmData->cxChar; pswp->cy /= v->Peer->pmData->cyChar; if (pswp->cy > MAXYSIZE) pswp->cy = MAXYSIZE; pswp->cy *= v->Peer->pmData->cyChar; } pswp->cy += cnt * cyScrollBar; pswp->cx += cxBorder * 2 + cxScrollBar; pswp->cy += cyBorder * 2 + cyTitleBar + swpMenu.cy + swpToolBar.cy; pswp->y = cyScreen - pswp->cy + cyBorder; DosReleaseMutexSem(hmtxPMData); return (MRESULT)FALSE; } } break; case WM_ADJUSTWINDOWPOS: { PSWP pswp = (PSWP) PVOIDFROMMP(mp1); if (pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_MAXIMIZE)) { GView *v; int cnt; SWP swpToolBar; if (pswp->cx < 0 || pswp->cy <= cyTitleBar + 2 * cyBorder) break; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); //printf("Before 1: %d %d | %d %d\n", pswp->cx, pswp->x, pswp->cy, pswp->y); CalcFrameSWP(hwnd, pswp, TRUE); if (ShowToolBar) { HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); swpToolBar.x = 0; swpToolBar.y = 0; swpToolBar.cx = pswp->cx; swpToolBar.cy = pswp->cy; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } pswp->cy -= swpToolBar.cy; pswp->cx -= cxScrollBar; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } pswp->cy -= cnt * cyScrollBar; //if (pswp->cy < 0) pswp->cy = 0; if (v) { pswp->cx /= v->Peer->pmData->cxChar; //if (pswp->cx < 8) pswp->cx = 8; if (pswp->cx > MAXXSIZE) pswp->cx = MAXXSIZE; pswp->cx *= v->Peer->pmData->cxChar; pswp->cy /= v->Peer->pmData->cyChar; //if (pswp->cy < cnt * 2) pswp->cy = cnt * 2; if (pswp->cy > MAXYSIZE) pswp->cy = MAXYSIZE; pswp->cy *= v->Peer->pmData->cyChar; } pswp->cy += cnt * cyScrollBar; pswp->cx += cxScrollBar; pswp->cy += swpToolBar.cy; CalcFrameSWP(hwnd, pswp, FALSE); DosReleaseMutexSem(hmtxPMData); } } break; case WM_QUERYFRAMECTLCOUNT: { SHORT sCount = SHORT1FROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); GView *v; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); v = peer->Frame->Top; while (v) { sCount += (SHORT)3; v = v->Prev; if (v == peer->Frame->Top) break; } if (ShowToolBar) sCount++; DosReleaseMutexSem(hmtxPMData); return MRESULT(sCount - 1); } case WM_FORMATFRAME: { SHORT sCount = SHORT1FROMMR(peer->oldFrameProc(hwnd, msg, mp1, mp2)); PSWP pswp; HWND Bhwnd; GView *v; int x, w, h, fl, y; int ctl, cnt; int Hy, H1, yPos; HWND hwndToolBar = WinWindowFromID(hwnd, FID_MTOOLBAR); SWP swpToolBar; PRECTL prcl; pswp = (PSWP) mp1; prcl = (PRECTL) mp2; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); sCount--; cnt = 0; v = peer->Frame->Top; while (v) { cnt++; v = v->Prev; if (v == peer->Frame->Top) break; } if (cnt == 0) { DosReleaseMutexSem(hmtxPMData); return MRFROMSHORT(sCount); } fl = pswp[sCount].fl; x = pswp[sCount].x; y = pswp[sCount].y; w = pswp[sCount].cx; h = pswp[sCount].cy; Bhwnd = pswp[sCount].hwndInsertBehind; if (ShowToolBar) { swpToolBar = pswp[sCount]; WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = hwndToolBar; pswp[sCount].fl = fl; pswp[sCount].x = cxBorder; pswp[sCount].cx = w; if (ShowToolBar == 1) { pswp[sCount].y = y + h - swpToolBar.cy; pswp[sCount].cy = swpToolBar.cy; h -= swpToolBar.cy; if (prcl) prcl->yTop -= swpToolBar.cy; } else if (ShowToolBar == 2) { pswp[sCount].y = y; pswp[sCount].cy = swpToolBar.cy; y += swpToolBar.cy; h -= swpToolBar.cy; if (prcl) prcl->yBottom += swpToolBar.cy; } sCount++; } ctl = 0; v = peer->Frame->Top; H1 = (h - cyScrollBar * cnt) / cnt; H1 /= v->Peer->pmData->cyChar; H1 *= v->Peer->pmData->cyChar; yPos = 0; while (v) { v = v->Prev; if (ctl == cnt - 1) { Hy = h - yPos - cyScrollBar; Hy /= v->Peer->pmData->cyChar; Hy *= v->Peer->pmData->cyChar; } else { Hy = H1; } pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndView; pswp[sCount].x = x; pswp[sCount].cx = w - cxScrollBar; pswp[sCount].y = yPos + y + cyScrollBar; pswp[sCount].cy = Hy; sCount++; pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndHscroll; pswp[sCount].x = x; pswp[sCount].cx = w - cxScrollBar; pswp[sCount].y = yPos + y; pswp[sCount].cy = cyScrollBar; yPos += cyScrollBar; sCount++; pswp[sCount].fl = fl; pswp[sCount].hwndInsertBehind = Bhwnd; Bhwnd = pswp[sCount].hwnd = v->Peer->hwndVscroll; pswp[sCount].x = x + w - cxScrollBar; pswp[sCount].cx = cxScrollBar; pswp[sCount].y = yPos - cyScrollBar + y; pswp[sCount].cy = Hy + cyScrollBar; yPos += Hy; sCount++; ctl++; if (v == peer->Frame->Top) break; } DosReleaseMutexSem(hmtxPMData); return MRFROMSHORT(sCount); } } return peer->oldFrameProc(hwnd, msg, mp1, mp2); } /*MRESULT EXPENTRY SizerWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_CREATE: break; case WM_DESTROY: break; case WM_BUTTON1DOWN: case WM_BUTTON1UP: case WM_MOUSEMOVE: break; case WM_PAINT: { SWP swp; HPS hps; RECTL rc; POINTL pt; WinQueryWindowPos(hwnd, &swp); hps = WinBeginPaint(hwnd, (HPS)NULL, &rc); GpiSetColor(hps, CLR_GRAY); GpiSetBackColor(hps, CLR_PALEGRAY); if (swp.cy > 2 && swp.cx > 2) { ptl.x = 1; ptl.y = 1; GpiMove(hps, &ptl); ptl.x += swp.cx - 2; ptl.y += swp.cy - 2; GpiBox(hps, DRO_FILL, &ptl, 0, 0); } GpiSetColor(hps, CLR_WHITE); ptl.x = 0; ptl.y = 0; GpiMove(hps, &ptl); ptl.y += swp.cy; GpiLine(hps, &ptl); ptl.x += swp.cx; GpiLine(hps, &ptl); GpiSetColor(hps, CLR_GRAY); ptl.y = 0; GpiLine(hps, &ptl); ptl.x = 0; GpiLine(hps, &ptl); WinEndPaint(hps); } break; } return WinDefWndProc(hwnd, msg, mp1, mp2); } */ MRESULT EXPENTRY AVIOWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { PMPTR *ptr = 0; PMData *pmData = (PMData *)WinQueryWindowULong(hwnd, QWL_USER); BYTE bBlank[2] = " "; SHORT cxClient, cyClient; HDC hdc; SIZEL sizl; PDRAGINFO pDragInfo; PDRAGITEM pDragItem; switch (msg) { case WM_CREATE: ptr = (PMPTR *)mp1; pmData = ptr ? (PMData *)ptr->p : 0; assert(pmData != 0); assert(WinSetWindowULong(hwnd, QWL_USER, (ULONG)pmData) == TRUE); hdc = WinOpenWindowDC(hwnd); VioCreatePS(&pmData->hvps, MAXYSIZE, MAXXSIZE, 0, 1, 0); sizl.cx = sizl.cy = 0; pmData->hps = GpiCreatePS(hab, hdc, &sizl, PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC); VioAssociate(hdc, pmData->hvps); if (WindowFont[0] != 0) { int x, y; if (sscanf(WindowFont, "%dx%d", &x, &y) == 2) VioSetDeviceCellSize((SHORT)y, (SHORT)x, pmData->hvps); } VioGetDeviceCellSize(&pmData->cyChar, &pmData->cxChar, pmData->hvps); bBlank[1] = hcPlain_Background; VioScrollUp(0, 0, -1, -1, -1, bBlank, pmData->hvps); return 0; case WM_DESTROY: VioAssociate(NULLHANDLE, pmData->hvps); VioDestroyPS(pmData->hvps); GpiDestroyPS(pmData->hps); pmData->Peer->pmData = 0; return 0; case UWM_DESTROY: { GViewPeer *Peer = pmData->Peer; WinDestroyWindow(Peer->hwndVscroll); WinDestroyWindow(Peer->hwndHscroll); WinDestroyWindow(Peer->hwndView); } return 0; case WM_ERASEBACKGROUND: return (MRESULT) FALSE; case WM_CLOSE: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_CLOSE", "FTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return (MRESULT) FALSE; case WM_SIZE: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; cxClient = SHORT1FROMMP(mp2); cyClient = SHORT2FROMMP(mp2); WinDefAVioWindowProc(hwnd, (USHORT)msg, (ULONG)mp1, (ULONG)mp2); if (cxClient <= pmData->cxChar || cyClient <= pmData->cyChar || reportSize == 0) { DosReleaseMutexSem(hmtxPMData); break; } Peer->wW = cxClient / pmData->cxChar; Peer->wH = cyClient / pmData->cyChar; if (hwnd == WinQueryFocus(HWND_DESKTOP)) { WinDestroyCursor(hwnd); WinCreateCursor(hwnd, pmData->cxChar * Peer->cX, pmData->cyChar * (Peer->wH - Peer->cY - 1) + pmData->cyChar * (100 - Peer->cEnd) / 100, pmData->cxChar, pmData->cyChar * (Peer->cEnd - Peer->cStart) / 100, CURSOR_TYPE, NULL); WinShowCursor(hwnd, TRUE); } //DosBeep(500, 100); if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SIZE", "FTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } } DosReleaseMutexSem(hmtxPMData); break; case WM_ACTIVATE: case WM_SETSELECTION: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SETFOCUS", "FTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_SETFOCUS: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; if (SHORT1FROMMP(mp2)) { WinCreateCursor(hwnd, pmData->cxChar * Peer->cX, pmData->cyChar * (Peer->wH - Peer->cY - 1) + pmData->cyChar * (100 - Peer->cEnd) / 100, pmData->cxChar, pmData->cyChar * (Peer->cEnd - Peer->cStart) / 100, CURSOR_TYPE, NULL); WinShowCursor(hwnd, TRUE); Peer->wState |= sfFocus; } else { WinDestroyCursor(hwnd); Peer->wState &= ~sfFocus; } } DosReleaseMutexSem(hmtxPMData); if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_SETFOCUS", "FTE/PM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_VSCROLL: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_VSCROLL", "ftePM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return 0; case WM_HSCROLL: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_HSCROLL", "ftePM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return 0; case WM_COMMAND: if (SHORT1FROMMP(mp1) >= 8192) { if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_COMMAND", "ftePM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } } break; case WM_CHAR: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_CHAR", "ftePM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } return (MRESULT) TRUE; case WM_MOUSEMOVE: { long b; b = 0; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) b |= 1; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) b |= 2; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) b |= 4; if (b == 0) break; } case WM_BUTTON1DOWN: case WM_BUTTON1DBLCLK: case WM_BUTTON1UP: case WM_BUTTON2DOWN: case WM_BUTTON2DBLCLK: case WM_BUTTON2UP: case WM_BUTTON3DOWN: case WM_BUTTON3DBLCLK: case WM_BUTTON3UP: if (WinPostMsg(pmData->hwndWorker, msg, mp1, mp2) == FALSE) { WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "WinPostMsg failed, WM_MOUSE", "ftePM", 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE); } break; case WM_PAINT: DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); { GViewPeer *Peer = pmData->Peer; WinBeginPaint(hwnd, pmData->hps, NULL); if (Peer->wH > 0 && Peer->wH <= MAXYSIZE && Peer->wW > 0 && Peer->wW <= MAXXSIZE) VioShowBuf(0, (SHORT)(MAXXSIZE * Peer->wH * 2), pmData->hvps); WinEndPaint(pmData->hps); } DosReleaseMutexSem(hmtxPMData); return 0; case DM_DRAGOVER: { char buf[1024] = ""; pDragInfo = (PDRAGINFO) mp1; DrgAccessDraginfo( pDragInfo ); pDragItem = DrgQueryDragitemPtr( pDragInfo, 0 ); // Don't accept multi select and non-file DrgQueryNativeRMF(pDragItem, sizeof(buf), buf); if (pDragInfo->cditem > 1 || strstr(buf, "DRM_OS2FILE") == 0) return (MRFROM2SHORT((DOR_NEVERDROP), (DO_UNKNOWN))); else return (MRFROM2SHORT((DOR_DROP), (DO_UNKNOWN))); } case DM_DROP: { pDragInfo = (PDRAGINFO)mp1; DrgAccessDraginfo(pDragInfo); pDragItem = DrgQueryDragitemPtr(pDragInfo, 0); DrgQueryStrName(pDragItem->hstrContainerName,100,dragname); DrgQueryStrName(pDragItem->hstrSourceName,100,dragname+strlen(dragname)); WinPostMsg(pmData->hwndWorker, UWM_DROPPEDFILE, 0, 0); } break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY ObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_CREATE: PMPTR *ptr = (PMPTR *)mp1; GViewPeer *peer = ptr ? (GViewPeer *)ptr->p : 0; assert(WinSetWindowULong(hwnd, QWL_USER, (ULONG)peer) == TRUE); break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); } MRESULT EXPENTRY CreatorWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case UWM_CREATEWORKER: { GViewPeer *peer = (GViewPeer *)mp1; PMData *pmData = (PMData *)mp2; PMPTR ptr; ptr.len = sizeof(ptr); ptr.p = peer; //DosBeep(2500, 1000); peer->hwndWorker = pmData->hwndWorker = WinCreateWindow(HWND_OBJECT, szObject, "Worker", 0, 0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, (void *)&ptr, NULL); assert(peer->hwndWorker != NULLHANDLE); return (MRESULT)TRUE; } case UWM_CREATEFRAME: { GFramePeer *peer = (GFramePeer *)PVOIDFROMMP(mp1); FRAMECDATA fcdata; fcdata.cb = sizeof(FRAMECDATA); fcdata.flCreateFlags = flFrame; fcdata.hmodResources = 0; fcdata.idResources = 1; //DosBeep(2500, 1000); peer->hwndFrame = WinCreateWindow(HWND_DESKTOP, WC_FRAME, NULL, 0, 0, 0, 0, 0, hwndCreatorUser, HWND_TOP, 1, &fcdata, NULL); assert(peer->hwndFrame != NULLHANDLE); WinSetWindowULong(peer->hwndFrame, QWL_USER, (ULONG)peer); peer->oldFrameProc = WinSubclassWindow(peer->hwndFrame, (PFNWP) FrameWndProc); if (ShowToolBar) { peer->hwndToolBar = CreateToolBar(peer->hwndFrame, peer->hwndFrame, FID_MTOOLBAR); assert(peer->hwndToolBar != NULLHANDLE); } return (MRESULT)TRUE; } case UWM_CREATEMAINMENU: { GFramePeer *peer = (GFramePeer *)mp1; char *Menu = (char *)PVOIDFROMMP(mp2); HWND hwnd, hwndMenu; char font[256]; ULONG AttrFound = 0; LONG len = -1; hwnd = WinWindowFromID(peer->hwndFrame, FID_MENU); if (hwnd != NULLHANDLE) { if (len == -1) { AttrFound = 0; len = WinQueryPresParam(hwnd, PP_FONTNAMESIZE, PP_FONTHANDLE, &AttrFound, sizeof(font), font, 0); } WinDestroyWindow(hwnd); } hwndMenu = CreatePMMainMenu(peer->hwndFrame, peer->hwndFrame, Menu); if (len > 0) WinSetPresParam(hwndMenu, AttrFound, len, font); WinSendMsg(peer->hwndFrame, WM_UPDATEFRAME, MPFROMLONG(FCF_MENU), 0); return (MRESULT)hwndMenu; } case UWM_CREATEPOPUPMENU: { GFramePeer *peer = (GFramePeer *)mp1; int MenuId = LONGFROMMP(mp2); static HWND hwnd = 0; POINTL ptl; char font[256]; ULONG AttrFound = 0; ULONG len; if (hwnd != 0) { WinDestroyWindow(hwnd); hwnd = 0; } hwnd = CreatePMMenu(HWND_DESKTOP, peer->hwndFrame, MenuId, 0, 0); WinQueryMsgPos(hab, &ptl); len = WinQueryPresParam(peer->menuBar, PP_FONTNAMESIZE, PP_FONTHANDLE, &AttrFound, sizeof(font), font, 0); if (len > 0) WinSetPresParam(hwnd, AttrFound, len, font); WinPopupMenu(HWND_DESKTOP, peer->Frame->Active->Peer->hwndView, hwnd, ptl.x, ptl.y, 0, PU_HCONSTRAIN | PU_VCONSTRAIN | PU_NONE | PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_MOUSEBUTTON3); return (MRESULT)TRUE; } } return WinDefWindowProc(hwnd, msg, mp1, mp2); } int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { QMSG qmsg; GFrame *f; GView *v; if (view) *view = 0; if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 0; } EventBuf.What = evNone; Event->What = evNone; //DosBeep(800, 10); if (WaitTime != -1) { if (WinPeekMsg(hab, &qmsg, NULLHANDLE, 0, 0, PM_NOREMOVE) == FALSE) return 0; } if (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0) == FALSE) return -1; //DosBeep(800, 10); f = frames; while (f) { v = f->Top; while (frames && v) { if (v->Peer->hwndWorker == qmsg.hwnd) { if (FocusCapture && v != FocusCapture) { WinSetFocus(HWND_DESKTOP, FocusCapture->Peer->hwndView); frames = f; break; } if (view) *view = v; switch (qmsg.msg) { /*case WM_ACTIVATE: case WM_SETSELECTION: if (SHORT1FROMMP(qmsg.mp1) == TRUE) { if (!v->IsActive()) v->Parent->SelectView(v); DosBeep(800, 10); return 0; } break;*/ case WM_SETFOCUS: if (SHORT1FROMMP(qmsg.mp2) == TRUE) { if (!v->IsActive()) v->Parent->SelectView(v); //DosBeep(800, 10); return 0; } break; case UWM_NOTIFY: //DosBeep(200, 200); Event->What = evNotify; Event->Msg.View = v; Event->Msg.Model = (EModel *)qmsg.mp1; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = (long)qmsg.mp2; frames = f; return 0; case UWM_DROPPEDFILE: if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evCommand; Event->Msg.View = v; Event->Msg.Command = cmDroppedFile; Event->Msg.Param1 = 0; Event->Msg.Param2 = &dragname; frames = f; return 0; case WM_SIZE: frames = f; //DosBeep(500, 500); v->Resize(v->Peer->wW, v->Peer->wH); return 0; case WM_VSCROLL: //DosBeep(200, 2000); if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evNone; Event->Msg.View = v; Event->Msg.Param1 = 0; Event->Msg.Param2 = 0; switch (SHORT2FROMMP(qmsg.mp2)) { case SB_LINEUP: Event->What = evCommand; Event->Msg.Command = cmVScrollUp; Event->Msg.Param1 = 1; break; case SB_LINEDOWN: Event->What = evCommand; Event->Msg.Command = cmVScrollDown; Event->Msg.Param1 = 1; break; case SB_PAGEUP: Event->What = evCommand; Event->Msg.Command = cmVScrollPgUp; break; case SB_PAGEDOWN: Event->What = evCommand; Event->Msg.Command = cmVScrollPgDn; break; case SB_ENDSCROLL: WinSetFocus(HWND_DESKTOP, v->Parent->Active->Peer->hwndView); /* no break */ case SB_SLIDERPOSITION: case SB_SLIDERTRACK: { SHORT x = SHORT1FROMMP(qmsg.mp2); if (x != 0) { Event->What = evCommand; Event->Msg.Command = cmVScrollMove; if (v->Peer->sbVtotal > 32000) Event->Msg.Param1 = (x - 1) * v->Peer->sbVtotal / 32000; else Event->Msg.Param1 = x - 1; } } break; } return 0; case WM_HSCROLL: //DosBeep(800, 2000); if (!v->IsActive()) v->Parent->SelectView(v); Event->What = evNone; Event->Msg.View = v; Event->Msg.Param1 = 0; Event->Msg.Param2 = 0; switch (SHORT2FROMMP(qmsg.mp2)) { case SB_LINEUP: Event->What = evCommand; Event->Msg.Command = cmHScrollLeft; Event->Msg.Param1 = 1; break; case SB_LINEDOWN: Event->What = evCommand; Event->Msg.Command = cmHScrollRight; Event->Msg.Param1 = 1; break; case SB_PAGEUP: Event->What = evCommand; Event->Msg.Command = cmHScrollPgLt; break; case SB_PAGEDOWN: Event->What = evCommand; Event->Msg.Command = cmHScrollPgRt; break; case SB_ENDSCROLL: WinSetFocus(HWND_DESKTOP, v->Parent->Active->Peer->hwndView); /* no break */ case SB_SLIDERPOSITION: case SB_SLIDERTRACK: { SHORT x = SHORT1FROMMP(qmsg.mp2); if (x != 0) { Event->What = evCommand; Event->Msg.Command = cmHScrollMove; if (v->Peer->sbHtotal > 32000) Event->Msg.Param1 = (x - 1) * v->Peer->sbHtotal / 32000; else Event->Msg.Param1 = x - 1; } } break; } return 0; case WM_CLOSE: //DosBeep(500, 1500); frames = f; Event->What = evCommand; Event->Msg.View = v->Parent->Active; Event->Msg.Command = cmClose; return 0; case WM_COMMAND: //DosBeep(50, 2500); if (SHORT1FROMMP(qmsg.mp1) >= 8192) { Event->What = evCommand; Event->Msg.View = v->Parent->Active; Event->Msg.Command = (SHORT1FROMMP(qmsg.mp1) - 8192) + 65536; frames = f; return 0; } break; case WM_CHAR: //DosBeep(50, 500); Event->What = evNone; Event->Msg.View = v; ConvertKey(SHORT1FROMMP(qmsg.mp2), /* char */ SHORT2FROMMP(qmsg.mp2), /* virtual */ SHORT1FROMMP(qmsg.mp1), /* flags */ CHAR4FROMMP(qmsg.mp1), /* scan */ *Event); frames = f; return 0; case WM_BUTTON1DOWN: case WM_BUTTON2DOWN: case WM_BUTTON3DOWN: case WM_BUTTON1DBLCLK: case WM_BUTTON2DBLCLK: case WM_BUTTON3DBLCLK: if (!v->IsActive()) v->Parent->SelectView(v); case WM_BUTTON1UP: case WM_BUTTON2UP: case WM_BUTTON3UP: case WM_MOUSEMOVE: Event->Mouse.What = evNone; Event->Msg.View = v; Event->Mouse.X = ((SHORT)SHORT1FROMMP(qmsg.mp1)) / v->Peer->pmData->cxChar; Event->Mouse.Y = v->Peer->wH - ((SHORT)SHORT2FROMMP(qmsg.mp1)) / v->Peer->pmData->cyChar - 1; Event->Mouse.Buttons = 1; Event->Mouse.Count = 1; Event->Mouse.KeyMask = 0; if (WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000) Event->Mouse.KeyMask |= kfCtrl; if (WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000) Event->Mouse.KeyMask |= kfAlt; if (WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000) Event->Mouse.KeyMask |= kfShift; // printf("KeyFlags: %d\n", Event->Mouse.KeyMask); //DosBeep(2000, 50); frames = f; switch (qmsg.msg) { case WM_BUTTON1DOWN: Event->What = evMouseDown; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON1DBLCLK: Event->What = evMouseDown; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON1UP: Event->What = evMouseUp; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2DOWN: Event->What = evMouseDown; Event->Mouse.Buttons = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2DBLCLK: Event->What = evMouseDown; Event->Mouse.Buttons = 2; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON2UP: Event->What = evMouseUp; Event->Mouse.Buttons = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3DOWN: Event->What = evMouseDown; Event->Mouse.Buttons = 4; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3DBLCLK: Event->What = evMouseDown; Event->Mouse.Buttons = 4; Event->Mouse.Count = 2; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_BUTTON3UP: Event->What = evMouseUp; Event->Mouse.Buttons = 4; v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; case WM_MOUSEMOVE: Event->What = evMouseMove; Event->Mouse.Buttons = 0; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) Event->Mouse.Buttons |= 1; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) Event->Mouse.Buttons |= 2; if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) Event->Mouse.Buttons |= 4; if (Event->Mouse.Buttons != 0) { if (Event->Mouse.X != v->Peer->OldMouseX || Event->Mouse.Y != v->Peer->OldMouseY) { v->Peer->OldMouseX = Event->Mouse.X; v->Peer->OldMouseY = Event->Mouse.Y; return 0; } else if (Event->Mouse.X >= 0 && Event->Mouse.Y >= 0 && Event->Mouse.X < v->Peer->wW && Event->Mouse.Y < v->Peer->wH) { Event->What = evNone; } } } break; default: WinDispatchMsg(hab, &qmsg); return 0; } } v = v->Next; if (v == f->Top) break; } f = f->Next; if (f == frames) break; } WinDispatchMsg(hab, &qmsg); return 0; } static void _LNK_CONV WorkThread(void *) { habW = WinInitialize(0); hmqW = WinCreateMsgQueue(hab, 0); hwndCreatorWorker = WinCreateWindow(HWND_OBJECT, szCreator, "Creator", 0, 0, 0, 0, 0, HWND_OBJECT, HWND_TOP, 0, NULL, NULL); assert(hwndCreatorWorker != 0); // work thread started DosPostEventSem(WorkerStarted); ULONG ulPostCount; DosWaitEventSem(StartInterface, SEM_INDEFINITE_WAIT); DosResetEventSem(StartInterface, &ulPostCount); //DosBeep(200, 200); if (gui->Start(gui->fArgc, gui->fArgv) == 0) { gui->doLoop = 1; //DosBeep(500, 500); while (gui->doLoop) gui->ProcessEvent(); gui->Stop(); } WinDestroyMsgQueue(hmqW); WinTerminate(habW); //DosBeep(500, 500); WinPostQueueMsg(hmq, WM_QUIT, 0, 0); _endthread(); } /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) { HWND parent; View = view; // wX = 0; // wY = 0; wW = XSize; wH = YSize; sbVtotal = 0; sbVstart = 0; sbVamount = 0; sbHtotal = 0; sbHstart = 0; sbHamount = 0; wState = 0; cVisible = 1; cStart = 0; // % cEnd = 100; OldMouseX = OldMouseY = 0xFFFF; pmData = (PMData *)malloc(sizeof(PMData)); pmData->Peer = this; pmData->hvps = 0; pmData->cxChar = 8; pmData->cyChar = 14; pmData->hwndWorker = 0; parent = View->Parent->Peer->hwndFrame; WinSendMsg(hwndCreatorWorker, UWM_CREATEWORKER, MPFROMP(this), MPFROMP(pmData)); WinSendMsg(parent, UWM_CREATECHILD, MPFROMP(this), MPFROMP(pmData)); } GViewPeer::~GViewPeer() { WinSendMsg(hwndView, UWM_DESTROY, 0, 0); WinDestroyWindow(hwndWorker); free(pmData); } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; char *p = (char *) Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtCellStr(p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); p += W << 1; } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; USHORT WW = (USHORT)(W << 1); char *p = (char *) Cell; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { VioReadCellStr((char *)p, &WW, (USHORT)(Y + I), (USHORT)X, pmData->hvps); p += W << 1; } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; char *p = (char *) Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtCellStr(p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; char *p = (char *) &Cell; int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } for (I = 0; I < H; I++) { if (I + Y == cY) Hidden = PMHideCursor(); VioWrtNCell(p, (USHORT)(W), (USHORT)(Y + I), (USHORT)X, pmData->hvps); if (Hidden) PMShowCursor(); } DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell FillCell = (TCell)(Fill << 8); int Hidden = 0; DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); if (Y < 0 || Y >= wH || X < 0 || X >= wW || Y + H < 0 || Y + H > wH || X + W < 0 || X + W > wW) { //fprintf(stderr, // "X:%d, Y:%d, W:%d, H:%d, wW:%d, wH:%d\n", // X, Y, W, H, wW, wH); DosReleaseMutexSem(hmtxPMData); return -1; } Hidden = PMHideCursor(); switch (Way) { case csUp: VioScrollUp((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csDown: VioScrollDn((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csLeft: VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; case csRight: VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, pmData->hvps); break; } if (Hidden) PMShowCursor(); DosReleaseMutexSem(hmtxPMData); return 0; } int GViewPeer::ConSetSize(int X, int Y) { wW = X; wH = Y; return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; if (Y >= wH) Y = wH - 1; cX = X; cY = Y; if (wState & sfFocus) return PMSetCursorPos(); else return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; if (wState & sfFocus) return PMShowCursor(); else return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; if (wState & sfFocus) return PMHideCursor(); else return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } int GViewPeer::ConSetCursorSize(int Start, int End) { cStart = Start; cEnd = End; if (wState & sfFocus) return PMSetCursorPos(); else return 1; } int GViewPeer::ExpandHeight(int DeltaY) { if (View->Parent->Top == View->Next) return -1; if (DeltaY + wH < 3) return -1; if (View->Next->Peer->wH - DeltaY < 3) return -1; ConSetSize(wW, wH + DeltaY); //View->Next->Peer->wY += DeltaY; View->Next->ConSetSize(View->Next->Peer->wW, View->Next->Peer->wH - DeltaY); View->Parent->Peer->SizeFrame(); return 0; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; if (View->Parent == 0) return 0; WinEnableWindowUpdate(hwndVscroll, FALSE); if (sbVamount < sbVtotal) { if (sbVtotal > 32000) { int total = 32000; int start = total * sbVstart / sbVtotal; int amount = total * sbVamount / sbVtotal; WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT((amount), (total))), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, (MPFROMSHORT((start + 1))), (MPFROM2SHORT((1), (total - amount + 2)))); } else { WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT((sbVamount), (sbVtotal))), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, (MPFROMSHORT((sbVstart + 1))), (MPFROM2SHORT((1), (sbVtotal - sbVamount + 2)))); } } else { WinSendMsg(hwndVscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(0, 0), 0); WinSendMsg(hwndVscroll, SBM_SETSCROLLBAR, MPFROMSHORT(0), MPFROM2SHORT(0, 0)); } WinEnableWindowUpdate(hwndVscroll, TRUE); } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; if (View->Parent == 0) return 0; WinEnableWindowUpdate(hwndHscroll, FALSE); if (sbHtotal > sbHamount) { if (sbHtotal > 32000) { int total = 32000; int start = total * sbVstart / sbVtotal; int amount = total * sbVamount / sbVtotal; WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(amount, total)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(start + 1)), (MPFROM2SHORT(1, total - amount + 2))); } else { WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(sbHamount, sbHtotal)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(sbHstart + 1)), (MPFROM2SHORT(1, sbHtotal - sbHamount + 2))); } } else { WinSendMsg(hwndHscroll, SBM_SETTHUMBSIZE, (MPFROM2SHORT(0, 0)), 0); WinSendMsg(hwndHscroll, SBM_SETSCROLLBAR, (MPFROMSHORT(0)), (MPFROM2SHORT(0, 0))); } WinEnableWindowUpdate(hwndHscroll, TRUE); } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetCursorSize(cStart, cEnd); if (cVisible) ConShowCursor(); else ConHideCursor(); return 1; } int GViewPeer::PMShowCursor() { if (wState & sfFocus) WinShowCursor(hwndView, TRUE); return 1; } int GViewPeer::PMHideCursor() { if (wState & sfFocus) WinShowCursor(hwndView, FALSE); return 1; } int GViewPeer::PMSetCursorPos() { if (wState & sfFocus) { WinDestroyCursor(hwndView); WinCreateCursor(hwndView, pmData->cxChar * cX, pmData->cyChar * (wH - cY - 1) + pmData->cyChar * (100 - cEnd) / 100, pmData->cxChar, pmData->cyChar * (cEnd - cStart) / 100, CURSOR_TYPE, NULL); WinShowCursor(hwndView, TRUE); } return 1; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) : Parent(parent), Next(0), Prev(0), Peer(new GViewPeer(this, XSize, YSize)) { if (Parent) Parent->AddView(this); } GView::~GView() { if (FocusCapture == this) CaptureFocus(0); if (MouseCapture == this) CaptureMouse(0); if (Parent) Parent->RemoveView(this); if (Peer) { Peer->View = 0; delete Peer; } } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { if (Peer->ConSetSize(X, Y)) Resize(X, Y); else return 0; return 1; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } int GView::ConSetCursorSize(int Start, int End) { return Peer->ConSetCursorSize(Start, End); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &Event) { } void GView::Resize(int width, int height) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; int didFocus = 0; if (FocusCapture == 0) { if (CaptureFocus(1) == 0) return -1; didFocus = 1; } else if (FocusCapture != this) return -1; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; if (didFocus) CaptureFocus(0); return NewResult; } int GView::IsActive() { return (Parent->Active == this && Parent == frames); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else { Peer->wState &= ~sfFocus; } Repaint(); } int GView::CaptureMouse(int grab) { if (MouseCapture == 0) { if (grab) { MouseCapture = this; WinSetCapture(HWND_DESKTOP, Peer->hwndView); } else return 0; } else { if (grab || MouseCapture != this) return 0; else { MouseCapture = 0; WinSetCapture(HWND_DESKTOP, NULLHANDLE); } } return 1; } int GView::CaptureFocus(int grab) { if (FocusCapture == 0) { if (grab) { FocusCapture = this; WinSetFocus(HWND_DESKTOP, Peer->hwndView); } else return 0; } else { if (grab || FocusCapture != this) return 0; else FocusCapture = 0; } return 1; } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *aFrame, int Width, int Height) { Frame = aFrame; WinSendMsg(hwndCreatorUser, UWM_CREATEFRAME, MPFROMP(this), MPFROMLONG(0)); if (Width != -1 && Height != -1) ConSetSize(Width, Height); } GFramePeer::~GFramePeer() { WinStoreWindowPos("FTEPM", "Frame1", hwndFrame); WinSendMsg(hwndFrame, UWM_DESTROY, 0, 0); } int GFramePeer::ConSetSize(int X, int Y) { //return ::ConSetSize(X, Y); return 0; } int GFramePeer::ConQuerySize(int *X, int *Y) { // ::ConQuerySize(&fW, &fH); // if (X) *X = fW; // if (Y) *Y = fH; return 1; } int GFramePeer::ConSetTitle(const char *Title, const char *STitle) { char szTitle[256] = {0}; JustFileName(Title, szTitle, sizeof(szTitle)); if (szTitle[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(Title, szTitle, sizeof(szTitle)); if (szTitle[0] != '\0') // if there is something... strlcat(szTitle, " - ", sizeof(szTitle)); strlcat(szTitle, Title, sizeof(szTitle)); WinSetWindowText(hwndFrame, szTitle); return 1; } int GFramePeer::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { WinQueryWindowText(hwndFrame, MaxLen, Title); WinQueryWindowText(hwndFrame, SMaxLen, STitle); return 1; } void GFramePeer::MapFrame() { if (frames != frames->Next || WinRestoreWindowPos("FTEPM", "Frame1", hwndFrame) == FALSE) { WinQueryTaskSizePos(hab, 0, &swp); WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_MOVE | SWP_SIZE); } // WinSendMsg(Peer->hwndFrame, WM_UPDATEFRAME, 0, 0); SizeFrame(); ShowFrame(); } void GFramePeer::ShowFrame() { WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE); } void GFramePeer::SizeFrame() { POINTL ptl; GView *v = Frame->Top; SWP swp; SWP swpMenu; HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); SWP swpToolBar; if (ShowToolBar) { HWND hwndToolBar = WinWindowFromID(hwndFrame, FID_MTOOLBAR); WinQueryWindowPos(hwndToolBar, &swpToolBar); WinSendMsg(hwndToolBar, WM_ADJUSTWINDOWPOS, MPFROMP(&swpToolBar), MPARAM(0)); } else { swpToolBar.cy = 0; } WinQueryWindowPos(hwndMenu, &swpMenu); WinSendMsg(hwndMenu, WM_ADJUSTWINDOWPOS, MPFROMP(&swpMenu), MPARAM(0)); //WinEnableWindowUpdate(hwndFrame, FALSE); DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); ptl.x = v->Peer->wW * v->Peer->pmData->cxChar + cxScrollBar + 2 * cxBorder; ptl.y = 2 * cyBorder + cyTitleBar + swpMenu.cy + swpToolBar.cy; while (v) { v = v->Prev; ptl.y += v->Peer->wH * v->Peer->pmData->cyChar + cyScrollBar; if (v == Frame->Top) break; } reportSize = 0; DosReleaseMutexSem(hmtxPMData); WinQueryWindowPos(hwndFrame, &swp); swp.y = swp.y + swp.cy - ptl.y; swp.cx = ptl.x; swp.cy = ptl.y; WinSendMsg(hwndFrame, WM_ADJUSTWINDOWPOS, MPFROMP(&swp), MPARAM(0)); WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); DosRequestMutexSem(hmtxPMData, SEM_INDEFINITE_WAIT); reportSize = 1; DosReleaseMutexSem(hmtxPMData); swp.x = cxBorder; swp.y = cyBorder; if (ShowToolBar == 2) { swp.y += swpToolBar.cy; } v = Frame->Top; while (v) { v = v->Prev; swp.cx = v->Peer->wW * v->Peer->pmData->cxChar; swp.cy = cyScrollBar; WinSetWindowPos(v->Peer->hwndHscroll, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.y += cyScrollBar; swp.cy = v->Peer->wH * v->Peer->pmData->cyChar; WinSetWindowPos(v->Peer->hwndView, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.x = v->Peer->wW * v->Peer->pmData->cxChar + cxBorder; swp.y -= cyScrollBar; swp.cx = cxScrollBar; swp.cy = cyScrollBar + v->Peer->wH * v->Peer->pmData->cyChar; WinSetWindowPos(v->Peer->hwndVscroll, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE | SWP_MOVE); swp.y += cyScrollBar + v->Peer->wH * v->Peer->pmData->cyChar; swp.x = cxBorder; if (v == Frame->Top) break; } //WinEnableWindowUpdate(hwndFrame, TRUE); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) { Menu = 0; if (frames == 0) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Top = Active = 0; Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { GView *P = Top, *Q; if (P) do { Q = P; P = Q->Next; Q->Parent = 0; delete Q; } while (P != Top); Top = Active = 0; if (Peer) { delete Peer; Peer = 0; } if (Next == this) { frames = 0; //DosBeep(500, 500); // printf("No more frames\x7\x7\n"); } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; frames->Activate(); } Next = Prev = 0; } int GFrame::ConSetTitle(const char *Title, const char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; view->ConQuerySize(&newview->Peer->wW, &dmy); newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2 - 1; view->Peer->wH /= 2; InsertView(view, newview); view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); Peer->SizeFrame(); return 0; } int GFrame::ConCloseView(GView *view) { return 0; } int GFrame::ConResizeView(GView *view, int DeltaY) { return 0; } int GFrame::AddView(GView *view) { if (Active != 0) { return ConSplitView(Active, view); } else { // int W, H; view->Parent = this; view->Prev = view->Next = 0; // view->Peer->wX = 0; // view->Peer->wY = 0; // ConQuerySize(&W, &H); // view->ConSetSize(W, H); InsertView(Top, view); return 0; } } void GFrame::Update() { GView *v = Active; UpdateMenu(); while (v) { v->Update(); v = v->Next; if (v == Active) break; } } void GFrame::UpdateMenu() { } void GFrame::Repaint() { GView *v = Active; while (v) { v->Repaint(); v = v->Next; if (v == Active) break; } } void GFrame::InsertView(GView *Prev, GView *view) { if (!view) return ; if (Prev) { view->Prev = Prev; view->Next = Prev->Next; Prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return ; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; if (Top == view) { Top = view->Next; Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH + 1); } else { view->Prev->ConSetSize(view->Prev->Peer->wW, view->Prev->Peer->wH + view->Peer->wH + 1); } if (Active == view) { Active = view->Prev; WinSetFocus(HWND_DESKTOP, Active->Peer->hwndView); Active->Activate(1); } } Peer->SizeFrame(); } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; else if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { c->Activate(0); Active->Activate(1); WinSetFocus(HWND_DESKTOP, Active->Peer->hwndView); } } int GFrame::SelectView(GView *view) { if (Top == 0) return 0; if (FocusCapture != 0 || MouseCapture != 0) return 0; if (Active) Active->Activate(0); Active = view; if (Active) { Active->Activate(1); } //DosBeep(50, 500); frames = this; return 1; } void GFrame::Resize(int width, int height) { if (!Top) return; if (width < 8 || height < 2) return; if (Top == Top->Next) { Top->ConSetSize(width, height); } else { } } int GFrame::SetMenu(const char *Name) { //WinAlarm(HWND_DESKTOP, WA_NOTE); if (Menu && Name && strcmp(Name, Menu) == 0) return 1; free(Menu); Menu = strdup(Name); Peer->menuBar = (HWND)WinSendMsg(hwndCreatorUser, UWM_CREATEMAINMENU, MPFROMP(Peer), MPFROMP(Menu)); return 1; } int GFrame::ExecMainMenu(char Sub) { HWND hwnd; hwnd = WinWindowFromID(Peer->hwndFrame, FID_MENU); if (Sub != 0) { int count = LONGFROMMR(WinSendMsg(hwnd, MM_QUERYITEMCOUNT, 0, 0)); SHORT id; char buf[256]; int len; char srch[3] = "~x"; srch[1] = (char)toupper(Sub); //puts("mainmenu"); for (SHORT i = 0; i < count; i++) { id = SHORT1FROMMR(WinSendMsg(hwnd, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0)); if (id == MIT_ERROR) { puts("error"); } else { //printf("got %d %d\n", i, id); len = SHORT1FROMMR(WinSendMsg(hwnd, MM_QUERYITEMTEXT, MPFROM2SHORT((id), (sizeof(buf) - 1)), MPFROMP(buf))); buf[len] = 0; //puts(buf); srch[1] = (char)toupper(Sub); if (strstr(buf, srch) != 0) { WinSendMsg(hwnd, MM_SELECTITEM, (MPFROM2SHORT(id, 0)), 0); //printf("select %d %d\n", i, id); } else { srch[1] = (char)tolower(Sub); if (strstr(buf, srch) != 0) { WinSendMsg(hwnd, MM_SELECTITEM, (MPFROM2SHORT(id, 0)), 0); //printf("select %d %d\n", i, id); } } } } } else { WinPostMsg(hwnd, MM_STARTMENUMODE, MPFROM2SHORT((Sub ? TRUE : FALSE), FALSE), 0); } return 1; } int GFrame::PopupMenu(const char *Name) { int id = GetMenuId(Name); if (id == -1) return 0; WinSendMsg(hwndCreatorUser, UWM_CREATEPOPUPMENU, MPFROMP(Peer), MPFROMLONG(id)); return 1; } void GFrame::Show() { Update(); Peer->MapFrame(); } void GFrame::Activate() { frames = this; Update(); Peer->ShowFrame(); } // GUI GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); assert(0 == DosCreateMutexSem(0, &hmtxPMData, 0, 0)); cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER); cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER); cxScrollBar = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL); cyScrollBar = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL); cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); cyTitleBar = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR); // edit window class WinRegisterClass(hab, szClient, (PFNWP)AVIOWndProc, CS_SIZEREDRAW, 4); //WinRegisterClass(hab, szSizer, (PFNWP)SizerWndProc, CS_SIZEREDRAW, 4); // worker object-window class WinRegisterClass(hab, szObject, (PFNWP)ObjectWndProc, 0, 4); // window that created windows in thr 1 for thr 2 WinRegisterClass(hab, szCreator, (PFNWP)CreatorWndProc, 0, 0); hwndCreatorUser = WinCreateWindow(HWND_DESKTOP, szCreator, "FTEPM", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_TOP, 0, NULL, NULL); assert(0 == DosCreateEventSem(0, &WorkerStarted, 0, 0)); assert(0 == DosCreateEventSem(0, &StartInterface, 0, 0)); _beginthread(WorkThread, FAKE_BEGINTHREAD_NULL PM_STACK_SIZE, 0); ULONG ulPostCount; DosWaitEventSem(WorkerStarted, SEM_INDEFINITE_WAIT); DosResetEventSem(WorkerStarted, &ulPostCount); gui = this; } GUI::~GUI() { WinDestroyMsgQueue(hmq); WinTerminate(hab); gui = 0; } int GUI::ConGrabEvents(TEventMask EventMask) { return 0; } void GUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { if (Event.What != evNone) { if (view) view->HandleEvent(Event); } } int GUI::ConSuspend() { return 0; } int GUI::ConContinue() { return 0; } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { return ::ConGetEvent(EventMask, Event, WaitTime, Delete, view); } int GUI::ConPutEvent(const TEvent& Event) { EventBuf = Event; return 1; } int GUI::ConFlush() { return 1; } void GUI::ProcessEvent() { TEvent E; GView *v; if (frames == 0) return ; E.What = evNone; if (E.What == evNone) { if (ConGetEvent(evMouseDown | evCommand | evKeyDown, &E, 0, 1, &v) == -1) ; } if (E.What == evNone) { //DosBeep(500, 100); frames->Update(); //DosBeep(1000, 100); if (ConGetEvent(evMouseDown | evCommand | evKeyDown, &E, -1, 1, &v) == -1) ; } if (E.What != evNone) { v = E.Msg.View; DispatchEvent(v->Parent, v, E); } } int GUI::Run() { QMSG qmsg; doLoop = 1; DosPostEventSem(StartInterface); while (doLoop != 0 && WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0)) WinDispatchMsg(hab, &qmsg); return 1; } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int mode, char *Command) { char FailBuf[256]; char *Args; char *Prog; int rc; PID pid; ULONG sid; int ArgsSize; Prog = getenv("COMSPEC"); ArgsSize = 3 + strlen(Command) + 1; Args = (char *)malloc(ArgsSize); if (Args == NULL) { return -1; } if (*Command != 0) { strlcpy(Args, "/c ", ArgsSize); strlcat(Args, Command, ArgsSize); } else { Args[0] = 0; } { STARTDATA sd; memset((void *)&sd, 0, sizeof(sd)); sd.Length = sizeof(sd); sd.Related = SSF_RELATED_INDEPENDENT; sd.FgBg = SSF_FGBG_FORE; sd.TraceOpt = SSF_TRACEOPT_NONE; sd.PgmTitle = (Command && Command[0] != 0) ? Command : 0; sd.PgmName = Prog; sd.PgmInputs = Args; sd.TermQ = 0; sd.Environment = 0; sd.InheritOpt = SSF_INHERTOPT_PARENT; sd.SessionType = SSF_TYPE_DEFAULT; sd.IconFile = 0; sd.PgmHandle = 0; sd.PgmControl = SSF_CONTROL_VISIBLE;// | ((Command && Command[0] != 0) ? SSF_CONTROL_NOAUTOCLOSE : 0); sd.ObjectBuffer = FailBuf; sd.ObjectBuffLen = sizeof(FailBuf); rc = DosStartSession(&sd, &sid, &pid); } free(Args); return rc; } static int CreatePipeChild(ULONG *sid, PID *pid, HPIPE &hfPipe, char *Command) { static int PCount = 0; char szPipe[32]; char FailBuf[256]; char *Args; char *Prog; #if 0 int arglen = 0; RESULTCODES rc_code; #endif ULONG ulAction; //ULONG ulNew; HPIPE hfChildPipe; HFILE hfNewStdOut = (HFILE)-1, hfNewStdErr = (HFILE)-1; HFILE hfStdOut = (HFILE)1, hfStdErr = (HFILE)2; int rc; sprintf(szPipe, "\\PIPE\\FTE%d\\CHILD%d", getpid(), PCount); PCount++; rc = DosCreateNPipe(szPipe, &hfPipe, NP_NOINHERIT | NP_ACCESS_INBOUND, NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE | 1, 0, 4096, 0); if (rc != 0) return -1; rc = DosConnectNPipe (hfPipe); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) { DosClose(hfPipe); return -1; } rc = DosSetNPHState (hfPipe, NP_WAIT | NP_READMODE_BYTE); if (rc != 0) { DosClose(hfPipe); return -1; } rc = DosOpen (szPipe, &hfChildPipe, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE, NULL); if (rc != 0) { DosClose (hfPipe); return -1; } // Duplicate handles DosDupHandle(hfStdOut, &hfNewStdOut); DosDupHandle(hfStdErr, &hfNewStdErr); // Close existing handles for current process DosClose(hfStdOut); DosClose(hfStdErr); // Redirect existing handles to new file DosDupHandle(hfChildPipe, &hfStdOut); DosDupHandle(hfChildPipe, &hfStdErr); // Let started program inherit handles from parent Prog = getenv("COMSPEC"); #if 0 Args = (char *)malloc(strlen(Prog) + 1 + 3 + strlen(Command) + 1 + 1); if (Args == NULL) { DosClose(hfPipe); return -1; } strcpy(Args, Prog); arglen = strlen(Args) + 1; strcpy(Args + arglen, "/c "); arglen += 3; strcpy(Args + arglen, Command); arglen += strlen(Command) + 1; Args[arglen] = '\0'; #else int ArgsSize = 3 + strlen(Command) + 1; Args = (char *)malloc(ArgsSize); if (Args == NULL) { DosClose(hfPipe); return -1; } strlcpy(Args, "/c ", ArgsSize); strlcat(Args, Command, ArgsSize); #endif #if 0 rc = DosExecPgm(FailBuf, sizeof(FailBuf), EXEC_ASYNCRESULT, // | EXEC_BACKGROUND, Args, 0, &rc_code, Prog); #else { STARTDATA sd; memset((void *)&sd, 0, sizeof(sd)); sd.Length = sizeof(sd); sd.Related = SSF_RELATED_INDEPENDENT; sd.FgBg = SSF_FGBG_BACK; sd.TraceOpt = SSF_TRACEOPT_NONE; sd.PgmTitle = 0; sd.PgmName = Prog; sd.PgmInputs = Args; sd.TermQ = 0; sd.Environment = 0; sd.InheritOpt = SSF_INHERTOPT_PARENT; sd.SessionType = SSF_TYPE_DEFAULT; sd.IconFile = 0; sd.PgmHandle = 0; sd.PgmControl = SSF_CONTROL_INVISIBLE; sd.ObjectBuffer = FailBuf; sd.ObjectBuffLen = sizeof(FailBuf); rc = DosStartSession(&sd, sid, pid); } #endif free(Args); // Get back original handles DosDupHandle(hfNewStdOut, &hfStdOut); DosDupHandle(hfNewStdErr, &hfStdErr); // Close the duplicated handles - no longer needed DosClose(hfNewStdOut); DosClose(hfNewStdErr); DosClose(hfChildPipe); // pipe one way, close out write end if (rc != 0) { DosClose(hfPipe); return -1; } #if 0 pid = rc_code.codeTerminate; // get pid when successful sid = 0; #endif return 0; } static void _LNK_CONV PipeThread(void *p) { GPipe *pipe = (GPipe *)p; HAB hab; ULONG ulPostCount; ULONG used; PID pid; ULONG sid; HPIPE hfPipe; #if 0 RESULTCODES rc_code; #endif int rc; hab = WinInitialize(0); rc = CreatePipeChild(&sid, &pid, hfPipe, pipe->Command); if (rc != 0) { DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->reading = 0; if (pipe->notify) WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); DosReleaseMutexSem(pipe->Access); WinTerminate(hab); return; } // fprintf(stderr, "Pipe: Begin: %d\n", pipe->id); while (1) { rc = DosRead(hfPipe, pipe->buffer, pipe->buflen, &used); if (rc < 0) used = 0; DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->bufused = used; // fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); DosResetEventSem(pipe->ResumeRead, &ulPostCount); if (pipe->bufused == 0) break; if (pipe->notify && pipe->stopped) { WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); pipe->stopped = 0; } DosReleaseMutexSem(pipe->Access); if (pipe->DoTerm) break; DosWaitEventSem(pipe->ResumeRead, SEM_INDEFINITE_WAIT); if (pipe->DoTerm) break; } // fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); DosClose(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); #if 0 rc = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &rc_code, &pid, pid); pipe->RetCode = rc_code.codeResult; #else //DosStopSession(STOP_SESSION_SPECIFIED, sid); pipe->RetCode = 0; #endif pipe->reading = 0; if (pipe->notify) WinPostMsg(frames->Active->Peer->hwndWorker, UWM_NOTIFY, MPFROMLONG(pipe->notify), MPFROMLONG(pipe->id)); DosReleaseMutexSem(pipe->Access); WinTerminate(hab); } int GUI::OpenPipe(const char *Command, EModel *notify) { int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) return -1; if (0 != DosCreateMutexSem(0, &Pipes[i].Access, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].ResumeRead, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseMutexSem(Pipes[i].Access); return -1; } Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); Pipes[i].used = 1; // fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); // fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; DosReleaseMutexSem(Pipes[id].Access); return 1; } int GUI::ReadPipe(int id, void *buffer, size_t len) { int l; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; // DosQueryEventSem(Pipes[id].ResumeRead, &ulPostCount); // if (ulPostCount != 0) // return 0; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); // fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; // fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; DosPostEventSem(Pipes[id].ResumeRead); } } else if (Pipes[id].reading == 0) l = -1; else { l = 0; //DosBeep(200, 200); } // fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); DosReleaseMutexSem(Pipes[id].Access); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; DosPostEventSem(Pipes[id].ResumeRead); DosWaitThread(&Pipes[id].tid, DCWW_WAIT); } free(Pipes[id].buffer); free(Pipes[id].Command); DosCloseEventSem(Pipes[id].ResumeRead); DosCloseMutexSem(Pipes[id].Access); // fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return (Pipes[id].RetCode == 0); } int GUI::multiFrame() { return 1; } void DieError(int rc, const char *msg, ...) { va_list ap; char str[1024]; va_start(ap, msg); vsprintf(str, msg, ap); va_end(ap); if (hab == 0) hab = WinInitialize(0); if (hmq == 0) hmq = WinCreateMsgQueue(hab, 0); WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "FTE", 0, MB_OK | MB_ERROR); WinDestroyMsgQueue(hmq); WinTerminate(hab); exit(rc); } char ConGetDrawChar(unsigned int index) { static const char tab[] = "\xDA\xBF\xC0\xD9\xC4\xB3\xC2\xC3\xB4\xC1\xC5\x1A\xFA\x04\xC4\x18\x19\xB1\xB0\x1B\x1A"; assert(index < strlen(tab)); return tab[index]; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_ipf.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000006461�11331412504�012234� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_ipf.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_IPF #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsIPF_Normal 0 #define hsIPF_Symbol 1 #define hsIPF_Tag 2 #define hsIPF_Control 3 #define hsIPF_String 4 int Hilit_IPF(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int j; C = 0; NC = 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { case hsIPF_Normal: Color = CLR_Normal; if (i == 0 && *p == '.') { State = hsIPF_Control; Color = CLR_Control; } else if (*p == ':') { State = hsIPF_Tag; Color = CLR_Tag; } else if (*p == '&') { State = hsIPF_Symbol; Color = CLR_Symbol; } goto hilit; case hsIPF_Tag: Color = CLR_Tag; if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j, 1)) { } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = CLR_Tag; continue; } else if (*p == '\'') { State = hsIPF_String; Color = CLR_String; goto hilit; } else if (*p == '.') { ColorNext(); State = hsIPF_Normal; continue; } goto hilit; case hsIPF_String: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsIPF_Tag; continue; } goto hilit; case hsIPF_Symbol: Color = CLR_Symbol; if (*p == '.') { ColorNext(); State = hsIPF_Normal; continue; } goto hilit; case hsIPF_Control: State = hsIPF_Control; Color = CLR_Control; goto hilit; default: State = hsIPF_Normal; Color = CLR_Normal; hilit: ColorNext(); continue; } } } if (State == hsIPF_Symbol || State == hsIPF_Control || State == hsIPF_String) State = hsIPF_Normal; *ECol = C; return 0; } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte.cpp���������������������������������������������������������������������������������������0000644�0001750�0001750�00000025055�11602724002�011725� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* fte.cpp * * Copyright (c) 1994-1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_config.h" #include "c_desktop.h" #include "c_history.h" #include "egui.h" #include "ftever.h" #include "log.h" #include "s_files.h" #include "s_string.h" #include <stdio.h> #ifdef CONFIG_USE_LOCALE #include <locale.h> #endif #if defined(UNIX) /* default locations for the configuration files */ static const char * const Unix_RCPaths[] = { "/usr/local/etc/fte/system.fterc", "/etc/fte/system.fterc", "/usr/X11R6/lib/X11/fte/system.fterc", }; // variables used by vfte uid_t effuid; gid_t effgid; #endif /* UNIX */ char ConfigFileName[MAXPATH] = ""; static void Usage() { printf("Usage: " PROGRAM " [-?] [-h] [--help] [-CDHTmlrt] files...\n" "Version: " VERSION " " COPYRIGHT "\n" " You may distribute under the terms of either the GNU General Public\n" " License or the Artistic License, as specified in the README file.\n" "\n" "Options:\n" " -- End of options, only files remain.\n" " -+ Next option is file.\n" " -? -h --help Display usage.\n" " -! Ignore config file, use builtin defaults (also -c).\n" " -C[<.cnf>] Use specified configuration file (no arg=builtin).\n" #ifdef CONFIG_DESKTOP " -D[<.dsk>] Load/Save desktop from <.dsk> file (no arg=disable desktop).\n" #endif #ifdef CONFIG_HISTORY " -H[<.his>] Load/Save history from <.his> file (no arg=disable history).\n" #endif " -m[<mode>] Override mode for remaining files (no arg=no override).\n" " -l<line>[,<col>] Go to line (and column) in next file.\n" " -r Open next file as read-only.\n" #ifdef CONFIG_TAGS " -T[<tagfile>] Load tags file at startup.\n" " -t<tag> Locate specified tag.\n" #endif // " -p Load files into already running FTE.\n" ); } #ifndef UNIX /* * findPathExt() returns a ^ to the suffix in a file name string. If the * name contains a suffix, the pointer ^ts to the suffix' dot character, * if the name has no suffix the pointer points to the NUL terminator of * the file name string. * .lib: CBASE.LIB */ static char *findPathExt(char *filename) { char *p, *sps; for (p = filename, sps = NULL; *p; p++) { if (ISSLASH(*p)) sps = NULL; if (*p == '.') sps = p; } if (sps == NULL) sps = p; return sps; } #endif #if defined(NT) && defined(MSVC) && !defined(__WATCOMC__) char *getProgramName(char *name) { return _pgmptr; } #endif #if defined(OS2) && defined(__EMX__) // argv[0] on emx does not contain full path #define INCL_DOS #include <os2.h> static char *getProgramName(char *name) { char ProgramName[MAXPATH]; PTIB tib; PPIB pib; DosGetInfoBlocks(&tib, &pib); if (DosQueryModuleName(pib->pib_hmte, sizeof(ProgramName), ProgramName) != 0) return name; return strdup(ProgramName); } #endif static int GetConfigFileName(int /*argc*/, char **argv, char *ConfigFileName) { // NOTE: function assumes that ConfigFileName's size is MAXPATH char CfgName[MAXPATH] = ""; if (ConfigFileName[0] == 0) { #if defined(UNIX) // ? use ./.fterc if by current user ? ExpandPath("~/.fterc", CfgName, sizeof(CfgName)); #elif defined(DOS) || defined(DOSP32) strlcpy(CfgName, argv[0], sizeof(CfgName)); char *extPtr; if ((extPtr = findPathExt(CfgName)) != NULL) { *extPtr = 0; strlcat(CfgName, ".cnf", sizeof(CfgName)); } #elif defined(OS2) || defined(NT) char home[MAXPATH] = ""; char *ph; #if defined(OS2) ph = getenv("HOME"); if (ph) strlcpy(home, ph, sizeof(home)); #endif #if defined(NT) ph = getenv("HOMEDRIVE"); if (ph) strlcpy(home, ph, sizeof(home)); ph = getenv("HOMEPATH"); if (ph) strlcat(home, ph, sizeof(home)); #endif if (home[0]) { strlcpy(CfgName, home, sizeof(CfgName)); Slash(CfgName, 1); strlcat(CfgName, "fte.cnf", sizeof(CfgName)); } if (!home[0] || access(CfgName, 0) != 0) { strlcpy(CfgName, argv[0], sizeof(CfgName)); char *extPtr; if ((extPtr = findPathExt(CfgName)) != NULL) { *extPtr = 0; strlcat(CfgName, ".cnf", sizeof(CfgName)); } } #endif strlcpy(ConfigFileName, CfgName, MAXPATH); } if (access(ConfigFileName, 0) == 0) return 1; #if defined(UNIX) for (size_t i = 0; i < FTE_ARRAY_SIZE(Unix_RCPaths); ++i) if (access(Unix_RCPaths[i], 0) == 0) { strlcpy(ConfigFileName, Unix_RCPaths[i], MAXPATH); return 1; } #endif return 0; } static int CmdLoadConfiguration(int &argc, char **argv) { int ign = 0; int QuoteAll = 0, QuoteNext = 0; int haveConfig = 0; int Arg; for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-') { if (strcmp(argv[Arg], "--help") == 0) { Usage(); return 0; } int debug_clean = strcmp(argv[Arg], "--debugclean") == 0; if (debug_clean || strcmp(argv[Arg], "--debug") == 0) { #ifndef FTE_NO_LOGGING char path[MAXPATH]; #ifdef UNIX ExpandPath("~/.fte", path, sizeof(path)); #else JustDirectory(argv[0], path, sizeof(path)); #endif Slash(path,1); strlcat(path, "fte.log", sizeof(path)); if (debug_clean) unlink(path); globalLog.SetLogFile(path); printf("Trace Log in: %s\n", path); #else printf("--debug, --debugclean disabled\n"); #endif } else QuoteAll = 1; } else if (argv[Arg][1] == '!') { ign = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; } else if (argv[Arg][1] == '?' || argv[Arg][1] == 'h') { Usage(); return 0; } else if (argv[Arg][1] == 'c' || argv[Arg][1] == 'C') { if (argv[Arg][2]) { ExpandPath(argv[Arg] + 2, ConfigFileName, sizeof(ConfigFileName)); haveConfig = 1; } else ign = 1; } } } if (!haveConfig && GetConfigFileName(argc, argv, ConfigFileName) == 0) { // should we default to internal #ifdef DEFAULT_INTERNAL_CONFIG ign = 1; #endif } if (ign) { if (UseDefaultConfig() == -1) DieError(1, "Error in internal configuration??? FATAL!"); } else { if (LoadConfig(argc, argv, ConfigFileName) == -1) DieError(1, "Failed to load configuration file '%s'.\n" "Use '-C' option.", ConfigFileName); } for (Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { if (argv[Arg][1] == '-' && argv[Arg][2] == '\0') { QuoteAll = 1; } else if (argv[Arg][1] == '+') { QuoteNext = 1; #ifdef CONFIG_DESKTOP } else if (argv[Arg][1] == 'D') { ExpandPath(argv[Arg] + 2, DesktopFileName, sizeof(DesktopFileName)); if (IsDirectory(DesktopFileName)) { Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); } if (DesktopFileName[0] == 0) { LoadDesktopOnEntry = 0; SaveDesktopOnExit = 0; } else { LoadDesktopOnEntry = 1; } #endif #ifdef CONFIG_HISTORY } else if (argv[Arg][1] == 'H') { strlcpy(HistoryFileName, argv[Arg] + 2, sizeof(HistoryFileName)); if (HistoryFileName[0] == 0) { KeepHistory = 0; } else { KeepHistory = 1; } #endif } } else { if (LoadDesktopOnEntry == 2) { LoadDesktopOnEntry = 0; SaveDesktopOnExit = 0; DesktopFileName[0] = 0; } } } if (LoadDesktopOnEntry == 2) LoadDesktopOnEntry = 1; return 1; } int main(int argc, char **argv) { #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR ); _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); #endif //_DEBUG && MSVC && MSVCDEBUG #if defined(__EMX__) || (defined(NT) && defined(MSVC) && !defined(__WATCOMC__)) argv[0] = getProgramName(argv[0]); #endif #if defined(UNIX) && defined(LINUX) // security fix - when we need to be suid to access vcsa effuid = geteuid(); effgid = getegid(); if (getuid() != effuid) seteuid(getuid()); if (getgid() != effgid) setegid(getgid()); #endif #ifdef CONFIG_USE_LOCALE // setup locale from environment setlocale(LC_ALL, ""); #endif if (CmdLoadConfiguration(argc, argv) == 0) return 1; STARTFUNC("main"); EGUI *g = new EGUI(argc, argv, ScreenSizeX, ScreenSizeY); if (gui == 0 || g == 0) DieError(1, "Failed to initialize display\n"); gui->Run(); #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif delete gui; gui = 0; #if defined(__EMX__) free(argv[0]); #endif #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif #if defined(_DEBUG) && defined(MSVC) && defined(MSVCDEBUG) _CrtSetDbgFlag((_CRTDBG_LEAK_CHECK_DF) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); #endif //_DEBUG && MSVC && MSVCDEBUG #if defined(__DEBUG_ALLOC__) _dump_allocated(64); #endif ENDFUNCRC(0); //return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_bind.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000006527�11344266042�012045� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_bind.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_BIND_H #define C_BIND_H #include "c_mode.h" // EM_MENUS #include "console.h" #include "e_regex.h" #include "o_model.h" #define ABBREV_HASH 16 class EMode; class EEventMap; class EKeyMap; class EKey; class EAbbrev; class EView; class EColorize; struct KeySel { TKeyCode Mask; TKeyCode Key; }; class EMode { public: EMode *fNext; char *fName; char *MatchName; char *MatchLine; RxNode *MatchNameRx; RxNode *MatchLineRx; EBufferFlags Flags; EEventMap *fEventMap; EMode *fParent; #ifdef CONFIG_SYNTAX_HILIT EColorize *fColorize; #endif char filename[256]; EMode(EMode *aMode, EEventMap *Map, const char *aName); ~EMode(); #ifdef CONFIG_ABBREV EAbbrev *FindAbbrev(const char *string); #endif }; class EKeyMap { public: EKeyMap *fParent; EKey *fKeys; EKeyMap(); ~EKeyMap(); void AddKey(EKey *aKey); EKey *FindKey(TKeyCode aKey); }; class EEventMap { public: EEventMap *Next; EEventMap *Parent; char *Name; EKeyMap *KeyMap; char *Menu[EM_MENUS]; // main + local EAbbrev *abbrev[ABBREV_HASH]; EEventMap(const char *AName, EEventMap *AParent); ~EEventMap(); void SetMenu(int which, const char *What); char *GetMenu(int which); #ifdef CONFIG_ABBREV int AddAbbrev(EAbbrev *ab); #endif }; enum CommandType_e { CT_COMMAND, CT_NUMBER, CT_STRING, CT_VARIABLE, CT_CONCAT /* concatenate strings */ }; struct CommandType { CommandType_e type; short repeat; short ign; union { long num; char *string; } u; }; struct ExMacro { char *Name; unsigned Count; CommandType *cmds; }; class EKey { public: KeySel fKey; int Cmd; EKeyMap *fKeyMap; EKey *fNext; EKey(const char *aKey); EKey(const char *aKey, EKeyMap *aKeyMap); ~EKey(); }; #ifdef CONFIG_ABBREV class EAbbrev { public: EAbbrev *next; int Cmd; char *Match; char *Replace; EAbbrev(const char *aMatch, const char *aReplace); EAbbrev(const char *aMatch, int aCmd); ~EAbbrev(); }; #endif class ExState { // state of macro execution public: int Macro; int Pos; int GetStrParam(EView *view, char *str, size_t buflen); int GetIntParam(EView *view, int *value); }; extern EMode *Modes; extern EEventMap *EventMaps; extern int CMacros; extern ExMacro *Macros; int GetCharFromEvent(TEvent &E, char *Ch); const char *GetCommandName(int Command); EMode *FindMode(const char *Name); EEventMap *FindEventMap(const char *Name); EEventMap *FindActiveMap(EMode *Mode); EMode *GetModeForName(const char *FileName); int CmdNum(const char *Cmd); void ExecKey(EKey *Key); EKey *SetKey(EEventMap *aMap, const char *Key); int GetKeyName(char *Key, size_t KeySize, KeySel &ks); int NewCommand(const char *Name); int RunCommand(int Command); int AddCommand(int no, int cmd, int count, int ign); int AddString(int no, const char *Command); int AddNumber(int no, long number); int AddVariable(int no, int number); int AddConcat(int no); int HashStr(const char *str, int maxim); void SetWordChars(char *w, const char *s); #endif // C_BIND_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_ascii.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000000772�11344266047�012230� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_ascii.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_ASCII_H #define I_ASCII_H #include "console.h" #include "i_oview.h" class ExASCII: public ExViewNext { int Pos, LPos; public: ExASCII(); virtual ~ExASCII(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); }; #endif // I_ASCII_H ������./src/g_menu.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000003367�11344266046�012437� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_menu.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "gui.h" #include "sysdep.h" int MenuCount = 0; mMenu *Menus = 0; int NewMenu(const char *Name) { int n; Menus = (mMenu *) realloc((void *) Menus, sizeof(mMenu) * (MenuCount + 1)); n = MenuCount; Menus[n].Name = strdup(Name); Menus[n].Count = 0; Menus[n].Items = 0; MenuCount++; return n; } int NewItem(int menu, const char *Name) { int n; assert (menu < MenuCount); Menus[menu].Items = (mItem *) realloc(Menus[menu].Items, sizeof(mItem) * (Menus[menu].Count + 1)); n = Menus[menu].Count; Menus[menu].Items[n].SubMenu = -1; Menus[menu].Items[n].Name = Name ? strdup(Name) : 0; Menus[menu].Items[n].Arg = 0; Menus[menu].Items[n].Cmd = -1; Menus[menu].Count++; return n; } int NewSubMenu(int menu, const char *Name, int submenu, int Type) { int n; assert (menu < MenuCount); Menus[menu].Items = (mItem *) realloc(Menus[menu].Items, sizeof(mItem) * (Menus[menu].Count + 1)); n = Menus[menu].Count; Menus[menu].Items[n].SubMenu = submenu; Menus[menu].Items[n].Name = Name ? strdup(Name) : 0; Menus[menu].Items[n].Arg = 0; Menus[menu].Items[n].Cmd = Type; Menus[menu].Count++; return n; } int GetMenuId(const char *Name) { if (Name) for (int i = 0; i < MenuCount; i++) if (strcmp(Name, Menus[i].Name) == 0) return i; return -1; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/defcfg.fte������������������������������������������������������������������������������������0000644�0001750�0001750�00000043737�07616042657�012413� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������menu File { item "&Open...\tF3" { FileOpen } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "&Close\tAlt+Q" { FileClose } item; item "&Next\tAlt+Left" { FileNext } item "&Previous\tAlt+Right" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "&Delete line\tCtrl+Y" { KillLine } item "&Split line\tCtrl+L" { LineSplit } item "&Join line\tCtrl+J" { LineJoin } item; item "&Quote Literal...\tCtrl+Q" { InsertChar } } menu Translate { item "Upperc&ase" { BlockCaseUp } item "Low&ercase" { BlockCaseDown } item "Tog&glecase" { BlockCaseToggle } } menu Block { item "&Unmark\tEsc" { BlockUnmark } item "Mark &Line\tAlt+L" { BlockMarkLine } item "Mark &Stream\tAlt+A" { BlockMarkStream } item "Mark &Column\tAlt+K" { BlockMarkColumn } item; item "&Indent\tAlt+I" { BlockIndent } item "U&nindent\tAlt+U" { BlockUnindent } item; item "&Write..." { BlockWrite } item "&Read..." { BlockRead } item "&Print" { BlockPrint } item; submenu "Translat&e", Translate; } menu Search { item "&Find...\tCtrl+F" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item "Repeat last find re&verse\tCtrl+B" { FindRepeatReverse } item "Repeat last find &once\tCtrl+N" { FindRepeatOnce } item "Incremental &search\tCtrl+S" { IncrementalSearch } item; item "&Place Bookmark..." { PlaceBookmark } item "Goto &Bookmark..." { GotoBookmark } item; item "&Match paren\tAlt+-" { MatchBracket } item "&Goto line...\tAlt+J" { MoveToLine } } menu Tools { item "&Compile\tF9" { Compile "make -k " } item "&Grep" { Compile "grep -n " } item; item "Sh&ell" { RunProgram "" } item; item "Go to prev &error\tF11" { CompilePrevError } item "Go to &next error\tF12" { CompileNextError } item; item "&Messages\tS+F9" { ViewMessages } } menu Window { item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "&Routines\tCtrl+I" { ListRoutines } item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Options { item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Auto indent\tC+O C+A" { ToggleAutoIndent } item "&Case sensitive\tC+O C+C" { ToggleMatchCase } item "Trim &EOL spaces\tC+O C+E" { ToggleTrim } item "&Read only\tC+O C+R" { ToggleReadOnly } item "&Undo/Redo\tC+O C+U" { ToggleUndo } item "&Show markers\tC+O C+." { ToggleShowMarkers; WinRefresh } item; item "&Word wrap\tC+O C+W" { ToggleWordWrap } item "&Left margin...\tC+O A+[" { ChangeLeftMargin } item "Ri&ght margin...\tC+O A+]" { ChangeRightMargin } item; item "&Tab size...\tC+O C+T" { ChangeTabSize; WinRefresh } item "S&how tabs\tC+O Tab" { ToggleShowTabs; WinRefresh } item "E&xpand tabs\tC+O C+Tab" { ToggleExpandTabs; WinRefresh } item "&Print to... " { SetPrintDevice } } menu Help { item "&Show key" { ShowKey } item; item "&About..." { ShowVersion } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Block", Block; submenu "&Search", Search; submenu "&Tools", Tools; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "&Unmark\tEsc" { BlockUnmark } item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "P&aste Column\tAlt+Ins" { BlockPasteColumn } item; item "Delete &line\tCtrl+Y" { KillLine } item "Delete to &EOL\tAlt+End" { KillToLineEnd } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } } eventmap MODEL { # basic commands, for files, directories, message view, etc. key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F9] { RunProgram } key [S+F10] { LocalMenu } key [A+G-Up] { WinPrev } key [A+G-Down] { WinNext } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+Q] { FileClose } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S-F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } # key [G+0] { ToggleInsert } # key [G+S+0] { InsertString 'foo' } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } key [C+B] { FindRepeatReverse } key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+F] { Find } key [C+I] { ListRoutines } key [C+J] { LineJoin } key [C+L] { FindRepeat } key [C+M] { DirOpen } key [C+N] { FindRepeatOnce } key [C+Q] { InsertChar } key [C+R] { FindReplace } key [C+T] { KillWord } key [C+Y] { KillLine } key [C+E] { LineTrim } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+U] { BlockUnindent } key [A+W] { MainMenu 'W' } key [C+S] { IncrementalSearch } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } # key [C+O_C+M] { ChangeMode } # key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [A+F5] { ShowEntryScreen } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } # key [C+S+A] { ASCIITable } key [G+*] { LineInsert ; MoveUp; ScrollUp } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } # key [A+C+A] { FileOpen 'BUFFER.CPP' } key [C+K] { ShowKey } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } colorize PLAIN { SyntaxParser = 'PLAIN'; color { { 'Normal', '7 0' }, }; } mode PLAIN { Colorizer = 'PLAIN'; } eventmap LIST { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [Esc] { Cancel } key [G-Enter] { Activate } } eventmap BUFFERS: LIST { key [C+F10] { FileClose } key [F2] { FileSave } } eventmap ROUTINES: LIST { } eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [G-Enter] { Activate } } menu Directory { item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirMain { submenu "&Directory", Directory; submenu "&Navigate", Navigate; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap DIRECTORY: MLIST { MainMenu = 'DirMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [C+D] { DeleteFile } key [A+D] { MainMenu 'D' } key [A+N] { MainMenu 'N' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } menu Messages { item "&Close\tAlt+Q" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Tools", Tools; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } ���������������������������������./src/c_hilit.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000013365�11602724002�012230� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_hilit.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_HILIT_H #define C_HILIT_H #include "c_mode.h" #include "console.h" #include "e_regex.h" #include <sys/types.h> class EBuffer; class ELine; typedef unsigned short hlState; typedef unsigned char hsState; #define CK_MAXLEN 64 #define HILIT_P(proc) \ int proc(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) //typedef int (*SyntaxProc)(EBuffer *BF, int LN, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap); typedef HILIT_P((*SyntaxProc)); int Indent_Plain(EBuffer *B, int Line, int PosCursor); HILIT_P(Hilit_Plain); #ifdef CONFIG_SYNTAX_HILIT /* highlighting state */ #ifdef CONFIG_HILIT_C HILIT_P(Hilit_C); #endif #ifdef CONFIG_HILIT_PERL HILIT_P(Hilit_PERL); #endif #ifdef CONFIG_HILIT_MAKE HILIT_P(Hilit_MAKE); #endif #ifdef CONFIG_HILIT_REXX HILIT_P(Hilit_REXX); #endif #ifdef CONFIG_HILIT_IPF HILIT_P(Hilit_IPF); #endif #ifdef CONFIG_HILIT_ADA HILIT_P(Hilit_ADA); #endif #ifdef CONFIG_HILIT_MSG HILIT_P(Hilit_MSG); #endif #ifdef CONFIG_HILIT_SH HILIT_P(Hilit_SH); #endif #ifdef CONFIG_HILIT_PASCAL HILIT_P(Hilit_PASCAL); #endif #ifdef CONFIG_HILIT_TEX HILIT_P(Hilit_TEX); #endif #ifdef CONFIG_HILIT_FTE HILIT_P(Hilit_FTE); #endif #ifdef CONFIG_HILIT_CATBS HILIT_P(Hilit_CATBS); #endif #ifdef CONFIG_HILIT_SIMPLE HILIT_P(Hilit_SIMPLE); #endif #ifdef CONFIG_INDENT_C int Indent_C(EBuffer *B, int Line, int PosCursor); #endif #ifdef CONFIG_INDENT_REXX int Indent_REXX(EBuffer *B, int Line, int PosCursor); #endif #ifdef CONFIG_INDENT_SIMPLE int Indent_SIMPLE(EBuffer *B, int Line, int PosCursor); #endif #define HILIT_CLRD() \ ChColor(((Color < COUNT_CLR) ? Colors[Color] : Color - COUNT_CLR)) #define ColorChar() \ do {\ BPos = C - Pos; \ if (B && BPos >= 0 && BPos < Width) \ B[BPos].Set(*p, HILIT_CLRD()); \ if (StateMap) StateMap[i] = (hsState)(State & 0xFF); \ } while (0) // MoveChar(B, C - Pos, Width, *p, Color, 1); // if (StateMap) StateMap[i] = State; } #define NextChar() do { i++; p++; len--; C++; } while (0) #define ColorNext() do { ColorChar(); NextChar(); } while (0) #define UntilMatchBrace(first, cmd) \ do { \ int Count[] = { 0, 0, 0, }; \ switch (first) \ { \ case '{': ++Count[0]; break; \ case '[': ++Count[1]; break; \ case '(': ++Count[2]; break; \ } \ \ while (len > 0) { \ switch (*p) { \ case '{': ++Count[0]; break; \ case '}': --Count[0]; break; \ case '[': ++Count[1]; break; \ case ']': --Count[1]; break; \ case '(': ++Count[2]; break; \ case ')': --Count[2]; break; \ } \ cmd; \ if (TEST_ZERO) \ break; \ } \ } while (0) #define HILIT_VARS(ColorTable, Line) \ int BPos; \ ChColor *Colors = ColorTable; \ ChColor Color = CLR_Normal; \ size_t i; \ size_t len = Line->Count; \ char *p = Line->Chars; \ int NC = 0, C = 0; \ int TabSize = BFI(BF, BFI_TabSize); \ int ExpandTabs = BFI(BF, BFI_ExpandTabs); //#define HILIT_VARS2() // int len1 = len; // char *last = p + len1 - 1; #define IF_TAB() \ if (*p == '\t' && ExpandTabs) { \ NC = NextTab(C, TabSize); \ if (StateMap) StateMap[i] = hsState(State);\ if (B) MoveChar(B, C - Pos, Width, ' ', HILIT_CLRD(), NC - C);\ if (BFI(BF, BFI_ShowTabs)) ColorChar(); /*{ ChColor t = Color; Color = CLR_Punctuation; ColorChar(); Color = t; }*/\ i++,len--,p++;\ C = NC;\ continue;\ } static inline bool isZeroArray(int* Count, size_t len) { for (unsigned i = 0; i < len; ++i) if (Count[i] != 0) return 0; return 1; } #define TEST_ZERO isZeroArray(Count, FTE_ARRAY_SIZE(Count)) struct ColorKeywords { int TotalCount; int count[CK_MAXLEN]; char *key[CK_MAXLEN]; }; struct HTrans { char *match; int matchLen; long matchFlags; int nextState; int color; RxNode *regexp; void InitTrans(); }; struct HState { int transCount; int firstTrans; int color; ColorKeywords keywords; char *wordChars; long options; int nextKwdMatchedState; int nextKwdNotMatchedState; int nextKwdNoCharState; void InitState(); int GetHilitWord(ChColor &clr, const char *str, size_t len); }; class HMachine { public: int stateCount; int transCount; HState *state; HTrans *trans; HMachine(); ~HMachine(); void AddState(HState &aState); void AddTrans(HTrans &aTrans); HState *LastState() { return state + stateCount - 1; } }; class EColorize { public: StlString Name; EColorize *Next; EColorize *Parent; int SyntaxParser; ColorKeywords Keywords; // keywords to highlight HMachine *hm; ChColor Colors[COUNT_CLR]; EColorize(const char *AName, const char *AParent); ~EColorize(); int SetColor(int clr, const char *value); }; extern EColorize *Colorizers; EColorize *FindColorizer(const char *AName); SyntaxProc GetHilitProc(int id); int IsState(hsState *Buf, hsState State, size_t Len); int LookAt(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord = 1, int CaseInsensitive = 0); static inline int LookAtNoCase(EBuffer *B, int Row, unsigned int Pos, const char *What, hsState State, int NoWord = 1) { return LookAt(B, Row, Pos, What, State, NoWord, 1); } #endif // CONFIG_SYNTAX_HILIT #endif // C_HILIT_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_rexx.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000036250�11602724002�012443� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_rexx.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_REXX #include "c_bind.h" #include "o_buflist.h" #include "sysdep.h" #include <ctype.h> #define hsREXX_Normal 0 #define hsREXX_Comment 1 #define hsREXX_String1 3 #define hsREXX_String2 4 #define hsREXX_Keyword 5 #define hsREXX_CommentL 6 int Hilit_REXX(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int wascall = 0; C = 0; NC = 0; for(i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch(State) { case hsREXX_Comment: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p+1) == '/')) { ColorNext(); set_normal: ColorNext(); State = hsREXX_Normal; continue; } goto hilit; case hsREXX_String1: Color = CLR_String; if (*p == '\'') { goto set_normal; } goto hilit; case hsREXX_String2: Color = CLR_String; if (*p == '"') { goto set_normal; } goto hilit; default: case hsREXX_Normal: if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (wascall) { State = hsREXX_Normal; Color = CLR_Function; wascall = 0; } else { if (BF->GetHilitWord(Color, Line->Chars + i, j, 1)) State = hsREXX_Keyword; else { int x; x = i + j; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsREXX_Normal; } } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); if (State == hsREXX_Keyword) if (strnicmp(Line->Chars + i, "CALL", 4) == 0) wascall = 1; i += j; len -= j; p += j; C += j; State = hsREXX_Normal; continue; } else if ((len >= 2) && ( (*p == '/') && (*(p+1) == '*') )) { State = hsREXX_Comment; Color = CLR_Comment; //hilit2: ColorNext(); hilit: ColorNext(); continue; } else if ((len >= 2) && (*p == '-') && (p[1] == '-')) { State = hsREXX_CommentL; Color = CLR_Comment; ColorNext(); ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && isdigit(*p)) ColorNext(); continue; } else if (*p == '\'') { State = hsREXX_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsREXX_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsREXX_CommentL: Color = CLR_Comment; goto hilit; } } } switch (State) { case hsREXX_String1: case hsREXX_String2: case hsREXX_CommentL: State = hsREXX_Normal; break; } *ECol = C; return 0; } #ifdef CONFIG_INDENT_REXX int REXX_Base_Indent = 4; int REXX_Do_Offset = 0; #define REXX_BASE_INDENT REXX_Base_Indent #define REXX_DO_OFFSET REXX_Do_Offset static int Match(int Len, int Pos, hsState *StateMap, const char *Text, const char *String, hsState State) { int L = strlen(String); if (Pos + L <= Len) if (StateMap == NULL || IsState(StateMap + Pos, State, L)) if (strnicmp(String, Text + Pos, L) == 0) return 1; return 0; } static int Match2(int Len, int Pos, hsState *StateMap, const char *Text, const char *String, hsState State) { int L = strlen(String); int i; for( i = 0; i < Pos; i++ ) if( Text[i] != ' ' ) return 0; if (Pos + L <= Len) if (StateMap == NULL || IsState(StateMap + Pos, State, L)) if (strnicmp(String, Text + Pos, L) == 0) return 1; return 0; } static int SearchMatch(int Count, EBuffer *B, int Row, int Ctx) { char *P; int L; int Pos; int StateLen; hsState *StateMap; int ICount = (Ctx == 2) ? Count : 0; Count = (Ctx == 2) ? 0 : Count; // Check all previous rows of the buffer for a matching "starting" keyword. // Count gives the "depth" we are in, must reach 0. // Ctx == 1 means we are looking for a mate for "end" // Ctx == 2 means we are looking for a mate for "else" // We try to find the indent of the line that "started" this "block" and return it. while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return -1; Pos = L - 1; if (L > 0) while (Pos >= 0) { if (isalpha(P[Pos])) { if( Ctx == 1 || Ctx == 3 ) { if (Match(L, Pos, StateMap, P, "do", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "loop", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "select", hsREXX_Keyword )) { Count++; if (Count == 0) { if (StateMap) free(StateMap); if( Ctx == 3 ) return B->LineIndented(Row); else return B->LineIndented(Row) + REXX_BASE_INDENT; } } else if (Match(L, Pos, StateMap, P, "end", hsREXX_Keyword)) { Count--; } } else if( Ctx == 4 ) { if (Match2(L, Pos, StateMap, P, "class", hsREXX_Keyword) ) { if (StateMap) free(StateMap); return B->LineIndented(Row) + REXX_BASE_INDENT; } } if (Ctx == 2 && Count == 0) { if (Match(L, Pos, StateMap, P, "if", hsREXX_Keyword)) { ICount++; if (ICount == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } else if (Match(L, Pos, StateMap, P, "else", hsREXX_Keyword)) { ICount--; } } } Pos--; } if (StateMap) free(StateMap); Row--; } return -1; } static int CheckLabel(EBuffer *B, int Line) { PELine L = B->RLine(Line); int P = B->CharOffset(L, B->LineIndented(Line)); int Cnt = 0; if (Line > 0 && B->RLine(Line - 1)->StateE != hsREXX_Normal) return 0; while ((P < L->Count) && (L->Chars[P] == ' ' || L->Chars[P] == 9)) P++; while (P < L->Count) { if (Cnt > 0) if (L->Chars[P] == ':') return 1; if (!(isalnum(L->Chars[P]) || (L->Chars[P] == '_'))) return 0; Cnt++; P++; } return 0; } static int SearchBackContext(EBuffer *B, int Row, char &ChFind) { char *P; int L; int Pos; int Count = -1; int StateLen; hsState *StateMap; int is_blank = 0; ChFind = '0'; while (Row >= 0) { P = B->RLine(Row)->Chars; L = B->RLine(Row)->Count; StateMap = NULL; if (B->GetMap(Row, &StateLen, &StateMap) == 0) return 0; Pos = L - 1; if (L > 0) while (Pos >= 0) { if (CheckLabel(B, Row) == 1) { Count++; ChFind = 'p'; if (Count == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } if (isalpha(P[Pos]) && (Pos == 0 || !isalpha(P[Pos - 1]))) { if (Match(L, Pos, StateMap, P, "do", hsREXX_Keyword) || Match(L, Pos, StateMap, P, "loop", hsREXX_Keyword)) { Count++; ChFind = 'd'; //} else if (Match(L, Pos, StateMap, P, "procedure", hsREXX_Keyword)) { //Count++; //ChFind = 'p'; } else if (Match(L, Pos, StateMap, P, "select", hsREXX_Keyword)) { Count++; ChFind = 's'; } else if (Match(L, Pos, StateMap, P, "method", hsREXX_Keyword)) { Count++; ChFind = 'm'; } else if (Match(L, Pos, StateMap, P, "properties", hsREXX_Keyword)) { Count++; ChFind = 'r'; } else if (Match2(L, Pos, StateMap, P, "class", hsREXX_Keyword)) { Count++; ChFind = 'c'; if (StateMap) free(StateMap); return B->LineIndented(Row) + REXX_BASE_INDENT; } else if (Match(L, Pos, StateMap, P, "otherwise", hsREXX_Keyword) && Count == 0) { //Count++; ChFind = 'o'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else if (Match(L, Pos, StateMap, P, "end", hsREXX_Keyword)) { Count--; ChFind = 'e'; } else if (is_blank < 5 && Match(L, Pos, StateMap, P, "then", hsREXX_Keyword)) { ChFind = 't'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else if (is_blank < 5 && Match(L, Pos, StateMap, P, "else", hsREXX_Keyword)) { ChFind = 'e'; if (StateMap) free(StateMap); return B->LineIndented(Row); } else { is_blank++; Pos--; continue; } if (Count == 0) { if (StateMap) free(StateMap); return B->LineIndented(Row); } } if (P[Pos] != ' ' && P[Pos] != 9) is_blank++; Pos--; } if (StateMap) free(StateMap); Row--; } return -1; } static int IndentComment(EBuffer *B, int Row, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0; char ChFind; if (Row > 0) { I = SearchBackContext(B, Row - 1, ChFind); if (I != -1) switch (ChFind) { case 's': case 'd': case 'c': case 't': case 'e': case 'o': // case 'r': // case 'm': I += REXX_BASE_INDENT; } else I = 0; if (B->RLine(Row - 1)->StateE == hsREXX_Comment) //if (LookAt(B, Row - 1, I, "/*", hsREXX_Comment, 0)) I += 1; } return I; } static int IndentNormal(EBuffer *B, int Line, int /*StateLen*/, hsState * /*StateMap*/) { int I = 0; if (CheckLabel(B, Line)) { return 0; } else if (LookAtNoCase(B, Line, 0, "end", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 1); } else if (LookAtNoCase(B, Line, 0, "else", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 2); } else if (LookAtNoCase(B, Line, 0, "catch", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 3); } else if (LookAtNoCase(B, Line, 0, "method", hsREXX_Keyword) || LookAtNoCase(B, Line, 0, "properties", hsREXX_Keyword)) { return SearchMatch(-1, B, Line - 1, 4); } else { char ChFind; I = SearchBackContext(B, Line - 1, ChFind); if (I == -1) return 0; switch (ChFind) { case 'p': if (LookAtNoCase(B, Line, 0, "return", hsREXX_Keyword)) return I; else return I + REXX_BASE_INDENT; case 's': case 'd': case 'c': case 'r': case 'm': return I + REXX_BASE_INDENT; case 't': case 'e': case 'o': if (LookAtNoCase(B, Line, 0, "do", hsREXX_Keyword)) return I + REXX_DO_OFFSET; else return I + REXX_BASE_INDENT; default: return I; } } } int Indent_REXX(EBuffer *B, int Line, int PosCursor) { int I; hsState *StateMap = NULL; int StateLen = 0; int OI; OI = I = B->LineIndented(Line); if (I != 0) B->IndentLine(Line, 0); if (B->GetMap(Line, &StateLen, &StateMap) == 0) return 0; if (StateLen > 0) { // line is not empty if (StateMap[0] == hsREXX_Comment) { I = IndentComment(B, Line, StateLen, StateMap); } else { I = IndentNormal(B, Line, StateLen, StateMap); } } else { I = IndentNormal(B, Line, 0, NULL); } if (StateMap) free(StateMap); if (I >= 0) B->IndentLine(Line, I); else I = 0; if (PosCursor == 1) { int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; if (X > B->LineLen(Line)) { X = B->LineLen(Line); if (X < I) X = I; } if (B->SetPosR(X, Line) == 0) return 0; } else if (PosCursor == 2) { if (B->SetPosR(I, Line) == 0) return 0; } return 1; } #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/conkbd.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000004757�11326137320�012066� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* conkbd.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef CONKBD_H #define CONKBD_H #define kfAltXXX 0x01000000 #define kfModifier 0x02000000 #define kfSpecial 0x00010000 #define kfAlt 0x00100000 #define kfCtrl 0x00200000 #define kfShift 0x00400000 #define kfGray 0x00800000 #define kfKeyUp 0x10000000 #define kfAll 0x00F00000 #define isAltXXX(x) (((x) & (kfAltXXX)) != 0) #define isAlt(x) (((x) & kfAlt) != 0) #define isCtrl(x) (((x) & kfCtrl) != 0) #define isShift(x) (((x) & kfShift) != 0) #define isGray(x) (((x) & kfGray) != 0) #define keyType(x) ((x) & kfAll) #define keyCode(x) ((x) & 0x000FFFFF) #define kbCode(x) (((x) & 0x0FFFFFFF) & ~(kfGray | kfAltXXX)) #define isAscii(x) ((((x) & (kfAlt | kfCtrl)) == 0) && (keyCode(x) < 256)) #define kbF1 (kfSpecial | 0x101) #define kbF2 (kfSpecial | 0x102) #define kbF3 (kfSpecial | 0x103) #define kbF4 (kfSpecial | 0x104) #define kbF5 (kfSpecial | 0x105) #define kbF6 (kfSpecial | 0x106) #define kbF7 (kfSpecial | 0x107) #define kbF8 (kfSpecial | 0x108) #define kbF9 (kfSpecial | 0x109) #define kbF10 (kfSpecial | 0x110) #define kbF11 (kfSpecial | 0x111) #define kbF12 (kfSpecial | 0x112) #define kbUp (kfSpecial | 0x201) #define kbDown (kfSpecial | 0x202) #define kbLeft (kfSpecial | 0x203) #define kbCenter (kfSpecial | 0x204) #define kbRight (kfSpecial | 0x205) #define kbHome (kfSpecial | 0x206) #define kbEnd (kfSpecial | 0x207) #define kbPgUp (kfSpecial | 0x208) #define kbPgDn (kfSpecial | 0x209) #define kbIns (kfSpecial | 0x210) #define kbDel (kfSpecial | 0x211) #define kbSpace 32 #define kbBackSp (kfSpecial | 8) #define kbTab (kfSpecial | 9) #define kbEnter (kfSpecial | 13) #define kbEsc (kfSpecial | 27) #define kbAlt (kfModifier | 0x301) #define kbCtrl (kfModifier | 0x302) #define kbShift (kfModifier | 0x303) #define kbCapsLock (kfModifier | 0x304) #define kbNumLock (kfModifier | 0x305) #define kbScrollLock (kfModifier | 0x306) #define kbPause (kfSpecial | 0x401) #define kbPrtScr (kfSpecial | 0x402) #define kbSysReq (kfSpecial | 0x403) #define kbBreak (kfSpecial | 0x404) #endif // CONKBD_H �����������������./src/ftever.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000000735�11326137320�012111� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef FTEVER_H #define FTEVER_H #define MAKE_VERSION(major,minor,release) ((major<<24L) | (minor << 16L) | release) #define PROG_FTE "fte" #define PROG_CFTE "cfte" #define PROGRAM PROG_FTE #define EXTRA_VERSION "-cvs" #define VERSION "0.50.02" EXTRA_VERSION #define VERNUM MAKE_VERSION(0x00, 0x50, 0x0002) #define COPYRIGHT "Copyright (c) 1994-1998 Marko Macek\n" \ "Copyright (c) 2000-2010 Others" #endif // FTEVER_H �����������������������������������./src/e_mark.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000002664�11333110353�012052� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef E_MARK_H #define E_MARK_H #include "e_buffer.h" #include <stdio.h> // FILE class EMark { public: EMark(const char *aName, const char *aFileName, EPoint aPoint, EBuffer *aBuffer = 0); ~EMark(); int SetBuffer(EBuffer *aBuffer); int RemoveBuffer(EBuffer *aBuffer); const char *GetName() const { return Name.c_str(); } const char *GetFileName() const { return FileName.c_str(); } EPoint &GetPoint(); EBuffer *GetBuffer() { return Buffer; } private: /* bookmark */ StlString Name; StlString FileName; EPoint Point; /* bookmark in file */ EBuffer *Buffer; }; class EMarkIndex { public: EMarkIndex(); ~EMarkIndex(); EMark *insert(const char *aName, const char *aFileName, EPoint aPoint, EBuffer* aBuffer = 0); EMark *insert(const char *aName, EBuffer* aBuffer, EPoint aPoint); EMark *locate(const char *aName); int remove(const char *aName); int view(EView *aView, const char *aName); // int MarkPush(EBuffer *B, EPoint P); // int MarkPop(EView *V); // int MarkSwap(EView *V, EBuffer *B, EPoint P); // int MarkNext(EView *V); // int MarkPrev(EView *V); EMark *pushMark(EBuffer *aBuffer, EPoint P); int popMark(EView *aView); int retrieveForBuffer(EBuffer *aBuffer); int storeForBuffer(EBuffer *aBuffer); int saveToDesktop(FILE *fp); private: StlVector<EMark*> Marks; }; extern EMarkIndex markIndex; #endif // E_MARK_H ����������������������������������������������������������������������������./src/fte-vag.mak�����������������������������������������������������������������������������������0000644�0001750�0001750�00000005361�07310774152�012500� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # # Makefile for VisualAge C++ version 3.00 # # EXE = OEXT = obj DEBUG = 0 #DEBUG = 1 CC = icc LINK = ilink RC = rc VOID = echo > NUL !if $(DEBUG) C_FLAGS = /Ti /Tx !else C_FLAGS = /O /Gs- !endif C_OPTIONS = /Q /Tl /G4 /Gm+ /DOS2 /DINCL_32 $(C_FLAGS) !if $(DEBUG) CPP_FLAGS = /Ti /Tm /Tx !else CPP_FLAGS = /O /Gs- !endif CPP_OPTIONS = /Q /G4 /Gm+ /DOS2 /DINCL_32 $(CPP_FLAGS) !if $(DEBUG) L_FLAGS = /DEBUG /DBGPACK !else L_FLAGS = /EXEPACK:2 /PACKC /PACKD /OPTF !endif L_OPTIONS = /BASE:0x010000 /EXEC /NOE /NOLOGO $(L_FLAGS) RC_OPT = -n C_SRC = C_H = CPP_SRC = CPP_HPP = !include objs.inc RES = LIBS = HLIB = DEF = .SUFFIXES: .SUFFIXES: .cpp .rc all: cfte.exe fte.exe ftepm.exe clipserv.exe cliputil.exe fte.cnf clean: -del bin2c.exe -del bin2c.map -del cfte.exe -del cfte.map -del clipserv.exe -del clipserv.map -del cliputil.exe -del cliputil.map -del defcfg.cnf -del defcfg.h -del fte.cnf -del fte.exe -del fte.his -del fte.map -del ftepm.exe -del ftepm.map -del ftepm.res -del *.obj clipserv.exe: clipserv.$(OEXT) clipserv.def $(VOID) <<clipserv.lnk clipserv.$(OEXT) $(L_OPTIONS) /OUT:$@ /MAP:clipserv.MAP $(LIBS) clipserv.def << $(LINK) @clipserv.lnk cliputil.exe: cliputil.$(OEXT) clip_vio.$(OEXT) cliputil.def $(VOID) <<cliputil.lnk cliputil.$(OEXT) clip_vio.$(OEXT) $(L_OPTIONS) /OUT:$@ /MAP:cliputil.MAP $(LIBS) cliputil.def << $(LINK) @cliputil.lnk cfte.exe: $(CFTE_OBJS) cfte.def $(VOID) <<cfte.lnk $(CFTE_OBJS) $(L_OPTIONS) /OUT:$@ /MAP:cfte.MAP $(LIBS) cfte.def << $(LINK) @cfte.lnk defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h fte.cnf: ..\config\* cfte.exe cfte ..\config\main.fte fte.cnf bin2c.obj: bin2c.cpp bin2c.exe: bin2c.obj $(VOID) <<bin2c.lnk bin2c.obj $(L_OPTIONS) /PM:VIO /OUT:$@ /MAP:bin2c.MAP $(LIBS) $(DEF) << $(LINK) @bin2c.lnk c_config.$(OEXT): defcfg.h fte.exe: $(OBJS) $(VIOOBJS) fte.def $(VOID) <<fte.lnk $(OBJS) $(VIOOBJS) $(L_OPTIONS) /OUT:$@ /MAP:fte.MAP $(LIBS) fte.def << $(LINK) @fte.lnk ftepm.res: ftepm.rc pmdlg.rc ftepm.exe: $(OBJS) $(PMOBJS) ftepm.def ftepm.res $(VOID) <<ftepm.lnk $(OBJS) $(PMOBJS) $(L_OPTIONS) /OUT:$@ /MAP:ftepm.MAP $(LIBS) ftepm.def << $(LINK) @ftepm.lnk $(RC) $(RC_OPT) ftepm.res ftepm.EXE $(EXE).EXE: $(OBJS) $(C_SRC:.c=.obj) $(CPP_SRC:.cpp=.obj) $(RES) $(DEF) $(LIBS) $(VOID) <<$(EXE).lnk $(OBJS) $(C_SRC:.c=.obj) $(CPP_SRC:.cpp=.obj) $(L_OPTIONS) /OUT:$@ /MAP:$(EXE).MAP $(LIBS) $(DEF) << $(LINK) @$(EXE).lnk $(RC) $(RC_OPT) $(RES) $(EXE).EXE # $(C_SRC:.c=.obj): $(C_SRC) $(C_H) # $(CPP_SRC:.cpp=.obj): $(CPP_SRC) $(CPP_HPP) # $(RES): $(RES:.res=.rc) .C.$(OEXT): $(CC) /C $(C_OPTIONS) $< .CPP.$(OEXT): $(CC) /C $(CPP_OPTIONS) $< .RC.RES: $(RC) -r $(RC_OPT) $< �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_unix.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000005073�11602724002�012434� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_unix.cpp * * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // UNIX specific routines #include "c_bind.h" #include "c_config.h" #include "c_history.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "s_util.h" #ifdef WINNT #include "e_win32.cpp" #else #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <sys/wait.h> int EView::SysShowHelp(ExState &State, const char *word) { char options[128] = ""; char command[1024]; char file[MAXPATH]; if (State.GetStrParam(this, options, sizeof(options) - 1) == 0) options[0] = 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } snprintf(file, sizeof(file)-1, "/tmp/fte%d-man-%s", getpid(), word); snprintf(command, sizeof(command)-1, "%s %s %s >'%s' 2>&1", HelpCommand, options, word, file); /// !!! why is this needed ??? #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) pid_t pid; int err, status; Msg(S_INFO, "Retrieving man page for %s, please wait", word); if ((pid = fork()) == 0) { close(1); SYSCALL(err = open(file, O_CREAT | O_WRONLY | O_APPEND, S_IRWXU)); if (err != -1) { close(2); //dup(1); // ignore error output close(0); assert(open("/dev/null", O_RDONLY) == 0); setenv("MAN_KEEP_FORMATTING", "1", 0); execlp("man", "man", "-7", #ifndef AIX // current AIX's don't like the -a. "-a", #endif word, NULL); // execlp("/bin/sh", "sh", "-c", command, NULL); perror("Can't exec command"); } else perror("Can't open file"); exit(1); } else if (pid < 0) { perror("Can't fork"); return 0; } SYSCALL(err = waitpid(pid, &status, 0)); if (err == -1) { perror("waitpid failed"); return 0; } // int rc = system(command); err = FileLoad(0, file, "CATBS", this); BFI((EBuffer*)(this->Model), BFI_ReadOnly) = 1; unlink(file); if (err == 0){ Msg(S_ERROR, "Error code %d retrieving manpage for %s", err, word); return 0; } return 1; } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_os2.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000002114�11331412502�012143� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_os2.cpp * * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // Win32 (NT) specific routines #include "c_bind.h" #include "o_model.h" #include "sysdep.h" int EView::SysShowHelp(ExState &State, const char *word) { char file[MAXPATH] = ""; char cmd[1024]; if (State.GetStrParam(this, file, sizeof(file)) == 0) if (MView->Win->GetStr("Help file", sizeof(file), file, HIST_DEFAULT) == 0) return 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk)) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk), wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } int i = snprintf(cmd, sizeof(cmd), "%s %s %s", HelpCommand, file, word); if (i > 0 && i < sizeof(cmd) && system(cmd) == 0) return 1; Msg(S_ERROR, "Failed to start view.exe!"); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clipserv.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000012455�11344266042�013006� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clipserv.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #define INCL_DOS #define INCL_PM #include "sysdep.h" #include <os2.h> #include <stdlib.h> #include <stdio.h> #include <process.h> #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 HAB hab; HMQ hmq; QMSG qmsg; HMTX hmtxSyn; HEV hevGet; HEV hevPut; HEV hevEnd; HMUX hmuxWait; void _LNK_CONV clipsrv(void *foo) { HAB hab; HMQ hmq; hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); while (1) { ULONG ulPostCount; ULONG Cmd; ULONG len; char *text; void *shmem; WinWaitMuxWaitSem(hmuxWait, SEM_INDEFINITE_WAIT, &Cmd); switch (Cmd) { case CMD_GET: DosResetEventSem(hevGet, &ulPostCount); shmem = 0; if ((WinOpenClipbrd(hab) == TRUE) && ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0)) { len = strlen(text); puts(text); if (0 == DosAllocSharedMem(&shmem, MEM_PREFIX "CLIPDATA", len + 5, PAG_COMMIT | PAG_WRITE | PAG_READ)) { memcpy(shmem, (void *)&len, 4); memcpy((void *)(((char *)shmem) + sizeof(ULONG)), text, len + 1); } else { DosBeep(200, 500); } } else { /*DosBeep(100, 1500);*/ len = 0; if (0 == DosAllocSharedMem(&shmem, MEM_PREFIX "CLIPDATA", 4, PAG_COMMIT | PAG_WRITE | PAG_READ)) { memcpy(shmem, (void *)&len, 4); } } WinCloseClipbrd(hab); DosPostEventSem(hevEnd); DosWaitEventSem(hevGet, SEM_INDEFINITE_WAIT); DosResetEventSem(hevGet, &ulPostCount); if (shmem) DosFreeMem(shmem); break; case CMD_PUT: DosResetEventSem(hevPut, &ulPostCount); if (0 == DosGetNamedSharedMem(&shmem, MEM_PREFIX "CLIPDATA", PAG_READ | PAG_WRITE)) { if (WinOpenClipbrd(hab) == TRUE) { WinEmptyClipbrd(hab); len = strlen((char *)shmem + 4); if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strcpy(text, ((char *)shmem) + 4); if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); } WinCloseClipbrd(hab); } else { DosBeep(1500, 3500); } } else { DosBeep(500, 7500); } DosPostEventSem(hevEnd); DosWaitEventSem(hevPut, SEM_INDEFINITE_WAIT); DosResetEventSem(hevPut, &ulPostCount); if (shmem) DosFreeMem(shmem); break; } } WinDestroyMsgQueue(hmq); WinTerminate(hab); } int main() { SEMRECORD sem[2]; int rc; rc = DosCreateMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn, 0, 0); if (rc != 0) return 1; puts("CLIPSYN"); rc = DosCreateEventSem(SEM_PREFIX "CLIPEND", &hevEnd, 0, 0); if (rc != 0) return 1; puts("CLIPEND"); rc = DosCreateEventSem(SEM_PREFIX "CLIPGET", &hevGet, 0, 0); if (rc != 0) return 1; puts("CLIPGET"); rc = DosCreateEventSem(SEM_PREFIX "CLIPPUT", &hevPut, 0, 0); if (rc != 0) return 1; puts("CLIPPUT"); sem[0].hsemCur = (PULONG) hevGet; sem[0].ulUser = CMD_GET; sem[1].hsemCur = (PULONG) hevPut; sem[1].ulUser = CMD_PUT; rc = DosCreateMuxWaitSem(0, &hmuxWait, 2, sem, DCMW_WAIT_ANY); if (rc != 0) return 1; puts("CLIPMUX"); hab = WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); #if defined(__EMX__) || defined(__TOS_OS2__) _beginthread(clipsrv, NULL, 8192, 0); #else _beginthread(clipsrv, 8192, 0); #endif while (WinGetMsg (hab, &qmsg, 0, 0, 0)) WinDispatchMsg (hab, &qmsg); WinDestroyMsgQueue(hmq); WinTerminate(hab); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_messages.h����������������������������������������������������������������������������������0000644�0001750�0001750�00000004427�11333110353�012740� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_messages.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_MESSAGES_H #define O_MESSAGES_H #include "fte.h" #ifdef CONFIG_OBJ_MESSAGES #include "o_list.h" #include "stl_fte.h" struct Error; class EBuffer; class EMessages: public EList { StlString Command; StlString Directory; StlVector<Error*> ErrList; int Running; int BufLen; int BufPos; int PipeId; int ReturnCode; int MatchCount; char MsgBuf[4096]; StlVector<StlString> DirLevel; // top of dir stack. public: EMessages(int createFlags, EModel **ARoot, const char *Dir, const char *ACommand); ~EMessages(); virtual void NotifyDelete(EModel *Deleting); void FindErrorFiles(); void FindErrorFile(unsigned err); void AddFileError(EBuffer *B, unsigned err); void FindFileErrors(EBuffer *B); virtual int GetContext() { return CONTEXT_MESSAGES; } virtual EEventMap *GetEventMap(); virtual int ExecCommand(ExCommands Command, ExState &State); void AddError(const char *file, int line, const char *msg, const char *text, int hilit=0); void FreeErrors(); int GetLine(char *Line, size_t MaxLen); void GetErrors(); int Compile(char *Command); void ShowError(EView *V, unsigned err); void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); char* FormatLine(int Line); int IsHilited(int Line); int IsRunning() const { return Running; } void UpdateList(); int Activate(int No); int CanActivate(int Line); void NotifyPipe(int APipeId); const char* GetDirectory() { return Directory.c_str(); } virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); virtual size_t GetRowLength(int ARow); int RunPipe(const char *Dir, const char *Command); int CompilePrevError(EView *V); int CompileNextError(EView *V); }; extern EMessages *CompilerMsgs; void FreeCRegexp(); #endif // CONFIG_OBJ_MESSAGES #endif // O_MESSAGES_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_block.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000067737�11333110353�012561� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_block.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_config.h" #include "e_undo.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "s_files.h" #include "s_util.h" #include <stdio.h> /////////////////////////////////////////////////////////////////////////////// // Block Commands // /////////////////////////////////////////////////////////////////////////////// int EBuffer::SetBB(const EPoint& M) { EPoint OldBB = BB; int MinL, MaxL; if (BB.Row == M.Row && BB.Col == M.Col) return 1; #ifdef CONFIG_UNDOREDO if (PushBlockData() == 0) return 0; #endif BB = M; if (OldBB.Row == -1) OldBB = BE; if ((OldBB.Col != BB.Col) && (BlockMode == bmColumn)) BlockRedraw(); MinL = Min(OldBB.Row, BB.Row); MaxL = Max(OldBB.Row, BB.Row); if (MinL != -1) if (MinL <= MaxL) Draw(MinL, MaxL); return 1; } int EBuffer::SetBE(const EPoint& M) { EPoint OldBE = BE; int MinL, MaxL; if (BE.Row == M.Row && BE.Col == M.Col) return 1; #ifdef CONFIG_UNDOREDO if (PushBlockData() == 0) return 0; #endif BE = M; if (OldBE.Row == -1) OldBE = BB; if ((OldBE.Col != BE.Col) && (BlockMode == bmColumn)) BlockRedraw(); MinL = Min(OldBE.Row, BE.Row); MaxL = Max(OldBE.Row, BE.Row); if (MinL != -1) if (MinL <= MaxL) Draw(MinL, MaxL); return 1; } // check if there is active or valid selection int EBuffer::CheckBlock() { if (BB.Row == -1 && BE.Row == 1) { BB.Col = -1; BE.Col = -1; return 0; } if (BB.Row == -1 || BE.Row == -1) return 0; if (BB.Row >= RCount) BB.Row = RCount - 1; if (BE.Row >= RCount) BE.Row = RCount - 1; switch(BlockMode) { case bmLine: BB.Col = 0; BE.Col = 0; if (BB.Row >= BE.Row) return 0; break; case bmColumn: if (BB.Col >= BE.Col) return 0; if (BB.Row >= BE.Row) return 0; break; case bmStream: if (BB.Row > BE.Row) return 0; if (BB.Row == BE.Row && BB.Col >= BE.Col) return 0; break; } return 1; } int EBuffer::BlockRedraw() { if (BB.Row == -1 || BE.Row == -1) return 0; Draw(BB.Row, BE.Row); return 1; } int EBuffer::BlockBegin() { EPoint X; X.Row = VToR(CP.Row); X.Col = CP.Col; CheckBlock(); SetBB(X); return 1; } int EBuffer::BlockEnd() { EPoint X; X.Row = VToR(CP.Row); X.Col = CP.Col; CheckBlock(); SetBE(X); return 1; } int EBuffer::BlockUnmark() { EPoint Null(-1,-1); SetBB(BE); SetBE(Null); SetBB(Null); AutoExtend = 0; return 1; } int EBuffer::BlockCut(int Append) { if (BlockCopy(Append) && BlockKill()) return 1; return 0; } int EBuffer::BlockCopy(int Append, int clipboard) { EPoint B, E; int L; int SL, OldCount; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; if (SSBuffer == 0) return 0; if (Append) { if (SystemClipboard) GetPMClip(clipboard); } else SSBuffer->Clear(); SSBuffer->BlockMode = BlockMode; BFI(SSBuffer, BFI_TabSize) = BFI(this, BFI_TabSize); BFI(SSBuffer, BFI_ExpandTabs) = BFI(this, BFI_ExpandTabs); BFI(SSBuffer, BFI_Undo) = 0; B = BB; E = BE; OldCount = SL = SSBuffer->RCount; switch (BlockMode) { case bmLine: for (L = B.Row; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, 0, RLine(L)) == 0) return 0; SL++; } break; case bmColumn: for (L = B.Row; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col - B.Col, B.Col, RLine(L)) == 0) return 0; if (SSBuffer->PadLine(SL, E.Col - B.Col) == 0) return 0; SL++; } break; case bmStream: if (B.Row == E.Row) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col - B.Col, B.Col, RLine(B.Row)) == 0) return 0; } else { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, B.Col, RLine(B.Row)) == 0) return 0; SL++; for (L = B.Row + 1; L < E.Row; L++) { if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, -1, 0, RLine(L)) == 0) return 0; SL++; } if (SSBuffer->InsLine(SL, 0) == 0) return 0; if (SSBuffer->InsLineText(SL, 0, E.Col, 0, RLine(E.Row)) == 0) return 0; } if (Append && OldCount > 0) if (SSBuffer->JoinLine(OldCount - 1, 0) == 0) return 0; break; } if (SystemClipboard) PutPMClip(clipboard); return 1; } int EBuffer::BlockPasteStream(int clipboard) { BlockMode = bmStream; return BlockPaste(clipboard); } int EBuffer::BlockPasteLine(int clipboard) { BlockMode = bmLine; return BlockPaste(clipboard); } int EBuffer::BlockPasteColumn(int clipboard) { BlockMode = bmColumn; return BlockPaste(clipboard); } int EBuffer::BlockPaste(int clipboard) { EPoint B, E; int L, BL; if (SystemClipboard) GetPMClip(clipboard); if (SSBuffer == 0) return 0; if (SSBuffer->RCount == 0) return 0; AutoExtend = 0; BFI(SSBuffer, BFI_TabSize) = BFI(this, BFI_TabSize); BFI(SSBuffer, BFI_ExpandTabs) = BFI(this, BFI_ExpandTabs); BFI(SSBuffer, BFI_Undo) = 0; BlockUnmark(); B.Row = VToR(CP.Row); B.Col = CP.Col; BL = B.Row; switch(BlockMode) { case bmLine: B.Col = 0; for (L = 0; L < SSBuffer->RCount; L++) { if (InsLine(BL, 0) == 0) return 0; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; BL++; } E.Row = BL; E.Col = 0; SetBB(B); SetBE(E); break; case bmColumn: for (L = 0; L < SSBuffer->RCount; L++) { if (AssertLine(BL) == 0) return 0; if (InsLineText(BL, B.Col, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; if (TrimLine(BL) == 0) return 0; BL++; } if (AssertLine(BL) == 0) return 0; E.Row = BL; E.Col = B.Col + SSBuffer->LineLen(0); SetBB(B); SetBE(E); break; case bmStream: if (SSBuffer->RCount > 1) if (SplitLine(B.Row, B.Col) == 0) return 0; if (InsLineText(B.Row, B.Col, SSBuffer->LineLen(0), 0, SSBuffer->RLine(0)) == 0) return 0; E = B; E.Col += SSBuffer->LineLen(0); BL++; if (SSBuffer->RCount > 1) { for (L = 1; L < SSBuffer->RCount - 1; L++) { if (InsLine(BL, 0) == 0) return 0; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; BL++; } L = SSBuffer->RCount - 1; if (InsLineText(BL, 0, SSBuffer->LineLen(L), 0, SSBuffer->RLine(L)) == 0) return 0; E.Col = SSBuffer->LineLen(L); E.Row = BL; } SetBB(B); SetBE(E); break; } return 1; } int EBuffer::BlockKill() { EPoint B, E; int L; int Y = -1; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, -1); // if (MoveToPos(B.Col, B.Row) == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo) == 1) { if (PushULong(CP.Col) == 0) return 0; if (PushULong(CP.Row) == 0) return 0; if (PushUChar(ucPosition) == 0) return 0; } #endif switch (BlockMode) { case bmLine: Y = VToR(CP.Row); if (Y >= B.Row) { if (Y >= E.Row) { if (SetPosR(CP.Col, Y - (E.Row - B.Row)) == 0) return 0; } else { if (SetPosR(CP.Col, B.Row) == 0) return 0; } } for (L = B.Row; L < E.Row; L++) if (DelLine(B.Row) == 0) return 0; break; case bmColumn: Y = VToR(CP.Row); if (Y >= B.Row && Y < E.Row) { if (CP.Col >= B.Col) { if (CP.Col >= E.Col) { if (SetPos(CP.Col - (E.Col - B.Col), CP.Row) == 0) return 0; } else { if (SetPos(B.Col, CP.Row) == 0) return 0; } } } for (L = B.Row; L < E.Row; L++) if (DelText(L, B.Col, E.Col - B.Col) == 0) return 0; break; case bmStream: Y = VToR(CP.Row); if (B.Row == E.Row) { if (Y == B.Row) { if (CP.Col >= B.Col) { if (CP.Col >= E.Col) { if (SetPos(CP.Col - (E.Col - B.Col), CP.Row) == 0) return 0; } else { if (SetPos(B.Col, CP.Row) == 0) return 0; } } } if (DelText(B.Row, B.Col, E.Col - B.Col) == 0) return 0; } else { if (Y >= B.Row) { if (Y > E.Row || (Y == E.Row && E.Col == 0)) { if (SetPosR(CP.Col, Y - (E.Row - B.Row)) == 0) return 0; } else if (Y == E.Row) { if (CP.Col >= E.Col) { if (SetPosR(CP.Col - E.Col + B.Col, B.Row) == 0) return 0; } else { if (SetPosR(B.Col, B.Row) == 0) return 0; } } else { if (SetPosR(B.Col, B.Row) == 0) return 0; } } if (DelText(E.Row, 0, E.Col) == 0) return 0; for (L = B.Row + 1; L < E.Row; L++) if (DelLine(B.Row + 1) == 0) return 0; if (DelText(B.Row, B.Col, -1) == 0) return 0; if (JoinLine(B.Row, B.Col) == 0) return 0; } break; } return BlockUnmark(); } // remove selected text and paste information from clipboard to replace it int EBuffer::BlockPasteOver(int clipboard) { // if there is existing selection, remove it's contents if (CheckBlock()) { BlockKill(); } // paste text from clipboard if (BlockPaste(clipboard)) { // go to end of selection SetPos(BE.Col, BE.Row); // remove selection return BlockUnmark(); } return 0; } // XXX clipboard ??? int EBuffer::ClipClear(int clipboard) { if (SSBuffer == 0) return 0; SSBuffer->Clear(); if (SystemClipboard) PutPMClip(clipboard); return 1; } int EBuffer::BlockIndent() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); if (SetPosR(B.Col, B.Row) == 0) return 0; for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: case bmLine: if (L < E.Row || E.Col != 0) { int I = LineIndented(L) + 1; IndentLine(L, I); } break; case bmColumn: if (L < E.Row) { if (InsText(L, B.Col, 1, 0) == 0) return 0; if (DelText(L, E.Col, 1) == 0) return 0; } break; } } if (SetPosR(B.Col, B.Row) == 0) return 0; return 1; } int EBuffer::BlockUnindent() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); if (SetPosR(B.Col, B.Row) == 0) return 0; for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: case bmLine: if (L < E.Row || E.Col != 0) { int I = LineIndented(L) - 1; if (I >= 0) IndentLine(L, I); } break; case bmColumn: if (L < E.Row) { if (InsText(L, E.Col, 1, 0) == 0) return 0; if (DelText(L, B.Col, 1) == 0) return 0; } break; } } if (SetPosR(B.Col, B.Row) == 0) return 0; return 1; } int EBuffer::BlockClear() { return 0; } int EBuffer::BlockMarkStream() { if (BlockMode != bmStream) BlockUnmark(); BlockMode= bmStream; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockMarkLine() { if (BlockMode != bmLine) BlockUnmark(); BlockMode= bmLine; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockMarkColumn() { if (BlockMode != bmColumn) BlockUnmark(); BlockMode= bmColumn; if (AutoExtend) AutoExtend = 0; else { BlockUnmark(); AutoExtend = 1; } return 1; } int EBuffer::BlockExtendBegin() { CheckBlock(); ExtendGrab = 0; AutoExtend = 0; int Y = VToR(CP.Row); switch (BlockMode) { case bmStream: if ((Y == BB.Row) && (CP.Col == BB.Col)) ExtendGrab |= 1; if ((Y == BE.Row) && (CP.Col == BE.Col)) ExtendGrab |= 2; break; case bmLine: if (Y == BB.Row) ExtendGrab |= 1; if (Y == BE.Row) ExtendGrab |= 2; break; case bmColumn: if (Y == BB.Row) ExtendGrab |= 1; if (Y == BE.Row) ExtendGrab |= 2; if (CP.Col == BB.Col) ExtendGrab |= 4; if (CP.Col == BE.Col) ExtendGrab |= 8; break; } if (ExtendGrab == 0) { BlockBegin(); BlockEnd(); if (BlockMode == bmColumn) ExtendGrab = 1 | 2 | 4 | 8; else ExtendGrab = 1 | 2; } return 1; } int EBuffer::BlockExtendEnd() { EPoint T, B, E; CheckBlock(); B = BB; E = BE; switch (BlockMode) { case bmLine: if (ExtendGrab & 1) { B.Row = VToR(CP.Row); B.Col = 0; } else if (ExtendGrab & 2) { E.Row = VToR(CP.Row); E.Col = 0; } if (B.Row > E.Row) { T = B; B = E; E = T; } break; case bmStream: if (ExtendGrab & 1) { B.Col = CP.Col; B.Row = VToR(CP.Row); } else if (ExtendGrab & 2) { E.Col = CP.Col; E.Row = VToR(CP.Row); } if ((B.Row > E.Row) || ((B.Row == E.Row) && (B.Col > E.Col))) { T = B; B = E; E = T; } break; case bmColumn: if (ExtendGrab & 1) B.Row = VToR(CP.Row); else if (ExtendGrab & 2) E.Row = VToR(CP.Row); if (ExtendGrab & 4) B.Col = CP.Col; else if (ExtendGrab & 8) E.Col = CP.Col; if (B.Row > E.Row) { int T; T = B.Row; B.Row = E.Row; E.Row = T; } if (B.Col > E.Col) { int T; T = B.Col; B.Col = E.Col; E.Col = T; } break; } SetBB(B); SetBE(E); ExtendGrab = 0; AutoExtend = 0; return 1; } int EBuffer::BlockIsMarked() { if ((BB.Row != -1) && (BE.Row != -1) && (BB.Col != -1) && (BE.Col != -1)) return 1; return 0; } int EBuffer::BlockReIndent() { EPoint P = CP; EPoint B, E; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { if (SetPosR(0, i) == 0) return 0; if (LineIndent() == 0) return 0; } return SetPos(P.Col, P.Row); } int EBuffer::BlockSelectWord() { int Y = VToR(CP.Row); PELine L = RLine(Y); int P; int C; if (BlockUnmark() == 0) return 0; BlockMode = bmStream; P = CharOffset(L, CP.Col); if (P >= L->Count) return 0; C = ChClassK(L->Chars[P]); while ((P > 0) && (C == ChClassK(L->Chars[P - 1]))) P--; if (SetBB(EPoint(Y, ScreenPos(L, P))) == 0) return 0; while ((P < L->Count) && (C == ChClassK(L->Chars[P]))) P++; if (SetBE(EPoint(Y, ScreenPos(L, P))) == 0) return 0; return 1; } int EBuffer::BlockSelectLine() { int Y = VToR(CP.Row); if (BlockUnmark() == 0) return 0; BlockMode = bmStream; if (SetBB(EPoint(Y, 0)) == 0) return 0; if (Y == RCount - 1) { if (SetBE(EPoint(Y, LineLen(Y))) == 0) return 0; } else { if (SetBE(EPoint(Y + 1, 0)) == 0) return 0; } return 1; } int EBuffer::BlockSelectPara() { return 1; } int EBuffer::BlockWriteTo(const char *AFileName, int Append) { //int error = 0; EPoint B, E; int L; PELine LL; int A, Z; FILE *fp; int bc = 0, lc = 0, oldc = 0; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; B = BB; E = BE; Msg(S_INFO, "Writing %s...", AFileName); fp = fopen(AFileName, Append ? "ab" : "wb"); if (fp == NULL) goto error; setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); for (L = B.Row; L <= E.Row; L++) { A = -1; Z = -1; LL = RLine(L); switch (BlockMode) { case bmLine: if (L < E.Row) { A = 0; Z = LL->Count; } break; case bmColumn: if (L < E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } break; case bmStream: if (B.Row == E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } else if (L == B.Row) { A = CharOffset(LL, B.Col); Z = LL->Count; } else if (L < E.Row) { A = 0; Z = LL->Count; } else if (L == E.Row) { A = 0; Z = CharOffset(LL, E.Col); } break; } if (A != -1 && Z != -1) { if (A < LL->Count) { if (Z > LL->Count) Z = LL->Count; if (Z > A) { if ((int)fwrite(LL->Chars + A, 1, Z - A, fp) != Z - A) { goto error; } else bc += Z - A; } } if (BFI(this, BFI_AddCR) == 1) { if (fputc(13, fp) < 0) goto error; else bc++; } if (BFI(this, BFI_AddLF) == 1) { if (fputc(10, fp) < 0) goto error; else { bc++; lc++; } } if (bc > 65536 + oldc) { Msg(S_INFO, "Writing %s, %d lines, %d bytes.", AFileName, lc, bc); oldc = bc; } } } fclose(fp); Msg(S_INFO, "Wrote %s, %d lines, %d bytes.", AFileName, lc, bc); return 1; error: if(fp != NULL) { fclose(fp); unlink(AFileName); } View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to write block to %s", AFileName); return 0; } int EBuffer::BlockReadFrom(const char *AFileName, int blockMode) { EBuffer *B; int savesys; int rc; if (FileExists(AFileName) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "File not found: %s", AFileName); return 0; } B = new EBuffer(0, (EModel **)&SSBuffer, AFileName); if (B == 0) return 0; B->SetFileName(AFileName, 0); if (B->Load() == 0) { delete B; return 0; } savesys = SystemClipboard; SystemClipboard = 0; switch (blockMode) { case bmColumn: rc = BlockPasteColumn(); break; case bmLine: rc = BlockPasteLine(); break; default: case bmStream: rc = BlockPasteStream(); break; } SystemClipboard = savesys; if (rc == 0) return 0; delete B; return 1; } static EBuffer *SortBuffer; static int SortReverse; static int *SortRows = 0; static int SortMinRow; static int SortMaxRow; static int SortMinCol; static int SortMaxCol; static int _LNK_CONV SortProc(const void *A, const void *B) { int *AA = (int *)A; int *BB = (int *)B; ELine *LA = SortBuffer->RLine(*AA); ELine *LB = SortBuffer->RLine(*BB); int rc; if (SortMinCol == -1) { int lA = LA->Count; int lB = LB->Count; if (BFI(SortBuffer, BFI_MatchCase) == 1) rc = memcmp(LA->Chars, LB->Chars, (lA < lB) ? lA : lB); else rc = memicmp(LA->Chars, LB->Chars, (lA < lB) ? lA : lB); if (rc == 0) { if (lA > lB) rc = 1; else rc = -1; } } else { int lA = LA->Count; int lB = LB->Count; int PA = SortBuffer->CharOffset(LA, SortMinCol); int PB = SortBuffer->CharOffset(LB, SortMinCol); lA -= PA; lB -= PB; if (lA < 0 && lB < 0) rc = 0; else if (lA < 0 && lB > 0) rc = -1; else if (lA > 0 && lB < 0) rc = 1; else { if (SortMaxCol != -1) { if (lA > SortMaxCol - SortMinCol) lA = SortMaxCol - SortMinCol; if (lB > SortMaxCol - SortMinCol) lB = SortMaxCol - SortMinCol; } if (BFI(SortBuffer, BFI_MatchCase) == 1) rc = memcmp(LA->Chars+ PA, LB->Chars + PB, (lA < lB) ? lA : lB); else rc = memicmp(LA->Chars + PA, LB->Chars + PB, (lA < lB) ? lA : lB); if (rc == 0) { if (lA > lB) rc = 1; else rc = -1; } } } if (SortReverse) return -rc; return rc; } int EBuffer::BlockSort(int Reverse) { int rq; ELine *oldL; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; SortMinRow = BB.Row; SortMaxRow = BE.Row; if (BlockMode != bmStream || BE.Col == 0) SortMaxRow--; if (SortMinRow >= SortMaxRow) return 1; SortBuffer = this; SortReverse = Reverse; switch (BlockMode) { case bmLine: case bmStream: SortMinCol = -1; SortMaxCol = -1; break; case bmColumn: SortMinCol = BB.Col; SortMaxCol = BE.Col; break; } SortRows = (int *)malloc((SortMaxRow - SortMinRow + 1) * sizeof(int)); if (SortRows == 0) { free(SortRows); return 0; } for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) SortRows[rq] = rq + SortMinRow; qsort(SortRows, SortMaxRow - SortMinRow + 1, sizeof(int), SortProc); // now change the order of lines according to new order in Rows array. for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) { oldL = RLine(SortRows[rq]); if (InsLine(1 + rq + SortMaxRow, 0) == 0) return 0; if (InsChars(1 + rq + SortMaxRow, 0, oldL->Count, oldL->Chars) == 0) return 0; } for (rq = 0; rq <= SortMaxRow - SortMinRow; rq++) if (DelLine(SortMinRow) == 0) return 0; free(SortRows); return 1; } int EBuffer::BlockUnTab() { EPoint B, E; ELine *L; int O, C; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { L = RLine(i); O = 0; C = 0; while (O < L->Count) { if (L->Chars[O] == '\t') { C = NextTab(C, BFI(this, BFI_TabSize)); if (DelChars(i, O, 1) != 1) return 0; if (InsChars(i, O, C - O, 0) != 1) return 0; O = C; } else { O++; C++; } } } return 1; } int EBuffer::BlockEnTab() { EPoint B, E; ELine *L; int O, C, O1, C1; char tab = '\t'; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (int i = B.Row; i < E.Row; i++) { L = RLine(i); O = C = 0; O1 = C1 = 0; while (O < L->Count) { if (L->Chars[O] == '\t') { // see if there are spaces to remove int C2 = NextTab(C, BFI(this, BFI_TabSize)); int N = BFI(this, BFI_TabSize) - (C2 - C); if (O - O1 < N) N = O - O1; if (N > 0) { if (DelChars(i, O - N, N) != 1) return 0; O -= N; C = C2; O++; C1 = C; O1 = O; } else { O++; C = C2; O1 = O; C1 = C; } } else if (L->Chars[O] != ' ') { // nope, cannot put tab here O++; C++; C1 = C; O1 = O; } else if (((C % BFI(this, BFI_TabSize)) == (BFI(this, BFI_TabSize) - 1)) && (C - C1 > 0)) { // reached a tab and can put one int N = BFI(this, BFI_TabSize); if (O - O1 + 1 < N) { N = O - O1 + 1; } else if (O - O1 + 1 > N) { O1 = O - N + 1; } if (DelChars(i, O1, N) != 1) return 0; if (InsChars(i, O1, 1, &tab) != 1) return 0; O1++; O = O1; C++; C1 = C; } else { O++; C++; } } } return 1; } // FindFunction -- search for line matching 'RoutineRegexp' // starting from current line + 'delta'. 'way' should be +1 or -1. int EBuffer::FindFunction(int delta, int way) { RxNode *regx; int line; PELine L; RxMatchRes res; if (BFS(this, BFS_RoutineRegexp) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return -1; } regx = RxCompile(BFS(this, BFS_RoutineRegexp)); if (regx == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to compile regexp '%s'", BFS(this, BFS_RoutineRegexp)); return -1; } //** Scan backwards from the current cursor position, Msg(S_BUSY, "Matching %s", BFS(this, BFS_RoutineRegexp)); line = VToR(CP.Row) + delta; while (line >= 0 && line < RCount) { L = RLine(line); if (RxExec(regx, L->Chars, L->Count, L->Chars, &res) == 1) break; line += way; } if (line < 0) line = 0; if (line >= RCount) line = RCount - 1; RxFree(regx); return line; } // Selects the current function. int EBuffer::BlockMarkFunction() { int by, ey; if (BlockUnmark() == 0) return 0; if ((by = FindFunction( 0, -1)) == -1) return 0; if ((ey = FindFunction(+1, +1)) == -1) return 0; //** Start and end are known. Set the block; BlockMode = bmStream; if (SetBB(EPoint(by, 0)) == 0) return 0; if (SetBE(EPoint(ey, 0)) == 0) return 0; return 1; } int EBuffer::IndentFunction() { EPoint P = CP; int by, ey; if ((by = FindFunction( 0, -1)) == -1) return 0; if ((ey = FindFunction(+1, +1)) == -1) return 0; //Draw(by, ey); ? for (int i = by; i < ey; i++) { if (SetPosR(0, i) == 0) return 0; if (LineIndent() == 0) return 0; } return SetPos(P.Col, P.Row); } int EBuffer::MoveFunctionPrev() { int line = FindFunction(-1, -1); if (line == -1) return 0; return CenterPosR(0, line); } int EBuffer::MoveFunctionNext() { int line = FindFunction(+1, +1); if (line == -1) return 0; return CenterPosR(0, line); } ���������������������������������./src/simple.fte������������������������������������������������������������������������������������0000644�0001750�0001750�00000041301�07203604605�012434� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mode PLAIN { ExpandTabs = 1; # expand tabs on display BackSpKillTab = 1; # backspace kills entire tabs DeleteKillTab = 1; # delete kills entire tabs BackSpUnindents = 0; # backspace at bol unindents SpaceTabs = 0; # insert tabs as spaces CursorThroughTabs = 0; PersistentBlocks = 0; # 1 = persistent blocks, 0 = transient BackSpKillBlock = 1; # to delete block if marked DeleteKillBlock = 1; # "" InsertKillBlock = 1; # inserting char kills selected block } object GLOBAL { KeepHistory = 0; # load/save history on entry/exit LoadDesktopOnEntry = 0; # load desktop on fte start SaveDesktopOnExit = 0; # save desktop in ExitEditor %if(OS_UNIX) %define(GUI_X11) %endif %if(GUI_X11) # X11 # Any fixed-width font should do. Make sure it has all 256 characters # defined or weird things can happen. # WindowFont = "fixed"; # WindowFont = "6x8"; # WindowFont = "7x13"; # WindowFont = "8x13"; WindowFont = "9x15"; # WindowFont = "10x20"; %endif } menu File { item "&Open...\tF3" { FileOpen } item "&Reload\tShift+F3" { FileReload } item "&Save\tF2" { FileSave } item "Save &As...\tShift+F2" { FileSaveAs } item "Save Al&l\tCtrl+F2" { FileSaveAll } item "&Close\tAlt+Q" { FileClose } item; item "&Next\tAlt+Left" { FileNext } item "&Previous\tAlt+Right" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu Edit { item "&Undo\tAlt+BackSp" { Undo } item "&Redo\tAlt+Shift+BackSp" { Redo } item; item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "&Unmark\tEsc" { BlockUnmark } item; item "&Delete line\tCtrl+Y" { KillLine } } menu Search { item "&Find...\tCtrl+F" { Find } item "Find and &replace...\tCtrl+R" { FindReplace } item "Repeat &Last find\tCtrl+L" { FindRepeat } item; item "&Goto line...\tAlt+J" { MoveToLine } } menu Window { item "Split &Horizontal\tShift+F2" { WinHSplit } item "&Close view\tCtrl+Alt+F4" { WinClose } item "Close &other views\tF5" { WinZoom } item; item "&Buffers\tAlt+0" { ViewBuffers } item "&Directory\tC+M" { DirOpen } } menu Options { item "&Insert mode\tC+O C+I" { ToggleInsert } item "&Word wrap\tC+O C+W" { ToggleWordWrap } } menu Help { item "&About..." { ShowVersion } } menu Main { submenu "&File", File; submenu "&Edit", Edit; submenu "&Search", Search; submenu "&Window", Window; submenu "&Options", Options; submenu "&Help", Help; } menu Local { item "Cu&t\tShift+Del" { BlockCut } item "&Copy\tCtrl+Ins" { BlockCopy } item "&Paste\tShift+Ins" { BlockPasteStream } item "&Unmark\tEsc" { BlockUnmark } item; item "Delete &line\tCtrl+Y" { KillLine } item; item "&Save\tF2" { FileSave } item "Cl&ose\tAlt+Q" { FileClose } } eventmap MODEL { # basic commands, for files, directories, message view, etc. key [C+F2] { FileSaveAll } key [F3] { FileOpen } key [F4] { WinNext } key [C+F4] { WinHSplit } key [S+F4] { WinPrev } key [A+S-F4] { WinClose } key [F5] { WinZoom } key [F6] { FileNext } key [S+F6] { FilePrev } key [A+S-F6] { FileLast } key [F10] { MainMenu } key [C+F9] { RunProgram } key [S+F10] { LocalMenu } key [A+G-Up] { WinPrev } key [A+G-Down] { WinNext } key [A+G-Left] { FilePrev } key [A+G-Right] { FileNext } key [A+G-PgUp] { WinPrev; MovePageUp; WinNext } key [A+G-PgDn] { WinNext; MovePageDown; WinPrev } key [A+C+G-PgUp] { WinNext; MovePageUp; WinPrev } key [A+C+G-PgDn] { WinPrev; MovePageDown; WinNext } key [A+Q] { FileClose } key [A+X] { ExitEditor } key [C+S+G-Up] { WinResize -1 } key [C+S+G-Down] { WinResize +1 } # this is also useful for 'grep -n' etc. if configured key [F9] { Compile; ViewMessages } key [F11] { CompilePrevError } key [F12] { CompileNextError } key [S+F9] { ViewMessages } key [A+0] { ViewBuffers } key [A+1] { SwitchTo 1 } key [A+2] { SwitchTo 2 } key [A+3] { SwitchTo 3 } key [A+4] { SwitchTo 4 } key [A+5] { SwitchTo 5 } key [A+6] { SwitchTo 6 } key [A+7] { SwitchTo 7 } key [A+8] { SwitchTo 8 } key [A+9] { SwitchTo 9 } } eventmap PLAIN: MODEL { # keymap for plaintext mode MainMenu = 'Main'; # menu for menubar LocalMenu = 'Local'; # local menu key [Esc] { BlockMarkStream; BlockUnmark } key [F2] { FileSave } key [S+F2] { FileSaveAs } key [A+S-F2] { FileSave; FileClose } key [S+F3] { FileReload; WinRefresh } key [C+F3] { FileOpenInMode } key [F7] { BlockBegin } key [S+F7] { MoveBlockStart } key [F8] { BlockEnd } key [S+F8] { MoveBlockEnd } key [G-Left] { MoveLeft } key [C+G-Left] { MoveWordPrev } key [G-Right] { MoveRight } key [C+G-Right] { MoveWordNext } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [S+G-Left] { BlockExtendBegin; MoveLeft; BlockExtendEnd } key [S+G-Right] { BlockExtendBegin; MoveRight; BlockExtendEnd } # key [G+0] { ToggleInsert } # key [G+S+0] { InsertString 'foo' } key [C+G-S+Left] { BlockExtendBegin; MoveWordPrev; BlockExtendEnd } key [C+G-S+Right] { BlockExtendBegin; MoveWordNext; BlockExtendEnd } key [G-S+Up] { BlockExtendBegin; MoveUp; BlockExtendEnd } key [G-S+Down] { BlockExtendBegin; MoveDown; BlockExtendEnd } key [G-S+Home] { BlockExtendBegin; MoveLineStart; BlockExtendEnd } key [G-S+End] { BlockExtendBegin; MoveLineEnd; BlockExtendEnd } key [C+G-S+Home] { BlockExtendBegin; MovePageStart; BlockExtendEnd } key [C+G-S+End] { BlockExtendBegin; MovePageEnd; BlockExtendEnd } key [G-S+PgUp] { BlockExtendBegin; MovePageUp; BlockExtendEnd } key [G-S+PgDn] { BlockExtendBegin; MovePageDown; BlockExtendEnd } key [C+G-S+PgUp] { BlockExtendBegin; MoveFileStart; BlockExtendEnd } key [C+G-S+PgDn] { BlockExtendBegin; MoveFileEnd; BlockExtendEnd } key [A+G-S+Up] { BlockExtendBegin; ScrollUp; BlockExtendEnd } key [A+G-S+Down] { BlockExtendBegin; ScrollDown; BlockExtendEnd } key [A+G-S+Left] { BlockExtendBegin; ScrollLeft; BlockExtendEnd } key [A+G-S+Right] { BlockExtendBegin; ScrollRight; BlockExtendEnd } key [A+G-C+Up] { MovePrevEqualIndent } key [A+G-C+Down] { MoveNextEqualIndent } key [A+G-C+Left] { MovePrevTab } key [A+G-C+Right] { MoveNextTab } key [C+G-Ins] { BlockCopy } key [C+G-Del] { BlockKill } key [S+G-Ins] { BlockPasteStream } key [S+G-Del] { BlockCut } key [A+G-Ins] { BlockPasteColumn } key [A+G-S+Ins] { BlockPasteLine } key [G-Enter] { LineNew } key [BackSp] { BackSpace } key [G-Ins] { ToggleInsert } key [G-Del] { Delete } key [Tab] { InsertTab } key [S+Tab] { InsertSpacesToTab 10 } key [C+Tab] { CompleteWord } # key [C+Tab] { InsertTab } key [C+BackSp] { KillWordPrev } key [C+S+BackSp] { KillToLineStart } key [C+G-Enter] { LineSplit } key [G-S+Enter] { LineInsert } key [A+G-Enter] { LineAdd } key [A+G-Del] { KillWord } key [A+G-End] { KillToLineEnd } key [A+BackSp] { Undo } key [A+S+BackSp] { Redo } key [C+A_1] { GotoBookmark "1" } key [C+A_2] { GotoBookmark "2" } key [C+A_3] { GotoBookmark "3" } key [C+A_4] { GotoBookmark "4" } key [C+A_5] { GotoBookmark "5" } key [C+A_6] { GotoBookmark "6" } key [C+A_7] { GotoBookmark "7" } key [C+A_8] { GotoBookmark "8" } key [C+A_9] { GotoBookmark "9" } key [C+A_0] { GotoBookmark "0" } key [C+P_1] { PlaceBookmark "1" } key [C+P_2] { PlaceBookmark "2" } key [C+P_3] { PlaceBookmark "3" } key [C+P_4] { PlaceBookmark "4" } key [C+P_5] { PlaceBookmark "5" } key [C+P_6] { PlaceBookmark "6" } key [C+P_7] { PlaceBookmark "7" } key [C+P_8] { PlaceBookmark "8" } key [C+P_9] { PlaceBookmark "9" } key [C+P_0] { PlaceBookmark "0" } key [C+B] { FindRepeatReverse } key [C+C] { MoveToColumn } key [C+D] { LineDuplicate } key [C+F] { Find } key [C+I] { ListRoutines } key [C+J] { LineJoin } # key [C+L] { FindRepeat } key [C+G] { FindRepeat } key [C+M] { DirOpen } key [C+N] { FindRepeatOnce } key [C+Q] { InsertChar } key [C+R] { FindReplace } key [C+T] { KillWord } key [C+Y] { KillLine } key [C+E] { LineTrim } key [A+A] { BlockMarkStream } key [A+B] { MainMenu 'B' } key [A+C] { BlockCopy } key [A+D] { MainMenu 'D' } key [A+E] { MainMenu 'E' } key [A+F] { MainMenu 'F' } key [A+G] { BlockCut } key [A+H] { MainMenu 'H' } key [A+I] { BlockIndent } key [A+J] { MoveToLine } key [A+K] { BlockMarkColumn } key [A+L] { BlockMarkLine } key [A+O] { MainMenu 'O' } key [A+R] { WrapPara } # Reformat key [A+S] { MainMenu 'S' } key [A+T] { MainMenu 'T' } key [A+U] { BlockUnindent } key [A+W] { MainMenu 'W' } key [C+S] { IncrementalSearch } key [C+O_C+A] { ToggleAutoIndent } key [C+O_C+C] { ToggleMatchCase } key [C+O_C+E] { ToggleTrim } key [C+O_C+I] { ToggleInsert } # key [C+O_C+M] { ChangeMode } # key [C+O_C+M] { ShowMenu 'MChangeMode' } key [C+O_C+R] { ToggleReadOnly } key [C+O_C+S] { ToggleSysClipboard } key [C+O_C+T] { ChangeTabSize } key [C+O_C+U] { ToggleUndo } key [C+O_C+W] { ToggleWordWrap } key [C+O_.] { ToggleShowMarkers } key [C+O_[] { SetLeftMargin } key [C+O_\]] { SetRightMargin } key [C+O_A+[] { ChangeLeftMargin } key [C+O_A+\]] { ChangeRightMargin } key [C+O_Tab] { ToggleShowTabs } key [C+O_C+Tab] { ToggleExpandTabs } key [C+O_Del] { ToggleDeleteKillTab } key [C+O_G-Ins] { ToggleInsert } key [C+O_BackSp] { ToggleBackSpKillTab } key [C+O_Space] { ToggleIndentWithTabs } key [C+O_C+BackSp] { ToggleBackSpUnindents } key [A+-] { MatchBracket } key [A+=] { HilitMatchBracket } key [C+Space] { InsPrevLineChar } key [A+Space] { InsPrevLineToEol } key [A+F5] { ShowEntryScreen } key [C+_] { ShowPosition } key [Center] { MoveLineCenter } key [C+X] { MovePrevPos } # key [C+S+A] { ASCIITable } key [G+*] { LineInsert ; MoveUp; ScrollUp } # key [G++] { DumpFold } key [A+G++] { FoldCreate } key [A+G+-] { FoldDestroy } key [G+S++] { FoldPromote } key [G+S+-] { FoldDemote } key [C+G++] { FoldOpen } key [C+G+-] { FoldClose } key [C+G+*] { FoldOpenNested } key [C+G+/] { FoldToggleOpenClose } key [A+G+*] { FoldOpenAll } key [A+G+/] { FoldCloseAll } # key [C+G-Up] { MoveFoldPrev } # key [C+G-Down] { MoveFoldNext } # key [A+C+A] { FileOpen 'BUFFER.CPP' } key [C+K] { ShowKey } key [A+,] { SearchWordPrev } key [A+.] { SearchWordNext } key [A+/] { HilitWord } } colorize PLAIN { SyntaxParser = 'PLAIN'; color { { 'Normal', '7 0' }, }; } mode PLAIN { Colorizer = 'PLAIN'; } eventmap LIST { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } key [A+G-Up] { ScrollUp } key [A+G-Down] { ScrollDown } key [A+G-Left] { ScrollLeft } key [A+G-Right] { ScrollRight } key [Esc] { Cancel } key [G-Enter] { Activate } } eventmap BUFFERS: LIST { key [C+F10] { FileClose } key [F2] { FileSave } } eventmap ROUTINES: LIST { } eventmap MLIST: MODEL { key [G-Left] { MoveLeft } key [G-Right] { MoveRight } key [G-Up] { MoveUp } key [G-Down] { MoveDown } key [G-Home] { MoveLineStart } key [C+G-Home] { MovePageStart } key [G-End] { MoveLineEnd } key [C+G-End] { MovePageEnd } key [G-PgUp] { MovePageUp } key [C+G-PgUp] { MoveFileStart } key [G-PgDn] { MovePageDown } key [C+G-PgDn] { MoveFileEnd } # key [A+G-Up] { ScrollUp } # key [A+G-Down] { ScrollDown } # key [A+G-Left] { ScrollLeft } # key [A+G-Right] { ScrollRight } key [G-Enter] { Activate } } menu DirectoryFile { item "&Open...\tF3" { FileOpen } item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "&Close\tAlt+Q" { FileClose } item; item "E&xit\tAlt+X" { ExitEditor } } menu Navigate { item "Go &< level\tCtrl+PgUp" { DirGoUp } item "Go &> level\tCtrl+PgDn" { DirGoDown } item "Go to &\\\tCtrl+\\" { DirGoRoot } # item "&/ Goto Dir\t/" { DirGoto } item "&\\ Goto Dir\t\\" { DirGoto } item; item '&A:\\' { DirGoto 'A:\\' } item '&B:\\' { DirGoto 'B:\\' } item '&C:\\' { DirGoto 'C:\\' } item '&D:\\' { DirGoto 'D:\\' } item '&E:\\' { DirGoto 'E:\\' } item '&F:\\' { DirGoto 'F:\\' } item '&G:\\' { DirGoto 'G:\\' } item '&H:\\' { DirGoto 'H:\\' } item '&I:\\' { DirGoto 'I:\\' } } menu DirectoryMain { submenu "&File", DirectoryFile; submenu "&Navigate", Navigate; submenu "&Window", Window; submenu "&Help", Help; } eventmap DIRECTORY: MLIST { MainMenu = 'DirectoryMain'; key [C+G-PgUp] { DirGoUp } key [C+G-PgDn] { DirGoDown } key [C+\\] { DirGoRoot } key [/] { DirGoto } key [\\] { DirGoto } key [A+F] { MainMenu 'F' } key [A+N] { MainMenu 'N' } key [A+W] { MainMenu 'W' } } menu Messages { item "&Close\tAlt+Q" { FileClose } item; item "&Next\tF6" { FileNext } item "&Previous\tShift+F6" { FilePrev } item; item "E&xit\tAlt+X" { ExitEditor } } menu MsgMain { submenu "&Messages", Messages; submenu "&Window", Window; } eventmap MESSAGES: MLIST { MainMenu = "MsgMain"; key [A+M] { MainMenu 'M' } key [A+T] { MainMenu 'T' } key [A+W] { MainMenu 'W' } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_undo.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000001436�11326137320�012066� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_undo.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef E_UNDO_H #define E_UNDO_H /* * only core operations can be directly undone * - Insert # of Lines * - Delete # of Lines * - Insert # Line * - Delete Line Text * - Insert Line Text * - Positioning * - Block marking */ enum UndoCommands { ucInsLine, ucDelLine, ucInsChars, ucDelChars, ucJoinLine, ucSplitLine, ucPosition, ucBlock, ucModified, ucFoldCreate, ucFoldDestroy, ucFoldPromote, ucFoldDemote, ucFoldOpen, ucFoldClose, ucPlaceUserBookmark, ucRemoveUserBookmark }; #endif // E_UNDO_H ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/view.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000102650�11602724002�012116� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* view.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_color.h" #include "c_history.h" #include "e_cvslog.h" #include "e_mark.h" #include "e_svnlog.h" #include "e_tags.h" #include "ftever.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "o_cvs.h" #include "o_cvsdiff.h" #include "o_directory.h" #include "o_messages.h" #include "o_modemap.h" #include "o_routine.h" #include "o_svn.h" #include "o_svndiff.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" EView *ActiveView = 0; extern BufferView *BufferList; EView::EView(EModel *AModel) : MView(0), Model(AModel), NextView(0), Port(0), CurMsg(0) { if (ActiveView) { Prev = ActiveView; Next = ActiveView->Next; Prev->Next = this; Next->Prev = this; } else Prev = Next = this; ActiveView = this; if (Model) Model->CreateViewPort(this); } EView::~EView() { if (Next != this) { Prev->Next = Next; Next->Prev = Prev; if (ActiveView == this) ActiveView = Next; } else ActiveView = 0; if (Model) Model->RemoveView(this); delete Port; //delete MView; free(CurMsg); } int EView::CanQuit() { if (Model) return Model->CanQuit(); return 1; } void EView::FocusChange(int GetFocus) { if (GetFocus) { if (Model->View && Model->View->Port) Model->View->Port->GetPos(); Model->CreateViewPort(this); } else { if (Model) { Model->RemoveView(this); delete Port; Port = 0; if (Model->View && Model->View->Port) Model->View->Port->StorePos(); } } } void EView::Resize(int Width, int Height) { if (Port) Port->Resize(Width, Height); } void EView::SetModel(EModel *AModel) { Model = AModel; ActiveModel = Model; } void EView::SelectModel(EModel *AModel) { if (Model != AModel) { if (Model) FocusChange(0); SetModel(AModel); if (Model) FocusChange(1); } } void EView::SwitchToModel(EModel *AModel) { if (Model != AModel) { if (Model) FocusChange(0); AModel->Prev->Next = AModel->Next; AModel->Next->Prev = AModel->Prev; if (Model) { AModel->Next = Model; AModel->Prev = Model->Prev; AModel->Prev->Next = AModel; Model->Prev = AModel; } else { AModel->Next = AModel->Prev = AModel; } SetModel(AModel); if (Model) FocusChange(1); } } void EView::Activate(int GotFocus) { if (Model && Model->View != this && Port) { Model->SelectView(this); if (GotFocus) { Port->StorePos(); } else { Port->GetPos(); } Port->RepaintView(); if (GotFocus) ActiveView = this; } } int EView::GetContext() { return Model ? Model->GetContext() : 0; } EEventMap *EView::GetEventMap() { return Model ? Model->GetEventMap() : 0; } int EView::BeginMacro() { return Model ? Model->BeginMacro() : 0; } int EView::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExSwitchTo: return SwitchTo(State); case ExFilePrev: return FilePrev(); case ExFileNext: return FileNext(); case ExFileLast: return FileLast(); case ExFileOpen: return FileOpen(State); case ExFileOpenInMode: return FileOpenInMode(State); case ExFileSaveAll: return FileSaveAll(); case ExListRoutines: #ifdef CONFIG_OBJ_ROUTINE return ViewRoutines(State); #else return 0; #endif case ExDirOpen: #ifdef CONFIG_OBJ_DIRECTORY return DirOpen(State); #else return 0; #endif #ifdef CONFIG_OBJ_MESSAGES case ExViewMessages: return ViewMessages(State); case ExCompile: return Compile(State); case ExRunCompiler: return RunCompiler(State); case ExCompilePrevError: return CompilePrevError(State); case ExCompileNextError: return CompileNextError(State); #else case ExViewMessages: return 0; case ExCompile: return 0; case ExCompilePrevError: return 0; case ExCompileNextError: return 0; #endif #ifdef CONFIG_OBJ_CVS case ExCvs: return Cvs(State); case ExRunCvs: return RunCvs(State); case ExViewCvs: return ViewCvs(State); case ExClearCvsMessages: return ClearCvsMessages(State); case ExCvsDiff: return CvsDiff(State); case ExRunCvsDiff: return RunCvsDiff(State); case ExViewCvsDiff: return ViewCvsDiff(State); case ExCvsCommit: return CvsCommit(State); case ExRunCvsCommit: return RunCvsCommit(State); case ExViewCvsLog: return ViewCvsLog(State); #else case ExCvs: return 0; case ExRunCvs: return 0; case ExViewCvs: return 0; case ExClearCvsMessages: return 0; case ExCvsDiff: return 0; case ExRunCvsDiff: return 0; case ExViewCvsDiff: return 0; case ExCvsCommit: return 0; case ExRunCvsCommit: return 0; case ExViewCvsLog: return 0; #endif #ifdef CONFIG_OBJ_SVN case ExSvn: return Svn(State); case ExRunSvn: return RunSvn(State); case ExViewSvn: return ViewSvn(State); case ExClearSvnMessages: return ClearSvnMessages(State); case ExSvnDiff: return SvnDiff(State); case ExRunSvnDiff: return RunSvnDiff(State); case ExViewSvnDiff: return ViewSvnDiff(State); case ExSvnCommit: return SvnCommit(State); case ExRunSvnCommit: return RunSvnCommit(State); case ExViewSvnLog: return ViewSvnLog(State); #else case ExSvn: return 0; case ExRunSvn: return 0; case ExViewSvn: return 0; case ExClearSvnMessages: return 0; case ExSvnDiff: return 0; case ExRunSvnDiff: return 0; case ExViewSvnDiff: return 0; case ExSvnCommit: return 0; case ExRunSvnCommit: return 0; case ExViewSvnLog: return 0; #endif case ExViewBuffers: return ViewBuffers(State); case ExShowKey: return ShowKey(State); case ExToggleSysClipboard: return ToggleSysClipboard(State); case ExSetPrintDevice: return SetPrintDevice(State); case ExShowVersion: return ShowVersion(); case ExViewModeMap: return ViewModeMap(State); case ExClearMessages: return ClearMessages(); #ifdef CONFIG_TAGS case ExTagNext: return TagNext(this); case ExTagPrev: return TagPrev(this); case ExTagPop: return TagPop(this); case ExTagClear: TagClear(); return 1; case ExTagLoad: return TagLoad(State); #endif case ExShowHelp: return SysShowHelp(State, 0); case ExConfigRecompile: return ConfigRecompile(State); case ExRemoveGlobalBookmark:return RemoveGlobalBookmark(State); case ExGotoGlobalBookmark: return GotoGlobalBookmark(State); case ExPopGlobalBookmark: return PopGlobalBookmark(); default: ; } return Model ? Model->ExecCommand(Command, State) : 0; } void EView::HandleEvent(TEvent &Event) { if (Model) Model->HandleEvent(Event); if (Port) Port->HandleEvent(Event); if (Event.What == evCommand) { switch (Event.Msg.Command) { case cmDroppedFile: { char *file = (char *)Event.Msg.Param2; #ifdef CONFIG_OBJ_DIRECTORY if (IsDirectory(file)) OpenDir(file); #endif MultiFileLoad(0, file, NULL, this); } break; } } } void EView::UpdateView() { if (Port) Port->UpdateView(); } void EView::RepaintView() { if (Port) Port->RepaintView(); } void EView::UpdateStatus() { if (Port) Port->UpdateStatus(); } void EView::RepaintStatus() { if (Port) Port->RepaintStatus(); } void EView::DeleteModel(EModel *M) { EView *V; EModel *M1; char s[256]; if (M == 0) return; M->GetName(s, sizeof(s)); Msg(S_INFO, "Closing %s.", s); V = ActiveView = this; while (V) { M1 = V->Model; if (M1 == M) { if (M->Next != M) V->SelectModel(M->Next); else V->SelectModel(0); } V = V->Next; if (V == ActiveView) break; } delete M; SetMsg(0); } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// int EView::FilePrev() { if (Model) { EModel *n=Model->Prev; if (IgnoreBufferList&&n&&n->GetContext ()==CONTEXT_BUFFERS) n=n->Prev; SelectModel(n); return 1; } return 0; } int EView::FileNext() { if (Model) { EModel *n=Model->Next; if (IgnoreBufferList&&n&&n->GetContext ()==CONTEXT_BUFFERS) n=n->Next; SelectModel(n); return 1; } return 0; } int EView::FileLast() { if (Model) { EModel *n=Model->Next; if (IgnoreBufferList&&n&&n->GetContext ()==CONTEXT_BUFFERS) n=n->Next; SwitchToModel(n); return 1; } return 0; } int EView::SwitchTo(ExState &State) { int No; if (State.GetIntParam(this, &No) == 0) { char str[10] = ""; if (MView->Win->GetStr("Obj.Number", sizeof(str), str, 0) == 0) return 0; No = atoi(str); } for (EModel* M = Model; M; M = M->Next) { if (M->ModelNo == No) { SwitchToModel(M); return 1; } if (M->Next == Model) break; } return 0; } int EView::FileSaveAll() { for (EModel *M = Model; M; M = M->Next) { if (M->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)M; if (B->Modified) { SwitchToModel(B); if (B->Save() == 0) return 0; } } if (M->Next == Model) break; } return 1; } int EView::FileOpen(ExState &State) { char FName[MAXPATH]; if (State.GetStrParam(this, FName, sizeof(FName)) == 0) { if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0) return 0; if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; } if( strlen( FName ) == 0 ) return 0; #ifdef CONFIG_OBJ_DIRECTORY if (IsDirectory(FName)) return OpenDir(FName); #endif return MultiFileLoad(0, FName, NULL, this); } int EView::FileOpenInMode(ExState &State) { char Mode[32] = ""; char FName[MAXPATH]; if (State.GetStrParam(this, Mode, sizeof(Mode)) == 0) if (MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) != 1) return 0; if (FindMode(Mode) == 0) { MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid mode '%s'", Mode); return 0; } if (GetDefaultDirectory(Model, FName, sizeof(FName)) == 0) return 0; if (State.GetStrParam(this, FName, sizeof(FName)) == 0) if (MView->Win->GetFile("Open file", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; #ifdef CONFIG_OBJ_DIRECTORY if (IsDirectory(FName)) return OpenDir(FName); #endif if( strlen( FName ) == 0 ) return 0; return MultiFileLoad(0, FName, Mode, this); } int EView::SetPrintDevice(ExState &State) { char Dev[sizeof(PrintDevice)]; strcpy(Dev, PrintDevice); if (State.GetStrParam(this, Dev, sizeof(Dev)) == 0) if (MView->Win->GetStr("Print to", sizeof(Dev), Dev, HIST_SETUP) == 0) return 0; strcpy(PrintDevice, Dev); return 1; } int EView::ToggleSysClipboard(ExState &/*State*/) { SystemClipboard = SystemClipboard ? 0 : 1; Msg(S_INFO, "SysClipboard is now %s.", SystemClipboard ? "ON" : "OFF"); return 1; } int EView::ShowKey(ExState &/*State*/) { char buf[100]; KeySel ks; ks.Mask = 0; ks.Key = MView->Win->GetChar(0); GetKeyName(buf, sizeof(buf), ks); Msg(S_INFO, "Key: '%s' - '%8X'", buf, ks.Key); return 1; } void EView::Msg(int level, const char *s, ...) { char msgbuftmp[MSGBUFTMP_SIZE]; va_list ap; va_start(ap, s); vsnprintf(msgbuftmp, sizeof(msgbuftmp), s, ap); va_end(ap); if (level != S_BUSY) SetMsg(msgbuftmp); } void EView::SetMsg(const char *msg) { free(CurMsg); CurMsg = (msg && msg[0]) ? strdup(msg) : 0; if (CurMsg && MView) { TDrawBuffer B; char SColor; int Cols, Rows; MView->ConQuerySize(&Cols, &Rows); if (MView->IsActive()) SColor = (char)hcStatus_Active; else SColor = (char)hcStatus_Normal; MoveChar(B, 0, Cols, ' ', SColor, Cols); MoveStr(B, 0, Cols, CurMsg, SColor, Cols); if (MView->Win->GetStatusContext() == MView) MView->ConPutBox(0, Rows - 1, Cols, 1, B); //printf("%s\n", Msg); } } int EView::ViewBuffers(ExState &/*State*/) { if (BufferList == 0) { BufferList = new BufferView(0, &ActiveModel); SwitchToModel(BufferList); } else { BufferList->UpdateList(); BufferList->Row = 1; SwitchToModel(BufferList); } return 1; } #ifdef CONFIG_OBJ_ROUTINE int EView::ViewRoutines(ExState &/*State*/) { EModel *M = Model; if (M->GetContext() != CONTEXT_FILE) return 0; EBuffer *Buffer = (EBuffer *)M; if (Buffer->Routines == 0) { if (BFS(Buffer, BFS_RoutineRegexp) == 0) { MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return 0; } Buffer->Routines = new RoutineView(0, &ActiveModel, Buffer); } else { Buffer->Routines->UpdateList(); } SwitchToModel(Buffer->Routines); return 1; } #endif #ifdef CONFIG_OBJ_DIRECTORY int EView::DirOpen(ExState &State) { char Path[MAXPATH]; if (State.GetStrParam(this, Path, sizeof(Path)) == 0) if (GetDefaultDirectory(Model, Path, sizeof(Path)) == 0) return 0; return OpenDir(Path); } int EView::OpenDir(const char *Path) { char XPath[MAXPATH]; EDirectory *dir = 0; if (ExpandPath(Path, XPath, sizeof(XPath)) == -1) return 0; for (EModel *x = Model; x; x = x->Next) { if (x->GetContext() == CONTEXT_DIRECTORY) { if (filecmp(((EDirectory *)x)->Path.c_str(), XPath) == 0) { dir = (EDirectory *)x; break; } } if (x->Next == Model) break; } if (dir == 0) dir = new EDirectory(0, &ActiveModel, XPath); SelectModel(dir); return 1; } #endif #ifdef CONFIG_OBJ_MESSAGES int EView::Compile(ExState &State) { static char Cmd[256] = ""; char Command[256] = ""; if (CompilerMsgs != 0 && CompilerMsgs->IsRunning()) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Command, sizeof(Command)) == 0) { if (Model->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)Model; if (BFS(B, BFS_CompileCommand) != 0) strcpy(Cmd, BFS(B, BFS_CompileCommand)); } if (Cmd[0] == 0) strlcpy(Cmd, CompileCommand, sizeof(Cmd)); if (MView->Win->GetStr("Compile", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; strlcpy(Command, Cmd, sizeof(Cmd)); } else { if (MView->Win->GetStr("Compile", sizeof(Command), Command, HIST_COMPILE) == 0) return 0; } return Compile(Command); } int EView::RunCompiler(ExState &State) { char Command[256] = ""; if (CompilerMsgs != 0 && CompilerMsgs->IsRunning()) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Command, sizeof(Command)) == 0) { if (Model->GetContext() == CONTEXT_FILE) { EBuffer *B = (EBuffer *)Model; if (BFS(B, BFS_CompileCommand) != 0) strlcpy(Command, BFS(B, BFS_CompileCommand), sizeof(Command)); } if (Command[0] == 0) strlcpy(Command, CompileCommand, sizeof(Command)); } return Compile(Command); } int EView::Compile(char *Command) { char Dir[MAXPATH] = ""; EMessages *msgs; if (CompilerMsgs != 0) { strlcpy(Dir, CompilerMsgs->GetDirectory(), sizeof(Dir)); CompilerMsgs->RunPipe(Dir, Command); msgs = CompilerMsgs; } else { if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; msgs = new EMessages(0, &ActiveModel, Dir, Command); } SwitchToModel(msgs); return 1; } int EView::ViewMessages(ExState &/*State*/) { if (!CompilerMsgs) return 0; SwitchToModel(CompilerMsgs); return 1; } int EView::CompilePrevError(ExState &/*State*/) { if (!CompilerMsgs) return 0; return CompilerMsgs->CompilePrevError(this); } int EView::CompileNextError(ExState &/*State*/) { if (!CompilerMsgs) return 0; return CompilerMsgs->CompileNextError(this); } #endif int EView::ShowVersion() { MView->Win->Choice(0, "About", 1, "O&K", PROGRAM " " VERSION " " COPYRIGHT); return 1; } int EView::ViewModeMap(ExState &/*State*/) { if (TheEventMapView != 0) TheEventMapView->ViewMap(GetEventMap()); else // FIXME: Complete MESS!! (void)new EventMapView(0, &ActiveModel, GetEventMap()); if (!TheEventMapView) return 0; SwitchToModel(TheEventMapView); return 1; } int EView::ClearMessages() { if (CompilerMsgs) { if (CompilerMsgs->IsRunning()) { Msg(S_INFO, "Running..."); return 0; } CompilerMsgs->FreeErrors(); CompilerMsgs->UpdateList(); } return 1; } #ifdef CONFIG_TAGS int EView::TagLoad(ExState &State) { char Tag[MAXPATH]; char FullTag[MAXPATH]; const char* pTagFile = getenv("TAGFILE"); if (pTagFile == NULL) pTagFile = "tags"; if (ExpandPath(pTagFile, Tag, sizeof(Tag)) == -1) return 0; if (State.GetStrParam(this, Tag, sizeof(Tag)) == 0) if (MView->Win->GetFile("Load tags", sizeof(Tag), Tag, HIST_TAGFILES, GF_OPEN) == 0) return 0; if (ExpandPath(Tag, FullTag, sizeof(FullTag)) == -1) return 0; if (!FileExists(FullTag)) { Msg(S_INFO, "Tag file '%s' not found.", FullTag); return 0; } return ::TagLoad(FullTag); } #endif int EView::ConfigRecompile(ExState &/*State*/) { if (ConfigSourcePath == 0 || ConfigFileName[0] == 0) { Msg(S_ERROR, "Cannot recompile (must use external configuration)."); return 0; } char command[1024]; strlcpy(command, "cfte \"", sizeof(command)); strlcat(command, ConfigSourcePath, sizeof(command)); strlcat(command, "\" ", sizeof(command)); #ifdef UNIX if (ExpandPath("~/.fterc", command + strlen(command), sizeof(command) - strlen(command)) != 0) return 0; #else strlcat(command, "\"", sizeof(command)); strlcat(command, ConfigFileName, sizeof(command)); strlcat(command, "\"", sizeof(command)); #endif return Compile(command); } int EView::RemoveGlobalBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(this, name, sizeof(name)) == 0) if (MView->Win->GetStr("Remove Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.remove(name) == 0) { Msg(S_ERROR, "Error removing global bookmark %s.", name); return 0; } return 1; } int EView::GotoGlobalBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(this, name, sizeof(name)) == 0) if (MView->Win->GetStr("Goto Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.view(this, name) == 0) { Msg(S_ERROR, "Error locating global bookmark %s.", name); return 0; } return 1; } int EView::PopGlobalBookmark() { if (markIndex.popMark(this) == 0) { Msg(S_INFO, "Bookmark stack empty."); return 0; } return 1; } int EView::GetStrVar(int var, char *str, size_t buflen) { //switch (var) { //} return Model->GetStrVar(var, str, buflen); } int EView::GetIntVar(int var, int *value) { //switch (var) { //} return Model->GetIntVar(var, value); } #ifdef CONFIG_OBJ_CVS int EView::Cvs(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS options", sizeof(Opts), Opts, HIST_CVS) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS options", sizeof(Options), Options, HIST_CVS) == 0) return 0; } return Cvs(Options); } int EView::RunCvs(ExState &State) { char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return Cvs(Options); } int EView::Cvs(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvs *cvs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsView != 0) { CvsView->RunPipe(Dir, Command, OnFiles); cvs = CvsView; } else { cvs = new ECvs(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(cvs); return 1; } int EView::ClearCvsMessages(ExState &/*State*/) { if (CvsView != 0) { if (CvsView->Running) { Msg(S_INFO, "Running..."); return 0; } else { CvsView->FreeLines(); CvsView->UpdateList(); return 1; } } return 0; } int EView::ViewCvs(ExState &/*State*/) { if (!CvsView) return 0; SwitchToModel(CvsView); return 1; } int EView::CvsDiff(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsDiffView != 0 && CvsDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS diff options", sizeof(Opts), Opts, HIST_CVSDIFF) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS diff options", sizeof(Options), Options, HIST_CVSDIFF) == 0) return 0; } return CvsDiff(Options); } int EView::RunCvsDiff(ExState &State) { char Options[128] = ""; if (CvsDiffView != 0 && CvsDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return CvsDiff(Options); } int EView::CvsDiff(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvsDiff *diffs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " diff -c "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsDiffView != 0) { CvsDiffView->RunPipe(Dir, Command, OnFiles); diffs = CvsDiffView; } else { diffs = new ECvsDiff(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(diffs); return 1; } int EView::ViewCvsDiff(ExState &/*State*/) { if (!CvsDiffView) return 0; SwitchToModel(CvsDiffView); return 1; } int EView::CvsCommit(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("CVS commit options", sizeof(Opts), Opts, HIST_CVSCOMMIT) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("CVS commit options", sizeof(Options), Options, HIST_CVSCOMMIT) == 0) return 0; } return CvsCommit(Options); } int EView::RunCvsCommit(ExState &State) { char Options[128] = ""; if (CvsView != 0 && CvsView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return CvsCommit(Options); } int EView::CvsCommit(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ECvs *cvs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, CvsCommand); strcat(Command, " commit "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_CVSDIFF: OnFiles = strdup(CvsDiffView->OnFiles); break; case CONTEXT_CVS: OnFiles = ((ECvs *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ECvs *)Model)->OnFiles); break; } if (CvsView == 0) cvs = new ECvs(0, &ActiveModel);else cvs = CvsView; SwitchToModel(cvs); cvs->RunCommit(Dir, Command, OnFiles); if (OnFiles != buf) free(OnFiles); return 1; } int EView::ViewCvsLog(ExState &/*State*/) { if (CvsLogView != 0) { SwitchToModel(CvsLogView); return 1; } return 0; } #endif #ifdef CONFIG_OBJ_SVN int EView::Svn(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN options", sizeof(Opts), Opts, HIST_SVN) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN options", sizeof(Options), Options, HIST_SVN) == 0) return 0; } return Svn(Options); } int EView::RunSvn(ExState &State) { char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return Svn(Options); } int EView::Svn(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvn *svn; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strlcpy(Command, SvnCommand, sizeof(Command)); strlcat(Command, " ", sizeof(Command)); if (Options[0] != 0) { strlcat(Command, Options, sizeof(Command)); strlcat(Command, " ", sizeof(Command)); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } if (SvnView != 0) { SvnView->RunPipe(Dir, Command, OnFiles); svn = SvnView; } else { svn = new ESvn(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(svn); return 1; } int EView::ClearSvnMessages(ExState &/*State*/) { if (SvnView != 0) { if (SvnView->Running) { Msg(S_INFO, "Running..."); return 0; } else { SvnView->FreeLines(); SvnView->UpdateList(); return 1; } } return 0; } int EView::ViewSvn(ExState &/*State*/) { if (!SvnView) return 0; SwitchToModel(SvnView); return 1; } int EView::SvnDiff(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnDiffView != 0 && SvnDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN diff options", sizeof(Opts), Opts, HIST_SVNDIFF) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN diff options", sizeof(Options), Options, HIST_SVNDIFF) == 0) return 0; } return SvnDiff(Options); } int EView::RunSvnDiff(ExState &State) { char Options[128] = ""; if (SvnDiffView != 0 && SvnDiffView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return SvnDiff(Options); } int EView::SvnDiff(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvnDiff *diffs; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, SvnCommand); strcat(Command, " diff "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } if (SvnDiffView != 0) { SvnDiffView->RunPipe(Dir, Command, OnFiles); diffs = SvnDiffView; } else { diffs = new ESvnDiff(0, &ActiveModel, Dir, Command, OnFiles); } if (OnFiles != buf) free(OnFiles); SwitchToModel(diffs); return 1; } int EView::ViewSvnDiff(ExState &/*State*/) { if (!SvnDiffView) return 0; SwitchToModel(SvnDiffView); return 1; } int EView::SvnCommit(ExState &State) { static char Opts[128] = ""; char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } if (State.GetStrParam(this, Options, sizeof(Options)) == 0) { if (MView->Win->GetStr("SVN commit options", sizeof(Opts), Opts, HIST_SVNCOMMIT) == 0) return 0; strcpy(Options, Opts); } else { if (MView->Win->GetStr("SVN commit options", sizeof(Options), Options, HIST_SVNCOMMIT) == 0) return 0; } return SvnCommit(Options); } int EView::RunSvnCommit(ExState &State) { char Options[128] = ""; if (SvnView != 0 && SvnView->Running) { Msg(S_INFO, "Already running..."); return 0; } State.GetStrParam(this, Options, sizeof(Options)); return SvnCommit(Options); } int EView::SvnCommit(char *Options) { char Dir[MAXPATH] = ""; char Command[256] = ""; char buf[1024] = ""; char *OnFiles = buf; ESvn *svn; if (GetDefaultDirectory(Model, Dir, sizeof(Dir)) == 0) return 0; strcpy(Command, SvnCommand); strcat(Command, " commit "); if (Options[0] != 0) { strcat(Command, Options); strcat(Command, " "); } switch (Model->GetContext()) { case CONTEXT_FILE: if (JustFileName(((EBuffer *)Model)->FileName, OnFiles, sizeof(buf)) != 0) return 0; // OnFiles points to buf break; case CONTEXT_SVNDIFF: OnFiles = strdup(SvnDiffView->OnFiles); break; case CONTEXT_SVN: OnFiles = ((ESvn *)Model)->MarkedAsList(); if (!OnFiles) OnFiles = strdup(((ESvn *)Model)->OnFiles); break; } svn = (!SvnView) ? new ESvn(0, &ActiveModel) : SvnView; SwitchToModel(svn); svn->RunCommit(Dir, Command, OnFiles); if (OnFiles != buf) free(OnFiles); return 1; } int EView::ViewSvnLog(ExState &/*State*/) { if (!SvnLogView) return 0; SwitchToModel(SvnLogView); return 1; } #endif ����������������������������������������������������������������������������������������./src/o_cvsdiff.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002002�11331412505�012542� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvsdiff.h * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Class showing output from CVS diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #ifndef O_CVSDIFF_H #define O_CVSDIFF_H #include "fte.h" #ifdef CONFIG_OBJ_CVS #include "o_cvsbase.h" class ECvsDiff: public ECvsBase { public: int CurrLine,ToLine,InToFile; char *CurrFile; ECvsDiff (int createFlags,EModel **ARoot,char *Dir,char *ACommand,char *AOnFiles); ~ECvsDiff (); void ParseFromTo (char *line,int len); virtual void ParseLine (char *line,int len); // Returns 0 if OK virtual int RunPipe(const char *Dir, const char *Command, const char *Info); virtual int ExecCommand(ExCommands Command, ExState &State); int BlockCopy (int Append); virtual int GetContext () {return CONTEXT_CVSDIFF;} virtual EEventMap *GetEventMap (); }; extern ECvsDiff *CvsDiffView; #endif #endif // O_CVSDIFF_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_cvsdiff.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000007217�11602724002�013111� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvsdiff.cpp * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Class showing output from CVS diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #include "o_cvsdiff.h" #ifdef CONFIG_OBJ_CVS #include "c_bind.h" #include "c_config.h" #include "e_buffer.h" #include "s_util.h" #include "sysdep.h" ECvsDiff *CvsDiffView=0; ECvsDiff::ECvsDiff (int createFlags, EModel **ARoot, char *ADir, char *ACommand, char *AOnFiles) : ECvsBase (createFlags, ARoot, "CVS diff"), CurrLine(0), ToLine(0), InToFile(0), CurrFile(0) { CvsDiffView=this; RunPipe (ADir,ACommand,AOnFiles); } ECvsDiff::~ECvsDiff () { CvsDiffView=0; free (CurrFile); } void ECvsDiff::ParseFromTo (char *line,int /*len*/) { char *end; CurrLine=strtol (line+4,&end,10)-1; if (*end==',') ToLine=atoi (end+1);else ToLine=CurrLine+1; if (!(CurrLine<ToLine&&ToLine>0)) CurrLine=ToLine=0; } void ECvsDiff::ParseLine (char *line,int len) { if (len>7&&strncmp (line,"Index: ",7)==0) { // Filename free (CurrFile);CurrFile=strdup (line+7); CurrLine=ToLine=InToFile=0; AddLine (CurrFile,-1,line); } else if (len>8&&strncmp (line,"*** ",4)==0) { // From file or from hunk if (strcmp (line+len-5," ****")==0) { // From hunk ParseFromTo (line,len); } InToFile=0; AddLine (0,-1,line); } else if (len>8&&strncmp (line,"--- ",4)==0) { // To file or to hunk if (strcmp (line+len-5," ----")==0) { // To hunk if (CurrFile) { ParseFromTo (line,len); AddLine (CurrFile,CurrLine,line,1); } else AddLine (0,-1,line); } else { // To-file AddLine (CurrFile,-1,line); } InToFile=1; } else if (strcmp (line,"***************")==0) { // Hunk start CurrLine=ToLine=0; AddLine (0,-1,line); } else if (CurrLine<ToLine) { // Diff line (markable, if CurrFile is set, also hilited) if (InToFile) AddLine (CurrFile,CurrLine,line,5); else AddLine (0,CurrLine,line,4); CurrLine++; } else AddLine (0,-1,line); } int ECvsDiff::RunPipe(const char *ADir, const char *ACommand, const char *AOnFiles) { FreeLines (); free (CurrFile); CurrLine=ToLine=InToFile=0; CurrFile=0; return ECvsBase::RunPipe (ADir,ACommand,AOnFiles); } int ECvsDiff::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExBlockCopy: return BlockCopy(0); case ExBlockCopyAppend: return BlockCopy(1); default: ; } return EList::ExecCommand(Command, State); } int ECvsDiff::BlockCopy (int Append) { if (SSBuffer==0) return 0; if (Append) { if (SystemClipboard) GetPMClip(0); } else SSBuffer->Clear (); SSBuffer->BlockMode=bmLine; // How to set these two ? BFI (SSBuffer,BFI_TabSize)=8; BFI (SSBuffer,BFI_ExpandTabs)=0; BFI (SSBuffer,BFI_Undo)=0; // Go through list of marked lines int last=-1,tl=0; for (int i=0;i<LineCount;i++) { if (Lines[i]->Status&2) { // Marked if (last!=i-1&&tl) { // Gap between this and last marked line SSBuffer->InsLine (tl++,0); } SSBuffer->InsertLine (tl++,strlen (Lines[i]->Msg+2),Lines[i]->Msg+2); last=i; } } if (SystemClipboard) PutPMClip (0); return 1; } // Event map - this name is used in config files when defining eventmap EEventMap *ECvsDiff::GetEventMap () { return FindEventMap ("CVSDIFF"); } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_search.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000001465�11344266047�012405� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_search.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_SEARCH_H #define I_SEARCH_H #include "i_oview.h" #include "e_buffer.h" class ExISearch: public ExViewNext { enum IState { IOk, INoMatch, INoPrev, INoNext }; public: static const unsigned MAXISEARCH = 256; ExISearch(EBuffer *B); virtual ~ExISearch(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); void SetState(IState state); private: char ISearchStr[MAXISEARCH + 1]; EPoint Orig; EPoint stack[MAXISEARCH]; int len; int stacklen; EBuffer *Buffer; IState state; int Direction; }; #endif // I_SEARCH_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/bin2c.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000001444�11160327163�012146� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "sysdep.h" #define BUFLEN (64 * 1024) static unsigned char buf[BUFLEN]; int main(int argc, char **argv) { int fd; int i, n = 1, len; if (argc != 2) { fprintf(stderr, "Usage: %s filename\n", argv[0]); exit(1); } if ((fd = open(argv[1], O_RDONLY | O_BINARY)) == -1) { fprintf(stderr, "Open: %s, error=%d\n", argv[1], errno); exit(1); } printf("/* do not edit */\nstatic const unsigned char DefaultConfig[] = {\n"); while ((len = read(fd, buf, BUFLEN)) > 0) { for (i = 0; i < len; i++) { printf("0x%02.02X", buf[i]); if (n++ % 10) { printf(", "); } else { printf(",\n"); } } } close(fd); printf("\n};\n"); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_svnbase.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000026066�11602724002�013131� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svnbase.cpp * * S.Pinigin copy o_cvsbase.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Base class for all other SVN-related classes. This is similar to EMessages * - starts SVN and shows its messages in list view. */ #include "o_svnbase.h" #ifdef CONFIG_OBJ_SVN #include "c_commands.h" #include "i_view.h" #include "o_buflist.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include "sysdep.h" #include <stdio.h> #define MAXREGEXP 32 static int SvnIgnoreRegexpCount=0; static RxNode *SvnIgnoreRegexp[MAXREGEXP]; int AddSvnIgnoreRegexp (const char *regexp) { if (SvnIgnoreRegexpCount>=MAXREGEXP) return 0; if ((SvnIgnoreRegexp[SvnIgnoreRegexpCount]=RxCompile (regexp))==NULL) return 0; SvnIgnoreRegexpCount++; return 1; } void FreeSvnIgnoreRegexp () { while (SvnIgnoreRegexpCount--) { RxFree (SvnIgnoreRegexp[SvnIgnoreRegexpCount]); } } ESvnBase::ESvnBase (int createFlags, EModel **ARoot, const char *title) : EList (createFlags, ARoot, title), Command(0), Directory(0), OnFiles(0), LineCount(0), Lines(0), Running(0), BufLen(0), BufPos(0), PipeId(-1), ReturnCode(-1) { } ESvnBase::~ESvnBase () { gui->ClosePipe (PipeId); FreeLines (); free (Command); free (Directory); free (OnFiles); } void ESvnBase::FreeLines () { if (Lines) { for (int i=0;i<LineCount;i++) { if (Lines[i]->Buf&&Lines[i]->Line>=0) { // Has buffer and line == bookmark -> remove it char book[16]; sprintf (book,"_SVN.%d",i); Lines[i]->Buf->RemoveBookmark (book); } free (Lines[i]->Msg); free (Lines[i]->File); free (Lines[i]); } free (Lines); } LineCount=0; Lines=0; BufLen=BufPos=0; } void ESvnBase::AddLine (const char *file, int line, const char *msg, int status) { SvnLine *l; l=(SvnLine *)malloc (sizeof (SvnLine)); if (l!=0) { l->File=file?strdup (file):0; l->Line=line; l->Msg=msg?strdup (msg):0; l->Buf=0; l->Status = (char)status; LineCount++; Lines=(SvnLine **)realloc (Lines,sizeof (SvnLine *)*LineCount); Lines[LineCount-1]=l; FindBuffer (LineCount-1); UpdateList (); } } void ESvnBase::FindBuffer (int line) { assert (line>=0&&line<LineCount); if (Lines[line]->File!=0) { EBuffer *B; Lines[line]->Buf=0; char path[MAXPATH]; strcpy (path,Directory);Slash (path,1);strcat (path,Lines[line]->File); B=FindFile (path); if (B!=0&&B->Loaded!=0) AssignBuffer (B,line); } } void ESvnBase::AssignBuffer (EBuffer *B,int line) { assert (line>=0&&line<LineCount); char book[16]; EPoint P; Lines[line]->Buf=B; if (Lines[line]->Line>=0) { sprintf (book,"_SVN.%d",line); P.Col=0; P.Row=Lines[line]->Line; if (P.Row>=B->RCount) P.Row=B->RCount-1; B->PlaceBookmark (book,P); } } void ESvnBase::FindFileLines (EBuffer *B) { char path[MAXPATH]; char *pos; strcpy (path,Directory);Slash (path,1);pos=path+strlen (path); for (int i=0;i<LineCount;i++) if (Lines[i]->Buf==0&&Lines[i]->File!=0) { strcpy (pos,Lines[i]->File); if (filecmp (B->FileName,path)==0) { AssignBuffer (B,i); } } } void ESvnBase::NotifyDelete (EModel *Deleting) { for (int i=0;i<LineCount;i++) { if (Lines[i]->Buf==Deleting) { Lines[i]->Buf=0; } } } int ESvnBase::GetLine(char *Line, size_t max) { ssize_t rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); if (!max) return 0; *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ContinuePipe (); } if (rc > 0) BufLen += rc; } l = max - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } void ESvnBase::ParseLine (char *line, size_t) { AddLine (0,-1,line); } void ESvnBase::NotifyPipe (int APipeId) { if (APipeId==PipeId) { char line[1024]; RxMatchRes RM; int i; while (GetLine(line, sizeof(line))) { size_t len = strlen(line); if (len>0&&line[len-1]=='\n') line[--len]=0; for (i=0;i<SvnIgnoreRegexpCount;i++) if (RxExec (SvnIgnoreRegexp[i],line,len,line,&RM)==1) break; if (i==SvnIgnoreRegexpCount) ParseLine (line,len); } if (!Running) { char s[30]; sprintf (s,"[done, status=%d]",ReturnCode); AddLine (0,-1,s); } } } int ESvnBase::RunPipe (const char *ADir, const char *ACommand, const char *AOnFiles) { free (Command); free (Directory); free (OnFiles); Command=strdup (ACommand); Directory=strdup (ADir); OnFiles=strdup (AOnFiles); ReturnCode=-1; Row=LineCount-1; OnFilesPos=OnFiles; { char s[2*MAXPATH*4]; sprintf (s,"[running svn in '%s']",Directory); AddLine (0,-1,s); } ChangeDir (Directory); return ContinuePipe (); } int ESvnBase::ContinuePipe () { char RealCommand[2048]; size_t space; if (!OnFilesPos) { // At the end of all files, terminate ClosePipe (); return 0; } else if (Running) { // Already running, close the pipe and continue ReturnCode=gui->ClosePipe (PipeId); } else { // Not running -> set to Running mode Running=1; } // Make real command with some files from OnFiles, update OnFilesPos strcat (strcpy (RealCommand,Command)," "); space=sizeof (RealCommand)-strlen (RealCommand)-1; if (space>=strlen (OnFilesPos)) { strcat (RealCommand,OnFilesPos); OnFilesPos=NULL; } else { char c=OnFilesPos[space]; OnFilesPos[space]=0; char *s=strrchr (OnFilesPos,' '); OnFilesPos[space]=c; if (!s) { ClosePipe (); return 0; } *s=0; strcat (RealCommand,OnFilesPos); OnFilesPos=s+1; while (*OnFilesPos==' ') OnFilesPos++; if (!*OnFilesPos) OnFilesPos=NULL; } BufLen=BufPos=0; { char s[sizeof (RealCommand)+32]; sprintf (s,"[continuing: '%s']",RealCommand); AddLine (0,-1,s); } PipeId=gui->OpenPipe (RealCommand,this); return 0; } void ESvnBase::ClosePipe () { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } void ESvnBase::DrawLine (PCell B,int Line,int Col,ChColor color,int Width) { if (Line<LineCount) if (Col<(int)strlen (Lines[Line]->Msg)) { char str[1024]; size_t len = UnTabStr(str,sizeof(str), Lines[Line]->Msg, strlen(Lines[Line]->Msg)); if ((int)len > Col) MoveStr (B,0,Width,str+Col,color,Width); } } char *ESvnBase::FormatLine (int Line) { if (Line<LineCount) return strdup (Lines[Line]->Msg);else return 0; } void ESvnBase::UpdateList () { if (LineCount<=Row||Row>=Count-1) Row=LineCount-1; Count=LineCount; EList::UpdateList (); } int ESvnBase::Activate (int No) { ShowLine (View,No); return 1; } int ESvnBase::CanActivate(int Line) { return Line<LineCount&&Lines[Line]->File; } int ESvnBase::IsHilited (int Line) { return Line<LineCount&&(Lines[Line]->Status&1); } int ESvnBase::IsMarked (int Line) { return Line<LineCount&&(Lines[Line]->Status&2); } int ESvnBase::Mark (int Line) { if (Line<LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status|=2; return 1; } else return 0; } int ESvnBase::Unmark (int Line) { if (Line<LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status&=~2; return 1; } else return 0; } int ESvnBase::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ClosePipe (); { char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddLine(0, -1, s); } return 1; case ExActivateInOtherWindow: ShowLine(View->Next, Row); return 1; default: ; } return EList::ExecCommand(Command, State); } void ESvnBase::ShowLine (EView *V,int line) { if (line>=0&&line<LineCount&&Lines[line]->File) { if (Lines[line]->Buf!=0) { V->SwitchToModel (Lines[line]->Buf); if (Lines[line]->Line!=-1) { char book[16]; sprintf(book,"_SVN.%d",line); Lines[line]->Buf->GotoBookmark (book); } } else { char path[MAXPATH]; strcpy (path,Directory);Slash (path,1);strcat (path,Lines[line]->File); if (FileLoad (0,path,0,V)==1) { V->SwitchToModel (ActiveModel); if (Lines[line]->Line!=-1) ((EBuffer *)ActiveModel)->CenterNearPosR (0,Lines[line]->Line); } } } } // Event map - this name is used in config files when defining eventmap EEventMap *ESvnBase::GetEventMap () { return FindEventMap ("SVNBASE"); } // Shown in "Closing xxx..." message when closing model void ESvnBase::GetName(char *AName, size_t MaxLen) { strlcpy(AName, Title, MaxLen); } // Shown in buffer list void ESvnBase::GetInfo(char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d/%03d %s (%s)", ModelNo, Row, Count, Title, Command); if (MaxLen > 1) AInfo[MaxLen - 2] = ')'; if (MaxLen > 0) AInfo[MaxLen - 1] = 0; } // Used to get default directory of model void ESvnBase::GetPath(char *APath, size_t MaxLen) { strlcpy(APath, Directory, MaxLen); Slash (APath, 0); } // Normal and short title (normal for window, short for icon in X) void ESvnBase::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { snprintf(ATitle, MaxLen, "%s: %s", Title, Command); strlcpy(ASTitle, Title, SMaxLen); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/gui.h�����������������������������������������������������������������������������������������0000644�0001750�0001750�00000014346�11602724002�011401� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* gui.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef GUI_H #define GUI_H #include "console.h" #include <stdarg.h> class GFramePeer; class GViewPeer; class GUI; class GFrame; class GView { public: GFrame *Parent; GView *Next, *Prev; GViewPeer *Peer; int Result; GView(GFrame *parent, int XSize, int YSize); virtual ~GView(); int ConClear(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); int CaptureMouse(int grab); int CaptureFocus(int grab); virtual int Execute(); void EndExec(int NewResult); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int IsActive(); virtual void Update(); virtual void Repaint(); virtual void Activate(int gotfocus); virtual void Resize(int width, int height); virtual void HandleEvent(TEvent &Event); }; class GFrame { public: GFrame *Prev, *Next; GView *Top, *Active; GFramePeer *Peer; char *Menu; GFrame(int XSize, int YSize); virtual ~GFrame(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int AddView(GView *view); int ConSplitView(GView *view, GView *newview); int ConCloseView(GView *view); int ConResizeView(GView *view, int DeltaY); int SelectView(GView *view); virtual void Update(); virtual void Repaint(); virtual void UpdateMenu(); void InsertView(GView *Prev, GView *view); void RemoveView(GView *view); void SelectNext(int back); void Resize(int width, int height); void DrawMenuBar(); int ExecMainMenu(char Sub); int SetMenu(const char *Name); char *QueryMenu(); int PopupMenu(const char *Name); void Show(); void Activate(); int isLastFrame(); }; class GUI { public: enum { RUN_WAIT, RUN_ASYNC }; GUI(int &argc, char **argv, int XSize, int YSize); virtual ~GUI(); int ConSuspend(); int ConContinue(); int ShowEntryScreen(); void ProcessEvent(); virtual void DispatchEvent(GFrame *frame, GView *view, TEvent &Event); int ConGetEvent(TEventMask EventMask, TEvent* Event, int WaitTime, int Delete, GView **view); int ConPutEvent(const TEvent& Event); int ConFlush(); int ConGrabEvents(TEventMask EventMask); virtual int Start(int &argc, char **argv); virtual void Stop(); int Run(); void StopLoop(); int RunProgram(int mode, char *Command); int OpenPipe(const char *Command, EModel *notify); int SetPipeView(int id, EModel *notify); ssize_t ReadPipe(int id, void *buffer, size_t len); int ClosePipe(int id); int multiFrame(); int fArgc; char **fArgv; int doLoop; }; extern GFrame *frames; extern GUI *gui; #define GUIDLG_CHOICE 0x00000001 #define GUIDLG_PROMPT 0x00000002 #define GUIDLG_PROMPT2 0x00000004 #define GUIDLG_FILE 0x00000008 #define GUIDLG_FIND 0x00000010 #define GUIDLG_FINDREPLACE 0x00000020 extern unsigned long HaveGUIDialogs; void DieError(int rc, const char *msg, ...); #define GF_OPEN 0x0001 #define GF_SAVEAS 0x0002 int DLGGetStr(GView *View, const char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags); int DLGGetFile(GView *View, const char *Prompt, unsigned int BufLen, char *FileName, int Flags); #define GPC_NOTE 0x0000 #define GPC_CONFIRM 0x0001 #define GPC_WARNING 0x0002 #define GPC_ERROR 0x0004 #define GPC_FATAL 0x0008 int DLGPickChoice(GView *View, const char *ATitle, int NSel, va_list ap, int Flags); #define SEARCH_BACK 0x00000001 // reverse (TODO for regexps) #define SEARCH_RE 0x00000002 // use regexp #define SEARCH_NCASE 0x00000004 // case #define SEARCH_GLOBAL 0x00000008 // start from begining (or end if BACK) #define SEARCH_BLOCK 0x00000010 // search in block #define SEARCH_NEXT 0x00000020 // next match #define SEARCH_NASK 0x00000040 // ask before replacing #define SEARCH_ALL 0x00000080 // search all #define SEARCH_REPLACE 0x00000100 // do a replace operation #define SEARCH_JOIN 0x00000200 // join line #define SEARCH_DELETE 0x00000400 // delete line #define SEARCH_CENTER 0x00001000 // center finds #define SEARCH_NOPOS 0x00002000 // don't move the cursor #define SEARCH_WORDBEG 0x00004000 // match at beginning of words only #define SEARCH_WORDEND 0x00008000 // match at end of words only #define SEARCH_WORD (SEARCH_WORDBEG | SEARCH_WORDEND) //0x00000800 // search words //#define SEARCH_LINE 0x00002000 // search on current line only TODO //#define SEARCH_WRAP 0x00004000 // similiar to GLOBAL, but goes to start // only when match from current position fails TODO //#define SEARCH_BOL 0x00008000 // search at line start //#define SEARCH_EOL 0x00010000 // search at line end #define MAXSEARCH 512 struct SearchReplaceOptions { int ok; int resCount; int lastInsertLen; unsigned long Options; //enum { MAXSEARCH = 512 }; char strSearch[MAXSEARCH]; char strReplace[MAXSEARCH]; SearchReplaceOptions(); }; int DLGGetFind(GView *View, SearchReplaceOptions &sr); int DLGGetFindReplace(GView *View, SearchReplaceOptions &sr); enum WaitFdPipe { FD_PIPE_ERROR, FD_PIPE_1, FD_PIPE_2, FD_PIPE_EVENT, FD_PIPE_TIMEOUT }; WaitFdPipe WaitFdPipeEvent(TEvent *Event, int fd, int fd2, int WaitTime); #endif // GUI_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_mode.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000017077�11604417213�012054� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_mode.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_MODE_H #define C_MODE_H #define CMD_EXT 0x1000 // max 4096 internal commands, check cfte.cpp enum Context_e { CONTEXT_NONE, CONTEXT_FILE, CONTEXT_DIRECTORY, CONTEXT_MESSAGES, CONTEXT_SHELL, CONTEXT_INPUT, CONTEXT_CHOICE, CONTEXT_LIST, CONTEXT_CHAR, CONTEXT_BUFFERS, CONTEXT_ROUTINES, // 10 CONTEXT_MAPVIEW, CONTEXT_CVSBASE, CONTEXT_CVS, CONTEXT_CVSDIFF, CONTEXT_SVNBASE, CONTEXT_SVN, CONTEXT_SVNDIFF }; typedef unsigned char ChColor; //typedef int ChColor; enum Hilit_e { HILIT_PLAIN, HILIT_C, HILIT_HTML, HILIT_MAKE, HILIT_REXX, HILIT_DIFF, HILIT_IPF, HILIT_PERL, HILIT_MERGE, HILIT_ADA, HILIT_MSG, // 10 HILIT_SH, HILIT_PASCAL, HILIT_TEX, HILIT_FTE, HILIT_CATBS, HILIT_SIMPLE // 16 }; enum Indent_{ INDENT_PLAIN, INDENT_C, INDENT_REXX, INDENT_SIMPLE }; #define BFI_AutoIndent 0 #define BFI_Insert 1 #define BFI_DrawOn 2 #define BFI_HilitOn 3 #define BFI_ExpandTabs 4 #define BFI_Trim 5 #define BFI_TabSize 6 #define BFI_Colorizer 7 #define BFI_IndentMode 8 #define BFI_ShowTabs 9 #define BFI_HardMode 15 #define BFI_Undo 16 #define BFI_ReadOnly 17 #define BFI_AutoSave 18 #define BFI_KeepBackups 19 #define BFI_MatchCase 22 #define BFI_BackSpKillTab 23 #define BFI_DeleteKillTab 24 #define BFI_BackSpUnindents 25 #define BFI_SpaceTabs 26 #define BFI_IndentWithTabs 27 #define BFI_SeeThruSel 30 #define BFI_ShowMarkers 32 #define BFI_CursorThroughTabs 33 #define BFI_MultiLineHilit 35 #define BFI_WordWrap 31 #define BFI_LeftMargin 28 #define BFI_RightMargin 29 #define BFI_LineChar 10 #define BFI_StripChar 11 #define BFI_AddLF 12 #define BFI_AddCR 13 #define BFI_ForceNewLine 14 #define BFI_LoadMargin 20 #define BFI_SaveFolds 34 #define BFI_UndoLimit 21 #define BFI_AutoHilitParen 36 #define BFI_Abbreviations 37 #define BFI_BackSpKillBlock 38 #define BFI_DeleteKillBlock 39 #define BFI_PersistentBlocks 40 #define BFI_InsertKillBlock 41 #define BFI_EventMap 42 #define BFI_UndoMoves 43 #define BFI_DetectLineSep 44 #define BFI_TrimOnSave 45 #define BFI_SaveBookmarks 46 #define BFI_HilitTags 47 #define BFI_ShowBookmarks 48 #define BFI_MakeBackups 49 #define BFI_COUNT 50 #define BFS_RoutineRegexp (0 | 256) #define BFS_DefFindOpt (1 | 256) #define BFS_DefFindReplaceOpt (2 | 256) #define BFS_CommentStart (3 | 256) #define BFS_CommentEnd (4 | 256) #define BFS_FileNameRx (5 | 256) #define BFS_FirstLineRx (6 | 256) #define BFS_CompileCommand (7 | 256) #define BFS_COUNT 8 #define BFS_WordChars (100 | 256) // ext #define BFS_CapitalChars (101 | 256) #define BFI(y,x) ((y)->Flags.num[(x) & 0xFF]) #define BFI_SET(y,x,v) ((y)->Flags.num[(x) & 0xFF]=(v)) #define BFS(y,x) ((y)->Flags.str[(x) & 0xFF]) #define WSETBIT(x,y,z) \ ((x)[(unsigned char)(y) >> 3] = char((z) ? \ ((x)[(unsigned char)(y) >> 3] | (1 << ((unsigned char)(y) & 0x7))) : \ ((x)[(unsigned char)(y) >> 3] & ~(1 << ((unsigned char)(y) & 0x7))))) #define WGETBIT(x,y) \ (((x)[(unsigned char)(y) / 8] & (1 << ((unsigned char)(y) % 8))) ? 1 : 0) struct EBufferFlags { int num[BFI_COUNT]; char *str[BFS_COUNT]; char WordChars[32]; char CapitalChars[32]; }; extern EBufferFlags DefaultBufferFlags; /* globals */ #define FLAG_C_Indent 1 #define FLAG_C_BraceOfs 2 #define FLAG_REXX_Indent 3 #define FLAG_ScreenSizeX 6 #define FLAG_ScreenSizeY 7 #define FLAG_CursorInsertStart 8 #define FLAG_CursorInsertEnd 9 #define FLAG_CursorOverStart 10 #define FLAG_CursorOverEnd 11 #define FLAG_SysClipboard 12 #define FLAG_ShowHScroll 13 #define FLAG_ShowVScroll 14 #define FLAG_ScrollBarWidth 15 #define FLAG_SelectPathname 16 #define FLAG_C_CaseOfs 18 #define FLAG_DefaultModeName 19 #define FLAG_CompletionFilter 20 #define FLAG_ShowMenuBar 22 #define FLAG_C_CaseDelta 23 #define FLAG_C_ClassOfs 24 #define FLAG_C_ClassDelta 25 #define FLAG_C_ColonOfs 26 #define FLAG_C_CommentOfs 27 #define FLAG_C_CommentDelta 28 #define FLAG_OpenAfterClose 30 #define FLAG_PrintDevice 31 #define FLAG_CompileCommand 32 #define FLAG_REXX_Do_Offset 33 #define FLAG_KeepHistory 34 #define FLAG_LoadDesktopOnEntry 35 #define FLAG_SaveDesktopOnExit 36 #define FLAG_WindowFont 37 #define FLAG_KeepMessages 38 #define FLAG_ScrollBorderX 39 #define FLAG_ScrollBorderY 40 #define FLAG_ScrollJumpX 41 #define FLAG_ScrollJumpY 42 #define FLAG_ShowToolBar 43 #define FLAG_GUIDialogs 44 #define FLAG_PMDisableAccel 45 #define FLAG_SevenBit 46 #define FLAG_WeirdScroll 47 #define FLAG_LoadDesktopMode 48 #define FLAG_HelpCommand 49 #define FLAG_C_FirstLevelIndent 50 #define FLAG_C_FirstLevelWidth 51 #define FLAG_C_Continuation 52 #define FLAG_C_ParenDelta 53 #define FLAG_FunctionUsesContinuation 54 #define FLAG_IgnoreBufferList 55 #define FLAG_GUICharacters 56 #define FLAG_CvsCommand 57 #define FLAG_CvsLogMode 58 #define FLAG_ReassignModelIds 59 #define FLAG_RecheckReadOnly 60 #define FLAG_XShellCommand 61 #define FLAG_RGBColor 62 #define FLAG_CursorBlink 63 #define FLAG_SvnCommand 64 #define FLAG_SvnLogMode 65 #define FLAG_ShowTildeFilesInDirList 66 #define EM_MENUS 2 #define EM_MainMenu 0 #define EM_LocalMenu 1 #define COL_SyntaxParser 1 enum Color_e { CLR_Normal, CLR_Keyword, CLR_String, CLR_Comment, CLR_CPreprocessor, CLR_Regexp, CLR_Header, CLR_Quotes, CLR_Number, CLR_HexNumber, CLR_OctalNumber, // 10 CLR_FloatNumber, CLR_Function, CLR_Command, CLR_Tag, CLR_Punctuation, CLR_New, CLR_Old, CLR_Changed, CLR_Control, CLR_Separator, // 20 CLR_Variable, CLR_Symbol, CLR_Directive, CLR_Label, CLR_Special, CLR_QuoteDelim, CLR_RegexpDelim, COUNT_CLR }; #define MATCH_MUST_BOL 0x0001 #define MATCH_MUST_BOLW 0x0002 #define MATCH_MUST_EOL 0x0004 #define MATCH_MUST_EOLW 0x0008 #define MATCH_NO_CASE 0x0010 #define MATCH_SET 0x0020 #define MATCH_NOTSET 0x0040 #define MATCH_QUOTECH 0x0100 #define MATCH_QUOTEEOL 0x0200 #define MATCH_NOGRAB 0x0400 #define MATCH_NEGATE 0x0800 #define MATCH_TAGASNEXT 0x1000 #define MATCH_REGEXP 0x2000 #define ACTION_NXSTATE 0x0001 #define STATE_NOCASE 0x0001 #define STATE_TAGASNEXT 0x0002 #define STATE_NOGRAB 0x0004 enum MacroVariable { mvFilePath = 1, /* directory + name + extension */ mvFileName, /* name + extension */ mvFileDirectory, /* directory + '/' */ mvFileBaseName, /* without the last extension */ mvFileExtension, /* the last one */ mvCurDirectory, mvCurRow, mvCurCol, mvChar, mvWord, mvLine, mvFTEVer }; #endif // C_MODE_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_no.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000000516�11602724002�012565� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_no.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetPMClip(int clipboard) { return 1; } int PutPMClip(int clipboard) { return 1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-bcc5.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000002616�07570214633�012540� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # FTE makefile for use with Borland C++ 5.5.x/C++Builder 5 # # The author, Jon Svendsen, explicitly places this module # in the Public Domain # # Assumes compiler-native includes to be in $(MAKEDIR)\..\Include # and libraries in $(MAKEDIR)\..\Libs # $(MAKEDIR) is set by Borland make and is the location of your make.exe # INCDIR = $(MAKEDIR)\..\Include LIBDIR = $(MAKEDIR)\..\Lib OPTIMIZE = -O2 CC = bcc32 LD = ilink32 OEXT = obj DEFS = -DNT -DNTCONSOLE -DBCPP CCFLAGS = $(OPTIMIZE) -w-aus -w-par -w-inl -tWC $(DEFS) -I$(INCDIR) LDFLAGS = -ap -Tpe -c -x -Gn -L$(LIBDIR) -j$(LIBDIR) LDOBJS = c0x32.obj LDLIBS = import32.lib cw32.lib !include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c {$< } .c.$(OEXT): $(CC) $(CCFLAGS) -c {$< } all: cfte.exe fte.exe defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h c_config.obj: defcfg.h bin2c.exe: bin2c.obj $(LD) $(LDFLAGS) $(LDOBJS) bin2c.obj,$< ,,$(LDLIBS) ,, cfte.exe: $(CFTE_OBJS) $(LD) $(LDFLAGS) $(LDOBJS) $(CFTE_OBJS),$< ,,$(LDLIBS) ,, fte.exe: $(OBJS) $(NTOBJS) $(LD) $(LDFLAGS) $(LDOBJS) $(OBJS) $(NTOBJS),$< ,,$(LDLIBS) ,, clean: del *.$(OEXT) del *.tds del fte.exe del cfte.exe del bin2c.exe del defcfg.h del defcfg.cnf ������������������������������������������������������������������������������������������������������������������./src/e_redraw.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000050174�11344266046�012753� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_redraw.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_bind.h" #include "c_color.h" #include "c_config.h" #include "e_tags.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" int EBuffer::GetMap(int Row, int *StateLen, hsState **StateMap) { hlState State = 0; Rehilit(Row); *StateLen = LineChars(Row); if (Row > 0) State = RLine(Row - 1)->StateE; if (*StateLen > 0) { PELine L = RLine(Row); int ECol; *StateMap = (hsState *) malloc(*StateLen); if (*StateMap == 0) return 0; #ifdef CONFIG_SYNTAX_HILIT if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) HilitProc(this, Row, 0, 0, *StateLen, L, State, *StateMap, &ECol); else #endif Hilit_Plain(this, Row, 0, 0, *StateLen, L, State, *StateMap, &ECol); // if (L->StateE != State) { // L->StateE = State; // } } else { *StateLen = 1; *StateMap = (hsState *) malloc(1); if (*StateMap == 0) return 0; (*StateMap)[0] = (hsState) (State & 0xFF); } return 1; } void EBuffer::FullRedraw() { // redraw all views EView *V = View; EEditPort *W; int Min, Max; while (V) { W = GetViewVPort(V); // Need to use real lines, not virtual // (similar to HilitMatchBracket) Min = VToR(W->TP.Row); Max = W->TP.Row + W->Rows; if (Max >= VCount) Max = RCount; else Max = VToR(Max); Draw(Min, Max); V = V->Next; if (V == View) break; } } void EBuffer::Hilit(int FromRow) { if (FromRow != -1) { if (StartHilit == -1) StartHilit = FromRow; else if (FromRow < StartHilit) StartHilit = FromRow; } } void EBuffer::Rehilit(int ToRow) { hlState State; int HilitX; PELine L; int ECol; if (StartHilit == -1) // all ok return ; if (BFI(this, BFI_MultiLineHilit) == 0) // everything handled in redisplay return; if (ToRow <= StartHilit) // will be handled in redisplay return; if (ToRow >= RCount) ToRow = RCount; HilitX = 1; while ((StartHilit < RCount) && ((StartHilit < ToRow) || HilitX)) { L = RLine(StartHilit); HilitX = 0; if (StartHilit > 0) State = RLine(StartHilit - 1)->StateE; else State = 0; if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) { HilitProc(this, StartHilit, 0, 0, 0, L, State, 0, &ECol); } else { Hilit_Plain(this, StartHilit, 0, 0, 0, L, State, 0, &ECol); } if (L->StateE != State) { HilitX = 1; L->StateE = State; } Draw(StartHilit, StartHilit); // ? if (StartHilit > EndHilit) EndHilit = StartHilit; if (HilitX == 0) // jump over (can we always do this ?) if (StartHilit < EndHilit) { StartHilit = EndHilit; } StartHilit++; } } void EBuffer::Draw(int Row0, int RowE) { //printf("r0 = %d, re = %d\n", Row0, RowE); //printf("m = %d, max = %d, rts = %d\n", MinRedraw, MaxRedraw, RedrawToEos); if (Row0 == -1) Row0 = 0; if ((Row0 < MinRedraw) || (MinRedraw == -1)) { MinRedraw = Row0; if (MaxRedraw == -1) MaxRedraw = MinRedraw; } if (RowE == -1) { RedrawToEos = 1; MaxRedraw = MinRedraw; } else if (((RowE > MaxRedraw) || (MaxRedraw == -1)) && (RowE != -1)) MaxRedraw = RowE; //printf("m = %d, max = %d, rts = %d\n", MinRedraw, MaxRedraw, RedrawToEos); } void EBuffer::DrawLine(TDrawBuffer B, int VRow, int C, int W, int &HilitX) { hlState State; int StartPos, EndPos; HilitX = 0; assert(W >= 0); MoveChar(B, 0, W, ' ', hcPlain_Background, W); // if ((VRow == VCount - 1) && !BFI(this, BFI_ForceNewLine)) { // if (BFI(this, BFI_ShowMarkers)) // MoveChar(B, 0, W, EOF_MARKER, hcPlain_Markers, W); // } if (VRow < VCount) { int Row = VToR(VRow); PELine L = RLine(Row); int ECol = 0; if (Row > 0) State = RLine(Row - 1)->StateE; else State = 0; #ifdef CONFIG_SYNTAX_HILIT if (BFI(this, BFI_HilitOn) == 1 && HilitProc != 0) HilitProc(this, Row, B, C, W, L, State, 0, &ECol); else #endif Hilit_Plain(this, Row, B, C, W, L, State, 0, &ECol); if (L->StateE != State) { HilitX = 1; L->StateE = State; } if (BFI(this, BFI_ShowMarkers)) { MoveChar(B, ECol - C, W, ConGetDrawChar((Row == RCount - 1) ? DCH_EOF : DCH_EOL), hcPlain_Markers, 1); ECol += 1; } if (Row < RCount) { int f; int Folded = 0; char fold[20]; int l; f = FindFold(Row); if (f != -1) { ChColor foldColor; if (FF[f].level<5) foldColor=hcPlain_Folds[FF[f].level]; else foldColor=hcPlain_Folds[4]; if (FF[f].open == 1) { l = sprintf(fold, "[%d]", FF[f].level); MoveStr(B, ECol - C + 1, W, fold, foldColor, 10); ECol += l; } else { if (VRow < VCount - 1) { Folded = Vis(VRow + 1) - Vis(VRow) + 1; } else if (VRow < VCount) { Folded = RCount - (VRow + Vis(VRow)); } l = sprintf(fold, "(%d:%d)", FF[f].level, Folded); MoveStr(B, ECol - C + 1, W, fold, foldColor, 10); ECol += l; MoveAttr(B, 0, W, foldColor, W); } } } if (BB.Row != -1 && BE.Row != -1 && Row >= BB.Row && Row <= BE.Row) { switch(BlockMode) { case bmLine: StartPos = 0; if (Row == BE.Row) EndPos = 0; else EndPos = W; break; case bmColumn: StartPos = BB.Col - C; if (Row == BE.Row) EndPos = BB.Col - C; else EndPos = BE.Col - C; break; case bmStream: if (Row == BB.Row && Row == BE.Row) { StartPos = BB.Col - C; EndPos = BE.Col - C; } else if (Row == BB.Row) { StartPos = BB.Col - C; EndPos = W; } else if (Row == BE.Row) { StartPos = 0; EndPos = BE.Col - C; } else { StartPos = 0; EndPos = W; } break; default: StartPos = EndPos = 0; break; } if (EndPos > StartPos) { if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, StartPos, W, hcPlain_Selected, EndPos - StartPos); else MoveAttr(B, StartPos, W, hcPlain_Selected, EndPos - StartPos); } } #ifdef CONFIG_BOOKMARKS if (BFI(this, BFI_ShowBookmarks)) { int i = 0; const EBookmark* eb; while ((i = GetBookmarkForLine(i, Row, eb)) != -1) { if (strncmp(eb->GetName(), "_BMK", 4) == 0) { // User bookmark, hilite line if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, 0, W, hcPlain_Bookmark, W); else MoveAttr(B, 0, W, hcPlain_Bookmark, W); break; } } } #endif if (Match.Row != -1 && Match.Col != -1) { if (Row == Match.Row) { if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, Match.Col - C, W, hcPlain_Found, MatchLen); else MoveAttr(B, Match.Col - C, W, hcPlain_Found, MatchLen); } } } else if (VRow == VCount) { if (BFI(this, BFI_ShowMarkers)) MoveChar(B, 0, W, ConGetDrawChar(DCH_END), hcPlain_Markers, W); } } void EBuffer::Redraw() { int HilitX; EView *V; EEditPort *W; int Row; TDrawBuffer B; char s[256]; ChColor SColor; int RowA, RowZ; int W1, H1; int first; //printf("EBuffer::Redraw1\n"); if (CP.Row >= VCount) CP.Row = VCount - 1; if (CP.Row < 0) CP.Row = 0; //printf("EBuffer::Redraw t:%p %p %p %p %p\n", this, View, View ? View->MView : (void*)1, Next, Prev); //assert(View != 0); CheckBlock(); /* check some window data */ if (!View || !View->MView) { MinRedraw = MaxRedraw = -1; RedrawToEos = 0; return; } View->MView->ConQuerySize(&W1, &H1); if (H1 < 1 || W1 < 1) return; //printf("EBuffer::Redraw4\n"); first = 1; for (V = View; V && (first || V != View); V = V->NextView) { if (!V->MView || !V->MView->Win) continue; // printf("Checking\x7\n"); if (V->Model != this) assert(1 == 0); W = GetViewVPort(V); if (W->Rows < 1 || W->Cols < 1) continue; if (V == View) { int scrollJumpX = Min(ScrollJumpX, W->Cols / 2); int scrollJumpY = Min(ScrollJumpY, W->Rows / 2); int scrollBorderX = Min(ScrollBorderX, W->Cols / 2); int scrollBorderY = Min(ScrollBorderY, W->Rows / 2); W->CP = CP; TP = W->TP; if (W->ReCenter) { W->TP.Row = CP.Row - W->Rows / 2; W->TP.Col = CP.Col - W->Cols + 8; W->ReCenter = 0; } if (W->TP.Row + scrollBorderY > CP.Row) W->TP.Row = CP.Row - scrollJumpY + 1 - scrollBorderY; if (W->TP.Row + W->Rows - scrollBorderY <= CP.Row) W->TP.Row = CP.Row - W->Rows + 1 + scrollJumpY - 1 + scrollBorderY; if (!WeirdScroll) if (W->TP.Row + W->Rows >= VCount) W->TP.Row = VCount - W->Rows; if (W->TP.Row < 0) W->TP.Row = 0; if (W->TP.Col + scrollBorderX > CP.Col) W->TP.Col = CP.Col - scrollJumpX - scrollBorderX; if (W->TP.Col + W->Cols - scrollBorderX <= CP.Col) W->TP.Col = CP.Col - W->Cols + scrollJumpX + scrollBorderX; if (W->TP.Col < 0) W->TP.Col = 0; if (W->OldTP.Row != -1 && W->OldTP.Col != -1 && RedrawToEos == 0) { if ((W->OldTP.Row != W->TP.Row) || (W->OldTP.Col != W->TP.Col)) { int A, B; int DeltaX, DeltaY; int Rows = W->Rows; int Delta1 = 0, Delta2 = 0; DeltaY = W->TP.Row - W->OldTP.Row ; DeltaX = W->TP.Col - W->OldTP.Col; if ((DeltaX == 0) && (-Rows < DeltaY) && (DeltaY < Rows)) { if (DeltaY < 0) { W->ScrollY(DeltaY); A = W->TP.Row; B = W->TP.Row - DeltaY; } else { W->ScrollY(DeltaY); A = W->TP.Row + Rows - DeltaY; B = W->TP.Row + Rows; } } else { A = W->TP.Row; B = W->TP.Row + W->Rows; } if (A >= VCount) { Delta1 = A - VCount + 1; A = VCount - 1; } if (B >= VCount) { Delta2 = B - VCount + 1; B = VCount - 1; } if (A < 0) A = 0; if (B < 0) B = 0; Draw(VToR(A) + Delta1, VToR(B) + Delta2); } } else { int A = W->TP.Row; int B = A + W->Rows; int Delta = 0; if (!VCount) continue; if (B > VCount) { Delta += B - VCount; B = VCount; } int LastV = VToR(VCount - 1); int B1 = (B == VCount) ? RCount : VToR(B); if (B1 >= LastV) { Delta += B1 - LastV; B1 = LastV; } if (B1 < 0) B1 = 0; Draw(VToR(A), B1 + Delta); } W->OldTP = W->TP; TP = W->TP; } if (W->CP.Row >= VCount) W->CP.Row = VCount - 1; if (W->CP.Row < 0) W->CP.Row = 0; if (W->TP.Row > W->CP.Row) W->TP.Row = W->CP.Row; if (W->TP.Row < 0) W->TP.Row = 0; if (V->MView->IsActive()) // hack SColor = hcStatus_Active; else SColor = hcStatus_Normal; MoveChar(B, 0, W->Cols, ' ', SColor, W->Cols); if (V->MView->Win->GetViewContext() == V->MView) { V->MView->Win->SetSbVPos(W->TP.Row, W->Rows, VCount + (WeirdScroll ? W->Rows - 1 : 0)); V->MView->Win->SetSbHPos(W->TP.Col, W->Cols, 1024 + (WeirdScroll ? W->Cols - 1 : 0)); } if (V->CurMsg == 0) { int CurLine = W->CP.Row; int ActLine = VToR(W->CP.Row); int CurColumn = W->CP.Col; int CurPos = CharOffset(RLine(ActLine), CurColumn); int NumLines = RCount; int NumChars = RLine(ActLine)->Count; // int NumColumns = ScreenPos(Line(CurLine), NumChars); char *fName = FileName; unsigned char CurCh = 0xFF; int lf = strlen(fName); char CCharStr[20] = ""; if (lf > 34) fName += lf - 34; if (CurPos < NumChars) { CurCh = VLine(CurLine)->Chars[CurPos]; sprintf(CCharStr, "%3u,%02X", CurCh, CurCh); } else { if (CurPos > NumChars) strcpy(CCharStr, " "); else if (CurLine < NumLines - 1) strcpy(CCharStr, " EOL"); else strcpy(CCharStr, " EOF"); } sprintf(s, "%04d:%02d %c%c%c%c%c %.6s %c" #ifdef DOS " %lu " #endif , // CurLine + 1, ActLine + 1, CurColumn + 1, // CurPos + 1, (BFI(this, BFI_Insert)) ? 'I' : ' ', (BFI(this, BFI_AutoIndent)) ? 'A' : ' ', // (BFI(this, BFI_ExpandTabs))?'T':' ', (BFI(this, BFI_MatchCase)) ? 'C' : ' ', AutoExtend ? ( (BlockMode == bmStream) ? 's' : (BlockMode == bmLine) ? 'l' : 'c' ) : ((BlockMode == bmStream) ? 'S' : (BlockMode == bmLine) ? 'L': 'C' ), #ifdef CONFIG_WORDWRAP (BFI(this, BFI_WordWrap) == 3) ? 't' : (BFI(this, BFI_WordWrap) == 2) ? 'W' : (BFI(this, BFI_WordWrap) == 1) ? 'w' : ' ', #endif // (BFI(this, BFI_Undo))?'U':' ', // (BFI(this, BFI_Trim))?'E':' ', // (Flags.KeepBackups)?'B':' ', Mode->fName, (Modified != 0)?'*':(BFI(this, BFI_ReadOnly))?'%':' ' #ifdef DOS ,coreleft() #endif ); int l = strlen(s); int fw = W->Cols - l; int fl = strlen(FileName); char num[100]; /* seriously, let's not skimp. */ MoveStr(B, 0, W->Cols, s, SColor, W->Cols); sprintf(num, " %s %d", CCharStr, ModelNo); MoveStr(B, W->Cols - strlen(num), W->Cols, num, SColor, W->Cols); fw -= strlen(num); if (fl > fw) { MoveStr(B, l, W->Cols, FileName + fl - fw, SColor, W->Cols); } else { MoveStr(B, l, W->Cols, FileName, SColor, W->Cols); } } else { MoveStr(B, 0, W->Cols, V->CurMsg, SColor, W->Cols); } if (V->MView->Win->GetStatusContext() == V->MView) { V->MView->ConPutBox(0, W->Rows, W->Cols, 1, B); if (V->MView->IsActive()) { V->MView->ConShowCursor(); V->MView->ConSetCursorPos(W->CP.Col - W->TP.Col, W->CP.Row - W->TP.Row); if (BFI(this, BFI_Insert)) { V->MView->ConSetCursorSize(CursorInsSize[0], CursorInsSize[1]); } else { V->MView->ConSetCursorSize(CursorOverSize[0], CursorOverSize[1]); } } } } Rehilit(VToR(CP.Row)); if (BFI(this, BFI_AutoHilitParen) == 1) { if (Match.Row == -1 && Match.Col == -1) HilitMatchBracket(); } // if ((Window == WW) && (MinRedraw == -1)) // MaxRedraw = MinRedraw = VToR(CP.Row); //printf("\n\nMinRedraw = %d, MaxRedraw = %d", MinRedraw, MaxRedraw); if (MinRedraw == -1 || !VCount) return; // printf("Will redraw: %d to %d, to eos = %d\n", MinRedraw, MaxRedraw, RedrawToEos); if (MinRedraw >= VCount) MinRedraw = VCount - 1; if (MinRedraw < 0) MinRedraw = 0; // puts("xxx\x7"); // printf("%d\n", MinRedraw); Row = RowA = RToVN(MinRedraw); // puts("xxx\x7"); RowZ = MaxRedraw; if (MaxRedraw != -1) { int Delta = 0; if (MaxRedraw >= RCount) { Delta = MaxRedraw - RCount + 1; MaxRedraw = RCount - 1; } if (MaxRedraw < 0) MaxRedraw = 0; // printf("%d\n", MaxRedraw); RowZ = RToVN(MaxRedraw) + Delta; } // puts("xxx\x7"); //printf("\nRowA = %d, RowZ = %d", RowA, RowZ); first = 1; for (V = View; V && (first || V != View); V = V->NextView) { first = 0; if (!V->MView || !V->MView->Win) continue; if (V->Model != this) assert(1 == 0); W = GetViewVPort(V); for (int R = W->TP.Row; R < W->TP.Row + W->Rows; R++) { Row = R; if ((Row >= RowA) && (RedrawToEos || Row <= RowZ)) { DrawLine(B, Row, W->TP.Col, W->Cols, HilitX); W->DrawLine(Row, B); if (HilitX && Row == RowZ) RowZ++; } } } MinRedraw = MaxRedraw = -1; RedrawToEos = 0; } int EBuffer::GetHilitWord(ChColor &clr, const char *str, size_t len, int IgnCase) { char *p; if (Mode == 0 || Mode->fColorize == 0) return 0; if (len >= CK_MAXLEN) return 0; #ifdef CONFIG_WORD_HILIT { char s[CK_MAXLEN + 1]; memcpy(s, str, len); s[len] = 0; if (HilitFindWord(s)) { clr = ChColor(COUNT_CLR + hcPlain_HilitWord); return 1; } } #endif if (len < 1) return 0; p = Mode->fColorize->Keywords.key[len]; if (IgnCase) { while (p && *p) { if (strnicmp(p, str, len) == 0) { clr = ChColor(COUNT_CLR + ((unsigned char*)p)[len]); return 1; } p += len + 1; } } else { while (p && *p) { if (memcmp(p, str, len) == 0) { clr = ChColor(COUNT_CLR + ((unsigned char*)p)[len]); //printf("PLEN %d %d\n", p[len], COUNT_CLR); return 1; } p += len + 1; } } if (len < 128) { char s[128]; memcpy(s, str, len); s[len] = 0; if (BFI(this, BFI_HilitTags)&&TagDefined(s)) { clr = CLR_HexNumber;// Mode->fColorize->Colors[]; return 1; } } return 0; } EEditPort *EBuffer::GetViewVPort(EView *V) { return (EEditPort *)V->Port; } EEditPort *EBuffer::GetVPort() { return (EEditPort *)View->Port; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_sh.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000024721�11331412504�012067� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_sh.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_SH #include "c_bind.h" #include "o_buflist.h" #include "sysdep.h" #include <ctype.h> enum { hsSH_Normal, hsSH_SQuote, hsSH_DQuote, hsSH_BQuote, hsSH_DBQuote, hsSH_Control, hsSH_Keyword, hsSH_Comment, hsSH_Variable, hsSH_EOF, hsSH_InOpt }; #define MAXSEOF 100 static char seof[MAXSEOF]; int Hilit_SH(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int CommandStr = 0; int isEOF = 0; for (i = 0; i < Line->Count;) { if (State == hsSH_EOF && 0 == i) { //printf("i=%d, len=%d, strlen(seof)=%d, seof=%s, Line-Chars=%s\n", // i, len, strlen(seof), seof, Line->Chars); // Skip past any leading tabs. char* iseof = Line->Chars; size_t len_left = len; while (*iseof == '\t') ++iseof, --len_left; isEOF = strlen(seof) == len_left && strncmp(seof, iseof, len_left) == 0; } IF_TAB() else { int j = 1; if (!isspace(*p)) CommandStr++; Color = CLR_Normal; switch (State) { case hsSH_Normal: if (CommandStr == 1 && len > 2 && *p == '.' && isspace(p[1])) { Color = CLR_Keyword; } else if (isalpha(*p) || *p == '_' || ((CommandStr == 1) && (*p == '/' || *p == '.'))) { while (len > j && (isalnum(p[j]) || strchr("_-[]$", p[j]) != NULL || ((CommandStr == 1) && (p[j] == '/' || p[j] == '.')))) j++; if (p[j] == '=') Color = CLR_Variable; else if (p[j] == '*' || p[j] == ')') Color = CLR_Normal; else { if (!BF->GetHilitWord(Color, p, j, 0)) { // Color for good match is set by this function Color = (CommandStr == 1) ? CLR_Command : CLR_Normal; //printf("Command %d %c%c\n", //CommandStr, //Line->Chars[i],Line->Chars[i+1]); } else { if (i > 0 && p[-1] != ';' && p[-1] != '(' && !isspace(p[-1])) Color = CLR_Normal; else { int s; switch(j) { case 2: s = strncmp(p, "in", j); break; case 3: s = strncmp(p, "for", j); break; case 4: s = strncmp(p, "read", j); break; case 5: s = strncmp(p, "unset", j); break; case 6: s = strncmp(p, "export", j); break; default: s = 1; break; } if (s) CommandStr = 0; } } } break; } else if (*p == '[' || *p == ']' || (CommandStr == 1 && *p == '!')) { CommandStr = 0; Color = CLR_Keyword; //Colors[CLR_Control]; //static a=0; //if (!a) {for(int i=0;i<COUNT_CLR;i++) //printf("%d %d\n", i, Colors[i]); //a++;} //same state } else if (*p == '\'') { State = hsSH_SQuote; Color = CLR_String; } else if (*p == '"') { State = hsSH_DQuote; Color = CLR_String; } else if ( len >= 2 && *p == '\\' && p[1] == '\'' ) { Color = CLR_String; ColorNext(); } else if ( len >= 2 && *p == '\\' && p[1] == '"' ) { Color = CLR_String; ColorNext(); } else if ( len >= 2 && *p == '\\' && p[1] == '`' ) { Color = CLR_Command; ColorNext(); } else if (*p == '`') { State = hsSH_BQuote; Color = CLR_Command; } else if (*p == '~') { Color = CLR_Variable; } else if (*p == '$') { State = hsSH_Variable; Color = CLR_Variable; } else if (*p == '#') { State = hsSH_Comment; Color = CLR_Comment; //} else if (isdigit(*p)) { //Color = CLR_Number; //while (len > 0 && (isdigit(*p))) //ColorNext(); //continue; } else if (len > 3 && *p == '<' && p[1] == '<') { if (p[2] == '<') { Color = CLR_Control; ColorNext(); ColorNext(); ColorNext(); } else { // !!! this is a hack, doesn't work properly -- Mark char *s = seof; j++; if (p[2] == '-') j++; Color = CLR_Control; while (len > j && (isspace(p[j]) || p[j] == '\'' || p[j] == '"')) j++; if( p[j] == '\\' ) j++; while (len > j && !(isspace(p[j]) || p[j] == '\'' || p[j] == '"')) *s++ = p[j++]; if (len > j && (p[j] == '\'' || p[j] == '"')) j++; *s = 0; State = hsSH_EOF; break; } } else if (*p == '=' || *p == '\\' || *p == '>' || *p == '<' || *p == '!' /*|| *p == ':'*/) { Color = CLR_Control; } else if (strchr(";|&(){}", *p) != NULL) { CommandStr = 0; Color = CLR_Control; } break; case hsSH_SQuote: Color = CLR_String; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '\'') State = hsSH_Normal; break; case hsSH_DQuote: Color = CLR_String; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '"') State = hsSH_Normal; else if (*p == '`') { Color = CLR_Command; State = hsSH_DBQuote; } break; case hsSH_BQuote: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '`') State = hsSH_Normal; break; case hsSH_DBQuote: Color = CLR_Command; if ((len >= 2) && (*p == '\\')) j++; else if (*p == '`') State = hsSH_DQuote; break; case hsSH_Variable: Color = CLR_Variable; State = hsSH_Normal; if (!isdigit(*p)) { int b = 1; if (*p == '{') b = 2; else if (*p == '[') b = 3; while (b && len > 0 && (isalnum(*p) || (strchr("{}[]_", *p) != NULL) || (b == 2 && (strchr("#%:-=?+/", *p) != NULL)) || (b == 1 && (strchr("*@#?-$!", *p) != NULL) /*|| (b == 0, 1) ????? */) ) ) { // !!!!! ????? // in ${...}, once we hit a :, %, or #, anything goes. // Ideally, we'd do normal processing inside as well, // but that'll take much, much longer to figure out // how to do. if (b == 2 && strchr("#%:", *p) != NULL) { UntilMatchBrace('{',ColorNext()); break; } if (b == 2 && *p == '}') b = 0; else if (b == 3 && *p == ']') b = 0; ColorNext(); } continue; } break; case hsSH_Comment: Color = CLR_Comment; break; case hsSH_EOF: Color = CLR_String; if (isEOF) { Color = CLR_Control; State = hsSH_Normal; j += len - 1; } break; default: State = hsSH_Normal; Color = CLR_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, p, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; } } if (State == hsSH_Comment || State == hsSH_Variable) State = hsSH_Normal; *ECol = C; return 0; } #endif �����������������������������������������������./src/i_complete.h����������������������������������������������������������������������������������0000644�0001750�0001750�00000001752�11344266047�012747� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_ascii.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_COMPLETE_H #define I_COMPLETE_H #include "i_oview.h" #include "e_buffer.h" #include <ctype.h> // maximum words which will be presented to the user #define MAXCOMPLETEWORDS 300 class ExComplete: public ExViewNext { EPoint Orig; EBuffer *Buffer; int WordsLast; char **Words; char *WordBegin; char *WordContinue; int WordPos; size_t WordFixed; size_t WordFixedCount; int RefreshComplete(); int CheckASCII(char c) const { return (isalnum(c) || (c == '_') || (c == '.')); } void FixedUpdate(int add); public: ExComplete(EBuffer *B); virtual ~ExComplete(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); bool IsSimpleCase(); int DoCompleteWord(); }; #endif // I_COMPLETE_H ����������������������./src/e_file.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000005040�11331412502�012360� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_file.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "s_direct.h" #include "s_files.h" EBuffer *FindFile(const char *FileName) { EModel *M; EBuffer *B; M = ActiveModel; while (M) { if (M->GetContext() == CONTEXT_FILE) { B = (EBuffer *)M; if (filecmp(B->FileName, FileName) == 0) { return B; } } M = M->Next; if (M == ActiveModel) break; } return 0; } #if 0 static void SwitchModel(EModel *AModel) { if (AModel != AcgiveModel && MM && AModel) { AModel->Prev->Next = AModel->Next; AModel->Next->Prev = AModel->Prev; AModel->Next = MM; AModel->Prev = MM->Prev; AModel->Prev->Next = AModel; MM->Prev = AModel; MM = AModel; } } #endif int FileLoad(int createFlags, const char *FileName, const char *Mode, EView *View) { char Name[MAXPATH]; EBuffer *B; assert(View != 0); if (ExpandPath(FileName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FileName); return 0; } B = FindFile(Name); if (B) { if (Mode != 0) B->SetFileName(Name, Mode); View->SwitchToModel(B); return 1; } B = new EBuffer(createFlags, &ActiveModel, Name); B->SetFileName(Name, Mode); View->SwitchToModel(B); return 1; } int MultiFileLoad(int createFlags, const char *FileName, const char *Mode, EView *View) { char fX[MAXPATH]; int count = 0; char FPath[MAXPATH]; char FName[MAXPATH]; FileFind *ff; FileInfo *fi; int rc; assert(View != 0); JustDirectory(FileName, fX, sizeof (fX)); if (fX[0] == 0) strcpy(fX, "."); JustFileName(FileName, FName, sizeof(FName)); if (ExpandPath(fX, FPath, sizeof(FPath)) == -1) return 0; Slash(FPath, 1); ff = new FileFind(FPath, FName, ffHIDDEN | ffFULLPATH); if (ff == 0) return 0; rc = ff->FindFirst(&fi); while (rc == 0) { count++; if (FileLoad(createFlags, fi->Name(), Mode, View) == 0) { delete fi; delete ff; return 0; } delete fi; rc = ff->FindNext(&fi); } delete ff; if (count == 0) return FileLoad(createFlags, FileName, Mode, View); return 1; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-cygwin-xf86.mak���������������������������������������������������������������������������0000644�0001750�0001750�00000004566�07335325610�014020� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# versions of FTE to build # Versions: # xfte - using XLib (the most stable) TARGETS = xfte PRIMARY = xfte # Comment or uncoment this two flags below if # you want to use: # Keyboard remaping by XFTE #REMAPFLAG = -DUSE_HARD_REMAP # Drawing fonts with locale support XMBFLAG = -DUSE_XMB # System X11R6 is compiled with X_LOCALE #SYSTEM_X_LOCALE = -DX_LOCALE I18NOPTIONS = $(XMBFLAG) $(REMAPFLAG) $(SYSTEM_X_LOCALE) # Optionally, you can define: # -DDEFAULT_INTERNAL_CONFIG to use internal config by default # -DUSE_XTINIT to use XtInitialize on init # -DFTE_NO_LOGGING to completely disable trace logging APPOPTIONS = -DDEFAULT_INTERNAL_CONFIG #gcc/g++ COPTIONS = -Wall -Wpointer-arith -Wconversion -Wwrite-strings \ -Wmissing-prototypes -Wmissing-declarations -Winline #CC = g++ #LD = g++ # try this for smaller/faster code and less dependencies CC = g++ -fno-rtti -fno-exceptions LD = g++ -fno-rtti -fno-exceptions ####################################################################### # Linux UOS = -DLINUX XINCDIR = -I/usr/X11R6/include XLIBDIR = -L/usr/X11R6/lib -lstdc++ SOCKETLIB = -lwsock32 -liberty ####################################################################### LIBDIR = INCDIR = #OPTIMIZE = -g # -O -g OPTIMIZE = -O2 #OPTIMIZE = -O2 -s CCFLAGS = $(OPTIMIZE) $(I18NOPTIONS) $(APPOPTIONS) $(COPTIONS) -DUNIX $(UOS) \ $(INCDIR) $(XINCDIR) LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) OEXT = o .SUFFIXES: .cpp .o include objs.inc # Need -lXt below if USE_XTINIT is defined XLIBS = -lX11 $(SOCKETLIB) .cpp.o: $(CC) $(CCFLAGS) -c $< .c.o: $(CC) $(CCFLAGS) -c $< all: cfte $(TARGETS) #rm -f fte ; ln -s $(PRIMARY) fte cfte: cfte.o s_files.o $(LD) $(LDFLAGS) cfte.o s_files.o -o cfte c_config.o: defcfg.h defcfg.h: defcfg.cnf perl mkdefcfg.pl <defcfg.cnf >defcfg.h #DEFAULT_FTE_CONFIG = simple.fte DEFAULT_FTE_CONFIG = defcfg.fte #DEFAULT_FTE_CONFIG = defcfg2.fte #DEFAULT_FTE_CONFIG = ../config/main.fte defcfg.cnf: $(DEFAULT_FTE_CONFIG) cfte ./cfte $(DEFAULT_FTE_CONFIG) defcfg.cnf xfte: $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) -o xfte compkeys: compkeys.o $(LD) $(LDFLAGS) compkeys.o -o compkeys clean: rm -f core *.o $(TARGETS) defcfg.h defcfg.cnf cfte fte vfte compkeys ������������������������������������������������������������������������������������������������������������������������������������������./src/fte-emx.mak�����������������������������������������������������������������������������������0000644�0001750�0001750�00000003726�07305007673�012520� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������INCDIR = LIBDIR = #OPTIMIZE = -g OPTIMIZE = -O -s #OPTIMIZE = -O2 -s MT = -Zmt CC = gcc LD = gcc #XTYPE = -Zomf #XLTYPE = -Zsys -Zlinker /map -Zlinker /runfromvdm # -Zomf #OEXT=obj OEXT=o #DEFS = -DDEBUG_EDITOR -DCHECKHEAP #LIBS = -lmalloc1 #DEFS = -DDEBUG_EDITOR -DDBMALLOC -I/src/dbmalloc #LIBS = -L/src/dbmalloc -ldbmalloc LIBS = -lstdcpp DEFS=-DINCL_32 #-DUSE_OS2_TOOLKIT_HEADERS CCFLAGS = $(OPTIMIZE) $(MT) $(XTYPE) -x c++ -Wall -DOS2 $(DEFS) $(INCDIR) -pipe LDFLAGS = $(OPTIMIZE) $(MT) -Zmap $(XLTYPE) $(LIBDIR) .SUFFIXES: .cpp .$(OEXT) include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) -c $< all: cfte.exe fte.exe ftepm.exe clipserv.exe cliputil.exe clipserv.exe: clipserv.$(OEXT) clipserv.def $(LD) $(LDFLAGS) clipserv.$(OEXT) clipserv.def -o clipserv.exe $(LIBS) cliputil.exe: cliputil.$(OEXT) clip_vio.$(OEXT) cliputil.def $(LD) $(LDFLAGS) cliputil.$(OEXT) clip_vio.$(OEXT) cliputil.def -o cliputil.exe $(LIBS) cfte.exe: $(CFTE_OBJS) cfte.def $(LD) $(LDFLAGS) $(CFTE_OBJS) cfte.def -o cfte.exe $(LIBS) defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) bin2c.cpp -o bin2c.exe c_config.$(OEXT): defcfg.h fte.exe: $(OBJS) $(VIOOBJS) fte.def $(LD) $(LDFLAGS) $(OBJS) $(VIOOBJS) fte.def -o fte.exe $(LIBS) ftepm.res: ftepm.rc pmdlg.rc bmps/*.bmp rc -r -i \emx\include ftepm.rc ftepm.res ftepm.exe: $(OBJS) $(PMOBJS) ftepm.def ftepm.res $(LD) $(LDFLAGS) $(OBJS) $(PMOBJS) ftepm.def ftepm.res -o ftepm.exe $(LIBS) fte.cnf: cfte.exe cfte ..\config\main.fte fte.cnf #rc -i \emx\include ftepm.rc ftepm.exe #ftepm.exe:: ftepm.res # rc ftepm.res ftepm.exe distro: ftepm.exe fte.exe fte.cnf cfte.exe clipserv.exe cliputil.exe zip ../fte-os2.zip ftepm.exe fte.exe fte.cnf cfte.exe clipserv.exe cliputil.exe (cd .. && zip -r fte-config.zip Artistic doc config) ������������������������������������������./src/clip_vio.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000005454�11602724002�012754� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_vio.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // OS/2 does not allow VIO programs to use the clipboard :-( #include "fte.h" #include "clip.h" #define INCL_DOS #include <os2.h> #include <string.h> #include <stdlib.h> #define SEM_PREFIX "\\SEM32\\PMCLIPS\\" #define MEM_PREFIX "\\SHAREMEM\\PMCLIPS\\" #define CMD_GET 1 #define CMD_PUT 2 static HMTX hmtxSyn; static HEV hevGet; static HEV hevPut; static HEV hevEnd; int GetClipText(ClipData *cd) { int rc; ULONG PostCount; char *mem; rc = DosOpenMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn); if (rc != 0) return 0; rc = DosOpenEventSem(SEM_PREFIX "CLIPGET", &hevGet); if (rc != 0) return 0; /* rc = DosOpenEventSem(SEM_PREFIX "CLIPPUT", &hevPut);*/ /* if (rc != 0) return -1;*/ rc = DosOpenEventSem(SEM_PREFIX "CLIPEND", &hevEnd); if (rc != 0) return 0; DosRequestMutexSem(hmtxSyn, SEM_INDEFINITE_WAIT); DosResetEventSem(hevEnd, &PostCount); DosPostEventSem(hevGet); DosWaitEventSem(hevEnd, SEM_INDEFINITE_WAIT); if (0 == DosGetNamedSharedMem((void **)&mem, MEM_PREFIX "CLIPDATA", PAG_READ | PAG_WRITE)) { cd->fLen = *(ULONG*)mem; cd->fChar = strdup(mem + 4); DosFreeMem(mem); } else { cd->fLen = 0; cd->fChar = 0; } DosPostEventSem(hevGet); DosReleaseMutexSem(hmtxSyn); /* DosCloseEventSem(hevPut);*/ DosCloseEventSem(hevGet); DosCloseEventSem(hevEnd); DosCloseMutexSem(hmtxSyn); return 1; } int PutClipText(ClipData *cd) { int rc; ULONG PostCount; char *mem; rc = DosOpenMutexSem(SEM_PREFIX "CLIPSYN", &hmtxSyn); if (rc != 0) return 0; /* rc = DosOpenEventSem(SEM_PREFIX "CLIPGET", &hevGet);*/ /* if (rc != 0) return -1;*/ rc = DosOpenEventSem(SEM_PREFIX "CLIPPUT", &hevPut); if (rc != 0) return 0; rc = DosOpenEventSem(SEM_PREFIX "CLIPEND", &hevEnd); if (rc != 0) return 0; DosRequestMutexSem(hmtxSyn, SEM_INDEFINITE_WAIT); DosResetEventSem(hevEnd, &PostCount); if (0 == DosAllocSharedMem((void **)&mem, MEM_PREFIX "CLIPDATA", cd->fLen + 5, PAG_COMMIT | PAG_READ | PAG_WRITE)) { ULONG L = cd->fLen; memcpy((void *)mem, (void *)&L, 4); strcpy(mem + 4, cd->fChar); } DosPostEventSem(hevPut); DosWaitEventSem(hevEnd, SEM_INDEFINITE_WAIT); DosPostEventSem(hevPut); DosReleaseMutexSem(hmtxSyn); DosCloseEventSem(hevPut); /* DosCloseEventSem(hevGet); */ DosCloseEventSem(hevEnd); DosCloseMutexSem(hmtxSyn); if (mem) DosFreeMem(mem); return 1; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_tags.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000001366�11602724002�012055� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_tags.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef E_TAGS_H #define E_TAGS_H #include "fte.h" #ifdef CONFIG_TAGS #include <stdio.h> // FILE class EView; class EBuffer; int TagsAdd(const char *FileName); int TagsSave(FILE *fp); int TagLoad(const char *FileName); void TagClear(); int TagGoto(EView *V, const char *Tag); int TagDefined(const char *Tag); int TagFind(EBuffer *B, EView *V, const char *Tag); int TagComplete(char **Words, int *WordsPos, int WordsMax, const char *Tag); int TagNext(EView *V); int TagPrev(EView *V); int TagPop(EView *V); #endif #endif // E_TAGS_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_tags.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000033026�11602724002�012406� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_tags.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_tags.h" #ifdef CONFIG_TAGS #include "o_buflist.h" #include "s_files.h" #include "s_util.h" #include "sysdep.h" #include <fcntl.h> struct TagData { int Tag; // tag name pos int FileName; int TagBase; // name of tag file int Line; int StrFind; // string to find }; struct TagStack { static TagStack* TStack; StlString CurrentTag; StlString FileName; int Line, Col; int TagPos; TagStack(const char* tag, const char* file, int line, int col, int pos) : CurrentTag(tag), FileName(file), Line(line), Col(col), TagPos(pos), Next(TStack) { TStack = this; } ~TagStack() { TStack = Next; } private: TagStack *Next; }; TagStack* TagStack::TStack = 0; static char *TagMem = 0; static int TagLen = 0; static int ATagMem = 0; static int CTags = 0; // number of tags static int ATags = 0; static TagData *TagD = 0; static int *TagI = 0; static int TagFileCount = 0; static int *TagFiles = 0; static int TagFilesLoaded = 0; // tag files are loaded at first lookup static char *CurrentTag; static int TagPosition = -1; static int AllocMem(const char *Mem, size_t Len, int *TagPos) { int N = 1024; char *NM; *TagPos = TagLen; while (N < (TagLen + Len)) N <<= 1; if (ATagMem < N || !TagMem) { if (!(NM = (char *)realloc((void *)TagMem, N))) return 0; TagMem = NM; ATagMem = N; } memcpy(TagMem + TagLen, Mem, Len); TagLen += Len; return 1; } static int AddTag(int Tag, int FileName, int TagBase, int Line, int StrFind) { int N; N = 1024; while (N < CTags + 1) N <<= 1; if (ATags < N || TagD == 0) { TagData *ND; if (!(ND = (TagData *)realloc((void *)TagD, N * sizeof(TagData)))) return 0; TagD = ND; ATags = N; } TagD[CTags].Tag = Tag; TagD[CTags].Line = Line; TagD[CTags].FileName = FileName; TagD[CTags].TagBase = TagBase; TagD[CTags].StrFind = StrFind; CTags++; return 1; } #if defined(__IBMCPP__) static int _LNK_CONV cmptags(const void *p1, const void *p2) { #else static int cmptags(const void *p1, const void *p2) { #endif //return strcmp(TagMem + TagD[*(int *)p1].Tag, // TagMem + TagD[*(int *)p2].Tag); int r = strcmp(TagMem + TagD[*(int *)p1].Tag, TagMem + TagD[*(int *)p2].Tag); if (r != 0) return r; r = strcmp(TagMem + TagD[*(int *)p1].FileName, TagMem + TagD[*(int *)p2].FileName); if (r != 0) return r; if (TagD[*(int *)p1].Line != TagD[*(int *)p2].Line) r = TagD[*(int *)p1].Line < TagD[*(int *)p2].Line ? -1 : 1; return r; } static int SortTags() { int *NI; int i; if (!CTags) return 0; if (!(NI = (int *)realloc(TagI, CTags * sizeof(int)))) return 0; TagI = NI; for (i = 0; i < CTags; i++) TagI[i] = i; qsort(TagI, CTags, sizeof(TagI[0]), cmptags); return 1; } static int TagsLoad(int id) { //char line[2048]; char *tags; int fd; struct stat sb; long size; int r = 0; if ((fd = open(TagMem + TagFiles[id], O_BINARY | O_RDONLY)) == -1) return 0; if (fstat(fd, &sb) == -1) { close(fd); return 0; } if (!(tags = (char *)malloc((size_t)sb.st_size))) { close(fd); return 0; } char *p = tags; char *e = tags + sb.st_size; size = read(fd, tags, (size_t)sb.st_size); close(fd); if (size != sb.st_size) goto err; if (!TagMem) { // preallocate (useful when big file) if (!(TagMem = (char *)realloc((void *)TagMem, TagLen + (size_t)sb.st_size))) goto err; ATagMem = TagLen + (int)sb.st_size; } char *LTag, *LFile, *LLine; int TagL, FileL/*, LineL*/; int MTag, MFile; while (p < e) { LTag = p; while (p < e && *p != '\t') p++; if (p < e && *p == '\t') *p++ = 0; else break; TagL = p - LTag; LFile = p; while (p < e && *p != '\t') p++; if (p < e && *p == '\t') *p++ = 0; else break; FileL = p - LFile; LLine = p; while (p < e && *p != '\r' && *p != '\n') p++; if (p < e && *p == '\r') *p++ = 0; // optional if (p < e && *p == '\n') *p++ = 0; else break; //LineL = p - LLine; if (!AllocMem(LTag, TagL + FileL, &MTag)) goto err; MFile = MTag + TagL; //printf("TSTR %s\n", LTag); //printf("FSTR %s\n", LTag + TagL); if (LLine[0] == '/') { char *AStr = LLine; char *p = AStr + 1; char *d = AStr; int MStr; while (*p) { if (*p == '\\') { p++; if (*p) *d++ = *p++; } else if (*p == '^' || *p == '$') p++; else if (*p == '/') break; else *d++ = *p++; } *d = 0; if (stricmp(d - 10, "/*FOLD00*/") == 0) d[-11] = 0; /* remove our internal folds */ //printf("MSTR %s\n", AStr); if (!AllocMem(AStr, strlen(AStr) + 1, &MStr)) goto err; if (!AddTag(MTag, MFile, TagFiles[id], -1, MStr)) goto err; } else { if (!AddTag(MTag, MFile, TagFiles[id], atoi(LLine), -1)) goto err; } } r = 1; err: free(tags); return r; } int TagsAdd(const char *FileName) { int *NewT; int NewF; if (!AllocMem(FileName, strlen(FileName) + 1, &NewF)) return 0; if (!(NewT = (int *)realloc((void *)TagFiles, (TagFileCount + 1) * sizeof(int)))) return 0; TagFiles = NewT; TagFiles[TagFileCount++] = NewF; return 1; } int TagsSave(FILE *fp) { for (int i = 0; i < TagFileCount; i++) if (fprintf(fp, "T|%s\n", TagMem + TagFiles[i]) < 0) return 0; return 1; } static void ClearTagStack() { free(CurrentTag); CurrentTag = 0; TagPosition = -1; while (TagStack::TStack) delete TagStack::TStack; } int TagLoad(const char *FileName) { if (!TagsAdd(FileName)) return 0; ClearTagStack(); if (TagFilesLoaded) { if (!TagsLoad(TagFileCount - 1) || !SortTags()) { TagClear(); return 0; } } return 1; } static int LoadTagFiles() { if (!TagFileCount) return 0; if (TagFilesLoaded) return 1; for (int i = 0; i < TagFileCount; i++) if (!TagsLoad(i)) { TagClear(); return 0; } if (!SortTags()) { TagClear(); return 0; } TagFilesLoaded = 1; return 1; } void TagClear() { free(TagD); free(TagI); TagD = 0; TagI = 0; CTags = 0; ATags = 0; free(TagFiles); TagFiles = 0; TagFileCount = 0; TagFilesLoaded = 0; free(TagMem); TagMem = 0; TagLen = 0; ATagMem = 0; ClearTagStack(); } static int GotoFilePos(EView *View, const char *FileName, int Line, int Col) { if (!FileLoad(0, FileName, 0, View)) return 0; if (((EBuffer *)ActiveModel)->Loaded == 0) ((EBuffer *)ActiveModel)->Load(); ((EBuffer *)ActiveModel)->CenterNearPosR(Col, Line); return 1; } static int GotoTag(int M, EView *View) { char path[MAXPATH]; char Dir[MAXPATH]; TagData *TT = &TagD[TagI[M]]; JustDirectory(TagMem + TT->TagBase, Dir, sizeof(Dir)); if (IsFullPath(TagMem + TT->FileName)) { strcpy(path, TagMem + TT->FileName); } else { strcpy(path, Dir); Slash(path, 1); strcat(path, TagMem + TT->FileName); } if (TT->Line != -1) { if (!GotoFilePos(View, path, TT->Line - 1, 0)) return 0; } else { if (!GotoFilePos(View, path, 0, 0)) return 0; if (!((EBuffer *)ActiveModel)->FindStr(TagMem + TT->StrFind, strlen(TagMem + TT->StrFind), 0)) return 0; } ((EBuffer *)ActiveModel)->FindStr(TagMem + TT->Tag, strlen(TagMem + TT->Tag), 0); return 1; } static int PushPos(EBuffer *B) { (void) new TagStack(CurrentTag, B->FileName, B->VToR(B->CP.Row), B->CP.Col, TagPosition); TagStack* T = TagStack::TStack; //printf("PUSHED POS %p %s\n", T, T->CurrentTag.c_str()); return 1; } int TagGoto(EView *View, const char *Tag) { assert(Tag); if (!LoadTagFiles() || !CTags) return 0; int L = 0, R = CTags, M, cmp; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) { while (M > 0 && strcmp(Tag, TagMem + TagD[TagI[M - 1]].Tag) == 0) M--; if (!GotoTag(M, View)) return 0; free(CurrentTag); CurrentTag = strdup(Tag); TagPosition = M; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; // tag not found } int TagFind(EBuffer *B, EView *View, const char *Tag) { assert(View && Tag && B); if (!LoadTagFiles()) return 0; int L = 0, R = CTags, M, cmp; //printf("TAGFIND %s %s tp:%d\n", Tag, CurrentTag, TagPosition); if (CurrentTag) { if (strcmp(CurrentTag, Tag) == 0) { if (!TagStack::TStack || TagPosition != TagStack::TStack->TagPos) if (!PushPos(B)) return 0; TagPosition = TagStack::TStack->TagPos; return TagNext(View); } } if (!CTags) return 0; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) { while (M > 0 && strcmp(Tag, TagMem + TagD[TagI[M - 1]].Tag) == 0) M--; if (PushPos(B) == 0) return 0; if (GotoTag(M, View) == 0) return 0; free(CurrentTag); // in case it already exists. CurrentTag = strdup(Tag); TagPosition = M; return 1; } else if (cmp < 0) { R = M; } else { L = M + 1; } } return 0; // tag not found } int TagDefined(const char *Tag) { if (!LoadTagFiles() || !CTags) return 0; int L = 0, R = CTags, M, cmp; while (L < R) { M = (L + R) / 2; cmp = strcmp(Tag, TagMem + TagD[TagI[M]].Tag); if (cmp == 0) return 1; else if (cmp < 0) R = M; else L = M + 1; } return 0; // tag not found } int TagComplete(char **Words, int *WordsPos, int WordsMax, const char *Tag) { if (!Tag || !Words || (*WordsPos >= WordsMax)) return 0; if (!LoadTagFiles() || !CTags) return 0; int L = 0, R = CTags, len = strlen(Tag); while (L < R) { int c, M; M = (L + R) / 2; c = strncmp(Tag, TagMem + TagD[TagI[M]].Tag, len); if (c == 0) { while (M > 0 && strncmp(Tag, TagMem + TagD[TagI[M - 1]].Tag, len) == 0) M--; // find begining int N = M, w = 0; while (strncmp(Tag, TagMem + TagD[TagI[N]].Tag, len) == 0) { // the first word is not tested for previous match if (!w || strcmp(TagMem + TagD[TagI[N]].Tag, TagMem + TagD[TagI[N-1]].Tag)) { int l = strlen(TagMem + TagD[TagI[N]].Tag) - len; if (l > 0) { char *s = new char[l + 1]; if (!s) break; strcpy(s, TagMem + TagD[TagI[N]].Tag + len); Words[(*WordsPos)++] = s; w++; // also mark the first usage if (*WordsPos >= WordsMax) break; } } N++; } return w; } else if (c < 0) R = M; else L = M + 1; } return 0; // tag not found } int TagNext(EView *View) { assert(View); if (!CurrentTag || TagPosition == -1) { View->Msg(S_INFO, "No current tag."); return 0; } if (TagPosition < CTags - 1 && strcmp(CurrentTag, TagMem + TagD[TagI[TagPosition + 1]].Tag) == 0) { TagPosition++; return GotoTag(TagPosition, View); } View->Msg(S_INFO, "No next match for tag."); return 0; } int TagPrev(EView *View) { assert(View); if (!CurrentTag || TagPosition == -1) { View->Msg(S_INFO, "No current tag."); return 0; } if (TagPosition > 0 && strcmp(CurrentTag, TagMem + TagD[TagI[TagPosition - 1]].Tag) == 0) { TagPosition--; return GotoTag(TagPosition, View); } View->Msg(S_INFO, "No previous match for tag."); return 0; } int TagPop(EView *View) { assert(View != 0); delete TagStack::TStack; TagStack* T = TagStack::TStack; if (T) { //printf("DELETE POP %p %s\n", T, T->CurrentTag.c_str()); free(CurrentTag); CurrentTag = strdup(T->CurrentTag.c_str()); TagPosition = T->TagPos; return GotoFilePos(View, T->FileName.c_str(), T->Line, T->Col); } View->Msg(S_INFO, "Tag stack empty."); return 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_qt_dlg.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000012212�11344266046�012732� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "sysdep.h" #include "console.h" #include "gui.h" #include "s_files.h" #include <qwidget.h> #include <qframe.h> #include <qlabel.h> #include <qdialog.h> #include <qbutton.h> #include <qpushbt.h> #include <qfiledlg.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdarg.h> #define DEBUGX(x) // printf x unsigned long HaveGUIDialogs = GUIDLG_FILE | GUIDLG_CHOICE; int DLGGetFile(GView *v, const char *Prompt, unsigned int BufLen, char *FileName, int Flags) { QString fn; char filter[MAXPATH] = "*"; char directory[MAXPATH]; assert(BufLen > 0); JustDirectory(FileName, directory, sizeof(directory)); DEBUGX(("Doing file dialog\n")); if (Flags & GF_SAVEAS) { fn = QFileDialog::getSaveFileName(directory, filter); } else { fn = QFileDialog::getOpenFileName(directory, filter); } DEBUGX(("File dialog done\n")); if (fn.isNull()) return 0; strncpy(FileName, fn, BufLen); FileName[BufLen - 1] = 0; DEBUGX(("selected %s\n", FileName)); return FileName[0] ? 1 : 0; } int DLGPickChoice(GView * /*v*/, const char * /*ATitle*/, int /*NSel*/, va_list /*ap*/, int /*Flags*/) { assert(1==0); return 0; } int DLGGetStr(GView * /*View*/, const char * /*Prompt*/, unsigned int /*BufLen*/, char * /*Str*/, int /*HistId*/, int /*Flags*/) { assert(1 == 0); return 0; } const int kMaxButton = 16; class QChoiceBox : public QDialog { Q_OBJECT public: QChoiceBox(QWidget *parent=0, const char *name=0); void setText(const char *text); void addButton(const char *text); void adjustSize(); int getChoice() { return buttonActivated; } public slots: void pressed(); void released(); void clicked(); protected: void resizeEvent(QResizeEvent *); private: QLabel *label; QPushButton *button[kMaxButton]; int buttonCount; int buttonArmed; int buttonSelected; int buttonActivated; void *reserved1; void *reserved2; }; QChoiceBox::QChoiceBox(QWidget *parent, const char *name) : QDialog(parent, name, TRUE), label(new QLabel(this, "text")), buttonCount(0), buttonArmed(-1), buttonSelected(-1), buttonActivated(-1) { //initMetaObject(); CHECK_PTR(label); label->setAlignment(AlignLeft); QFont font("Helvetica", 12, QFont::Bold); label->setFont(font ); } void QChoiceBox::setText(const char *text) { label->setText(text); } void QChoiceBox::addButton(const char *text) { assert(buttonCount < kMaxButton); button[buttonCount] = new QPushButton(this); CHECK_PTR(button[buttonCount]); connect(button[buttonCount], SIGNAL(clicked()), SLOT(clicked())); connect(button[buttonCount], SIGNAL(pressed()), SLOT(pressed())); connect(button[buttonCount], SIGNAL(released()), SLOT(released())); button[buttonCount]->setFont(QFont("Helvetica", 12, QFont::Bold)); button[buttonCount]->setText(text ? text : "?" ); buttonCount++; } void QChoiceBox::adjustSize() { int w_buttons = 0; for (int i = 0; i < buttonCount; i++) { button[i]->adjustSize(); w_buttons += button[i]->width() + 10; } label->adjustSize(); QString labelStr = label->text(); int nlines = labelStr.contains('\n'); QFontMetrics fm = label->fontMetrics(); nlines += 2; int w = QMAX(w_buttons, label->width()); int h = button[0]->height() + fm.lineSpacing()*nlines; resize( w + w/3, h + h/3 ); } void QChoiceBox::resizeEvent( QResizeEvent * ) { int i; for (i = 0; i < buttonCount; i++) { button[i]->adjustSize(); } label->adjustSize(); int h = (height() - button[0]->height() - label->height())/3; int x = 10; for (i = 0; i < buttonCount; i++) { button[i]->move(x, height() - h - button[i]->height()); x += button[i]->width() + 10; } label->move( 10, h ); } void QChoiceBox::pressed() { int i; buttonSelected = -1; for (i = 0; i < buttonCount; i++) if (button[i]->isDown()) buttonSelected = i; buttonArmed = buttonSelected; DEBUGX(("selected: %d\n", buttonSelected)); } void QChoiceBox::released() { buttonSelected = -1; DEBUGX(("released\n")); } void QChoiceBox::clicked() { buttonActivated = buttonArmed; DEBUGX(("activated: %d\n", buttonActivated)); accept(); } #include "g_qt_dlg.moc" int DLGPickChoice(GView *v, char *ATitle, int NSel, va_list ap, int Flags) { QChoiceBox *cb = new QChoiceBox(); CHECK_PTR(cb); cb->setCaption( ATitle ); for (int i = 0; i < NSel; i++) cb->addButton(va_arg(ap, char *)); char msg[1024]; char *fmt; fmt = va_arg(ap, char *); vsprintf(msg, fmt, ap); cb->setText(msg); int retcode = cb->exec(); delete cb; if (retcode == QDialog::Accepted) return cb->getChoice(); return -1; } int DLGGetFind(GView *View, SearchReplaceOptions &sr) { assert(1==0); return 0; } int DLGGetFindReplace(GView *View, SearchReplaceOptions &sr) { assert(1==0); return 0; } int DLGGetStr(GView *View, char *Prompt, unsigned int BufLen, char *Str, int HistId, int Flags) { assert(1 == 0); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/menu_text.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000051152�11344266047�013171� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* menu_text.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_color.h" #include "c_mode.h" #include "gui.h" #include "sysdep.h" #include <ctype.h> #include <signal.h> #include <stdarg.h> #include <stdio.h> class UpMenu { public: class UpMenu *up; int id; int vert; int x, y, w, h; }; static int GetHOfsItem(int id, int cur) { int pos = 2; for (unsigned i = 0; i < Menus[id].Count; i++) { if ((int)i == cur) return pos; if (Menus[id].Items[i].Name) pos += (int)CStrLen(Menus[id].Items[i].Name) + 2; else pos++; } return -1; } static int GetHPosItem(int id, int X) { int pos = 1; unsigned i; size_t len; for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { len = CStrLen(Menus[id].Items[i].Name); if (X >= pos && X <= pos + (int)len + 1) return i; pos += (int)len + 2; } else pos++; } return -1; } static int DrawHMenu(int x, int y, int id, int active) { int pos = 1; TDrawBuffer B; unsigned i; size_t len; TAttr color1, color2; int Cols, Rows; ConQuerySize(&Cols, &Rows); MoveChar(B, 0, Cols, ' ', hcMenu_Background, Cols); if (id != -1) { for (i = 0; i < Menus[id].Count; i++) { if ((int)i == active) { color1 = hcMenu_ActiveItem; color2 = hcMenu_ActiveChar; } else { color1 = hcMenu_NormalItem; color2 = hcMenu_NormalChar; } if (Menus[id].Items[i].Name) { len = CStrLen(Menus[id].Items[i].Name); MoveChar(B, pos, Cols, ' ', color1, len + 2); MoveCStr(B, pos + 1, Cols, Menus[id].Items[i].Name, color1, color2, len); pos += (int)len + 2; } else { MoveChar(B, pos, Cols, ConGetDrawChar(DCH_V), hcMenu_Background, 1); pos++; } } } ConPutBox(x, y, Cols - x, 1, B); return 1; } static int GetVPosItem(int id, int w, int X, int Y) { if (Y <= 0 || Y > (int)Menus[id].Count) return -1; if (Menus[id].Items[Y - 1].Name == 0) return -1; if (X <= 0 || X >= w - 1) return -1; return Y - 1; } static int GetVSize(int id, int &X, int &Y) { size_t xsize = 0; size_t len; Y = Menus[id].Count; for (int i = 0; i < Y; i++) { len = 0; if (Menus[id].Items[i].Name) len = CStrLen(Menus[id].Items[i].Name); if (len > xsize) xsize = len; } X = (int)xsize; return 0; } static int DrawVMenu(int x, int y, int id, int active) { TDrawBuffer B; TAttr color1, color2; int w, h; if (id == -1) return -1; GetVSize(id, w, h); w += 4; h += 2; MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); MoveCh(B, ConGetDrawChar(DCH_C1), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_C2), hcMenu_Background, 1); ConPutBox(x, y, w, 1, B); for (unsigned i = 0; i < Menus[id].Count; ++i) { if ((int)i == active) { color1 = hcMenu_ActiveItem; color2 = hcMenu_ActiveChar; } else { color1 = hcMenu_NormalItem; color2 = hcMenu_NormalChar; } if (Menus[id].Items[i].Name) { char name[128]; strcpy(name, Menus[id].Items[i].Name); char* arg = strchr(name, '\t'); if (arg) *arg++ = 0; size_t len = CStrLen(name); size_t len2 = (arg) ? CStrLen(arg) : 0; MoveChar(B, 0, w, ' ', color1, w); MoveCh(B, ConGetDrawChar(DCH_V), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_V), hcMenu_Background, 1); MoveCStr(B, 2, (int)len + 2, Menus[id].Items[i].Name, color1, color2, len); if (arg) MoveCStr(B, w - (int)len2 - 2, w + 4, arg, color1, color2, len2); if (Menus[id].Items[i].SubMenu != -1) MoveCh(B + w - 2, ConGetDrawChar(DCH_RPTR), color1, 1); } else { MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); //for (int i = 0; i <= DCH_ARIGHT; i++) MoveCh(B + i, ConGetDrawChar(i), hcMenu_Background, 1); MoveCh(B, ConGetDrawChar(DCH_M2), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_M3), hcMenu_Background, 1); } ConPutBox(x, y + i + 1, w, 1, B); } MoveChar(B, 0, w, ConGetDrawChar(DCH_H), hcMenu_Background, w); MoveCh(B, ConGetDrawChar(DCH_C3), hcMenu_Background, 1); MoveCh(B + w - 1, ConGetDrawChar(DCH_C4), hcMenu_Background, 1); ConPutBox(x, y + Menus[id].Count + 1, w, 1, B); return 1; } int ExecVertMenu(int x, int y, int id, TEvent &E, UpMenu *up) { int cur = 0; int abort; int w, h; PCell c; PCell SaveC = 0; int SaveX, SaveY, SaveW, SaveH; UpMenu here; int dovert = 0; int rx; int Cols, Rows; ConQuerySize(&Cols, &Rows); here.up = up; if (x < 0) x = 0; if (y < 0) y = 0; GetVSize(id, w, h); w += 4; h += 2; if (w > Cols) w = Cols; if (h > Rows) h = Rows; if (x + w > Cols) { if (up && up->x == 0 && up->y == 0 && up->h == 1) { x = Cols - w; } else { if (up) x = up->x - w + 1; else x = x - w + 1; } } if (y + h > Rows) { if (up) y = y - h + 3; else { y = y - h + 1; } } if (x < 0) x = 0; if (y < 0) y = 0; here.x = x; here.y = y; here.w = w; here.h = h; here.id = id; here.vert = 1; c = (PCell) malloc(w * h * sizeof(TCell)); if (c) ConGetBox(x, y, w, h, c); SaveC = c; SaveX = x; SaveY = y; SaveW = w; SaveH = h; #ifdef CONFIG_MOUSE int wasmouse = 0; if (E.What == evMouseMove || E.What == evMouseDown) { } if (E.What & evMouse) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); dovert = 0; wasmouse = 1; E.What = evNone; } #endif abort = -2; while (abort == -2) { DrawVMenu(x, y, id, cur); if (dovert) { if (cur != -1) { if (Menus[id].Items[cur].SubMenu != -1) { rx = ExecVertMenu(x + w - 1, y + cur, Menus[id].Items[cur].SubMenu, E, &here); if (rx == 1) { abort = 1; continue; } else if (rx == -3) { abort = -3; break; } else abort = -2; } } } ConHideCursor(); do { ConGetEvent(evCommand | evMouseDown | evMouseMove | evMouseUp | evKeyDown | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, frames->Active, E); } while (E.What & evNotify); if (E.What & evMouse) { //fprintf(stderr, "Mouse: %d %d %d\n", E.What, E.Mouse.X, E.Mouse.Y); } dovert = 0; switch (E.What) { case evCommand: if (E.Msg.Command == cmResize) abort = -3; break; case evKeyDown: switch (kbCode(E.Key.Code)) { case kbPgDn: case kbEnd: cur = Menus[id].Count; case kbUp: { int xcur = cur; do { cur--; if (cur < 0) cur = Menus[id].Count - 1; } while (cur != xcur && Menus[id].Items[cur].Name == 0); } break; case kbPgUp: case kbHome: cur = -1; case kbDown: { int xcur = cur; do { cur++; if (cur >= Menus[id].Count) cur = 0; } while (cur != xcur && Menus[id].Items[cur].Name == 0); } break; case kbEsc: abort = -1; break; case kbEnter: if (cur != -1) { if (Menus[id].Items[cur].SubMenu < 0) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; case kbLeft: case kbRight: gui->ConPutEvent(E); abort = -1; break; default: if (isAscii(E.Key.Code)) { char cc; int i; cc = char(toupper(char(E.Key.Code & 0xFF))); for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o) if (toupper(o[1]) == cc) { cur = i; if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; } } } } } break; #ifdef CONFIG_MOUSE case evMouseDown: if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } else { if (up) gui->ConPutEvent(E); abort = -1; } wasmouse = 1; dovert = 1; break; case evMouseMove: if (E.Mouse.Buttons) { dovert = 1; if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } else { UpMenu *p = up; int first = 1; if (wasmouse) { while (p) { if (E.Mouse.X >= p->x && E.Mouse.Y >= p->y && E.Mouse.X < p->x + p->w && E.Mouse.Y < p->y + p->h) { if (first == 1) { if (p->vert) { int i = GetVPosItem(p->id, p->w, E.Mouse.X - p->x, E.Mouse.Y - p->y); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } else { int i = GetHPosItem(p->id, E.Mouse.X); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } first = 0; } gui->ConPutEvent(E); abort = -1; break; } first = 0; p = p->up; } cur = -1; } else cur = -1; } } break; case evMouseUp: if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h) { cur = GetVPosItem(id, w, E.Mouse.X - x, E.Mouse.Y - y); } if (cur == -1) { if (up) { UpMenu *p = up; cur = 0; if (E.Mouse.X >= p->x && E.Mouse.Y >= p->y && E.Mouse.X < p->x + p->w && E.Mouse.Y < p->y + p->h) { if (p->vert) { int i = GetVPosItem(p->id, p->w, E.Mouse.X - p->x, E.Mouse.Y - p->y); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } else { int i = GetHPosItem(p->id, E.Mouse.X); if (i != -1) if (Menus[p->id].Items[i].SubMenu == id) break; } abort = -1; } } else abort = -1; if (E.Mouse.X >= x && E.Mouse.Y >= y && E.Mouse.X < x + w && E.Mouse.Y < y + h); else { gui->ConPutEvent(E); abort = -3; } } else { if (Menus[id].Items[cur].Name != 0 && Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; //fprintf(stderr, "Command set = %d %d %d\n", id, cur, Menus[id].Items[cur].Cmd); abort = 1; } } break; #endif } } if (SaveC) { ConPutBox(SaveX, SaveY, SaveW, SaveH, SaveC); free(SaveC); SaveC = 0; } ConShowCursor(); if (up && abort == -3) return -3; return (abort == 1) ? 1 : -1; } int ExecMainMenu(TEvent &E, char sub) { int cur = 0; int id = GetMenuId(frames->Menu); int abort; int dovert = 1; int rx; static UpMenu top = { 0, 0, 0, 0, 0, 0, 1 }; TCell topline[ConMaxCols]; int Cols, Rows; ConQuerySize(&Cols, &Rows); top.x = 0; top.y = 0; top.h = 1; top.w = Cols; top.id = id; top.vert = 0; ConGetBox(0, 0, Cols, 1, topline); if (sub != 0) { for (int i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o && toupper(o[1]) == toupper(sub)) { cur = i; break; } } } } #ifdef CONFIG_MOUSE if (E.What == evMouseDown) { cur = GetHPosItem(id, E.Mouse.X); dovert = 1; } #endif abort = -2; while (abort == -2) { DrawHMenu(0, 0, id, cur); if (dovert) { if (cur != -1) { if (Menus[id].Items[cur].SubMenu != -1) { rx = ExecVertMenu(GetHOfsItem(id, cur) - 2, 1, Menus[id].Items[cur].SubMenu, E, &top); if (rx == 1) { abort = 1; continue; } else if (rx == -3) { abort = -1; break; } else abort = -2; } } } ConHideCursor(); do { ConGetEvent(evCommand | evMouseDown | evMouseMove | evMouseUp | evKeyDown | evNotify, &E, -1, 1); if (E.What & evNotify) gui->DispatchEvent(frames, frames->Active, E); } while (E.What & evNotify); dovert = 0; switch (E.What) { case evCommand: if (E.Msg.Command == cmResize) abort = -1; break; case evKeyDown: switch (kbCode(E.Key.Code)) { case kbEnd: cur = Menus[id].Count; case kbLeft: dovert = 1; { int x = cur; do { cur--; if (cur < 0) cur = Menus[id].Count - 1; } while (cur != x && Menus[id].Items[cur].Name == 0); } break; case kbHome: cur = -1; case kbRight: dovert = 1; { int x = cur; do { cur++; if (cur >= Menus[id].Count) cur = 0; } while (cur != x && Menus[id].Items[cur].Name == 0); } break; case kbEsc: abort = -1; dovert = 0; break; case kbEnter: if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; default: if (isAscii(E.Key.Code)) { char cc; int i; cc = char(toupper(char(E.Key.Code & 0xFF))); for (i = 0; i < Menus[id].Count; i++) { if (Menus[id].Items[i].Name) { char *o = strchr(Menus[id].Items[i].Name, '&'); if (o) if (toupper(o[1]) == cc) { cur = i; if (cur != -1) { if (Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } else { dovert = 1; } } break; } } } } break; } break; #ifdef CONFIG_MOUSE case evMouseDown: if (E.Mouse.Y == 0) { int oldcur = cur; cur = GetHPosItem(id, E.Mouse.X); if (cur == oldcur) { abort = -1; } } else { cur = -1; abort = -1; } dovert = 1; break; case evMouseMove: if (E.Mouse.Buttons) { if (E.Mouse.Y == 0) cur = GetHPosItem(id, E.Mouse.X); else cur = -1; dovert = 1; } break; case evMouseUp: if (E.Mouse.Y == 0) cur = GetHPosItem(id, E.Mouse.X); if (cur == -1) abort = -1; else { if (Menus[id].Items[cur].Name != 0 && Menus[id].Items[cur].SubMenu == -1) { E.What = evCommand; E.Msg.View = frames->Active; E.Msg.Command = Menus[id].Items[cur].Cmd; abort = 1; } } break; #endif } } DrawHMenu(0, 0, id, -1); ConPutBox(0, 0, Cols, 1, topline); ConShowCursor(); return (abort == 1) ? 1 : -1; } void GFrame::DrawMenuBar() { DrawHMenu(0, 0, GetMenuId(Menu), -1); } extern TEvent NextEvent; int GFrame::PopupMenu(const char *Name) { NextEvent.What = evCommand; NextEvent.Msg.Command = cmPopupMenu; NextEvent.Msg.Param1 = GetMenuId(Name); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_fold.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000031263�11602724002�012375� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_fold.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "e_undo.h" #include "o_buflist.h" #include "sysdep.h" int EBuffer::FindFold(int Line) { // optimize /*FOLD00*/ int f = FindNearFold(Line); if (f != -1) if (FF[f].line == Line) return f; return -1; } int EBuffer::FindNearFold(int Line) { /*FOLD00*/ int b = 0, B = FCount - 1, c; while (b <= B) { c = (b + B) / 2; // printf("%d %d %d %d %d\n", b, B, c, Line, FF[c].line); if (FF[c].line == Line) return c; if (c < FCount - 1) { if (FF[c].line <= Line && FF[c + 1].line > Line) return c; } else { if (FF[c].line <= Line) return c; } if (FF[c].line < Line) b = c + 1; else B = c - 1; if (b > B) break; } return -1; } int EBuffer::ShowRow(int Row) { /*FOLD00*/ int V = RToVN(Row), GapSize; // printf("Showing row %d\n", Row); assert(Row >= 0 && Row < RCount); // 0 cannot be hidden if (V + Vis(V) == Row) return 1; // already visible assert(VCount <= VAllocated); if (VCount == VAllocated) { if (AllocVis(VCount ? (VCount * 2) : 1) == 0) return 0; memmove(VV + VAllocated - (VCount - VGap), VV + VGap, sizeof(int) * (VCount - VGap)); } if (VGap != V + 1) if (MoveVGap(V + 1) == 0) return 0; VV[VGap] = Row - (VGap); VGap++; VCount++; GapSize = VAllocated - VCount; if (VGap != V + 2) if (MoveVGap(V + 2) == 0) return 0; for (int i = V + 2; i < VCount; i++) VV[i + GapSize]--; // Vis(i, Vis(i) - 1); UpdateVisible(Row, 1); // if (CP.Row > Row) // if (SetPos(CP.Col, CP.Row + 1) == 0) return 0; Draw(Row, -1); return 1; } int EBuffer::HideRow(int Row) { /*FOLD00*/ int V = RToV(Row), GapSize; assert(Row > 0 && Row < RCount); // 0 cannot be hidden if (V == -1) return 1; // already hidden UpdateVisible(Row, -1); if (VGap != V) if (MoveVGap(V) == 0) return 0; GapSize = VAllocated - VCount; VV[VGap + GapSize] = 0; VCount--; GapSize++; if (VAllocated - VAllocated / 2 > VCount) { memmove(VV + VGap + GapSize - VAllocated / 3, VV + VGap + GapSize, sizeof(int) * (VCount - VGap)); if (AllocVis(VAllocated - VAllocated / 3) == 0) return 0; } GapSize = VAllocated - VCount; if (VGap != V) if (MoveVGap(V) == 0) return 0; for (int i = V; i < VCount; i++) VV[i + GapSize]++; // Vis(i, Vis(i) + 1); // if (CP.Row > Row) // if (SetPos(CP.Col, CP.Row - 1) == 0) return 0; Draw(Row, -1); return 1; } int EBuffer::ExposeRow(int Row) { /*FOLD00*/ int V; int f, level, oldlevel = 100; //DumpFold(); assert(Row >= 0 && Row < RCount); // range V = RToV(Row); if (V != -1) return 1; // already exposed f = FindNearFold(Row); assert(f != -1); // if not visible, must be folded while (f >= 0) { level = FF[f].level; if (level < oldlevel) { if (FF[f].open == 0) { // printf("opening fold %d\n", f); if (FoldOpen(FF[f].line) == 0) return 0; } oldlevel = level; } f--; if (level == 0) break; } V = RToV(Row); // if (V == -1) { // printf("Expose Row = %d\n", Row); // DumpFold(); // } assert (V != -1); return 1; } void EBuffer::UpdateVis(EPoint &M, int Row, int Delta) { /*FOLD00*/ if (Delta < 0) { if (M.Row > Row) { if (M.Row < Row - Delta) M.Row = Row; else M.Row += Delta; } } else if (M.Row >= Row) M.Row += Delta; } void EBuffer::UpdateVisible(int Row, int Delta) { /*FOLD00*/ EView *w; Row = RToV(Row); UpdateVis(CP, Row, Delta); w = View; if (w) do { UpdateVis(GetViewVPort(w)->TP, Row, Delta); UpdateVis(GetViewVPort(w)->CP, Row, Delta); w = w->Next; } while (w != View); } int EBuffer::FoldCreate(int Line) { /*FOLD00*/ int n; if (Modify() == 0) return 0; if (FindFold(Line) != -1) return 1; // already exists #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldCreate) == 0) return 0; } #endif n = FindNearFold(Line); n++; FF = (EFold *) realloc((void *)FF, sizeof(EFold) * ((1 + FCount) | 7)); assert(FF != 0); memmove(FF + n + 1, FF + n, sizeof(EFold) * (FCount - n)); FCount++; FF[n].line = Line; FF[n].level = 0; FF[n].open = 1; FF[n].flags = 0; Draw(Line, Line); return 1; } int EBuffer::FoldCreateByRegexp(const char *Regexp) { /*FOLD00*/ RxNode *R; int err = 1; if (Modify() == 0) return 0; R = RxCompile(Regexp); if (R != NULL) { PELine X; int first = -1; int L; for (L = 0; L < RCount; L++) { RxMatchRes RM; X = RLine(L); if (RxExec(R, X->Chars, X->Count, X->Chars, &RM) == 1) { if (first >= 0) { int i; for(i = L; i > 0; i--) { PELine Y; Y = RLine(i); if ((Y->Count == 0) || strrchr(Y->Chars, '}')) { if ((L - i) > 2) { while ((i > 0) && (RLine(i - 1)->Count == 0)) i--; if ((first >= 0) && i && (FoldCreate(i) == 0)) err = 0; } break; } } } else first = L; if (FoldCreate(L) == 0) { err = 0; break; } } } RxFree(R); } return err; } int EBuffer::FoldCreateAtRoutines() { /*FOLD00*/ if (BFS(this, BFS_RoutineRegexp) == 0) return 0; return FoldCreateByRegexp(BFS(this, BFS_RoutineRegexp)); } int EBuffer::FoldDestroy(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) if (FoldOpen(Line) == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(FF[f].level) == 0) return 0; if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldDestroy) == 0) return 0; } #endif memmove(FF + f, FF + f + 1, sizeof(EFold) * (FCount - f - 1)); FCount--; FF = (EFold *) realloc((void *)FF, sizeof(EFold) * (FCount | 7)); Draw(Line, Line); return 1; } int EBuffer::FoldDestroyAll() { /*FOLD00*/ int l; if (Modify() == 0) return 0; for (l = 0; l < RCount; l++) if (FindFold(l) != -1) if (FoldDestroy(l) == 0) return 0; return 1; } int EBuffer::FoldPromote(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) return 0; if (FF[f].level == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldPromote) == 0) return 0; } #endif if ((FF[f].line > 0) && (ExposeRow(FF[f].line - 1) == 0)) return 0; FF[f].level--; Draw(Line, Line); return 1; } int EBuffer::FoldDemote(int Line) { /*FOLD00*/ int f = FindFold(Line); if (Modify() == 0) return 0; if (f == -1) return 0; if (FF[f].open == 0) return 0; if (FF[f].level == 99) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldDemote) == 0) return 0; } #endif if ((FF[f].line > 0) && (ExposeRow(FF[f].line - 1) == 0)) return 0; FF[f].level++; Draw(Line, Line); return 1; } int EBuffer::FoldOpen(int Line) { /*FOLD00*/ int f = FindFold(Line); int l; int level, toplevel; int top; if (f == -1) return 0; if (FF[f].open == 1) return 1; // already open if (Modify() == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldOpen) == 0) return 0; } #endif FF[f].open = 1; top = FF[f].line; toplevel = FF[f].level; // printf("Fold starts with %d\n", FF[f].line); if (ShowRow(FF[f].line) == 0) return 0; while (f < FCount) { level = FF[f].level; if (FF[f].open == 1) { // fold is open if (f == FCount - 1) { for (l = FF[f].line; l < RCount; l++) if (l != top) if (ShowRow(l) == 0) return 0; } else { for (l = FF[f].line; l < FF[f + 1].line; l++) if (l != top) if (ShowRow(l) == 0) return 0; } f++; } else { // fold is closed // show head line if (ShowRow(FF[f].line) == 0) return 0; // skip closed folds while ((f < FCount) && (level < FF[f + 1].level)) f++; f++; } if (f < FCount && FF[f].level <= toplevel) break; } return 1; } int EBuffer::FoldOpenAll() { /*FOLD00*/ for (int l = 0; l < RCount; ++l) if ((FindFold(l) != -1) && !FoldOpen(l)) return 0; return 1; } int EBuffer::FoldOpenNested() { /*FOLD00*/ int Line = VToR(CP.Row); int f = FindFold(Line); int l; int level; if (f == -1) return 0; level = FF[f].level; while (f + 1 < FCount && FF[f + 1].level > level) f++; if (f + 1 == FCount) { if (FoldOpen(Line) == 0) return 0; } else { for (l = Line; l < RCount && l < FF[f + 1].line; l++) { if (FindFold(l) != -1) if (FoldOpen(l) == 0) return 0; } } return 0; } int EBuffer::FoldClose(int Line) { /*FOLD00*/ int f = FindNearFold(Line); int l, top; int level; if (f == -1) return 0; if (FF[f].open == 0) return 1; // already closed if (Modify() == 0) return 0; if (SetPosR(CP.Col, FF[f].line, tmLeft) == 0) return 0; #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(Line) == 0) return 0; if (PushUChar(ucFoldClose) == 0) return 0; } #endif FF[f].open = 0; top = FF[f].line; level = FF[f].level; while ((f < FCount - 1) && (FF[f + 1].level > level)) f++; /* performance tweak: do it in reverse (we'll see if it helps) */ if (f == FCount - 1) { for (l = RCount - 1; l > top; l--) if (HideRow(l) == 0) return 0; } else { for (l = FF[f + 1].line - 1; l > top; l--) if (HideRow(l) == 0) return 0; } /* yup, it does. try below for a (MUCH!) slower version */ /*if (f == FCount - 1) { for (l = top + 1; l < RCount; l++) if (HideRow(l) == 0) return 0; } else { for (l = top + 1; l < FF[f + 1].line; l++) if (HideRow(l) == 0) return 0; }*/ return 1; } int EBuffer::FoldCloseAll() { /*FOLD00*/ for (int l = RCount - 1; l >= 0; --l) if ((FindFold(l) != -1) && !FoldClose(l)) return 0; return 1; } int EBuffer::FoldToggleOpenClose() { /*FOLD00*/ int Line = VToR(CP.Row); int f = FindNearFold(Line); if (f == -1) return 0; if (FF[f].open) { if (!FoldClose(Line)) return 0; } else { if (!FoldOpen(Line)) return 0; } return 1; } int EBuffer::MoveFoldTop() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f <= 0) return 0; if (FF[f].line == VToR(CP.Row)) return 1; return SetPosR(CP.Col, FF[f].line, tmLeft); } int EBuffer::MoveFoldPrev() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if (f <= 0) return 0; if (FF[f].line == VToR(CP.Row)) { for (;;) { if (--f < 0) return 0; if (RToV(FF[f].line) != -1) break; } } return SetPosR(CP.Col, FF[f].line, tmLeft); } int EBuffer::MoveFoldNext() { /*FOLD00*/ int f = FindNearFold(VToR(CP.Row)); if ((f == (FCount - 1)) || (f == -1)) return 0; while (++f < FCount) if (RToV(FF[f].line) != -1) return SetPosR(CP.Col, FF[f].line, tmLeft); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_i18n.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000000651�11331412502�012223� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef CON_I18N_H #define CON_I18N_H #include <X11/Xlib.h> struct i18n_context_t; /* * prototypes for I18N functions * * C code - need typedef */ void i18n_focus_out(i18n_context_t*); void i18n_focus_in(i18n_context_t*); int i18n_lookup_sym(i18n_context_t*, XKeyEvent *, char *, int, KeySym *); i18n_context_t* i18n_open(Display *, Window, unsigned long *); void i18n_destroy(i18n_context_t**); #endif // CON_I18N_H ���������������������������������������������������������������������������������������./src/o_modemap.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000011474�11344266047�013124� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_modemap.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_modemap.h" #include "s_string.h" #include "sysdep.h" #include <stdio.h> EventMapView *TheEventMapView = 0; void EventMapView::AddLine(const char *Line) { if (BList) { BCount++; BList = (char **)realloc((void *)BList, sizeof(char *) * BCount); } else { BCount = 1; BList = (char **)malloc(sizeof(char *)); } assert(BList); BList[BCount - 1] = strdup(Line); } void EventMapView::DumpKey(const char *aPrefix, EKey *Key) { char KeyName[128] = ""; char Entry[2048] = ""; char *p; int id; if (aPrefix) { strcpy(KeyName, aPrefix); strcat(KeyName, "_"); } GetKeyName(KeyName + strlen(KeyName), sizeof(KeyName)-strlen(KeyName), Key->fKey); sprintf(Entry, "%13s ", KeyName); id = Key->Cmd; for (unsigned i = 0; i < Macros[id].Count; ++i) { p = Entry + strlen(Entry); if (Macros[id].cmds[i].type == CT_COMMAND) { if (Macros[id].cmds[i].repeat > 1) sprintf(p, "%d:%s ", Macros[id].cmds[i].repeat, GetCommandName((int)Macros[id].cmds[i].u.num)); else sprintf(p, "%s ", GetCommandName((int)Macros[id].cmds[i].u.num)); } else if (Macros[id].cmds[i].type == CT_NUMBER) { sprintf(p, "%ld ", Macros[id].cmds[i].u.num); } else if (Macros[id].cmds[i].type == CT_STRING) { sprintf(p, "'%s' ", Macros[id].cmds[i].u.string); } else if (Macros[id].cmds[i].type == CT_CONCAT) { strcat(p, ". "); } else if (Macros[id].cmds[i].type == CT_VARIABLE) { sprintf(p, "$(%ld) ", Macros[id].cmds[i].u.num); } if (strlen(Entry) > 70) { if ((i + 1) != Macros[id].Count) { // not the last entry AddLine(Entry); sprintf(Entry, "%13s ", ""); } } } AddLine(Entry); } void EventMapView::DumpMap(const char *aPrefix, EKeyMap *aKeyMap) { EKey *Key; Key = aKeyMap->fKeys; while (Key) { if (Key->fKeyMap) { char Prefix[32] = ""; if (aPrefix) { strcpy(Prefix, aPrefix); strcat(Prefix, "_"); } GetKeyName(Prefix + strlen(Prefix), sizeof(Prefix)-strlen(Prefix), Key->fKey); DumpMap(Prefix, Key->fKeyMap); } else { DumpKey(aPrefix, Key); } Key = Key->fNext; } } void EventMapView::DumpEventMap(EEventMap *aEventMap) { while (aEventMap) { StlString name(aEventMap->Name); if (aEventMap->Parent) { name += ": "; name += aEventMap->Parent->Name; } AddLine(name.c_str()); if (aEventMap->KeyMap) DumpMap(0, aEventMap->KeyMap); aEventMap = aEventMap->Parent; if (aEventMap != 0) AddLine(""); } } EventMapView::EventMapView(int createFlags, EModel **ARoot, EEventMap *Map) : EList(createFlags, ARoot, "Event Map"), BList(0), BCount(0) { DumpEventMap(EMap = Map); TheEventMapView = this; } EventMapView::~EventMapView() { FreeView(); TheEventMapView = 0; } void EventMapView::FreeView() { if (BList) { for (int i = 0; i < BCount; i++) if (BList[i]) free(BList[i]); free(BList); } BCount = 0; BList = 0; } void EventMapView::ViewMap(EEventMap *Map) { FreeView(); DumpEventMap(EMap = Map); } EEventMap *EventMapView::GetEventMap() { return FindEventMap("EVENTMAPVIEW"); } int EventMapView::ExecCommand(ExCommands Command, ExState &State) { return EList::ExecCommand(Command, State); } int EventMapView::GetContext() { return CONTEXT_MAPVIEW; } void EventMapView::DrawLine(PCell B, int Line, int Col, ChColor color, int Width) { if (Line < BCount) if (Col < int(strlen(BList[Line]))) MoveStr(B, 0, Width, BList[Line] + Col, color, Width); } char *EventMapView::FormatLine(int Line) { return strdup(BList[Line]); } void EventMapView::UpdateList() { Count = BCount; EList::UpdateList(); } int EventMapView::CanActivate(int /*Line*/) { return 0; } void EventMapView::GetName(char *AName, size_t MaxLen) { strlcpy(AName, "EventMapView", MaxLen); } void EventMapView::GetInfo(char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d/%03d EventMapView (%s)", ModelNo, Row + 1, Count, EMap->Name); } void EventMapView::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { snprintf(ATitle, MaxLen, "EventMapView: %s", EMap->Name); strlcpy(ASTitle, "EventMapView", SMaxLen); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/c_hilit.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000015742�11602724002�012564� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_hilit.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_buflist.h" #ifdef CONFIG_SYNTAX_HILIT #include "sysdep.h" #include <stdio.h> static const struct { const char Name[8]; int Num; SyntaxProc Proc; } HilitModes[] = { { "PLAIN", HILIT_PLAIN, Hilit_Plain }, #ifdef CONFIG_HILIT_C { "C", HILIT_C, Hilit_C }, #endif #ifdef CONFIG_HILIT_REXX { "REXX", HILIT_REXX, Hilit_REXX }, #endif #ifdef CONFIG_HILIT_PERL { "PERL", HILIT_PERL, Hilit_PERL }, #endif #ifdef CONFIG_HILIT_MAKE { "MAKE", HILIT_MAKE, Hilit_MAKE }, #endif #ifdef CONFIG_HILIT_IPF { "IPF", HILIT_IPF, Hilit_IPF }, #endif #ifdef CONFIG_HILIT_ADA { "Ada", HILIT_ADA, Hilit_ADA }, #endif #ifdef CONFIG_HILIT_MSG { "MSG", HILIT_MSG, Hilit_MSG }, #endif #ifdef CONFIG_HILIT_SH { "SH", HILIT_SH, Hilit_SH }, #endif #ifdef CONFIG_HILIT_PASCAL { "PASCAL", HILIT_PASCAL, Hilit_PASCAL }, #endif #ifdef CONFIG_HILIT_TEX { "TEX", HILIT_TEX, Hilit_TEX }, #endif #ifdef CONFIG_HILIT_FTE { "FTE", HILIT_FTE, Hilit_FTE }, #endif #ifdef CONFIG_HILIT_CATBS { "CATBS", HILIT_CATBS, Hilit_CATBS }, #endif #ifdef CONFIG_HILIT_SIMPLE { "SIMPLE", HILIT_SIMPLE, Hilit_SIMPLE }, #endif }; static const struct { const char Name[8]; int Num; } IndentModes[] = { #ifdef CONFIG_INDENT_C { "C", INDENT_C }, #endif #ifdef CONFIG_INDENT_REXX { "REXX", INDENT_REXX }, #endif #ifdef CONFIG_INDENT_SIMPLE { "SIMPLE", INDENT_REXX }, #endif { "PLAIN", INDENT_PLAIN }, }; EColorize *Colorizers = 0; int GetIndentMode(const char *Str) { for (size_t i = 0; i < FTE_ARRAY_SIZE(IndentModes); ++i) if (strcmp(Str, IndentModes[i].Name) == 0) return IndentModes[i].Num; return 0; } int GetHilitMode(const char *Str) { for (size_t i = 0; i < FTE_ARRAY_SIZE(HilitModes); ++i) if (strcmp(Str, HilitModes[i].Name) == 0) return HilitModes[i].Num; return HILIT_PLAIN; } SyntaxProc GetHilitProc(int id) { for (size_t i = 0; i < FTE_ARRAY_SIZE(HilitModes); ++i) if (id == HilitModes[i].Num) return HilitModes[i].Proc; return 0; } #ifdef CONFIG_WORD_HILIT int EBuffer::HilitAddWord(const char *Word) { if (HilitFindWord(Word) == 1) return 1; WordList.push_back(Word); FullRedraw(); return 1; } int EBuffer::HilitFindWord(const char *Word) { vector_iterate(StlString, WordList, it) { if (BFI(this, BFI_MatchCase) == 1) { if (strcmp(Word, (*it).c_str()) == 0) return 1; } else { if (stricmp(Word, (*it).c_str()) == 0) return 1; } } return 0; } int EBuffer::HilitRemoveWord(const char *Word) { vector_iterate(StlString, WordList, it) { if (BFI(this, BFI_MatchCase) == 1) { if (strcmp(Word, (*it).c_str()) != 0) continue; } else { if (stricmp(Word, (*it).c_str()) != 0) continue; } WordList.erase(it); FullRedraw(); return 1; } return 0; } int EBuffer::HilitWord() { PELine L = VLine(CP.Row); char s[CK_MAXLEN + 2]; int P, len = 0; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < CK_MAXLEN && P < (int)L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) s[len++] = L->Chars[P++]; if (len == 0) return 0; s[len] = 0; return (HilitFindWord(s)) ? HilitRemoveWord(s) : HilitAddWord(s); } #endif /* ======================================================================= */ EColorize::EColorize(const char *AName, const char *AParent) : Name(AName), Next(Colorizers), Parent(FindColorizer(AParent)), SyntaxParser(HILIT_PLAIN), hm(0) { Colorizers = this; memset(&Keywords, 0, sizeof(Keywords)); if (Parent) { SyntaxParser = Parent->SyntaxParser; memcpy(Colors, Parent->Colors, sizeof(Colors)); } else memset(Colors, 0, sizeof(Colors)); } EColorize::~EColorize() { for (int i=0; i<CK_MAXLEN; i++) free(Keywords.key[i]); delete hm; } EColorize *FindColorizer(const char *AName) { EColorize *p = Colorizers; while (p) { if (p->Name == AName) return p; p = p->Next; } return 0; } int EColorize::SetColor(int idx, const char *Value) { unsigned int ColBg, ColFg; if (sscanf(Value, "%1X %1X", &ColFg, &ColBg) != 2) return 0; if (idx < 0 || idx >= COUNT_CLR) return 0; Colors[idx] = ChColor(ColFg | (ColBg << 4)); return 1; } /* ======================================================================= */ void HTrans::InitTrans() { match = 0; matchLen = 0; matchFlags = 0; nextState = 0; color = 0; regexp = 0; } /* ======================================================================= */ void HState::InitState() { memset((void *)&keywords, 0, sizeof(keywords)); firstTrans = 0; transCount = 0; color = 0; wordChars = 0; options = 0; nextKwdMatchedState = -1; nextKwdNotMatchedState = -1; nextKwdNoCharState = -1; } int HState::GetHilitWord(ChColor &clr, const char *str, size_t len) { char *p; if (len >= CK_MAXLEN || !len) return 0; p = keywords.key[len]; if (options & STATE_NOCASE) { while (p && *p) { if (strnicmp(p, str, len) == 0) { clr = ChColor(COUNT_CLR + ((unsigned char*)p)[len]); return 1; } p += len + 1; } } else { while (p && *p) { if (memcmp(p, str, len) == 0) { clr = ChColor(COUNT_CLR + ((unsigned char*)p)[len]); return 1; } p += len + 1; } } return 0; } /* ======================================================================= */ HMachine::HMachine() : stateCount(0), transCount(0), state(0), trans(0) { } HMachine::~HMachine() { // free states if (state) { while (stateCount--) { for (unsigned i = 0; i < CK_MAXLEN; ++i) free(state[stateCount].keywords.key[i]); free(state[stateCount].wordChars); } free(state); } // free transes if (trans) { while (transCount--) { if (trans[transCount].match) free(trans[transCount].match); if (trans[transCount].regexp) RxFree(trans[transCount].regexp); } free(trans); } } void HMachine::AddState(HState &aState) { state = (HState *)realloc(state, (stateCount + 1) * sizeof(HState) ); assert( state ); state[stateCount] = aState; state[stateCount].firstTrans = transCount; stateCount++; } void HMachine::AddTrans(HTrans &aTrans) { assert(stateCount > 0); trans = (HTrans *)realloc(trans, (transCount + 1) * sizeof(HTrans) ); assert( trans ); state[stateCount - 1].transCount++; trans[transCount] = aTrans; transCount++; } #endif // CONFIG_SYNTAX_HILIT ������������������������������./src/compkeys.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000031135�11602724002�012775� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * compkeys.cpp * * Copyright (c) 1998 by István Váradi * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "conkbd.h" #include "console.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define FTESL_KBDCTRL(x) (x - 'a' + 1) // *INDENT-OFF* static unsigned get_linux_keycode(TKeyCode kcode) { static const unsigned lnxkeycodes[] = { /* 32 */ 57, 2, 40, 4, 5, 6, 8, 40, /* 40 */ 10, 11, 9, 13, 51, 12, 52, 53, /* 48 */ 11, 2, 3, 4, 5, 6, 7, 8, /* 56 */ 9 , 10, 39, 39, 51, 13, 52, 53, /* 64 */ 3 , 30, 48, 46, 32, 18, 33, 34, /* 72 */ 35, 23, 36, 37, 38, 50, 49, 24, /* 80 */ 25, 16, 19, 31, 20, 22, 47, 17, /* 88 */ 45, 21, 44, 26, 86, 27, 7, 12, /* 96 */ 43, 30, 48, 46, 32, 18, 33, 34, /* 104 */ 35, 23, 36, 37, 38, 50, 49, 24, /* 112 */ 25, 16, 19, 31, 20, 22, 47, 17, /* 120 */ 45, 21, 44, 26, 86, 27, 43, 0, }; TKeyCode key = keyCode(kcode)|(kcode&kfGray); switch(key) { case kbF1: case kbF2: case kbF3: case kbF4: case kbF5: case kbF6: case kbF7: case kbF8: case kbF9: case kbF10: return 59 + (unsigned)key - kbF1; case kbF11: return 87; case kbF12: return 88; case kbHome: return 102; case kbEnd: return 107; case kbPgUp: return 104; case kbPgDn: return 109; case kbIns: return 110; case kbDel: return 111; case kbUp: return 103; case kbDown: return 108; case kbLeft: return 105; case kbRight: return 106; case kbEnter: return 28; case kbEsc: return 1; case kbBackSp: return 14; case kbSpace: return 57; case kbTab: return 15; case kbCenter: return 76; case kfGray|'/': return 98; case kfGray|'*': return 55; case kfGray|'+': return 78; case kfGray|'-': return 74; case kfGray|kbEnter: return 96; case kfGray|'.': return 83; case kfGray|'7': case kfGray|kbHome: return 71; case kfGray|'8': case kfGray|kbUp: return 72; case kfGray|'9': case kfGray|kbPgUp: return 73; case kfGray|'4': case kfGray|kbLeft: return 75; case kfGray|'5': return 76; case kfGray|'6': case kfGray|kbRight: return 77; case kfGray|'1': case kfGray|kbEnd: return 79; case kfGray|'2': case kfGray|kbDown: return 80; case kfGray|'3': case kfGray|kbPgDn: return 81; default: if (key > 32 && key < 128) return lnxkeycodes[key - 32]; return 0; } } // *INDENT-ON* struct keymapper { TKeyCode kcode; const char* kname; }; static const keymapper speckeymap[]={ { kbHome, "Home" }, { kbEnd, "End" }, { kbPgUp, "PgUp" }, { kbPgDn, "PgDn" }, { kbIns, "Ins" }, { kbDel, "Del" }, { kbUp, "Up" }, { kbDown, "Down" }, { kbLeft, "Left" }, { kbRight, "Right" }, { kbEnter, "Enter" }, { kbEsc, "Esc" }, { kbBackSp, "BackSp" }, { kbSpace, "Space" }, { kbTab, "Tab" }, { kbCenter, "Center" }, }; static TKeyCode ftesl_getkeycode(const char* key) { TKeyCode kcode = 0; if ( (*key)=='\0') return 0; while (*(key+1)=='+') { switch (*key) { case 'A': kcode|=kfAlt; break; case 'C': kcode|=kfCtrl; break; case 'S': kcode|=kfShift; break; case 'G': kcode|=kfGray; break; default: return 0; break; } key+=2; } if ( (*key)=='\0') return 0; if ( *(key+1)=='\0') { kcode|=*(const unsigned char *)key; return kcode; } for (size_t i = 0; i < FTE_ARRAY_SIZE(speckeymap); ++i) if (!strcmp(key, speckeymap[i].kname)) { kcode|=speckeymap[i].kcode; return kcode; } if ( *key == 'F' ) { key++; if ( *key>='1' && *key<='9' ) { if ( *key == '1' && *(key+1)!='\0' ) { key++; switch (*key) { case '1': kcode|=kbF11; break; case '2': kcode|=kbF12; break; default: return 0; break; } return kcode; } kcode|=kbF1+(*key-'1'); return kcode; } } return 0; } static int ftesl_get_ctrlcode(TKeyCode key) { TKeyCode kcode = keyCode(key); switch(kcode) { case kbUp: return FTESL_KBDCTRL('u'); case kbDown: return FTESL_KBDCTRL('d'); case kbLeft: return FTESL_KBDCTRL('l'); case kbRight: return FTESL_KBDCTRL('r'); case kbCenter: return FTESL_KBDCTRL('x'); case kbHome: return FTESL_KBDCTRL('b'); case kbEnd: return FTESL_KBDCTRL('e'); case kbPgUp: return FTESL_KBDCTRL('p'); case kbPgDn: return FTESL_KBDCTRL('n'); case kbIns: return FTESL_KBDCTRL('q'); case kbDel: return FTESL_KBDCTRL('z'); case kbBackSp: return FTESL_KBDCTRL('h'); case kbTab: return FTESL_KBDCTRL('i'); case kbEnter: return FTESL_KBDCTRL('m'); } if (kcode>=kbF1 && kcode<=kbF12) return FTESL_KBDCTRL('f'); else return (int)kcode; } int main(int argc, char* argv[]) { FILE* fin; FILE* fout; char finname[255]; char foutname[255]; char linebuf[256]; char* lptr; char keyspecbuf[32]; char* bufptr; int err = 0; unsigned linecnt = 0; unsigned strcnt = 0; //int opt; finname[0] = '\0'; foutname[0] = '\0'; printf("Linux keymap compiler for SLang FTE, Copyright (c) 1998 by István Váradi\n\n"); if (argc<3) { fprintf(stderr, "Usage: compkeys infile outfile\n\n"); fprintf(stderr, " where:\n"); fprintf(stderr, " infile: the file with the list of the keys\n"); fprintf(stderr, " outfile: the name of the output keymap file\n"); exit(-2); } strcpy(finname, argv[1]); strcpy(foutname, argv[2]); fin = fopen(finname, "rt"); if (fin==NULL) { fprintf(stderr, "Can't open input file '%s' for reading.\n", finname); return -1; } fout = fopen(foutname, "wb"); if (fout==NULL) { fprintf(stderr, "Can't open output file '%s' for writing.\n", foutname); fclose(fin); return -1; } printf("Compiling from '%s' into '%s'.\n", finname, foutname); fprintf(fout, "############################\n"); fprintf(fout, "# Keytable to use with FTE #\n"); fprintf(fout, "# generated by 'compkeys' #\n"); fprintf(fout, "############################\n\n"); err = 0; while (!err && fgets(linebuf, sizeof(linebuf), fin)==linebuf) { linecnt++; lptr = linebuf; while (!err) { while (*lptr != '\0' && strchr(" \t", *lptr)) lptr++; if (*lptr == '#' || *lptr == '\0' || *lptr == '\n') break; bufptr=keyspecbuf; while (*lptr != '\0' && !strchr(" \t\n", *lptr)) *(bufptr++)=*(lptr++); *(bufptr++)='\0'; TKeyCode kcode = ftesl_getkeycode(keyspecbuf), kcode1; if (kcode==0) { err = 2; } else { fprintf(fout, "\n# %s\n", keyspecbuf); if (kcode&kfShift) fprintf(fout, "shift "); if (kcode&kfCtrl) fprintf(fout, "control "); if (kcode&kfAlt) fprintf(fout, "alt "); fprintf(fout, "keycode %3u = F%u\n", get_linux_keycode(kcode), 100+strcnt); fprintf(fout, "string F%u = \"\\033", 100+strcnt); if (kcode&kfShift) fprintf(fout, "\\023"); if (kcode&kfCtrl) fprintf(fout, "\\003"); if (kcode&kfAlt) fprintf(fout, "\\001"); int ccode = ftesl_get_ctrlcode(kcode); fprintf(fout, "\\%03o", ccode); if (ccode==FTESL_KBDCTRL('f')) { kcode1 = keyCode(kcode); switch(kcode1) { case kbF1: case kbF2: case kbF3: case kbF4: case kbF5: case kbF6: case kbF7: case kbF8: case kbF9: fprintf(fout, "%c", (int)'1'+int(kcode1-kbF1)); break; case kbF10: fprintf(fout, "0"); break; case kbF11: fprintf(fout, "a"); break; case kbF12: fprintf(fout, "b"); break; } } fprintf(fout, "\"\n"); strcnt++; } } } fclose(fout); fclose(fin); if (err) { fprintf(stderr, "line %u: ", linecnt); switch (err) { case 1: fprintf(stderr, "syntax error"); break; case 2: fprintf(stderr, "invalid key specification: '%s'", keyspecbuf); } fprintf(stderr, "\n"); remove(foutname); } else { printf("\nDone.\n"); } if (err) return -1; else return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_x11.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000004140�11602724002�012557� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_x11.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "o_buflist.h" #include "sysdep.h" int GetXSelection(int *len, char **data, int clipboard); int SetXSelection(int len, char *data, int clipboard); int GetPMClip(int clipboard) { char *data; int len; int i,j, l, dx; EPoint P; if (!GetXSelection(&len, &data, clipboard)) return 0; SSBuffer->Clear(); j = 0; l = 0; for (i = 0; i < len; i++) { if (data[i] == '\n') { SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (data[i-1] == '\r')) dx++; SSBuffer->InsertLine(P, i - j - dx, data + j); j = i + 1; } } if (j < len) { // remainder i = len; SSBuffer->AssertLine(l); P.Col = 0; P.Row = l++; dx = 0; if ((i > 0) && (data[i-1] == '\r')) dx++; SSBuffer->InsText(P.Row, P.Col, i - j - dx, data + j); j = i + 1; } free(data); return 1; } int PutPMClip(int clipboard) { PELine L; char *p = NULL; int rc = 0; int l = 0; for (int i = 0; i < SSBuffer->RCount; i++) { L = SSBuffer->RLine(i); char *n = (char *)realloc(p, l + L->Count + 1); if (n != NULL) { for(unsigned j = 0; j < L->Count; ++j) { if ((j < (L->Count - 1)) && (L->Chars[j + 1] == '\b')) j++; else n[l++] = L->Chars[j]; } if (i < SSBuffer->RCount - 1) n[l++] = '\n'; else n[l] = 0; } else break; p = n; // if p already contains some address it will be freed } if (p != NULL) { // remove some 'UNWANTED' characters - sequence XX 0x08 YY -> YY // this makes usable cut&paste from manpages rc = SetXSelection(l, p, clipboard); free(p); } return rc; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_buffer.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000055076�11347455323�012414� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_buffer.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef E_BUFFER_H #define E_BUFFER_H #include "c_hilit.h" // hlState #include "c_mode.h" #include "e_regex.h" #include "gui.h" #include "o_model.h" #include <sys/stat.h> class EBuffer; class EMode; #define bmLine 0 #define bmStream 1 #define bmColumn 2 #define umDelete 0 #define umInsert 1 #define umSplitLine 2 #define umJoinLine 3 #define tmNone 0 #define tmLeft 1 #define tmRight 2 typedef unsigned char TransTable[256]; #ifdef DOS /* 16 bit, sometime ;-) */ #define RWBUFSIZE 8192 #else #define RWBUFSIZE 32768 #endif extern char FileBuffer[RWBUFSIZE]; #define ChClass(x) (WGETBIT(Flags.WordChars, (x)) ? 1 : 0) #define ChClassK(x) (((x) == ' ' || (x) == 9) ? 2 : ChClass(x)) #define InRange(a,x,b) (((a) <= (x)) && ((x) < (b))) #define Min(a,b) (((a) < (b))?(a):(b)) #define Max(a,b) (((a) > (b))?(a):(b)) #define NextTab(pos,ts) (((pos) / (ts) + 1) * (ts)) // x before gap -> x // x less than count -> after gap // count - 1 before gap -> count - 1 // after gap -> allocated - 1 //#define GapLine(x,g,c,a) (((x) < (g)) ? (x) : (x) < (c) ? ((x) + (a) - (c)) : (c) - 1 < (g) ? (c) - 1 : (a) - 1 ) // Use inline to make it easier to read/debug static inline int GapLine(int No, int Gap, int Count, int Allocated) { int rc = -1; if (No < Gap) rc = No; else if (No < Count) rc = No + Allocated - Count; else if (Count - 1 < Gap) rc = Count - 1; else rc = Allocated - 1; return rc; } typedef class ELine* PELine; typedef class EPoint* PEPoint; #define CHAR_TRESHOLD 0x3U class ELine { public: size_t Count; char *Chars; #ifdef CONFIG_SYNTAX_HILIT hlState StateE; #endif ELine(size_t ACount, const char *AChars); ELine(char *AChars, size_t ACount); ~ELine(); int Allocate(size_t Bytes); // int Length(EBufferFlags *CurFlags); }; class EPoint { public: int Row; int Col; // EPoint(EPoint &M) { Row = M.Row; Col = M.Col; } EPoint(int aRow = 0, int aCol = 0) : Row(aRow), Col(aCol) {} }; struct UndoStack { int NextCmd, Record, Undo; int UndoPtr; int Num; void **Data; int *Top; }; #ifdef CONFIG_OBJ_ROUTINE class RoutineView; struct RoutineList { int Count; int *Lines; }; #endif #ifdef CONFIG_BOOKMARKS class EBookmark { StlString Name; EPoint BM; public: EBookmark(const char* n, const EPoint& p) : Name(n), BM(p) {} const char* GetName() const { return Name.c_str(); } const EPoint& GetPoint() const { return BM; } EPoint& GetPoint() { return BM; } bool IsName(const char* n) const { return Name == n; } void SetPoint(const EPoint& p) { BM = p; } }; #endif struct EFold { int line; unsigned char level; unsigned char open; unsigned short flags; }; class EEditPort: public EViewPort { public: EBuffer *Buffer; EPoint TP, OldTP; EPoint CP; int Rows, Cols; EEditPort(EBuffer *B, EView *V); virtual ~EEditPort(); virtual void HandleEvent(TEvent &Event); #ifdef CONFIG_MOUSE virtual void HandleMouse(TEvent &Event); #endif virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void Resize(int Width, int Height); int SetTop(int Col, int Row); virtual void GetPos(); virtual void StorePos(); void DrawLine(int L, TDrawBuffer B); void ScrollY(int Delta); void RedrawAll(); }; class EBuffer: public EModel { public: char *FileName; int Modified; EPoint TP; EPoint CP; EPoint BB; EPoint BE; EPoint PrevPos; EPoint SavedPos; EBufferFlags Flags; EMode *Mode; int BlockMode; int ExtendGrab; int AutoExtend; int Loaded; #ifdef CONFIG_UNDOREDO UndoStack US; #endif struct stat FileStatus; int FileOk; int Loading; int RAllocated; // text line allocation int RGap; int RCount; PELine *LL; int VAllocated; // visible lines int VGap; int VCount; int *VV; #ifdef CONFIG_FOLDS int FCount; EFold *FF; #endif EPoint Match; size_t MatchLen; int MatchCount; RxMatchRes MatchRes; #ifdef CONFIG_BOOKMARKS StlVector<EBookmark*> BMarks; #endif #ifdef CONFIG_OBJ_ROUTINE RoutineList rlst; RoutineView *Routines; #endif int MinRedraw, MaxRedraw; int RedrawToEos; #ifdef CONFIG_WORD_HILIT StlVector<StlString> WordList; size_t GetWordCount() const { return WordList.size(); } #endif #ifdef CONFIG_SYNTAX_HILIT SyntaxProc HilitProc; int StartHilit, EndHilit; #endif // constructors EBuffer(int createFlags, EModel **ARoot, const char *AName); virtual ~EBuffer(); virtual void DeleteRelated(); virtual EViewPort *CreateViewPort(EView *V); EEditPort *GetViewVPort(EView *V); EEditPort *GetVPort(); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void GetName(char *AName, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); PELine RLine(int No) { #ifdef DEBUG_EDITOR int N = GapLine(No, RGap, RCount, RAllocated); if (!((No < RCount) && (No >= 0) && (LL[N]))) { printf("Get No = %d/%d Gap=%d RAlloc = %d, VCount = %d\n", No, RCount, RGap, RAllocated, VCount); assert((No < RCount) && (No >= 0) && (LL[N])); } #endif return LL[GapLine(No, RGap, RCount, RAllocated)]; } void RLine(int No, PELine L) { #ifdef DEBUG_EDITOR if (!((No >= 0))) printf("Set No = %d\n", No); assert((No >= 0)); #endif LL[GapLine(No, RGap, RCount, RAllocated)] = L; } int Vis(int No) { #ifdef DEBUG_EDITOR if (No < 0 || No >= VCount) { printf("Vis get no %d of %d\n", No, VCount); assert (No >= 0 && No < VCount); } #endif return VV[GapLine(No, VGap, VCount, VAllocated)]; } void Vis(int No, int V) { #ifdef DEBUG_EDITOR if (No < 0 || No >= VCount) { printf("Vis set no %d of %d to %d\n", No, VCount, V); assert (No >= 0 && No < VCount); } #endif VV[GapLine(No, VGap, VCount, VAllocated)] = V; } PELine VLine(int No) { #ifdef DEBUG_EDITOR if (!((No < VCount) && (No >= 0))) { printf("VGet No = %d\n", No); assert((No < VCount) && (No >= 0)); } if (Vis(No) < 0) assert(1 == 0); #endif return RLine(No + Vis(No)); } void VLine(int No, PELine L) { #ifdef DEBUG_EDITOR if (!((No >= 0))) { printf("VSet No = %d\n", No); assert((No >= 0)); } if (VV[No] < 0) assert(1 == 0); #endif RLine(No + Vis(No), L); } int VToR(int No) { if (!VCount) return 0; #ifdef DEBUG_EDITOR if (!(No < VCount)) { printf("Get No = %d\n", No); assert((No < VCount)); } #endif return No + Vis(No); } int RToV(int No); int RToVN(int No); // allocation int Allocate(int ACount); int MoveRGap(int RPos); int AllocVis(int ACount); int MoveVGap(int VPos); int Modify(); int Clear(); #ifdef CONFIG_UNDOREDO int FreeUndo(); #endif // internal primitives int ValidPos(EPoint W); int RValidPos(EPoint W); int LoadRegion(EPoint *A, int FH, int StripChar, int LineChar); int SaveRegion(EPoint *A, EPoint *Z, int FH, int AddCR, int AddLF, int Mode); int AssertLine(int Line); int InsertLine(const EPoint& Pos, size_t ACount, const char *AChars); int UpdateMarker(int Type, int Line, int Col, int Lines, int Cols); int UpdateMark(EPoint &M, int Type, int Line, int Col, int Lines, int Cols); void UpdateVis(EPoint &M, int Row, int Delta); void UpdateVisible(int Row, int Delta); int LoadFrom(const char *AFileName); int SaveTo(const char *AFileName); int IsBlockStart(); int IsBlockEnd(); int BlockType(int Mode); int BeginExtend(); int EndExtend(); int CheckBlock(); int BlockRedraw(); int SetBB(const EPoint& M); int SetBE(const EPoint& M); int Load(); int Save(); int Reload(); int FilePrint(); int SetFileName(const char *AFileName, const char *AMode); int SetPos(int Col, int Row, int tabMode = tmNone); int SetPosR(int Col, int Row, int tabMode = tmNone); int CenterPos(int Col, int Row, int tabMode = tmNone); int CenterPosR(int Col, int Row, int tabMode = tmNone); int SetNearPos(int Col, int Row, int tabMode = tmNone); int SetNearPosR(int Col, int Row, int tabMode = tmNone); int CenterNearPos(int Col, int Row, int tabMode = tmNone); int CenterNearPosR(int Col, int Row, int tabMode = tmNone); int LineLen(int Row); int LineChars(int Row); ///////////////////////////////////////////////////////////////////////////// // Undo/Redo Routines ///////////////////////////////////////////////////////////////////////////// int NextCommand(); #ifdef CONFIG_UNDOREDO int PushUData(const void *data, size_t len); int PushULong(unsigned long l); int PushUChar(unsigned char ch); int PopUData(void *data, size_t len); int GetUData(int No, int pos, void **data, size_t len); int Undo(int undo); int Undo(); int Redo(); int BeginUndo(); int EndUndo(); int PushBlockData(); #endif ///////////////////////////////////////////////////////////////////////////// // Primitive Editing ///////////////////////////////////////////////////////////////////////////// //int ExpReg(int Row, int Ofs, int ACount, int &B, int &E); int ScreenPos(ELine *L, int Offset); int CharOffset(ELine *L, int ScreenPos); int DelLine(int Row, int DoMark = 1); int UnTabPoint(int Row, int Col); int InsLine(int Row, int DoAppend, int DoMark = 1); int DelChars(int Row, int Ofs, size_t ACount); int InsChars(int Row, int Ofs, size_t ACount, const char *Buffer); int ChgChars(int Row, int Ofs, size_t ACount, const char *Buffer); int DelText(int Row, int Col, size_t ACount, int DoMark = 1); int InsText(int Row, int Col, size_t ACount, const char *Buffer, int DoMark = 1); int InsLineText(int Row, int Col, size_t ACount, int Pos, PELine Line); int SplitLine(int Row, int Col); int JoinLine(int Row, int Col); int CanUnfold(int Row); int PadLine(int Row, size_t Length); int ShowRow(int Row); int HideRow(int Row); int ExposeRow(int Row); // make row visible (open all folds containing) ///////////////////////////////////////////////////////////////////////////// // Redraw/Windowing Routines ///////////////////////////////////////////////////////////////////////////// void Draw(int Line0, int LineE); void DrawLine(TDrawBuffer B, int L, int C, int W, int &HilitX); void Hilit(int FromRow); void Rehilit(int ToRow); void Redraw(); void FullRedraw(); int GetHilitWord(ChColor &clr, const char *str, size_t len, int IgnCase = 0); ///////////////////////////////////////////////////////////////////////////// // Utility Routines ///////////////////////////////////////////////////////////////////////////// int LineIndented(int Row, const char *indentchars = 0); int LineIndentedCharCount(ELine *l, const char *indentchars); int IndentLine(int Row, int Indent); #ifdef CONFIG_SYNTAX_HILIT int GetMap(int Row, int *StateLen, hsState **StateMap); #endif int FindStr(const char *Data, int Len, int Options); int FindStr(const char *Data, int Len, SearchReplaceOptions &opt); int FindRx(RxNode *Rx, SearchReplaceOptions &opt); int Find(SearchReplaceOptions &opt); int IsLineBlank(int Row); int TrimLine(int Row); #ifdef CONFIG_OBJ_ROUTINE int ScanForRoutines(); #endif ///////////////////////////////////////////////////////////////////////////// // Bookmark Routines ///////////////////////////////////////////////////////////////////////////// #ifdef CONFIG_BOOKMARKS int PlaceBookmark(const char *Name, const EPoint &P); int RemoveBookmark(const char *Name); int GetBookmark(const char *Name, EPoint &P); int GotoBookmark(const char *Name); int GetBookmarkForLine(int searchFrom, int searchForLine, const EBookmark* &b); #endif ///////////////////////////////////////////////////////////////////////////// // Editing Routines ///////////////////////////////////////////////////////////////////////////// int MoveLeft(); int MoveRight(); int MoveUp(); int MoveDown(); int MovePrev(); int MoveNext(); int MoveWordLeftX(int start); int MoveWordRightX(int start); int MoveWordLeft(); int MoveWordRight(); int MoveWordPrev(); int MoveWordNext(); int MoveWordEndLeft(); int MoveWordEndRight(); int MoveWordEndPrev(); int MoveWordEndNext(); int MoveWordOrCapLeft(); int MoveWordOrCapRight(); int MoveWordOrCapPrev(); int MoveWordOrCapNext(); int MoveWordOrCapEndLeft(); int MoveWordOrCapEndRight(); int MoveWordOrCapEndPrev(); int MoveWordOrCapEndNext(); // int MoveWordStart(); // int MoveWordEnd(); int MoveLineStart(); int MoveLineEnd(); int MovePageUp(); int MovePageDown(); int MovePageLeft(); int MovePageRight(); int MovePageStart(); int MovePageEnd(); int MoveFileStart(); int MoveFileEnd(); int MoveBlockStart(); int MoveBlockEnd(); int ScrollLeft(int Cols); int ScrollRight(int Cols); int ScrollDown(int Lines); int ScrollUp(int Lines); int MoveToLine(); int MoveToColumn(); int MoveFirstNonWhite(); int MoveLastNonWhite(); int MovePrevEqualIndent(); int MoveNextEqualIndent(); int MovePrevTab(); int MoveNextTab(); int MoveLineTop(); int MoveLineCenter(); int MoveLineBottom(); int MovePrevPos(); int MoveSavedPosCol(); int MoveSavedPosRow(); int MoveSavedPos(); int SavePos(); int MoveTabStart(); int MoveTabEnd(); int MoveFoldTop(); int MoveFoldPrev(); int MoveFoldNext(); int MoveBeginOrNonWhite(); int MoveBeginLinePageFile(); int MoveEndLinePageFile(); int KillLine(); int KillChar(); int KillCharPrev(); int KillWord(); int KillWordPrev(); int KillWordOrCap(); int KillWordOrCapPrev(); int KillToLineStart(); int KillToLineEnd(); int KillBlock(); int BackSpace(); int Delete(); int CompleteWord(); int KillBlockOrChar(); int KillBlockOrCharPrev(); #define ccUp 0 #define ccDown 1 #define ccToggle 2 int CharTrans(TransTable tab); int CharCaseUp(); int CharCaseDown(); int CharCaseToggle(); int LineTrans(TransTable tab); int LineCaseUp(); int LineCaseDown(); int LineCaseToggle(); int BlockTrans(TransTable tab); int BlockCaseUp(); int BlockCaseDown(); int BlockCaseToggle(); int CharTrans(ExState &State); int LineTrans(ExState &State); int BlockTrans(ExState &State); int GetTrans(ExState &State, TransTable tab); int LineInsert(); int LineAdd(); int LineSplit(); int LineJoin(); int LineNew(); int LineIndent(); int LineTrim(); int LineCenter(); int FileTrim(); int BlockTrim(); #ifdef CONFIG_UNDOREDO int CanUndo(); int CanRedo(); #endif int LineLen(); int LineCount(); int CLine(); int CColumn(); int InsertChar(char aCh); int TypeChar(char aCh); int InsertString(const char *aStr, size_t aCount); int InsertSpacesToTab(int TSize); int InsertTab(); int InsertSpace(); int SelfInsert(); #ifdef CONFIG_WORDWRAP int DoWrap(int WrapAll); int WrapPara(); #endif int InsPrevLineChar(); int InsPrevLineToEol(); int LineDuplicate(); int GetMatchBrace(EPoint &M, int MinLine, int MaxLine, int show); int MatchBracket(); int HilitMatchBracket(); int BlockBegin(); int BlockEnd(); int BlockUnmark(); int BlockCut(int Append); int BlockCopy(int Append, int clipboard=0); int BlockPaste(int clipboard=0); int BlockKill(); int BlockIndent(); int BlockUnindent(); int BlockClear(); int BlockMarkStream(); int BlockMarkLine(); int BlockMarkColumn(); int BlockReadFrom(const char *aFileName, int blockMode); int BlockWriteTo(const char *aFileName, int Append = 0); int BlockExtendBegin(); int BlockExtendEnd(); int BlockReIndent(); int BlockIsMarked(); int BlockPasteStream(int clipboard=0); int BlockPasteLine(int clipboard=0); int BlockPasteColumn(int clipboard=0); int BlockPasteOver(int clipboard=0); int BlockSelectWord(); int BlockSelectLine(); int BlockSelectPara(); int BlockPrint(); int BlockSort(int Reverse); int ClipClear(int clipboard=0); int BlockUnTab(); int BlockEnTab(); int ToggleAutoIndent(); int ToggleInsert(); int ToggleExpandTabs(); int ToggleShowTabs(); int ToggleUndo(); int ToggleReadOnly(); int ToggleKeepBackups(); int ToggleMatchCase(); int ToggleBackSpKillTab(); int ToggleDeleteKillTab(); int ToggleSpaceTabs(); int ToggleIndentWithTabs(); int ToggleBackSpUnindents(); int ToggleWordWrap(); int ToggleTrim(); int ToggleShowMarkers(); int ToggleHilitTags(); int ToggleShowBookmarks(); int ToggleMakeBackups(); int SetLeftMargin(); int SetRightMargin(); int ShowPosition(); int Search(ExState &State, const char *aString, int Options, int CanResume = 0); int SearchAgain(ExState &State, unsigned int Options); int SearchReplace(ExState &State, const char *aString, const char *aReplaceString, int Options); int Search(ExState &State); int SearchB(ExState &State); int SearchRx(ExState &State); int SearchAgain(ExState &State); int SearchAgainB(ExState &State); int SearchReplace(ExState &State); int SearchReplaceB(ExState &State); int SearchReplaceRx(ExState &State); #ifdef CONFIG_WORD_HILIT int HilitAddWord(const char *Word); int HilitFindWord(const char *Word); int HilitRemoveWord(const char *Word); int HilitWord(); #endif int SearchWord(int Flags); #ifdef CONFIG_FOLDS int FindFold(int Line); int FindNearFold(int Line); int FoldCreate(int Line); int FoldCreateByRegexp(const char *Regexp); int FoldDestroy(int Line); int FoldDestroyAll(); int FoldPromote(int Line); int FoldDemote(int Line); int FoldOpen(int Line); int FoldOpenAll(); int FoldOpenNested(); int FoldClose(int Line); int FoldCloseAll(); int FoldToggleOpenClose(); #endif int ChangeMode(const char *Mode); int ChangeKeys(const char *Mode); int ChangeFlags(const char *Mode); int ScrollLeft(ExState &State); int ScrollRight(ExState &State); int ScrollDown(ExState &State); int ScrollUp(ExState &State); /* editor functions with user interface */ int MoveToColumn(ExState &State); int MoveToLine(ExState &State); int FoldCreateByRegexp(ExState &State); #ifdef CONFIG_BOOKMARKS int PlaceUserBookmark(const char *n,EPoint P); int RemoveUserBookmark(const char *n); int GotoUserBookmark(const char *n); int GetUserBookmarkForLine(int searchFrom, int searchForLine, const EBookmark* &b); int PlaceBookmark(ExState &State); int RemoveBookmark(ExState &State); int GotoBookmark(ExState &State); #endif int InsertString(ExState &State); int SelfInsert(ExState &State); int FileReload(ExState &State); int FileSaveAs(const char *FileName); int FileSaveAs(ExState &State); int FileWriteTo(const char *FileName); int FileWriteTo(ExState &State); int BlockReadX(ExState &State, int BlockMode); int BlockRead(ExState &State); int BlockReadStream(ExState &State); int BlockReadLine(ExState &State); int BlockReadColumn(ExState &State); int BlockWrite(ExState &State); int Find(ExState &State); int FindReplace(ExState &State); int FindRepeat(ExState &State); int FindRepeatOnce(ExState &State); int FindRepeatReverse(ExState &State); int InsertChar(ExState &State); int TypeChar(ExState &State); int ChangeMode(ExState &State); int ChangeKeys(ExState &State); int ChangeFlags(ExState &State); int ChangeTabSize(ExState &State); int ChangeRightMargin(ExState &State); int ChangeLeftMargin(ExState &State); #ifdef CONFIG_I_ASCII int ASCIITable(ExState &State); #endif #ifdef CONFIG_TAGS int FindTag(ExState &State); int FindTagWord(ExState &State); #endif int SetCIndentStyle(ExState &State); int FindFunction(int delta, int way); int BlockMarkFunction(); int IndentFunction(); int MoveFunctionPrev(); int MoveFunctionNext(); int InsertDate(ExState& state); int InsertUid(); int ShowHelpWord(ExState &State); int PlaceGlobalBookmark(ExState &State); int PushGlobalBookmark(); virtual int GetStrVar(int var, char *str, size_t buflen); virtual int GetIntVar(int var, int *value); int SetIndentWithTabs(ExState &State); int FoldCreateAtRoutines(); }; extern EBuffer *SSBuffer; extern SearchReplaceOptions LSearch; extern int suspendLoads; int DoneEditor(); EBuffer *FindFile(const char *FileName); int ParseSearchOption(int replace, char c, unsigned long &opt); int ParseSearchOptions(int replace, const char *str, unsigned long &Options); int ParseSearchReplace(EBuffer *B, const char *str, int replace, SearchReplaceOptions &opt); #endif // E_BUFFER_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/ftewin32.rc�����������������������������������������������������������������������������������0000644�0001750�0001750�00000000065�07374135317�012444� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <windows.h> FTE ICON "icons\\ftewin32.ico" ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_gpm.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000000517�11602724002�012735� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_gpm.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" int GetPMClip(int clipboard) { return 1; } int PutPMClip(int clipboard) { return 1; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_complete.cpp��������������������������������������������������������������������������������0000644�0001750�0001750�00000022475�11602724002�013272� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_complete.cpp * * Copyright (c) 1998, Zdenek Kabelac * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_complete.h" #ifdef CONFIG_I_COMPLETE #include "e_tags.h" #include <stdio.h> #include <stdlib.h> #define STRCOMPLETE "Complete Word: [" #define STRNOCOMPLETE "No word for completition..." #define LOCALE_SORT #ifdef LOCALE_SORT #if defined(__IBMCPP__) static int _LNK_CONV CmpStr(const void *p1, const void *p2) { #else static int CmpStr(const void *p1, const void *p2) { #endif //printf("%s %s %d\n", *(char **)p1, *(char **)p2, // strcoll(*(char **)p1, *(char **)p2)); return strcoll(*(const char **)p1, *(const char **)p2); } #endif /** * Create Sorted list of possible word extensions */ ExComplete::ExComplete(EBuffer *B) : Orig(B->CP), Buffer(B), WordsLast(0), Words(new char *[MAXCOMPLETEWORDS + 2]), WordBegin(0), WordPos(0), WordFixed(0) { RefreshComplete(); } ExComplete::~ExComplete() { // fprintf(stderr, "W %p %p %p %d\n", Words, WordContinue, WordBegin, WordsLast); delete[] WordBegin; if (Words != NULL) { for(int i = 0; i < WordsLast; i++) delete[] Words[i]; delete[] Words; } } bool ExComplete::IsSimpleCase() { return (WordsLast < 2) ? true : false; } int ExComplete::DoCompleteWord() { int rc = 0; if (WordsLast <= 0 || !Words[WordPos]) return rc; size_t l = strlen(Words[WordPos]); if (Buffer->InsText(Buffer->VToR(Orig.Row), Orig.Col, l, Words[WordPos], 1) && Buffer->SetPos(Orig.Col + l, Orig.Row)) { Buffer->Draw(Buffer->VToR(Orig.Row), Buffer->VToR(Orig.Row)); rc = 1; } return rc; } void ExComplete::HandleEvent(TEvent &Event) { unsigned long kb = kbCode(Event.Key.Code); int DoQuit = 0; int i = 0; if (WordsLast < 2) { if ((WordsLast == 1) && (kb != kbEsc)) { DoQuit = 1; } else { EndExec(0); Event.What = evNone; } } else if (Event.What == evKeyDown) { switch(kb) { case kbPgUp: case kbLeft: // if there would not be locale sort, we could check only // the next string, but with `locale sort` this is impossible!! // this loop is little inefficient but it's quite short & nice for (i = WordPos; i-- > 0;) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) { WordPos = i; break; } Event.What = evNone; break; case kbPgDn: case kbRight: for(i = WordPos; i++ < WordsLast - 1;) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) { WordPos = i; break; } Event.What = evNone; break; case kbHome: for (i = 0; i < WordPos; i++) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordPos = i; Event.What = evNone; break; case kbEnd: for (i = WordsLast - 1; i > WordPos; i--) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordPos = i; Event.What = evNone; break; case kbTab: while (WordPos < WordsLast - 1) { WordPos++; if (strncmp(Words[WordPos], Words[WordPos - 1], WordFixed + 1)) break; } Event.What = evNone; break; case kbTab | kfShift: while (WordPos > 0) { WordPos--; if (strncmp(Words[WordPos], Words[WordPos + 1], WordFixed + 1)) break; } Event.What = evNone; break; case kbIns: case kbUp: FixedUpdate(1); Event.What = evNone; break; case kbBackSp: case kbDel: case kbDown: FixedUpdate(-1); Event.What = evNone; break; case kbEsc: EndExec(0); Event.What = evNone; break; case kbEnter: case kbSpace: case kbTab | kfCtrl: DoQuit = 1; break; default: if (CheckASCII((char)Event.Key.Code)) { char *s = (char *)alloca(WordFixed + 2); strncpy(s, Words[WordPos], WordFixed); s[WordFixed] = (char)(Event.Key.Code); s[WordFixed + 1] = 0; for (int i = 0; i < WordsLast; i++) if (strncmp(s, Words[i], WordFixed + 1) == 0) { WordPos = i; if (WordFixedCount == 1) DoQuit = 1; else FixedUpdate(1); break; } Event.What = evNone; } break; } } if (DoQuit) { /* int rc = 0; int l = strlen(Words[WordPos]); if (Buffer->InsText(Buffer->VToR(Orig.Row), Orig.Col, l, Words[WordPos], 1) && Buffer->SetPos(Orig.Col + l, Orig.Row)) { Buffer->Draw(Buffer->VToR(Orig.Row), Buffer->VToR(Orig.Row)); rc = 1; }*/ int rc = DoCompleteWord(); EndExec(rc); Event.What = evNone; } } void ExComplete::RepaintStatus() { TDrawBuffer B; int W, H; // Currently use this fixed colors - maybe there are some better defines?? #define COM_NORM 0x17 #define COM_ORIG 0x1C #define COM_HIGH 0x1E #define COM_MARK 0x2E #define COM_ERR 0x1C ConQuerySize(&W, &H); MoveCh(B, ' ', COM_NORM, W); if ((WordsLast > 0) && (WordBegin != NULL) && (Words != NULL) && (Words[WordPos]) != NULL) { const char *sc = STRCOMPLETE; size_t p = sizeof(STRCOMPLETE) - 1; if (W < 35) { // if the width is quite small sc += p - 1; // jump to last character p = 1; } MoveStr(B, 0, W, sc, COM_NORM, W); // int cur = p; MoveStr(B, (int)p, W, WordBegin, COM_ORIG, W); p += strlen(WordBegin); size_t l = strlen(Words[WordPos]); if (WordFixed > 0) { MoveStr(B, (int)p, W, Words[WordPos], COM_MARK, W); p += WordFixed; l -= WordFixed; } MoveStr(B, (int)p, W, Words[WordPos] + WordFixed, (WordFixedCount == 1) ? COM_ORIG : COM_HIGH, W); p += l; char s[100]; sprintf(s, "] (T:%d/%d S:%d)", WordPos + 1, WordsLast, (int)WordFixedCount); MoveStr(B, (int)p, W, s, COM_NORM, W); // ConSetCursorPos(cur + WordFixed, H - 1); } else MoveStr(B, 0, W, STRNOCOMPLETE, COM_ERR, W); ConPutBox(0, H - 1, W, 1, B); ConShowCursor(); } int ExComplete::RefreshComplete() { if ((Buffer->CP.Col == 0) || (Buffer->SetPos(Buffer->CP.Col, Buffer->CP.Row) == 0)) return 0; PELine L = Buffer->VLine(Buffer->CP.Row); int C = Buffer->CP.Col; int P = Buffer->CharOffset(L, C); if (!P || P > L->Count) return 0; int P1 = P; while ((P > 0) && CheckASCII(L->Chars[P - 1])) P--; int wlen = P1 - P; if (!wlen) return 0; WordBegin = new char[wlen + 1]; if (WordBegin == NULL) return 0; strncpy(WordBegin, L->Chars + P, wlen); WordBegin[wlen] = 0; // fprintf(stderr, "Calling %d %s\n", wlen, WordBegin); // Search words in TAGS TagComplete(Words, &WordsLast, MAXCOMPLETEWORDS, WordBegin); // fprintf(stderr, "Located %d words\n", WordsLast); // these words are already sorted // Search words in current TEXT Buffer->Match.Col = Buffer->Match.Row = 0; // this might look strange but it is necessary to catch // the first word at position 0,0 for match :-) unsigned long mask = SEARCH_NOPOS | SEARCH_WORDBEG; while (Buffer->FindStr(L->Chars + P, wlen, mask) == 1) { mask |= SEARCH_NEXT; PELine M = Buffer->RLine(Buffer->Match.Row); int X = Buffer->CharOffset(M, Buffer->Match.Col); if ((L->Chars == M->Chars) && (P == X)) continue; int XL = X; while ((XL < M->Count) && CheckASCII(M->Chars[XL])) XL++; int len = XL - X - wlen; if (len == 0) continue; char *s = new char[len + 1]; if (s != NULL) { strncpy(s, M->Chars + X + wlen, len); s[len] = 0; int c = 1, H = 0, L = 0, R = WordsLast; // using sort to insert only unique words while (L < R) { H = (L + R) / 2; c = strcmp(s, Words[H]); if (c < 0) R = H; else if (c > 0) L = H + 1; else break; } if (c != 0) { // Loop exited without finding the word. Instead, // it found the spot where the new should be inserted. WordsLast++; int i = WordsLast; while (i > L) { Words[i] = Words[i-1]; i--; } Words[i] = s; if (WordsLast >= MAXCOMPLETEWORDS) break; } else { // word was already listed, free duplicate. delete[] s; } } } Buffer->Match.Row = Buffer->Match.Col = -1; Buffer->MatchLen = Buffer->MatchCount = 0; #ifdef LOCALE_SORT // sort by current locales qsort(Words, WordsLast, sizeof(Words[0]), CmpStr); #endif FixedUpdate(0); //for(int i = 0; i < WordsLast; i++) //if (Words[i]) //fprintf(stderr, "%3d:\t%10p\t%s\n", i, Words[i], Words[i]); //fprintf(stderr, "Words %3d\n", WordsLast); return WordsLast; } void ExComplete::FixedUpdate(int add) { if (add < 0) { if (WordFixed > 0) WordFixed += add; } else if (add > 0) { if (strlen(Words[WordPos]) > WordFixed) WordFixed += add; } if (WordFixed > 0) { WordFixedCount = 0; for(int i = 0; i < WordsLast; i++) if (strncmp(Words[WordPos], Words[i], WordFixed) == 0) WordFixedCount++; } else WordFixedCount = WordsLast; } /* // Well this was my first idea - but these menus are unusable int menu = NewMenu("CW"); int n; n = NewItem(menu, "Word1"); Menus[menu].Items[n].Cmd = ExFind; n = NewItem(menu, "Word2"); Menus[menu].Items[n].Cmd = ExMoveLineStart; n = NewItem(menu, "Word3"); Menus[menu].Items[n].Cmd = ExMovePageEnd; printf(">%d ****\n", View->MView->Win->Parent->PopupMenu("CW")); */ #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_cvsbase.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000005261�11331412505�012556� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvsbase.h * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Base class for all other CVS-related classes. This is similar to EMessages * - starts CVS and shows its messages in list view. */ #ifndef O_CVSBASE_H #define O_CVSBASE_H #include "fte.h" #ifdef CONFIG_OBJ_CVS #include "o_list.h" class EBuffer; struct CvsLine { char *File; // Relative to view's directory int Line; char *Msg; EBuffer *Buf; char Status; // bit 0 - hilited // bit 1 - marked // bit 2 - markable }; class ECvsBase:public EList { public: char *Command; char *Directory; char *OnFiles; char *OnFilesPos; int LineCount; CvsLine **Lines; int Running; size_t BufLen; int BufPos; int PipeId; int ReturnCode; char MsgBuf[4096]; ECvsBase (int createFlags,EModel **ARoot,const char *ATitle); ~ECvsBase (); void FreeLines (); void AddLine (const char *file, int line, const char *msg, int hilit = 0); void FindBuffer (int line); void AssignBuffer (EBuffer *B,int line); void FindFileLines (EBuffer *B); virtual void NotifyDelete (EModel *Deleting); int GetLine (char *Line, size_t max); virtual void ParseLine (const char *line, size_t len); void NotifyPipe (int APipeId); // Returns 0 if OK - calls ContinuePipe() several times to complete command for all files virtual int RunPipe(const char *Dir, const char *Command, const char *OnFiles); // Returns 0 if OK - continue with next files in queue virtual int ContinuePipe (); // Reads ReturnCode, sets Running to 0, PipeId to -1 virtual void ClosePipe (); void DrawLine (PCell B,int Line,int Col,ChColor color,int Width); char *FormatLine (int Line); void UpdateList (); int Activate (int No); int CanActivate (int Line); virtual int IsHilited (int Line); virtual int IsMarked (int Line); virtual int Mark (int Line); virtual int Unmark (int Line); virtual int ExecCommand(ExCommands Command, ExState &State); void ShowLine (EView *V,int err); virtual int GetContext () {return CONTEXT_CVSBASE;} virtual EEventMap *GetEventMap (); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; int AddCvsIgnoreRegexp (const char *); void FreeCvsIgnoreRegexp (); #endif // CONFIG_OBJ_CVS #endif // O_CVSBASE_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_ncurses.cpp�������������������������������������������������������������������������������0000644�0001750�0001750�00000050741�11602724002�013470� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_ncurses.cpp * * Ncurses front-end to fte - Don Mahurin * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_config.h" #include "con_tty.h" #include "gui.h" #include "o_model.h" // Msg #include "s_string.h" #include "s_util.h" // S_ERROR #include "sysdep.h" #include <ncurses.h> #include <signal.h> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/wait.h> #include <termios.h> /* Escape sequence delay in milliseconds */ #define escDelay 10 extern TEvent NextEvent; // g_text.cpp /* translate fte colors to curses*/ static const short fte_curses_colors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, }; static PCell *SavedScreen = 0; static int MaxSavedW = 0, MaxSavedH = 0; static int ScreenSizeChanged; static void curses_winch_handler(int signum) { ScreenSizeChanged = 1; signal(SIGWINCH, curses_winch_handler); } /* Routine to allocate/reallocate and zero space for screen buffer, represented as a dynamic array of dynamic PCell lines */ static void SaveScreen() { int NewSavedW, NewSavedH; ConQuerySize(&NewSavedW, &NewSavedH); //fprintf(stderr, "SAVESCREEN %d %d\n", NewSavedW, NewSavedH); if (SavedScreen && NewSavedW > MaxSavedW) { /* Expand and zero maximum width if needed */ for (int i = 0 ; i < MaxSavedH; ++i) { SavedScreen[i] = (PCell)realloc(SavedScreen[i], NewSavedW * sizeof(TCell)); memset(SavedScreen[i] + MaxSavedW, 0, (NewSavedW - MaxSavedW) * sizeof(TCell)); } } MaxSavedW = NewSavedW; if (NewSavedH > MaxSavedH) { /* Expand and zero maximum height if needed */ SavedScreen = (PCell *)realloc(SavedScreen, NewSavedH * sizeof(PCell)); for (int i = MaxSavedH; i < NewSavedH; ++i) { SavedScreen[i] = (PCell)malloc(MaxSavedW * sizeof(TCell)); memset(SavedScreen[i], 0, MaxSavedW * sizeof(TCell)); } MaxSavedH = NewSavedH; } } static void ReleaseScreen() { if (!SavedScreen) return; for (int i = 0; i < MaxSavedH; i++) if (SavedScreen[i]) free(SavedScreen[i]); free(SavedScreen); SavedScreen = NULL; MaxSavedH = MaxSavedW = 0; } static int fte_curses_attr[256]; static int key_sup = 0; static int key_sdown = 0; static int InitColors() { int c = 0; int colors = has_colors(); if (colors) start_color(); for (int bgb = 0 ; bgb < 2; bgb++) { /* bg bright bit */ for (int bg = 0 ; bg < 8; bg++) { for (int fgb = 0; fgb < 2; fgb++) { /* fg bright bit */ for (int fg = 0 ; fg < 8; fg++, c++) { if (colors) { short pair = short(bg * 8 + fg); if (c) init_pair(pair, fte_curses_colors[fg], fte_curses_colors[bg]); fte_curses_attr[c] = unsigned(fgb ? A_BOLD : 0) | COLOR_PAIR(pair); } else { if (fgb || bgb) fte_curses_attr[c] = (bg > fg) ? (A_UNDERLINE | A_REVERSE) : A_BOLD; else if (bg > fg) fte_curses_attr[c] = A_REVERSE; else fte_curses_attr[c] = 0; } } } } } return colors; } int ConInit(int /*XSize */ , int /*YSize */ ) { int ch; const char *s; ESCDELAY = escDelay; initscr(); InitColors(); #ifdef CONFIG_MOUSE mouseinterval(200); #if 1 mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); #else mousemask(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED #if NCURSES_MOUSE_VERSION > 1 | BUTTON5_CLICKED #endif , 0); #endif #endif /* cbreak (); */ raw(); noecho(); nonl(); keypad(stdscr,1); meta(stdscr,1); SaveScreen(); signal(SIGWINCH, curses_winch_handler); /* find shift up/down */ for (ch = KEY_MAX +1; ; ch++) { if (!(s = keyname(ch))) break; if (!strcmp(s, "kUP")) key_sup = ch; else if (!strcmp(s, "kDN")) key_sdown = ch; if (key_sup > 0 && key_sdown > 0) break; } return 1; } int ConDone() { keypad(stdscr,0); endwin(); ReleaseScreen(); return 1; } int ConSuspend() { return 1; } int ConContinue() { return 1; } int ConSetTitle(const char * /*Title */, const char * /*STitle */) { return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, "", MaxLen); strlcpy(STitle, "", SMaxLen); return 1; } int ConClear() /* not used? */ { clear(); refresh(); return 1; } static chtype GetDch(int idx) { switch(idx) { case DCH_C1: return ACS_ULCORNER; case DCH_C2: return ACS_URCORNER; case DCH_C3: return ACS_LLCORNER; case DCH_C4: return ACS_LRCORNER; case DCH_H: return ACS_HLINE; case DCH_V: return ACS_VLINE; case DCH_M1: return ACS_TTEE; case DCH_M2: return ACS_LTEE; case DCH_M3: return ACS_RTEE; case DCH_M4 : return ACS_BTEE; case DCH_X: return ACS_PLUS; case DCH_RPTR: return ACS_RARROW; case DCH_EOL: return ACS_BULLET; case DCH_EOF: return ACS_DIAMOND; case DCH_END: return ACS_HLINE; case DCH_AUP: return ACS_UARROW; case DCH_ADOWN: return ACS_DARROW; case DCH_HFORE: return ' ';// return ACS_BLOCK; case DCH_HBACK: return ACS_CKBOARD; case DCH_ALEFT: return ACS_LARROW; case DCH_ARIGHT: return ACS_RARROW; default: return '@'; } } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int last_attr = ~0; int CurX, CurY; ConQueryCursorPos(&CurX, &CurY); //static int x = 0; //fprintf(stderr, "%5d: refresh done %d %d %d x %d L:%d C:%d\n", x++, X, Y, W, H, LINES, COLS); if (Y + H > LINES) H = LINES - Y; for (int j = 0; j < H; j++) { memcpy(SavedScreen[Y + j] + X, Cell, W * sizeof(TCell)); // copy outputed line to saved screen move(Y + j, X); for (int i = 0; i < W; ++i) { unsigned char ch = Cell->GetChar(); int attr = fte_curses_attr[Cell->GetAttr()]; if (attr != last_attr) { wattrset(stdscr, attr); last_attr = attr; } if (ch < 32) waddch(stdscr, (ch <= 20) ? GetDch(ch) : '.'); else if (ch < 128 || ch >= 160) waddch(stdscr, ch); /* else if(ch < 180) { waddch(stdscr,GetDch(ch-128)); } */ else waddch(stdscr, '.'); Cell++; } } return ConSetCursorPos(CurX, CurY); } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { for (int j = 0 ; j < H; Cell += W, ++j) memcpy(Cell, SavedScreen[Y+j]+X, W*sizeof(TCell)); return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { for (int j = 0 ; j < H; ++j) ConPutBox(X, Y+j, W, 1, Cell); return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TCell line[W]; for (int i = 0; i < W; ++i) line[i] = Cell; ConPutLine(X, Y, W, H, line); return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell box[W * H]; ConGetBox(X, Y, W, H, box); //TCell fill(' ', Fill); if (Way == csUp) { ConPutBox(X, Y, W, H - Count, box + W * Count); //ConSetBox(X, Y + H - Count, W, Count, fill); } else { ConPutBox(X, Y + Count, W, H - Count, box); //ConSetBox(X, Y, W, Count, fill); } return 1; } int ConSetSize(int /*X */ , int /*Y */ ) { return -1; } int ConQuerySize(int *X, int *Y) { *X = COLS; *Y = LINES; return 1; } int ConSetCursorPos(int X, int Y) { move(Y,X); refresh(); return 1; } int ConQueryCursorPos(int *X, int *Y) { getyx(stdscr, *Y, *X); return 1; } static int CurVis = 1; int ConShowCursor() { CurVis = 1; curs_set(1); refresh(); return 1; } int ConHideCursor() { CurVis = 0; curs_set(0); refresh(); return 1; } int ConCursorVisible() { return CurVis; } int ConSetCursorSize(int /*Start */ , int /*End */ ) { return 0; } #ifdef CONFIG_MOUSE int ConSetMousePos(int /*X */ , int /*Y */ ) { return 0; } int ConQueryMousePos(int *X, int *Y) { *X = 0; *Y = 0; return 1; } int ConShowMouse() { return 0; } int ConHideMouse() { return 0; } int ConMouseVisible() { return 1; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 0; return 1; } static int ConGetMouseEvent(TEvent *Event) { MEVENT mevent; mmask_t& bstate = mevent.bstate; if (getmouse(&mevent) == ERR) { Event->What = evNone; return 0; } #if 0 fprintf(stderr, "EVENT %x %x %x %d %d\n", (int)bstate, (int)BUTTON_CTRL, (int)BUTTON_CTRL, (int)mevent.x, (int)mevent.y); for (int i = 1; i <= 5; ++i) fprintf(stderr, "EVENTXXX %d R:%lx P:%lx C:%lx D:%lx T:%lx E:%lx\n", i, BUTTON_RELEASE(bstate, i), BUTTON_PRESS(bstate, i), BUTTON_CLICK(bstate, i), BUTTON_DOUBLE_CLICK(bstate, i), BUTTON_TRIPLE_CLICK(bstate, i), BUTTON_RESERVED_EVENT(bstate, i)); #endif Event->What = evNone; Event->Mouse.X = mevent.x; Event->Mouse.Y = mevent.y; Event->Mouse.Count = 0; int i; for (i = 1; i < 3; ++i) { if (BUTTON_CLICK(bstate, i)) { Event->Mouse.Count = 1; break; } else if (BUTTON_DOUBLE_CLICK(bstate, i)) { Event->Mouse.Count = 2; break; } else if (BUTTON_TRIPLE_CLICK(bstate, i)) { Event->Mouse.Count = 3; break; } } //fprintf(stderr, "BUTTONS b:%d c:%d\n", i, (int)Event->Mouse.Count); if (Event->Mouse.Count) { switch (i) { case 1: Event->Mouse.Buttons = 1; break; case 2: Event->Mouse.Buttons = 2; break; case 3: Event->Mouse.Buttons = 4; break; } Event->Mouse.What = evMouseDown; NextEvent = *Event; NextEvent.Mouse.What = evMouseUp; } else if (BUTTON_DOUBLE_CLICK(bstate, 5) || BUTTON_PRESS(bstate, 4)) { Event->What = evCommand; Event->Msg.Param1 = 10; /* HACK - with control move in opposite direction * as the 'upward' scroll is really slow with plain Button4 */ Event->Msg.Command = (bstate & (BUTTON_CTRL | BUTTON4_PRESSED)) ? cmVScrollUp : cmVScrollDown; } return 1; } #endif // CONFIG_MOUSE static TEvent Prev = { evNone }; #if 1 static int ConGetEscEvent() { int key; if ((key = getch()) == ERR) return kbEsc; if (key >= 'a' && key <= 'z' ) /* Alt-A == Alt-a*/ return (kfAlt | (key + 'A' - 'a')); char seq[8] = { (char)key }; unsigned seqpos = 1; while (seqpos < 7 && (key = getch()) != ERR) seq[seqpos++] = (char)key; seq[seqpos] = 0; if (!(key = TTYParseEsc(seq))) ;//Msg(S_ERROR, "Sequence '%s' not found.", seq); return key; } #else /* * Routine would have to be far more complex * to handle majority of esq sequences * * Using string table and TTYEscParse */ static int ConGetEscEvent() { int ch; int code = 0; if ((ch = getch()) == 27) { ch = getch(); if (ch == '[' || ch == 'O') code |= kfAlt; } if (ch == ERR) return kbEsc; if (ch == '[' || ch == 'O') { int ch1 = getch(); int ch2 = 0; if (ch1 >= '1' && ch1 <= '8') { if ((ch2 = getch()) == ';') { if ((ch1 = getch()) == ERR || ch1 < '1' || ch1 > '8') return kbEsc; ch2 = 0; } } if (ch1 == ERR) /* translate to Alt-[ or Alt-O */ return (kfAlt | ch); if (ch2 == '~' || ch2 == '$') { if (ch2 == '$') code |= kfShift; switch (ch1 - '0') { case 1: code |= kbHome; break; case 2: code |= kbIns; break; case 3: code |= kbDel; break; case 4: code |= kbEnd; break; case 5: code |= kbPgUp; break; case 6: code |= kbPgDn; break; case 7: code |= kbHome; break; case 8: code |= kbEnd; break; default: code = 0; break; } } else { if (ch2) { int ctAlSh = ch2 - '1'; if (ctAlSh & 0x4) code |= kfCtrl; if (ctAlSh & 0x2) code |= kfAlt; if (ctAlSh & 0x1) code |= kfShift; } switch(ch1) { case 'A': code |= kbUp; break; case 'B': code |= kbDown; break; case 'C': code |= kbRight; break; case 'D': code |= kbLeft; break; case 'F': code |= kbEnd; break; case 'H': code |= kbHome; break; case 'a': code |= (kfShift | kbUp); break; case 'b': code |= (kfShift | kbDown); break; case 'c': code |= (kfShift | kbRight); break; case 'd': code |= (kfShift | kbLeft); break; default: code = 0; break; } } } else { code |= kfAlt; if(ch == '\r' || ch == '\n') code |= kbEnter; else if(ch == '\t') code |= kbTab; else if(ch < 32) code |= (kfCtrl | (ch+ 0100)); else { if(ch > 0x60 && ch < 0x7b ) /* Alt-A == Alt-a*/ ch -= 0x20; code |= ch; } } return code; } #endif static int ResizeWindow() { struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; /* unused */ unsigned short ws_ypixel; } ws = { 0 }; ScreenSizeChanged = 0; if (ioctl(1, TIOCGWINSZ, &ws) == -1 || !ws.ws_row || !ws.ws_col) return 0; if (is_term_resized(ws.ws_row, ws.ws_col)) { LINES = ws.ws_row; COLS = ws.ws_col; resize_term(LINES, COLS); SaveScreen(); ConClear(); //fprintf(stderr, "SIGNAL RESIZE %d %d\n", COLS, LINES); } return 1; } // *INDENT-OFF* int ConGetEvent(TEventMask /*EventMask */, TEvent* Event, int WaitTime, int Delete) { TKeyEvent* KEvent = &(Event->Key); if (ScreenSizeChanged && (ResizeWindow() > 0)) { Event->What = evCommand; Event->Msg.Command = cmResize; return 1; } if (WaitTime == 0) return 0; if (Prev.What != evNone) { *Event = Prev; if (Delete) Prev.What = evNone; return 1; } if (WaitFdPipeEvent(Event, STDIN_FILENO, -1, -1) == FD_PIPE_ERROR) return 0; if (Event->What == evNotify) return 0; // pipe reading int ch = wgetch(stdscr); Event->What = evKeyDown; KEvent->Code = 0; //fprintf(stderr, "READKEY %d %s\n", ch, keyname(ch)); if (SevenBit && (ch > 127) && (ch < 256)) { KEvent->Code |= kfAlt; ch -= 128; if ((ch > 0x60) && (ch < 0x7b)) /* Alt-A == Alt-a*/ ch -= 0x20; } if (ch < 0) Event->What = evNone; else if (ch == 27) { //fprintf(stderr, "ESCAPEEVENT %x\n", (int)ch); keypad(stdscr, 0); timeout(escDelay); if (!(KEvent->Code = ConGetEscEvent())) Event->What = evNone; timeout(-1); keypad(stdscr, 1); } else if ((ch == '\n') || (ch == '\r')) KEvent->Code |= kbEnter; else if (ch == '\t') KEvent->Code |= kbTab; else if ((ch >= 'A') && (ch <= 'Z')) KEvent->Code |= kfShift | ch; else if (ch < 32) KEvent->Code |= (kfCtrl | (ch + 'A' - 1)); // +0100 else if (ch < 256) KEvent->Code |= ch; else // > 255 switch (ch) { #ifdef CONFIG_MOUSE case KEY_MOUSE: Event->What = evNone; ConGetMouseEvent(Event); break; #endif case KEY_RESIZE: break; // already handled case KEY_UP: KEvent->Code = kbUp; break; case KEY_SR: KEvent->Code = kfShift | kbUp; break; case 559: KEvent->Code = kfAlt | kbUp; break; // kUP3 case 561: KEvent->Code = kfCtrl | kbUp; break; // kUP5 case KEY_DOWN: KEvent->Code = kbDown; break; case KEY_SF: KEvent->Code = kfShift | kbDown; break; case 518: KEvent->Code = kfAlt | kbDown; break; // kDN3 case 520: KEvent->Code = kfCtrl | kbDown; break; // kDN5 case KEY_RIGHT: KEvent->Code = kbRight; break; case KEY_SRIGHT: KEvent->Code = kfShift | kbRight; break; case 553: KEvent->Code = kfAlt | kbRight; break; // kRIT3 case 555: KEvent->Code = kfCtrl | kbRight; break; // kRIT5 case 556: KEvent->Code = kfCtrl | kfShift | kbRight; break; // kRIT6 case KEY_LEFT: KEvent->Code = kbLeft; break; case KEY_SLEFT: KEvent->Code = kfShift | kbLeft; break; case 538: KEvent->Code = kfAlt | kbLeft; break; // kLFT3 case 540: KEvent->Code = kfCtrl | kbLeft; break; // kLFT5 case 541: KEvent->Code = kfCtrl | kfShift | kbLeft; break; // kLFT6 case KEY_DC: KEvent->Code = kbDel; break; case KEY_SDC: KEvent->Code = kfShift | kbDel; break; case KEY_IC: KEvent->Code = kbIns; break; case KEY_SIC: KEvent->Code = kfShift | kbIns; break; case KEY_BACKSPACE: KEvent->Code = kbBackSp; break; case KEY_HOME: KEvent->Code = kbHome; break; case KEY_SHOME: KEvent->Code = kfShift | kbHome; break; case 528: KEvent->Code = kfCtrl | kbHome; break; // kHOM3 case 530: KEvent->Code = kfAlt | kbHome; break; // kHOM5 case 532: KEvent->Code = kfAlt | kfCtrl | kbHome; break; // kHOM7 case KEY_LL: // used in old termcap/infos case KEY_END: KEvent->Code = kbEnd; break; case KEY_SEND: KEvent->Code = kfShift | kbEnd; break; case 523: KEvent->Code = kfAlt | kbEnd; break; // kEND3 case 524: KEvent->Code = kfAlt | kfShift | kbEnd; break; // kEND4 case 525: KEvent->Code = kfCtrl | kbEnd; break; // kEND5 case 526: KEvent->Code = kfCtrl | kfShift | kbEnd; break; // kEND6 case 527: KEvent->Code = kfAlt | kfCtrl | kbEnd; break; // kEND7 case KEY_NPAGE: KEvent->Code = kbPgDn; break; case KEY_SNEXT: KEvent->Code = kfShift | kbPgDn; break; case 543: KEvent->Code = kfAlt | kbPgDn; break; // kNXT3 case 545: KEvent->Code = kfCtrl | kbPgDn; break; // kNXT5 case 547: KEvent->Code = kfAlt | kfCtrl | kbPgDn; break; // kNXT7 case KEY_PPAGE: KEvent->Code = kbPgUp; break; case KEY_SPREVIOUS: KEvent->Code = kfShift | kbPgUp; break; case 548: KEvent->Code = kfAlt | kbPgUp; break; // kPRV3 case 550: KEvent->Code = kfCtrl | kbPgUp; break; // kPRV5 case 552: KEvent->Code = kfAlt | kfCtrl | kbPgUp; break; // kPRV7 case KEY_F(1): KEvent->Code = kbF1; break; case KEY_F(13): KEvent->Code = kfShift | kbF1; break; case KEY_F(25): KEvent->Code = kfCtrl | kbF1; break; case KEY_F(37): KEvent->Code = kfCtrl | kfShift | kbF1; break; case KEY_F(2): KEvent->Code = kbF2; break; case KEY_F(14): KEvent->Code = kfShift | kbF2; break; case KEY_F(26): KEvent->Code = kfCtrl | kbF2; break; case KEY_F(38): KEvent->Code = kfCtrl | kfShift | kbF2; break; case KEY_F(3): KEvent->Code = kbF3; break; case KEY_F(15): KEvent->Code = kfShift | kbF3; break; case KEY_F(27): KEvent->Code = kfCtrl | kbF3; break; case KEY_F(39): KEvent->Code = kfCtrl | kfShift | kbF3; break; case KEY_F(4): KEvent->Code = kbF4; break; case KEY_F(16): KEvent->Code = kfShift | kbF4; break; case KEY_F(28): KEvent->Code = kfCtrl | kbF4; break; case KEY_F(40): KEvent->Code = kfCtrl | kfShift | kbF4; break; case KEY_F(5): KEvent->Code = kbF5; break; case KEY_F(17): KEvent->Code = kfShift | kbF5; break; case KEY_F(29): KEvent->Code = kfCtrl | kbF5; break; case KEY_F(41): KEvent->Code = kfCtrl | kfShift | kbF5; break; case KEY_F(6): KEvent->Code = kbF6; break; case KEY_F(18): KEvent->Code = kfShift | kbF6; break; case KEY_F(30): KEvent->Code = kfCtrl | kbF6; break; case KEY_F(42): KEvent->Code = kfCtrl | kfShift | kbF6; break; case KEY_F(7): KEvent->Code = kbF7; break; case KEY_F(19): KEvent->Code = kfShift | kbF7; break; case KEY_F(31): KEvent->Code = kfCtrl | kbF7; break; case KEY_F(43): KEvent->Code = kfCtrl | kfShift | kbF7; break; case KEY_F(8): KEvent->Code = kbF8; break; case KEY_F(20): KEvent->Code = kfShift | kbF8; break; case KEY_F(32): KEvent->Code = kfCtrl | kbF8; break; case KEY_F(44): KEvent->Code = kfCtrl | kfShift | kbF8; break; case KEY_F(9): KEvent->Code = kbF9; break; case KEY_F(21): KEvent->Code = kfShift | kbF9; break; case KEY_F(33): KEvent->Code = kfCtrl | kbF9; break; case KEY_F(45): KEvent->Code = kfCtrl | kfShift | kbF9; break; case KEY_F(10): KEvent->Code = kbF10; break; case KEY_F(22): KEvent->Code = kfShift | kbF10; break; case KEY_F(34): KEvent->Code = kfCtrl | kbF10; break; case KEY_F(46): KEvent->Code = kfCtrl | kfShift | kbF10; break; case KEY_F(11): KEvent->Code = kbF11; break; case KEY_F(23): KEvent->Code = kfShift | kbF11; break; case KEY_F(35): KEvent->Code = kfCtrl | kbF11; break; case KEY_F(47): KEvent->Code = kfCtrl | kfShift | kbF11; break; case KEY_F(12): KEvent->Code = kbF12; break; case KEY_F(24): KEvent->Code = kfShift | kbF12; break; case KEY_F(36): KEvent->Code = kfCtrl | kbF12; break; case KEY_F(48): KEvent->Code = kfCtrl | kfShift | kbF12; break; case KEY_B2: KEvent->Code = kbCenter; break; case KEY_ENTER: KEvent->Code = kbEnter; break; /* shift enter */ default: if ((key_sdown != 0) && (ch == key_sdown)) KEvent->Code = kfShift | kbDown; else if ((key_sup != 0) && (ch == key_sup)) KEvent->Code = kfShift | kbUp; else { Event->What = evNone; //fprintf(stderr, "Unknown 0x%x %d\n", ch, ch); } break; } if (!Delete) Prev = *Event; return 1; } // *INDENT-ON* char ConGetDrawChar(unsigned int idx) { //return 128+idx; return (char)idx; } int ConPutEvent(const TEvent& Event) { Prev = Event; return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; if (TTYInitTable() == 0) { ::ConInit(-1, -1); ::ConSetSize(XSize, YSize); gui = this; } } GUI::~GUI() { ::ConDone(); gui = 0; } int GUI::ConSuspend() { return ::ConSuspend(); } int GUI::ConContinue() { return ::ConContinue(); } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int /*mode */ , char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); #ifdef CONFIG_MOUSE ConHideMouse(); #endif ConSuspend(); if (!Command[0]) // empty string = shell Command = getenv("SHELL"); rc = system(Command); ConContinue(); #ifdef CONFIG_MOUSE ConShowMouse(); #endif ConQuerySize(&W1, &H1); if (W != W1 || H != H1) frames->Resize(W1, H1); frames->Repaint(); return rc; } �������������������������������./src/o_buffer.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000152712�11602724002�012737� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_buffer.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_color.h" #include "c_config.h" #include "c_history.h" #include "e_mark.h" #include "e_tags.h" #include "e_undo.h" #include "ftever.h" #include "i_modelview.h" #include "i_view.h" #include "o_cvsdiff.h" #include "o_messages.h" #include "o_svndiff.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include <ctype.h> #include <time.h> SearchReplaceOptions LSearch; int suspendLoads = 0; EViewPort *EBuffer::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); if (Loaded == 0 && !suspendLoads) { Load(); #ifdef CONFIG_OBJ_MESSAGES if (CompilerMsgs) CompilerMsgs->FindFileErrors(this); #endif #ifdef CONFIG_OBJ_CVS if (CvsDiffView) CvsDiffView->FindFileLines(this); #endif #ifdef CONFIG_OBJ_SVN if (SvnDiffView) SvnDiffView->FindFileLines(this); #endif markIndex.retrieveForBuffer(this); #ifdef CONFIG_HISTORY int r, c; if (RetrieveFPos(FileName, r, c) == 1) SetNearPosR(c, r); //printf("setting to c:%d r:%d f:%s", c, r, FileName); V->Port->GetPos(); V->Port->ReCenter = 1; #ifdef CONFIG_BOOKMARKS if (BFI (this,BFI_SaveBookmarks)==3) RetrieveBookmarks(this); #endif #endif } return V->Port; } EEditPort::EEditPort(EBuffer *B, EView *V) : EViewPort(V), Buffer(B), OldTP(-1, -1), Rows(0), Cols(0) { GetPos(); if (V && V->MView && V->MView->Win) { V->MView->ConQuerySize(&Cols, &Rows); Rows--; } } EEditPort::~EEditPort() { StorePos(); } void EEditPort::Resize(int Width, int Height) { Cols = Width; Rows = Height - 1; RedrawAll(); } int EEditPort::SetTop(int Col, int Line) { int A, B; if (Line >= Buffer->VCount) Line = Buffer->VCount - 1; if (Line < 0) Line = 0; A = Line; B = Line + Rows; TP.Row = Line; TP.Col = Col; if (A >= Buffer->VCount) A = Buffer->VCount - 1; if (B >= Buffer->VCount) { B = Buffer->VCount - 1; } Buffer->Draw(Buffer->VToR(A), -1); return 1; } void EEditPort::StorePos() { Buffer->CP = CP; Buffer->TP = TP; } void EEditPort::GetPos() { CP = Buffer->CP; TP = Buffer->TP; } void EEditPort::ScrollY(int Delta) { // optimization // no need to scroll (clear) entire window which we are about to redraw if (Delta >= Rows || -Delta >= Rows) return ; if (Delta < 0) { Delta = -Delta; if (Delta > Rows) return; View->MView->ConScroll(csDown, 0, 0, Cols, Rows, hcPlain_Background, Delta); } else { if (Delta > Rows) return; View->MView->ConScroll(csUp, 0, 0, Cols, Rows, hcPlain_Background, Delta); } } void EEditPort::DrawLine(int L, TDrawBuffer B) { if (L < TP.Row) return; if (L >= TP.Row + Rows) return; if (View->MView->Win->GetViewContext() == View->MView) View->MView->ConPutBox(0, L - TP.Row, Cols, 1, B); // printf("%d %d (%d %d %d %d)\n", 0, L - TP.Row, view->sX, view->sY, view->sW, view->sH); } void EEditPort::RedrawAll() { Buffer->Draw(TP.Row, -1); /// Redraw(0, 0, Cols, Rows); } int EBuffer::GetContext() { return CONTEXT_FILE; } void EEditPort::HandleEvent(TEvent &Event) { EViewPort::HandleEvent(Event); switch (Event.What) { case evKeyDown: { char Ch; if (GetCharFromEvent(Event, &Ch)) { if (Buffer->BeginMacro() == 0) return ; Buffer->TypeChar(Ch); Event.What = evNone; } } break; case evCommand: switch (Event.Msg.Command) { case cmVScrollUp: Buffer->ScrollDown(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollDown: Buffer->ScrollUp(Event.Msg.Param1); Event.What = evNone; break; case cmVScrollPgUp: Buffer->ScrollDown(Rows); Event.What = evNone; break; case cmVScrollPgDn: Buffer->ScrollUp(Rows); Event.What = evNone; break; case cmVScrollMove: { int ypos; // fprintf(stderr, "Pos = %d\n\x7", Event.Msg.Param1); ypos = Buffer->CP.Row - TP.Row; Buffer->SetNearPos(Buffer->CP.Col, Event.Msg.Param1 + ypos); SetTop(TP.Col, Event.Msg.Param1); RedrawAll(); } Event.What = evNone; break; case cmHScrollLeft: Buffer->ScrollRight(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollRight: Buffer->ScrollLeft(Event.Msg.Param1); Event.What = evNone; break; case cmHScrollPgLt: Buffer->ScrollRight(Cols); Event.What = evNone; break; case cmHScrollPgRt: Buffer->ScrollLeft(Cols); Event.What = evNone; break; case cmHScrollMove: { int xpos; xpos = Buffer->CP.Col - TP.Col; Buffer->SetNearPos(Event.Msg.Param1 + xpos, Buffer->CP.Row); SetTop(Event.Msg.Param1, TP.Row); RedrawAll(); } Event.What = evNone; break; } break; #ifdef CONFIG_MOUSE case evMouseDown: case evMouseMove: case evMouseAuto: case evMouseUp: HandleMouse(Event); break; #endif } } #ifdef CONFIG_MOUSE void EEditPort::HandleMouse(TEvent &Event) { int x, y, xx, yy, W, H; View->MView->ConQuerySize(&W, &H); x = Event.Mouse.X; y = Event.Mouse.Y; if (Event.What != evMouseDown || y < H - 1) { xx = x + TP.Col; yy = y + TP.Row; if (yy >= Buffer->VCount) yy = Buffer->VCount - 1; if (yy < 0) yy = 0; if (xx < 0) xx = 0; switch (Event.What) { case evMouseDown: if (Event.Mouse.Y == H - 1) break; if (View->MView->Win->CaptureMouse(1)) View->MView->MouseCaptured = 1; else break; View->MView->MouseMoved = 0; if (Event.Mouse.Buttons == 1) { // left mouse button down Buffer->SetNearPos(xx, yy); switch (Event.Mouse.Count % 5) { case 1: break; case 2: Buffer->BlockSelectWord(); break; case 3: Buffer->BlockSelectLine(); break; case 4: Buffer->BlockSelectPara(); break; } // Window->Buffer->Redraw(); if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); Buffer->BlockCopy(0, 1); } Event.What = evNone; } else if (Event.Mouse.Buttons == 2) { // right mouse button down Buffer->SetNearPos(xx, yy); } break; case evMouseAuto: case evMouseMove: if (View->MView->MouseCaptured) { if (Event.Mouse.Buttons == 1) { // left mouse button move if (!View->MView->MouseMoved) { if (Event.Mouse.KeyMask == kfCtrl) Buffer->BlockMarkColumn(); else if (Event.Mouse.KeyMask == kfAlt) Buffer->BlockMarkLine(); else Buffer->BlockMarkStream(); Buffer->BlockUnmark(); if (Event.What == evMouseMove) View->MView->MouseMoved = 1; } Buffer->BlockExtendBegin(); Buffer->SetNearPos(xx, yy); Buffer->BlockExtendEnd(); } else if (Event.Mouse.Buttons == 2) { // right mouse button move if (Event.Mouse.KeyMask == kfAlt) { } else { Buffer->SetNearPos(xx, yy); } } Event.What = evNone; } break; /* case evMouseAuto: if (View->MView->MouseCaptured) { Event.What = evNone; } break;*/ case evMouseUp: if (View->MView->MouseCaptured) View->MView->Win->CaptureMouse(0); else break; View->MView->MouseCaptured = 0; if (Event.Mouse.Buttons == 1) { // left mouse button up if (View->MView->MouseMoved) if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); Buffer->BlockCopy(0, 1); } } if (Event.Mouse.Buttons == 2) { // right mouse button up if (!View->MView->MouseMoved) { EEventMap *Map = View->MView->Win->GetEventMap(); const char *MName = 0; if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->MView->Win->Parent->PopupMenu(MName); } } if (Event.Mouse.Buttons == 4) { // middle mouse button up if (SystemClipboard) { // note: copy to second clipboard Buffer->NextCommand(); if (Event.Mouse.KeyMask == 0) Buffer->BlockPasteStream(1); else if (Event.Mouse.KeyMask == kfCtrl) Buffer->BlockPasteColumn(1); else if (Event.Mouse.KeyMask == kfAlt) Buffer->BlockPasteLine(1); } } Event.What = evNone; break; } } } #endif void EEditPort::UpdateView() { Buffer->Redraw(); } void EEditPort::RepaintView() { RedrawAll(); } void EEditPort::UpdateStatus() { } void EEditPort::RepaintStatus() { //Buffer->Redraw(); } EEventMap *EBuffer::GetEventMap() { return FindActiveMap(Mode); } int EBuffer::BeginMacro() { return NextCommand(); } // *INDENT-OFF* int EBuffer::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMovePrev: return MovePrev(); case ExMoveNext: return MoveNext(); case ExMoveWordLeft: return MoveWordLeft(); case ExMoveWordRight: return MoveWordRight(); case ExMoveWordPrev: return MoveWordPrev(); case ExMoveWordNext: return MoveWordNext(); case ExMoveWordEndLeft: return MoveWordEndLeft(); case ExMoveWordEndRight: return MoveWordEndRight(); case ExMoveWordEndPrev: return MoveWordEndPrev(); case ExMoveWordEndNext: return MoveWordEndNext(); case ExMoveWordOrCapLeft: return MoveWordOrCapLeft(); case ExMoveWordOrCapRight: return MoveWordOrCapRight(); case ExMoveWordOrCapPrev: return MoveWordOrCapPrev(); case ExMoveWordOrCapNext: return MoveWordOrCapNext(); case ExMoveWordOrCapEndLeft: return MoveWordOrCapEndLeft(); case ExMoveWordOrCapEndRight: return MoveWordOrCapEndRight(); case ExMoveWordOrCapEndPrev: return MoveWordOrCapEndPrev(); case ExMoveWordOrCapEndNext: return MoveWordOrCapEndNext(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExMovePageLeft: return MovePageLeft(); case ExMovePageRight: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveBlockStart: return MoveBlockStart(); case ExMoveBlockEnd: return MoveBlockEnd(); case ExMoveFirstNonWhite: return MoveFirstNonWhite(); case ExMoveLastNonWhite: return MoveLastNonWhite(); case ExMovePrevEqualIndent: return MovePrevEqualIndent(); case ExMoveNextEqualIndent: return MoveNextEqualIndent(); case ExMovePrevTab: return MovePrevTab(); case ExMoveNextTab: return MoveNextTab(); case ExMoveTabStart: return MoveTabStart(); case ExMoveTabEnd: return MoveTabEnd(); case ExMoveLineTop: return MoveLineTop(); case ExMoveLineCenter: return MoveLineCenter(); case ExMoveLineBottom: return MoveLineBottom(); case ExMoveBeginOrNonWhite: return MoveBeginOrNonWhite(); case ExMoveBeginLinePageFile: return MoveBeginLinePageFile(); case ExMoveEndLinePageFile: return MoveEndLinePageFile(); case ExScrollLeft: return ScrollLeft(State); case ExScrollRight: return ScrollRight(State); case ExScrollDown: return ScrollDown(State); case ExScrollUp: return ScrollUp(State); case ExKillLine: return KillLine(); case ExKillChar: return KillChar(); case ExKillCharPrev: return KillCharPrev(); case ExKillWord: return KillWord(); case ExKillWordPrev: return KillWordPrev(); case ExKillWordOrCap: return KillWordOrCap(); case ExKillWordOrCapPrev: return KillWordOrCapPrev(); case ExKillToLineStart: return KillToLineStart(); case ExKillToLineEnd: return KillToLineEnd(); case ExKillBlock: return KillBlock(); case ExBackSpace: return BackSpace(); case ExDelete: return Delete(); case ExCharCaseUp: return CharCaseUp(); case ExCharCaseDown: return CharCaseDown(); case ExCharCaseToggle: return CharCaseToggle(); case ExLineCaseUp: return LineCaseUp(); case ExLineCaseDown: return LineCaseDown(); case ExLineCaseToggle: return LineCaseToggle(); case ExLineInsert: return LineInsert(); case ExLineAdd: return LineAdd(); case ExLineSplit: return LineSplit(); case ExLineJoin: return LineJoin(); case ExLineNew: return LineNew(); case ExLineIndent: return LineIndent(); case ExLineTrim: return LineTrim(); case ExLineCenter: return LineCenter(); case ExInsertSpacesToTab: { int no; if(State.GetIntParam(View, &no) == 0) no = 0; return InsertSpacesToTab(no); } case ExInsertTab: return InsertTab(); case ExInsertSpace: return InsertSpace(); case ExWrapPara: #ifdef CONFIG_WORDWRAP return WrapPara(); #else return 0; #endif case ExInsPrevLineChar: return InsPrevLineChar(); case ExInsPrevLineToEol: return InsPrevLineToEol(); case ExLineDuplicate: return LineDuplicate(); case ExBlockBegin: return BlockBegin(); case ExBlockEnd: return BlockEnd(); case ExBlockUnmark: return BlockUnmark(); case ExBlockCut: return BlockCut(0); case ExBlockCopy: return BlockCopy(0); case ExBlockCutAppend: return BlockCut(1); case ExBlockCopyAppend: return BlockCopy(1); case ExClipClear: return ClipClear(); case ExBlockPaste: return BlockPaste(); case ExBlockKill: return BlockKill(); case ExBlockIndent: { int saved_persistence, ret_code; saved_persistence = BFI(this, BFI_PersistentBlocks); BFI_SET(this, BFI_PersistentBlocks, 1); ret_code = BlockIndent(); BFI_SET(this, BFI_PersistentBlocks, saved_persistence); return ret_code; } case ExBlockUnindent: { int saved_persistence, ret_code; saved_persistence = BFI(this, BFI_PersistentBlocks); BFI_SET(this, BFI_PersistentBlocks, 1); ret_code = BlockUnindent(); BFI_SET(this, BFI_PersistentBlocks, saved_persistence); return ret_code; } case ExBlockClear: return BlockClear(); case ExBlockMarkStream: return BlockMarkStream(); case ExBlockMarkLine: return BlockMarkLine(); case ExBlockMarkColumn: return BlockMarkColumn(); case ExBlockCaseUp: return BlockCaseUp(); case ExBlockCaseDown: return BlockCaseDown(); case ExBlockCaseToggle: return BlockCaseToggle(); case ExBlockExtendBegin: return BlockExtendBegin(); case ExBlockExtendEnd: return BlockExtendEnd(); case ExBlockReIndent: return BlockReIndent(); case ExBlockSelectWord: return BlockSelectWord(); case ExBlockSelectLine: return BlockSelectLine(); case ExBlockSelectPara: return BlockSelectPara(); case ExBlockUnTab: return BlockUnTab(); case ExBlockEnTab: return BlockEnTab(); #ifdef CONFIG_UNDOREDO case ExUndo: return Undo(); case ExRedo: return Redo(); #else case ExUndo: return 0; case ExRedo: return 0; #endif case ExMatchBracket: return MatchBracket(); case ExMovePrevPos: return MovePrevPos(); case ExMoveSavedPosCol: return MoveSavedPosCol(); case ExMoveSavedPosRow: return MoveSavedPosRow(); case ExMoveSavedPos: return MoveSavedPos(); case ExSavePos: return SavePos(); case ExCompleteWord: return CompleteWord(); case ExBlockPasteStream: return BlockPasteStream(); case ExBlockPasteLine: return BlockPasteLine(); case ExBlockPasteColumn: return BlockPasteColumn(); case ExBlockPasteOver: return BlockPasteOver(); case ExShowPosition: return ShowPosition(); case ExFoldCreate: return FoldCreate(VToR(CP.Row)); case ExFoldDestroy: return FoldDestroy(VToR(CP.Row)); case ExFoldDestroyAll: return FoldDestroyAll(); case ExFoldPromote: return FoldPromote(VToR(CP.Row)); case ExFoldDemote: return FoldDemote(VToR(CP.Row)); case ExFoldOpen: return FoldOpen(VToR(CP.Row)); case ExFoldOpenNested: return FoldOpenNested(); case ExFoldClose: return FoldClose(VToR(CP.Row)); case ExFoldOpenAll: return FoldOpenAll(); case ExFoldCloseAll: return FoldCloseAll(); case ExFoldToggleOpenClose: return FoldToggleOpenClose(); case ExFoldCreateAtRoutines: return FoldCreateAtRoutines(); case ExMoveFoldTop: return MoveFoldTop(); case ExMoveFoldPrev: return MoveFoldPrev(); case ExMoveFoldNext: return MoveFoldNext(); case ExFileSave: return Save(); case ExFilePrint: return FilePrint(); case ExBlockPrint: return BlockPrint(); case ExBlockTrim: return BlockTrim(); case ExFileTrim: return FileTrim(); case ExHilitWord: #ifdef CONFIG_WORD_HILIT return HilitWord(); #else return 0; #endif case ExSearchWordPrev: return SearchWord(SEARCH_BACK | SEARCH_NEXT); case ExSearchWordNext: return SearchWord(SEARCH_NEXT); case ExHilitMatchBracket: return HilitMatchBracket(); case ExToggleAutoIndent: return ToggleAutoIndent(); case ExToggleInsert: return ToggleInsert(); case ExToggleExpandTabs: return ToggleExpandTabs(); case ExToggleShowTabs: return ToggleShowTabs(); case ExToggleUndo: return ToggleUndo(); case ExToggleReadOnly: return ToggleReadOnly(); case ExToggleKeepBackups: return ToggleKeepBackups(); case ExToggleMatchCase: return ToggleMatchCase(); case ExToggleBackSpKillTab: return ToggleBackSpKillTab(); case ExToggleDeleteKillTab: return ToggleDeleteKillTab(); case ExToggleSpaceTabs: return ToggleSpaceTabs(); case ExToggleIndentWithTabs: return ToggleIndentWithTabs(); case ExToggleBackSpUnindents: return ToggleBackSpUnindents(); case ExToggleWordWrap: return ToggleWordWrap(); case ExToggleTrim: return ToggleTrim(); case ExToggleShowMarkers: return ToggleShowMarkers(); case ExToggleHilitTags: return ToggleHilitTags(); case ExToggleShowBookmarks: return ToggleShowBookmarks(); case ExToggleMakeBackups: return ToggleMakeBackups(); case ExSetLeftMargin: return SetLeftMargin(); case ExSetRightMargin: return SetRightMargin(); case ExSetIndentWithTabs: return SetIndentWithTabs(State); // stuff with UI case ExMoveToLine: return MoveToLine(State); case ExMoveToColumn: return MoveToColumn(State); case ExFoldCreateByRegexp: return FoldCreateByRegexp(State); #ifdef CONFIG_BOOKMARKS case ExPlaceBookmark: return PlaceBookmark(State); case ExRemoveBookmark: return RemoveBookmark(State); case ExGotoBookmark: return GotoBookmark(State); #else case ExPlaceBookmark: return 0; case ExRemoveBookmark: return 0; case ExGotoBookmark: return 0; #endif case ExPlaceGlobalBookmark: return PlaceGlobalBookmark(State); case ExPushGlobalBookmark: return PushGlobalBookmark(); case ExInsertString: return InsertString(State); case ExSelfInsert: return SelfInsert(State); case ExFileReload: return FileReload(State); case ExFileSaveAs: return FileSaveAs(State); case ExFileWriteTo: return FileWriteTo(State); case ExBlockRead: return BlockRead(State); case ExBlockReadStream: return BlockReadStream(State); case ExBlockReadLine: return BlockReadLine(State); case ExBlockReadColumn: return BlockReadColumn(State); case ExBlockWrite: return BlockWrite(State); case ExBlockSort: return BlockSort(0); case ExBlockSortReverse: return BlockSort(1); case ExFind: return Find(State); case ExFindReplace: return FindReplace(State); case ExFindRepeat: return FindRepeat(State); case ExFindRepeatOnce: return FindRepeatOnce(State); case ExFindRepeatReverse: return FindRepeatReverse(State); case ExSearch: return Search(State); case ExSearchB: return SearchB(State); case ExSearchRx: return SearchRx(State); case ExSearchAgain: return SearchAgain(State); case ExSearchAgainB: return SearchAgainB(State); case ExSearchReplace: return SearchReplace(State); case ExSearchReplaceB: return SearchReplaceB(State); case ExSearchReplaceRx: return SearchReplaceRx(State); case ExInsertChar: return InsertChar(State); case ExTypeChar: return TypeChar(State); case ExChangeMode: return ChangeMode(State); //case ExChangeKeys: return ChangeKeys(State); case ExChangeFlags: return ChangeFlags(State); case ExChangeTabSize: return ChangeTabSize(State); case ExChangeLeftMargin: return ChangeLeftMargin(State); case ExChangeRightMargin: return ChangeRightMargin(State); case ExASCIITable: #ifdef CONFIG_I_ASCII return ASCIITable(State); #else return 0; #endif case ExCharTrans: return CharTrans(State); case ExLineTrans: return LineTrans(State); case ExBlockTrans: return BlockTrans(State); #ifdef CONFIG_TAGS case ExTagFind: return FindTag(State); case ExTagFindWord: return FindTagWord(State); #endif case ExSetCIndentStyle: return SetCIndentStyle(State); case ExBlockMarkFunction: return BlockMarkFunction(); case ExIndentFunction: return IndentFunction(); case ExMoveFunctionPrev: return MoveFunctionPrev(); case ExMoveFunctionNext: return MoveFunctionNext(); case ExInsertDate: return InsertDate(State); case ExInsertUid: return InsertUid(); case ExShowHelpWord: return ShowHelpWord(State); default: ; } return EModel::ExecCommand(Command, State); } // *INDENT-ON* void EBuffer::HandleEvent(TEvent &Event) { EModel::HandleEvent(Event); } int EBuffer::MoveToLine(ExState &State) { int No = 0; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", VToR(CP.Row) + 1); if (View->MView->Win->GetStr("Goto Line", sizeof(Num), Num, HIST_POSITION) == 0) return 0; No = atol(Num); } return SetNearPosR(CP.Col, No - 1); } int EBuffer::MoveToColumn(ExState &State) { int No = 0; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", CP.Col + 1); if (View->MView->Win->GetStr("Goto Column", 8, Num, HIST_POSITION) == 0) return 0; No = atol(Num); } return SetNearPos(No - 1, CP.Row); } int EBuffer::FoldCreateByRegexp(ExState &State) { char strbuf[1024] = ""; if (State.GetStrParam(View, strbuf, sizeof(strbuf)) == 0) { if (View->MView->Win->GetStr("Create Fold Regexp", sizeof(strbuf), strbuf, HIST_REGEXP) == 0) return 0; } return FoldCreateByRegexp(strbuf); } #ifdef CONFIG_BOOKMARKS int EBuffer::PlaceUserBookmark(const char *n,EPoint P) { char name[256+4] = "_BMK"; int result; EPoint prev; strcpy (name+4,n); if (GetBookmark (name,prev)==0) { prev.Row=-1;prev.Col=-1; } result=PlaceBookmark(name, P); if (result) { if (BFI (this,BFI_ShowBookmarks)) { FullRedraw (); } if (BFI (this,BFI_SaveBookmarks)==1||BFI (this,BFI_SaveBookmarks)==2) { if (!Modify ()) return result; // Never try to save to read-only #ifdef CONFIG_UNDOREDO if (BFI(this, BFI_Undo)) { if (PushULong(prev.Row) == 0) return 0; if (PushULong(prev.Col) == 0) return 0; if (PushUData(n, strlen(n) + 1) == 0) return 0; if (PushULong(strlen (n)+1) == 0) return 0; if (PushUChar(ucPlaceUserBookmark) == 0) return 0; } #endif } } return result; } int EBuffer::RemoveUserBookmark(const char *n) { char name[256+4] = "_BMK"; int result; EPoint p; strcpy (name+4,n); GetBookmark (name,p); // p is valid only if remove is successful result=RemoveBookmark(name); if (result) { if (BFI (this,BFI_ShowBookmarks)) { FullRedraw (); } if (BFI (this,BFI_SaveBookmarks)==1||BFI (this,BFI_SaveBookmarks)==2) { if (!Modify ()) return result; // Never try to save to read-only #ifdef CONFIG_UNDOREDO if (PushULong(p.Row) == 0) return 0; if (PushULong(p.Col) == 0) return 0; if (PushUData((void *)n,strlen (n)+1) == 0) return 0; if (PushULong(strlen (n)+1) == 0) return 0; if (PushUChar(ucRemoveUserBookmark) == 0) return 0; #endif } } return result; } int EBuffer::GotoUserBookmark(const char *n) { char name[256+4] = "_BMK"; strcpy (name+4,n); return GotoBookmark(name); } int EBuffer::GetUserBookmarkForLine(int searchFrom, int searchForLine, const EBookmark* &eb) { int i = searchFrom; while ((i = GetBookmarkForLine(i, searchForLine, eb) != -1)) if (strncmp(eb->GetName(), "_BMK", 4) == 0) return i; return -1; } int EBuffer::PlaceBookmark(ExState &State) { char name[256] = ""; EPoint P = CP; P.Row = VToR(P.Row); if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Place Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return PlaceUserBookmark(name, P); } int EBuffer::RemoveBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Remove Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return RemoveUserBookmark(name); } int EBuffer::GotoBookmark(ExState &State) { char name[256] = ""; if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Goto Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; return GotoUserBookmark(name); } #endif int EBuffer::PlaceGlobalBookmark(ExState &State) { char name[256] = ""; EPoint P = CP; P.Row = VToR(P.Row); if (State.GetStrParam(View, name, sizeof(name)) == 0) if (View->MView->Win->GetStr("Place Global Bookmark", sizeof(name), name, HIST_BOOKMARK) == 0) return 0; if (markIndex.insert(name, this, P) == 0) { Msg(S_ERROR, "Error placing global bookmark %s.", name); } return 1; } int EBuffer::PushGlobalBookmark() { EPoint P = CP; P.Row = VToR(P.Row); EMark *m = markIndex.pushMark(this, P); if (m) Msg(S_INFO, "Placed bookmark %s", m->GetName()); return m ? 1 : 0; } int EBuffer::InsertChar(ExState &State) { char Ch; int No; if (State.GetIntParam(View, &No) == 0) { TEvent E; E.What = evKeyDown; E.Key.Code = View->MView->Win->GetChar("Quote Char:"); if (!GetCharFromEvent(E, &Ch)) return 0; No = Ch; } if (No < 0 || No > 255) return 0; Ch = char(No); return InsertChar(Ch); } int EBuffer::TypeChar(ExState &State) { char Ch; int No; if (State.GetIntParam(View, &No) == 0) { TEvent E; E.What = evKeyDown; E.Key.Code = View->MView->Win->GetChar(0); if (!GetCharFromEvent(E, &Ch)) return 0; No = Ch; } if (No < 0 || No > 255) return 0; Ch = char(No); return TypeChar(Ch); } int EBuffer::InsertString(ExState &State) { char strbuf[1024] = ""; if (State.GetStrParam(View, strbuf, sizeof(strbuf)) == 0) { if (View->MView->Win->GetStr("Insert String", sizeof(strbuf), strbuf, HIST_DEFAULT) == 0) return 0; } return InsertString(strbuf, strlen(strbuf)); } extern int LastEventChar; int EBuffer::SelfInsert(ExState &/*State*/) { if (LastEventChar != -1) return TypeChar(char(LastEventChar)); return 0; } int EBuffer::FileReload(ExState &/*State*/) { if (Modified) { switch (View->MView->Win->Choice(GPC_ERROR, "File Modified", 2, "&Reload", "&Cancel", "%s", FileName)) { case 0: break; case 1: case -1: default: return 0; } } // GetNewNumber(); return Reload(); } int EBuffer::FileSaveAs(const char *FName) { char Name[MAXPATH]; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 2, "&Overwrite", "&Cancel", "%s", Name)) { case 0: break; case 1: case -1: default: return 0; } } free(FileName); FileName = strdup(Name); UpdateTitle(); return Save(); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } } int EBuffer::FileSaveAs(ExState &State) { char FName[MAXPATH]; strcpy(FName, FileName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; return FileSaveAs(FName); } int EBuffer::FileWriteTo(const char *FName) { char Name[MAXPATH]; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 2, "&Overwrite", "&Cancel", "%s", Name)) { case 0: break; case 1: case -1: default: return 0; } } return SaveTo(Name); } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } } int EBuffer::FileWriteTo(ExState &State) { char FName[MAXPATH]; strcpy(FName, FileName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Write To", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; return FileWriteTo(FName); } int EBuffer::BlockReadX(ExState &State, int blockMode) { char Name[MAXPATH]; char FName[MAXPATH]; if (JustDirectory(FileName, FName, sizeof(FName)) == -1) return 0; SlashDir(FName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Read block", sizeof(FName), FName, HIST_PATH, GF_OPEN) == 0) return 0; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } return BlockReadFrom(FName, blockMode); } int EBuffer::BlockRead(ExState &State) { return BlockReadX(State, BlockMode); } int EBuffer::BlockReadStream(ExState &State) { return BlockReadX(State, bmStream); } int EBuffer::BlockReadLine(ExState &State) { return BlockReadX(State, bmLine); } int EBuffer::BlockReadColumn(ExState &State) { return BlockReadX(State, bmColumn); } int EBuffer::BlockWrite(ExState &State) { char Name[MAXPATH]; char FName[MAXPATH]; int Append = 0; if (JustDirectory(FileName, FName, sizeof(FName)) == -1) return 0; SlashDir(FName); if (State.GetStrParam(View, FName, sizeof(FName)) == 0) if (View->MView->Win->GetFile("Write block", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (ExpandPath(FName, Name, sizeof(Name)) == -1) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Invalid path: %s.", FName); return 0; } if (FindFile(Name) == 0) { if (FileExists(Name)) { switch (View->MView->Win->Choice(GPC_ERROR, "File Exists", 3, "&Overwrite", "&Append", "&Cancel", "%s", Name)) { case 0: break; case 1: Append = 1; break; case 2: case -1: default: return 0; } } } else { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Already editing '%s.'", Name); return 0; } return BlockWriteTo(Name, Append); } int EBuffer::Find(ExState &State) { char find[MAXSEARCH+1] = ""; char options[32] = ""; if (State.GetStrParam(View, find, sizeof(find)) != 0) { if (State.GetStrParam(View, options, sizeof(options)) == 0) strcpy(options, BFS(this, BFS_DefFindOpt)); LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.strReplace[0] = 0; LSearch.Options = 0; if (ParseSearchOptions(0, options, LSearch.Options) == 0) return 0; LSearch.ok = 1; } else if ((HaveGUIDialogs & GUIDLG_FIND) && GUIDialogs) { LSearch.ok = 0; LSearch.strSearch[0] = 0; LSearch.strReplace[0] = 0; LSearch.Options = 0; if (BFS(this, BFS_DefFindOpt)) strcpy(options, BFS(this, BFS_DefFindOpt)); if (ParseSearchOptions(0, options, LSearch.Options) == 0) LSearch.Options = 0; if (DLGGetFind(View->MView->Win, LSearch) == 0) return 0; } else { if (BFS(this, BFS_DefFindOpt)) strcpy(options, BFS(this, BFS_DefFindOpt)); if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (View->MView->Win->GetStr("Options (All/Block/Cur/Delln/Glob/Igncase/Joinln/Rev/Word/regX)", sizeof(options), options, HIST_SEARCHOPT) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.strReplace[0] = 0; LSearch.Options = 0; if (ParseSearchOptions(0, options, LSearch.Options) == 0) return 0; LSearch.ok = 1; } if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_CENTER; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindReplace(ExState &State) { char find[MAXSEARCH+1] = ""; char replace[MAXSEARCH+1] = ""; char options[32] = ""; if (State.GetStrParam(View, find, sizeof(find)) != 0) { if (State.GetStrParam(View, replace, sizeof(replace)) == 0) return 0; if (State.GetStrParam(View, options, sizeof(options)) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = 0; if (ParseSearchOptions(1, options, LSearch.Options) == 0) return 0; LSearch.Options |= SEARCH_REPLACE; LSearch.ok = 1; } else if ((HaveGUIDialogs & GUIDLG_FINDREPLACE) && GUIDialogs) { LSearch.ok = 0; LSearch.strSearch[0] = 0; LSearch.strReplace[0] = 0; LSearch.Options = 0; if (BFS(this, BFS_DefFindReplaceOpt)) strcpy(options, BFS(this, BFS_DefFindReplaceOpt)); if (ParseSearchOptions(1, options, LSearch.Options) == 0) LSearch.Options = 0; if (DLGGetFindReplace(View->MView->Win, LSearch) == 0) return 0; } else { if (BFS(this, BFS_DefFindReplaceOpt)) strcpy(options, BFS(this, BFS_DefFindReplaceOpt)); if (State.GetStrParam(View, find, sizeof(find)) == 0) if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (State.GetStrParam(View, replace, sizeof(replace)) == 0) if (View->MView->Win->GetStr("Replace", sizeof(replace), replace, HIST_SEARCH) == 0) return 0; if (State.GetStrParam(View, options, sizeof(options)) == 0) if (View->MView->Win->GetStr("Options (All/Block/Cur/Delln/Glob/Igncase/Joinln/Rev/Noask/Word/regX)", sizeof(options), options, HIST_SEARCHOPT) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = 0; if (ParseSearchOptions(1, options, LSearch.Options) == 0) return 0; LSearch.Options |= SEARCH_REPLACE; LSearch.ok = 1; } if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_CENTER; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindRepeat(ExState &State) { if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::FindRepeatReverse(ExState &State) { int rc; if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; LSearch.Options ^= SEARCH_BACK; rc = Find(LSearch); LSearch.Options ^= SEARCH_BACK; return rc; } int EBuffer::FindRepeatOnce(ExState &State) { if (LSearch.ok == 0) return Find(State); LSearch.Options |= SEARCH_NEXT; LSearch.Options &= ~SEARCH_GLOBAL; LSearch.Options &= ~SEARCH_ALL; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::ChangeMode(ExState &State) { char Mode[32] = ""; int rc; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeMode(Mode); FullRedraw(); return rc; } int EBuffer::ChangeKeys(ExState &State) { int rc; char Mode[32] = ""; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeKeys(Mode); FullRedraw(); return rc; } int EBuffer::ChangeFlags(ExState &State) { int rc; char Mode[32] = ""; if (State.GetStrParam(View, Mode, sizeof(Mode)) == 0) if (View->MView->Win->GetStr("Mode", sizeof(Mode), Mode, HIST_SETUP) == 0) return 0; rc = ChangeFlags(Mode); FullRedraw(); return rc; } int EBuffer::ChangeTabSize(ExState &State) { int No; if (State.GetIntParam(View, &No) == 0) { char Num[10]; sprintf(Num, "%d", BFI(this, BFI_TabSize)); if (View->MView->Win->GetStr("TabSize", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num); } if (No < 1) return 0; if (No > 32) return 0; BFI(this, BFI_TabSize) = No; FullRedraw(); return 1; } int EBuffer::SetIndentWithTabs(ExState &State) { int No; if (State.GetIntParam(View, &No) == 0) return 0; Flags.num[BFI_IndentWithTabs] = No ? 1 : 0; return 1; } int EBuffer::ChangeRightMargin(ExState &State) { char Num[10]; int No; if (State.GetIntParam(View, &No) == 0) { sprintf(Num, "%d", BFI(this, BFI_RightMargin) + 1); if (View->MView->Win->GetStr("RightMargin", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num) - 1; } if (No <= 1) return 0; BFI(this, BFI_RightMargin) = No; Msg(S_INFO, "RightMargin set to %d.", No + 1); return 1; } int EBuffer::ChangeLeftMargin(ExState &State) { char Num[10]; int No; if (State.GetIntParam(View, &No) == 0) { sprintf(Num, "%d", BFI(this, BFI_LeftMargin) + 1); if (View->MView->Win->GetStr("LeftMargin", sizeof(Num), Num, HIST_SETUP) == 0) return 0; No = atol(Num) - 1; } if (No < 0) return 0; BFI(this, BFI_LeftMargin) = No; Msg(S_INFO, "LeftMargin set to %d.", No + 1); return 1; } int EBuffer::CanQuit() { if (Modified) return 0; else return 1; } int EBuffer::ConfQuit(GxView *V, int multiFile) { if (Modified) { if (multiFile) { switch (V->Choice(GPC_ERROR, "File Modified", 5, "&Save", "&As", "A&ll", "&Discard", "&Cancel", "%s", FileName)) { case 0: /* Save */ if (Save() == 0) return 0; break; case 1: /* As */ { char FName[MAXPATH]; strcpy(FName, FileName); if (V->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (FileSaveAs(FName) == 0) return 0; } break; case 2: /* Save all */ return -2; case 3: /* Discard */ break; case 4: /* Cancel */ case -1: default: return 0; } }else { switch (V->Choice(GPC_ERROR, "File Modified", 4, "&Save", "&As", "&Discard", "&Cancel", "%s", FileName)) { case 0: /* Save */ if (Save() == 0) return 0; break; case 1: /* As */ { char FName[MAXPATH]; strcpy(FName, FileName); if (V->GetFile("Save As", sizeof(FName), FName, HIST_PATH, GF_SAVEAS) == 0) return 0; if (FileSaveAs(FName) == 0) return 0; } break; case 2: /* Discard */ break; case 3: /* Cancel */ case -1: default: return 0; } } } return 1; } void EBuffer::GetName(char *AName, size_t MaxLen) { strlcpy(AName, FileName, MaxLen); } void EBuffer::GetPath(char *APath, size_t MaxLen) { JustDirectory(FileName, APath, MaxLen); } void EBuffer::GetInfo(char *AInfo, size_t /*MaxLen*/) { char buf[256] = {0}; char winTitle[256] = {0}; JustFileName(FileName, buf, sizeof(buf)); if (buf[0] == '\0') // if there is no filename, try the directory name. JustLastDirectory(FileName, buf, sizeof(buf)); if (buf[0] != 0) // if there is a file/dir name, stick it in here. { strlcat(winTitle, buf, sizeof(winTitle)); strlcat(winTitle, " - ", sizeof(winTitle)); } strlcat(winTitle, FileName, sizeof(winTitle)); sprintf(AInfo, "%2d %04d:%03d%c%-150s ", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified ? '*': ' ', winTitle); } void EBuffer::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { strlcpy(ATitle, FileName, MaxLen); char *p = SepRChr(FileName); strlcpy(ASTitle, (p) ? p + 1 : FileName, SMaxLen); } #ifdef CONFIG_I_ASCII int EBuffer::ASCIITable(ExState &/*State*/) { int rc; rc = View->MView->Win->PickASCII(); if (rc != -1) return InsertChar(char(rc)); return 0; } #endif int EBuffer::ScrollLeft(ExState &State) { int Cols; if (State.GetIntParam(View, &Cols) == 0) Cols = 8; return ScrollLeft(Cols); } int EBuffer::ScrollRight(ExState &State) { int Cols; if (State.GetIntParam(View, &Cols) == 0) Cols = 8; return ScrollRight(Cols); } int EBuffer::ScrollDown(ExState &State) { int Rows; if (State.GetIntParam(View, &Rows) == 0) Rows = 1; return ScrollDown(Rows); } int EBuffer::ScrollUp(ExState &State) { int Rows; if (State.GetIntParam(View, &Rows) == 0) Rows = 1; return ScrollUp(Rows); } #ifdef CONFIG_TAGS int EBuffer::FindTag(ExState &State) { char Tag[MAXSEARCH] = ""; if (State.GetStrParam(View, Tag, sizeof(Tag)) == 0) if (View->MView->Win->GetStr("Find tag", sizeof(Tag), Tag, HIST_SEARCH) == 0) return 0; int j = 2; while (j--) { int i; i = TagFind(this, View, Tag); if (i > 0) return 1; else if (j && (i < 0)) { /* Try autoload tags */ if (View->ExecCommand(ExTagLoad, State) == 0) break; } else { Msg(S_INFO, "Tag '%s' not found.", Tag); break; } } return 0; } #endif // these two will probably be replaced in the future int EBuffer::InsertDate(ExState &State) { char strArg[128] = ""; char buf[128], *p; time_t t; time(&t); if (State.GetStrParam(View, strArg, sizeof(strArg))) { struct tm *tt = localtime(&t); strftime(buf, sizeof(buf), strArg, tt); buf[sizeof(buf) - 1] = 0; } else { //** 012345678901234567890123 //** Wed Jan 02 02:23:54 1991 p = ctime(&t); sprintf(buf, "%.10s %.4s", p, p + 20); } //puts(buf); return InsertString(buf, strlen(buf)); } int EBuffer::InsertUid() { const char *p = getenv("USER"); if (p == 0) p = getenv("NAME"); if (p == 0) p = getenv("ID"); // mostly for Windows. Why they can't just be standard, I don't know... if (p == 0) p = getenv("USERNAME"); if (p == 0) { Msg(S_INFO, "User ID not set ($USER)."); //return 0; p = "UNKNOWN USER"; } return InsertString(p, strlen(p)); } int EBuffer::ShowHelpWord(ExState &State) { //** Code for BlockSelectWord to find the word under the cursor, const char *achr = "+-_."; // these are accepted characters char buf[128]; int Y = VToR(CP.Row); PELine L = RLine(Y); int P; P = CharOffset(L, CP.Col); // fix \b for the case of CATBS for(int i = 0; i < P; i++) { //printf("%d - %d %d %c %c\n", i, P, L->Chars[i], //L->Chars[i], L->Chars[P]); if ((L->Chars[i] == '\b') && (P < (L->Count - 2))) P += 2; } size_t len = 0; if (P < L->Count) { // To start of word, while ((P > 0) && ((L->Chars[P - 1] == '\b') || isalnum(L->Chars[P - 1]) || (strchr(achr, L->Chars[P - 1]) != NULL))) P--; // '_' for underline is hidden in achr if ((P < (L->Count - 1)) && (L->Chars[P] == '\b')) P++; // To end of word, while ((len < (sizeof(buf) - 1)) && (P < L->Count)) { if (((P + 1) < L->Count) && (L->Chars[P + 1] == '\b')) P += 2; else if (isalnum(L->Chars[P]) || (strchr(achr, L->Chars[P]) != NULL)) buf[len++] = L->Chars[P++]; else break; } } buf[len] = 0; //printf("Word: %s\n", buf); //if (buf[0] == 0) { // Msg(INFO, "No valid word under the cursor."); // return 0; //} return View->SysShowHelp(State, buf[0] ? buf : 0); } int EBuffer::GetStrVar(int var, char *str, size_t buflen) { if (buflen == 0) return 0; //puts("variable EBuffer\x7"); switch (var) { case mvFilePath: //puts("variable FilePath\x7"); strncpy(str, FileName, buflen); str[buflen - 1] = 0; return 1; case mvFileName: JustFileName(FileName, str, buflen); return 1; case mvFileDirectory: JustDirectory(FileName, str, buflen); return 1; case mvFileBaseName: { char buf[MAXPATH]; char *dot, *dot2; JustFileName(FileName, buf, sizeof(buf)); dot = strchr(buf, '.'); while ((dot2 = strchr(dot + 1, '.')) != NULL) dot = dot2; if (dot) *dot = 0; strlcpy(str, buf, buflen); } return 1; case mvFileExtension: { char buf[MAXPATH]; char *dot; JustFileName(FileName, buf, sizeof(buf)); dot = strrchr(buf, '.'); if (dot) strlcpy(str, dot, buflen); else str[0] = 0; } return 1; case mvChar: { PELine L; int P; L = RLine(CP.Row); P = CharOffset(L, CP.Col); strlcpy(str, "", buflen); if (ChClass(L->Chars[P])) { char tmp[2]; // make copy of character tmp[0] = L->Chars[P]; tmp[1] = 0; strlcat(str, tmp, buflen); } } return 1; case mvWord: { PELine L; int P, C; int wordBegin, wordEnd; L = RLine(CP.Row); P = CharOffset(L, CP.Col); strlcpy(str, "", buflen); if (ChClass(L->Chars[P])) { C = ChClassK(L->Chars[P]); // search start of word while ((P>0) && (C == ChClassK(L->Chars[P-1]))) P--; wordBegin = P; // search end of word while ((P< L->Count) && (C == ChClassK(L->Chars[P]))) P++; wordEnd = P; // calculate total length for buffer copy size_t length = wordEnd - wordBegin; if ((length + 1) < buflen) { length++; } else { length = buflen; } // copy word to buffer strlcpy(str, &L->Chars[wordBegin], length); } } return 1; case mvLine: { PELine L; L = RLine(CP.Row); strlcpy(str, "", buflen); if (L->Count > 0) { // calculate total length for buffer copy size_t length = L->Count; if ((length + 1) < buflen) { length++; } else { length = buflen; } // copy word to buffer strlcpy(str, L->Chars, length); } } return 1; case mvFTEVer: strlcpy(str, VERSION, buflen); return 1; } return EModel::GetStrVar(var, str, buflen); } int EBuffer::GetIntVar(int var, int *value) { switch (var) { case mvCurRow: *value = VToR(CP.Row) + 1; return 1; case mvCurCol: *value = CP.Col; return 1; } return EModel::GetIntVar(var, value); } ������������������������������������������������������./src/c_commands.h����������������������������������������������������������������������������������0000644�0001750�0001750�00000053030�11602724002�012711� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_commands.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_COMMANDS_H #define C_COMMANDS_H enum ExCommands { ExNop, ExFail, //<cmd_cursor> Cursor Movement //& <A HREF="modes.html#ms.CursorTroughTabs">CursorTroughTabs</A> ExMoveDown, /// Move cursor to next line. ExMoveUp, /// Move cursor to previous line ExMoveLeft, /// Move cursor to previous column. ExMoveRight, /// Move cursor to next column. ExMovePrev, /// Move cursor to previous character. Moves to end of the previous /// line if cursor is at the beginning of line. ExMoveNext, /// Move cursor to next character. Moves to the beginning of next /// line if cursor is at the end of line. ExMoveWordLeft, /// Move cursor to the beginning of the word on the left. ExMoveWordRight, /// Move cursor to the beginning of the word on the right. ExMoveWordPrev, /// Move cursor to the beginning of the previous word. ExMoveWordNext, /// Move cursor to the beginning of the next word. ExMoveWordEndLeft, /// Move cursor to the end of the previous word. ExMoveWordEndRight, /// Move cursor to the end of the word on the right. ExMoveWordEndPrev, /// Move cursor to the end of the previous word. ExMoveWordEndNext, /// Move cursor to the end of the next word. ExMoveWordOrCapLeft, /// Move cursor to the beginning of the word or capital letter on the right. ExMoveWordOrCapRight, /// Move cursor to the beginning of the word or capital letter on the left. ExMoveWordOrCapPrev, /// Move cursor to the beginning of the previous word or to previous /// capital letter. ExMoveWordOrCapNext, /// Move cursor to the beginning of the next word or to next capital letter. ExMoveWordOrCapEndLeft, /// Move cursor to the end of the word or capitals on the left. ExMoveWordOrCapEndRight, /// Move cursor to the end of the word or capitals on the right. ExMoveWordOrCapEndPrev, /// Move cursor to the end of the previous word or capitals. ExMoveWordOrCapEndNext, /// Move cursor to the end of the next word or capitals. ExMoveLineStart, /// Move cursor to the beginning of line. ExMoveLineEnd, /// Move cursor to the end of line. ExMovePageStart, /// Move cursor to the first line on current page. ExMovePageEnd, /// Move cursor to the last line on currently page. ExMovePageUp, /// Display previous page. ExMovePageDown, /// Display next page. ExMoveFileStart, /// Move cursor to the beginning of file. ExMoveFileEnd, /// Move cursor to the end of file. ExMovePageLeft, /// Scroll horizontally to display page on the left. ExMovePageRight, /// Scroll horizontally to display page on the right. ExMoveBlockStart, /// Move cursor to the beginning of block. ExMoveBlockEnd, /// Move cursor to end beginning of block. ExMoveFirstNonWhite, /// Move cursor to the first non-blank character on line. ExMoveLastNonWhite, /// Move cursor to the last non-blank character on line. ExMovePrevEqualIndent, /// Move cursor to the previous line with equal indentation. ExMoveNextEqualIndent, /// Move cursor to the next line with equal indentation. ExMovePrevTab, /// Move cursor to the previous tab position. ExMoveNextTab, /// Move cursor to the next tab position. ExMoveTabStart, /// When cursor is on the tab characters, moves it to the beginning /// of the tab. ExMoveTabEnd, /// When cursor is on the tab characters, moves it to the end /// of the tab. ExMoveLineTop, /// Scroll the file to make the current line appear on the top of the window. ExMoveLineCenter, /// Scroll the file to make the current line appear on the center of the window. ExMoveLineBottom, /// Scroll the file to make the current line appear on the bottom of the window. ExScrollLeft, /// Scroll screen left. ExScrollRight, /// Scroll screen right. ExScrollDown, /// Scroll screen down. ExScrollUp, /// Scroll screen up. ExMoveFoldTop, /// Move to the beginning of current fold. ExMoveFoldPrev, /// Move to the beginning of previous fold. ExMoveFoldNext, /// Move to the beginning of next fold. ExMoveBeginOrNonWhite, /// Move to beginning of line, or to first non blank character ExMoveBeginLinePageFile, /// Move to the beginning of line. If there already, move to the beginning /// page. If there already, move to the beginning of file. ExMoveEndLinePageFile, /// Move to the end of line. If there already, move to the end /// page. If there already, move to the end of file. ExMoveToLine, /// Move to line number given as argument ExMoveToColumn, /// Move to column given as argument ExMoveSavedPosCol, /// Move to column from saved position ExMoveSavedPosRow, /// Move to line from saved position ExMoveSavedPos, /// Move to saved position ExSavePos, /// Save current cursor position ExMovePrevPos, /// Move to last cursor position // ExCursorPush, // ExCursorPop, //<cmd_delete> Deleting Text ExKillLine, /// Delete current line. If the line is the last line in the file, /// only the text is deleted. ExKillChar, /// Delete character under (after) cursor. ExKillCharPrev, /// Delete character before cursor. ExKillWord, /// Delete the word after cursor. ExKillWordPrev, /// Delete the word before cursor. ExKillWordOrCap, /// Delete word or capitals after cursor. ExKillWordOrCapPrev, /// Delete word or capitals before cursor. ExKillToLineStart, /// Delete characters to the beginning of line. ExKillToLineEnd, /// Delete characters to the end of line. ExKillBlock, /// Delete block. ExKillBlockOrChar, /// If block is marked, delete it, otherwise delete character under cursor. ExKillBlockOrCharPrev, /// If block is marked, delete it, otherwise delete character before cursor. ExDelete, /// Delete character under (after) cursor. //& <A HREF="modes.html#ms.DeleteKillTab">DeleteKillTab</A> //& <A HREF="modes.html#ms.DeleteKillBlock">DeleteKillBlock</A> ExBackSpace, /// Delete character before cursor. //& <A HREF="modes.html#ms.BackSpKillTab">BackSpKillTab</A> //& <A HREF="modes.html#ms.BackSpKillBlock">BackSpKillBlock</A> //<cmd_line> Line Commands ExLineInsert, /// Insert a new line before the current one. ExLineAdd, /// Add a new line after the current one. ExLineSplit, /// Split current line after cursor position ExLineJoin, /// Join current line with next one. If cursor is positioned beyond /// the end of line, the current line is first padded with whitespace. ExLineNew, /// Append a new line and move to the beginning of new line. ExLineIndent, /// Reindent current line. ExLineTrim, /// Trim whitespace at the end of current line. ExLineDuplicate, /// Duplicate the current line. ExLineCenter, /// Center the current line //<cmd_block> Block Commands ExBlockBegin, /// Set block beginning to current position. ExBlockEnd, /// Set block end to current position. ExBlockUnmark, /// Unmark block. ExBlockCut, /// Cut selected block to clipboard. ExBlockCopy, /// Copy selected block to clipboard. ExBlockCutAppend, /// Cut selected block and append it to clipboard. ExBlockCopyAppend, /// Append selected block to clipboard. ExBlockClear, /// Clear selected block ExBlockPaste, /// Paste clipboard to current position. ExBlockKill, /// Delete selected text. ExBlockIndent, /// Indent block by 1 character. ExBlockUnindent, /// Unindent block by 1 character. ExBlockMarkStream, /// Start/stop marking stream block. ExBlockMarkLine, /// Start/stop marking line block. ExBlockMarkColumn, /// Start/stop marking column block. ExBlockExtendBegin, /// Start extending selected block. ExBlockExtendEnd, /// Stop extending selected block. ExBlockReIndent, /// Reindent entire block (C/REXX mode) ExBlockSelectWord, /// Select word under cursor as block. ExBlockSelectLine, /// Select current line as block. ExBlockSelectPara, /// Select current paragraph (delimited by blank lines) as block. ExBlockPasteStream, /// Paste clipboard to current position as stream block. ExBlockPasteLine, /// Paste clipboard to current position as line block. ExBlockPasteColumn, /// Paste clipboard to current position as column block. ExBlockPrint, /// Print a block to configured device. ExBlockRead, /// Read block from file. ExBlockReadStream, /// Read block from file as stream block ExBlockReadLine, /// Read block from file as line block ExBlockReadColumn, /// Read block from file as column block ExBlockWrite, /// Write marked block to file. ExBlockSort, /// Sorts the marked block in ascending order. /// //\ If mode setting MatchCase is set, characters will be compared case //\ sensitively. /// //\ When block is marked in <A HREF="modes.html#ec.BlockMarkStream"> //\ Stream</A> or <A HREF="#ec.BlockMarkLine">Line</A> mode, //\ the entire lines in marked block will be compared. /// //\ When block is marked in <A HREF="#ec.BlockMarkColumn">Column</A> //\ mode, only characters within marked columns will be compared. ExBlockSortReverse, /// Sorts the marked block in descending order. //^ <A HREF="#ec.BlockSort">BlockSort</A> ExBlockUnTab, /// Remove tabs from marked lines. ExBlockEnTab, /// Generate and optimize tabs in marked lines. ExBlockMarkFunction, /// Mark current function as block. ExBlockTrim, /// Trim end-of-line whitespace //<cmd_edit> Text Editing and Insertion ExUndo, /// Undo last operation ExRedo, /// Redo last undone operation. //<cmd_fold> Folding Text ExFoldCreate, /// Create fold ExFoldCreateByRegexp, /// Create folds at lines matching a regular expression ExFoldCreateAtRoutines, /// Create folds at lines matching RoutineRx ExFoldDestroy, /// Destroy fold at current line ExFoldDestroyAll, /// Destroy all folds in the file ExFoldPromote, /// Promote fold to outer level ExFoldDemote, /// Demote fold to inner level ExFoldOpen, /// Open fold at current line ExFoldOpenNested, /// Open fold and nested folds ExFoldClose, /// Close current fold ExFoldOpenAll, /// Open all folds in the file ExFoldCloseAll, /// Close all folds in the file ExFoldToggleOpenClose, /// Toggle open/close current fold. //<cmd_bookmark>Bookmarks ExPlaceBookmark, /// Place a file-local bookmark. ExRemoveBookmark, /// Place a file-local bookmark. ExGotoBookmark, /// Go to file-local bookmark location. ExPlaceGlobalBookmark, /// Place global (persistent) bookmark. ExRemoveGlobalBookmark, /// Remove global bookmark. ExGotoGlobalBookmark, /// Go to global bookmark location. ExPushGlobalBookmark, /// Push global bookmark (named as #<num>) to stack. ExPopGlobalBookmark, /// Pop global bookmark from stack. //<cmd_trans> Character Translation ExCharCaseUp, /// Convert current character to uppercase ExCharCaseDown, /// Convert current character to lowercase ExCharCaseToggle, /// Toggle case of current character ExCharTrans, /// Translate current character (like perl/sed) ExLineCaseUp, /// Convert current line to uppercase ExLineCaseDown, /// Convert current line to lowercase ExLineCaseToggle, /// Toggle case of current line ExLineTrans, /// Translate characters on current line ExBlockCaseUp, /// Convert characters in selected block to uppercase ExBlockCaseDown, /// Convert characters in selected block to lowercase ExBlockCaseToggle, /// Toggle case of characters in selected block ExBlockTrans, /// Translate characters in selected block. ExInsertString, /// Insert argument string at cursor position ExInsertSpace, /// Insert space ExInsertChar, /// Insert character argument at cursor position ExTypeChar, /// Insert character at cursor position (expanding abbreviations) ExInsertTab, /// Insert tab character at cursor position ExInsertSpacesToTab, /// Insert appropriate number of spaces to simulate a tab. ExSelfInsert, /// Insert typed character ExWrapPara, /// Wrap current paragraph ExInsPrevLineChar, /// Insert character in previous line above cursor ExInsPrevLineToEol, /// Insert previous line from cursor to end of line ExCompleteWord, /// Complete current word to last word starting with the /// same prefix. ExFilePrev, /// Switch to previous file in ring. ExFileNext, /// Switch to next file in ring. ExFileLast, /// Exchange last two files in ring. ExSwitchTo, /// Switch to numbered buffer given as argument //<cmd_file> File Commands ExFileOpen, /// Open file ExFileOpenInMode, /// Open file in specified mode ExFileReload, /// Reload current file ExFileSave, /// Save current file ExFileSaveAll, /// Save all modified files ExFileSaveAs, /// Rename Save current file ExFileWriteTo, /// Write current file into another file ExFilePrint, /// Print current file ExFileClose, /// Close current file ExFileCloseAll, /// Close all open files ExFileTrim, /// Trim end-of-line whitespace //<cmd_directory> Directory Commands ExDirOpen, /// Open directory browser ExDirGoUp, /// Change to parent directory ExDirGoDown, /// Change to currently selected directory ExDirGoRoot, /// Change to root directory ExDirGoto, /// Change to directory given as argument ExDirSearchCancel, /// Cancel search ExDirSearchNext, /// Find next matching file ExDirSearchPrev, /// Find previous matching file //<cmd_search> Search and Replace ExIncrementalSearch, /// Incremental search ExFind, /// Find ExFindReplace, /// Find and replace ExFindRepeat, /// Repeat last find/replace operation ExFindRepeatOnce, /// Repeat last find/replace operation only once ExFindRepeatReverse, /// Repeat last find/replace operation in reverse ExMatchBracket, /// Find matching bracket ([{<>}]) ExHilitWord, /// Highlight current word everywhere in the file ExSearchWordPrev, /// Search for previous occurence of word under cursor ExSearchWordNext, /// Search for next occurence of word under cursor ExHilitMatchBracket, /// Highlight matching bracket ExSearch, ExSearchB, ExSearchRx, ExSearchAgain, ExSearchAgainB, ExSearchReplace, ExSearchReplaceB, ExSearchReplaceRx, //<cmd_window> Window Commands ExWinHSplit, /// Split window horizontally ExWinNext, /// Switch to next (bottom) window ExWinPrev, /// Switcn to previous (top) window. ExWinClose, /// Close current window ExWinZoom, /// Delete all windows except for current one ExWinResize, /// Resize current window (+n,-n given as argument) ExViewBuffers, /// View currently open buffers ExListRoutines, /// Display routines in current source file ExExitEditor, /// Exit FTE. ExShowEntryScreen, /// View external program output if available //<cmd_compile> Compiler Support ExCompile, /// Ask for compile command and run compiler ExRunCompiler, /// Run configured compile command ExViewMessages, /// View compiler output ExCompileNextError, /// Switch to next compiler error ExCompilePrevError, /// Switch to previous compiler error ExRunProgram, /// Run external program //<cmd_cvs> CVS Support ExCvs, /// Ask for CVS options and run CVS ExRunCvs, /// Run configured CVS command ExViewCvs, /// View CVS output ExClearCvsMessages, /// Clear CVS messages ExCvsDiff, /// Ask for CVS diff options and run CVS ExRunCvsDiff, /// Run configured CVS diff command ExViewCvsDiff, /// View CVS diff output ExCvsCommit, /// Ask for CVS commit options and run CVS ExRunCvsCommit, /// Run configured CVS commit command ExViewCvsLog, /// View CVS log //<cmd_svn> SVN Support ExSvn, /// Ask for SVN options and run SVN ExRunSvn, /// Run configured SVN command ExViewSvn, /// View SVN output ExClearSvnMessages, /// Clear SVN messages ExSvnDiff, /// Ask for SVN diff options and run SVN ExRunSvnDiff, /// Run configured SVN diff command ExViewSvnDiff, /// View SVN diff output ExSvnCommit, /// Ask for SVN commit options and run SVN ExRunSvnCommit, /// Run configured SVN commit command ExViewSvnLog, /// View SVN log //<cmd_tags> TAGS Commands /// fte supports TAGS files generated by programs like ctags. ExTagFind, /// Find word argumen in tag files. ExTagFindWord, /// Find word under cursor in tag files. ExTagNext, /// Switch to next occurance of tag ExTagPrev, /// Switch to previous occurance of tag ExTagPop, /// Pop saved position from tag stack ExTagLoad, /// Load tag file and merge with current tags ExTagClear, /// Clear loaded tags ExTagGoto, /// //<cmd_option> Option commands ExToggleAutoIndent, /// ExToggleInsert, /// ExToggleExpandTabs, /// ExToggleShowTabs, /// ExToggleUndo, /// ExToggleReadOnly, /// ExToggleKeepBackups, /// ExToggleMatchCase, /// ExToggleBackSpKillTab, /// ExToggleDeleteKillTab, /// ExToggleSpaceTabs, /// ExToggleIndentWithTabs, /// ExToggleBackSpUnindents, /// ExToggleWordWrap, /// ExToggleTrim, /// ExToggleShowMarkers, /// ExToggleHilitTags, /// ExToggleShowBookmarks, /// ExToggleMakeBackups, /// ExSetLeftMargin, /// ExSetRightMargin, /// ExToggleSysClipboard, /// ExSetPrintDevice, /// ExChangeTabSize, /// ExChangeLeftMargin, /// ExChangeRightMargin, /// //<cmd_other> Other commands ExShowPosition, /// Show internal position information on status line ExShowVersion, /// Show editor version information ExShowKey, /// Wait for keypress and display modifiers+key pressed ExWinRefresh, /// Refresh display ExMainMenu, /// Activate main menu ExShowMenu, /// Popup menu specified as argument ExLocalMenu, /// Popup context menu ExChangeMode, /// Change active mode for current buffer ExChangeKeys, /// Change keybindings for current buffer ExChangeFlags, /// Change option flags for current buffer ExCancel, /// ExActivate, /// ExRescan, /// ExCloseActivate, /// ExActivateInOtherWindow, /// ExDeleteFile, /// ExASCIITable, /// Display ASCII selector in status line. ExDesktopSave, /// Save desktop ExClipClear, /// Clear clipboard ExDesktopSaveAs, /// Save desktop under a new name ExChildClose, /// ExBufListFileSave, /// Save currently selected file in buffer list ExBufListFileClose, /// Close currently selected file in buffer list ExBufListSearchCancel, /// Cancel search ExBufListSearchNext, /// Next match in search ExBufListSearchPrev, /// Previous match in search ExViewModeMap, /// View current mode keybindings ExClearMessages, /// Clear compiler messages ExIndentFunction, /// Indent current function ExMoveFunctionPrev, /// Move cursor to previous function ExMoveFunctionNext, /// Move cursor to next function ExInsertDate, /// Insert date at cursor ExInsertUid, /// Insert user name at cursor ExFrameNew, /// ExFrameClose, /// ExFrameNext, /// ExFramePrev, /// ExBufferViewNext, /// ExBufferViewPrev, /// ExShowHelpWord, /// Show context help on keyword. ExShowHelp, /// Show help for FTE. ExConfigRecompile, /// Recompile editor configuration ExSetCIndentStyle, /// Set C indentation style parameters /// Has the following parameters: /// /// C_Indent = 4; /// C_BraceOfs = 0; /// C_ParenDelta = -1; /// C_CaseOfs = 0; /// C_CaseDelta = 4; /// C_ClassOfs = 0; /// C_ClassDelta = 4; /// C_ColonOfs = -4; /// C_CommentOfs = 0; /// C_CommentDelta = 1; /// C_FirstLevelWidth = -1; /// C_FirstLevelIndent = 4; /// C_Continuation = 4; ExSetIndentWithTabs, /// Set value of indent-with-tabs to argument ExRunProgramAsync, ExListMark, /// Mark single line in list ExListUnmark, /// Unmark single line in list ExListToggleMark, /// Toggle marking of single line in list ExListMarkAll, /// Mark all lines in list ExListUnmarkAll, /// Unmark all lines in list ExListToggleMarkAll, /// Toggle marking of all lines in list ExBlockPasteOver /// Delete content's of selection and paste clipboard to current position }; #endif // C_COMMANDS_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/stl_string.cpp��������������������������������������������������������������������������������0000644�0001750�0001750�00000011036�11344266050�013340� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "stl_fte.h" #ifndef CONFIG_FTE_USE_STL #include <new> #include <ctype.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> FTE_BEGIN_NAMESPACE; /* * Ok I think it's worth to add comment about this g++ feature: * * when we get char* from new and assing it member value - we lose strict-aliasing * property. Thus every write access through str[] basically leads to the necesity of * reread of this member value * * That's why local var is used to manipulate with str */ static char xempty_string[] = ""; // used as empty string - shall never be overwritten char* string::empty_string = xempty_string; string::string(char c) { char* tmp = str = new char[2]; // stored to local value tmp[0] = c; tmp[1] = 0; } string::string(const char* s) { size_type slen = s ? string::slen(s) : 0; if (slen) { char* tmp = str = new char[slen + 1]; tmp[slen] = 0; memcpy(tmp, s, slen); } else str = empty_string; } string::string(const char* s, size_type len) { size_type slen = s ? string::slen(s) : 0; if (slen > len) slen = len; if (slen) { char* tmp = str = new char[len + 1]; tmp[slen] = 0; memcpy(tmp, s, slen); return; } else str = empty_string; } string::string(const string& s) { size_type slen = s.size(); if (slen) { char* tmp = str = new char[slen + 1]; tmp[slen] = 0; memcpy(tmp, s.str, slen); } else str = empty_string; } string::string(const string& s, size_type len) { size_type slen = s.size(); if (slen > len) slen = len; if (slen) { char* tmp = str = new char[slen + 1]; tmp[slen] = 0; memcpy(tmp, s.str, slen); } else str = empty_string; } string::string(const char* s1, size_type sz1, const char* s2, size_type sz2) : str(new char[sz1 + ++sz2]) { memcpy(str, s1, sz1); memcpy(str + sz1, s2, sz2); } string::~string() { if (str != empty_string) delete[] str; } string string::operator+(char c) const { return string(*this) += c; } string string::operator+(const char* s) const { return string(*this) += s; } string string::operator+(const string& s) const { return string(*this) += s; } string& string::operator=(char c) { string tmp(c); swap(tmp); return *this; } string& string::operator=(const char* s) { string tmp(s); swap(tmp); return *this; } bool string::operator==(const char* s) const { return (s) ? !strcmp(str, s) : empty(); } bool string::operator<(const string& s) const { return (strcmp(str, s.str)<0); } string& string::append(char c) { char s[2] = { c, 0 }; string tmp(str, size(), s, 1); swap(tmp); return *this; } string& string::append(const char* s) { if (s) { string tmp(str, size(), s, slen(s)); swap(tmp); } return *this; } string& string::erase(size_type pos, size_type n) { char* p = str + pos; if (n != npos && n > 0) { // add check for size() ??? for (char* i = p + n; *i; ++i) *p++ = *i; } if (p != str) *p = 0; else clear(); return *this; } string::size_type string::find(const string& s, size_type startpos) const { const char* p = strstr(str + startpos, s.str); return (p) ? p - str : npos; } string::size_type string::find(char c) const { const char* p = strchr(str, c); return (p) ? p - str : npos; } string::size_type string::rfind(char c) const { const char* p = strrchr(str, c); return (p) ? p - str : npos; } void string::insert(size_type pos, const string& s) { size_type k = size(); size_type l = s.size(); char* p = new char[k + l + 1]; if (pos > k) pos = k; memcpy(p, str, pos); memcpy(p + pos, s.str, l); memcpy(p + pos + l, str + pos, k - pos + 1); if (str != empty_string) delete[] str; str = p; } int string::sprintf(const char* fmt, ...) { int r; va_list ap; va_start(ap, fmt); #ifdef _GNU_SOURCE char* s = 0; r = vasprintf(&s, fmt, ap); #else // a bit poor hack but should be sufficient // eventually write full implementation char s[1000]; r = vsnprintf(s, sizeof(s), fmt, ap); #endif va_end(ap); if (s && r > 0) { string tmp(s, r); swap(tmp); } else { string tmp; swap(tmp); r = 0; } #ifdef _GNU_SOURCE free(s); #endif return r; } string& string::tolower() { for (char *p = str; *p; p++) *p = (char)::tolower(*p); return *this; } string& string::toupper() { for (char *p = str; *p; p++) *p = (char)::toupper(*p); return *this; } FTE_END_NAMESPACE; #endif // CONFIG_FTE_USE_STL ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_key.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000001360�11344266047�012255� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_key.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_key.h" #include "sysdep.h" ExKey::ExKey(const char *APrompt) : Prompt(APrompt) { } ExKey::~ExKey() { } void ExKey::HandleEvent(TEvent &Event) { switch (Event.What) { case evKeyDown: Key = Event.Key.Code; if (!(Key & kfModifier)) // not ctrl,alt,shift, .... EndExec(1); Event.What = evNone; break; } } void ExKey::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); MoveCh(B, ' ', 0x17, W); ConPutBox(0, H - 1, W, 1, B); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_string.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000003454�11331412505�012777� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "s_string.h" #include <string.h> size_t UnTabStr(char *dest, size_t maxlen, const char *source, size_t slen) { const char * const end = dest + maxlen - 1; char *p = dest; unsigned pos = 0; for (unsigned i = 0; p < end && i < slen; ++i) { if (source[i] == '\t') { do { if (p < end) *p++ = ' '; } while (++pos & 0x7); } else { *p++ = source[i]; pos++; } } if (p <= end) *p = '\0'; return pos; } size_t UnEscStr(char *dest, size_t maxlen, const char *source, size_t slen) { const char * const end = dest + maxlen - 1; char *p = dest; for (unsigned i = 0; p < end && i < slen; ++i) { if (source[i] == 0x1B) { // ESC-seq if (++i < slen && (source[i] == '[')) { while (++i < slen && ((source[i] >= '0' && source[i] <= '9') || source[i] == ';')) ; } else *p++ = '^'; } else if (source[i] == (char)0xE2 && (i + 1) < slen && source[i + 1] == (char)0x80) { // Replace localized UTF8 apostrophes used by gcc. *p++ = '\''; i += 2; } else *p++ = source[i]; } if (p <= end) *p = '\0'; return p - dest; } #if !defined(HAVE_STRLCPY) /* returns size of src */ size_t strlcpy(char *dst, const char *src, size_t size) { size_t sz = 0; while (sz < size && (dst[sz] = src[sz])) sz++; if (sz && (sz == size)) dst[sz - 1] = 0; while (src[sz]) sz++; return sz; } #endif // !HAVE_STRLCPY #if !defined(HAVE_STRLCAT) size_t strlcat(char *dst, const char *src, size_t size) { size_t dst_len = strlen(dst); size_t src_len = strlen(src); if (size) { size_t len = (src_len >= size-dst_len) ? (size-dst_len-1) : src_len; memcpy(&dst[dst_len], src, len); dst[dst_len + len] = '\0'; } return dst_len + src_len; } #endif // !HAVE_STRLCAT ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_slang.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000050102�11602724002�013101� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_slang.cpp * * Copyright (c) 1998, István Váradi * Copyright (c) 2010, Zdenek Kabelac * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // to have %PRId64 defined for C++ #define __STDC_FORMAT_MACROS #include "c_config.h" #include "con_tty.h" #include "console.h" #include "gui.h" #include "s_string.h" #include "sysdep.h" //#include "slangkbd.h" //#include <slang/slang.h> #include <slang.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <sys/wait.h> #include <unistd.h> extern TEvent NextEvent; // g_text.cpp /* These characters cannot appear on a console, so we can detect * them in the output routine. */ #define DCH_SLANG_C1 128 #define DCH_SLANG_C2 129 #define DCH_SLANG_C3 130 #define DCH_SLANG_C4 131 #define DCH_SLANG_H 132 #define DCH_SLANG_V 133 #define DCH_SLANG_M1 134 #define DCH_SLANG_M2 135 #define DCH_SLANG_M3 136 #define DCH_SLANG_M4 137 #define DCH_SLANG_X 138 #define DCH_SLANG_RPTR 139 #define DCH_SLANG_EOL 140 #define DCH_SLANG_EOF 141 #define DCH_SLANG_END 142 #define DCH_SLANG_AUP 143 #define DCH_SLANG_ADOWN 144 #define DCH_SLANG_HFORE 145 #define DCH_SLANG_HBACK 146 #define DCH_SLANG_ALEFT 147 #define DCH_SLANG_ARIGHT 148 // i VT // } pound // { PI static const char slang_dchs[] = { 'l', 'k', 'm', 'j', 'q', 'x', 'w', 't', 'u', 'f', 'v', 'n', '~', '`', 'q', '-', '.', ' ', 'a', ',', '+' }; static SLsmg_Char_Type raw_dchs[sizeof(slang_dchs)]; static unsigned char ftesl_get_dch(SLsmg_Char_Type raw) { for (size_t i = 0; i < sizeof(slang_dchs); i++) if (raw_dchs[i].nchars == raw.nchars && !memcmp(raw_dchs[i].wchars, raw.wchars, raw.nchars * sizeof(*raw.wchars))) return (unsigned char)(DCH_SLANG_C1 + i); return DCH_SLANG_EOL; } static const char slang_colors[][14] = { "black", "blue", "green", "cyan", "red", "magenta", "brown", "lightgray", "gray", "brightblue", "brightgreen", "brightcyan", "brightred", "brightmagenta", "yellow", "white", }; static volatile int ScreenSizeChanged; static void sigwinch_handler(int sig) { ScreenSizeChanged = 1; } int ConInit(int /*XSize */ , int /*YSize */ ) { SLtt_get_terminfo(); if ((SLkp_init() == -1) || (SLang_init_tty(0, 1, 1) == -1)) return 0; if (SLsmg_init_smg() == -1) { SLang_reset_tty(); return 0; } SLsignal_intr(SIGWINCH, sigwinch_handler); SLang_set_abort_signal(NULL); SLtty_set_suspend_state(0); /* skip modification of color 0 and 0x7f */ for (unsigned i = 1; i < 127; ++i) SLtt_set_color(i, NULL, const_cast<char *>(slang_colors[i & 0x0f]), const_cast<char *>(slang_colors[(i >> 4) & 0x07])); SLsmg_gotorc(0, 0); SLsmg_set_char_set(1); SLsmg_write_nchars(const_cast<char*>(slang_dchs), sizeof(slang_dchs)); SLsmg_gotorc(0, 0); SLsmg_read_raw(raw_dchs, sizeof(slang_dchs)); SLsmg_set_char_set(0); #ifdef CONFIG_MOUSE SLtt_set_mouse_mode(1, 0); #endif SLtt_flush_output(); //use_esc_hack = (getenv("FTESL_ESC_HACK") != NULL); return 1; } int ConDone() { SLsmg_reset_smg(); SLang_reset_tty(); return 1; } int ConSuspend() { SLsmg_suspend_smg(); SLang_reset_tty(); return 1; } int ConContinue() { SLang_init_tty(-1, 0, 1); SLsmg_resume_smg(); return 1; } int ConSetTitle(const char * /*Title */ , const char * /*STitle */ ) { return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, "", MaxLen); strlcpy(STitle, "", SMaxLen); return 1; } int ConClear() { SLsmg_cls(); SLsmg_refresh(); return 1; } static void fte_write_color_chars(PCell Cell, int W) { int chset = 0, chsetprev = 2; unsigned char ch, col = 0, colprev = 0x80; char buf[256]; while (W > 0) { int i; for (i = 0; i < W && i < (int)sizeof(buf); ++i) { ch = Cell[i].GetChar(); col = Cell[i].GetAttr() & 0x7f; //fprintf(stderr, "W: %d i:%d ch: %d %c col: %2x / %2x\n", W, i, ch, ch, col, Cell[i].GetAttr() & 0x7f); if (ch <= 127 || ch >= 0xa0) { buf[i] = (ch < 32) ? '.' : (char)ch; chset = 0; } else { buf[i] = slang_dchs[ch - 128]; chset = 1; } if (col != colprev || chset != chsetprev) break; } if (i > 0) { SLsmg_write_nchars(buf, i); W -= i; Cell += i; } if (col != colprev) { SLsmg_set_color(col); colprev = col; } if (chset != chsetprev) { SLsmg_set_char_set(chset); chsetprev = chset; } } } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int CurX, CurY; ConQueryCursorPos(&CurX, &CurY); for (;H > 0; Cell += W, --H) { SLsmg_gotorc(Y++, X); fte_write_color_chars(Cell, W); } ConSetCursorPos(CurX, CurY); return 1; } static int ConPutBoxRaw(int X, int Y, int W, int H, SLsmg_Char_Type *box) { int CurX, CurY; ConQueryCursorPos(&CurX, &CurY); for (;H > 0; box += W, --H) { SLsmg_gotorc(Y++, X); SLsmg_write_raw(box, W); } ConSetCursorPos(CurX, CurY); return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int CurX, CurY, i; SLsmg_Char_Type linebuf[W]; ConQueryCursorPos(&CurX, &CurY); for (;H > 0; Cell += W, --H) { SLsmg_gotorc(Y++, X); SLsmg_read_raw(linebuf, W); for (i = 0; i < W; i++) { if (linebuf[i].color & SLSMG_ACS_MASK) Cell[i].SetChar(ftesl_get_dch(linebuf[i])); else /* * FIXME: Handle UTF-8 -- way beyond a quick-and-dirty * fix. --MV */ Cell[i].SetChar((char)SLSMG_EXTRACT_CHAR(linebuf[i])); /* * FIXME: This preserves only 7 out of 15 bits of color. * Fortunately, we're dealing with color handles rather than * colors themselves -- S-Lang jumps through an extra hoop to * map these to color data. As long as we use less than 127 * different colors, things should be OK. I think. --MV */ Cell[i].SetAttr(linebuf[i].color & 0x7f); } } ConSetCursorPos(CurX, CurY); return 1; } static int ConGetBoxRaw(int X, int Y, int W, int H, SLsmg_Char_Type *box) { int CurX, CurY; ConQueryCursorPos(&CurX, &CurY); for (;H > 0; box += W, --H) { SLsmg_gotorc(Y++, X); SLsmg_read_raw(box, W); } ConSetCursorPos(CurX, CurY); return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int CurX, CurY; ConQueryCursorPos(&CurX, &CurY); for (;H > 0; --H) { SLsmg_gotorc(Y++, X); fte_write_color_chars(Cell, W); } ConSetCursorPos(CurX, CurY); return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TCell line[W]; for (int i = 0; i < W; i++) line[i] = Cell; ConPutLine(X, Y, W, H, line); return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { SLsmg_Char_Type box[W * H]; TCell fill(' ', Fill); ConGetBoxRaw(X, Y, W, H, box); if (Way == csUp) { ConPutBoxRaw(X, Y, W, H - Count, box + W * Count); //ConSetBox(X, Y + H - Count, W, Count, fill); } else { ConPutBoxRaw(X, Y + Count, W, H - Count, box); //ConSetBox(X, Y, W, Count, fill); } return 1; } int ConSetSize(int /*X */ , int /*Y */ ) { return 0; } int ConQuerySize(int *X, int *Y) { *X = SLtt_Screen_Cols; *Y = SLtt_Screen_Rows; return 1; } int ConSetCursorPos(int X, int Y) { SLsmg_gotorc(Y, X); SLsmg_refresh(); return 1; } int ConQueryCursorPos(int *X, int *Y) { *X = SLsmg_get_column(); *Y = SLsmg_get_row(); return 1; } static int CurVis = 1; int ConShowCursor() { CurVis = 1; SLtt_set_cursor_visibility(1); return 1; } int ConHideCursor() { CurVis = 0; SLtt_set_cursor_visibility(0); return 1; } int ConCursorVisible() { return CurVis; } int ConSetCursorSize(int /*Start */ , int /*End */ ) { return 1; } int ConSetMousePos(int /*X */ , int /*Y */ ) { return 0; } int ConQueryMousePos(int *X, int *Y) { *X = 0; *Y = 0; return 1; } int ConShowMouse() { return 0; } int ConHideMouse() { return 0; } int ConMouseVisible() { return 1; } int ConQueryMouseButtons(int *ButtonCount) { *ButtonCount = 0; return 1; } static int getkey(int tsecs) { int key; if (SLang_input_pending(tsecs) > 0) { key = SLang_getkey(); //fprintf(stderr, "readkey 0x%2x %d %c\n", key, key, isprint(key) ? key : ' '); } else key = 0; return key; } static int parseEsc(TEvent *Event) { int key = getkey(0); char seq[8] = { (char)key, 0 }; unsigned seqpos = 1; if ((key < 'a' && key) || key > 'z') { /* read whole Esc sequence */ while (seqpos < 7 && (seq[seqpos] = (char)getkey(0))) { if ((unsigned char)seq[seqpos] < ' ') { SLang_ungetkey((unsigned char)seq[seqpos]); break; } seqpos++; } seq[seqpos] = 0; } //if (seqpos > 1) fprintf(stderr, "Seq: %d %s\n", seqpos, seq); if (seqpos == 5 && seq[0] == '[' && seq[1] == 'M') { #ifdef CONFIG_MOUSE // FIXME: hardcoded timeouts static const int64_t timeout[] = { 300000,// 300ms double 500000,// 500ms tripple 700000,// 700ms 4 clicks 900000 // 900ms 5 clicks }; static int64_t time_prev[FTE_ARRAY_SIZE(timeout)]; struct timeval tv; gettimeofday(&tv, NULL); int64_t time_new = tv.tv_sec * 1000000 + tv.tv_usec; // only mouse clicks are reported Event->Mouse.What = evMouseDown; Event->Mouse.X = (unsigned char)seq[3] - 33; Event->Mouse.Y = (unsigned char)seq[4] - 33; Event->Mouse.Buttons = (seq[2] == 32) ? 1 : (seq[2] == 33) ? 4 : 2; // FIXME: this code should be moved to upper layer // detect 2,3,4 mouse clicks Event->Mouse.Count = 1; for (size_t i = 0; i < FTE_ARRAY_SIZE(timeout) && ((time_new - time_prev[i]) < timeout[i]); ++i) Event->Mouse.Count++; for (size_t i = FTE_ARRAY_SIZE(timeout); --i > 0;) time_prev[i] = time_prev[i - 1]; time_prev[0] = time_new; //fprintf(stderr, "B:%2d:%d X:%3d Y:%3d Time %"PRId64 "\n", // Event->Mouse.Buttons, Event->Mouse.Count, Event->Mouse.X, Event->Mouse.Y, time_new); if (seq[2] & 0x40) { Event->What = evCommand; Event->Msg.Param1 = 10; Event->Msg.Command = (seq[2] & 1) ? cmVScrollDown : cmVScrollUp; } else { NextEvent = *Event; NextEvent.Mouse.What = evMouseUp; } #endif // CONFIG_MOUSE return 1; } return TTYParseEsc(seq); } static TEvent Prev = { evNone }; int ConGetEvent(TEventMask /*EventMask */ , TEvent * Event, int WaitTime, int Delete) { TKeyEvent& KEvent = Event->Key; int key; if (ScreenSizeChanged) { ScreenSizeChanged = 0; SLtt_get_screen_size(); SLsmg_reinit_smg(); Event->What = evCommand; Event->Msg.Command = cmResize; return 1; } if (Prev.What != evNone) { *Event = Prev; if (Delete) Prev.What = evNone; return 1; } WaitTime = (WaitTime >= 0) ? WaitTime / 100 : 36000; switch (WaitFdPipeEvent(Event, STDIN_FILENO, -1, WaitTime)) { case FD_PIPE_1: break; default: return 0; } Event->What = evKeyDown; key = getkey(0); if (isupper(key)) key = kfShift | key; else if (key < 32) { switch (key) { case 0: Event->What = evNone; return -1; case 8: key = kbBackSp; break; case '\t': key = kbTab; break; case '\r': case '\n': key = kbEnter; break; case 27: // Esc key = parseEsc(Event); break; default: key = kfCtrl | (key + 'A' - 1); } } else if (key == 127) key = kbBackSp; else if (key > 255) key = kbEsc; if (Event->What == evKeyDown) { KEvent.Code = key; //fprintf(stderr, "KEY %x \n", key); if (!Delete) Prev = *Event; } return 1; } int ConPutEvent(const TEvent& Event) { Prev = Event; return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; if (TTYInitTable() == 0) { ::ConInit(-1, -1); ::ConSetSize(XSize, YSize); gui = this; } } GUI::~GUI() { ::ConDone(); gui = 0; } int GUI::ConSuspend() { return::ConSuspend(); } int GUI::ConContinue() { return::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } int GUI::RunProgram(int /*mode */ , char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv("SHELL"); rc = system(Command); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) frames->Resize(W1, H1); frames->Repaint(); return rc; } char ConGetDrawChar(unsigned int idx) { static const unsigned char tab[] = { DCH_SLANG_C1, DCH_SLANG_C2, DCH_SLANG_C3, DCH_SLANG_C4, DCH_SLANG_H, DCH_SLANG_V, DCH_SLANG_M1, DCH_SLANG_M2, DCH_SLANG_M3, DCH_SLANG_M4, DCH_SLANG_X, '>', // DCH_SLANG_RPTR DCH_SLANG_EOL, DCH_SLANG_EOF, DCH_SLANG_END, DCH_SLANG_AUP, DCH_SLANG_ADOWN, DCH_SLANG_HFORE, DCH_SLANG_HBACK, DCH_SLANG_ALEFT, DCH_SLANG_ARIGHT }; static const unsigned char tab_linux[] = { DCH_SLANG_C1, DCH_SLANG_C2, DCH_SLANG_C3, DCH_SLANG_C4, DCH_SLANG_H, DCH_SLANG_V, DCH_SLANG_M1, DCH_SLANG_M2, DCH_SLANG_M3, DCH_SLANG_M4, DCH_SLANG_X, '>', '.', DCH_SLANG_EOF, DCH_SLANG_END, DCH_SLANG_AUP, DCH_SLANG_ADOWN, DCH_SLANG_HFORE, DCH_SLANG_HBACK, DCH_SLANG_ALEFT, DCH_SLANG_ARIGHT }; #if 0 static const unsigned char tab[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q' }; #endif static const char *use_tab; static size_t use_tab_size; if (!use_tab) { const char *c = getenv("TERM"); use_tab = (const char*) ((!c || strcmp(c, "linux") != 0) ? tab : tab_linux); use_tab = GetGUICharacters("Slang", use_tab); use_tab_size = strlen(use_tab); } assert(idx < use_tab_size); return use_tab[idx]; } /* * Code bellow is no longer needed * - will be removed in future */ #if 0 if (SLang_input_pending(0) > 0) { TKeyCode kcode = 0, kcode1; key = SLang_getkey(); int escfirst = 1; if (key == 27) while (1) { if (use_esc_hack) { if (SLang_input_pending(1) == 0) { kcode = kbEsc; break; } } key = SLang_getkey(); if (key == 3) { SLang_ungetkey((unsigned char)key); SLkp_getkey(); } if (key >= 'a' && key <= 'z') key -= 'a' - 'A'; if (key == 27) { kcode = kbEsc; break; } else if (key == '[' && escfirst) { unsigned char kbuf[2]; kbuf[0] = 27; kbuf[1] = (char) key; SLang_ungetkey_string(kbuf, 2); key = SLkp_getkey(); if (key == 0xFFFF) { if (SLang_input_pending(0) == 0) { /* * SLang got an unknown key and ate it. * beep and bonk out. */ SLtt_beep(); return -1; } /* * SLang encountered an unknown key sequence, so we * try to parse the sequence one by one and thus * enable the user to configure a binding for it */ key = SLang_getkey(); if (key != 27) { SLtt_beep(); SLang_flush_input(); return -1; } } kcode = ftesl_process_key(key, 0); break; } else { kcode1 = ftesl_process_key(key, 1); if (keyCode(kcode1) == kbF1) { key = SLang_getkey(); switch (key) { case '0': kcode |= kbF10; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': kcode |= kbF1 + key - '1'; break; case 'a': case 'b': kcode |= kbF11 + key - 'a'; break; } } else kcode |= kcode1; if (keyCode(kcode) != 0) { if (escfirst) kcode |= kfAlt; break; } } escfirst = 0; } else { SLang_ungetkey((unsigned char)key); key = SLkp_getkey(); kcode = ftesl_process_key(key, 0); } Event->What = evKeyDown; KEvent->Code = kcode; if (!Delete) Prev = *Event; return 1; } return -1; #endif #if 0 /* * Definitions for keyboard handling under SLang. */ #define FTESL_KEY 0x00001000 // A key defined by me #define FTESL_KEY_SHIFT 0x00002000 // Key with Shift #define FTESL_KEY_CTRL 0x00004000 // Key with Ctrl #define FTESL_KEY_ALT 0x00008000 // Key with Alt #define FTESL_KEY_GRAY 0x00010000 // Gray Key #define FTESL_KEY_ENTER 13 #define FTESL_KEY_TAB 9 #define FTESL_KEY_ESC 27 #define FTESL_KEY_BACKSP 8 #define FTESL_KEY_CTRLAND(x) (x+1-'a') static int use_esc_hack = 0; static const TKeyCode speckeys[] = { kbF1, kbF2, kbF3, kbF4, kbF5, kbF6, kbF7, kbF8, kbF9, kbF10, kbF11, kbF12, kbHome, kbEnd, kbPgUp, kbPgDn, kbIns, kbDel, kbUp, kbDown, kbLeft, kbRight, kbEnter, kbEsc, kbBackSp, kbSpace, kbTab, kbCenter, }; /* static int ftesl_getkeysym(TKeyCode keycode) { unsigned key = keyCode(keycode); int ksym = -1; for (unsigned i = 0; i < sizeof(speckeys) / sizeof(TKeyCode); i++) { if (key == speckeys[i]) { ksym = (int) i; break; } } if (ksym < 0 && key < 256) { ksym = (int) key; } if (ksym < 0) return ksym; if (keycode & kfAlt) ksym |= FTESL_KEY_ALT; if (keycode & kfCtrl) ksym |= FTESL_KEY_CTRL; if (keycode & kfShift) ksym |= FTESL_KEY_SHIFT; if (keycode & kfGray) ksym |= FTESL_KEY_GRAY; ksym |= FTESL_KEY; return ksym; } */ static const TKeyCode keys_ctrlhack[] = { kfAlt, // A kbHome, // B kfCtrl, kbDown, kbEnd, kbF1, kfCtrl | 'G', kbBackSp, kbTab, kfCtrl | 'J', kfCtrl | 'K', kbLeft, kbEnter, kbPgDn, kfCtrl | 'O', kbPgUp, kbIns, kbRight, kfShift, kfCtrl | 'T', kbUp, kfCtrl | 'V', kfCtrl | 'W', kbCenter, kfCtrl | 'Y', kbDel, kbEsc, kbCtrl | '\\', kbCtrl | ']', kbCtrl | '^', kbCtrl | '_' }; static TKeyCode ftesl_getftekey(unsigned char key) { if (key < 32) return speckeys[key]; else return (TKeyCode) key; } /* * Keyboard handling with SLang. */ static TKeyCode ftesl_process_key(int key, int ctrlhack = 0) { TKeyCode kcode; //fprintf(stderr, "KEY %03d \n", key); if (key < 256 && key >= 32) { return (TKeyCode) key; } else if (key >= 1 && key <= 31 && key != 13 && key != 9 && key != 8 && key != 27) { if (!ctrlhack) return ((key + 'A' - 1) & 0xff) | kfCtrl; else return keys_ctrlhack[key - 1]; } else if (key & FTESL_KEY) { kcode = ftesl_getftekey((unsigned char)key); if (key & FTESL_KEY_SHIFT) kcode |= kfShift; if (key & FTESL_KEY_CTRL) kcode |= kfCtrl; if (key & FTESL_KEY_ALT) kcode |= kfAlt; if (key & FTESL_KEY_GRAY) kcode |= kfGray; return kcode; } else switch (key) { case SL_KEY_UP: return kbUp; case SL_KEY_DOWN: return kbDown; case SL_KEY_LEFT: return kbLeft; case SL_KEY_RIGHT: return kbRight; case SL_KEY_PPAGE: return kbPgUp; case SL_KEY_NPAGE: return kbPgDn; case SL_KEY_HOME: return kbHome; case SL_KEY_END: return kbEnd; case SL_KEY_BACKSPACE: case FTESL_KEY_BACKSP: return kbBackSp; case SL_KEY_ENTER: case FTESL_KEY_ENTER: return kbEnter; case SL_KEY_IC: return kbIns; case SL_KEY_DELETE: return kbDel; case SL_KEY_F(1): return kbF1; case SL_KEY_F(2): return kbF2; case SL_KEY_F(3): return kbF3; case SL_KEY_F(4): return kbF4; case SL_KEY_F(5): return kbF5; case SL_KEY_F(6): return kbF6; case SL_KEY_F(7): return kbF7; case SL_KEY_F(8): return kbF8; case SL_KEY_F(9): return kbF9; case SL_KEY_F(10): return kbF10; case SL_KEY_F(11): return kbF11; case SL_KEY_F(12): return kbF12; case FTESL_KEY_TAB: return kbTab; case FTESL_KEY_ESC: case SL_KEY_ERR: return kbEsc; default: return '?'; } } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_util.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000001503�11331412506�012105� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* s_util.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef S_UTIL_H #define S_UTIL_H #include "fte.h" #include <sys/types.h> #define USE_CtrlEnter 1 enum { S_BUSY, S_INFO, S_BOLD, S_ERROR }; class EView; class EBuffer; class EModel; char* MakeBackup(const char *FileName, char *NewName); int GetPMClip(int clipboard); int PutPMClip(int clipboard); int FileLoad(int createFlags, const char *FileName, const char *Mode, EView *View); int MultiFileLoad(int createFlags, const char *FileName, const char *Mode, EView *View); int SetDefaultDirectory(EModel *M); int GetDefaultDirectory(EModel *M, char *Path, size_t MaxLen); #endif // S_UTIL_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_oview.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000004716�11602724002�012611� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_oview.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_view.h" ExView::ExView() : Win(0), Next(0) { } ExView::~ExView() { } void ExView::Activate(int /*gotfocus*/) { } int ExView::IsActive() { return (Win) ? Win->IsActive() : 0; } int ExView::GetContext() { return CONTEXT_NONE; } ExView *ExView::GetViewContext() { return this; } ExView *ExView::GetStatusContext() { return this; } EEventMap *ExView::GetEventMap() { return 0; } int ExView::ExecCommand(ExCommands /*Command*/, ExState &/*State*/) { return 0; } int ExView::BeginMacro() { return 1; } void ExView::HandleEvent(TEvent &Event) { if (Event.What == evKeyDown && kbCode(Event.Key.Code) == kbF12) Win->Parent->SelectNext(0); } void ExView::EndExec(int NewResult) { if (Win->Result == -2) { // hack Win->EndExec(NewResult); } else { if (Next) delete Win->PopView(); // self } } void ExView::UpdateView() { } void ExView::UpdateStatus() { } void ExView::RepaintView() { } void ExView::RepaintStatus() { } void ExView::Repaint() { RepaintStatus(); RepaintView(); } void ExView::Update() { UpdateStatus(); UpdateView(); } void ExView::Resize(int /*width*/, int /*height*/) { Repaint(); } int ExView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return (Win) ? Win->ConPutBox(X, Y, W, H, Cell) : -1; } int ExView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return (Win) ? Win->ConScroll(Way, X, Y, W, H, Fill, Count) : -1; } int ExView::ConQuerySize(int *X, int *Y) { return (Win) ? Win->ConQuerySize(X, Y) : -1; } int ExView::ConSetCursorPos(int X, int Y) { return (Win) ? Win->ConSetCursorPos(X, Y) : -1; } int ExView::ConShowCursor() { return (Win) ? Win->ConShowCursor() : -1; } int ExView::ConHideCursor() { return (Win) ? Win->ConHideCursor() : -1; } int ExView::ConSetCursorSize(int Start, int End) { return (Win) ? Win->ConSetCursorSize(Start, End) : -1; } int ExView::IsModelView() { return 0; } ExView* ExViewNext::GetViewContext() { return Next; } void ExViewNext::RepaintView() { if (Next) Next->RepaintView(); } void ExViewNext::UpdateView() { if (Next) Next->UpdateView(); } void ExViewNext::UpdateStatus() { RepaintStatus(); } ��������������������������������������������������./src/o_model.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000012622�11344266047�012243� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_model.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_MODEL_H #define O_MODEL_H #include "console.h" // TEvent #include "c_commands.h" class EView; class EEventMap; class ExState; class ExModelView; class GxView; class EViewPort { public: EView *View; int ReCenter; EViewPort(EView *V); virtual ~EViewPort(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void GetPos(); virtual void StorePos(); virtual void Resize(int Width, int Height); }; enum createFlags { cfAppend = 1, cfNoActivate = 2 }; class EModel { public: EModel **Root; // root ptr of this list EModel *Next; // next model EModel *Prev; // prev model EView *View; // active view of model int ModelNo; EModel(int createFlags, EModel **ARoot); virtual ~EModel(); void AddView(EView *V); void RemoveView(EView *V); void SelectView(EView *V); virtual EViewPort *CreateViewPort(EView *V); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void GetName(char *AName, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); void UpdateTitle(); void Msg(int level, const char *s, ...); virtual int CanQuit(); virtual int ConfQuit(GxView *V, int multiFile = 0); virtual int GetStrVar(int var, char *str, size_t buflen); virtual int GetIntVar(int var, int *value); virtual void NotifyPipe(int PipeId); virtual void NotifyDelete(EModel *Deleting); virtual void DeleteRelated(); }; class EView { public: EView *Next; // next view EView *Prev; // prev view ExModelView *MView; // model view controller EModel *Model; // model for this view EView *NextView; // next view for model EViewPort *Port; char *CurMsg; EView(EModel *AModel); virtual ~EView(); virtual void FocusChange(int GotFocus); virtual void Resize(int Width, int Height); void SetModel(EModel *AModel); void SelectModel(EModel *AModel); void SwitchToModel(EModel *AModel); void Activate(int GotFocus); virtual int GetContext(); virtual EEventMap *GetEventMap(); virtual int BeginMacro(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); void Msg(int level, const char *s, ...); void SetMsg(const char *msg); int SwitchTo(ExState &State); int FilePrev(); int FileNext(); int FileLast(); int FileSaveAll(); int FileOpen(ExState &State); int FileOpenInMode(ExState &State); int SetPrintDevice(ExState &State); int ToggleSysClipboard(ExState &State); int ShowKey(ExState &State); int ViewBuffers(ExState &State); #ifdef CONFIG_OBJ_ROUTINE int ViewRoutines(ExState &State); #endif #ifdef CONFIG_OBJ_MESSAGES int Compile(ExState &State); int RunCompiler(ExState &State); int Compile(char *Command); int ViewMessages(ExState &State); int CompilePrevError(ExState &State); int CompileNextError(ExState &State); int ConfigRecompile(ExState &State); #endif #ifdef CONFIG_OBJ_CVS int Cvs(ExState &State); int RunCvs(ExState &State); int ViewCvs(ExState &State); int Cvs(char *Options); int ClearCvsMessages(ExState &State); int CvsDiff(ExState &State); int RunCvsDiff(ExState &State); int ViewCvsDiff(ExState &State); int CvsDiff(char *Options); int CvsCommit(ExState &State); int RunCvsCommit(ExState &State); int CvsCommit(char *Options); int ViewCvsLog(ExState &State); #endif #ifdef CONFIG_OBJ_SVN int Svn(ExState &State); int RunSvn(ExState &State); int ViewSvn(ExState &State); int Svn(char *Options); int ClearSvnMessages(ExState &State); int SvnDiff(ExState &State); int RunSvnDiff(ExState &State); int ViewSvnDiff(ExState &State); int SvnDiff(char *Options); int SvnCommit(ExState &State); int RunSvnCommit(ExState &State); int SvnCommit(char *Options); int ViewSvnLog(ExState &State); #endif #ifdef CONFIG_OBJ_DIRECTORY int DirOpen(ExState &State); int OpenDir(const char *Directory); #endif int ShowVersion(); int ViewModeMap(ExState &State); int ClearMessages(); #ifdef CONFIG_TAGS int TagLoad(ExState &State); #endif int SysShowHelp(ExState &State, const char *word); int RemoveGlobalBookmark(ExState &State); int GotoGlobalBookmark(ExState &State); int PopGlobalBookmark(); void DeleteModel(EModel *M); int CanQuit(); int GetStrVar(int var, char *str, size_t buflen); int GetIntVar(int var, int *value); }; extern EModel *ActiveModel; extern EView *ActiveView; EModel *FindModelID(EModel *B, int ID); #define MSGBUFTMP_SIZE 1024 #endif // O_MODEL_H ��������������������������������������������������������������������������������������������������������������./src/h_ada.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000010431�11344266046�012207� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_ada.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_ADA #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsAda_Normal 0 #define hsAda_Comment 1 #define hsAda_CommentL 2 #define hsAda_Keyword 4 #define hsAda_String1 10 #define hsAda_String2 11 int Hilit_ADA(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); int len1 = len; // char *last = p + len1 - 1; C = 0; NC = 0; for(i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch (State) { default: case hsAda_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_') || (Line->Chars[i + j] == '\'')) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j, 1)) { State = hsAda_Keyword; } else { int x; x = i + j; while ((x < Line->Count) && ((Line->Chars[x] == ' ') || (Line->Chars[x] == 9))) x++; if ((x < Line->Count) && (Line->Chars[x] == '(')) { Color = CLR_Function; } else { Color = CLR_Normal; } State = hsAda_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsAda_Normal; continue; } else if ((len >= 2) && (*p == '-') && (*(p+1) == '-')) { State = hsAda_CommentL; Color = CLR_Comment; //hilit2: ColorNext(); hilit: ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.' || *p == '_')) ColorNext(); continue; } else if (*p == '\'') { State = hsAda_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsAda_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsAda_CommentL: Color = CLR_Comment; goto hilit; case hsAda_String1: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsAda_Normal; continue; } goto hilit; case hsAda_String2: Color = CLR_String; if (*p == '"') { ColorNext(); State = hsAda_Normal; continue; } goto hilit; } } } if (State == hsAda_CommentL) State = hsAda_Normal; if ((len1 == 0)) { switch (State) { case hsAda_String1: case hsAda_String2: State = hsAda_Normal; break; } } *ECol = C; return 0; } #endif // CONFIG_HILIT_ADA ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/g_motif.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000157040�11602724002�012573� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* g_motif.cpp * * Copyright (c) 1994-1996, Marko Macek * Copyright (c) 2010, Zdenek Kabelac * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * * Only demo code */ #include "c_config.h" #include "console.h" #include "gui.h" #include "s_string.h" #include <X11/Xatom.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #ifdef HPUX #include </usr/include/X11R5/X11/HPkeysym.h> #endif #include <Xm/Xm.h> #include <Xm/BulletinB.h> #include <Xm/CascadeB.h> #include <Xm/DrawingA.h> #include <Xm/Form.h> #include <Xm/Label.h> #include <Xm/MainW.h> #include <Xm/MainW.h> #include <Xm/PanedW.h> #include <Xm/PushB.h> #include <Xm/RowColumn.h> #include <Xm/ScrollBar.h> #include <Xm/ScrolledW.h> #include <Xm/Separator.h> #include <Xm/Text.h> #include <fcntl.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #define DEBUG(x) //printf x #define MAX_PIPES 4 //#define PIPE_BUFLEN 4096 typedef struct { int used; int id; int fd; int pid; int stopped; EModel *notify; XtInputId input; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #define sfFocus 1 static long MouseAutoDelay = 40; static long MouseAutoRepeat = 200; static long MouseMultiClick = 300; static Atom WM_DELETE_WINDOW; static Atom XA_CLIPBOARD; class GViewPeer { public: Widget ScrollWin; Widget TextWin; Widget SbHorz, SbVert; GC gc[256]; XGCValues gcv; // TAttr GCattr; int Visibility; GView *View; // int wX, wY; int wW, wH, wState, wRefresh; int cX, cY, cVisible, cStart, cEnd; int sbVstart, sbVamount, sbVtotal; int sbHstart, sbHamount, sbHtotal; int VertPos, HorzPos; char *ScreenBuffer; GViewPeer(GView *view, int XSize, int YSize); ~GViewPeer(); int AllocBuffer(); void DrawCursor(int Show); void UpdateWindow(int xx, int yy, int ww, int hh); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); int QuerySbVPos(); int SetSbVPos(int Start, int Amount, int Total); int SetSbHPos(int Start, int Amount, int Total); int ExpandHeight(int DeltaY); int UpdateCursor(); int PMShowCursor(); int PMHideCursor(); int PMSetCursorPos(); }; class GFramePeer { public: GFrame *Frame; Widget ShellWin, MainWin, PanedWin, MenuBar; GFramePeer(GFrame *frame, int Width, int Height); ~GFramePeer(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); void MapFrame(); }; int ShowVScroll = 1; int ShowHScroll = 0; int ShowMenuBar = 1; int ShowToolBar = 0; GFrame *frames = 0; GUI *gui = 0; unsigned long HaveGUIDialogs = 0; static GView *MouseCapture = 0; static GView *FocusCapture = 0; static int cxChar = 8; static int cyChar = 13; static XtAppContext AppContext; static Widget TopLevel; static Display *display; static Window root; static int screen; static Colormap colormap; static XColor Colors[16]; static XFontStruct *fontStruct; TEvent EventBuf = { evNone }; TEvent NextEvent = { evNone }; XButtonEvent LastRelease; Widget LPopupMenu = 0; static int LastMouseX = -1, LastMouseY = -1; static void SetColor(int i) { int j, k, z; j = i & 7; k = 65535 - 20480; z = (i > 7) ? (20480) : 0; Colors[i].blue = k * (j & 1) + z; Colors[i].green = k * ((j & 2)?1:0) + z; Colors[i].red = k * ((j & 4)?1:0) + z; Colors[i].flags = DoRed | DoGreen | DoBlue; } static int InitXColors() { int i, j; long d = 0, d1; XColor clr; long pix; int num; long d_red, d_green, d_blue; unsigned long u_red, u_green, u_blue; for (i = 0; i < 16; i++) { SetColor(i); if (XAllocColor(display, colormap, &Colors[i]) == 0) { SetColor(i); pix = -1; num = DisplayCells(display, DefaultScreen(display)); for (j = 0; j < num; j++) { clr.pixel = j; XQueryColor(display, colormap, &clr); d_red = clr.red - Colors[i].red; d_green = clr.green - Colors[i].green; d_blue = clr.blue - Colors[i].blue; //fprintf(stderr, "%d:%d dr:%d, dg:%d, db:%d\n", i, j, d_red, d_green, d_blue); u_red = d_red / 10 * d_red; u_green = d_green / 10 * d_green; u_blue = d_blue / 10 * d_blue; //fprintf(stderr, "%d:%d dr:%u, dg:%u, db:%u\n", i, j, u_red, u_green, u_blue); d1 = u_red + u_blue + u_green; if (d1 < 0) d1 = -d1; if (pix == -1 || d1 < d) { pix = j; d = d1; } } if (pix == -1) { fprintf(stderr, "Color search failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } clr.pixel = pix; XQueryColor(display, colormap, &clr); Colors[i] = clr; if (XAllocColor(display, colormap, &Colors[i]) == 0) { fprintf(stderr, "Color alloc failed for #%04X%04X%04X\n", Colors[i].red, Colors[i].green, Colors[i].blue); } } } return 0; } // *INDENT-OFF* static const struct { long keysym; long keycode; } key_table[] = { { XK_Escape, kbEsc }, { XK_Tab, kbTab }, { XK_Return, kbEnter }, { XK_Pause, kbPause }, { XK_BackSpace, kbBackSp }, { XK_Home, kbHome }, { XK_Up, kbUp }, { XK_Prior, kbPgUp }, { XK_Left, kbLeft }, { XK_Right, kbRight }, { XK_End, kbEnd }, { XK_Down, kbDown }, { XK_Next, kbPgDn }, { XK_Select, kbEnd }, { XK_KP_Enter, kbEnter | kfGray }, { XK_Insert, kbIns | kfGray }, { XK_Delete, kbDel | kfGray }, { XK_KP_Add, '+' | kfGray }, { XK_KP_Subtract, '-' | kfGray }, { XK_KP_Multiply, '*' | kfGray }, { XK_KP_Divide, '/' | kfGray }, { XK_Num_Lock, kbNumLock }, { XK_Caps_Lock, kbCapsLock }, { XK_Print, kbPrtScr }, { XK_Shift_L, kbShift }, { XK_Shift_R, kbShift | kfGray }, { XK_Control_L, kbCtrl }, { XK_Control_R, kbCtrl | kfGray }, { XK_Alt_L, kbAlt }, { XK_Alt_R, kbAlt | kfGray }, { XK_Meta_L, kbAlt }, { XK_Meta_R, kbAlt | kfGray }, { XK_F1, kbF1 }, { XK_F2, kbF2 }, { XK_F3, kbF3 }, { XK_F4, kbF4 }, { XK_F5, kbF5 }, { XK_F6, kbF6 }, { XK_F7, kbF7 }, { XK_F8, kbF8 }, { XK_F9, kbF9 }, { XK_F10, kbF10 }, { XK_F11, kbF11 }, { XK_F12, kbF12 }, { XK_KP_0, '0' | kfGray }, { XK_KP_1, '1' | kfGray }, { XK_KP_2, '2' | kfGray }, { XK_KP_3, '3' | kfGray }, { XK_KP_4, '4' | kfGray }, { XK_KP_5, '5' | kfGray }, { XK_KP_6, '6' | kfGray }, { XK_KP_7, '7' | kfGray }, { XK_KP_8, '8' | kfGray }, { XK_KP_9, '9' | kfGray }, { XK_KP_Decimal, '.' | kfGray }, { 0x1000FF6F, kbDel | kfShift | kfGray }, { 0x1000FF70, kbIns | kfCtrl | kfGray }, { 0x1000FF71, kbIns | kfShift | kfGray }, { 0x1000FF72, kbIns | kfGray }, { 0x1000FF73, kbDel | kfGray }, { 0x1000FF74, kbTab | kfShift }, { 0x1000FF75, kbTab | kfShift }, { 0, 0 } }; // *INDENT-ON* static void ConvertKeyToEvent(KeySym key, KeySym key1, char *keyname, int etype, int state, TEvent *Event) { unsigned int myState = 0; int k; DEBUG(("key: \n")); Event->What = evNone; switch (etype) { case KeyPress: Event->What = evKeyDown; break; case KeyRelease: Event->What = evKeyUp; break; } if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; if (state & Mod1Mask) myState |= kfAlt; if (state & Mod2Mask) myState |= kfAlt; if (state & Mod3Mask) myState |= kfAlt; if (state & Mod4Mask) myState |= kfAlt; DEBUG(("key: %d ; %d ; %d\n", key, key1, state)); if (key < 256) { if (myState == kfShift) myState = 0; if (myState & kfCtrl) { if (((key >= 'A') && (key < 'A' + 32)) || ((key >= 'a') && (key < 'a' + 32))) key &= 0x1F; } if (myState & kfAlt) { if (((key >= 'A') && (key <= 'Z')) || ((key >= 'a') && (key <= 'z'))) key &= ~0x20; } Event->Key.Code = key | myState; return; } else { for (size_t i = 0; i < FTE_ARRAY_SIZE(key_table); ++i) { if (key1 == key_table[i].keysym) { k = key_table[i].keycode; if (k < 256) if (myState == kfShift) myState = 0; Event->Key.Code = k | myState; return; } } } DEBUG(("Unknown key: %ld %s %d %d\n", key, keyname, etype, state)); Event->What = evNone; } static TEvent LastMouseEvent = { evNone }; #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) static void ConvertClickToEvent(int type, int xx, int yy, int button, int state, TEvent *Event, Time time) { unsigned int myState = 0; static unsigned long LastClickTime = 0; static unsigned long LastClickCount = 0; static unsigned long LastClick = 0; unsigned long CurTime = time; if (type == MotionNotify) Event->What = evMouseMove; else if (type == ButtonPress) Event->What = evMouseDown; else Event->What = evMouseUp; Event->Mouse.X = xx / cxChar; Event->Mouse.Y = yy / cyChar; if (Event->What == evMouseMove) if (LastMouseX == Event->Mouse.X && LastMouseY == Event->Mouse.Y) { Event->What = evNone; return; } LastMouseX = Event->Mouse.X; LastMouseY = Event->Mouse.Y; Event->Mouse.Buttons = 0; if (type == MotionNotify) { if (state & Button1Mask) Event->Mouse.Buttons |= 1; if (state & Button2Mask) Event->Mouse.Buttons |= 4; if (state & Button3Mask) Event->Mouse.Buttons |= 2; } else { switch (button) { case Button1: Event->Mouse.Buttons |= 1; break; case Button2: Event->Mouse.Buttons |= 4; break; case Button3: Event->Mouse.Buttons |= 2; break; } } Event->Mouse.Count = 1; if (state & ShiftMask) myState |= kfShift; if (state & ControlMask) myState |= kfCtrl; if (state & Mod1Mask) myState |= kfAlt; if (state & Mod2Mask) myState |= kfAlt; if (state & Mod3Mask) myState |= kfAlt; if (state & Mod4Mask) myState |= kfAlt; Event->Mouse.KeyMask = myState; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; LastClickTime = CurTime; } /* if (Event->What == evMouseMove) { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } */ DEBUG(("Mouse: %d %d %d\n", Event->What, Event->Mouse.X, Event->Mouse.Y)); LastMouseEvent = *Event; } static void ProcessXEvents(XEvent *event, TEvent *Event, GViewPeer *Peer) { XAnyEvent *anyEvent = (XAnyEvent *) event; XExposeEvent *exposeEvent = (XExposeEvent *) event; XButtonEvent *buttonEvent = (XButtonEvent *) event; XKeyEvent *keyEvent = (XKeyEvent *) event; XKeyEvent keyEvent1; XConfigureEvent *configureEvent = (XConfigureEvent *) event; XGraphicsExposeEvent *gexposeEvent = (XGraphicsExposeEvent *) event; XMotionEvent *motionEvent = (XMotionEvent *) event; KeySym key, key1; int state; char keyName[32]; char keyName1[32]; static int hasConfig = 0; Event->What = evNone; Event->Msg.View = Peer->View; switch (event->type) { case ButtonRelease: case ButtonPress: LastRelease = *buttonEvent; ConvertClickToEvent(event->type, buttonEvent->x, buttonEvent->y, buttonEvent->button, buttonEvent->state, Event, motionEvent->time); break; case KeyPress: case KeyRelease: state = keyEvent->state; keyEvent1 = *keyEvent; keyEvent1.state &= ~(ShiftMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask); XLookupString(keyEvent, keyName, sizeof(keyName), &key, 0); XLookupString(&keyEvent1, keyName1, sizeof(keyName1), &key1, 0); //key1 = XLookupKeysym(keyEvent, 0); ConvertKeyToEvent(key, key1, keyName, event->type, state, Event); break; case MotionNotify: ConvertClickToEvent(event->type, motionEvent->x, motionEvent->y, 0, motionEvent->state, Event, motionEvent->time); break; } } static void CloseWindow(Widget w, void *framev, XEvent *event, Boolean *cont) { GFramePeer *frame = (GFramePeer*)framev; if (event->type != ClientMessage || ((XClientMessageEvent *)event)->data.l[0] != WM_DELETE_WINDOW) return; NextEvent.What = evCommand; NextEvent.Msg.Command = cmClose; *cont = False; } static void MainCallback (Widget w, void* itemv, XtPointer callData) { mItem *item = (mItem*) itemv; DEBUG(("Main: %d\n", item->Cmd)); NextEvent.What = evCommand; NextEvent.Msg.Command = item->Cmd; } static void PopupCallback (Widget w, void* itemv, XtPointer callData) { mItem *item = (mItem*) itemv; DEBUG(("Popup: %d\n", item->Cmd)); NextEvent.What = evCommand; NextEvent.Msg.Command = item->Cmd; } static void MenuPopdownCb (Widget w, void* itemv, XtPointer callData) { mItem *item = (mItem*) itemv; DEBUG(("Popdown: %d\n", item->Cmd)); if (LPopupMenu != 0) { XtDestroyWidget(LPopupMenu); LPopupMenu = 0; } } static void InputWindow(Widget w, void *PeerV, XEvent *event, Boolean *cont) { GViewPeer *Peer = (GViewPeer*)PeerV; DEBUG(("Input\n")); if (!Peer->View->IsActive()) Peer->View->Parent->SelectView(Peer->View); NextEvent.Msg.View = Peer->View; ProcessXEvents(event, &NextEvent, Peer); *cont = False; } static void VisibilityCb(Widget w, void* peerv, XEvent *event, Boolean *cont) { GViewPeer *peer = (GViewPeer*)peerv; if (event->type != VisibilityNotify) return; peer->Visibility = event->xvisibility.state; DEBUG(("Visibility %d\n", peer->Visibility)); /* * When we do an XCopyArea(), and the window is partially obscured, we want * to receive an event to tell us whether it worked or not. */ /*XSetGraphicsExposures(display, gui.text_gc, gui.visibility != VisibilityUnobscured);*/ *cont = True; } static void ConfigureWindow(Widget w, void *PeerV, XEvent *event, Boolean *cont) { GViewPeer *Peer = (GViewPeer*)PeerV; XConfigureEvent *confEvent = (XConfigureEvent*)event; int X, Y; DEBUG(("Configure\n")); X = confEvent->width / cxChar; Y = confEvent->height / cyChar; DEBUG(("!! Resize %d, %d\n", X, Y)); if (X > 0 && Y > 0) { Peer->ConSetSize(X, Y); NextEvent.What = evCommand; NextEvent.Msg.Command = cmResize; } DEBUG(("!! resize done\n")); *cont = True; } static void ExposeWindow(Widget w, void* PeerV, void* CallV) { GViewPeer *Peer = (GViewPeer*)PeerV; XmDrawingAreaCallbackStruct *Call = (XmDrawingAreaCallbackStruct*)CallV; XExposeEvent *exposeEvent = (XExposeEvent *) Call->event; DEBUG(("Expose\n")); // if (!XtIsManaged(w)) return Peer->UpdateWindow(exposeEvent->x, exposeEvent->y, exposeEvent->width, exposeEvent->height); DEBUG(("! Expose done\n")); } static void VertValueChanged(Widget w, void* PeerV, void* CallV) { GViewPeer *Peer = (GViewPeer*)PeerV; XmScrollBarCallbackStruct *Call = (XmScrollBarCallbackStruct*)CallV; if (!Peer->View->IsActive()) Peer->View->Parent->SelectView(Peer->View); if (Peer->VertPos != Call->value) { NextEvent.What = evCommand; NextEvent.Msg.View = Peer->View; NextEvent.Msg.Command = cmVScrollMove; NextEvent.Msg.Param1 = Call->value; DEBUG(("Vert: %d\n", Call->value)); Peer->VertPos = Call->value; } } //void HorzValueChanged(Widget w, GViewPeer *Peer, XmScrollBarCallbackStruct *Call) void HorzValueChanged(Widget w, void* PeerV, void* CallV) { GViewPeer *Peer = (GViewPeer*)PeerV; XmScrollBarCallbackStruct *Call = (XmScrollBarCallbackStruct*) CallV; if (!Peer->View->IsActive()) Peer->View->Parent->SelectView(Peer->View); if (Call->value != Peer->HorzPos) { NextEvent.What = evCommand; NextEvent.Msg.View = Peer->View; NextEvent.Msg.Command = cmHScrollMove; NextEvent.Msg.Param1 = Call->value; DEBUG(("Horz: %d\n", Call->value)); Peer->HorzPos = Call->value; } } /////////////////////////////////////////////////////////////////////////// GViewPeer::GViewPeer(GView *view, int XSize, int YSize) : Visibility(VisibilityFullyObscured), View(view), //wX(0), //wY(0), //wW(XSize), //wH(YSize), wW(80), wH(40), wState(0), wRefresh(0), cX(-1), cY(-1), cVisible(1), cStart(0), // % cEnd(100), sbVstart(0), sbVamount(0), sbVtotal(0), sbHstart(0), sbHamount(0), sbHtotal(0), VertPos(-1), HorzPos(-1), ScreenBuffer(0) { for (int jj = 0; jj < 256; jj++) gc[jj] = 0; AllocBuffer(); ScrollWin = XtVaCreateWidget("ScrollWin", xmScrolledWindowWidgetClass, frames->Peer->PanedWin, XmNmarginHeight, 0, XmNmarginWidth, 0, XmNspacing, 0, NULL); TextWin = XtVaCreateManagedWidget ("TextWin", xmDrawingAreaWidgetClass, ScrollWin, XmNmarginHeight, 0, XmNmarginWidth, 0, XmNhighlightThickness, 0, XmNshadowThickness, 0, XmNwidthInc, cxChar, XmNheightInc, cyChar, XmNwidth, cxChar * 80, XmNheight, cyChar * 30, NULL); // XSetWindowColormap(display, XtWindow(TextWin), colormap); XtVaSetValues (ScrollWin, XmNworkWindow, TextWin, NULL); SbVert = XtVaCreateManagedWidget("VScrollBar", xmScrollBarWidgetClass, ScrollWin, XmNmarginHeight, 0, XmNmarginWidth, 0, XmNwidth, 20, NULL); SbHorz = XtVaCreateManagedWidget("HScrollBar", xmScrollBarWidgetClass, ScrollWin, XmNmarginHeight, 0, XmNmarginWidth, 0, XmNorientation, XmHORIZONTAL, NULL); XtVaSetValues(ScrollWin, XmNhorizontalScrollBar, SbHorz, XmNverticalScrollBar, SbVert, NULL); XtManageChild(ScrollWin); gcv.foreground = Colors[0].pixel; gcv.background = Colors[0].pixel; gcv.font = fontStruct->fid; gc[0] = XtGetGC(TextWin, GCForeground | GCBackground | GCFont, &gcv); // GCattr = 0x07; /* XtAddCallback(TextWin, XmNinputCallback, InputWindow, this);*/ XtAddEventHandler(TextWin, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask, False, InputWindow, this); XtAddEventHandler(TextWin, VisibilityChangeMask, False, VisibilityCb, this); XtAddEventHandler(TextWin, StructureNotifyMask, False, ConfigureWindow, this); //XtAddCallback(TextWin, XmNresizeCallback, ResizeWindow, this); XtAddCallback(TextWin, XmNexposeCallback, ExposeWindow, this); XtAddCallback(SbHorz, XmNvalueChangedCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNdragCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNincrementCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNdecrementCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNpageIncrementCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNpageDecrementCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNtoTopCallback, HorzValueChanged, this); XtAddCallback(SbHorz, XmNtoBottomCallback, HorzValueChanged, this); XtAddCallback(SbVert, XmNvalueChangedCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNdragCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNincrementCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNdecrementCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNpageIncrementCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNpageDecrementCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNtoTopCallback, VertValueChanged, this); XtAddCallback(SbVert, XmNtoBottomCallback, VertValueChanged, this); } GViewPeer::~GViewPeer() { // Widget destroyed recursively // from master shell widget free(ScreenBuffer); ScreenBuffer = 0; } int GViewPeer::AllocBuffer() { int i; char *p; /* FIXME */ if (!(ScreenBuffer = (char *)malloc(wW * wH * sizeof(TCell)))) return 0; for (i = 0, p = ScreenBuffer; i < wW * wH; i++) { *p++ = 32; *p++ = 0x07; } return 1; } #define InRange(x,a,y) (((x) <= (a)) && ((a) < (y))) #define CursorXYPos(x,y) (ScreenBuffer + ((x) + ((y) * wW)) * 2) void GViewPeer::DrawCursor(int Show) { if (!(View && View->Parent)) return; if (!(wState & sfFocus)) Show = 0; if (Visibility == VisibilityFullyObscured) return; if (cX >= wW || cY >= wW || cX + 1 > wW || cY + 1 > wH) { //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); return; } DEBUG(("DrawCursor %d %d\n", cX, cY)); // if (!XtIsManaged(TextWin)) return ; if (cVisible && cX >= 0 && cY >= 0) { char *p = CursorXYPos(cX, cY), attr; attr = p[1]; /*if (Show) attr = ((((attr << 4) & 0xF0)) | (attr >> 4)) ^ 0x77;*/ if (Show) attr = (attr ^ 0x77); if (gc[attr] == 0) { gcv.foreground = Colors[attr & 0xF].pixel; gcv.background = Colors[(attr >> 4) & 0xF].pixel; gcv.font = fontStruct->fid; gc[attr] = XtGetGC(TextWin, GCForeground | GCBackground | GCFont, &gcv); } XDrawImageString(display, XtWindow(TextWin), gc[attr], cX * cxChar, fontStruct->max_bounds.ascent + cY * cyChar, (const char*)p, 1); } } int GViewPeer::ConPutBox(int X, int Y, int W, int H, PCell Cell) { int i; char temp[256], attr; char *p, *ps, *c, *ops; int len, x, l, ox, olen, skip; if (!(View && View->Parent && gc)) return 1; if (Visibility == VisibilityFullyObscured) return 0; if (X >= wW || Y >= wH || X + W > wW || Y + H > wH) { //fprintf(stderr, "%d %d %d %d %d %d\n", ScreenCols, ScreenRows, X, Y, W, H); return 0; } DEBUG(("PutBox %d | %d %d %d %d | %d %d\n", wRefresh, X, Y, W, H, wW, wH)); for (i = 0; i < H; i++) { len = W; p = CursorXYPos(X, Y + i); ps = (char *) Cell; x = X; while (len > 0) { if (!wRefresh) { c = CursorXYPos(x, Y + i); skip = 0; ops = ps; ox = x; olen = len; while ((len > 0) && (*(unsigned short *) c == *(unsigned short *)ps)) x++, len--, ps+=2, c+=2, skip++; if (len <= 0) break; if (skip <= 4) { ps = ops; x = ox; len = olen; } } p = ps; l = 1; temp[0] = *ps++; attr = *ps++; while ((l < len) && ((unsigned char) (ps[1]) == attr)) { temp[l++] = *ps++; ps++; } if (gc[attr] == 0) { gcv.foreground = Colors[attr & 0xF].pixel; gcv.background = Colors[(attr >> 4) & 0xF].pixel; gcv.font = fontStruct->fid; gc[attr] = XtGetGC(TextWin, GCForeground | GCBackground | GCFont, &gcv); } XDrawImageString(display, XtWindow(TextWin), gc[attr], x * cxChar, fontStruct->max_bounds.ascent + (Y + i) * cyChar, temp, l); x += l; len -= l; } p = CursorXYPos(X, Y + i); memmove(p, Cell, W * sizeof(TCell)); if (i + Y == cY) DrawCursor(1); Cell += W; } DEBUG(("done putbox\n")); return 1; } void GViewPeer::UpdateWindow(int xx, int yy, int ww, int hh) { PCell p; int i; ww /= cxChar; ww += 2; hh /= cyChar; hh += 2; xx /= cxChar; yy /= cyChar; if (xx + ww > wW) ww = wW - xx; if (yy + hh > wH) hh = wH - yy; wRefresh = 1; p = (PCell) CursorXYPos(xx, yy); for (i = 0; i < hh; i++) { ConPutBox(xx, yy + i, ww, 1, p); p += wW; } XFlush(display); wRefresh = 0; } int GViewPeer::ConGetBox(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; i++) { memcpy(Cell, CursorXYPos(X, Y + i), 2 * W); Cell += W; } return 1; } int GViewPeer::ConPutLine(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; i++) if (!ConPutBox(X, Y + i, W, 1, Cell)) return 0; return 1; } int GViewPeer::ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; for (int i = 0; i < W; i++) B[i] = Cell; ConPutLine(X, Y, W, H, B); return 1; } int GViewPeer::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { TCell Cell; int l; MoveCh(&Cell, ' ', Fill, 1); DrawCursor(0); if (Way == csUp) { XCopyArea(display, XtWindow(TextWin), XtWindow(TextWin), gc[0], X * cxChar, (Y + Count) * cyChar, W * cxChar, (H - Count) * cyChar, X * cxChar, Y * cyChar ); for (l = 0; l < H - Count; l++) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l + Count), 2 * W); if (!ConSetBox(X, Y + H - Count, W, Count, Cell)) return 0; } else if (Way == csDown) { XCopyArea(display, XtWindow(TextWin), XtWindow(TextWin), gc[0], X * cxChar, Y * cyChar, W * cxChar, (H - Count) * cyChar, X * cxChar, (Y + Count)* cyChar ); for (l = H - 1; l >= Count; l--) memcpy(CursorXYPos(X, Y + l), CursorXYPos(X, Y + l - Count), 2 * W); if (!ConSetBox(X, Y, W, Count, Cell)) return 0; } DrawCursor(1); return 0; } int GViewPeer::ConSetSize(int X, int Y) { char *NewBuffer; char *p; int i; int MX, MY; p = NewBuffer = (char *) malloc(X * Y * sizeof(TCell)); if (NewBuffer == NULL) return 0; for (int i = 0; i < X * Y; i++) { *p++ = ' '; *p++ = 0x07; } if (ScreenBuffer) { MX = wW; if (X < MX) MX = X; MY = wH; if (Y < MY) MY = Y; if (X < MX) MX = X; p = NewBuffer; for (i = 0; i < MY; i++) { memcpy(p, CursorXYPos(0, i), MX * sizeof(TCell)); p += X * 2; } free(ScreenBuffer); } ScreenBuffer = NewBuffer; wW = X; wH = Y; wRefresh = 1; View->Resize(wW, wH); ConPutBox(0, 0, wW, wH, (PCell) ScreenBuffer); wRefresh = 0; // if (Refresh == 0) // XResizeWindow(display, win, ScreenCols * cxChar, ScreenRows * cyChar); return 1; } int GViewPeer::ConQuerySize(int *X, int *Y) { //printf("3CONQUERYSIZE %d %d\n", wW, wH); if (X) *X = wW; if (Y) *Y = wH; return 1; } int GViewPeer::ConSetCursorPos(int X, int Y) { if (X < 0) X = 0; else if (X >= wW) X = wW - 1; if (Y < 0) Y = 0; else if (Y >= wH) Y = wH - 1; DrawCursor(0); cX = X; cY = Y; DrawCursor(1); return 1; } int GViewPeer::ConQueryCursorPos(int *X, int *Y) { if (X) *X = cX; if (Y) *Y = cY; return 1; } int GViewPeer::ConShowCursor() { cVisible = 1; // DrawCursor(1); return 1; } int GViewPeer::ConHideCursor() { cVisible = 0; // DrawCursor(0); return 1; } int GViewPeer::ConCursorVisible() { return cVisible; } int GViewPeer::ConSetCursorSize(int Start, int End) { cStart = Start; cEnd = End; if (wState & sfFocus) return 1; //PMSetCursorSize(Start, End); return 1; } int GViewPeer::ExpandHeight(int DeltaY) { return 0; } int GViewPeer::QuerySbVPos() { return sbVstart; } int GViewPeer::SetSbVPos(int Start, int Amount, int Total) { if (sbVstart != Start || sbVamount != Amount || sbVtotal != Total) { sbVstart = Start; sbVamount = Amount; sbVtotal = Total; if (!View->Parent) return 0; if (Amount < 1 || Start + Amount > Total) { XtVaSetValues(SbVert, XmNmaximum, 1, XmNminimum, 0, XmNpageIncrement, 1, XmNsliderSize, 1, XmNvalue, 0, NULL); } else { XtVaSetValues(SbVert, XmNmaximum, Total, XmNminimum, 0, XmNpageIncrement, ((Amount > 1) ? Amount : 1), XmNsliderSize, Amount, XmNvalue, Start, NULL); } } return 1; } int GViewPeer::SetSbHPos(int Start, int Amount, int Total) { if (sbHstart != Start || sbHamount != Amount || sbHtotal != Total) { sbHstart = Start; sbHamount = Amount; sbHtotal = Total; if (!View->Parent) return 0; if (Amount < 1 || Start + Amount > Total) XtVaSetValues(SbHorz, XmNmaximum, 1, XmNminimum, 0, XmNpageIncrement, 1, XmNsliderSize, 1, XmNvalue, 0, NULL); else XtVaSetValues(SbHorz, XmNmaximum, Total, XmNminimum, 0, XmNpageIncrement, ((Amount > 1) ? Amount : 1), XmNsliderSize, Amount, XmNvalue, Start, NULL); } return 1; } int GViewPeer::UpdateCursor() { ConSetCursorPos(cX, cY); ConSetCursorSize(cStart, cEnd); if (cVisible) ConShowCursor(); else ConHideCursor(); return 1; } int GViewPeer::PMShowCursor() { // if (wState & sfFocus) // WinShowCursor(hwndView, TRUE); return 1; } int GViewPeer::PMHideCursor() { // if (wState & sfFocus) // WinShowCursor(hwndView, FALSE); return 1; } int GViewPeer::PMSetCursorPos() { // if (wState & sfFocus) { // WinDestroyCursor(hwndView); // WinCreateCursor(hwndView, // cxChar * cX, cyChar * (wH - cY - 1), cxChar, 2, // CURSOR_TYPE, // NULL); // WinShowCursor(hwndView, TRUE); // } return 1; } /////////////////////////////////////////////////////////////////////////// GView::GView(GFrame *parent, int XSize, int YSize) : Parent(parent), Next(0), Prev(0), Peer(new GViewPeer(this, XSize, YSize)) { if (Parent) Parent->AddView(this); } GView::~GView() { if (Parent) Parent->RemoveView(this); delete Peer; } int GView::ConClear() { int W, H; TDrawBuffer B; ConQuerySize(&W, &H); MoveChar(B, 0, W, ' ', 0x07, 1); ConSetBox(0, 0, W, H, B[0]); return 1; } int GView::ConPutBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutBox(X, Y, W, H, Cell); } int GView::ConGetBox(int X, int Y, int W, int H, PCell Cell) { return Peer->ConGetBox(X, Y, W, H, Cell); } int GView::ConPutLine(int X, int Y, int W, int H, PCell Cell) { return Peer->ConPutLine(X, Y, W, H, Cell); } int GView::ConSetBox(int X, int Y, int W, int H, TCell Cell) { return Peer->ConSetBox(X, Y, W, H, Cell); } int GView::ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { return Peer->ConScroll(Way, X, Y, W, H, Fill, Count); } int GView::ConSetSize(int X, int Y) { printf("ConSetSize %d %d\n", X, Y); if (Peer->ConSetSize(X, Y)) { // Resize(X, Y); return 1; } return 0; } int GView::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GView::ConSetCursorPos(int X, int Y) { return Peer->ConSetCursorPos(X, Y); } int GView::ConQueryCursorPos(int *X, int *Y) { return Peer->ConQueryCursorPos(X, Y); } int GView::ConShowCursor() { return Peer->ConShowCursor(); } int GView::ConHideCursor() { return Peer->ConHideCursor(); } int GView::ConCursorVisible() { return Peer->ConCursorVisible(); } int GView::ConSetCursorSize(int Start, int End) { return Peer->ConSetCursorSize(Start, End); } int GView::QuerySbVPos() { return Peer->QuerySbVPos(); } int GView::SetSbVPos(int Start, int Amount, int Total) { return Peer->SetSbVPos(Start, Amount, Total); } int GView::SetSbHPos(int Start, int Amount, int Total) { return Peer->SetSbHPos(Start, Amount, Total); } int GView::ExpandHeight(int DeltaY) { return Peer->ExpandHeight(DeltaY); } void GView::Update() { } void GView::Repaint() { } void GView::HandleEvent(TEvent &Event) { } void GView::Resize(int width, int height) { Repaint(); } void GView::EndExec(int NewResult) { Result = NewResult; } int GView::Execute() { int SaveRc = Result; int NewResult; Result = -2; while (Result == -2 && frames != 0) gui->ProcessEvent(); NewResult = Result; Result = SaveRc; return NewResult; } int GView::IsActive() { return (Parent->Active == this); } void GView::Activate(int gotfocus) { if (gotfocus) { Peer->wState |= sfFocus; Peer->UpdateCursor(); } else Peer->wState &= ~sfFocus; Repaint(); } int GView::CaptureMouse(int grab) { if (MouseCapture == 0) { if (!grab) return 0; MouseCapture = this; } else { if (grab || MouseCapture != this) return 0; MouseCapture = 0; } return 1; } /////////////////////////////////////////////////////////////////////////// GFramePeer::GFramePeer(GFrame *frame, int Width, int Height) : MenuBar(0) { ShellWin = XtCreatePopupShell("fte", topLevelShellWidgetClass, TopLevel, NULL, 0); XtVaSetValues(ShellWin, XmNwidthInc, cxChar, XmNheightInc, cyChar, NULL); MainWin = XtCreateManagedWidget("Widget", xmMainWindowWidgetClass, ShellWin, NULL, 0); PanedWin = XtVaCreateManagedWidget("pane", xmPanedWindowWidgetClass, MainWin, XmNmarginHeight, 0, XmNmarginWidth, 0, NULL); XtVaSetValues (MainWin, XmNworkWindow, PanedWin, NULL); if (Width != -1 && Height != -1) ConSetSize(Width, Height); } GFramePeer::~GFramePeer() { // Kill master window - deletes recursively all related widgets XtDestroyWidget(MenuBar); XtDestroyWidget(ShellWin); } int GFramePeer::ConSetSize(int X, int Y) { printf("SetSIZE %d x %d\n", X, Y); //return ::ConSetSize(X, Y); return 0; } int GFramePeer::ConQuerySize(int *X, int *Y) { //::ConQuerySize(&fW, &fH); //if (X) *X = fW; //if (Y) *Y = fH; if (X) *X = 80; if (Y) *Y = 25; printf("ConQuerySize %d x %d\n", *X, *Y); return 1; } int GFramePeer::ConSetTitle(const char *Title, const char *STitle) { XSetStandardProperties(display, XtWindow(ShellWin), Title, STitle, 0, NULL, 0, NULL); return 1; } int GFramePeer::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { *Title = 0; *STitle = 0; return 1; } void GFramePeer::MapFrame() { //Parent->UpdateMenu(); XtPopup(ShellWin, XtGrabNone); XSetWMProtocols(display, XtWindow(ShellWin), &WM_DELETE_WINDOW, 1); XtInsertEventHandler(ShellWin, NoEventMask, True, CloseWindow, NULL, XtListHead); } /////////////////////////////////////////////////////////////////////////// GFrame::GFrame(int XSize, int YSize) { Menu = 0; if (!frames) { frames = Prev = Next = this; } else { Next = frames->Next; Prev = frames; frames->Next->Prev = this; frames->Next = this; frames = this; } Top = Active = 0; Peer = new GFramePeer(this, XSize, YSize); } GFrame::~GFrame() { delete Peer; free(Menu); if (Next == this) { frames = 0; // DEBUG(("No more frames\x7\x7\n")); } else { Next->Prev = Prev; Prev->Next = Next; frames = Next; } } int GFrame::ConSetTitle(const char *Title, const char *STitle) { return Peer->ConSetTitle(Title, STitle); } int GFrame::ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { return Peer->ConGetTitle(Title, MaxLen, STitle, SMaxLen); } int GFrame::ConSetSize(int X, int Y) { return Peer->ConSetSize(X, Y); } int GFrame::ConQuerySize(int *X, int *Y) { return Peer->ConQuerySize(X, Y); } int GFrame::ConSplitView(GView *view, GView *newview) { int dmy; newview->Parent = this; // newview->Peer->wX = 0; ConQuerySize(&newview->Peer->wW, &dmy); // newview->Peer->wY = view->Peer->wY + view->Peer->wH / 2; // newview->Peer->wH = view->Peer->wH - view->Peer->wH / 2; // view->Peer->wH /= 2; InsertView(view, newview); view->ConSetSize(view->Peer->wW, view->Peer->wH); newview->ConSetSize(newview->Peer->wW, newview->Peer->wH); return 1; } int GFrame::ConCloseView(GView *view) { return 0; } int GFrame::ConResizeView(GView *view, int DeltaY) { return 0; } int GFrame::AddView(GView *view) { if (Top != 0) return ConSplitView(Top, view); // int W, H; view->Parent = this; view->Prev = view->Next = 0; // view->Peer->wX = 0; // view->Peer->wY = 0; // ConQuerySize(&W, &H); // view->ConSetSize(W, H); InsertView(Top, view); return 1; } void GFrame::Update() { UpdateMenu(); for (GView *v = Active; v; v = v->Next) { v->Update(); if (v->Next == Active) break; } } void GFrame::UpdateMenu() { } void GFrame::Repaint() { for (GView* v = Active; v; v = v->Next) { v->Repaint(); if (v->Next == Active) break; } } void GFrame::InsertView(GView *Prev, GView *view) { if (!view) return ; if (Prev) { view->Prev = Prev; view->Next = Prev->Next; Prev->Next = view; view->Next->Prev = view; } else { view->Prev = view->Next = view; Top = view; } if (Active == 0) { Active = view; Active->Activate(1); } } void GFrame::RemoveView(GView *view) { if (!view) return ; if (Active == view) Active->Activate(0); if (view->Next == view) { Top = Active = 0; delete this; } else { view->Next->Prev = view->Prev; view->Prev->Next = view->Next; // if (Top == view) { // Top = view->Next; // Top->Peer->wY -= view->Peer->wH; // Top->ConSetSize(Top->Peer->wW, Top->Peer->wH + view->Peer->wH); // } else { // view->Prev->ConSetSize(view->Prev->Peer->wW, // view->Prev->Peer->wH + view->Peer->wH); // } if (Active == view) { Active = view->Prev; Active->Activate(1); } } } void GFrame::SelectNext(int back) { GView *c = Active; if (c == 0 && Top == 0) return; if (c == 0) c = Active = Top; else if (back) { Active = Active->Prev; } else { Active = Active->Next; } if (c != Active) { c->Activate(0); Active->Activate(1); } if (Active) XtSetKeyboardFocus(Peer->PanedWin, Active->Peer->TextWin); } int GFrame::SelectView(GView *view) { if (Top == 0) return 0; if (FocusCapture != 0 || MouseCapture != 0) return 0; if (Active) Active->Activate(0); Active = view; if (Active) Active->Activate(1); if (Active) XtSetKeyboardFocus(Peer->PanedWin, Active->Peer->TextWin); return 1; } void GFrame::Resize(int width, int height) { if (!Top) return; if (width < 8 || height < 2) return; if (Top == Top->Next) Top->ConSetSize(width, height); } static Widget CreateMotifMenu(Widget parent, int menu, int main, XtCallbackProc MenuProc) { Widget hmenu; Widget item; if (main == 1) hmenu = XmCreateMenuBar(parent, "menu", NULL, 0); else if (main == 2) { hmenu = XmCreatePopupMenu(parent, "submenu", NULL, 0); // XtCreateManagedWidget ( "Title", xmLabelWidgetClass, hmenu, // NULL, 0 ); // XtCreateManagedWidget ( "separator", xmSeparatorWidgetClass, // hmenu, NULL, 0 ); } else hmenu = XmCreatePulldownMenu(parent, "submenu", NULL, 0); for (int i = 0; i < Menus[menu].Count; ++i) { if (Menus[menu].Items[i].Name) { char s[256]; char *mn = 0; strcpy(s, Menus[menu].Items[i].Name); char* p = strchr(s, '&'); if (p) { mn = p; // for strcpy src & dest may not overlap! for (; p[0]; ++p) p[0] = p[1]; } p = strchr(s, '\t'); if (p) { *p = 0; p++; } if (Menus[menu].Items[i].SubMenu != -1) { item = XtVaCreateManagedWidget(s, xmCascadeButtonWidgetClass, hmenu, XmNsubMenuId, CreateMotifMenu(hmenu, Menus[menu].Items[i].SubMenu, 0, MenuProc), NULL); } else { item = XtVaCreateManagedWidget(s, xmPushButtonWidgetClass, hmenu, NULL); XtAddCallback(item, XmNactivateCallback, MenuProc, &(Menus[menu].Items[i])); } if (p) XtVaSetValues(item, XmNacceleratorText, XmStringCreate(p, XmSTRING_DEFAULT_CHARSET), NULL); if (mn) XtVaSetValues(item, XmNmnemonic, KeySym(*mn), NULL); } else { item = XtVaCreateManagedWidget("separator", xmSeparatorWidgetClass, hmenu, NULL); //XmCreateSeparator(parent, "xx", 0, 0); } // item.id = Menus[menu].Items[i].Cmd & 0xFFFF; // ? } return hmenu; } static Widget CreateMotifMainMenu(Widget parent, char *Name) { int id = GetMenuId(Name); return CreateMotifMenu(parent, id, 1, MainCallback); } int GFrame::SetMenu(const char *Name) { free(Menu); Menu = strdup(Name); if (Peer->MenuBar) XtDestroyWidget(Peer->MenuBar); Peer->MenuBar = CreateMotifMainMenu(Peer->MainWin, Menu); XtManageChild (Peer->MenuBar); XtVaSetValues (Peer->MainWin, XmNmenuBar, Peer->MenuBar, NULL); return 1; } int GFrame::ExecMainMenu(char Sub) { return 1; } int GFrame::PopupMenu(const char *Name) { int id = GetMenuId(Name); if (LPopupMenu) XtDestroyWidget(LPopupMenu); LPopupMenu = CreateMotifMenu(Peer->MainWin, id, 2, PopupCallback); XtAddCallback(XtParent(LPopupMenu), XmNpopdownCallback, MenuPopdownCb, 0); XmMenuPosition(LPopupMenu, &LastRelease); XtManageChild(LPopupMenu); return 1; } void GFrame::Show() { Update(); Peer->MapFrame(); } void GFrame::Activate() { frames = this; Update(); //Peer->ShowFrame(); } // GUI int GUI::multiFrame() { return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) : fArgc(argc), fArgv(argv) { char *fs = getenv("VIOFONT"); if (fs == 0 && WindowFont[0] != 0) fs = WindowFont; TopLevel = XtVaAppInitialize(&AppContext, "TopLevel", NULL, 0, &argc, argv, NULL, XmNmappedWhenManaged, FALSE, NULL); if (!TopLevel) return; if (!(display = XtDisplay(TopLevel))) return; //XSynchronize(display, True); root = DefaultRootWindow(display); screen = DefaultScreen(display); colormap = DefaultColormap(display, screen); InitXColors(); fontStruct = NULL; if (fs) fontStruct = XLoadQueryFont(display, fs); else { #ifdef HPUX fontStruct = XLoadQueryFont(display, "8x13"); #endif #ifdef AIX fontStruct = XLoadQueryFont(display, "8x13"); #endif #ifdef LINUX fontStruct = XLoadQueryFont(display, "8x13"); #endif #ifdef IRIX fontStruct = XLoadQueryFont(display, "8x13"); #endif } if (fontStruct == NULL) fontStruct = XLoadQueryFont(display, "fixed"); if (fontStruct == NULL) return; cxChar = fontStruct->max_bounds.width; cyChar = fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent; XtRealizeWidget(TopLevel); WM_DELETE_WINDOW = XInternAtom(display, "WM_DELETE_WINDOW", False); XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False); gui = this; } GUI::~GUI() { //core: XtCloseDisplay(display); //core: XtDestroyApplicationContext(AppContext); gui = 0; } int GUI::ConGrabEvents(TEventMask EventMask) { return 1; } void GUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { if (Event.What != evNone) { if (view) view->HandleEvent(Event); } } int GUI::ConSuspend() { return 0; } int GUI::ConContinue() { return 0; } int GUI::ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete, GView **view) { //return ::ConGetEvent(EventMask, Event, WaitTime, Delete, view); assert(1 == 0); return 1; } int GUI::ConPutEvent(const TEvent& Event) { EventBuf = Event; return 1; } int GUI::ConFlush() { return 1; } void GUI::ProcessEvent() { static int need_update = 1; if (need_update && XtAppPending(AppContext) == 0 ) { frames->Update(); need_update = 0; } XtAppProcessEvent(AppContext, XtIMAll); if (NextEvent.What != evNone) { DispatchEvent(frames, NextEvent.Msg.View, NextEvent); NextEvent.What = evNone; need_update = 1; } } int GUI::Run() { if (Start(fArgc, fArgv)) { doLoop = 1; frames->Show(); //if (frames && frames->Peer) // frames->Peer->MapFrame(); //XtAppMainLoop(AppContext); while (doLoop) ProcessEvent(); Stop(); return 1; } return 0; } int GUI::ShowEntryScreen() { return 1; } int GUI::RunProgram(int mode, char *Command) { char Cmd[1024]; strlcpy(Cmd, XShellCommand, sizeof(Cmd)); if (*Command == 0) // empty string = shell strlcat(Cmd, " -ls &", sizeof(Cmd)); else { strlcat(Cmd, " -e ", sizeof(Cmd)); strlcat(Cmd, Command, sizeof(Cmd)); if (mode == RUN_ASYNC) strlcat(Cmd, " &", sizeof(Cmd)); } return (system(Cmd) == 0); } //void PipeCallback(GPipe *pipe, int *source, XtInputId *input) void PipeCallback(void *pipev, int *source, XtInputId *input) { GPipe *pipe = (GPipe*)pipev; if (pipe && pipe->notify && *source == pipe->fd) { NextEvent.What = evNotify; NextEvent.Msg.View = frames->Active; NextEvent.Msg.Model = pipe->notify; NextEvent.Msg.Command = cmPipeRead; NextEvent.Msg.Param1 = pipe->id; pipe->stopped = 0; } //fprintf(stderr, "Pipe %d\n", *source); } int GUI::OpenPipe(const char *Command, EModel *notify) { for (int i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { int pfd[2]; Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; if (pipe((int *)pfd) == -1) return 0; switch (Pipes[i].pid = fork()) { case -1: /* fail */ return -1; case 0: /* child */ close(pfd[0]); close(0); dup2(pfd[1], 1); dup2(pfd[1], 2); exit(system(Command)); default: close(pfd[1]); fcntl(pfd[0], F_SETFL, O_NONBLOCK); Pipes[i].fd = pfd[0]; } Pipes[i].input = /* FIXME: */ XtAppAddInput(AppContext, Pipes[i].fd, (void*)XtInputReadMask, PipeCallback, &Pipes[i]); Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; if (notify != Pipes[id].notify) { if (notify) { Pipes[id].input = /* FIXME */ XtAppAddInput(AppContext, Pipes[id].fd, (void*)XtInputReadMask, PipeCallback, &Pipes[id]); } else { if (Pipes[id].input != 0) { XtRemoveInput(Pipes[id].input); Pipes[id].input = 0; } } } return 1; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { ssize_t rc; if (id < 0 || id > MAX_PIPES || Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); rc = read(Pipes[id].fd, buffer, len); //fprintf(stderr, "Pipe Read: Got %d %d\n", id, len); if (rc == 0) { if (Pipes[id].input != 0) { XtRemoveInput(Pipes[id].input); Pipes[id].input = 0; } close(Pipes[id].fd); return -1; } if (rc == -1) Pipes[id].stopped = 1; return rc; } int GUI::ClosePipe(int id) { int status; if (id < 0 || id > MAX_PIPES || Pipes[id].used == 0) return 0; waitpid(Pipes[id].pid, &status, 0); //fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; return (WEXITSTATUS(status) == 0); } int GetXSelection(int *len, char **data, int clipboard) { // XXX use clipboard? if (!(*data = XFetchBytes(display, len))) return 0; return 1; } int SetXSelection(int len, char *data, int clipboard) { Atom clip; XStoreBytes(display, data, len); switch (clipboard) { case 0: clip = XA_CLIPBOARD; break; case 1: clip = XA_PRIMARY; break; case 2: clip = XA_SECONDARY; break; default: // not supported return 0; } XSetSelectionOwner(display, clip, None, CurrentTime); return 1; } /* static void SetColor(int i) { int j, k, z; j = i & 7; k = 65535 - 20480; z = (i > 7) ? (20480) : 0; Colors[i].blue = k * (j & 1) + z; Colors[i].green = k * ((j & 2)?1:0) + z; Colors[i].red = k * ((j & 4)?1:0) + z; Colors[i].flags = DoRed | DoGreen | DoBlue; } static int InitXColors() { int i; for (i = 0; i < 16; i++) { SetColor(i); if (XAllocColor(display, colormap, &Colors[i]) == 0) { colormap = XCreateColormap(display, win, DefaultVisual(display, screen), AllocNone); for (i = 0; i < 16; i++) { SetColor(i); XAllocColor(display, colormap, &Colors[i]); } XSetWindowColormap(display, win, colormap); return 0; } } return 0; } static int InitXGCs() { int i; XGCValues gcv; for (i = 0; i < 256; i++) { gcv.foreground = Colors[i % 16].pixel; gcv.background = Colors[(i / 16)].pixel; gcv.font = fontStruct->fid; GCs[i] = XCreateGC(display, win, GCForeground | GCBackground | GCFont, &gcv); } return 0; } */ void DieError(int rc, const char *msg, ...) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); exit(rc); } char ConGetDrawChar(unsigned int index) { static const char tab[] = "\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12\x01\x01 \x02"; assert(index < sizeof(tab) - 1); return tab[index]; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_pmv.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000037172�11602724002�012763� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_pm.cpp * * Copyright (c) 1994-1998, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "clip.h" #define INCL_WIN #define INCL_DOS #define INCL_ORDINALS #include <os2.h> #include <stdlib.h> /* * Pointers to PM functions * Instead of calling PM directly, we are obtaining these pointers * on first access to clipboard. * All these prototypes are copied from OS2.H * Note: all prototypes are 32-bit version only */ #define ORD_WIN32ADDATOM 700 #define ORD_WIN32ALARM 701 #define ORD_WIN32BEGINENUMWINDOWS 702 #define ORD_WIN32BEGINPAINT 703 #define ORD_WIN32CALCFRAMERECT 704 #define ORD_WIN32CANCELSHUTDOWN 705 #define ORD_WIN32CLOSECLIPBRD 707 #define ORD_WIN32COMPARESTRINGS 708 #define ORD_WIN32COPYACCELTABLE 709 #define ORD_WIN32COPYRECT 710 #define ORD_WIN32CPTRANSLATECHAR 711 #define ORD_WIN32CPTRANSLATESTRING 712 #define ORD_WIN32CREATEACCELTABLE 713 #define ORD_WIN32CREATEATOMTABLE 714 #define ORD_WIN32CREATECURSOR 715 #define ORD_WIN32CREATEMSGQUEUE 716 #define ORD_WIN32CREATEPOINTER 717 #define ORD_WIN32DDEINITIATE 718 #define ORD_WIN32DDEPOSTMSG 719 #define ORD_WIN32DDERESPOND 720 #define ORD_WIN32DELETEATOM 721 #define ORD_WIN32DELETELIBRARY 722 #define ORD_WIN32DESTROYACCELTABLE 723 #define ORD_WIN32DESTROYATOMTABLE 724 #define ORD_WIN32DESTROYCURSOR 725 #define ORD_WIN32DESTROYMSGQUEUE 726 #define ORD_WIN32DESTROYPOINTER 727 #define ORD_WIN32DESTROYWINDOW 728 #define ORD_WIN32DISMISSDLG 729 #define ORD_WIN32DRAWBITMAP 730 #define ORD_WIN32DRAWBORDER 731 #define ORD_WIN32DRAWPOINTER 732 #define ORD_WIN32EMPTYCLIPBRD 733 #define ORD_WIN32ENABLEPHYSINPUT 734 #define ORD_WIN32ENABLEWINDOW 735 #define ORD_WIN32ENABLEWINDOWUPDATE 736 #define ORD_WIN32ENDENUMWINDOWS 737 #define ORD_WIN32ENDPAINT 738 #define ORD_WIN32ENUMCLIPBRDFMTS 739 #define ORD_WIN32ENUMDLGITEM 740 #define ORD_WIN32EQUALRECT 741 #define ORD_WIN32EXCLUDEUPDATEREGION 742 #define ORD_WIN32FILLRECT 743 #define ORD_WIN32FINDATOM 744 #define ORD_WIN32FLASHWINDOW 745 #define ORD_WIN32FOCUSCHANGE 746 #define ORD_WIN32FREEERRORINFO 748 #define ORD_WIN32GETCLIPPS 749 #define ORD_WIN32GETCURRENTTIME 750 #define ORD_WIN32GETERRORINFO 751 #define ORD_WIN32GETKEYSTATE 752 #define ORD_WIN32GETLASTERROR 753 #define ORD_WIN32GETMAXPOSITION 754 #define ORD_WIN32GETMINPOSITION 755 #define ORD_WIN32GETNEXTWINDOW 756 #define ORD_WIN32GETPS 757 #define ORD_WIN32GETPHYSKEYSTATE 758 #define ORD_WIN32GETSCREENPS 759 #define ORD_WIN32GETSYSBITMAP 760 #define ORD_WIN32INSENDMSG 761 #define ORD_WIN32INFLATERECT 762 #define ORD_WIN32INITIALIZE 763 #define ORD_WIN32INTERSECTRECT 764 #define ORD_WIN32INVALIDATERECT 765 #define ORD_WIN32INVALIDATEREGION 766 #define ORD_WIN32INVERTRECT 767 #define ORD_WIN32ISCHILD 768 #define ORD_WIN32ISPHYSINPUTENABLED 769 #define ORD_WIN32ISRECTEMPTY 770 #define ORD_WIN32ISTHREADACTIVE 771 #define ORD_WIN32ISWINDOW 772 #define ORD_WIN32ISWINDOWENABLED 773 #define ORD_WIN32ISWINDOWSHOWING 774 #define ORD_WIN32ISWINDOWVISIBLE 775 #define ORD_WIN32LOADACCELTABLE 776 #define ORD_WIN32LOADLIBRARY 777 #define ORD_WIN32LOADMENU 778 #define ORD_WIN32LOADMESSAGE 779 #define ORD_WIN32LOADPOINTER 780 #define ORD_WIN32LOADSTRING 781 #define ORD_WIN32LOCKVISREGIONS 782 #define ORD_WIN32LOCKWINDOWUPDATE 784 #define ORD_WIN32MAKEPOINTS 785 #define ORD_WIN32MAKERECT 786 #define ORD_WIN32MAPDLGPOINTS 787 #define ORD_WIN32MAPWINDOWPOINTS 788 #define ORD_WIN32MESSAGEBOX 789 #define ORD_WIN32MSGSEMWAIT 790 #define ORD_WIN32NEXTCHAR 791 #define ORD_WIN32OFFSETRECT 792 #define ORD_WIN32OPENCLIPBRD 793 #define ORD_WIN32OPENWINDOWDC 794 #define ORD_WIN32PREVCHAR 795 #define ORD_WIN32PROCESSDLG 796 #define ORD_WIN32PTINRECT 797 #define ORD_WIN32QUERYACCELTABLE 798 #define ORD_WIN32QUERYACTIVEWINDOW 799 #define ORD_WIN32QUERYANCHORBLOCK 800 #define ORD_WIN32QUERYATOMLENGTH 801 #define ORD_WIN32QUERYATOMNAME 802 #define ORD_WIN32QUERYATOMUSAGE 803 #define ORD_WIN32QUERYCAPTURE 804 #define ORD_WIN32QUERYCLASSNAME 805 #define ORD_WIN32QUERYCLIPBRDDATA 806 #define ORD_WIN32QUERYCLIPBRDFMTINFO 807 #define ORD_WIN32QUERYCLIPBRDOWNER 808 #define ORD_WIN32QUERYCLIPBRDVIEWER 809 #define ORD_WIN32QUERYCP 810 #define ORD_WIN32QUERYCPLIST 811 #define ORD_WIN32QUERYCURSORINFO 812 #define ORD_WIN32QUERYDESKTOPWINDOW 813 #define ORD_WIN32QUERYDLGITEMSHORT 814 #define ORD_WIN32QUERYDLGITEMTEXT 815 #define ORD_WIN32QUERYDLGITEMTEXTLENGTH 816 #define ORD_WIN32QUERYFOCUS 817 #define ORD_WIN32QUERYMSGPOS 818 #define ORD_WIN32QUERYMSGTIME 819 #define ORD_WIN32QUERYOBJECTWINDOW 820 #define ORD_WIN32QUERYPOINTER 821 #define ORD_WIN32QUERYPOINTERINFO 822 #define ORD_WIN32QUERYPOINTERPOS 823 #define ORD_WIN32QUERYQUEUEINFO 824 #define ORD_WIN32QUERYQUEUESTATUS 825 #define ORD_WIN32QUERYSYSCOLOR 826 #define ORD_WIN32QUERYSYSMODALWINDOW 827 #define ORD_WIN32QUERYSYSPOINTER 828 #define ORD_WIN32QUERYSYSVALUE 829 #define ORD_WIN32QUERYSYSTEMATOMTABLE 830 #define ORD_WIN32QUERYUPDATERECT 831 #define ORD_WIN32QUERYUPDATEREGION 832 #define ORD_WIN32QUERYVERSION 833 #define ORD_WIN32QUERYWINDOW 834 #define ORD_WIN32QUERYWINDOWDC 835 #define ORD_WIN32QUERYWINDOWPOS 837 #define ORD_WIN32QUERYWINDOWPROCESS 838 #define ORD_WIN32QUERYWINDOWPTR 839 #define ORD_WIN32QUERYWINDOWRECT 840 #define ORD_WIN32QUERYWINDOWTEXT 841 #define ORD_WIN32QUERYWINDOWTEXTLENGTH 842 #define ORD_WIN32QUERYWINDOWULONG 843 #define ORD_WIN32QUERYWINDOWUSHORT 844 #define ORD_WIN32REGISTERUSERDATATYPE 845 #define ORD_WIN32REGISTERUSERMSG 846 #define ORD_WIN32RELEASEPS 848 #define ORD_WIN32SCROLLWINDOW 849 #define ORD_WIN32SETACCELTABLE 850 #define ORD_WIN32SETACTIVEWINDOW 851 #define ORD_WIN32SETCAPTURE 852 #define ORD_WIN32SETCLASSMSGINTEREST 853 #define ORD_WIN32SETCLIPBRDDATA 854 #define ORD_WIN32SETCLIPBRDOWNER 855 #define ORD_WIN32SETCLIPBRDVIEWER 856 #define ORD_WIN32SETCP 857 #define ORD_WIN32SETDLGITEMSHORT 858 #define ORD_WIN32SETDLGITEMTEXT 859 #define ORD_WIN32SETFOCUS 860 #define ORD_WIN32SETMSGINTEREST 861 #define ORD_WIN32SETMSGMODE 862 #define ORD_WIN32SETMULTWINDOWPOS 863 #define ORD_WIN32SETOWNER 864 #define ORD_WIN32SETPARENT 865 #define ORD_WIN32SETPOINTER 866 #define ORD_WIN32SETPOINTERPOS 867 #define ORD_WIN32SETRECT 868 #define ORD_WIN32SETRECTEMPTY 869 #define ORD_WIN32SETSYNCHROMODE 870 #define ORD_WIN32SETSYSCOLORS 871 #define ORD_WIN32SETSYSMODALWINDOW 872 #define ORD_WIN32SETSYSVALUE 873 #define ORD_WIN32SETWINDOWBITS 874 #define ORD_WIN32SETWINDOWPOS 875 #define ORD_WIN32SETWINDOWPTR 876 #define ORD_WIN32SETWINDOWTEXT 877 #define ORD_WIN32SETWINDOWULONG 878 #define ORD_WIN32SETWINDOWUSHORT 879 #define ORD_WIN32SHOWCURSOR 880 #define ORD_WIN32SHOWPOINTER 881 #define ORD_WIN32SHOWTRACKRECT 882 #define ORD_WIN32SHOWWINDOW 883 #define ORD_WIN32STARTTIMER 884 #define ORD_WIN32STOPTIMER 885 #define ORD_WIN32SUBSTITUTESTRINGS 886 #define ORD_WIN32SUBTRACTRECT 887 #define ORD_WIN32TERMINATE 888 #define ORD_WIN32TRACKRECT 890 #define ORD_WIN32UNIONRECT 891 #define ORD_WIN32UPDATEWINDOW 892 #define ORD_WIN32UPPER 893 #define ORD_WIN32UPPERCHAR 894 #define ORD_WIN32VALIDATERECT 895 #define ORD_WIN32VALIDATEREGION 896 #define ORD_WIN32WAITMSG 897 #define ORD_WIN32WINDOWFROMDC 898 #define ORD_WIN32WINDOWFROMID 899 #define ORD_WIN32WINDOWFROMPOINT 900 #define ORD_WIN32BROADCASTMSG 901 #define ORD_WIN32POSTQUEUEMSG 902 #define ORD_WIN32SENDDLGITEMMSG 903 #define ORD_WIN32TRANSLATEACCEL 904 #define ORD_WIN32CALLMSGFILTER 905 #define ORD_WIN32CREATEFRAMECONTROLS 906 #define ORD_WIN32CREATEMENU 907 #define ORD_WIN32CREATESTDWINDOW 908 #define ORD_WIN32CREATEWINDOW 909 #define ORD_WIN32DEFDLGPROC 910 #define ORD_WIN32DEFWINDOWPROC 911 #define ORD_WIN32DISPATCHMSG 912 #define ORD_WIN32DRAWTEXT 913 #define ORD_WIN32GETDLGMSG 914 #define ORD_WIN32GETMSG 915 #define ORD_WIN32MSGMUXSEMWAIT 916 #define ORD_WIN32MULTWINDOWFROMIDS 917 #define ORD_WIN32PEEKMSG 918 #define ORD_WIN32POSTMSG 919 #define ORD_WIN32SENDMSG 920 #define ORD_WIN32SETKEYBOARDSTATETABLE 921 #define ORD_WIN32CREATEDLG 922 #define ORD_WIN32DLGBOX 923 #define ORD_WIN32LOADDLG 924 #define ORD_WIN32QUERYCLASSINFO 925 #define ORD_WIN32REGISTERCLASS 926 #define ORD_WIN32RELEASEHOOK 927 #define ORD_WIN32SETHOOK 928 #define ORD_WIN32SUBCLASSWINDOW 929 #define ORD_WIN32SETCLASSTHUNKPROC 930 #define ORD_WIN32QUERYCLASSTHUNKPROC 931 #define ORD_WIN32SETWINDOWTHUNKPROC 932 #define ORD_WIN32QUERYWINDOWTHUNKPROC 933 #define ORD_WIN32QUERYWINDOWMODEL 934 #define ORD_WIN32SETDESKTOPBKGND 935 #define ORD_WIN32QUERYDESKTOPBKGND 936 #define ORD_WIN32POPUPMENU 937 #define ORD_WIN32SETPRESPARAM 938 #define ORD_WIN32QUERYPRESPARAM 939 #define ORD_WIN32REMOVEPRESPARAM 940 #define ORD_WIN32REALIZEPALETTE 941 #define ORD_WIN32CREATEPOINTERINDIRECT 942 #define ORD_WIN32SAVEWINDOWPOS 943 #define ORD_WIN32GETERASEPS 952 #define ORD_WIN32RELEASEERASEPS 953 #define ORD_WIN32SETPOINTEROWNER 971 #define ORD_WIN32STRETCHPOINTER 968 #define ORD_WIN32SETERRORINFO 977 #define ORD_WIN32WAITEVENTSEM 978 #define ORD_WIN32REQUESTMUTEXSEM 979 #define ORD_WIN32WAITMUXWAITSEM 980 #ifndef INCL_32 #error Prototypes are for 32-bit compiler only #endif HAB (APIENTRY *p_WinInitialize)(ULONG flOptions); BOOL (APIENTRY *p_WinTerminate)(HAB hab); HMQ (APIENTRY *p_WinCreateMsgQueue)(HAB hab, LONG cmsg); BOOL (APIENTRY *p_WinDestroyMsgQueue)(HMQ hmq); BOOL (APIENTRY *p_WinEmptyClipbrd)(HAB hab); BOOL (APIENTRY *p_WinOpenClipbrd)(HAB hab); BOOL (APIENTRY *p_WinCloseClipbrd)(HAB hab); BOOL (APIENTRY *p_WinSetClipbrdData)(HAB hab, ULONG ulData, ULONG fmt, ULONG rgfFmtInfo); ULONG (APIENTRY *p_WinQueryClipbrdData)(HAB hab, ULONG fmt); static struct impentry { ULONG ordinal; PFN *pointer; } imported_functions[] = { { ORD_WIN32INITIALIZE, (PFN *) &p_WinInitialize }, { ORD_WIN32TERMINATE, (PFN *) &p_WinTerminate }, { ORD_WIN32CREATEMSGQUEUE, (PFN *) &p_WinCreateMsgQueue }, { ORD_WIN32DESTROYMSGQUEUE,(PFN *) &p_WinDestroyMsgQueue }, { ORD_WIN32EMPTYCLIPBRD, (PFN *) &p_WinEmptyClipbrd }, { ORD_WIN32OPENCLIPBRD, (PFN *) &p_WinOpenClipbrd }, { ORD_WIN32CLOSECLIPBRD, (PFN *) &p_WinCloseClipbrd }, { ORD_WIN32SETCLIPBRDDATA, (PFN *) &p_WinSetClipbrdData }, { ORD_WIN32QUERYCLIPBRDDATA,(PFN *)&p_WinQueryClipbrdData }, { 0, 0 } }; /* * Load PMWIN.DLL and get pointers to all reqd PM functions */ static BOOL loadDLL() { static BOOL loaded = FALSE; static BOOL loaded_ok = FALSE; static HMODULE pmwin; char error[200]; if (loaded == TRUE) return loaded_ok; loaded = TRUE; if (DosLoadModule((PSZ)error, sizeof(error), (PSZ)"PMWIN.DLL", &pmwin) == 0) { struct impentry *imp; for (imp = imported_functions; imp->ordinal; imp++) if (DosQueryProcAddr(pmwin, imp->ordinal, NULL, imp->pointer) != 0) return FALSE; loaded_ok = TRUE; } return loaded_ok; } /* AccessPmClipboard: Purpose: perform all necessary PM stuff and open clipboard for access; Return : TRUE on success, FALSE on error; Note : on error, clipboard is released automatically. LeavePmClipboard: Purpose: releases previously opened clipboard and clear all PM stuff Return : none */ static struct { PPIB ppib; HAB hab; HMQ hmq; ULONG savedtype; BOOL opened; } PmInfo; static void LeavePmClipboard() { if (PmInfo.opened) p_WinCloseClipbrd(PmInfo.hab); if (PmInfo.hmq) p_WinDestroyMsgQueue(PmInfo.hmq); if (PmInfo.hab) p_WinTerminate(PmInfo.hab); PmInfo.ppib->pib_ultype = PmInfo.savedtype; } static BOOL AccessPmClipboard() { PTIB ptib; if (loadDLL() == FALSE) { DosBeep(100, 1500); return FALSE; } memset(&PmInfo, 0, sizeof(PmInfo)); // mutate into PM application for clipboard (Win**) functions access DosGetInfoBlocks(&ptib, &PmInfo.ppib); PmInfo.savedtype = PmInfo.ppib->pib_ultype; PmInfo.ppib->pib_ultype = PROG_PM; if ((PmInfo.hab = p_WinInitialize(0)) != NULLHANDLE) { if ((PmInfo.hmq = p_WinCreateMsgQueue(PmInfo.hab, 0)) != NULLHANDLE) { if (p_WinOpenClipbrd(PmInfo.hab) == TRUE) { PmInfo.opened = TRUE; } } } if (PmInfo.opened != TRUE) { LeavePmClipboard(); DosBeep(100, 1500); } return PmInfo.opened; } int GetClipText(ClipData *cd) { int rc = 0; char *text; cd->fLen = 0; cd->fChar = 0; if (!AccessPmClipboard()) return rc; if ((text = (char *) p_WinQueryClipbrdData(PmInfo.hab, CF_TEXT)) != 0) { cd->fLen = strlen(text); cd->fChar = strdup(text); rc = 1; } LeavePmClipboard(); return rc; } int PutClipText(ClipData *cd) { ULONG len; void *text; int rc = 0; if (!AccessPmClipboard()) return rc; p_WinEmptyClipbrd(PmInfo.hab); len = cd->fLen; if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strncpy((char *)text, cd->fChar, len + 1); if (!p_WinSetClipbrdData(PmInfo.hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); else rc = 1; } LeavePmClipboard(); return rc; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_pascal.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000010747�11331412504�012723� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_pascal.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_PASCAL #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsPas_Normal 0 #define hsPas_Comment1 1 #define hsPas_Comment2 2 #define hsPas_Keyword 3 #define hsPas_String1 4 #define hsPas_String2 5 int Hilit_PASCAL(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { int j = 0; int firstnw = 0; HILIT_VARS(BF->Mode->fColorize->Colors, Line); C = 0; NC = 0; for(i = 0; i < Line->Count;) { if (*p != ' ' && *p != 9) firstnw++; IF_TAB() else { switch(State) { default: case hsPas_Normal: if (isalpha(*p) || *p == '_') { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(Color, &Line->Chars[i], j, 1)) { // Color = hcC_Keyword; State = hsPas_Keyword; } else { Color = CLR_Normal; State = hsPas_Normal; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; State = hsPas_Normal; continue; } else if ((len >= 2) && (*p == '(') && (*(p+1) == '*')) { State = hsPas_Comment1; Color = CLR_Comment; ColorNext(); goto hilit; } else if (*p == '{') { State = hsPas_Comment2; Color = CLR_Comment; goto hilit; } else if (*p == '$') { Color = CLR_HexNumber; ColorNext(); ColorNext(); while (len && isxdigit(*p)) ColorNext(); continue; } else if (isdigit(*p)) { Color = CLR_Number; ColorNext(); while (len && (isdigit(*p) || *p == 'e' || *p == 'E' || *p == '.')) ColorNext(); continue; } else if (*p == '\'') { State = hsPas_String1; Color = CLR_String; goto hilit; } else if (*p == '"') { State = hsPas_String2; Color = CLR_String; goto hilit; } else if (ispunct(*p) && *p != '_') { Color = CLR_Punctuation; goto hilit; } Color = CLR_Normal; goto hilit; case hsPas_Comment1: Color = CLR_Comment; if ((len >= 2) && (*p == '*') && (*(p+1) == ')')) { ColorNext(); ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_Comment2: Color = CLR_Comment; if (*p == '}') { ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_String1: Color = CLR_String; if (*p == '\'') { ColorNext(); State = hsPas_Normal; continue; } goto hilit; case hsPas_String2: Color = CLR_String; if (*p == '"') { ColorNext(); State = hsPas_Normal; continue; } hilit: ColorNext(); continue; } } } switch(State) { case hsPas_String1: case hsPas_String2: State = hsPas_Normal; break; } *ECol = C; return 0; } #endif �������������������������./src/e_mark.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000012736�11602724002�012407� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "e_mark.h" #include "s_util.h" #include "sysdep.h" #include <ctype.h> EMarkIndex markIndex; EMark::EMark(const char *aName, const char *aFileName, EPoint aPoint, EBuffer *aBuffer) : Name(aName), FileName(aFileName), Point(aPoint), Buffer(0) { if (!aBuffer) aBuffer = FindFile(aFileName); if (aBuffer && aBuffer->Loaded) SetBuffer(aBuffer); } EMark::~EMark() { if (Buffer) RemoveBuffer(Buffer); } int EMark::SetBuffer(EBuffer *aBuffer) { assert(aBuffer != 0); assert(filecmp(aBuffer->FileName, FileName.c_str()) == 0); if (Point.Row >= aBuffer->RCount) Point.Row = aBuffer->RCount - 1; if (Point.Row < 0) Point.Row = 0; if (aBuffer->PlaceBookmark(Name.c_str(), Point) == 1) { Buffer = aBuffer; return 1; } return 0; } int EMark::RemoveBuffer(EBuffer *aBuffer) { assert(aBuffer != 0); if (Buffer == 0 || Buffer != aBuffer) return 0; assert(filecmp(aBuffer->FileName, FileName.c_str()) == 0); if (!Buffer->GetBookmark(Name.c_str(), Point)) return 0; if (!Buffer->RemoveBookmark(Name.c_str())) return 0; Buffer = 0; return 1; } EPoint &EMark::GetPoint() { if (Buffer) { assert(Buffer->GetBookmark(Name.c_str(), Point) != 0); } return Point; } EMarkIndex::EMarkIndex() { } EMarkIndex::~EMarkIndex() { vector_iterate(EMark*, Marks, it) delete (*it); } EMark *EMarkIndex::insert(const char *aName, const char *aFileName, EPoint aPoint, EBuffer *aBuffer) { assert(aName != 0 && aName[0] != 0); assert(aFileName != 0 && aFileName[0] != 0); size_t L = 0, R = Marks.size(); while (L < R) { size_t M = (L + R) / 2; int cmp = strcmp(aName, Marks[M]->GetName()); if (cmp == 0) return 0; if (cmp > 0) L = M + 1; else R = M; } EMark* m = new EMark(aName, aFileName, aPoint, aBuffer); Marks.insert(Marks.begin() + L, m); return m; } EMark *EMarkIndex::insert(const char *aName, EBuffer *aBuffer, EPoint aPoint) { assert(aName != 0 && aName[0] != 0); assert(aBuffer != 0); assert(aBuffer->FileName != 0); return insert(aName, aBuffer->FileName, aPoint, aBuffer); } EMark *EMarkIndex::locate(const char *aName) { assert(aName != 0 && aName[0] != 0); size_t L = 0, R = Marks.size(); while (L < R) { size_t M = (L + R) / 2; int cmp = strcmp(aName, Marks[M]->GetName()); if (cmp == 0) return Marks[M]; else if (cmp > 0) L = M + 1; else R = M; } return 0; } int EMarkIndex::remove(const char *aName) { assert(aName != 0 && aName[0] != 0); size_t L = 0, R = Marks.size(); while (L < R) { size_t M = (L + R) / 2; int cmp = strcmp(aName, Marks[M]->GetName()); if (cmp == 0) { delete Marks[M]; Marks.erase(Marks.begin() + M); return 1; } else if (cmp > 0) L = M + 1; else R = M; } return 0; } int EMarkIndex::view(EView *aView, const char *aName) { EMark *m = locate(aName); if (m) { EBuffer *b = m->GetBuffer(); if (b == 0) { if (!FileLoad(0, m->GetFileName(), 0, aView)) return 0; if (!retrieveForBuffer((EBuffer *)ActiveModel)) return 0; b = (EBuffer *)ActiveModel; } aView->SwitchToModel(b); return b->GotoBookmark(m->GetName()); } return 0; } int EMarkIndex::retrieveForBuffer(EBuffer *aBuffer) { vector_iterate(EMark*, Marks, it) if (((*it)->GetBuffer() == 0) && (filecmp(aBuffer->FileName, (*it)->GetFileName()) == 0)) if (!(*it)->SetBuffer(aBuffer)) return 0; return 1; } int EMarkIndex::storeForBuffer(EBuffer *aBuffer) { vector_iterate(EMark*, Marks, it) if (((*it)->GetBuffer() == aBuffer) && ((*it)->RemoveBuffer(aBuffer) == 0)) return 0; return 1; } int EMarkIndex::saveToDesktop(FILE *fp) { vector_iterate(EMark*, Marks, it) // ??? file of buffer or of mark? (different if file renamed) ??? // perhaps marks should be duplicated? if (fprintf(fp, "M|%d|%d|%s|%s\n", (*it)->GetPoint().Row, (*it)->GetPoint().Col, (*it)->GetName(), (*it)->GetFileName()) < 0) return 0; return 1; } // needs performance fixes (perhaps a redesign ?) EMark *EMarkIndex::pushMark(EBuffer *aBuffer, EPoint P) { int stackTop = -1; vector_iterate(EMark*, Marks, it) { const char *name = (*it)->GetName(); if (name && name[0] == '#' && isdigit(name[1])) { int no = atoi(name + 1); if (no > stackTop) stackTop = no; } } char name[20]; sprintf(name, "#%d", stackTop + 1); return insert(name, aBuffer, P); } int EMarkIndex::popMark(EView *aView) { int stackTop = -1; vector_iterate(EMark*, Marks, it) { const char *name = (*it)->GetName(); if (name && name[0] == '#' && isdigit(name[1])) { int no = atoi(name + 1); if (no > stackTop) stackTop = no; } } if (stackTop == -1) return 0; char name[20]; sprintf(name, "#%d", stackTop); if (!view(aView, name)) return 0; assert(remove(name) == 1); return 1; } ����������������������������������./src/fte-unix.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000012025�11347744007�012702� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# versions of FTE to build # Versions: # xfte - using XLib (the most stable) # vfte - for Linux console directly (with limitations, see con_linux.cpp) TGT_NFTE = nfte #TGT_QFTE = qfte TGT_SFTE = sfte TGT_VFTE = vfte TGT_XFTE = xfte TARGETS = $(TGT_XFTE) $(TGT_VFTE) $(TGT_NFTE) $(TGT_SFTE) $(TGT_QFTE) # Supply icons in X if CONFIG_X11_XICON is defined, requires Xpm library XPMLIB = -lXpm # Need -lXt if CONFIG_X11_XTINIT is defined #XTLIB = -lXt #gcc/g++ #CC = g++ #LD = g++ CC = $(CXX) LD = $(CXX) CPPOPTIONS = -Wall -Wpointer-arith -Wconversion -Wwrite-strings -Winline # try this for smaller/faster code and less dependencies #NOEXCEPTION = -fno-rtti -fno-exceptions # choose your os here ####################################################################### # Linux UOS = -DLINUX #XLIBDIR = ####################################################################### # HP/UX #UOS = -DHPUX -D_HPUX_SOURCE -DCAST_FD_SET_INT #UOS = -DHPUX -D_HPUX_SOURCE #CC = CC +a1 #LD = CC #CC = aCC #LD = aCC #XLIBDIR = -L/usr/lib/X11R6 #XINCDIR = -I/usr/include/X11R5 #XLIBDIR = -L/usr/lib/X11R5 #MINCDIR = -I/usr/include/Motif1.2 #MLIBDIR = -L/usr/lib/Motif1.2 SINCDIR = -I/usr/include/slang ####################################################################### # AIX #UOS = -DAIX -D_BSD_INCLUDES #CC = xlC #LD = xlC #CPPOPTIONS = -DNO_NEW_CPP_FEATURES #TARGETS = xfte ####################################################################### # Irix # missing fnmatch, but otherwise ok (tested only on 64bit) # 6.x has fnmatch now ;-) # uncomment below to use SGI CC compiler #UOS = -DIRIX #CC = CC #LD = CC #CPPOPTIONS = -DNO_NEW_CPP_FEATURES -OPT:Olimit=3000 # -xc++ ####################################################################### # SunOS (Solaris) #UOS = -DSUNOS #CC = CC -noex #LD = CC -noex #CPPOPTIONS = -DNO_NEW_CPP_FEATURES #XINCDIR = -I/usr/openwin/include #XLIBDIR = -L/usr/openwin/lib ####################################################################### # for SCO CC # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # If you have problems with the program "cfte" # try to compile this program without optimalization -O2 # use just -O # #UOS = -DSCO #CC = CC -b elf #LD = $(CC) #XLIBDIR = -L/usr/X11R6/lib #SOCKETLIB = -lsocket #CPPOPTIONS = +.cpp ####################################################################### # NCR #CC = cc -Hnocopyr #LD = cc -Hnocopyr #CPPOPTIONS = -w3 #UOS = -DNCR #XINCDIR = -I../../include #SOCKETLIB = -lsocket -lnsl -lc -lucb ####################################################################### QTDIR = /usr/lib64/qt-3.3 #/users/markom/qt QLIBDIR = -L$(QTDIR)/lib #QINCDIR = -I$(QTDIR)/include #QINCDIR = -I/usr/include/qt QINCDIR = -I/usr/include/qt3 -I/usr/lib64/qt-3.3/include MOC = moc LIBDIRS = INCDIRS = $(XINCDIR) $(QINCDIR) $(MINCDIR) $(SINCDIR) OPTIMIZE = -g # -O -g #OPTIMIZE = -O2 #OPTIMIZE = -Os #OPTIMIZE = -O2 -s CCFLAGS = $(CPPOPTIONS) $(OPTIMIZE) $(NOEXCEPTION) $(INCDIRS) -DUNIX $(UOS) LDFLAGS = $(OPTIMIZE) $(LIBDIRS) .SUFFIXES: .cpp .o .moc OEXT = o include objs.inc COBJS = cfte.o s_files.o s_string.o #$(QOBJS:.o=.cpp) SRCS = $(OBJS:.o=.cpp)\ $(COBJS:.o=.cpp)\ $(NOBJS:.o=.cpp)\ $(SOBJS:.o=.cpp)\ $(VOBJS:.o=.cpp)\ $(XOBJS:.o=.cpp) XLIBS = $(XLIBDIR) -lX11 $(SOCKETLIB) $(XPMLIB) $(XTLIB) VLIBS = $(VLIBDIR) -lgpm NLIBS = $(NLIBDIR) -lncurses SLIBS = $(SLIBDIR) -lslang #QLIBS = $(QLIBDIR) -lqt QLIBS = $(QLIBDIR) -lqt-mt MLIBS = $(MLIBDIR) -lXm -lXp -lXt -lXpm -lXext .cpp.o: $(CC) -c $< $(CXXFLAGS) $(CPPFLAGS) $(CCFLAGS) .c.o: $(CC) -c $< $(CFLAGS) $(CPPFLAGS) $(CCFLAGS) .cpp.moc: $(MOC) -o $@ $< all: cfte $(TARGETS) cfte: $(COBJS) $(LD) -o $@ $(LDFLAGS) $(COBJS) c_config.o: defcfg.h defcfg.h: defcfg.cnf perl mkdefcfg.pl <defcfg.cnf >defcfg.h #DEFAULT_FTE_CONFIG = simple.fte DEFAULT_FTE_CONFIG = defcfg.fte #DEFAULT_FTE_CONFIG = defcfg2.fte #DEFAULT_FTE_CONFIG = ../config/main.fte defcfg.cnf: $(DEFAULT_FTE_CONFIG) cfte ./cfte $(DEFAULT_FTE_CONFIG) defcfg.cnf xfte: .depend $(OBJS) $(XOBJS) $(LD) -o $@ $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) qfte: .depend g_qt.moc g_qt_dlg.moc $(OBJS) $(QOBJS) $(LD) -o $@ $(LDFLAGS) $(OBJS) $(QOBJS) $(QLIBS) $(XLIBS) vfte: .depend $(OBJS) $(VOBJS) $(LD) -o $@ $(LDFLAGS) $(OBJS) $(VOBJS) $(VLIBS) sfte: .depend $(OBJS) $(SOBJS) compkeys $(LD) -o $@ $(LDFLAGS) $(OBJS) $(SOBJS) $(SLIBS) nfte: .depend $(OBJS) $(NOBJS) compkeys $(LD) -o $@ $(LDFLAGS) $(OBJS) $(NOBJS) $(NLIBS) compkeys: .depend compkeys.o $(LD) -o $@ $(LDFLAGS) compkeys.o mfte: .depend $(OBJS) $(MOBJS) $(LD) -o $@ $(LDFLAGS) $(OBJS) $(MOBJS) $(MLIBS) $(XLIBS) g_qt.obj: g_qt.moc g_qt_dlg.obj: g_qt_dlg.moc .depend: defcfg.h $(CC) -MM -MG $(CCFLAGS) $(SRCS) 1>.depend # purposefully not part of "all". tags: $(SRCS) $(wildcard *.h) ctags *.h $(SRCS) .PHONY: clean clean: rm -f core *.o *.moc .depend $(TARGETS) defcfg.h defcfg.cnf \ cfte fte sfte vfte nfte mfte qfte xfte compkeys tags # # include dependency files if they exist # ifneq ($(wildcard .depend),) include .depend endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/console.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000014605�11602724002�012255� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* console.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef CONSOLE_H #define CONSOLE_H #include "fte.h" /* don't change these, used as index */ enum { DCH_C1, /// upper left corner DCH_C2, /// upper right corner DCH_C3, /// lower left corner DCH_C4, /// lower right corner DCH_H, /// horizontal line DCH_V, /// vertical line DCH_M1, /// tee pointing down DCH_M2, /// tee pointing right DCH_M3, /// tee pointing left DCH_M4, /// tee pointing up DCH_X, /// crossover 10 DCH_RPTR, /// arrow pointing right DCH_EOL, /// usually print as bullet DCH_EOF, /// usually print as diamond DCH_END, /// DCH_AUP, /// arrow pointing up DCH_ADOWN, /// arrow pointing down DCH_HFORE, /// full square block DCH_HBACK, /// checker board (stipple) DCH_ALEFT, /// arrow pointing left DCH_ARIGHT /// arrow pointing right }; #define ConMaxCols 256 #define ConMaxRows 128 enum TEventScroll { csUp, csDown, csLeft, csRight }; #define evNone 0 #define evKeyDown 0x0001 #define evKeyUp 0x0002 #define evMouseDown 0x0010 #define evMouseUp 0x0020 #define evMouseMove 0x0040 #define evMouseAuto 0x0080 #define evCommand 0x0100 #define evBroadcast 0x0200 #define evNotify 0x0400 #define evKeyboard (evKeyDown | evKeyUp) #define evMouse (evMouseDown | evMouseUp | evMouseMove | evMouseAuto) #define evMessage (evCommand | evBroadcast) #include "conkbd.h" enum TEventCommands { cmRefresh = 1, cmResize, cmClose, cmPipeRead, cmMainMenu, cmPopupMenu, // 6 /* vertical scroll */ cmVScrollUp, // 10 cmVScrollDown, cmVScrollPgUp, cmVScrollPgDn, cmVScrollMove, // 14 /* horizontal scroll */ cmHScrollLeft, // 15 cmHScrollRight, cmHScrollPgLt, cmHScrollPgRt, cmHScrollMove, // 19 cmDroppedFile = 30, cmRenameFile /* TODO: in-place editing of titlebar */ }; typedef unsigned char TAttr; typedef unsigned char TChar; // we need to use class instead of casting to short // otherwice we would need to resolve CPU ordering issues #ifdef NTCONSOLE #define WIN32_LEAN_AND_MEAN #include <windows.h> class TCell : public CHAR_INFO { public: TCell(char c = ' ', TAttr a = 0x07) { Char.AsciiChar = c; Attributes = a; } char GetChar() const { return Char.AsciiChar; } TAttr GetAttr() const { return Attributes; } void SetChar(char c) { Char.AsciiChar = c; } void SetAttr(TAttr a) { Attributes = a; } void Set(char c, TAttr a) { SetChar(c); SetAttr(a); } bool operator==(const TCell &c) const { return (Char.AsciiChar == c.Char.AsciiChar && Attributes == c.Attributes); } }; #else class TCell { TChar Char; TAttr Attr; operator const char*(); operator const unsigned char*(); operator unsigned char*(); operator char*(); public: TCell(TChar c = ' ', TAttr a = 0x07) : Char(c), Attr(a) {} TChar GetChar() const { return Char; } TAttr GetAttr() const { return Attr; } void SetChar(TChar c) { Char = c; } void SetAttr(TAttr a) { Attr = a; } void Set(TChar c, TAttr a) { SetChar(c); SetAttr(a); } bool operator==(const TCell &c) const { return (Char == c.Char && Attr == c.Attr); } }; #endif typedef TCell *PCell; typedef TCell TDrawBuffer[ConMaxCols]; typedef TDrawBuffer *PDrawBuffer; typedef unsigned long TEventMask; typedef unsigned long TKeyCode; typedef unsigned long TCommand; class EModel; // forward class GView; struct TKeyEvent { TEventMask What; GView* View; TKeyCode Code; }; struct TMouseEvent { TEventMask What; GView* View; int X; int Y; unsigned short Buttons; unsigned short Count; TKeyCode KeyMask; }; struct TMsgEvent { TEventMask What; GView *View; EModel *Model; TCommand Command; long Param1; void *Param2; }; union TEvent { TEventMask What; TKeyEvent Key; TMouseEvent Mouse; TMsgEvent Msg; char fill[32]; }; #define SUBMENU_NORMAL (-1) #define SUBMENU_CONDITIONAL (-2) struct mItem { char *Name; char *Arg; int SubMenu; int Cmd; }; struct mMenu { char *Name; unsigned Count; mItem *Items; }; extern int MenuCount; extern mMenu *Menus; int ConInit(int XSize, int YSize); int ConDone(); int ConSuspend(); int ConContinue(); int ConSetTitle(const char *Title, const char *STitle); int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen); int ConClear(); int ConPutBox(int X, int Y, int W, int H, PCell Cell); int ConGetBox(int X, int Y, int W, int H, PCell Cell); int ConPutLine(int X, int Y, int W, int H, PCell Cell); int ConSetBox(int X, int Y, int W, int H, TCell Cell); int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count); int ConSetSize(int X, int Y); int ConQuerySize(int *X, int *Y); int ConSetCursorPos(int X, int Y); int ConQueryCursorPos(int *X, int *Y); int ConShowCursor(); int ConHideCursor(); int ConCursorVisible(); int ConSetCursorSize(int Start, int End); #ifdef CONFIG_MOUSE int ConSetMousePos(int X, int Y); int ConQueryMousePos(int *X, int *Y); int ConShowMouse(); int ConHideMouse(); int ConMouseVisible(); int ConQueryMouseButtons(int *ButtonCount); #endif int ConGetEvent(TEventMask EventMask, TEvent* Event, int WaitTime, int Delete); int ConPutEvent(const TEvent& Event); void MoveCh(PCell B, char Ch, TAttr Attr, size_t Count); void MoveChar(PCell B, int Pos, int Width, const char Ch, TAttr Attr, size_t Count); void MoveMem(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t Count); void MoveStr(PCell B, int Pos, int Width, const char* Ch, TAttr Attr, size_t MaxCount); void MoveCStr(PCell B, int Pos, int Width, const char* Ch, TAttr A0, TAttr A1, size_t MaxCount); void MoveAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count); void MoveBgAttr(PCell B, int Pos, int Width, TAttr Attr, size_t Count); size_t CStrLen(const char *s); int NewMenu(const char *Name); int NewItem(int menu, const char *Name); int NewSubMenu(int menu, const char *Name, int submenu, int type); int GetMenuId(const char *Name); char ConGetDrawChar(unsigned int index); extern char WindowFont[64]; struct TRGBColor { unsigned char r, g, b; }; extern TRGBColor RGBColor[16]; extern bool RGBColorValid[16]; #endif // CONSOLE_H ���������������������������������������������������������������������������������������������������������������������������./src/c_desktop.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000001076�11331412501�012561� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_desktop.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef C_DESKTOP_H #define C_DESKTOP_H #include "fte.h" #ifdef CONFIG_DESKTOP #ifdef UNIX # define DESKTOP_NAME ".fte-desktop" #else # define DESKTOP_NAME "fte.dsk" #endif extern char DesktopFileName[256]; int SaveDesktop(const char *FileName); int LoadDesktop(const char *FileName); #endif #endif // C_DESKTOP_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_ikcz.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000017614�11331412502�012413� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef CON_IKCS_H #define CON_IKCS_H #include "con_i18n.h" #include <X11/keysym.h> struct remapKey { KeySym key_english; KeySym key_remap; }; struct keyboardRec { const struct remapKey *tab; KeySym deadkey; short next; }; static const struct remapKey keyboardStd[] = { {0,} }; static const struct remapKey keyboardHalfCz[] = { {XK_2, 0xff & 'ì'}, {XK_3, 0xff & '¹'}, {XK_4, 0xff & 'è'}, {XK_5, 0xff & 'ø'}, {XK_6, 0xff & '¾'}, {XK_7, 0xff & 'ý'}, {XK_8, 0xff & 'á'}, {XK_9, 0xff & 'í'}, {XK_0, 0xff & 'é'}, {0,} }; static const struct remapKey keyboardFullCz[] = { {XK_1, 0xff & '+'}, {XK_exclam, XK_1}, {XK_2, 0xff & 'ì'}, {XK_at, XK_2}, {XK_3, 0xff & '¹'}, {XK_numbersign, XK_3}, {XK_4, 0xff & 'è'}, {XK_dollar, XK_4}, {XK_5, 0xff & 'ø'}, {XK_percent, XK_5}, {XK_6, 0xff & '¾'}, {XK_asciicircum, XK_6}, {XK_7, 0xff & 'ý'}, {XK_ampersand, XK_7}, {XK_8, 0xff & 'á'}, {XK_asterisk, XK_8}, {XK_9, 0xff & 'í'}, {XK_parenleft, XK_9}, {XK_0, 0xff & 'é'}, {XK_parenright, XK_0}, {XK_minus, XK_equal}, {XK_underscore, XK_percent}, {XK_bracketleft, 0xff & 'ú'}, {XK_braceleft, 0xff & '/'}, {XK_bracketright, 0xff & ')'}, {XK_braceright, 0xff & '('}, {XK_semicolon, 0xff & 'ù'}, {XK_apostrophe, 0xff & '§'}, {XK_colon, 0xff & '"'}, {XK_quotedbl, 0xff & '!'}, {XK_comma, 0xff & ','}, {XK_less, 0xff & '?'}, {XK_period, 0xff & '.'}, {XK_greater, 0xff & ':'}, {XK_question, 0xff & '_'}, {XK_slash, 0xff & '-'}, {0,} }; static const struct remapKey keyboardAcute[] = { {XK_w, 0xff & 'ì'}, {XK_W, 0xff & 'Ì'}, {XK_e, 0xff & 'é'}, {XK_E, 0xff & 'É'}, {XK_r, 0xff & 'à'}, {XK_R, 0xff & 'À'}, {XK_t, 0xff & '»'}, {XK_T, 0xff & '«'}, {XK_y, 0xff & 'ý'}, {XK_Y, 0xff & 'Ý'}, {XK_u, 0xff & 'ú'}, {XK_U, 0xff & 'Ú'}, {XK_i, 0xff & 'í'}, {XK_I, 0xff & 'Í'}, {XK_o, 0xff & 'ó'}, {XK_O, 0xff & 'Ó'}, {XK_p, 0xff & '§'}, {XK_P, 0xff & '§'}, {XK_a, 0xff & 'á'}, {XK_A, 0xff & 'Á'}, {XK_s, 0xff & '¶'}, {XK_S, 0xff & '¦'}, {XK_d, 0xff & 'ï'}, {XK_D, 0xff & 'Ï'}, {XK_h, 0xff & 'þ'}, {XK_H, 0xff & 'Þ'}, {XK_l, 0xff & 'å'}, {XK_L, 0xff & 'Å'}, {XK_z, 0xff & '¼'}, {XK_Z, 0xff & '¬'}, {XK_x, 0xff & '×'}, {XK_X, 0xff & '×'}, {XK_c, 0xff & 'æ'}, {XK_C, 0xff & 'Æ'}, {XK_b, 0xff & 'ß'}, {XK_B, 0xff & 'ß'}, {XK_n, 0xff & 'ñ'}, {XK_N, 0xff & 'Ñ'}, {XK_equal, 0xff & '´'}, {0,} }; static struct remapKey keyboardCaron[] = { {XK_e, 0xff & 'ì'}, {XK_E, 0xff & 'Ì'}, {XK_r, 0xff & 'ø'}, {XK_R, 0xff & 'Ø'}, {XK_t, 0xff & '»'}, {XK_T, 0xff & '«'}, {XK_u, 0xff & 'ù'}, {XK_U, 0xff & 'Ù'}, {XK_i, 0xff & 'î'}, {XK_I, 0xff & 'Î'}, {XK_o, 0xff & 'ö'}, {XK_O, 0xff & 'Ö'}, {XK_a, 0xff & 'ä'}, {XK_A, 0xff & 'Ä'}, {XK_s, 0xff & '¹'}, {XK_S, 0xff & '©'}, {XK_d, 0xff & 'ï'}, {XK_D, 0xff & 'Ï'}, {XK_l, 0xff & 'µ'}, {XK_L, 0xff & '¥'}, {XK_z, 0xff & '¾'}, {XK_Z, 0xff & '®'}, {XK_x, 0xff & '¤'}, {XK_X, 0xff & '¤'}, {XK_c, 0xff & 'è'}, {XK_C, 0xff & 'È'}, {XK_n, 0xff & 'ò'}, {XK_N, 0xff & 'Ò'}, {XK_plus, 0xff & '·'}, {0,} }; static struct remapKey keyboardFirst[] = { {XK_w, 0xff & 'ì'}, {XK_W, 0xff & 'Ì'}, {XK_e, 0xff & 'é'}, {XK_E, 0xff & 'É'}, {XK_r, 0xff & 'ø'}, {XK_R, 0xff & 'Ø'}, {XK_t, 0xff & '»'}, {XK_T, 0xff & '«'}, {XK_y, 0xff & 'ý'}, {XK_Y, 0xff & 'Ý'}, {XK_u, 0xff & 'ú'}, {XK_U, 0xff & 'Ú'}, {XK_i, 0xff & 'í'}, {XK_I, 0xff & 'Í'}, {XK_o, 0xff & 'ó'}, {XK_O, 0xff & 'Ó'}, {XK_p, 0xff & '§'}, {XK_P, 0xff & '§'}, {XK_a, 0xff & 'á'}, {XK_A, 0xff & 'Á'}, {XK_s, 0xff & '¹'}, {XK_S, 0xff & '©'}, {XK_d, 0xff & 'ï'}, {XK_D, 0xff & 'Ï'}, {XK_h, 0xff & 'þ'}, {XK_H, 0xff & 'Þ'}, {XK_l, 0xff & 'å'}, {XK_L, 0xff & 'Å'}, {XK_z, 0xff & '¾'}, {XK_Z, 0xff & '®'}, {XK_x, 0xff & '×'}, {XK_X, 0xff & '×'}, {XK_c, 0xff & 'è'}, {XK_C, 0xff & 'È'}, {XK_b, 0xff & 'ß'}, {XK_B, 0xff & 'ß'}, {XK_n, 0xff & 'ò'}, {XK_N, 0xff & 'Ò'}, {0,} }; static struct remapKey keyboardSecond[] = { {XK_equal, 0xff & '´'}, {XK_plus, 0xff & '·'}, {XK_e, 0xff & 'ì'}, {XK_E, 0xff & 'Ì'}, {XK_r, 0xff & 'à'}, {XK_R, 0xff & 'À'}, {XK_t, 0xff & 'þ'}, {XK_T, 0xff & 'Þ'}, {XK_u, 0xff & 'ù'}, {XK_U, 0xff & 'Ù'}, {XK_i, 0xff & 'î'}, {XK_I, 0xff & 'Î'}, {XK_o, 0xff & 'ö'}, {XK_O, 0xff & 'Ö'}, {XK_a, 0xff & 'ä'}, {XK_A, 0xff & 'Ä'}, {XK_s, 0xff & '¶'}, {XK_S, 0xff & '¦'}, {XK_d, 0xff & 'ð'}, {XK_D, 0xff & 'Ð'}, {XK_l, 0xff & 'µ'}, {XK_L, 0xff & '¥'}, {XK_z, 0xff & '¼'}, {XK_Z, 0xff & '¬'}, {XK_x, 0xff & '¤'}, {XK_X, 0xff & '¤'}, {XK_c, 0xff & 'æ'}, {XK_C, 0xff & 'Æ'}, {XK_n, 0xff & 'ñ'}, {XK_N, 0xff & 'Ñ'}, {0,} }; static struct remapKey keyboardThird[] = { {XK_a, 0xff & 'â'}, {XK_A, 0xff & 'Â'}, {XK_e, 0xff & 'ë'}, {XK_E, 0xff & 'Ë'}, {XK_u, 0xff & 'ü'}, {XK_U, 0xff & 'Ü'}, {XK_o, 0xff & 'ô'}, {XK_O, 0xff & 'Ô'}, {XK_s, 0xff & 'ß'}, {XK_S, 0xff & 'ß'}, {XK_l, 0xff & '³'}, {XK_L, 0xff & '£'}, {XK_z, 0xff & '¿'}, {XK_Z, 0xff & '¯'}, {XK_c, 0xff & 'ç'}, {XK_C, 0xff & 'Ç'}, {0,} }; static struct remapKey keyboardFourth[] = { {XK_a, 0xff & 'ã'}, {XK_A, 0xff & 'Ã'}, {XK_e, 0xff & 'ê'}, {XK_E, 0xff & 'Ê'}, {XK_u, 0xff & 'û'}, {XK_U, 0xff & 'Ü'}, {XK_o, 0xff & 'õ'}, {XK_O, 0xff & 'Õ'}, {XK_l, 0xff & '£'}, {XK_L, 0xff & '£'}, {0,} }; static struct remapKey keyboardFifth[] = { {XK_a, 0xff & '±'}, {XK_A, 0xff & '¡'}, {XK_o, 0xff & '§'}, {XK_O, 0xff & '§'}, {XK_l, 0xff & '|'}, {XK_L, 0xff & '|'}, {0,} }; #define KEYMAPS_MACRO \ {keyboardAcute, 0, 0}, /* 1 */ \ {keyboardCaron, 0, 0}, /* 2 */ \ {keyboardFirst, 0, 0}, /* 3 */ \ {keyboardSecond, 0, 0}, /* 4 */ \ {keyboardThird, 0, 0}, /* 5 */ \ {keyboardFourth, 0, 0}, /* 6 */ \ {keyboardFifth, 0, 0}, /* 7 */ #ifdef XK_dead_acute #define XKB_DEAD_KEYS \ {keyboardStd, XK_dead_acute, 1}, \ {keyboardStd, XK_dead_caron, 2}, \ {keyboardStd, XK_dead_iota, 3}, \ {keyboardStd, XK_dead_iota, 4}, \ {keyboardStd, XK_dead_iota, 5}, \ {keyboardStd, XK_dead_iota, 6}, \ {keyboardStd, XK_dead_iota, 7}, \ {keyboardStd, XK_dead_iota, 0}, #else #define XKB_DEAD_KEYS #endif #ifdef XK_F22 #define F22_DEAD_KEYS \ {keyboardStd, XK_F22, 3}, \ {keyboardStd, XK_F22, 4}, \ {keyboardStd, XK_F22, 5}, \ {keyboardStd, XK_F22, 6}, \ {keyboardStd, XK_F22, 7}, \ {keyboardStd, XK_F22, 0}, #else #define F22_DEAD_KEYS #endif #define KBD_MACRO \ {keyboardStd, XK_Print, 3}, \ {keyboardStd, XK_Print, 4}, \ {keyboardStd, XK_Print, 5}, \ {keyboardStd, XK_Print, 6}, \ {keyboardStd, XK_Print, 7}, \ {keyboardStd, XK_Print, 0}, \ XKB_DEAD_KEYS \ F22_DEAD_KEYS static const struct keyboardRec kbdStdRec[] = { { keyboardStd, 0, 0 }, /* 0 */ KEYMAPS_MACRO KBD_MACRO { NULL } }; static const struct keyboardRec kbdHalfCzRec[] = { { keyboardHalfCz, 0, 0 }, /* 0 */ KEYMAPS_MACRO KBD_MACRO { NULL } }; static const struct keyboardRec kbdFullCzRec[] = { { keyboardFullCz, 0, 0 }, /* 0 */ KEYMAPS_MACRO { keyboardStd, XK_equal, 1 }, { keyboardStd, XK_plus, 2 }, KBD_MACRO { NULL } }; /* * one standart keyboard and two national keyboards * (for programmers and for writers) */ static const struct keyboardRec* nationalKey[] = { kbdStdRec, kbdHalfCzRec, kbdFullCzRec, NULL }; #endif // CON_IKCS_H ��������������������������������������������������������������������������������������������������������������������./src/clip.h����������������������������������������������������������������������������������������0000644�0001750�0001750�00000000734�11331412501�011535� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef CLIP_H #define CLIP_H #include <sys/types.h> #ifdef __cplusplus extern "C" { #endif struct ClipData { size_t fLen; char *fChar; }; int GetClipText(ClipData *cd); int PutClipText(ClipData *cd); #ifdef __cplusplus } #endif #endif // CLIP_H ������������������������������������./src/con_os2.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000101241�11602724002�012501� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_os2.cpp * * Copyright (c) 1994-1998, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // include #include "console.h" #include "gui.h" #include "sysdep.h" #include <process.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #ifndef OS2_INCLUDED #include <os2.h> #endif extern int ShowVScroll; //#define INCL_NOPM //#define INCL_WINSWITCHLIST #define INCL_WIN #define INCL_SUB #define INCL_KBD #define INCL_VIO #define INCL_MOU #define INCL_BASE #define INCL_DOS #define INCL_DOSDEVIOCTL #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; int reading, stopped; TID tid; HMTX Access; HEV ResumeRead; HEV NewData; char *buffer; int buflen; int bufused; int bufpos; EModel *notify; char *Command; int RetCode; int DoTerm; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; static long MouseAutoDelay = 400; static long MouseAutoRepeat = 5; static long MouseMultiClick = 300; static int Initialized = 0; static int MousePresent = 0; static int CursorVisible = 1; /* 1 means visible */ static int MouseVisible = 0; /* 0 means hidden */ static TEvent MouseEv = { evNone }; static TEvent EventBuf = { evNone }; static HMOU MouseHandle = 0; static KBDINFO SaveKbdState; // misc static void DrawCursor(int Show) { VIOCURSORINFO vci; VioGetCurType(&vci, 0); if (Show == 1) vci.attr = 1; else vci.attr = (SHORT)-1; VioSetCurType(&vci, 0); } static void DrawMouse(int Show) { if (!MousePresent) return; if (Show == 1) { MouDrawPtr(MouseHandle); } else { NOPTRRECT npr; int W, H; npr.row = 0; npr.col = 0; ConQuerySize(&W, &H); npr.cCol = (USHORT) (W - 1); npr.cRow = (USHORT) (H - 1); MouRemovePtr(&npr, MouseHandle); } } // *INDENT-OFF* static struct { // TransCharScan USHORT CharScan; TKeyCode KeyCode; } TransCharScan[] = { { 0x0100, kbEsc }, { 0x011B, kbEsc }, { 0x1C0D, kbEnter }, { 0x1C0A, kbEnter }, { 0x1C00, kbEnter }, { 0xE00D, kbEnter | kfGray }, { 0xA600, kbEnter | kfGray }, { 0xE00A, kbEnter | kfGray }, { 0x0E08, kbBackSp }, { 0x0E7F, kbBackSp }, { 0x0E00, kbBackSp }, { 0x0F09, kbTab }, { 0x9400, kbTab }, { 0xA500, kbTab }, { 0x0F00, kbTab }, { 0x4E00, '+' | kfGray }, { 0x9000, '+' | kfGray }, { 0x4E2B, '+' | kfGray }, { 0x4A00, '-' | kfGray }, { 0x8E00, '-' | kfGray }, { 0x4A2D, '-' | kfGray }, { 0x3700, '*' | kfGray }, { 0x9600, '*' | kfGray }, { 0x372A, '*' | kfGray }, { 0xE02F, '/' | kfGray }, { 0xA400, '/' | kfGray }, { 0x9500, '/' | kfGray }, { 0x0300, 0 } }; static struct { // TransScan int ScanCode; TKeyCode KeyCode; } TransScan[] = { { 0x78, '1' }, { 0x79, '2' }, { 0x7A, '3' }, { 0x7B, '4' }, { 0x7C, '5' }, { 0x7D, '6' }, { 0x7E, '7' }, { 0x7F, '8' }, { 0x80, '9' }, { 0x81, '0' }, { 0x10, 'Q' }, { 0x11, 'W' }, { 0x12, 'E' }, { 0x13, 'R' }, { 0x14, 'T' }, { 0x15, 'Y' }, { 0x16, 'U' }, { 0x17, 'I' }, { 0x18, 'O' }, { 0x19, 'P' }, { 0x1E, 'A' }, { 0x1F, 'S' }, { 0x20, 'D' }, { 0x21, 'F' }, { 0x22, 'G' }, { 0x23, 'H' }, { 0x24, 'J' }, { 0x25, 'K' }, { 0x26, 'L' }, { 0x2C, 'Z' }, { 0x2D, 'X' }, { 0x2E, 'C' }, { 0x2F, 'V' }, { 0x30, 'B' }, { 0x31, 'N' }, { 0x32, 'M' }, { 0x29, '`' }, { 0x82, '-' }, { 0x83, '=' }, { 0x2B, '\\' }, { 0x1A, '[' }, { 0x1B, ']' }, { 0x27, ';' }, { 0x28, '\'' }, { 0x33, ',' }, { 0x34, '.' }, { 0x35, '/' }, { 0x37, '*' }, { 0x4E, '+' }, { 0x4A, '-' }, { 0x3B, kbF1 }, { 0x3C, kbF2 }, { 0x3D, kbF3 }, { 0x3E, kbF4 }, { 0x3F, kbF5 }, { 0x40, kbF6 }, { 0x41, kbF7 }, { 0x42, kbF8 }, { 0x43, kbF9 }, { 0x44, kbF10 }, { 0x85, kbF11 }, { 0x86, kbF12 }, { 0x54, kbF1 }, { 0x55, kbF2 }, { 0x56, kbF3 }, { 0x57, kbF4 }, { 0x58, kbF5 }, { 0x59, kbF6 }, { 0x5A, kbF7 }, { 0x5B, kbF8 }, { 0x5C, kbF9 }, { 0x5D, kbF10 }, { 0x87, kbF11 }, { 0x88, kbF12 }, { 0x5E, kbF1 }, { 0x5F, kbF2 }, { 0x60, kbF3 }, { 0x61, kbF4 }, { 0x62, kbF5 }, { 0x63, kbF6 }, { 0x64, kbF7 }, { 0x65, kbF8 }, { 0x66, kbF9 }, { 0x67, kbF10 }, { 0x89, kbF11 }, { 0x8A, kbF12 }, { 0x68, kbF1 }, { 0x69, kbF2 }, { 0x6A, kbF3 }, { 0x6B, kbF4 }, { 0x6C, kbF5 }, { 0x6D, kbF6 }, { 0x6E, kbF7 }, { 0x6F, kbF8 }, { 0x70, kbF9 }, { 0x71, kbF10 }, { 0x8B, kbF11 }, { 0x8C, kbF12 }, { 0x47, kbHome }, { 0x48, kbUp }, { 0x49, kbPgUp }, { 0x4B, kbLeft }, { 0x4C, kbCenter}, { 0x4D, kbRight }, { 0x4F, kbEnd }, { 0x50, kbDown }, { 0x51, kbPgDn }, { 0x52, kbIns }, { 0x53, kbDel }, { 0x77, kbHome }, { 0x8D, kbUp }, { 0x84, kbPgUp }, { 0x73, kbLeft }, { 0x74, kbRight }, { 0x75, kbEnd }, { 0x91, kbDown }, { 0x76, kbPgDn }, { 0x92, kbIns }, { 0x93, kbDel }, { 0x97, kbHome | kfGray }, { 0x98, kbUp | kfGray }, { 0x99, kbPgUp | kfGray }, { 0x9B, kbLeft | kfGray }, { 0x9D, kbRight | kfGray }, { 0x9F, kbEnd | kfGray }, { 0xA0, kbDown | kfGray }, { 0xA1, kbPgDn | kfGray }, { 0xA2, kbIns | kfGray }, { 0xA3, kbDel | kfGray } }; // *INDENT-ON* int ReadKbdEvent(TEvent *Event, int Wait) { KBDKEYINFO ki; UCHAR CharCode, ScanCode; ULONG KeyCode, KeyFlags; USHORT CharScan, Flags; static USHORT PrevFlags = 0; unsigned int I; Event->What = evNone; KbdCharIn(&ki, IO_NOWAIT, 0); if (!(ki.fbStatus & 0x40)) return 0; Event->What = evKeyDown; CharCode = ki.chChar; ScanCode = ki.chScan; CharScan = (USHORT)((((USHORT)ScanCode) << 8) | ((USHORT)CharCode)); Flags = ki.fsState; KeyCode = 0; KeyFlags = 0; /* printf("Key: %X %X %X %X %X \n", (unsigned long) ki.bNlsShift, (unsigned long) ki.fbStatus, (unsigned long) Flags, (unsigned long) CharCode, (unsigned long) ScanCode);*/ if ((Flags & (LEFTSHIFT | RIGHTSHIFT)) != 0) KeyFlags |= kfShift; if ((Flags & (LEFTCONTROL | RIGHTCONTROL)) != 0) KeyFlags |= kfCtrl; /* cpCount = sizeof(cpList);*/ /* rc = DosQueryCp(sizeof(cpList), cpList, &cpCount); // get active code page*/ if (CharCode != 0) { if ((Flags & (LEFTALT)) != 0) KeyFlags |= kfAlt; } else { if ((Flags & (LEFTALT | RIGHTALT)) != 0) KeyFlags |= kfAlt; } /* if (rc != 0) printf("rc = %d\n", rc);*/ if (CharScan == 0) { /* shift/alt/ctrl/caps/scroll/num */ } else if (ScanCode == 0) { /* alt numeric */ KeyCode = CharCode; KeyFlags |= kfAltXXX; } else { /* now check special combinations */ for (I = 0; I < sizeof(TransCharScan)/sizeof(TransCharScan[0]); I++) if (TransCharScan[I].CharScan == CharScan) { KeyCode = TransCharScan[I].KeyCode; break; } if (KeyCode == 0) { if ((CharCode == 0) || (CharCode == 0xE0)) { if (CharCode == 0xE0) KeyFlags |= kfGray; for (I = 0; I < sizeof(TransScan)/sizeof(TransScan[0]); I++) if (TransScan[I].ScanCode == ScanCode) { KeyCode = TransScan[I].KeyCode; break; } } else { if (CharCode < 32) if (KeyFlags & kfCtrl) CharCode += 64; KeyCode = CharCode; } } } Event->Key.Code = KeyCode | KeyFlags; PrevFlags = Flags; return 1; } #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) int ReadMouseEvent(TEvent *Event, ULONG EventMask) { static unsigned short PrevState = 0; static unsigned short PrevButtons = 0; static TEvent LastMouseEvent = { evNone }; static ULONG LastEventTime = 0; static ULONG LastClick = 0; static ULONG LastClickTime = 0; static ULONG LastClickCount = 0; MOUEVENTINFO mi; unsigned short Buttons, State, Btn; USHORT fWait = MOU_NOWAIT; MOUQUEINFO mq; ULONG CurTime; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &CurTime, 4); Event->What = evNone; MouGetNumQueEl(&mq, MouseHandle); if (mq.cEvents == 0) { if (LastMouseEvent.What == evMouseAuto && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoRepeat) { *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } if ((LastMouseEvent.What == evMouseDown || LastMouseEvent.What == evMouseMove) && (LastMouseEvent.Mouse.Buttons) && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoDelay) { LastMouseEvent.What = evMouseAuto; *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } return 0; } if (MouReadEventQue(&mi, &fWait, MouseHandle) != 0) return 0; Event->Mouse.X = mi.col; Event->Mouse.Y = mi.row; State = mi.fs; Btn = Buttons = ((State & (2 | 4))?1:0) | ((State & (8 | 16))?2:0) | ((State & (32 | 64))?4:0); if (Buttons != PrevButtons) { Buttons ^= PrevButtons; if (PrevButtons & Buttons) Event->What = evMouseUp; else Event->What = evMouseDown; } else { Event->What = evMouseMove; if (Event->Mouse.X == LastMouseEvent.Mouse.X && Event->Mouse.Y == LastMouseEvent.Mouse.Y) return 0; } Event->Mouse.Buttons = Buttons; Event->Mouse.Count = 1; PrevState = State; PrevButtons = Btn; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastClickTime, 4); } /* if (Event->What == evMouseMove) { LastClick = 0; LastClickCount = 0; LastClickTime = 0; }*/ { KBDINFO ki; USHORT Flags; TKeyCode KeyFlags = 0; ki.cb = sizeof(ki); KbdGetStatus(&ki, 0); Flags = ki.fsState; if ((Flags & (LEFTSHIFT | RIGHTSHIFT)) != 0) KeyFlags |= kfShift; if ((Flags & (LEFTCONTROL | RIGHTCONTROL)) != 0) KeyFlags |= kfCtrl; if ((Flags & (LEFTALT | RIGHTALT)) != 0) KeyFlags |= kfAlt; Event->Mouse.KeyMask = KeyFlags; } LastMouseEvent = *Event; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } int ConClear() { int W, H; TDrawBuffer B; MoveChar(B, 0, ConMaxCols, ' ', 0x07, 1); if (!ConQuerySize(&W, &H) || !ConSetBox(0, 0, W, H, B[0])) return 0; return 1; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if ((MX >= X) && (MX <= X + W)) { DrawMouse(0); MouseHidden = 1; } VioWrtCellStr((PCH)p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; USHORT WW = (USHORT)(W << 1); unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioReadCellStr((PCH)p, &WW, (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioWrtCellStr((PCH)p, (USHORT)(W << 1), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; int MX, MY; int MouseHidden = 0; unsigned char *p = (unsigned char *) &Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } VioWrtNCell((PCH)p, (USHORT)(W), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 0; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { int MX, MY; int MouseHidden = 0; TCell FillCell = (TCell)(Fill << 8); if (MousePresent && MouseVisible) { ConQueryMousePos(&MX, &MY); if (MX >= X && MX < X + W && MY >= Y && MY < Y + H) { DrawMouse(0); MouseHidden = 1; } } switch (Way) { case csUp: VioScrollUp((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csDown: VioScrollDn((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csLeft: VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csRight: VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; } if (MouseHidden) DrawMouse(1); return 1; } int ConSetSize(int X, int Y) { VIOMODEINFO vmi; int rc; vmi.cb = sizeof(VIOMODEINFO); VioGetMode(&vmi, 0); vmi.col = (USHORT)X; vmi.row = (USHORT)Y; vmi.cb = 2 + 1 + 1 + 2 + 2; rc = VioSetMode(&vmi, 0); return (rc == 0); } int ConQuerySize(int *X, int *Y) { VIOMODEINFO vmi; vmi.cb = sizeof(VIOMODEINFO); VioGetMode(&vmi, 0); if (X) *X = vmi.col; if (Y) *Y = vmi.row; return 1; } int ConSetCursorPos(int X, int Y) { VioSetCurPos((USHORT)Y, (USHORT)X, 0); return 1; } int ConQueryCursorPos(int *X, int *Y) { USHORT AX, AY; VioGetCurPos(&AY, &AX, 0); if (X) *X = AX; if (Y) *Y = AY; return 1; } int ConShowCursor() { CursorVisible = 1; DrawCursor(1); return 1; } int ConHideCursor() { CursorVisible = 0; DrawCursor(0); return 1; } int ConSetCursorSize(int Start, int End) { VIOCURSORINFO ci; VioGetCurType(&ci, 0); ci.yStart = -Start; ci.cEnd = -End; ci.cx = 0; VioSetCurType(&ci, 0); return 1; } int ConSetMousePos(int X, int Y) { PTRLOC mp; if (!MousePresent) return 0; mp.col = (USHORT)X; mp.row = (USHORT)Y; MouSetPtrPos(&mp, MouseHandle); return 1; } int ConQueryMousePos(int *X, int *Y) { PTRLOC mp; if (!MousePresent) return 0; MouGetPtrPos(&mp, MouseHandle); if (X) *X = mp.col; if (Y) *Y = mp.row; return 1; } int ConShowMouse() { MouseVisible = 1; if (!MousePresent) return 0; DrawMouse(1); return 1; } int ConHideMouse() { MouseVisible = 0; if (!MousePresent) return 0; DrawMouse(0); return 1; } int ConMouseVisible() { return (MouseVisible == 1); } int ConQueryMouseButtons(int *ButtonCount) { USHORT Count; if (MouGetNumButtons(&Count, MouseHandle) != 0) return 0; if (ButtonCount) *ButtonCount = Count; return 1; } int ConInit(int XSize, int YSize) { USHORT MevMask = 127; if (Initialized) return 0; EventBuf.What = evNone; MousePresent = (MouOpen(NULL, &MouseHandle) == 0) ?1:0; if (MousePresent) MouSetEventMask(&MevMask, MouseHandle); memset(&SaveKbdState, 0, sizeof(SaveKbdState)); SaveKbdState.cb = sizeof(SaveKbdState); assert(KbdGetStatus(&SaveKbdState, 0) == 0); ConContinue(); Initialized = 1; return 1; } int ConDone() { return ConSuspend(); } int ConSuspend() { VIOINTENSITY vi; static KBDINFO ki; vi.cb = 6; vi.type = 2; vi.fs = 0; VioSetState(&vi, 0); ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); ki.fsMask |= (KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); assert(0 == KbdSetStatus(&ki, 0)); ConHideMouse(); signal(SIGBREAK, SIG_DFL); signal(SIGINT, SIG_DFL); return 1; } int ConContinue() { VIOINTENSITY vi; static KBDINFO ki; signal(SIGBREAK, SIG_IGN); signal(SIGINT, SIG_IGN); ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); ki.fsMask |= (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); assert(KbdSetStatus (&ki, 0) == 0); vi.cb = 6; vi.type = 2; vi.fs = 1; VioSetState(&vi, 0); ConShowMouse(); return 1; } int GetPipeEvent(TEvent *Event) { ULONG ulPostCount; int i; Event->What = evNone; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) continue; if (Pipes[i].notify == 0) continue; if (DosResetEventSem(Pipes[i].NewData, &ulPostCount) != 0) continue; if (ulPostCount > 0) { //fprintf(stderr, "Pipe New Data: %d\n", i); Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[i].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = i; return 1; } } return 0; } int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { KBDINFO ki; if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 0; } if (MouseEv.What != evNone) { *Event = MouseEv; if (Delete) MouseEv.What = evNone; return 0; } EventBuf.What = evNone; Event->What = evNone; ki = SaveKbdState; ki.fsMask &= ~(KEYBOARD_ECHO_ON | KEYBOARD_ASCII_MODE); ki.fsMask |= (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE); assert(KbdSetStatus (&ki, 0) == 0); while ((WaitTime == -1) || (WaitTime >= 0)) { if ((ReadKbdEvent(Event, WaitTime) == 1) && (EventMask & evKeyboard)) break; else if (MousePresent && (ReadMouseEvent(Event, EventMask) == 1) && (EventMask & evMouse)) break; else if (GetPipeEvent(Event) == 1) break; if (WaitTime == 0) return 0; DosSleep(5); if (WaitTime > 0) { WaitTime -= 5; if (WaitTime <= 0) return 0; } } if (Event->What != evNone) { if (Event->What == evMouseMove) { while (ReadMouseEvent(&MouseEv, EventMask) == 1) { if (MouseEv.What == evMouseMove) { *Event = MouseEv; MouseEv.What = evNone; } else break; } } EventBuf = *Event; if (Delete) EventBuf.What = evNone; return 1; } return 0; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(PCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 1; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { RestoreScreen(); if (SavedScreen) free(SavedScreen); ::ConDone(); gui = 0; } int GUI::ConSuspend() { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue() { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } static int CreatePipeChild(PID &pid, HPIPE &hfPipe, char *Command) { static int PCount = 0; char szPipe[32]; char FailBuf[256]; char *Args; int arglen = 0; char *Prog; RESULTCODES rc_code; ULONG ulAction; //ULONG ulNew; HPIPE hfChildPipe; HFILE hfNewStdOut = (HFILE)-1, hfNewStdErr = (HFILE)-1; HFILE hfStdOut = 1, hfStdErr = 2; int rc; sprintf(szPipe, "\\PIPE\\FTE%d\\CHILD%d", getpid(), PCount); PCount++; rc = DosCreateNPipe(szPipe, &hfPipe, NP_NOINHERIT | NP_ACCESS_INBOUND, NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE | 1, 0, 4096, 0); if (rc != 0) return 0; rc = DosConnectNPipe (hfPipe); if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED) { DosClose(hfPipe); return 0; } rc = DosSetNPHState (hfPipe, NP_WAIT | NP_READMODE_BYTE); if (rc != 0) { DosClose(hfPipe); return 0; } rc = DosOpen (szPipe, &hfChildPipe, &ulAction, 0, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE, NULL); if (rc != 0) { DosClose (hfPipe); return 0; } // Duplicate handles DosDupHandle(hfStdOut, &hfNewStdOut); DosDupHandle(hfStdErr, &hfNewStdErr); // Close existing handles for current process DosClose(hfStdOut); DosClose(hfStdErr); // Redirect existing handles to new file DosDupHandle(hfChildPipe, &hfStdOut); DosDupHandle(hfChildPipe, &hfStdErr); // Let started program inherit handles from parent Prog = getenv("COMSPEC"); Args = (char *)malloc(strlen(Prog) + 1 + 3 + strlen(Command) + 1 + 1); if (Args == NULL) { DosClose(hfPipe); return 0; } strcpy(Args, Prog); arglen = strlen(Args) + 1; strcpy(Args + arglen, "/c "); arglen += 3; strcpy(Args + arglen, Command); arglen += strlen(Command) + 1; Args[arglen] = '\0'; rc = DosExecPgm(FailBuf, sizeof(FailBuf), EXEC_ASYNCRESULT, // | EXEC_BACKGROUND, Args, 0, &rc_code, Prog); free(Args); // Get back original handles DosDupHandle(hfNewStdOut, &hfStdOut); DosDupHandle(hfNewStdErr, &hfStdErr); // Close the duplicated handles - no longer needed DosClose(hfNewStdOut); DosClose(hfNewStdErr); DosClose(hfChildPipe); // pipe one way, close out write end if (rc != 0) { DosClose(hfPipe); return 0; } pid = rc_code.codeTerminate; // get pid when successful return 1; } static void _LNK_CONV PipeThread(void *p) { GPipe *pipe = (GPipe *)p; int rc; ULONG ulPostCount; ULONG used; PID pid; HPIPE hfPipe; RESULTCODES rc_code; rc = CreatePipeChild(pid, hfPipe, pipe->Command); if (rc != 0) { //fprintf(stderr, "Failed createpipe"); DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); pipe->reading = 0; DosPostEventSem(pipe->NewData); DosReleaseMutexSem(pipe->Access); return; } //fprintf(stderr, "Pipe: Begin: %d %s\n", pipe->id, Args); while (1) { //fprintf(stderr, "Waiting on pipe\n"); //fread(pipe->buffer, 1, pipe->buflen, fp); rc = DosRead(hfPipe, pipe->buffer, pipe->buflen, &used); if (rc < 0) used = 0; DosRequestMutexSem(pipe->Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Waiting on mutex\n"); pipe->bufused = used; //fprintf(stderr, "Pipe: fread: %d %d\n", pipe->id, pipe->bufused); DosResetEventSem(pipe->ResumeRead, &ulPostCount); if (pipe->bufused == 0) break; if (pipe->notify) { DosPostEventSem(pipe->NewData); pipe->stopped = 0; } DosReleaseMutexSem(pipe->Access); if (pipe->DoTerm) break; //fprintf(stderr, "Waiting on sem\n"); DosWaitEventSem(pipe->ResumeRead, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Read: Released mutex\n"); if (pipe->DoTerm) break; } DosClose(hfPipe); //fprintf(stderr, "Pipe: pClose: %d\n", pipe->id); rc = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &rc_code, &pid, pid); pipe->RetCode = (rc_code.codeResult == 0); // pclose(fp); pipe->reading = 0; DosPostEventSem(pipe->NewData); DosReleaseMutexSem(pipe->Access); //fprintf(stderr, "Read: Released mutex\n"); } int GUI::OpenPipe(const char *Command, EModel *notify) { for (int i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].reading = 1; Pipes[i].stopped = 1; Pipes[i].id = i; Pipes[i].bufused = 0; Pipes[i].bufpos = 0; Pipes[i].buflen = PIPE_BUFLEN; Pipes[i].Command = strdup(Command); Pipes[i].notify = notify; Pipes[i].DoTerm = 0; if ((Pipes[i].buffer = (char *)malloc(PIPE_BUFLEN)) == 0) { free(Pipes[i].Command); return -1; } if (0 != DosCreateMutexSem(0, &Pipes[i].Access, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].ResumeRead, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseMutexSem(Pipes[i].Access); return -1; } if (0 != DosCreateEventSem(0, &Pipes[i].NewData, 0, 0)) { free(Pipes[i].Command); free(Pipes[i].buffer); DosCloseEventSem(Pipes[i].ResumeRead); DosCloseMutexSem(Pipes[i].Access); return -1; } #if defined(__MT__) || defined(__MULTI__) Pipes[i].tid = _beginthread(PipeThread, FAKE_BEGINTHREAD_NULL 16384, &Pipes[i]); #else DosCreateThread(Pipes[i].tid, (PFNTHREAD)PipeThread, &Pipes[i], 0, /* immediate */ 16384); #endif Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } return -1; } int GUI::SetPipeView(int id, EModel *notify) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; DosReleaseMutexSem(Pipes[id].Access); return 1; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { ssize_t l = -1; //ULONG ulPostCount; if (id < 0 || id > MAX_PIPES || Pipes[id].used == 0) return -1; //fprintf(stderr, "Read: Waiting on mutex\n"); //ConContinue(); DosRequestMutexSem(Pipes[id].Access, SEM_INDEFINITE_WAIT); //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); if (Pipes[id].bufused - Pipes[id].bufpos > 0) { l = len; if (l > Pipes[id].bufused - Pipes[id].bufpos) { l = Pipes[id].bufused - Pipes[id].bufpos; } memcpy(buffer, Pipes[id].buffer + Pipes[id].bufpos, l); Pipes[id].bufpos += l; if (Pipes[id].bufpos == Pipes[id].bufused) { Pipes[id].bufused = 0; Pipes[id].bufpos = 0; //fprintf(stderr, "Pipe Resume Read: %d\n", id); Pipes[id].stopped = 1; //fprintf(stderr, "Read: posting sem\n"); DosPostEventSem(Pipes[id].ResumeRead); } } else if (Pipes[id].reading) l = 0; // DosBeep(200, 200); } //fprintf(stderr, "Pipe Read: Got %d %d\n", id, l); DosReleaseMutexSem(Pipes[id].Access); //fprintf(stderr, "Read: Released mutex\n"); return l; } int GUI::ClosePipe(int id) { if (id < 0 || id > MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; if (Pipes[id].reading == 1) { Pipes[id].DoTerm = 1; DosPostEventSem(Pipes[id].ResumeRead); DosWaitThread(&Pipes[id].tid, DCWW_WAIT); } free(Pipes[id].buffer); free(Pipes[id].Command); DosCloseEventSem(Pipes[id].NewData); DosCloseEventSem(Pipes[id].ResumeRead); DosCloseMutexSem(Pipes[id].Access); // fprintf(stderr, "Pipe Close: %d\n", id); Pipes[id].used = 0; //ConContinue(); return Pipes[id].RetCode; } int GUI::RunProgram(int mode, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (Command == 0 || *Command == 0) // empty string = shell Command = getenv("COMSPEC"); rc = (system(Command) == 0); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) frames->Resize(W1, H1); frames->Repaint(); return rc; } int ConSetTitle(const char *Title, const char *STitle) { /* HSWITCH hsw; SWCNTRL sw; HAB hab; PID pid; TID tid; static PVOID Shmem = NULL; if (Shmem == NULL) DosAllocSharedMem(&Shmem, NULL, 4096, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE); strcpy(Shmem, Title); hab = WinInitialize(0); hsw = WinQuerySwitchHandle(NULLHANDLE, getpid()); if (WinQuerySwitchEntry(hsw, &sw) != 0) printf("\x7\n"); else { strncpy (sw.szSwtitle, Title, MAXNAMEL - 1); sw.szSwtitle[MAXNAMEL-1] = 0; printf("hwnd: %X, hwndIcon: %X, pid: %d\n", sw.hwnd, sw.hwndIcon, sw.idProcess); WinQueryWindowProcess(sw.hwnd, &pid, &tid); DosGiveSharedMem(Shmem, pid, PAG_READ | PAG_WRITE); printf("txt 1: %d\n", WinSetWindowText(sw.hwnd, Shmem)); // printf("txt 2: %d\n", WinSetWindowText(Wsw.hwndIcon, Shmem)); WinChangeSwitchEntry(hsw, &sw); } WinTerminate(hab); */ return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, "FTE", MaxLen); strlcpy(STitle, "FTE", SMaxLen); return 1; } int ConCursorVisible() { return (CursorVisible == 1); } int ConPutEvent(const TEvent& Event) { EventBuf = Event; return 1; } extern int SevenBit; char ConGetDrawChar(unsigned int index) { static const char tab[] = "Ú¿ÀÙijÂôÁÅ\x1Aúı°\x1B\x1A"; static const char tab7[] = "++++-|+++++\x1A.-++#+\x1B\x1A"; assert(index < strlen(tab)); return (SevenBit) ? tab7[index] : tab[index]; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_catbs.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002755�11331412504�012554� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_catbs.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_CATBS #include "c_bind.h" #include "o_buflist.h" #define hsBS_Normal 1 // this is for viewing only, do not try to edit or anything. int Hilit_CATBS(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine *Line, hlState &State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int CL = 0; //(LN == BF->VToR(BF->CP.Row)) ? 1 : 0; for (i = 0; i < Line->Count;) { IF_TAB() else { switch (State) { default: case hsBS_Normal: Color = CLR_Normal; while (!CL && len >= 2 && p[1] == '\b') { if (len > 2 && p[0] == p[2]) { // bold Color = CLR_Keyword; NextChar(); NextChar(); C -= 2; } else if (p[0] == '_') { // underline Color = CLR_Symbol; NextChar(); NextChar(); C -= 2; break; } else break; } ColorNext(); continue; } } } *ECol = C; return 0; } #endif �������������������./src/i_search.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000011203�11344266047�012727� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_search.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_search.h" #ifdef CONFIG_I_SEARCH #include "i_view.h" #include "o_buflist.h" #include <stdio.h> static char PrevISearch[ExISearch::MAXISEARCH] = ""; ExISearch::ExISearch(EBuffer *B) : Orig(B->CP), // ? len(0), stacklen(0), Buffer(B), state(INoMatch), Direction(0) { ISearchStr[0] = 0; } ExISearch::~ExISearch() { if (ISearchStr[0] != 0) strcpy(PrevISearch, ISearchStr); } void ExISearch::HandleEvent(TEvent &Event) { int Case = BFI(Buffer, BFI_MatchCase) ? 0 : SEARCH_NCASE; ExView::HandleEvent(Event); switch (Event.What) { case evKeyDown: SetState(IOk); switch (kbCode(Event.Key.Code)) { case kbEsc: Buffer->SetPos(Orig.Col, Orig.Row); EndExec(0); break; case kbEnter: EndExec(1); break; case kbBackSp: if (len > 0) { if (stacklen > 0) { stacklen--; if (Buffer->CenterPos(stack[stacklen].Col, stack[stacklen].Row) == 0) return; } len--; ISearchStr[len] = 0; if (len > 0 && Buffer->FindStr(ISearchStr, len, Case | Direction) == 0) { SetState(INoMatch); } } else { if (Buffer->CenterPos(Orig.Col, Orig.Row) == 0) return; } break; case kbUp: Buffer->ScrollDown(1); break; case kbDown: Buffer->ScrollUp(1); break; case kbLeft: Buffer->ScrollRight(8); break; case kbRight: Buffer->ScrollLeft(8); break; case kbPgDn: Buffer->MovePageDown(); break; case kbPgUp: Buffer->MovePageUp(); break; case kbPgUp | kfCtrl: Buffer->MoveFileStart(); break; case kbPgDn | kfCtrl: Buffer->MoveFileEnd(); break; case kbHome: Buffer->MoveLineStart(); break; case kbEnd: Buffer->MoveLineEnd(); break; case kbTab | kfShift: Direction = SEARCH_BACK; if (len == 0) { strcpy(ISearchStr, PrevISearch); len = (int)strlen(ISearchStr); if (len == 0) break; } if (Buffer->FindStr(ISearchStr, len, Case | Direction | SEARCH_NEXT) == 0) { Buffer->FindStr(ISearchStr, len, Case); SetState(INoPrev); } break; case kbTab: Direction = 0; if (len == 0) { strcpy(ISearchStr, PrevISearch); len = (int)strlen(ISearchStr); if (len == 0) break; } if (Buffer->FindStr(ISearchStr, len, Case | Direction | SEARCH_NEXT) == 0) { Buffer->FindStr(ISearchStr, len, Case); SetState(INoNext); } break; case 'Q' | kfCtrl: Event.What = evKeyDown; Event.Key.Code = Win->GetChar(0); default: if (isAscii(Event.Key.Code) && (len < (int)MAXISEARCH)) { char Ch = (char) Event.Key.Code; stack[stacklen++] = Buffer->CP; ISearchStr[len++] = Ch; ISearchStr[len] = 0; if (Buffer->FindStr(ISearchStr, len, Case | Direction) == 0) { SetState(INoMatch); len--; stacklen--; ISearchStr[len] = 0; Buffer->FindStr(ISearchStr, len, Case | Direction); } } break; } } } void ExISearch::RepaintStatus() { TDrawBuffer B; char s[MAXISEARCH + 1]; const char *p; int W, H; ConQuerySize(&W, &H); switch (state) { case INoMatch: p = " No Match. "; break; case INoPrev: p = " No Prev Match. "; break; case INoNext: p = " No Next Match. "; break; case IOk: default: p = ""; break; } sprintf(s, "ISearch [%s]%s", ISearchStr, p); MoveCh(B, ' ', 0x17, W); MoveStr(B, 0, W, s, 0x17, W); ConPutBox(0, H - 1, W, 1, B); ConSetCursorPos((int)strlen(s) - 1, H - 1); ConShowCursor(); } void ExISearch::SetState(IState s) { state = s; RepaintView(); } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_search.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000107017�11602724002�012717� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_search.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_history.h" #include "e_tags.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "s_util.h" #include "sysdep.h" #include <ctype.h> SearchReplaceOptions::SearchReplaceOptions() { memset(this, 0, sizeof(*this)); } // *INDENT-OFF* int ParseSearchOption(int replace, char c, unsigned long &opt) { switch (tolower(c)) { case 'a': opt |= SEARCH_ALL; break; // search all occurances case 'b': opt |= SEARCH_BLOCK; break; // search in block only case 'c': opt &= ~SEARCH_NEXT; break; // search from current position case 'd': opt |= SEARCH_DELETE; break; // delete found line case 'g': opt |= SEARCH_GLOBAL; break; // search globally case 'i': opt |= SEARCH_NCASE; break; // don't match case case 'j': opt |= SEARCH_JOIN; break; // join found line case 'r': opt |= SEARCH_BACK; break; // search reverse case 'w': opt |= SEARCH_WORDBEG | SEARCH_WORDEND; break; case '<': opt |= SEARCH_WORDBEG; break; case '>': opt |= SEARCH_WORDEND; break; case 'x': opt |= SEARCH_RE; break; // search using regexps default: if (!replace) return 0; switch (c) { case 'n': opt |= SEARCH_NASK; break; // don't ask before replacing default: return 0; } } return 1; } static int UnquoteString(char *str) { char *s, *d; s = str; d = str; while (*s) { if (*s == '\\') { s++; if (*s == 0) return 0; } *d++ = *s++; } *d = 0; return 1; } int ParseSearchOptions(int replace, const char *str, unsigned long &Options) { const char *p = str; Options = SEARCH_NEXT; while (*p) { if (ParseSearchOption(replace, *p, Options) == 0) return 0; p++; } return 1; } int ParseSearchReplace(EBuffer *B, const char *str, int replace, SearchReplaceOptions &opt) { int where = 0; int len = 0; const char *p = str; memset((void *)&opt, 0, sizeof(opt)); if (p == 0) return 0; if (replace) { if (ParseSearchOptions(replace, BFS(B, BFS_DefFindReplaceOpt), opt.Options) == 0) return 0; opt.Options |= SEARCH_REPLACE; } else { if (ParseSearchOptions(replace, BFS(B, BFS_DefFindOpt), opt.Options) == 0) return 0; } while (*p) { switch (*p) { case '\\': if (where == 0) { opt.strSearch[len++] = *p++; if (*p == 0) return 0; opt.strSearch[len++] = *p++; } else if (where == 1) { opt.strReplace[len++] = *p++; if (*p == 0) return 0; opt.strReplace[len++] = *p++; } else return 0; break; case '/': where++; if (!replace && where == 1) where++; if (where == 2) opt.Options = SEARCH_NEXT; if (where > 2) return 0; len = 0; p++; break; default: if (where == 0) opt.strSearch[len++] = *p++; else if (where == 1) opt.strReplace[len++] = *p++; else { char c = *p; p++; if (ParseSearchOption(replace, c, opt.Options) == 0) return 0; } } } if (opt.Options & SEARCH_RE); else { if (UnquoteString(opt.strSearch) == 0) return 0; if (opt.Options & SEARCH_REPLACE) if (UnquoteString(opt.strReplace) == 0) return 0; } opt.ok = 1; return 1; } int EBuffer::FindStr(const char *Data, int Len, int Options) { SearchReplaceOptions opt; opt.Options = Options; return FindStr(Data, Len, opt); } int EBuffer::FindStr(const char *Data, int Len, SearchReplaceOptions &opt) { int Options = opt.Options; int LLen, Start, End; int C, L; PELine X; char *P; if (Options & SEARCH_RE) return 0; if (Len <= 0) return 0; if (Options & SEARCH_NOPOS) { C = Match.Col; L = Match.Row; } else { C = CP.Col; L = VToR(CP.Row); } if (Match.Row != -1) Draw(Match.Row, Match.Row); Match.Row = -1; Match.Col = -1; X = RLine(L); C = CharOffset(X, C); if (Options & SEARCH_NEXT) { int CC = MatchCount ? 1 : 0; if (Options & SEARCH_BACK) { C -= CC; if (C < 0) { if (L == 0) return 0; L--; X = RLine(L); C = X->Count; } } else { if (Options & SEARCH_REPLACE && opt.lastInsertLen > 0) { C += CC * opt.lastInsertLen; // 0 or opt.lastInsertLen } else { C += CC; } if (C >= X->Count) { C = 0; L++; if (L == RCount) return 0; } } } MatchLen = 0; MatchCount = 0; if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (BlockMode == bmStream) { if (L > BE.Row) { L = BE.Row; C = BE.Col; } if (L == BE.Row && C > BE.Col) C = BE.Col; } else { if (L >= BE.Row && BE.Row > 0) { L = BE.Row - 1; C = RLine(L)->Count; } if (BlockMode == bmColumn) if (L == BE.Row - 1 && C >= BE.Col) C = BE.Col; } } else { if (L < BB.Row) { L = BB.Row; C = 0; } if (L == BB.Row && C < BB.Col) C = BB.Col; } } while (1) { if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream) { if (L > BE.Row || L < BB.Row) break; } else if (L >= BE.Row || L < BB.Row) break; } else if (L >= RCount || L < 0) break; X = RLine(L); LLen = X->Count; P = X->Chars; Start = 0; End = LLen; if (Options & SEARCH_BLOCK) { if (BlockMode == bmColumn) { Start = CharOffset(X, BB.Col); End = CharOffset(X, BE.Col); } else if (BlockMode == bmStream) { if (L == BB.Row) Start = CharOffset(X, BB.Col); if (L == BE.Row) End = CharOffset(X, BE.Col); } } if (Options & SEARCH_BACK) { if (C >= End - Len) C = End - Len; } else { if (C < Start) C = Start; } while (((!(Options & SEARCH_BACK)) && (C <= End - Len)) || ((Options & SEARCH_BACK) && (C >= Start))) { if ((!(Options & SEARCH_WORDBEG) || (C == 0) || (WGETBIT(Flags.WordChars, P[C - 1]) == 0)) && (!(Options & SEARCH_WORDEND) || (C + Len >= End) || (WGETBIT(Flags.WordChars, P[C + Len]) == 0)) && ((!(Options & SEARCH_NCASE) && (P[C] == Data[0]) && (memcmp(P + C, Data, Len) == 0)) || ((Options & SEARCH_NCASE) && (toupper(P[C]) == toupper(Data[0])) && (strnicmp(P + C, Data, Len) == 0))) /* && BOL | EOL */ ) { Match.Col = ScreenPos(X, C); Match.Row = L; MatchCount = Len; MatchLen = ScreenPos(X, C + Len) - Match.Col; if (!(Options & SEARCH_NOPOS)) { if (Options & SEARCH_CENTER) CenterPosR(Match.Col, Match.Row); else SetPosR(Match.Col, Match.Row); } Draw(L, L); return 1; } if (Options & SEARCH_BACK) C--; else C++; } if (Options & SEARCH_BACK) { L--; if (L >= 0) C = RLine(L)->Count; } else { C = 0; L++; } } //SetPos(OC, OL); return 0; } int EBuffer::FindRx(RxNode *Rx, SearchReplaceOptions &opt) { int Options = opt.Options; int LLen, Start, End; int C, L; char *P; PELine X; RxMatchRes b; if (!(Options & SEARCH_RE)) return 0; if (Options & SEARCH_BACK) { // not supported View->MView->Win->Choice(GPC_ERROR, "FindRx", 1, "O&K", "Reverse regexp search not supported."); return 0; } if (Rx == 0) return 0; if (Match.Row != -1) Draw(Match.Row, Match.Row); Match.Row = -1; Match.Col = -1; C = CP.Col; L = VToR(CP.Row); X = RLine(L); C = CharOffset(X, C); if (Options & SEARCH_NEXT) { int CC = MatchCount ? MatchCount : 1; if (Options & SEARCH_BACK) { C -= CC; if (Options & SEARCH_BLOCK) { if (C < BB.Col && L == BB.Row) return 0; L--; X = RLine(L); C = X->Count; if (BlockMode == bmColumn) if (BE.Col < C) C = BE.Col; } else { if (C < 0 && L == 0) return 0; L--; X = RLine(L); C = X->Count; } } else { C += CC; if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream || BlockMode == bmLine) { if (C >= X->Count) { C = 0; L++; if (BlockMode == bmLine) { if (L == BE.Row) return 0; } else if (L == BE.Row && (C >= BE.Col || C >= X->Count)) return 0; } } else if (BlockMode == bmColumn) { if (C >= X->Count || C >= BE.Col) { C = BB.Col; L++; if (L == BE.Row) return 0; } } } else { if (C >= X->Count) { C = 0; L++; if (L == RCount) return 0; } } } } MatchLen = 0; MatchCount = 0; if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (BlockMode == bmStream) { if (L > BE.Row) { L = BE.Row; C = BE.Col; } if (L == BE.Row && C > BE.Col) C = BE.Col; } else { if (L >= BE.Row && BE.Row > 0) { L = BE.Row - 1; C = RLine(L)->Count; } if (BlockMode == bmColumn) if (L == BE.Row - 1 && C >= BE.Col) C = BE.Col; } } else { if (L < BB.Row) { L = BB.Row; C = 0; } if (L == BB.Row && C < BB.Col) C = BB.Col; } } while (1) { if (Options & SEARCH_BLOCK) { if (BlockMode == bmStream) { if (L > BE.Row || L < BB.Row) break; } else if (L >= BE.Row || L < BB.Row) break; } else if (L >= RCount || L < 0) break; X = RLine(L); LLen = X->Count; P = X->Chars; Start = 0; End = LLen; if (Options & SEARCH_BLOCK) { if (BlockMode == bmColumn) { Start = CharOffset(X, BB.Col); End = CharOffset(X, BE.Col); } else if (BlockMode == bmStream) { if (L == BB.Row) Start = CharOffset(X, BB.Col); if (L == BE.Row) End = CharOffset(X, BE.Col); } if (End > LLen) End = LLen; } if (Options & SEARCH_BACK) { if (C >= End) C = End; } else { if (C < Start) C = Start; } if (Start <= End) { if (RxExec(Rx, P + Start, End - Start, P + C, &b, (Options & SEARCH_NCASE) ? 0 : RX_CASE) == 1) { C = ScreenPos(X, b.Open[0] + Start); Match.Col = C; Match.Row = L; MatchCount = b.Close[0] - b.Open[0]; MatchLen = ScreenPos(X, b.Close[0] + Start) - C; for (int mm = 0; mm < NSEXPS; mm++) { b.Open[mm] += Start; b.Close[mm] += Start; } MatchRes = b; if (!(Options & SEARCH_NOPOS)) { if (Options & SEARCH_CENTER) CenterPosR(C, L); else SetPosR(C, L); } Draw(L, L); return 1; } } C = 0; L++; } //SetPos(OC, OL); return 0; } int EBuffer::Find(SearchReplaceOptions &opt) { size_t slen = strlen(opt.strSearch); int Options = opt.Options; size_t rlen = strlen(opt.strReplace); RxNode *R = NULL; opt.resCount = -1; opt.lastInsertLen = 0; if (slen == 0) return 0; if (Options & SEARCH_BLOCK) { if (CheckBlock() == 0) return 0; } if (Options & SEARCH_RE) { R = RxCompile(opt.strSearch); if (R == 0) { View->MView->Win->Choice(GPC_ERROR, "Find", 1, "O&K", "Invalid regular expression."); return 0; } } if (Options & SEARCH_GLOBAL) { if (Options & SEARCH_BLOCK) { if (Options & SEARCH_BACK) { if (SetPosR(BE.Col, BE.Row) == 0) goto error; } else { if (SetPosR(BB.Col, BB.Row) == 0) goto error; } } else { if (Options & SEARCH_BACK) { if (RCount < 1) goto error; if (SetPosR(LineLen(RCount - 1), RCount - 1) == 0) goto error; } else { if (SetPosR(0, 0) == 0) goto error; } } } opt.resCount = 0; while (1) { if (Options & SEARCH_RE) { if (FindRx(R, opt) == 0) goto end; } else { if (FindStr(opt.strSearch, slen, opt) == 0) goto end; } opt.resCount++; if (opt.Options & SEARCH_REPLACE) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Replace", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Replace with %s?", opt.strReplace)) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_rep; } if (ch == 'N') { ask = 'N'; goto ok_rep; } if (ch == 'Q') { ask = 'Q'; goto ok_rep; } if (ch == 'A') { ask = 'A'; goto ok_rep; } if (ch == 'O') { ask = 'O'; goto ok_rep; } } ok_rep: if (ask == 'N') goto try_join; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (Options & SEARCH_RE) { PELine L = RLine(Match.Row); int P, R; char *PR = 0; size_t LR = 0; R = Match.Row; P = Match.Col; P = CharOffset(L, P); if (0 == RxReplace(opt.strReplace, L->Chars, L->Count, MatchRes, &PR, &LR)) { if (DelText(R, Match.Col, MatchLen) == 0) goto error; if (PR && LR > 0) if (InsText(R, Match.Col, LR, PR) == 0) goto error; if (PR) free(PR); rlen = LR; } } else { if (DelText(Match.Row, Match.Col, MatchLen) == 0) goto error; if (InsText(Match.Row, Match.Col, rlen, opt.strReplace) == 0) goto error; // Cursor remains at start of inserted string. If there is recursive // replace pattern, fte can go it infinite loop. // Workaround: Move cursor to end of inserted string opt.lastInsertLen = strlen(opt.strReplace); } if (!(Options & SEARCH_BACK)) { MatchLen = rlen; MatchCount = rlen; } if (ask == 'O') goto end; } try_join: if (Options & SEARCH_JOIN) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Join Line", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Join lines %d and %d?", 1 + VToR(CP.Row), 1 + VToR(CP.Row) + 1)) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_join; } if (ch == 'N') { ask = 'N'; goto ok_join; } if (ch == 'Q') { ask = 'Q'; goto ok_join; } if (ch == 'A') { ask = 'A'; goto ok_join; } if (ch == 'O') { ask = 'O'; goto ok_join; } } ok_join: if (ask == 'N') goto try_delete; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (JoinLine(Match.Row, Match.Col) == 0) goto error; if (ask == 'O') goto end; } try_delete: if (Options & SEARCH_DELETE) { char ask = 'A'; if (!(Options & SEARCH_NASK)) { char ch; while (1) { Draw(VToR(CP.Row), 1); Redraw(); switch (View->MView->Win->Choice(0, "Delete Line", 5, "&Yes", "&All", "&Once", "&Skip", "&Cancel", "Delete line %d?", VToR(CP.Row))) { case 0: ch = 'Y'; break; case 1: ch = 'A'; break; case 2: ch = 'O'; break; case 3: ch = 'N'; break; case 4: case -1: default: ch = 'Q'; break; } if (ch == 'Y') { ask = 'Y'; goto ok_delete; } if (ch == 'N') { ask = 'N'; goto ok_delete; } if (ch == 'Q') { ask = 'Q'; goto ok_delete; } if (ch == 'A') { ask = 'A'; goto ok_delete; } if (ch == 'O') { ask = 'O'; goto ok_delete; } } ok_delete: if (ask == 'N') goto next; if (ask == 'Q') goto end; if (ask == 'A') Options |= SEARCH_NASK; } if (Match.Row == RCount - 1) { if (DelText(Match.Row, 0, LineLen()) == 0) goto error; } else if (DelLine(Match.Row) == 0) goto error; if (ask == 'O') goto end; if (!(Options & SEARCH_ALL)) break; goto last; } next: if (!(Options & SEARCH_ALL)) break; Options |= SEARCH_NEXT; last: ; } end: // end of search if (R) RxFree(R); if (Options & SEARCH_ALL) Msg(S_INFO, "%d match(es) found.", opt.resCount); else { if (opt.resCount == 0) { Msg(S_INFO, "[%s] not found", opt.strSearch); return 0; } } return 1; error: if (R) { RxFree(R); } View->MView->Win->Choice(GPC_ERROR, "Find", 1, "O&K", "Error in search/replace."); return 0; } int EBuffer::CompleteWord() { #ifdef CONFIG_I_COMPLETE return View->MView->Win->ICompleteWord(View); #else PELine L = VLine(CP.Row), M; int C, P, X, P1, N, xlen, XL; EPoint O = CP; if (CP.Col == 0) return 0; if (SetPos(CP.Col, CP.Row) == 0) return 0; C = CP.Col; P = CharOffset(L, C); P1 = P; N = VToR(CP.Row); if (P > L->Count) return 0; if (P > 0) { while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; if (P == P1) return 0; xlen = P1 - P; C = ScreenPos(L, P); Match.Row = N; Match.Col = C; //if (SetPos(C, CP.Row) == 0) return 0; //again: if (FindStr(L->Chars + P, xlen, SEARCH_BACK | SEARCH_NEXT | SEARCH_NOPOS | SEARCH_WORDBEG) == 1) { M = RLine(Match.Row); X = CharOffset(M, Match.Col); XL = X; //if ((XL > 0) && ((ChClass(M->Chars[XL - 1]) == 1) || (M->Chars[XL - 1] == '_'))) goto again; while ((XL < M->Count) && ((ChClass(M->Chars[XL]) == 1) || (M->Chars[XL] == '_'))) XL++; { char *pp = (char *)malloc(XL - X - xlen); if (pp) { memcpy(pp, M->Chars + X + xlen, XL - X - xlen); if (InsText(N, O.Col, XL - X - xlen, pp, 1) == 0) return 0; free(pp); } } if (SetPos(O.Col + XL - X - xlen, O.Row) == 0) return 0; Draw(Match.Row, Match.Row); Match.Row = -1; Match.Col = -1; MatchLen = 0; MatchCount = 0; return 1; } } if (Match.Row != -1) Draw(Match.Row, Match.Row); Match.Col = Match.Row = -1; MatchLen = 0; MatchCount = 0; return 0; #endif } int EBuffer::Search(ExState &State, const char *aString, int Options, int /*CanResume*/) { char find[MAXSEARCH+1] = ""; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; int Next = 0; int erc = 0; //int Changed; if (aString) strcpy(find, aString); else if (State.GetStrParam(View, find, sizeof(find)) == 0) if ((erc = View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH)) == 0) return 0; if (strlen(find) == 0) return 0; if (erc == 2) Case ^= SEARCH_NCASE; //if (Changed == 0 && CanResume) // Next |= SEARCH_NEXT; LSearch.ok = 0; strcpy(LSearch.strSearch, find); LSearch.Options = Case | Next | (Options & ~SEARCH_NCASE); LSearch.ok = 1; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::SearchAgain(ExState &/*State*/, unsigned int Options) { if (LSearch.ok == 0) return 0; LSearch.Options |= SEARCH_NEXT; if ((Options & SEARCH_BACK) != (LSearch.Options & SEARCH_BACK)) LSearch.Options ^= SEARCH_BACK; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::SearchReplace(ExState &State, const char *aString, const char *aReplaceString, int Options) { char find[MAXSEARCH+1] = ""; char replace[MAXSEARCH+1] = ""; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; if (aString) strcpy(find, aString); else if (State.GetStrParam(View, find, sizeof(find)) == 0) if (View->MView->Win->GetStr("Find", sizeof(find), find, HIST_SEARCH) == 0) return 0; if (strlen(find) == 0) return 0; if (aReplaceString) strcpy(replace, aReplaceString); else if (State.GetStrParam(View, replace, sizeof(replace)) == 0) if (View->MView->Win->GetStr("Replace", sizeof(replace), replace, HIST_SEARCH) == 0) return 0; LSearch.ok = 0; strcpy(LSearch.strSearch, find); strcpy(LSearch.strReplace, replace); LSearch.Options = Case | (Options & ~SEARCH_NCASE) | SEARCH_ALL | SEARCH_REPLACE; LSearch.ok = 1; if (Find(LSearch) == 0) return 0; return 1; } int EBuffer::Search(ExState &State) { return Search(State, 0, 0, 1); } int EBuffer::SearchB(ExState &State) { return Search(State, 0, SEARCH_BACK, 1); } int EBuffer::SearchRx(ExState &State) { return Search(State, 0, SEARCH_RE, 1); } int EBuffer::SearchAgain(ExState &State) { return SearchAgain(State, 0); } int EBuffer::SearchAgainB(ExState &State) { return SearchAgain(State, SEARCH_BACK); } int EBuffer::SearchReplace(ExState &State) { return SearchReplace(State, 0, 0, 0); } int EBuffer::SearchReplaceB(ExState &State) { return SearchReplace(State, 0, 0, SEARCH_BACK); } int EBuffer::SearchReplaceRx(ExState &State) { return SearchReplace(State, 0, 0, SEARCH_RE); } #ifdef CONFIG_OBJ_ROUTINE int EBuffer::ScanForRoutines() { RxNode *regx; int line; PELine L; RxMatchRes res; if (BFS(this, BFS_RoutineRegexp) == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "No routine regexp."); return 0; } regx = RxCompile(BFS(this, BFS_RoutineRegexp)); if (regx == 0) { View->MView->Win->Choice(GPC_ERROR, "Error", 1, "O&K", "Failed to compile regexp '%s'", BFS(this, BFS_RoutineRegexp)); return 0; } if (rlst.Lines) { free(rlst.Lines); rlst.Lines = 0; } rlst.Lines = 0; rlst.Count = 0; Msg(S_BUSY, "Matching %s", BFS(this, BFS_RoutineRegexp)); for (line = 0; line < RCount; line++) { L = RLine(line); if (RxExec(regx, L->Chars, L->Count, L->Chars, &res) == 1) { rlst.Count++; rlst.Lines = (int *) realloc((void *) rlst.Lines, sizeof(int) * (rlst.Count | 0x1F)); rlst.Lines[rlst.Count - 1] = line; Msg(S_BUSY, "Routines: %d", rlst.Count); } } RxFree(regx); return 1; } #endif int EBuffer::ShowPosition() { int CLine, NLines; int CAct, NAct; int CColumn, NColumns; int CCharPos, NChars; #ifdef HEAPWALK unsigned long MemUsed = 0, MemFree = 0, BlkUsed = 0, BlkFree = 0, BigFree = 0, BigUsed = 0; #endif if (!View) return 0; CLine = CP.Row + 1; NLines = VCount; CAct = VToR(CP.Row) + 1; NAct = RCount; CColumn = CP.Col + 1; NColumns = LineLen(CP.Row); CCharPos = CharOffset(VLine(CP.Row), CP.Col) + 1; NChars = VLine(CP.Row)->Count; #ifdef HEAPWALK if (_heapchk() != _HEAPOK) { MemUsed = -1; } else { _HEAPINFO hi; hi._pentry = NULL; while (_heapwalk(&hi) == _HEAPOK) { if (hi._useflag == _USEDENTRY) { BlkUsed++; MemUsed += hi._size; if (hi._size > BigUsed) BigUsed = hi._size; //fprintf(stderr, "USED %d\n", hi._size); } else { BlkFree++; MemFree += hi._size; if (hi._size > BigFree) BigFree = hi._size; //fprintf(stderr, "FREE %d\n", hi._size); } } } #endif #ifdef CONFIG_UNDOREDO int NN = -1; if (US.UndoPtr > 0) NN = US.Top[US.UndoPtr - 1]; #endif Msg(S_INFO, #ifdef HEAPWALK "M%ld,%ld B%ld,%ld S%ld,%ld" #endif "L%d/%d G%d/%d/%d A%d/%d C%d/%d P%d/%d " #ifdef CONFIG_UNDOREDO "U%d/%d/%d " #endif "H%d/%d/%d", #ifdef HEAPWALK MemUsed, MemFree, BlkUsed, BlkFree, BigUsed, BigFree, #endif CLine, NLines, RGap, RCount, RAllocated, CAct, NAct, CColumn, NColumns, CCharPos, NChars, #ifdef CONFIG_UNDOREDO US.UndoPtr, US.Num, NN, #endif StartHilit, MinRedraw, MaxRedraw); return 1; } #ifdef CONFIG_BOOKMARKS int EBuffer::PlaceBookmark(const char *Name, const EPoint &P) { assert(P.Row >= 0 && P.Row < RCount && P.Col >= 0); vector_iterate(EBookmark*, BMarks, it) if ((*it)->IsName(Name)) { (*it)->SetPoint(P); return 1; } EBookmark* b = new EBookmark(Name, P); BMarks.push_back(b); return 1; } int EBuffer::RemoveBookmark(const char *Name) { vector_iterate(EBookmark*, BMarks, it) if ((*it)->IsName(Name)) { delete (*it); BMarks.erase(it); return 1; } View->MView->Win->Choice(GPC_ERROR, "RemoveBookmark", 1, "O&K", "Bookmark %s not found.", Name); return 0; } int EBuffer::GetBookmark(const char *Name, EPoint &P) { vector_iterate(EBookmark*, BMarks, it) if ((*it)->IsName(Name)) { P = (*it)->GetPoint(); return 1; } return 0; } /* * Searches bookmark list starting at given index (searchFrom) for next * bookmark for line searchForLine. It then returns its name and position * and index (used for next search) or -1 if none found. Name is pointer * directly into bookmark structure (not copied!). If searchForLine is -1, * this function returns any next bookmark -> can be used to enumerate * bookmarks. */ int EBuffer::GetBookmarkForLine(int searchFrom, int searchForLine, const EBookmark* &b) { for (int i = searchFrom; i < (int)BMarks.size(); i++) if (searchForLine == -1 || BMarks[i]->GetPoint().Row == searchForLine) { b = BMarks[i]; return i + 1; } return -1; } int EBuffer::GotoBookmark(const char *Name) { vector_iterate(EBookmark*, BMarks, it) if ((*it)->IsName(Name)) return CenterNearPosR((*it)->GetPoint().Col, (*it)->GetPoint().Row); View->MView->Win->Choice(GPC_ERROR, "GotoBookmark", 1, "O&K", "Bookmark %s not found.", Name); return 0; } #endif int EBuffer::GetMatchBrace(EPoint &M, int MinLine, int MaxLine, int show) { int StateLen; hsState *StateMap = 0; int Pos; PELine L = VLine(M.Row); int dir = 0; hsState State; char Ch1, Ch2; int CountX = 0; int StateRow = -1; M.Row = VToR(CP.Row); Pos = CharOffset(L, M.Col); if (Pos >= L->Count) return 0; switch(L->Chars[Pos]) { case '{': dir = +1; Ch1 = '{'; Ch2 = '}'; break; case '[': dir = +1; Ch1 = '['; Ch2 = ']'; break; case '<': dir = +1; Ch1 = '<'; Ch2 = '>'; break; case '(': dir = +1; Ch1 = '('; Ch2 = ')'; break; case '}': dir = -1; Ch1 = '}'; Ch2 = '{'; break; case ']': dir = -1; Ch1 = ']'; Ch2 = '['; break; case '>': dir = -1; Ch1 = '>'; Ch2 = '<'; break; case ')': dir = -1; Ch1 = ')'; Ch2 = '('; break; default: return 0; } StateMap = 0; if (GetMap(M.Row, &StateLen, &StateMap) == 0) return 0; State = StateMap[Pos]; StateRow = M.Row; while (M.Row >= MinLine && M.Row < MaxLine) { while (Pos >= 0 && Pos < L->Count) { if (L->Chars[Pos] == Ch1 || L->Chars[Pos] == Ch2) { // update syntax state if needed if (StateRow != M.Row) { free(StateMap); StateMap = 0; GetMap(M.Row, &StateLen, &StateMap); if (StateMap == 0) return 0; StateRow = M.Row; } if (StateMap[Pos] == State) { if (L->Chars[Pos] == Ch1) CountX++; if (L->Chars[Pos] == Ch2) CountX--; if (CountX == 0) { M.Col = ScreenPos(L, Pos); free(StateMap); return 1; } } } Pos += dir; } M.Row += dir; if (M.Row >= 0 && M.Row < RCount) { L = RLine(M.Row); Pos = (dir == 1) ? 0 : (L->Count - 1); } } if (StateMap) free(StateMap); if (show) Msg(S_INFO, "No match (%d missing).", CountX); return 0; } int EBuffer::MatchBracket() { EPoint M = CP; if (GetMatchBrace(M, 0, RCount, 1) == 1) return SetPosR(M.Col, M.Row); return 0; } int EBuffer::HilitMatchBracket() { EPoint M = CP; if (View == 0) return 0; int Min = VToR(GetVPort()->TP.Row); int Max = GetVPort()->TP.Row + GetVPort()->Rows; if (Max >= VCount) Max = RCount; else Max = VToR(Max); if (Min < 0) Min = 0; if (Max < Min) return 0; if (GetMatchBrace(M, Min, Max, 0) == 1) { Match = M; MatchLen = 1; MatchCount = 1; Draw(Match.Row, Match.Row); return 1; } return 0; } int EBuffer::SearchWord(int SearchFlags) { char word[MAXSEARCH + 1]; PELine L = VLine(CP.Row); int P, len = 0; int Case = BFI(this, BFI_MatchCase) ? 0 : SEARCH_NCASE; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < int(sizeof(word)) && P < L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) word[len++] = L->Chars[P++]; word[len] = 0; if (len == 0) return 0; return FindStr(word, len, Case | SearchFlags | SEARCH_WORD); } int EBuffer::FindTagWord(ExState &State) { char word[MAXSEARCH + 1]; PELine L = VLine(CP.Row); int P, len = 0; P = CharOffset(L, CP.Col); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; while (len < int(sizeof(word)) && P < L->Count && (ChClass(L->Chars[P]) == 1 || L->Chars[P] == '_')) word[len++] = L->Chars[P++]; word[len] = 0; if (len == 0) { Msg(S_INFO, "No word at cursor."); return 0; } for (int j = 2; j; j--) { if (TagFind(this, View, word)) return 1; if (j == 2) { /* Try autoload tags */ if (!View->ExecCommand(ExTagLoad, State)) break; } else { Msg(S_INFO, "Tag '%s' not found.", word); break; } } return 0; } // *INDENT-ON* �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/cfte.def��������������������������������������������������������������������������������������0000644�0001750�0001750�00000000120�07045070635�012042� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NAME cfte WINDOWCOMPAT DESCRIPTION 'FTE Configuration Compiler' STACKSIZE 49152 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-x2.mak������������������������������������������������������������������������������������0000644�0001750�0001750�00000005635�07272404610�012254� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# versions of FTE to build # Versions: # xfte - using XLib (the most stable) # vfte - for Linux console directly (with limitations, see con_linux.cpp) TARGETS = xfte #TARGETS = xfte vfte PRIMARY = xfte # choose your os here ####################################################################### # Linux #UOS = -DLINUX #XLIBDIR = -L/usr/X11R6/lib ####################################################################### # HP/UX #UOS = -DHPUX -D_HPUX_SOURCE #XINCDIR = -I/usr/include/X11R5 #XLIBDIR = -L/usr/lib/X11R5 #MINCDIR = -I/usr/include/Motif1.2 #MLIBDIR = -L/usr/lib/Motif1.2 ####################################################################### # AIX #UOS = -DAIX -D_BSD_INCLUDES # not recently tested (it did work) ####################################################################### # Irix # missing fnmatch, but otherwise ok (tested only on 64bit) # 6.x has fnmatch now ;-) # uncomment below to use SGI CC compiler #UOS = -DIRIX ####################################################################### # SunOS (Solaris) #UOS = -DSUNOS #XINCDIR = -I/usr/openwin/include #XLIBDIR = -L/usr/openwin/lib ####################################################################### # XFree86OS/2 UOS = -DOS2 XINCDIR = -I$(X11ROOT)/XFree86/include XLIBDIR = -L$(X11ROOT)/XFree86/lib ####################################################################### #QTDIR = /users/markom/qt #QLIBDIR = -L$(QTDIR)/lib #QINCDIR = -I$(QTDIR)/include MOC = moc # for GCC #CC = g++ #LD = gcc #COPTIONS = -xc++ -Wall # for IRIX CC #CC = CC #LD = CC #COPTIONS = -xc++ # for OS/2 CC = gcc -Zmtd LD = gcc -Zmtd -Zexe COPTIONS = LIBDIR = INCDIR = #OPTIMIZE = -g #OPTIMIZE = -O -g OPTIMIZE = -O -s #CCFLAGS = $(OPTIMIZE) $(COPTIONS) -DUNIX $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) CCFLAGS = $(OPTIMIZE) $(COPTIONS) $(UOS) $(INCDIR) $(XINCDIR) $(QINCDIR) $(MINCDIR) LDFLAGS = $(OPTIMIZE) $(LIBDIR) $(XLIBDIR) $(QLIBDIR) $(MLIBDIR) OEXT = o .SUFFIXES: .cpp .o .moc include objs.inc XLIBS = -lX11 QLIBS = -lqt VLIBS = -lgpm -ltermcap MLIBS = -lXm -lXt .cpp.o: $(CC) $(CCFLAGS) -c $< .c.o: $(CC) $(CCFLAGS) -c $< .cpp.moc: $(MOC) $< -o $@ all: cfte $(TARGETS) # rm -f fte ; ln -s $(PRIMARY) fte cfte: cfte.o s_files.o $(LD) $(LDFLAGS) cfte.o s_files.o -o cfte c_config.o: defcfg.h defcfg.h: defcfg.cnf perl mkdefcfg.pl <defcfg.cnf >defcfg.h defcfg.cnf: defcfg.fte cfte cfte defcfg.fte defcfg.cnf xfte: $(OBJS) $(XOBJS) $(LD) $(LDFLAGS) $(OBJS) $(XOBJS) $(XLIBS) -o xfte qfte: g_qt.moc g_qt_dlg.moc $(OBJS) $(QOBJS) $(LD) $(LDFLAGS) $(OBJS) $(QOBJS) $(QLIBS) $(XLIBS) -o qfte vfte: $(OBJS) $(VOBJS) $(LD) $(LDFLAGS) $(OBJS) $(VOBJS) $(VLIBS) -o vfte mfte: $(OBJS) $(MOBJS) $(LD) $(LDFLAGS) $(OBJS) $(MOBJS) $(MLIBS) $(XLIBS) -o mfte g_qt.obj: g_qt.moc g_qt_dlg.obj: g_qt_dlg.moc clean: rm -f *.o $(TARGETS) defcfg.h defcfg.cnf cfte fte ���������������������������������������������������������������������������������������������������./src/e_cvslog.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000013172�11602724002�012745� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * e_cvslog.cpp * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Subclass of EBuffer for writing log for CVS commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #include "e_cvslog.h" #ifdef CONFIG_OBJ_CVS #include "i_view.h" #include "o_cvs.h" #include "s_string.h" #include "sysdep.h" #include <ctype.h> #include <stdio.h> ECvsLog *CvsLogView; ECvsLog::ECvsLog (int createFlags,EModel **ARoot,char *Directory,char *OnFiles):EBuffer (createFlags,ARoot,NULL) { int i,j,p; char msgFile[MAXPATH]; CvsLogView=this; // Create filename for message #ifdef UNIX // Use this in Unix - it says more to user sprintf (msgFile,"/tmp/fte%d-cvs-msg", (int)getpid()); #else tmpnam (msgFile); #endif SetFileName (msgFile,CvsLogMode); // Preload buffer with info InsertLine (0,0, ""); InsertLine (1,60, "CVS: -------------------------------------------------------"); InsertLine (2,59, "CVS: Enter log. Lines beginning with 'CVS:' will be removed"); InsertLine (3,4, "CVS:"); InsertLine (4,18, "CVS: Commiting in "); InsText (4,18,strlen (Directory),Directory); if (OnFiles[0]) { p=5; // Go through files - use GetFileStatus to show what to do with files // First count files int cnt=0;i=0; while (1) { if (OnFiles[i]==0||OnFiles[i]==' ') { while (OnFiles[i]==' ') i++; cnt++; if (!OnFiles[i]) break; } else i++; } int *position=new int[cnt]; int *len=new int[cnt]; char *status=new char[cnt]; // Find out position and status for each file i=j=0;position[0]=0; while (1) { if (OnFiles[i]==0||OnFiles[i]==' ') { // This is not thread-safe! len[j]=i-position[j]; char c=OnFiles[i]; OnFiles[i]=0; status[j]=CvsView->GetFileStatus (OnFiles+position[j]); if (status[j]==0) status[j]='x'; OnFiles[i]=c; while (OnFiles[i]==' ') i++; if (!OnFiles[i]) break; position[++j]=i; } else i++; } // Go through status int fAdded=0,fRemoved=0,fModified=0,fOther=0; for (i=0;i<cnt;i++) switch (toupper(status[i])) { case 'A': fAdded++; break; case 'R': fRemoved++; break; case 'M': fModified++; break; default:fOther++; } // Now list files with given status ListFiles (p,fAdded,"Added",cnt,position,len,status,OnFiles,"Aa"); ListFiles (p,fRemoved,"Removed",cnt,position,len,status,OnFiles,"Rr"); ListFiles (p,fModified,"Modified",cnt,position,len,status,OnFiles,"Mm"); ListFiles (p,fOther,"Other",cnt,position,len,status,OnFiles,"AaRrMm",1); delete position;delete len;delete status; } else { InsertLine (5,4, "CVS:"); InsertLine (6,30, "CVS: Commiting whole directory"); p=7; } InsertLine (p,4, "CVS:"); InsertLine (p+1,60, "CVS: -------------------------------------------------------"); SetPos (0,0); FreeUndo (); Modified=0; } ECvsLog::~ECvsLog () { CvsLogView=0; } void ECvsLog::ListFiles (int &p,const int fCount,const char *title,const int cnt,const int *position, const int *len,const char *status,const char *list,const char *excinc,const int exc) { if (fCount) { InsertLine (p++,4, "CVS:"); int i=strlen (title); InsertLine (p,5, "CVS: "); InsText (p,5,i, title); InsText (p,i+=5,5, " file"); i+=5; if (fCount!=1) InsText (p,i++,1, "s"); InsText (p++,i,1, ":"); for (i=0;i<cnt;i++) if (!!strchr (excinc,status[i])^!!exc) { // Should be displayed InsertLine (p,9, "CVS: "); InsText (p,9,1, status+i);InsText (p,10,1, " "); InsText (p++,11,len[i], list+position[i]); } } } // Overridden because we don't want to load file EViewPort *ECvsLog::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); return V->Port; } int ECvsLog::CanQuit () { return 0; } int ECvsLog::ConfQuit (GxView *V,int /*multiFile*/) { int i; switch (V->Choice (GPC_ERROR,"CVS commit pending",3,"C&ommit","&Discard","&Cancel","")) { case 0: // Commit // First save - this is just try if (Save ()==0) return 0; // Now remove CVS: lines and really save for (i=0;i<RCount;) { PELine l=RLine (i); if (l->Count>=4&&strncmp (l->Chars,"CVS:",4)==0) DelLine (i);else i++; } Save (); // DoneCommit returns 0 if OK return !CvsView->DoneCommit (1); case 1: // Discard CvsView->DoneCommit (0); return 1; case 2: // Cancel default: return 0; } } // Shown in "Closing xxx..." message when closing model void ECvsLog::GetName (char *AName, size_t MaxLen) { strlcpy(AName, "CVS log", MaxLen); } // Shown in buffer list void ECvsLog::GetInfo (char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d:%03d%cCVS log: %s", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified?'*':' ', FileName); } // Normal and short title (normal for window, short for icon in X) void ECvsLog::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { strlcpy(ATitle, "CVS log", MaxLen); strlcpy(ASTitle, "CVS log", SMaxLen); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/sysdep.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000010176�11602724002�012121� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* sysdep.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef SYSDEP_H #define SYSDEP_H #include "fte.h" #if !defined(OS2) && \ !defined(NT) && \ !defined(DOSP32) && \ !defined(LINUX) && \ !defined(HPUX) && \ !defined(AIX) && \ !defined(IRIX) && \ !defined(SCO) && \ !defined(SUNOS) && \ !defined(NCR) # error Target not supported. #endif #include <stdlib.h> #if defined(AIX) || defined(SCO) || defined(NCR) #include <strings.h> #endif #ifdef DBMALLOC #include <malloc.h> #endif #if defined(UNIX) || defined(DJGPP) # define USE_DIRENT #endif #if defined(USE_DIRENT) // also needs fnmatch # include <dirent.h> #endif #if defined(UNIX) # include <unistd.h> # include <pwd.h> # if defined(__CYGWIN__) # include "fnmatch.h" # else # include <fnmatch.h> # endif # define strnicmp strncasecmp # define stricmp strcasecmp # define filecmp strcmp //# define memicmp strncasecmp // FIX, fails for nulls extern "C" int memicmp(const void *s1, const void *s2, size_t n); #endif #if defined(OS2) # include <malloc.h> # if !defined(__TOS_OS2__) # include <dos.h> # endif # include <io.h> # include <process.h> # if defined(BCPP) || defined(WATCOM) || defined(__TOS_OS2__) # include <direct.h> # endif # if defined(BCPP) # include <dir.h> # endif # define filecmp stricmp # if !defined(__EMX__) # define NO_NEW_CPP_FEATURES # endif #endif #if defined(DOS) || defined(DOSP32) # include <malloc.h> # include <dos.h> # include <io.h> # include <process.h> # define NO_NEW_CPP_FEATURES # if defined(BCPP) # include <dir.h> # endif # if defined(WATCOM) # include <direct.h> # endif # if defined(DJGPP) # include <dir.h> # include <unistd.h> # undef MAXPATH extern "C" int memicmp(const void *s1, const void *s2, size_t n); # endif # define filecmp stricmp #endif #if defined(NT) # include <malloc.h> # include <io.h> # include <process.h> # include <fcntl.h> # if defined(MSVC) # include <direct.h> # define snprintf _snprintf # define ssize_t SSIZE_T # endif # if defined(WATCOM) # include <direct.h> # endif # if defined(BCPP) # include <dir.h> # define ssize_t SSIZE_T # endif # if defined(MINGW) # include <dir.h> # define HAVE_BOOL // older versions of MingW may not have it # endif # define filecmp stricmp # define popen _popen # define pclose _pclose #endif #ifndef MAXPATH # define MAXPATH 1024 #endif #ifndef O_BINARY # define O_BINARY 0 /* defined on OS/2, no difference on unix */ #endif #if defined(OS2) || defined(NT) # if defined(__EMX__) || defined(WATCOM) || defined(__TOS_OS2__) # define FAKE_BEGINTHREAD_NULL NULL, # else # define FAKE_BEGINTHREAD_NULL # endif #endif #if (!defined(__IBMC__) && !defined(__IBMCPP__)) || !defined(OS2) # define _LNK_CONV #endif #define PT_UNIXISH 0 #define PT_DOSISH 1 #ifndef S_ISDIR // NT, DOS, DOSP32 # ifdef S_IFDIR # define S_ISDIR(mode) ((mode) & S_IFDIR) # else # define S_ISDIR(mode) ((mode) & _S_IFDIR) # endif #endif #ifndef S_IWGRP #define S_IWGRP 0 #define S_IWOTH 0 #endif #if defined(OS2) || defined(NT) || defined(DOSP32) || defined(DOS) #define PATHTYPE PT_DOSISH #else #define PATHTYPE PT_UNIXISH #endif #if defined __cplusplus && __cplusplus >= 199707L #define HAVE_BOOL #endif #if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) #define HAVE_BOOL #endif #if defined _G_HAVE_BOOL #define HAVE_BOOL #endif #if defined __BORLANDC__ && __BORLANDC__ >= 0x0500 #define HAVE_BOOL #endif #if defined __BORLANDC__ && defined __OS2__ #define popen _popen #define pclose _pclose #define ftruncate _ftruncate #endif #undef HAVE_STRLCPY #undef HAVE_STRLCAT #ifndef HAVE_BOOL #define bool int #define true 1 #define false 0 #endif #endif // SYSDEP_H ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clipserv.def����������������������������������������������������������������������������������0000644�0001750�0001750�00000000132�07045070640�012747� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NAME clipserv WINDOWAPI DESCRIPTION 'FTE Clipboard access server for VIO' STACKSIZE 49152 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_ascii.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000005637�11344266047�012570� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_ascii.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "i_ascii.h" #ifdef CONFIG_I_ASCII #include "c_color.h" static int SPos = 0; static int SLPos = 0; ExASCII::ExASCII() : Pos(SPos), LPos(SLPos) { } ExASCII::~ExASCII() { SPos = Pos; SLPos = LPos; } void ExASCII::HandleEvent(TEvent &Event) { int W, H; ConQuerySize(&W, &H); switch (Event.What) { case evKeyDown: switch(kbCode(Event.Key.Code)) { case kbLeft: Pos--; Event.What = evNone; break; case kbRight: Pos++; Event.What = evNone; break; case kbHome: Pos = 0; Event.What = evNone; break; case kbEnd: Pos = 255; Event.What = evNone; break; case kbLeft + kfCtrl: Pos -= 16; Event.What = evNone; break; case kbRight + kfCtrl: Pos += 16; Event.What = evNone; break; case kbUp: Pos -= W; LPos -= W; Event.What = evNone; break; case kbDown: Pos += W; LPos += W; Event.What = evNone; break; case kbEsc: EndExec(-1); Event.What = evNone; break; case kbEnter: EndExec(Pos); Event.What = evNone; break; } break; #if 0 case evMouseDown: if (E.Mouse.X < XPos || E.Mouse.X >= XPos + 34 || E.Mouse.Y < YPos || E.Mouse.Y >= YPos + 10) { abort = 2; break; } do { x = E.Mouse.X - XPos - 1; y = E.Mouse.Y - YPos - 1; if (x >= 0 && x < 32 && y >= 0 && y < 8) { X = x; Y = y; if (X >= 32) X = 31; if (Y >= 8) Y = 7; if (X < 0) X = 0; if (Y < 0) Y = 0; frames->ConSetCursorPos(X + XPos + 1, Y + YPos + 1); sprintf(s, "0%03o %03d 0x%02X", X + Y * 32, X + Y * 32, X + Y * 32); MoveStr(B, 0, 13, s, hcAsciiStatus, 13); frames->ConPutBox(XPos + 2, YPos + 9, 13, 1, B); } if (E.Mouse.Count == 2) { abort = 1; break; } gui->ConGetEvent(evMouse, &E, -1, 1); if (E.What == evMouseUp) break; } while (1); break; #endif } } void ExASCII::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); if (Pos > 255) Pos = 255; if (Pos < 0) Pos = 0; if (LPos + W < Pos) LPos = Pos - W + 1; if (LPos > 255 - W) LPos = 255 - W + 1; if (LPos > Pos) LPos = Pos; if (LPos < 0) LPos = 0; for (int i = 0; i < W; i++) MoveCh(B + i, char(i + LPos), hcAsciiChars, 1); ConSetCursorPos(Pos - LPos, H - 1); ConShowCursor(); ConPutBox(0, H - 1, W, 1, B); } #endif �������������������������������������������������������������������������������������������������./src/s_files.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000031035�11602724002�012566� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* s_files.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "s_files.h" #include "sysdep.h" #include "s_util.h" #include "s_string.h" #include <stdlib.h> // getenv #include <ctype.h> #include <sys/stat.h> #if defined(OS2) #define INCL_DOS #include <os2.h> #endif #if defined(NT) # define WIN32_LEAN_AND_MEAN 1 # include <windows.h> #endif #if defined(DOSP32) # include "port.h" #endif #if defined(DJGPP) static inline int is_end(int c) { return c == 0 || c == '.' || c == '/'; } static inline int is_filename_char(int c) { return (strchr("+<>",c) == NULL); } static void my_fixpath(const char *in, char *out) { // this does most of the cleanup _fixpath(in,out); if (_USE_LFN) return; // handle 8+3 restrictions char tmp[MAXPATH]; char *t = tmp; char *o = out; if (o[0] && o[1] == ':') { *t++ = *o++; *t++ = *o++; } while (*o) { int i; // copy over slash if (*o == '/') *t++ = *o++; // copy over filename (up to 8 chars) for (i = 0; i < 8 && !is_end(*o); o++) if (is_filename_char(*o)) *t++ = *o, i++; // copy over extension (up to 3 chars) if (*o == '.') { // don't copy a trailing '.' unless following a ':' if (o[1] == 0 && o > out && o[-1] != ':') break; *t++ = (i > 0 ? '.' : '_'); o++; for (i = 0; i < 3 && !is_end(*o); o++) if (is_filename_char(*o)) *t++ = *o, i++; } // find next slash while (*o && *o != '/') o++; } *t++ = 0; #if 0 if (strcmp(out,tmp) != 0) fprintf(stderr,"fix: '%s'->'%s'\n",out,tmp); #endif strcpy(out,tmp); } #endif char *Slash(char *Path, int Add) { size_t len = strlen(Path); if (Add) { if ((len == 0) || !ISSLASH(Path[len - 1])) { Path[len] = SLASH; Path[len+1] = 0; } } else { if ((len > 1) #if PATHTYPE == PT_DOSISH && ((len > 3) || (Path[1] != ':')) #endif ) { if (ISSLASH(Path[len - 1])) { Path[len - 1] = 0; } } } return Path; } char *SlashDir(char *Path) { size_t len = strlen(Path); if (len > 1) { #if PATHTYPE == PT_DOSISH if ((len == 2) && Path[1] == ':') { #ifdef DJGPP char tmp[MAXPATH]; strcpy(tmp,Path); my_fixpath(tmp,Path); strcat(Path,SSLASH); #else Path[2] = SLASH; Path[3] = 0; #endif } else #endif if (!ISSLASH(Path[len - 1])) { struct stat statbuf; if (stat(Path, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { Path[len] = SLASH; Path[len+1] = 0; } } } } return Path; } int IsDirectory(const char *Path) { size_t len = strlen(Path); if (len > 0) { #if PATHTYPE == PT_DOSISH if ((len == 2) && Path[1] == ':') return 1; else #endif if (!ISSLASH(Path[len - 1])) { int res; struct stat statbuf; #if PATHTYPE == PT_UNIXISH if (Path[0] == '~') { char Expanded[MAXPATH]; if (ExpandPath(Path, Expanded, sizeof(Expanded)) == -1) return 0; res = stat(Expanded, &statbuf); } else #endif res = stat(Path, &statbuf); if (res == 0) { if (S_ISDIR(statbuf.st_mode)) { return 1; } } return 0; } else return 1; } return 0; } #if PATHTYPE == PT_DOSISH static int GetDiskCurDir(int drive, char *dir) { if (drive < 1 || drive > 26) return -1; #if defined(__EMX__) return (_getcwd1(dir, (char)(drive + 'A' - 1)) == 0) ? 0 : -1; #elif defined(OS2) { ULONG len = MAXPATH - 4; // 'c:\0' return (DosQueryCurrentDir(drive, dir, &len) == 0) ? 0 : -1; } #elif defined(NT) { char orig[MAXPATH], newdrive[MAXPATH]; // set to new drive, get directory and restore original directory if (!GetCurrentDirectory(sizeof(orig), orig)) return -1; newdrive[0] = drive + 'A' - 1; newdrive[1] = ':'; newdrive[2] = 0; if (!SetCurrentDirectory(newdrive)) return -1; if (!GetCurrentDirectory(sizeof(newdrive), newdrive)) return -1; strcpy(dir, newdrive + 3); SetCurrentDirectory(orig); // ? check return 0; } #elif defined(DOS) || defined(DOSP32) return (plGetcurdir(drive, dir) != 0); #endif } static int SetDrive(int drive) { // 1 = A, 2 = B, 3 = C, ... if (drive < 1 || drive > 26) return -1; // mess // _chdrive seems to be most portable between dosish systems, // but seem to take different arguments ??? #if defined(__EMX__) return _chdrive(drive + 'A' - 1); #elif defined(OS2) return (DosSetDefaultDisk(drive) == 0) ? 0 : -1; #elif defined(NT) char buf[3]; buf[0] = (char)(drive + 'A' - 1); buf[1] = ':'; buf[2] = '\0'; return SetCurrentDirectory(buf) ? 0 : -1; #elif defined(DOS) || defined(DOSP32) unsigned int ndr; _dos_setdrive(drive, &ndr); return 0; //(ndr == drive) ? 0 : -1; // ? #endif } #endif #if PATHTYPE == PT_UNIXISH int RemoveDots(const char *p, char* Dest) { char *d = Dest; while (*p) { // if ((strncmp(p, SSLASH SSLASH, 2) == 0)) { if (ISSLASH(p[0]) && ISSLASH(p[1])) { p++; // } else if ((strncmp(p, SSLASH ".." SSLASH, 4) == 0) || (strcmp(p, SSLASH "..") == 0)) { } else if (ISSLASH(p[0]) && p[1] == '.' && p[2] == '.' && (ISSLASH(p[3]) || p[3] == 0)) { p += 3; while ((d > Dest) && !ISSEP(*d)) d--; *d = 0; continue; // } else if ((strncmp(p, SSLASH "." SSLASH, 3) == 0) || (strcmp(p, SSLASH ".") == 0)) { } else if (ISSLASH(p[0]) && p[1] == '.' && (ISSLASH(p[2]) || p[2] == 0)) { p += 2; continue; } *d++ = *p++; *d = 0; } *d = 0; return 0; } #endif int ExpandPath(const char *Path, char *Expand, size_t ExpandSize) { char Name[MAXPATH]; if (Path[0] == 0) { Expand[0] = 0; return 0; } #if PATHTYPE == PT_DOSISH int slashed = 0; strlcpy(Name, Path, sizeof(Name)); if (Name[0] != 0) slashed = ISSLASH(Name[strlen(Name)-1]); Slash(Name, 0); #if defined(DJGPP) my_fixpath(Name, Expand); #else //puts(Name); if (Name[0] && Name[1] == ':' && Name[2] == 0) { // '?:' int drive = Name[0]; strlcpy(Expand, Name, ExpandSize); Expand[2] = '\\'; Expand[3] = 0; drive = (int)(toupper(Name[0]) - 'A' + 1); if (GetDiskCurDir(drive, Expand + 3) == -1) return -1; } else { #if defined(__EMX__) if (_fullpath(Expand, Name, MAXPATH) == -1) return -1; #else if (_fullpath(Expand, Name, MAXPATH) == NULL) return -1; #endif } #endif #if defined(__EMX__) { char *p = Expand; if (p && *p) do { if (ISSLASH(*p)) *p = SLASH; } while (*p++); } #endif if (slashed) SlashDir(Expand); //puts(Expand); return 0; #endif #if PATHTYPE == PT_UNIXISH char Name2[MAXPATH]; char *path, *p; strlcpy(Name, Path, sizeof(Name)); switch (Name[0]) { case SLASH: break; case '~': if (Name[1] == SLASH || Name[1] == 0) { path = Name + 1; strlcpy(Name2, getenv("HOME"), sizeof(Name2)); } else { struct passwd *pwd; p = Name; p++; while (*p && (*p != SLASH)) p++; if (*p == SLASH) { path = p + 1; *p = 0; } else { path = p; } pwd = getpwnam(Name + 1); if (pwd == NULL) return -1; strlcpy(Name2, pwd->pw_dir, sizeof(Name2)); } if (path[0] != SLASH) Slash(Name2, 1); strlcat(Name2, path, sizeof(Name2)); strlcpy(Name, Name2, sizeof(Name)); break; default: if (getcwd(Name, MAXPATH) == NULL) return -1; Slash(Name, 1); strlcat(Name, Path, sizeof(Name)); break; } return RemoveDots(Name, Expand); #endif } int IsSameFile(const char *Path1, const char *Path2) { char p1[MAXPATH], p2[MAXPATH]; if (ExpandPath(Path1, p1, sizeof(p1)) == -1) return -1; if (ExpandPath(Path2, p2, sizeof(p2)) == -1) return -1; if (filecmp(p1, p2) == 0) return 1; return 0; } int JustDirectory(const char *Path, char *Dir, size_t DirSize) { char *p; if (ExpandPath(Path, Dir, DirSize) == -1) strlcpy(Dir, Path, DirSize); p = SepRChr(Dir); if (p) { p[1] = 0; } else Dir[0] = 0; return 0; } int JustLastDirectory(const char *Path, char *Dir, size_t DirSize) { size_t lastSlash = strlen(Path); while (lastSlash > 0 && !ISSEP(Path[lastSlash])) lastSlash--; size_t secondLastSlash = lastSlash; while (secondLastSlash > 0 && !ISSEP(Path[secondLastSlash - 1])) secondLastSlash--; if ((lastSlash - secondLastSlash) >= (DirSize-1)) { // how unfortunate, we didn't have enough space for directory name // just copy as many characters as possible while leaving room for NUL. lastSlash = secondLastSlash + DirSize - 2; } strncpy(Dir, Path + secondLastSlash, lastSlash - secondLastSlash); Dir[lastSlash - secondLastSlash] = 0; return 0; } int JustFileName(const char *Path, char *Name, size_t NameSize) { size_t len = strlen(Path); while (len > 0 && !ISSEP(Path[len - 1])) len--; strlcpy(Name, Path + len, NameSize); return 0; } int JustRoot(const char *Path, char *Root, size_t RootSize) { #if PATHTYPE == PT_UNIXISH strlcpy(Root, SSLASH, RootSize); #else if (RootSize >= 4) strlcpy(Root, Path, 3); #endif return 0; } int FileExists(const char *Path) { return (access(Path, 0) == 0) ? 1 : 0; } int IsFullPath(const char *Path) { if (ISSLASH(Path[0]) #if PATHTYPE == PT_DOSISH || (Path[0] != 0 && Path[1] == ':') #endif ) return 1; else return 0; } const char *ShortFName(const char *Path, size_t len) { static char P[MAXPATH]; char p1[MAXPATH]; size_t l1; if (len < 10) len = 10; if (len > (int)(sizeof(P) - 1)) len = sizeof(P) - 1; if (ExpandPath(Path, p1, sizeof(p1)) == -1) return Path; l1 = strlen(p1); if (l1 < len) { strlcpy(P, p1, sizeof(P)); } else { strncpy(P, p1, 3); strcpy(P + 3, "..."); strncpy(P + 6, p1 + l1 - len, len - 6); } return P; } int ChangeDir(const char *Dir) { char *dir = (char*)alloca(strlen(Dir) + 10); strcpy(dir, Dir); Slash(dir, 0); // remove last \ except in case of ?: #if PATHTYPE == PT_DOSISH if (dir[0] && dir[1] == ':') if (SetDrive(toupper(dir[0]) - 'A' + 1) == -1) return -1; #endif return (chdir(dir) == 0) ? 0 : -1; } int JoinDirFile(char *Dest, const char *Dir, const char *Name) { strcpy(Dest, Dir); Slash(Dest, 1); strcat(Dest, Name); return 0; } char *SepRChr(const char *Dir) { if (Dir && Dir[0]) { for (const char *p = Dir + strlen(Dir); p > Dir; p--) if (ISSEP(p[-1])) return const_cast<char*>(p - 1); } return NULL; } // Returns relative path of Path with respect to Dir // Ex: Dir = /home/martin/src/ Path = /home/martin/src/Fte/s_files.cpp -> Fte/s_files.cpp int RelativePathName(const char *Dir, const char *Path, char *RelPath, int RelPathSize) { char d[MAXPATH], p[MAXPATH], c; size_t dl, pl; if (ExpandPath(Dir, d, sizeof(d)) == -1) return -1; if (ExpandPath(Path, p, sizeof(p)) == -1) return -1; dl = strlen (d); pl = strlen (p); if (dl <= pl) { c = p[dl]; p[dl] = 0; if (filecmp(d, p) == 0) { p[dl] = c; strlcpy(RelPath, p + dl, RelPathSize); return 0; } } return -1; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/egui.cpp��������������������������������������������������������������������������������������0000644�0001750�0001750�00000066643�11602724002�012110� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* egui.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "egui.h" #include "c_bind.h" #include "c_config.h" #include "c_desktop.h" #include "c_history.h" #include "e_buffer.h" #include "e_tags.h" #include "i_modelview.h" #include "i_view.h" #include "o_cvsbase.h" #include "o_directory.h" #include "o_messages.h" #include "o_svnbase.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include <stdio.h> int LastEventChar = -1; EFrame::EFrame(int XSize, int YSize) : GFrame(XSize, YSize), CMap(0), CModel(0) { } EFrame::~EFrame() { } void EFrame::Update() { if (Active) { if (CModel != ActiveModel && ActiveModel) { char Title[256] = ""; //fte: "; char STitle[256] = ""; //"fte: "; ActiveModel->GetTitle(Title, sizeof(Title), STitle, sizeof(STitle)); ConSetTitle(Title, STitle); CModel = ActiveModel; } } GFrame::Update(); } void EFrame::UpdateMenu() { GxView *V = (GxView *)Active; EEventMap *Map = 0; if (V) Map = V->GetEventMap(); if (Map != CMap || CMap == 0) { const char *NMenu = 0; const char *OMenu = 0; // set menu if (CMap) OMenu = CMap->GetMenu(EM_MainMenu); if (Map) NMenu = Map->GetMenu(EM_MainMenu); if (NMenu == 0) NMenu = "Main"; CMap = Map; if (OMenu && strcmp(OMenu, NMenu) == 0) { // ok } else { SetMenu(NMenu); } } /*else if (CMap == 0 && Map == 0) { SetMenu("Main"); }*/ GFrame::UpdateMenu(); } EGUI::EGUI(int &argc, char **argv, int XSize, int YSize) : GUI(argc, argv, XSize, YSize), ActiveMap(0), OverrideMap(0) { CharMap[0] = 0; } EGUI::~EGUI() { assert(frames == 0); } int EGUI::ExecCommand(GxView *view, ExCommands Command, ExState &State) { if (Command & CMD_EXT) return ExecMacro(view, Command & ~CMD_EXT); if (Command == ExFail) return 0; if (view->IsModelView()) { ExModelView *V = (ExModelView *)view->Top; EView *View = V->GetView(); switch (Command) { case ExFileClose: return FileClose(View, State); case ExFileCloseAll: return FileCloseAll(View, State); case ExExitEditor: return ExitEditor(View); case ExIncrementalSearch: #ifdef CONFIG_I_SEARCH return View->MView->Win->IncrementalSearch(View); #else return 0; #endif default: ; } } switch (Command) { case ExWinRefresh: view->Repaint(); return 1; case ExWinNext: return WinNext(view); case ExWinPrev: return WinPrev(view); case ExShowEntryScreen: return ShowEntryScreen(); case ExRunProgram: return RunProgram(State, view); case ExRunProgramAsync: return RunProgramAsync(State, view); case ExMainMenu: return MainMenu(State, view); case ExShowMenu: return ShowMenu(State, view); case ExLocalMenu: return LocalMenu(view); case ExFrameNew: return FrameNew(); case ExFrameNext: return FrameNext(view); case ExFramePrev: return FramePrev(view); case ExWinHSplit: return WinHSplit(view); case ExWinClose: return WinClose(view); case ExWinZoom: return WinZoom(view); case ExWinResize: return WinResize(State, view); case ExDesktopSaveAs: return DesktopSaveAs(State, view); case ExDesktopSave: if (DesktopFileName[0] != 0) return SaveDesktop(DesktopFileName); return 1; case ExChangeKeys: { char kmaps[64] = ""; EEventMap *m; if (State.GetStrParam(0, kmaps, sizeof(kmaps)) == 0) { SetOverrideMap(0, 0); return 0; } if ((m = FindEventMap(kmaps)) == 0) return 0; SetOverrideMap(m->KeyMap, m->Name); return 1; } default: ; } return view->ExecCommand(Command, State); } int EGUI::BeginMacro(GxView *view) { view->BeginMacro(); return 1; } int EGUI::ExecMacro(GxView *view, int Macro) { int i, j; ExMacro *m; ExState State; if (Macro == -1) return 0; if (BeginMacro(view) == -1) return 0; State.Macro = Macro; State.Pos = 0; m = &Macros[State.Macro]; for (; State.Pos < m->Count; State.Pos++) { i = State.Pos; if (m->cmds[i].type != CT_COMMAND || m->cmds[i].u.num == ExNop) continue; for (j = 0; j < m->cmds[i].repeat; j++) { State.Pos = i + 1; if (ExecCommand(view, (ExCommands)m->cmds[i].u.num, State) == 0 && !m->cmds[i].ign) return 0; } State.Pos = i; } return 1; } void EGUI::SetMsg(const char *Msg) { size_t len = Msg ? strlen(Msg) + 3 : 1; char* CharMap = (char*) alloca(len); if (Msg) { CharMap[0] = '['; memcpy(CharMap + 1, Msg, len); CharMap[len + 1] = ']'; CharMap[len + 2] = 0; } else CharMap[0] = 0; if (ActiveModel) ActiveModel->Msg(S_INFO, CharMap); } void EGUI::SetOverrideMap(EKeyMap *aMap, const char *ModeName) { OverrideMap = aMap; SetMsg((aMap == 0) ? 0 : ModeName); } void EGUI::SetMap(EKeyMap *aMap, KeySel *ks) { char key[32] = ""; ActiveMap = aMap; if (!ActiveMap) SetMsg(0); else if (ks != 0) { GetKeyName(key, sizeof(key), *ks); SetMsg(key); } } void EGUI::DispatchKey(GxView *view, TEvent &Event) { EEventMap *EventMap; EKeyMap *map; EKey *key = 0; char Ch; if (Event.Key.Code & kfModifier) return; LastEventChar = -1; if (GetCharFromEvent(Event, &Ch)) LastEventChar = Ch; if ((EventMap = view->GetEventMap()) == 0) return; map = EventMap->KeyMap; if (ActiveMap || OverrideMap) { map = ActiveMap; if (OverrideMap) map = OverrideMap; while (map) { if ((key = map->FindKey(Event.Key.Code)) != 0) { if (key->fKeyMap) { SetMap(key->fKeyMap, &key->fKey); Event.What = evNone; return ; } else { SetMap(0, &key->fKey); ExecMacro(view, key->Cmd); Event.What = evNone; return ; } } // printf("Going up\n"); map = map->fParent; } if (!OverrideMap) { SetMap(0, 0); Event.What = evNone; } return ; } while (EventMap) { if (map) { if ((key = map->FindKey(Event.Key.Code)) != 0) { if (key->fKeyMap) { SetMap(key->fKeyMap, &key->fKey); Event.What = evNone; return ; } else { ExecMacro(view, key->Cmd); Event.What = evNone; return ; } } } EventMap = EventMap->Parent; if (EventMap == 0) break; map = EventMap->KeyMap; } // if (GetCharFromEvent(Event, &Ch)) // CharEvent(view, Event, Ch); SetMap(0, 0); } void EGUI::DispatchCommand(GxView *view, TEvent &Event) { if (Event.Msg.Command > 65536 + 16384) { // hack for PM toolbar Event.Msg.Command -= 65536 + 16384; BeginMacro(view); ExState State; State.Macro = 0; State.Pos = 0; ExecCommand(view, (ExCommands)Event.Msg.Command, State); Event.What = evNone; } else if (Event.Msg.Command >= 65536) { Event.Msg.Command -= 65536; ExecMacro(view, (int)Event.Msg.Command); Event.What = evNone; } } void EGUI::DispatchEvent(GFrame *frame, GView *view, TEvent &Event) { GxView *xview = (GxView *) view; if (Event.What == evNone || (Event.What == evMouseMove && Event.Mouse.Buttons == 0)) return; if (Event.What == evNotify && Event.Msg.Command == cmPipeRead) { Event.Msg.Model->NotifyPipe((int)Event.Msg.Param1); return; } if (xview && xview->GetEventMap() != 0) { switch (Event.What) { case evKeyDown: DispatchKey(xview, Event); break; case evCommand: if (Event.Msg.Command >= 65536) DispatchCommand(xview, Event); else switch (Event.Msg.Command) { case cmClose: assert(ActiveView != 0); FrameClose(ActiveView->MView->Win); return; } } } GUI::DispatchEvent(frame, view, Event); #if defined(OS2) && !defined(DBMALLOC) && defined(CHECKHEAP) if (_heapchk() != _HEAPOK) DieError(0, "Heap memory is corrupt."); #endif } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// int EGUI::WinNext(GxView *view) { view->Parent->SelectNext(0); return 1; } int EGUI::WinPrev(GxView *view) { view->Parent->SelectNext(1); return 1; } int EGUI::FileCloseX(EView *View, int CreateNew, int XClose) { char Path[MAXPATH]; // this should never fail! if (!GetDefaultDirectory(View->Model, Path, sizeof(Path))) return 0; if (View->Model->ConfQuit(View->MView->Win)) { View->Model->DeleteRelated(); // close everything that can be closed without confirmation if closing all if (XClose) while (View->Model->Next != View->Model && View->Model->Next->CanQuit()) delete View->Model->Next; View->DeleteModel(View->Model); #ifdef CONFIG_OBJ_DIRECTORY if (ActiveModel == 0 && CreateNew) { EView *V = ActiveView; EModel *m = new EDirectory(0, &ActiveModel, Path); assert(m != 0); do { V = V->Next; V->SelectModel(ActiveModel); } while (V != ActiveView); return 0; } #endif if (ActiveView) { /* * FIXME: hack - fixing problem when closing window * i.e.: F1 - Split - Close * was leaving cursor in wrong window * so going to next view and back for now * fixes problem */ ActiveView->MView->Win->Parent->SelectNext(0); ActiveView->MView->Win->Parent->SelectNext(1); } if (ActiveModel == 0) StopLoop(); return 1; } return 0; } int EGUI::FileClose(EView *View, ExState &State) { int x = 0; if (State.GetIntParam(View, &x) == 0) x = OpenAfterClose; return FileCloseX(View, x); } int EGUI::FileCloseAll(EView *View, ExState &State) { int x = 0; if (State.GetIntParam(View, &x) == 0) x = OpenAfterClose; while (ActiveModel) if (!FileCloseX(View, x, 1)) return 0; return 1; } int EGUI::WinHSplit(GxView *View) { int W, H; View->ConQuerySize(&W, &H); if (H < 8) return 0; GxView *view = new GxView(View->Parent); EView *win = new EView(ActiveModel); ExModelView *edit = new ExModelView(win); view->PushView(edit); view->Parent->SelectNext(0); //fprintf(stderr, "WinHSplit %p gv:%p\n", frames, view); return 1; } int EGUI::WinClose(GxView * /*V*/) { EView *View = ActiveView; if (View->Next == View) { // when closing last window, close all files if (!ExitEditor(View)) return 0; } else { View->MView->Win->Parent->SelectNext(0); delete View->MView->Win; } return 1; } int EGUI::WinZoom(GxView *View) { GView *V = View->Next; GView *V1; while (V) { V1 = V; if (V == View) break; V = V->Next; delete V1; } return 1; } int EGUI::WinResize(ExState &State, GxView *View) { int Delta = 1; if (State.GetIntParam(0, &Delta)) if (!View->ExpandHeight(Delta)) return 0; return 1; } int EGUI::ExitEditor(EView *View) { // check/save modified files for (EModel *B = ActiveModel; ActiveModel; ActiveModel = ActiveModel->Next) { if (!ActiveModel->CanQuit()) { View->SelectModel(ActiveModel); int rc = ActiveModel->ConfQuit(View->MView->Win, 1); if (rc == 0) return 0; if (rc == -2) { View->FileSaveAll(); break; } } if (ActiveModel->Next == B) break; } #ifdef CONFIG_DESKTOP if (SaveDesktopOnExit && DesktopFileName[0] != 0) SaveDesktop(DesktopFileName); else if (LoadDesktopMode == 2) { // Ask about saving? GxView* gx = View->MView->Win; if (gx->GetStr("Save desktop As", sizeof(DesktopFileName), DesktopFileName, HIST_DEFAULT) != 0) SaveDesktop(DesktopFileName); } #endif while (ActiveModel) { if (View->Model->GetContext() == CONTEXT_ROUTINES) // Never delete Routine models directly { ActiveModel = ActiveModel->Next; View->SelectModel(ActiveModel); } View->Model->DeleteRelated(); // delete related views first // while (View->Model->Next != View->Model && // View->Model->Next->CanQuit()) // delete View->Model->Next; View->DeleteModel(View->Model); } StopLoop(); return 1; } int EGUI::ShowEntryScreen() { return gui->ShowEntryScreen(); } int EGUI::RunProgram(ExState &State, GxView *view) { static char Cmd[512] = ""; if (ActiveModel) SetDefaultDirectory(ActiveModel); if (State.GetStrParam(ActiveView, Cmd, sizeof(Cmd)) == 0) if (view->GetStr("Run", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; gui->RunProgram(RUN_WAIT, Cmd); return 1; } int EGUI::RunProgramAsync(ExState &State, GxView *view) { static char Cmd[512] = ""; if (ActiveModel) SetDefaultDirectory(ActiveModel); if (State.GetStrParam(ActiveView, Cmd, sizeof(Cmd)) == 0) if (view->GetStr("Run", sizeof(Cmd), Cmd, HIST_COMPILE) == 0) return 0; gui->RunProgram(RUN_ASYNC, Cmd); return 1; } int EGUI::MainMenu(ExState &State, GxView *View) { char s[3]; if (!State.GetStrParam(0, s, sizeof(s))) s[0] = 0; View->Parent->ExecMainMenu(s[0]); return 1; } int EGUI::ShowMenu(ExState &State, GxView *View) { char MName[32] = ""; if (!State.GetStrParam(0, MName, sizeof(MName))) return 0; View->Parent->PopupMenu(MName); return 1; } int EGUI::LocalMenu(GxView *View) { EEventMap *Map = View->GetEventMap(); const char *MName = 0; if (Map) MName = Map->GetMenu(EM_LocalMenu); if (MName == 0) MName = "Local"; View->Parent->PopupMenu(MName); return 1; } int EGUI::DesktopSaveAs(ExState &State, GxView *view) { if (!State.GetStrParam(0, DesktopFileName, sizeof(DesktopFileName)) && !view->GetFile("Save Desktop", sizeof(DesktopFileName), DesktopFileName, HIST_PATH, GF_SAVEAS)) return 0; if (!DesktopFileName[0]) return 0; return SaveDesktop(DesktopFileName); } int EGUI::FrameNew() { if (!multiFrame() && frames) return 0; (void) new EFrame(ScreenSizeX, ScreenSizeY); // -> frames assert(frames != 0); GxView *view = new GxView(frames); (void)new EView(ActiveModel); // ->ActiveView ExModelView *edit = new ExModelView(ActiveView); view->PushView(edit); frames->Show(); //fprintf(stderr, "FrameNew %p\n", frames); return 1; } int EGUI::FrameClose(GxView *View) { assert(frames != 0); assert(View != 0); //fprintf(stderr, "FrameClose %p v:%p\n", frames, View); if (!frames->isLastFrame()) delete frames; else if (!ExitEditor(ActiveView)) return 0; return 1; } int EGUI::FrameNext(GxView * /*View*/) { if (frames->isLastFrame()) return 0; frames->Next->Activate(); return 1; } int EGUI::FramePrev(GxView * /*View*/) { if (frames->isLastFrame()) return 0; frames->Prev->Activate(); return 1; } #ifdef CONFIG_DESKTOP int EGUI::findDesktop(char *argv[]) { /* * Locates the desktop file depending on the load desktop mode flag: * 0: Try the "current" directory, then the FTE .exe directory (PC) or * the user's homedir (Unix). Fail if not found (original FTE * algorithm). * 1: Try the current directory, then loop {go one directory UP and try} * If not found, don't load a desktop! * 2: As above, but asks to save the desktop if one was not found. * This is called if the desktop is not spec'd on the command line. */ switch (LoadDesktopMode) { default: //** 0: try curdir then "homedir".. // fprintf(stderr, "ld: Mode 0\n"); if (FileExists(DESKTOP_NAME)) ExpandPath(DESKTOP_NAME, DesktopFileName, sizeof(DesktopFileName)); else { //** Use homedir, #ifdef UNIX ExpandPath("~/" DESKTOP_NAME, DesktopFileName, sizeof(DesktopFileName)); #else JustDirectory(argv[0], DesktopFileName, sizeof(DesktopFileName)); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); #endif // UNIX } return FileExists(DesktopFileName); case 1: case 2: //** Try curdir, then it's owner(s).. ExpandPath(".", DesktopFileName, sizeof(DesktopFileName)); //fprintf(stderr, "ld: Mode 1 (start at %s)\n", DesktopFileName); for (;;) { //** Try current location, char *pe = DesktopFileName + strlen(DesktopFileName); Slash(DesktopFileName, 1); // Add appropriate slash strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); //fprintf(stderr, "ld: Mode 1 (trying %s)\n", DesktopFileName); if (FileExists(DesktopFileName)) { //fprintf(stderr, "ld: Mode 1 (using %s)\n", DesktopFileName); return 1; } //** Not found. Remove added stuff, then go level UP, *pe = 0; // Remove the current part, char *p = SepRChr(DesktopFileName); if (p == NULL) { //** No desktop! Set default name in current directory, ExpandPath(".", DesktopFileName, sizeof(DesktopFileName)); Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); SaveDesktopOnExit = 0; // Don't save, return 0; // NOT found!! } *p = 0; // Truncate name at last } } } void EGUI::DoLoadDesktopOnEntry(int &/*argc*/, char **argv) { if (DesktopFileName[0] == 0) findDesktop(argv); if (DesktopFileName[0] != 0) { if (IsDirectory(DesktopFileName)) { Slash(DesktopFileName, 1); strlcat(DesktopFileName, DESKTOP_NAME, sizeof(DesktopFileName)); } if (LoadDesktopOnEntry && FileExists(DesktopFileName)) LoadDesktop(DesktopFileName); } } #endif // CONFIG_DESKTOP void EGUI::EditorInit() { SSBuffer = new EBuffer(0, (EModel **)&SSBuffer, "Scrap"); BFI(SSBuffer, BFI_Undo) = 0; // disable undo for clipboard ActiveModel = 0; } int EGUI::InterfaceInit(int &/*argc*/, char ** /*argv*/) { if (!FrameNew()) DieError(1, "Failed to create window\n"); return 1; } #ifdef CONFIG_HISTORY void EGUI::DoLoadHistoryOnEntry(int &/*argc*/, char **argv) { if (HistoryFileName[0] == 0) { #ifdef UNIX ExpandPath("~/.fte-history", HistoryFileName, sizeof(HistoryFileName)); #else JustDirectory(argv[0], HistoryFileName, sizeof(HistoryFileName)); strlcat(HistoryFileName, "fte.his", sizeof(HistoryFileName)); #endif // UNIX } else { char p[256]; ExpandPath(HistoryFileName, p, sizeof(p)); if (IsDirectory(p)) { Slash(p, 1); strlcat(p, HISTORY_NAME, sizeof(p)); } strlcpy(HistoryFileName, p, sizeof(HistoryFileName)); } if (KeepHistory && FileExists(HistoryFileName)) LoadHistory(HistoryFileName); } void EGUI::DoSaveHistoryOnExit() { if (KeepHistory && HistoryFileName[0] != 0) SaveHistory(HistoryFileName); // since we are exiting, free history ClearHistory(); } #endif // CONFIG_HISTORY int EGUI::CmdLoadFiles(int &argc, char **argv) { int QuoteNext = 0; int QuoteAll = 0; int GotoLine = 0; int LineNum = 1; int ColNum = 1; int ModeOverride = 0; char Mode[32]; int LCount = 0; int ReadOnly = 0; for (int Arg = 1; Arg < argc; Arg++) { if (!QuoteAll && !QuoteNext && (argv[Arg][0] == '-')) { switch (argv[Arg][1]) { case '-': if (strncmp(argv[Arg], "--debug", 7) != 0) QuoteAll = 1; Arg = argc; break; case '!': case 'C': case 'c': case 'D': case 'd': case 'H': // handled before break; case '+': QuoteNext = 1; break; case '#': case 'l': LineNum = 1; ColNum = 1; if (strchr(argv[Arg], ',')) { GotoLine = (2 == sscanf(argv[Arg] + 2, "%d,%d", &LineNum, &ColNum)); } else { GotoLine = (1 == sscanf(argv[Arg] + 2, "%d", &LineNum)); } // printf("Gotoline = %d, line = %d, col = %d\n", GotoLine, LineNum, ColNum); break; case 'r': ReadOnly = 1; break; case 'm': if (argv[Arg][2] == 0) { ModeOverride = 0; } else { ModeOverride = 1; strcpy(Mode, argv[Arg] + 2); } break; #ifdef CONFIG_TAGS case 'T': TagsAdd(argv[Arg] + 2); break; case 't': TagGoto(ActiveView, argv[Arg] + 2); break; #endif default: DieError(2, "Invalid command line option %s", argv[Arg]); } } else { QuoteNext = 0; #ifdef CONFIG_OBJ_DIRECTORY char Path[MAXPATH]; if (ExpandPath(argv[Arg], Path, sizeof(Path)) == 0 && IsDirectory(Path)) { EModel *m = new EDirectory(cfAppend, &ActiveModel, Path); assert(ActiveModel != 0 && m != 0); } else #endif { if (LCount != 0) suspendLoads = 1; if (MultiFileLoad(cfAppend, argv[Arg], ModeOverride ? Mode : 0, ActiveView) == 0) { suspendLoads = 0; return 0; } suspendLoads = 0; if (GotoLine) { if (((EBuffer *)ActiveModel)->Loaded == 0) ((EBuffer *)ActiveModel)->Load(); if (GotoLine) { GotoLine = 0; ((EBuffer *)ActiveModel)->SetNearPosR(ColNum - 1, LineNum - 1); } else { int r, c; if (RetrieveFPos(((EBuffer *)ActiveModel)->FileName, r, c) == 1) ((EBuffer *)ActiveModel)->SetNearPosR(c, r); } //ActiveView->SelectModel(ActiveModel); } if (ReadOnly) { ReadOnly = 0; BFI(((EBuffer *)ActiveModel), BFI_ReadOnly) = 1; } } suspendLoads = 1; ActiveView->SelectModel(ActiveModel->Next); suspendLoads = 0; LCount++; } } EModel *P = ActiveModel; while (LCount-- > 0) P = P->Prev; ActiveView->SelectModel(P); return 1; } int EGUI::Start(int &argc, char **argv) { if (!GUI::Start(argc, argv)) return 0; if (!InterfaceInit(argc, argv)) return 0; EditorInit(); #ifdef CONFIG_HISTORY DoLoadHistoryOnEntry(argc, argv); #endif #ifdef CONFIG_DESKTOP DoLoadDesktopOnEntry(argc, argv); #endif if (!CmdLoadFiles(argc, argv)) return 0; if (!ActiveModel) { #ifdef CONFIG_OBJ_DIRECTORY char Path[MAXPATH]; GetDefaultDirectory(0, Path, sizeof(Path)); EModel *m = new EDirectory(0, &ActiveModel, Path); assert(ActiveModel != 0 && m != 0); ActiveView->SwitchToModel(ActiveModel); #else // FIXME Usage(); return 0; #endif } return 1; } void EGUI::EditorCleanup() { if (ActiveModel != NULL) { EModel *B, *N, *A; B = A = ActiveModel; do { N = B->Next; delete B; B = N; } while (B != A); } ActiveModel = NULL; delete SSBuffer; SSBuffer = NULL; #if 0 EView *BW; // If EView what is about to be deleted is currently ActiveView, ActiveView moves to next one // or if there is no next, it will be set as NULL. while ((BW = ActiveView) != NULL) { ActiveView = ActiveView->Next; delete BW; } #endif while (frames && frames->Top) delete frames->Top; } void EGUI::Stop() { #ifdef CONFIG_HISTORY DoSaveHistoryOnExit(); #endif // free macros if (Macros != 0) { while (CMacros--) { free(Macros[CMacros].Name); for (unsigned i = 0; i < Macros[CMacros].Count; ++i) if (Macros[CMacros].cmds[i].type == CT_STRING) free(Macros[CMacros].cmds[i].u.string); free(Macros[CMacros].cmds); } free(Macros); Macros = 0; } #ifdef CONFIG_SYNTAX_HILIT // free colorizers while (EColorize *p = Colorizers) { Colorizers = Colorizers->Next; delete p; } #endif // free event maps while (EEventMap *em = EventMaps) { EventMaps = EventMaps->Next; delete em; } // free modes while (EMode *m = Modes) { Modes = Modes->fNext; delete m; } // free menus if (Menus) { int mc, c; while (MenuCount--) { mc = MenuCount; free(Menus[mc].Name); while (Menus[mc].Count--) { c = Menus[mc].Count; free(Menus[mc].Items[c].Name); } free(Menus[MenuCount].Items); } free(Menus); Menus = NULL; } // free completion rexexp filter extern RxNode *CompletionFilter; RxFree(CompletionFilter); #ifdef CONFIG_OBJ_MESSAGES // free CRegexp array from o_messages.cpp FreeCRegexp(); #endif #ifdef CONFIG_OBJ_CVS // free CvsIgnoreRegexp array from o_messages.cpp FreeCvsIgnoreRegexp(); #endif #ifdef CONFIG_OBJ_SVN // free SvnIgnoreRegexp array from o_messages.cpp FreeSvnIgnoreRegexp(); #endif #ifdef CONFIG_TAGS TagClear(); #endif // free configuration file path free(ConfigSourcePath); ConfigSourcePath = NULL; EditorCleanup(); assert(frames == 0); GUI::Stop(); } ���������������������������������������������������������������������������������������������./src/fnmatch.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000005613�11331412503�012231� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef FNMATCH_H #define FNMATCH_H #ifdef __cplusplus extern "C" { #endif #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 # if !defined __GLIBC__ || !defined __P # undef __P # define __P(protos) protos # endif #else /* Not C++ or ANSI C. */ # undef __P # define __P(protos) () /* We can get away without defining `const' here only because in this file it is used only inside the prototype for `fnmatch', which is elided in non-ANSI C where `const' is problematical. */ #endif /* C++ or ANSI C. */ #ifndef const # if (defined __STDC__ && __STDC__) || defined __cplusplus # define __const const # else # define __const # endif #endif /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in <unistd.h>. */ #undef FNM_PATHNAME #undef FNM_NOESCAPE #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE # define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ # define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ # define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ #define FNM_NOMATCH 1 /* This value is returned if the implementation does not support `fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE # define FNM_NOSYS (-1) #endif /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P ((__const char *__pattern, __const char *__string, int __flags)); #ifdef __cplusplus } #endif #endif /* fnmatch.h */ ���������������������������������������������������������������������������������������������������������������������./src/c_desktop.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000010532�11602724002�013114� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_desktop.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_desktop.h" #ifdef CONFIG_DESKTOP #include "c_commands.h" #include "e_cvslog.h" #include "e_mark.h" #include "e_tags.h" #include "o_directory.h" #include "s_util.h" #include <ctype.h> #define DESKTOP_VER "FTE Desktop 2\n" #define DESKTOP_VER1 "FTE Desktop 1\n" char DesktopFileName[256] = ""; int SaveDesktop(const char *FileName) { FILE *fp; EModel *M; if (!(fp = fopen(FileName, "w"))) return 0; if (setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer) != 0)) goto err; if (fprintf(fp, DESKTOP_VER) < 0) goto err; M = ActiveModel; while (M) { switch(M->GetContext()) { case CONTEXT_FILE: #ifdef CONFIG_OBJ_CVS if (M != CvsLogView) { #else { #endif EBuffer *B = (EBuffer *)M; if (fprintf(fp, "F|%d|%s\n", B->ModelNo, B->FileName) < 0) goto err; } break; #ifdef CONFIG_OBJ_DIRECTORY case CONTEXT_DIRECTORY: { EDirectory *D = (EDirectory *)M; if (fprintf(fp, "D|%d|%s\n", D->ModelNo, D->Path.c_str()) < 0) goto err; } break; #endif } M = M->Next; if (M == ActiveModel) break; } #ifdef CONFIG_TAGS TagsSave(fp); #endif markIndex.saveToDesktop(fp); return (fclose(fp) == 0) ? 1 : 0; err: fclose(fp); return 0; } int LoadDesktop(const char *FileName) { FILE *fp; char line[512]; char *p, *e; int FLCount = 0; #ifdef CONFIG_TAGS TagClear(); #endif if (!(fp = fopen(FileName, "r"))) return 0; //setvbuf(fp, FileBuffer, _IOFBF, sizeof(FileBuffer)); if (!fgets(line, sizeof(line), fp) || (strcmp(line, DESKTOP_VER) != 0 && (strcmp(line, DESKTOP_VER1) != 0))) { fclose(fp); return 0; } while (fgets(line, sizeof(line), fp) != 0) { e = strchr(line, '\n'); if (e == 0) break; *e = 0; if ((line[0] == 'D' || line[0] == 'F') && line[1] == '|') { int ModelNo = -1; p = line + 2; if (isdigit(*p)) { ModelNo = atoi(p); while (isdigit(*p)) p++; if (*p == '|') p++; } if (line[0] == 'F') { // file if (FLCount > 0) suspendLoads = 1; if (FileLoad(0, p, 0, ActiveView)) FLCount++; suspendLoads = 0; #ifdef CONFIG_OBJ_DIRECTORY } else if (line[0] == 'D') { // directory EModel *m = new EDirectory(0, &ActiveModel, p); assert(ActiveModel != 0 && m != 0); #endif } if (ActiveModel) { if (ModelNo != -1) { if (FindModelID(ActiveModel, ModelNo) == 0) ActiveModel->ModelNo = ModelNo; } if (ActiveModel != ActiveModel->Next) { suspendLoads = 1; ActiveView->SelectModel(ActiveModel->Next); suspendLoads = 0; } } } else #ifdef CONFIG_TAGS if (line[0] == 'T' && line[1] == '|') // tag file TagsAdd(line + 2); else #endif if (line[0] == 'M' && line[1] == '|') { // mark char *name; char *file; EPoint P; //long l; char *c; p = line + 2; P.Row = (int)strtol(p, &c, 10); if (*c != '|') break; p = c + 1; P.Col = (int)strtol(p, &c, 10); if (*c != '|') break; p = c + 1; name = p; while (*p && *p != '|') p++; if (*p == '|') *p++ = 0; else break; file = p; markIndex.insert(name, file, P); } } return (fclose(fp) == 0) ? 1 : 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_svnbase.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000005273�11331412505�012574� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svnbase.h * * S.Pinigin copy o_cvsbase.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Base class for all other SVN-related classes. This is similar to EMessages * - starts SVN and shows its messages in list view. */ #ifndef O_SVNBASE_H #define O_SVNBASE_H #include "fte.h" #ifdef CONFIG_OBJ_SVN #include "o_list.h" class EBuffer; struct SvnLine { char *File; // Relative to view's directory int Line; char *Msg; EBuffer *Buf; char Status; // bit 0 - hilited // bit 1 - marked // bit 2 - markable }; class ESvnBase:public EList { public: char *Command; char *Directory; char *OnFiles; char *OnFilesPos; int LineCount; SvnLine **Lines; int Running; int BufLen; int BufPos; int PipeId; int ReturnCode; char MsgBuf[4096]; ESvnBase (int createFlags,EModel **ARoot,const char *ATitle); ~ESvnBase (); void FreeLines (); void AddLine(const char *file, int line, const char *msg, int hilit = 0); void FindBuffer (int line); void AssignBuffer (EBuffer *B,int line); void FindFileLines (EBuffer *B); virtual void NotifyDelete (EModel *Deleting); int GetLine(char *Line, size_t max); virtual void ParseLine (char *line, size_t len); void NotifyPipe (int APipeId); // Returns 0 if OK - calls ContinuePipe() several times to complete command for all files virtual int RunPipe(const char *Dir, const char *Command, const char *OnFiles); // Returns 0 if OK - continue with next files in queue virtual int ContinuePipe (); // Reads ReturnCode, sets Running to 0, PipeId to -1 virtual void ClosePipe (); void DrawLine (PCell B,int Line,int Col,ChColor color,int Width); char *FormatLine (int Line); void UpdateList (); int Activate (int No); int CanActivate (int Line); virtual int IsHilited (int Line); virtual int IsMarked (int Line); virtual int Mark (int Line); virtual int Unmark (int Line); virtual int ExecCommand(ExCommands Command, ExState &State); void ShowLine (EView *V,int err); virtual int GetContext () {return CONTEXT_SVNBASE;} virtual EEventMap *GetEventMap (); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetPath(char *APath, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; int AddSvnIgnoreRegexp (const char *); void FreeSvnIgnoreRegexp (); #endif // CONFIG_OBJ_SVN #endif // O_SVNBASE_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_svn.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000014003�11344266047�012277� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svn.cpp * * S.Pinigin copy o_cvs.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class providing access to most of SVN commands. */ #include "o_svn.h" #ifdef CONFIG_OBJ_SVN #include "i_view.h" #include "e_svnlog.h" #include "o_buflist.h" #include "s_files.h" #include "sysdep.h" #include <stdio.h> static int SameDir (const char *D1, const char *D2) { if (!D1||!D2) return 0; size_t l1=strlen (D1); size_t l2=strlen (D2); if (l1<l2) return strncmp (D1,D2,l1)==0&&strcmp (D2+l1,SSLASH)==0; else if (l1==l2) return !strcmp (D1,D2); else return strncmp (D1,D2,l2)==0&&strcmp (D1+l1,SSLASH)==0; } static const char SvnStatusChars[] = "?XUPMCAR"; ESvn *SvnView=0; ESvn::ESvn (int createFlags, EModel **ARoot, char *ADir, char *ACommand, char *AOnFiles) : ESvnBase (createFlags, ARoot, "SVN"), LogFile(0), Commiting(0) { SvnView=this; RunPipe (ADir,ACommand,AOnFiles); } ESvn::ESvn (int createFlags, EModel **ARoot) : ESvnBase (createFlags, ARoot, "SVN"), LogFile(0) { SvnView=this; } ESvn::~ESvn () { SvnView=0; RemoveLogFile (); } void ESvn::RemoveLogFile () { if (LogFile) { unlink (LogFile); free (LogFile); LogFile=0; } } char *ESvn::MarkedAsList () { int i; size_t len=0; // First pass - calculate size for (i=0;i<LineCount;i++) if (Lines[i]->Status&2) len+=strlen (Lines[i]->File)+1; if (len==0) { // Nothing marked, use the file at cursor if (Lines[Row]->Status&4) return strdup (Lines[Row]->File); else return NULL; } char *s=(char *)malloc (len+1); s[0]=0; for (i=0;i<LineCount;i++) if (Lines[i]->Status&2) strcat (strcat (s,Lines[i]->File)," "); s[strlen (s)-1]=0; return s; } char ESvn::GetFileStatus (const char *file) { // Search backward, file can be present several times (old messages) for (int i=LineCount-1;i>=0;i--) if (Lines[i]->File&&filecmp (Lines[i]->File,file)==0) return Lines[i]->Msg[0]; return 0; } //  §¡®à áâப ¯®á«¥ ¢ë¯®«­¥­¨ï 'svn st' // ‘âப¨ ­ ç¨­ î騥áï ­  ᨬ¢®«ë ¨§ SvnStatusChars // ®¤á¢¥ç¨¢ îâáï ¨ ¬®¦­® ¯¥à¥©â¨ ­  í⨠䠩«ë void ESvn::ParseLine (char *line,int len) { if(len > 2 && line[1]==' ' && strchr(SvnStatusChars, line[0])) AddLine(line + 7, -1, line, 5); else AddLine(0, -1, line); } int ESvn::RunPipe (const char *ADir, const char *ACommand, const char *AOnFiles) { Commiting=0; if (!SameDir (Directory,ADir)) FreeLines (); return ESvnBase::RunPipe (ADir,ACommand,AOnFiles); } void ESvn::ClosePipe () { ESvnBase::ClosePipe (); if (Commiting&&!ReturnCode) { // Successful commit - reload files // Is it safe to do this ? Currently not done, manual reload is needed } Commiting=0; } int ESvn::RunCommit (const char *ADir, const char *ACommand, const char *AOnFiles) { if (!SameDir (Directory,ADir)) FreeLines (); free (Command); free (Directory); free (OnFiles); Command=strdup (ACommand); Directory=strdup (ADir); OnFiles=strdup (AOnFiles); RemoveLogFile (); // Disallow any SVN command while commiting Running=1; // Create message buffer ESvnLog *svnlog=new ESvnLog (0,&ActiveModel,Directory,OnFiles); LogFile=strdup (svnlog->FileName); View->SwitchToModel (svnlog); AddLine (LogFile, -1, "SVN commit start - enter message text", 1); return 0; } extern BufferView *BufferList;//!!! int ESvn::DoneCommit (int commit) { Running=0; // Remove line with link to log free (Lines[LineCount-1]->File); free (Lines[LineCount-1]->Msg); LineCount--; UpdateList (); if (commit) { // We need a copy of Command/Directory/OnFiles because RunPipe deletes them! char *ACommand=(char *)malloc (strlen (Command)+strlen (LogFile)+10); char *ADirectory=strdup (Directory); char *AOnFiles=strdup (OnFiles); sprintf (ACommand,"%s -F %s",Command,LogFile); int ret=RunPipe (ADirectory,ACommand,AOnFiles); free (ACommand);free (ADirectory);free (AOnFiles); // We set Commiting after RunPipe since it sets it to 0 // This is OK since FTE is not multi-threaded Commiting=1; if (ActiveView->Model==SvnLogView) { // SvnLogView is currently active, move SvnView just after it if (SvnLogView->Next!=SvnView) { // Need to move, is not at right place yet // Here we use the fact that if current model is closed, // the one just after it (Next) is focused. SvnView->Prev->Next=SvnView->Next; SvnView->Next->Prev=SvnView->Prev; SvnView->Next=SvnLogView->Next; SvnLogView->Next->Prev=SvnView; SvnLogView->Next=SvnView; SvnView->Prev=SvnLogView; } } // else - SvnLogView is not active, there is need to make SvnView // active some other way. However, SwitchToModel() or SelectModel() // calls does not work. Currently I don't know how to do this. !!! return ret; } else { RemoveLogFile (); UpdateList (); return 0; } } // If running, can't be closed without asking int ESvn::CanQuit () { if (Running) return 0;else return 1; } // Ask user if we can close this model int ESvn::ConfQuit (GxView *V,int multiFile) { if (SvnLogView) { // Log is open if (SvnLogView->ConfQuit (V,multiFile)) { // Commit confirmed or discarded - depends on Running ActiveView->DeleteModel (SvnLogView); } else return 0; } if (Running) { // SVN command in progress switch (V->Choice (GPC_ERROR,"SVN command is running",2,"&Kill","&Cancel","")) { case 0: // Kill return 1; case 1: // Cancel default: return 0; } } else return 1; } // Event map - this name is used in config files when defining eventmap EEventMap *ESvn::GetEventMap () { return FindEventMap ("SVN"); } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-msvc.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000003545�11602724002�012661� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������INCDIR = LIBDIR = OPTIMIZE = /O2 /MT #OPTIMIZE = /Zi /Od /MTd #DEBUG = -DMSVCDEBUG CC = cl LD = cl RC = rc OEXT=obj #APPOPTIONS = -DDEFAULT_INTERNAL_CONFIG #/Fm /GF /J # Use these settings for MSVC 6 #CCFLAGS = $(OPTIMIZE) -DNT -DNTCONSOLE -DMSVC -DWIN32 -D_CONSOLE -DNO_NEW_CPP_FEATURES $(INCDIR) /GX \ # $(APPOPTIONS) $(DEBUG) \ # /nologo /W3 /J # /YX # Use these settings for MSVC 2003 #CCFLAGS = $(OPTIMIZE) -DNT -DNTCONSOLE -DMSVC -DWIN32 -D_CONSOLE $(INCDIR) /GX \ # $(APPOPTIONS) $(DEBUG) \ # /nologo /W3 /J # /YX # Use these settings for Visual C Express 2008 MOREDEFS = -D_CRT_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_DEPRECATE=1 CCFLAGS = $(OPTIMIZE) -DNT -DNTCONSOLE -DMSVC -DWIN32 -D_CONSOLE $(MOREDEFS) $(INCDIR) /EHsc \ $(APPOPTIONS) $(DEBUG) /nologo /W3 /J LDFLAGS = $(OPTIMIZE) $(LIBDIR) /nologo RCFLAGS = .SUFFIXES: .cpp .$(OEXT) !include objs.inc NTRES = ftewin32.res .cpp.$(OEXT): $(CC) $(CCFLAGS) -c $< .c.$(OEXT): $(CC) $(CCFLAGS) -c $< all: cfte.exe fte.cnf fte.exe clean: -del bin2c.exe -del bin2c.pdb -del cfte.exe -del cfte.pdb -del cfte.exp -del cfte.lib -del defcfg.cnf -del defcfg.h -del fte.cnf -del fte.exe -del fte.his -del fte.pdb -del vc60.pdb -del ftewin32.res -del *.obj cfte.exe: $(CFTE_OBJS) cfte.def $(LD) $(LDFLAGS) /Fecfte.exe $(CFTE_OBJS) cfte.def defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h fte.cnf: ..\config\* cfte.exe cfte ..\config\main.fte fte.cnf bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) $(LDFLAGS) /Febin2c.exe bin2c.cpp c_config.$(OEXT): defcfg.h ftewin32.res: ftewin32.rc $(RC) $(RCFLAGS) ftewin32.rc fte.exe: $(OBJS) $(NTOBJS) $(NTRES) $(LD) $(LDFLAGS) /Fefte.exe $(OBJS) $(NTOBJS) user32.lib $(NTRES) distro: fte.exe fte.cnf cfte.exe zip ../fte-nt.zip fte.exe fte.cnf cfte.exe �����������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_cvsbase.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000026126�11602724002�013113� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvsbase.cpp * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Base class for all other CVS-related classes. This is similar to EMessages * - starts CVS and shows its messages in list view. */ #include "o_cvsbase.h" #ifdef CONFIG_OBJ_CVS #include "c_commands.h" #include "i_view.h" #include "o_buflist.h" #include "s_files.h" #include "s_string.h" #include "s_util.h" #include "sysdep.h" #include <stdio.h> #define MAXREGEXP 32 static int CvsIgnoreRegexpCount=0; static RxNode *CvsIgnoreRegexp[MAXREGEXP]; int AddCvsIgnoreRegexp (const char *regexp) { if (CvsIgnoreRegexpCount>=MAXREGEXP) return 0; if ((CvsIgnoreRegexp[CvsIgnoreRegexpCount]=RxCompile (regexp))==NULL) return 0; CvsIgnoreRegexpCount++; return 1; } void FreeCvsIgnoreRegexp () { while (CvsIgnoreRegexpCount--) { RxFree (CvsIgnoreRegexp[CvsIgnoreRegexpCount]); } } ECvsBase::ECvsBase (int createFlags,EModel **ARoot, const char *title) : EList (createFlags, ARoot, title), Command(0), Directory(0), OnFiles(0), LineCount(0), Lines(0), Running(0), BufLen(0), BufPos(0), PipeId(-1), ReturnCode(-1) { } ECvsBase::~ECvsBase () { gui->ClosePipe (PipeId); FreeLines (); free (Command); free (Directory); free (OnFiles); } void ECvsBase::FreeLines () { if (Lines) { for (int i=0;i<LineCount;i++) { if (Lines[i]->Buf&&Lines[i]->Line>=0) { // Has buffer and line == bookmark -> remove it char book[16]; sprintf (book,"_CVS.%d",i); Lines[i]->Buf->RemoveBookmark (book); } free (Lines[i]->Msg); free (Lines[i]->File); free (Lines[i]); } free (Lines); } LineCount=0; Lines=0; BufLen=BufPos=0; } void ECvsBase::AddLine(const char *file, int line, const char *msg, int status) { CvsLine *l; l=(CvsLine *)malloc (sizeof (CvsLine)); if (l!=0) { l->File=file?strdup (file):0; l->Line=line; l->Msg=msg?strdup (msg):0; l->Buf=0; l->Status=status; LineCount++; Lines=(CvsLine **)realloc (Lines,sizeof (CvsLine *)*LineCount); Lines[LineCount-1]=l; FindBuffer (LineCount-1); UpdateList (); } } void ECvsBase::FindBuffer (int line) { assert (line>=0&&line<LineCount); if (Lines[line]->File!=0) { EBuffer *B; Lines[line]->Buf=0; char path[MAXPATH]; strcpy (path,Directory);Slash (path,1);strcat (path,Lines[line]->File); B=FindFile (path); if (B!=0&&B->Loaded!=0) AssignBuffer (B,line); } } void ECvsBase::AssignBuffer (EBuffer *B,int line) { assert (line>=0&&line<LineCount); char book[16]; EPoint P; Lines[line]->Buf=B; if (Lines[line]->Line>=0) { sprintf (book,"_CVS.%d",line); P.Col=0; P.Row=Lines[line]->Line; if (P.Row>=B->RCount) P.Row=B->RCount-1; B->PlaceBookmark (book,P); } } void ECvsBase::FindFileLines (EBuffer *B) { char path[MAXPATH]; char *pos; strcpy (path,Directory);Slash (path,1);pos=path+strlen (path); for (int i=0;i<LineCount;i++) if (Lines[i]->Buf==0&&Lines[i]->File!=0) { strcpy (pos,Lines[i]->File); if (filecmp (B->FileName,path)==0) { AssignBuffer (B,i); } } } void ECvsBase::NotifyDelete (EModel *Deleting) { for (int i=0;i<LineCount;i++) { if (Lines[i]->Buf==Deleting) { Lines[i]->Buf=0; } } } int ECvsBase::GetLine(char *Line, size_t max) { int rc; char *p; int l; //fprintf(stderr, "GetLine: %d\n", Running); *Line = 0; if (Running && PipeId != -1) { rc = gui->ReadPipe(PipeId, MsgBuf + BufLen, sizeof(MsgBuf) - BufLen); //fprintf(stderr, "GetLine: ReadPipe rc = %d\n", rc); if (rc == -1) { ContinuePipe (); } if (rc > 0) BufLen += rc; } l = max - 1; if (BufLen - BufPos < l) l = BufLen - BufPos; //fprintf(stderr, "GetLine: Data %d\n", l); p = (char *)memchr(MsgBuf + BufPos, '\n', l); if (p) { *p = 0; strcpy(Line, MsgBuf + BufPos); l = strlen(Line); if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos = p + 1 - MsgBuf; //fprintf(stderr, "GetLine: Line %d\n", strlen(Line)); } else if (Running && sizeof(MsgBuf) != BufLen) { memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Line Incomplete\n"); return 0; } else { if (l == 0) return 0; memcpy(Line, MsgBuf + BufPos, l); Line[l] = 0; if (l > 0 && Line[l - 1] == '\r') Line[l - 1] = 0; BufPos += l; //fprintf(stderr, "GetLine: Line Last %d\n", l); } memmove(MsgBuf, MsgBuf + BufPos, BufLen - BufPos); BufLen -= BufPos; BufPos = 0; //fprintf(stderr, "GetLine: Got Line\n"); return 1; } void ECvsBase::ParseLine(const char *line, size_t) { AddLine (0,-1,line); } void ECvsBase::NotifyPipe (int APipeId) { if (APipeId==PipeId) { char line[1024]; RxMatchRes RM; int i; while (GetLine(line, sizeof(line))) { size_t len = strlen(line); if (len>0&&line[len-1]=='\n') line[--len]=0; for (i=0;i<CvsIgnoreRegexpCount;i++) if (RxExec (CvsIgnoreRegexp[i],line,len,line,&RM)==1) break; if (i==CvsIgnoreRegexpCount) ParseLine (line,len); } if (!Running) { char s[30]; sprintf (s,"[done, status=%d]",ReturnCode); AddLine (0,-1,s); } } } int ECvsBase::RunPipe(const char *ADir, const char *ACommand, const char *AOnFiles) { free (Command); free (Directory); free (OnFiles); Command=strdup (ACommand); Directory=strdup (ADir); OnFiles=strdup (AOnFiles); ReturnCode=-1; Row=LineCount-1; OnFilesPos=OnFiles; { char s[2*MAXPATH*4]; sprintf (s,"[running cvs in '%s']",Directory); AddLine (0,-1,s); } ChangeDir (Directory); return ContinuePipe (); } int ECvsBase::ContinuePipe () { char RealCommand[2048]; size_t space; if (!OnFilesPos) { // At the end of all files, terminate ClosePipe (); return 0; } else if (Running) { // Already running, close the pipe and continue ReturnCode=gui->ClosePipe (PipeId); } else { // Not running -> set to Running mode Running=1; } // Make real command with some files from OnFiles, update OnFilesPos strcat (strcpy (RealCommand,Command)," "); space=sizeof (RealCommand)-strlen (RealCommand)-1; if (space>=strlen (OnFilesPos)) { strcat (RealCommand,OnFilesPos); OnFilesPos=NULL; } else { char c=OnFilesPos[space]; OnFilesPos[space]=0; char *s=strrchr (OnFilesPos,' '); OnFilesPos[space]=c; if (!s) { ClosePipe (); return 0; } *s=0; strcat (RealCommand,OnFilesPos); OnFilesPos=s+1; while (*OnFilesPos==' ') OnFilesPos++; if (!*OnFilesPos) OnFilesPos=NULL; } BufLen=BufPos=0; { char s[sizeof (RealCommand)+32]; sprintf (s,"[continuing: '%s']",RealCommand); AddLine (0,-1,s); } PipeId=gui->OpenPipe (RealCommand,this); return 0; } void ECvsBase::ClosePipe () { ReturnCode = gui->ClosePipe(PipeId); PipeId = -1; Running = 0; } void ECvsBase::DrawLine (PCell B,int Line,int Col,ChColor color,int Width) { if (Line<LineCount) if (Col<(int)strlen (Lines[Line]->Msg)) { char str[1024]; int len; len=UnTabStr (str,sizeof (str),Lines[Line]->Msg,strlen (Lines[Line]->Msg)); if (len>Col) MoveStr (B,0,Width,str+Col,color,Width); } } char *ECvsBase::FormatLine (int Line) { if (Line<LineCount) return strdup (Lines[Line]->Msg);else return 0; } void ECvsBase::UpdateList () { if (LineCount<=Row||Row>=Count-1) Row=LineCount-1; Count=LineCount; EList::UpdateList (); } int ECvsBase::Activate (int No) { ShowLine (View,No); return 1; } int ECvsBase::CanActivate(int Line) { return Line<LineCount&&Lines[Line]->File; } int ECvsBase::IsHilited (int Line) { return Line<LineCount&&(Lines[Line]->Status&1); } int ECvsBase::IsMarked (int Line) { return Line<LineCount&&(Lines[Line]->Status&2); } int ECvsBase::Mark (int Line) { if (Line<LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status|=2; return 1; } else return 0; } int ECvsBase::Unmark (int Line) { if (Line<LineCount) { if (Lines[Line]->Status&4) Lines[Line]->Status&=~2; return 1; } else return 0; } int ECvsBase::ExecCommand(ExCommands Command, ExState &State) { switch (Command) { case ExChildClose: if (Running == 0 || PipeId == -1) break; ClosePipe (); { char s[30]; sprintf(s, "[aborted, status=%d]", ReturnCode); AddLine(0, -1, s); } return 1; case ExActivateInOtherWindow: ShowLine(View->Next, Row); return 1; default: ; } return EList::ExecCommand(Command, State); } void ECvsBase::ShowLine (EView *V,int line) { if (line>=0&&line<LineCount&&Lines[line]->File) { if (Lines[line]->Buf!=0) { V->SwitchToModel (Lines[line]->Buf); if (Lines[line]->Line!=-1) { char book[16]; sprintf(book,"_CVS.%d",line); Lines[line]->Buf->GotoBookmark (book); } } else { char path[MAXPATH]; strcpy (path,Directory);Slash (path,1);strcat (path,Lines[line]->File); if (FileLoad (0,path,0,V)==1) { V->SwitchToModel (ActiveModel); if (Lines[line]->Line!=-1) ((EBuffer *)ActiveModel)->CenterNearPosR (0,Lines[line]->Line); } } } } // Event map - this name is used in config files when defining eventmap EEventMap *ECvsBase::GetEventMap () { return FindEventMap ("CVSBASE"); } // Shown in "Closing xxx..." message when closing model void ECvsBase::GetName(char *AName, size_t MaxLen) { strlcpy(AName, Title, MaxLen); } // Shown in buffer list void ECvsBase::GetInfo (char *AInfo, size_t MaxLen) { char format[128]; sprintf(format, "%2d %04d/%03d %s (%%.%is) ", ModelNo, Row, Count, Title, (int)(MaxLen - 24 - strlen(Title))); snprintf(AInfo, MaxLen, format, Command); } // Used to get default directory of model void ECvsBase::GetPath(char *APath, size_t MaxLen) { strlcpy(APath, Directory, MaxLen); Slash(APath, 0); } // Normal and short title (normal for window, short for icon in X) void ECvsBase::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { char format[128]; sprintf(format,"%s: %%.%is", Title, (int)(MaxLen - 4 - strlen(Title))); sprintf(ATitle, format, Command); strlcpy(ASTitle, Title, SMaxLen); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte-bcc2.mak����������������������������������������������������������������������������������0000644�0001750�0001750�00000002674�10004723760�012531� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������LIBDIR = \BCOS2\LIB INCDIR = \BCOS2\INCLUDE .AUTODEPEND DEFINES=-DOS2 -DBCPP -DHEAPWALK -DINCL_32 DEBUG = #DEBUG=-v INIT = $(LIBDIR)\c02.obj CC = bcc LD = tlink CCFLAGS = $(DEFINES) -L$(LIBDIR) -I$(INCDIR) -H=fte.CSM \ -k- -sm -K -w -w-par -Ot -RT- -xd- -x- -vi- -d -a -y $(DEBUG) LDFLAGS = -L$(LIBDIR) $(DEBUG) -s -Toe -Oc -B:0x10000 OEXT=obj !include objs.inc .cpp.$(OEXT): $(CC) $(CCFLAGS) -c {$< } .c.$(OEXT): $(CC) $(CCFLAGS) -c {$< } all: cfte.exe fte.exe ftepm.exe clipserv.exe cliputil.exe defcfg.cnf: defcfg.fte cfte.exe cfte defcfg.fte defcfg.cnf defcfg.h: defcfg.cnf bin2c.exe bin2c defcfg.cnf >defcfg.h c_config.obj: defcfg.h bin2c.exe: bin2c.cpp $(CC) $(CCFLAGS) bin2c.cpp cfte.exe: $(CFTE_OBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,cfte.exe,cfte.map,os2 c2mt,cfte.def | fte.exe: $(OBJS) $(VIOOBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,fte.exe,fte.map,os2 c2mt,fte.def | ftepm.exe:: $(OBJS) $(PMOBJS) $(LD) @&&| $(LDFLAGS) $(INIT) $**,ftepm.exe,ftepm.map,c2mt os2,ftepm.def | rc -i $(INCDIR) ftepm.rc ftepm.exe clipserv.exe: clipserv.obj $(LD) @&&| $(LDFLAGS) $(INIT) $**,clipserv.exe,clipserv.map,c2mt os2,clipserv.def | cliputil.exe: cliputil.obj clip_vio.obj $(LD) @&&| $(LDFLAGS) $(INIT) $**,cliputil.exe,cliputil.map,c2mt os2,cliputil.def | ftepm.exe:: ftepm.res rc ftepm.res ftepm.exe ftepm.res: ftepm.rc pmdlg.rc rc -i $(INCDIR) -r ftepm.rc ��������������������������������������������������������������������./src/con_dosx.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000062476�11602724002�012773� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_dosx.cpp * * Copyright (c) 1994-1996, Marko Macek * Free 1996 F.Jalvingh * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // include #include "sysdep.h" #include "console.h" #include "c_config.h" #include "gui.h" #include "s_string.h" #include <process.h> #include "port.h" // DOS portability calls, #include <stdio.h> #include <stdlib.h> #include <signal.h> #ifdef DJGPP #include <sys/stat.h> #endif #define MAX_PIPES 4 #define PIPE_BUFLEN 4096 typedef struct { int used; int id; // int reading; int stopped; // TID tid; // HMTX Access; // HEV ResumeRead; // HEV NewData; // char *buffer; // int buflen; // int bufused; // int bufpos; EModel *notify; // char *Command; // int RetCode; // int DoTerm; FILE *fp; } GPipe; static GPipe Pipes[MAX_PIPES] = { { 0 }, { 0 }, { 0 }, { 0 } }; #if defined(__DJGPP__) // adapted from djgpp library source - redirects stderr as well as stdout // Original author: pacetti@fl-ngnet.army.mil #include <io.h> #include <errno.h> #include <unistd.h> /* hold file pointer, descriptor, command, mode, temporary file name, and the status of the command */ struct pipe_list { FILE *fp; int fd; int exit_status; char *command, mode[10], temp_name[L_tmpnam]; struct pipe_list *next; }; /* static, global list pointer */ static struct pipe_list *pl = NULL; static FILE * xpopen (const char *cm, const char *md) /* program name, pipe mode */ { struct pipe_list *l1, *l2; /* make new node */ if ((l1 = (struct pipe_list *) malloc (sizeof (struct pipe_list))) == NULL) return NULL; /* zero out elements to we'll get here */ l1->fd = 0; l1->fp = NULL; l1->next = NULL; /* if empty list - just grab new node */ if (!pl) pl = l1; else { /* otherwise, find last node in list */ ++(l1->fd); l2 = pl; while (l2->next) { ++(l1->fd); l2 = l2->next; }; /* add new node to list */ l2->next = l1; } /* stick in elements we know already */ l1->exit_status = -1; strcpy (l1->mode, md); if (tmpnam (l1->temp_name) == NULL) return NULL; /* if can save the program name, build temp file */ if ((l1->command = (char *) malloc(strlen(cm)+1))) { strcpy(l1->command, cm); /* if caller wants to read */ if (l1->mode[0] == 'r') { #if 1 int fd2 = -1; #endif /* dup stdout */ if ((l1->fd = dup (fileno (stdout))) == EOF) l1->fp = NULL; else if (!(l1->fp = freopen (l1->temp_name, "wb", stdout))) l1->fp = NULL; #if 1 /* dup stderr */ else if ((fd2 = dup (STDERR_FILENO)) == EOF) l1->fp = NULL; /* redirect stderr to new stdout */ else if (dup2(fileno(l1->fp),STDERR_FILENO) == EOF) l1->fp = NULL; #endif else /* exec cmd */ if ((l1->exit_status = system (cm)) == EOF) l1->fp = NULL; /* reopen real stdout */ if (dup2 (l1->fd, fileno (stdout)) == EOF) l1->fp = NULL; else /* open file for reader */ l1->fp = fopen (l1->temp_name, l1->mode); close(l1->fd); #if 1 /* restore stderr */ if (fd2 >= 0) { (void) dup2(fd2, STDERR_FILENO); (void) close(fd2); } #endif } else /* if caller wants to write */ if (l1->mode[0] == 'w') /* open temp file */ l1->fp = fopen (l1->temp_name, l1->mode); else /* unknown mode */ l1->fp = NULL; } return l1->fp; /* return == NULL ? ERROR : OK */ } static int xpclose (FILE *pp) { struct pipe_list *l1, *l2; /* list pointers */ int retval=0; /* function return value */ /* if pointer is first node */ if (pl->fp == pp) { /* save node and take it out the list */ l1 = pl; pl = l1->next; } else /* if more than one node in list */ if (pl->next) { /* find right node */ for (l2 = pl, l1 = pl->next; l1; l2 = l1, l1 = l2->next) if (l1->fp == pp) break; /* take node out of list */ l2->next = l1->next; } else return -1; /* if FILE not in list - return error */ if (l1->fp == pp) { /* close the (hopefully) popen()ed file */ fclose (l1->fp); /* if pipe was opened to write */ if (l1->mode[0] == 'w') { /* dup stdin */ if ((l1->fd = dup (fileno (stdin))) == EOF) retval = -1; else /* open temp stdin */ if (!(l1->fp = freopen (l1->temp_name, "rb", stdin))) retval = -1; else /* exec cmd */ if ((retval = system (l1->command)) != EOF) { /* reopen stdin */ if (dup2 (l1->fd, fileno (stdin)) == EOF) retval = -1; } close(l1->fd); } else /* if pipe was opened to read, return the exit status we saved */ if (l1->mode[0] == 'r') retval = l1->exit_status; else /* invalid mode */ retval = -1; } remove (l1->temp_name); /* remove temporary file */ free (l1->command); /* dealloc memory */ free (l1); /* dealloc memory */ l1 = NULL; /* make pointer bogus */ return retval; /* retval==0 ? OK : ERROR */ } #endif /* defined(__DJGPP__) */ static long MouseAutoDelay = 400; static long MouseAutoRepeat = 5; static long MouseMultiClick = 300; static int Initialized = 0; static int MousePresent = 0; static int CursorVisible = 1; /* 1 means visible */ static int MouseVisible = 0; /* 0 means hidden */ static TEvent MouseEv = { evNone }; static TEvent EventBuf = { evNone }; //static HMOU MouseHandle = 0; //static KBDINFO SaveKbdState; // misc static void DrawCursor(int Show) { } static void DrawMouse(int Show) { if (!MousePresent) return; if (Show) MOUSCursen(TRUE); else MOUSCursen(FALSE); } // *INDENT-OFF* static struct { // TransCharScan unsigned short CharScan; TKeyCode KeyCode; } TransCharScan[] = { { 0x0100, kbEsc }, { 0x011B, kbEsc }, { 0x1C0D, kbEnter }, { 0x1C0A, kbEnter }, { 0x1C00, kbEnter }, { 0xE00D, kbEnter | kfGray }, { 0xA600, kbEnter | kfGray },{ 0xE00A, kbEnter | kfGray }, { 0x0E08, kbBackSp }, { 0x0E7F, kbBackSp }, { 0x0E00, kbBackSp }, { 0x0F09, kbTab }, { 0x9400, kbTab }, { 0xA500, kbTab }, { 0x0F00, kbTab }, { 0x4E00, '+' | kfGray }, { 0x9000, '+' | kfGray }, { 0x4E2B, '+' | kfGray }, { 0x4A00, '-' | kfGray }, { 0x8E00, '-' | kfGray }, { 0x4A2D, '-' | kfGray }, { 0x3700, '*' | kfGray }, { 0x9600, '*' | kfGray }, { 0x372A, '*' | kfGray }, { 0xE02F, '/' | kfGray }, { 0xA400, '/' | kfGray }, { 0x9500, '/' | kfGray }, { 0x0300, 0 } }; static struct { // TransScan int ScanCode; TKeyCode KeyCode; } TransScan[] = { { 0x78, '1' }, { 0x79, '2' }, { 0x7A, '3' }, { 0x7B, '4' }, { 0x7C, '5' }, { 0x7D, '6' }, { 0x7E, '7' }, { 0x7F, '8' }, { 0x80, '9' }, { 0x81, '0' }, { 0x10, 'Q' }, { 0x11, 'W' }, { 0x12, 'E' }, { 0x13, 'R' }, { 0x14, 'T' }, { 0x15, 'Y' }, { 0x16, 'U' }, { 0x17, 'I' }, { 0x18, 'O' }, { 0x19, 'P' }, { 0x1E, 'A' }, { 0x1F, 'S' }, { 0x20, 'D' }, { 0x21, 'F' }, { 0x22, 'G' }, { 0x23, 'H' }, { 0x24, 'J' }, { 0x25, 'K' }, { 0x26, 'L' }, { 0x2C, 'Z' }, { 0x2D, 'X' }, { 0x2E, 'C' }, { 0x2F, 'V' }, { 0x30, 'B' }, { 0x31, 'N' }, { 0x32, 'M' }, { 0x29, '`' }, { 0x82, '-' }, { 0x83, '=' }, { 0x2B, '\\' }, { 0x1A, '[' }, { 0x1B, ']' }, { 0x27, ';' }, { 0x28, '\'' }, { 0x33, ',' }, { 0x34, '.' }, { 0x35, '/' }, { 0x37, '*' }, { 0x4E, '+' }, { 0x4A, '-' }, { 0x3B, kbF1 }, { 0x3C, kbF2 }, { 0x3D, kbF3 }, { 0x3E, kbF4 }, { 0x3F, kbF5 }, { 0x40, kbF6 }, { 0x41, kbF7 }, { 0x42, kbF8 }, { 0x43, kbF9 }, { 0x44, kbF10 }, { 0x85, kbF11 }, { 0x86, kbF12 }, { 0x54, kbF1 }, { 0x55, kbF2 }, { 0x56, kbF3 }, { 0x57, kbF4 }, { 0x58, kbF5 }, { 0x59, kbF6 }, { 0x5A, kbF7 }, { 0x5B, kbF8 }, { 0x5C, kbF9 }, { 0x5D, kbF10 }, { 0x87, kbF11 }, { 0x88, kbF12 }, { 0x5E, kbF1 }, { 0x5F, kbF2 }, { 0x60, kbF3 }, { 0x61, kbF4 }, { 0x62, kbF5 }, { 0x63, kbF6 }, { 0x64, kbF7 }, { 0x65, kbF8 }, { 0x66, kbF9 }, { 0x67, kbF10 }, { 0x89, kbF11 }, { 0x8A, kbF12 }, { 0x68, kbF1 }, { 0x69, kbF2 }, { 0x6A, kbF3 }, { 0x6B, kbF4 }, { 0x6C, kbF5 }, { 0x6D, kbF6 }, { 0x6E, kbF7 }, { 0x6F, kbF8 }, { 0x70, kbF9 }, { 0x71, kbF10 }, { 0x8B, kbF11 }, { 0x8C, kbF12 }, { 0x47, kbHome }, { 0x48, kbUp }, { 0x49, kbPgUp }, { 0x4B, kbLeft }, { 0x4C, kbCenter }, { 0x4D, kbRight }, { 0x4F, kbEnd }, { 0x50, kbDown }, { 0x51, kbPgDn }, { 0x52, kbIns }, { 0x53, kbDel }, { 0x77, kbHome }, { 0x8D, kbUp }, { 0x84, kbPgUp }, { 0x73, kbLeft }, { 0x74, kbRight }, { 0x75, kbEnd }, { 0x91, kbDown }, { 0x76, kbPgDn }, { 0x92, kbIns }, { 0x93, kbDel }, { 0x97, kbHome | kfGray }, { 0x98, kbUp | kfGray }, { 0x99, kbPgUp | kfGray }, { 0xA1, kbPgDn | kfGray }, { 0x9B, kbLeft | kfGray }, { 0x9D, kbRight | kfGray }, { 0x9F, kbEnd | kfGray }, { 0xA0, kbDown | kfGray }, { 0xA2, kbIns | kfGray }, { 0xA3, kbDel | kfGray } }; // *INDENT-ON* int ReadKbdEvent(TEvent *Event, int Wait) { struct plKbdInfo ki; UBYTE CharCode, ScanCode; ULONG KeyCode, KeyFlags; UWORD CharScan, Flags; static ULONG PrevFlags = 0; int I; const int Tcs = (int) (sizeof(TransCharScan)/sizeof(TransCharScan[0])); const int Ts = (int) (sizeof(TransScan)/sizeof(TransScan[0])); Event->What = evNone; if(! plKbdReadF(&ki)) return 0; // No data-> no read.. Event->What = evKeyDown; CharCode = ki.ki_ascii; ScanCode = ki.ki_scan; CharScan = (UWORD)((((UWORD)ScanCode) << 8) | ((UWORD)CharCode)); Flags = ki.ki_flags; KeyCode = 0; KeyFlags = 0; /* printf("Key: %X %X %X %X %X \n", (unsigned long) ki.bNlsShift, (unsigned long) ki.fbStatus, (unsigned long) Flags, (unsigned long) CharCode, (unsigned long) ScanCode);*/ if ((Flags & PLKF_SHIFT) != 0) KeyFlags |= kfShift; if ((Flags & PLKF_CTRL) != 0) KeyFlags |= kfCtrl; /* cpCount = sizeof(cpList);*/ /* rc = DosQueryCp(sizeof(cpList), cpList, &cpCount); // get active code page*/ if (CharCode != 0) { // if ((Flags & PLKF_ALT) != 0) KeyFlags |= kfAlt; } else { if((Flags & PLKF_ALT) != 0) KeyFlags |= kfAlt; } /* if (rc != 0) printf("rc = %d\n", rc);*/ if (CharScan == 0) { /* shift/alt/ctrl/caps/scroll/num */ } else if (ScanCode == 0) { /* alt numeric */ KeyCode = CharCode; KeyFlags |= kfAltXXX; } else { /* now check special combinations */ for (I = 0; I < Tcs; I++) if (TransCharScan[I].CharScan == CharScan) { KeyCode = TransCharScan[I].KeyCode; break; } if (KeyCode == 0) { if ((CharCode == 0) || (CharCode == 0xE0)) { if (CharCode == 0xE0) KeyFlags |= kfGray; for (I = 0; I < Ts; I++) if (TransScan[I].ScanCode == ScanCode) { KeyCode = TransScan[I].KeyCode; break; } } else { KeyCode = CharCode; } } } Event->Key.Code = KeyCode | KeyFlags; PrevFlags = Flags; return 1; } #define TM_DIFF(x,y) ((long)(((long)(x) < (long)(y)) ? ((long)(y) - (long)(x)) : ((long)(x) - (long)(y)))) int ReadMouseEvent(TEvent *Event, unsigned long EventMask) { static unsigned short PrevState = 0; static unsigned short PrevButtons = 0; static TEvent LastMouseEvent = { evNone }; static ULONG LastEventTime = 0; static ULONG LastClick = 0; static ULONG LastClickTime = 0; static ULONG LastClickCount = 0; // MOUEVENTINFO mi; unsigned short Buttons, State, Btn; // USHORT fWait = MOU_NOWAIT; // MOUQUEINFO mq; ULONG CurTime; UWORD cx, cy; int butf; boolean rb, lb; static int Scx = -1, Scy = -1; static boolean Slb, Srb; // CurTime = plTmGet(); // 2do! Event->What = evNone; //** Distill an event from the current position & button state of the mouse. MOUSPos(&cx, &cy, &lb, &rb); cx /= 8; cy /= 8; if(Scx == -1) { Scx = cx; // Force initial state to here. Scy = cy; } //** Assume something happened.. Set the mouse' position, butf = (lb ? 0x01 : 0) | (rb ? 0x02 : 0); Event->Mouse.X = cx; Event->Mouse.Y = cy; Event->Mouse.Count = 1; //** 1. Has the buttons state changed? if(Slb != lb) { Event->What = lb ? evMouseDown : evMouseUp; Event->Mouse.Buttons = 0x01; //lb ? 0x01 : 0; Slb = lb; } else if(Srb != rb) { Event->What = rb ? evMouseDown : evMouseUp; Event->Mouse.Buttons = 0x02; // rb ? 0x02 : 0; Srb = rb; } else if(cx != Scx || cy != Scy) { //** Mouse move. Event->What = evMouseMove; Event->Mouse.Buttons = butf; Event->Mouse.Count = 0; } //** Any event? if(Event->What == evNone) { //** Handle repeat here!! return 0; } // printf("[ev=%d, b=%d] ", Event->What, Event->Mouse.Buttons); //** Something happened.. Scx = cx; Scy = cy; return 1; } #if 0 MouGetNumQueEl(&mq, MouseHandle); if (mq.cEvents == 0) { if (LastMouseEvent.What == evMouseAuto && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoRepeat) { *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } if ((LastMouseEvent.What == evMouseDown || LastMouseEvent.What == evMouseMove) && (LastMouseEvent.Mouse.Buttons) && (EventMask & evMouseAuto)) { if (TM_DIFF(CurTime, LastEventTime) >= MouseAutoDelay) { LastMouseEvent.What = evMouseAuto; *Event = LastMouseEvent; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } } return 0; } if (MouReadEventQue(&mi, &fWait, MouseHandle) != 0) return 0; Event->Mouse.X = mi.col; Event->Mouse.Y = mi.row; State = mi.fs; Btn = Buttons = ((State & (2 | 4))?1:0) | ((State & (8 | 16))?2:0) | ((State & (32 | 64))?4:0); if (Buttons != PrevButtons) { Buttons ^= PrevButtons; if (PrevButtons & Buttons) Event->What = evMouseUp; else Event->What = evMouseDown; } else Event->What = evMouseMove; Event->Mouse.Buttons = Buttons; Event->Mouse.Count = 1; PrevState = State; PrevButtons = Btn; if (Event->What == evMouseDown) { if (LastClickCount) { if (LastClick == Event->Mouse.Buttons) { if (TM_DIFF(CurTime, LastClickTime) <= MouseMultiClick) { Event->Mouse.Count = ++LastClickCount; } else { LastClickCount = 0; } } else { LastClick = 0; LastClickCount = 0; LastClickTime = 0; } } LastClick = Event->Mouse.Buttons; if (LastClickCount == 0) LastClickCount = 1; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastClickTime, 4); } /* if (Event->What == evMouseMove) { LastClick = 0; LastClickCount = 0; LastClickTime = 0; }*/ { KBDINFO ki; USHORT Flags; TKeyCode KeyFlags = 0; ki.cb = sizeof(ki); KbdGetStatus(&ki, 0); Flags = ki.fsState; if ((Flags & (LEFTSHIFT | RIGHTSHIFT)) != 0) KeyFlags |= kfShift; if ((Flags & (LEFTCONTROL | RIGHTCONTROL)) != 0) KeyFlags |= kfCtrl; if ((Flags & (LEFTALT | RIGHTALT)) != 0) KeyFlags |= kfAlt; Event->Mouse.KeyMask = KeyFlags; } LastMouseEvent = *Event; DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &LastEventTime, 4); return 1; } #endif int ConClear() { plScnSetCell(0, 0, plScnWidth(), plScnHeight(), 0x0720); return 1; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; char *p = (char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if ((MX >= X) && (MX <= X + W)) { DrawMouse(0); MouseHidden = 1; } plScnWrite(X, Y+I, (UWORD *)p, W); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; // USHORT WW = (U)(W << 1); char *p = (char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } plScnRead(X, Y+I, (unsigned short*) p, W); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } p += W << 1; } return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { int I; int MX, MY; int MouseHidden = 0; char *p = (char *) Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } plScnWrite(X, Y+I, (UWORD *) p, W); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { int I; int MX, MY; int MouseHidden = 0; char *p = (char *) &Cell; if (MouseVisible) ConQueryMousePos(&MX, &MY); for (I = 0; I < H; I++) { if (MouseVisible) if (Y + I == MY) if (MX >= X && MX < X + W) { DrawMouse(0); MouseHidden = 1; } plScnSetCell(X, Y+I, W, 1, (UWORD)Cell); // VioWrtNCell(p, (USHORT)(W), (USHORT)(Y + I), (USHORT)X, 0); if (MouseHidden) { DrawMouse(1); MouseHidden = 0; } } return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { int MX, MY; int MouseHidden = 0; TCell FillCell = (TCell)(Fill << 8); if (MousePresent && MouseVisible) { ConQueryMousePos(&MX, &MY); if (MX >= X && MX < X + W && MY >= Y && MY < Y + H) { DrawMouse(0); MouseHidden = 1; } } switch (Way) { case csUp: plScnScrollUp(X, Y, X+W, Y+H, Count, (UWORD)FillCell); break; case csDown:plScnScrollDown(X, Y, X+W, Y+H, Count, (UWORD)FillCell); break; case csLeft: // VioScrollLf((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; case csRight: // VioScrollRt((USHORT)Y, (USHORT)X, (USHORT)(Y + H - 1), (USHORT)(X + W - 1), (USHORT)Count, (PBYTE)&FillCell, 0); break; } if (MouseHidden) DrawMouse(1); return 1; } int ConSetSize(int X, int Y) { return 1; } int ConQuerySize(int *X, int *Y) { *X = plScnWidth(); *Y = plScnHeight(); return 1; } int ConSetCursorPos(int X, int Y) { plScnCursorPos(X, Y); return 1; } int ConQueryCursorPos(int *X, int *Y) { plScnCursorPosGet(X, Y); return 1; } int ConShowCursor() { CursorVisible = 1; plScnCursorOn(TRUE); return 1; } int ConHideCursor() { CursorVisible = 0; plScnCursorOn(FALSE); return 1; } int ConSetCursorSize(int Start, int End) { return 1; } //int ConSetMousePos(int X, int Y) { // return 0; //} /****************************************************************************/ /* */ /* CODING: Mouse stuff. */ /* */ /****************************************************************************/ int ConQueryMousePos(int *X, int *Y) { UWORD a, b; boolean lb, rb; if (!MOUSIsPresent()) return 0; MOUSPos(&a, &b, &lb, &rb); *X = a / 8; *Y = b / 8; return 1; } int ConShowMouse() { MouseVisible = TRUE; if (!MOUSIsPresent()) return 0; MOUSCursen(TRUE); return 1; } int ConHideMouse() { MouseVisible = FALSE; if (!MOUSIsPresent()) return 0; MOUSCursen(FALSE); return 1; } int ConMouseVisible() { return MouseVisible; } int ConQueryMouseButtons(int *ButtonCount) { if (ButtonCount != 0) *ButtonCount = 2; return 1; } int ConInit(int XSize, int YSize) { if (Initialized) return 1; EventBuf.What = evNone; MousePresent = MOUSInit(); ConContinue(); Initialized = 1; return 1; } int ConDone() { return ConSuspend(); } int ConSuspend() { plScnSetFlash(TRUE); // Set "flash" mode, not bright mode ConHideMouse(); #if defined(SIGBREAK) signal(SIGBREAK, SIG_DFL); #endif signal(SIGINT, SIG_DFL); return 1; } int ConContinue() { #if defined(SIGBREAK) signal(SIGBREAK, SIG_IGN); #endif signal(SIGINT, SIG_IGN); plScnSetFlash(FALSE); // Set "bright" mode, not flashing ConShowMouse(); return 1; } int GetPipeEvent(TEvent *Event) { #ifdef DJGPP int i; Event->What = evNone; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) continue; if (Pipes[i].notify == 0) continue; if (1) { //fprintf(stderr, "Pipe New Data: %d\n", i); Event->What = evNotify; Event->Msg.View = 0; Event->Msg.Model = Pipes[i].notify; Event->Msg.Command = cmPipeRead; Event->Msg.Param1 = i; return 1; } } #endif return 0; } int ConGetEvent(TEventMask EventMask, TEvent *Event, int WaitTime, int Delete) { if (EventBuf.What != evNone) { *Event = EventBuf; if (Delete) EventBuf.What = evNone; return 1; } if (MouseEv.What != evNone) { *Event = MouseEv; if (Delete) MouseEv.What = evNone; return 1; } EventBuf.What = evNone; Event->What = evNone; if (!(ReadKbdEvent(Event, WaitTime) == 1) && (EventMask & evKeyboard)) { if (MousePresent && (ReadMouseEvent(Event, EventMask) == 1) && (EventMask & evMouse)) ; else if (GetPipeEvent(Event) != 1) return 0; } if (Event->What != evNone) { if (Event->What == evMouseMove) { while (ReadMouseEvent(&MouseEv, EventMask) == 1) { if (MouseEv.What == evMouseMove) { *Event = MouseEv; MouseEv.What = evNone; } else break; } } EventBuf = *Event; if (Delete) EventBuf.What = evNone; return 1; } return 0; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { if (SavedScreen) free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(PCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 1; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) { fArgc = argc; fArgv = argv; ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; #ifdef DJGPP // speed up directory access by turning off unused stat functionality _djstat_flags |= _STAT_INODE; _djstat_flags |= _STAT_EXEC_EXT; _djstat_flags |= _STAT_EXEC_MAGIC; _djstat_flags |= _STAT_DIRSIZE; _djstat_flags |= _STAT_ROOT_TIME; _djstat_flags |= _STAT_WRITEBIT; #endif } GUI::~GUI() { RestoreScreen(); ::ConDone(); if(SavedScreen) { free(SavedScreen); SavedScreen = 0; } gui = 0; } int GUI::ConSuspend() { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue() { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } //static int CreatePipeChild(PID &pid, HPIPE &hfPipe, char *Command) { // return 0; //} static void PipeThread(void *p) { } int GUI::OpenPipe(const char *Command, EModel *notify) { #ifdef DJGPP int i; for (i = 0; i < MAX_PIPES; i++) { if (Pipes[i].used == 0) { Pipes[i].id = i; Pipes[i].notify = notify; Pipes[i].stopped = 1; Pipes[i].fp = xpopen(Command,"r"); if (Pipes[i].fp == NULL) return 0; Pipes[i].used = 1; //fprintf(stderr, "Pipe Open: %d\n", i); return i; } } #endif return -1; } int GUI::SetPipeView(int id, EModel *notify) { #ifdef DJGPP if (id < 0 || id >= MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; //fprintf(stderr, "Pipe View: %d %08X\n", id, notify); Pipes[id].notify = notify; #endif return 1; } ssize_t GUI::ReadPipe(int id, void *buffer, size_t len) { #ifdef DJGPP ssize_t rc; if (id < 0 || id >= MAX_PIPES) return -1; if (Pipes[id].used == 0) return -1; //fprintf(stderr, "Pipe Read: Get %d %d\n", id, len); rc = fread(buffer,1,len,Pipes[id].fp); //fprintf(stderr, "Pipe Read: Got %d %d\n", id, rc); if (ferror(Pipes[id].fp)) { Pipes[id].stopped = 1; rc = -1; } return rc; #else return -1; #endif } int GUI::ClosePipe(int id) { #ifdef DJGPP if (id < 0 || id >= MAX_PIPES) return 0; if (Pipes[id].used == 0) return 0; Pipes[id].used = 0; //fprintf(stderr, "Pipe Close: %d\n", id); return (xpclose(Pipes[id].fp) == 0); #else return 0; #endif } int GUI::RunProgram(int mode, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv( "COMSPEC" ); rc = system(Command); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) { frames->Resize(W1, H1); } frames->Repaint(); return rc; } int ConSetTitle(const char *Title, const char *STitle) { return 0; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, "FTE", MaxLen); strlcpy(STitle, "FTE", SMaxLen); return 0; } int ConCursorVisible() { return 0; } int ConPutEvent(const TEvent& Event) { EventBuf = Event; return 0; } char ConGetDrawChar(unsigned int index) { static const char *tab = NULL; if (!tab) tab = GetGUICharacters ("DOS","\xDA\xBF\xC0\xD9\xC4\xB3\xC2\xC3\xB4\xC1\xC5\x1A\xFA\x04\xC4\x18\x19\B1\xB0\x1B\x1A"); assert(index < strlen(tab) && strlen(tab) > 20); return tab[index]; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/con_linux.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000065202�11602724002�013143� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* con_linux.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // If you're searching for portability it is not here ;-) #define USE_GPM //uncomment here to use GPM #define USE_SCRNMAP // use USER translation table instead of direct mapping // The translation table is assumed to be invertible (more or less). // How do we get other translation tables from kernel, the USER one // is null mapping by default (not very useful)? // PROBLEM: we use raw mode, and this disables the console // switching (consoles cannot be switched when the editor is busy). // probably needs to be fixed in the kernel (IMO kernel should // switch consoles when raw mode is used, unless console is under // VT_PROCESS control). Why does kernel trust user processes to do it? // FIX: caps lock is ignored (I haven't pressed it in years, except by mistake). // FIX: access GPM clipboard. how? // Also: num lock is ignored // ... some more comments below #include "c_config.h" #include "console.h" #include "gui.h" #include "s_string.h" #include "sysdep.h" #ifdef USE_GPM extern "C" { #include <gpm.h> } #endif #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdarg.h> #include <stdio.h> #include <sys/ioctl.h> #include <sys/kd.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/vt.h> #include <sys/wait.h> #include <termios.h> #include <linux/tty.h> #include <linux/major.h> #include <linux/kdev_t.h> #include <linux/kd.h> #include <linux/keyboard.h> #define MAX_PIPES 4 //#define PIPE_BUFLEN 4096 #define die(s) do { printf("%s\n", s); exit(1); } while (0) unsigned int VideoCols = 80; unsigned int VideoRows = 25; unsigned int CursorX = 0; unsigned int CursorY = 0; int CursorVisible = 1; int VtNum = -1; static int VtFd = -1; static int VcsFd = -1; struct termios Save_termios; struct kbdiacrs diacr_table; #ifdef USE_GPM int GpmFd = -1; #endif int LastMouseX = 0, LastMouseY = 0; int WindowChanged = 0; int drawPointer = 1; int mouseDrawn = 0; TCell MousePosCell; #ifdef USE_SCRNMAP static int noCharTrans = 0; static unsigned char toScreen[256]; static unsigned char fromScreen[256]; #endif #define MEM_PAGE_SIZE 4096 #define VIDEO_SIZE (VideoCols * VideoRows * 2) #define VIDEO_MAP_SIZE ((VIDEO_SIZE | (MEM_PAGE_SIZE - 1)) + 1) int GetKeyEvent(TEvent *Event); int GetMouseEvent(TEvent *Event); static ssize_t conread(int fd, TCell *p, size_t len, off_t off) { char buf[len * 2]; char *s = buf; lseek(fd, off, SEEK_SET); ssize_t rlen = read(fd, buf, len * 2); for (unsigned n = 0; n < rlen; ++p, n += 2) { char ch; #ifdef USE_SCRNMAP if (!noCharTrans) ch = fromScreen[(unsigned char)s[n + (BYTE_ORDER == BIG_ENDIAN)]]; else #endif ch = s[n + (BYTE_ORDER == BIG_ENDIAN)]; p->Set(ch, s[n + (BYTE_ORDER != BIG_ENDIAN)]); } return rlen; } static ssize_t conwrite(int fd, TCell *p, size_t len, off_t off) { char buf[len * 2]; char *c = buf; lseek(fd, off, SEEK_SET); for (unsigned n = 0; n < len; ++n) { #ifdef USE_SCRNMAP if (!noCharTrans) c[BYTE_ORDER == BIG_ENDIAN] = toScreen[(unsigned char)p[n].GetChar()]; else #endif c[BYTE_ORDER == BIG_ENDIAN] = p[n].GetChar(); c[BYTE_ORDER != BIG_ENDIAN] = p[n].GetAttr(); c += 2; } return write(fd, buf, c - buf); } static void mouseShow() { #ifdef USE_GPM if (GpmFd != -1 && VcsFd != -1 && drawPointer && mouseDrawn == 0) { int pos = (LastMouseX + LastMouseY * VideoCols) * 2 + 4; conread(VcsFd, &MousePosCell, 1, pos); TCell newCell(MousePosCell.GetChar(), MousePosCell.GetAttr() ^ 0x77); // correct ? conwrite(VcsFd, &newCell, 1, pos); mouseDrawn = 1; } #endif } static void mouseHide() { #ifdef USE_GPM if (GpmFd != -1 && VcsFd != -1 && drawPointer && mouseDrawn == 1) { int pos = (LastMouseX + LastMouseY * VideoCols) * 2 + 4; conwrite(VcsFd, &MousePosCell, 1, pos); mouseDrawn = 0; } #endif } void SigWindowChanged(int /*arg*/) { signal(SIGWINCH, SigWindowChanged); WindowChanged = 1; } static void Cleanup() { ConDone(); } static void Die(int) { ConDone(); exit(1); } int ConInit(int /*XSize*/, int /*YSize*/) { int tmp; int mode; struct termios newt; //char ttyname[20]; char vcsname[20]; // struct vt_mode vtm; //long free_tty; // struct winsize ws; struct stat stb; unsigned char vc_data[4]; #ifdef USE_GPM Gpm_Connect conn; #endif VtFd = 2; /* try stderr as output */ if (isatty(VtFd) == 0) { die("not a terminal."); } if (fstat(VtFd, &stb) != 0) { perror("stat"); die("stat failed"); } VtNum = MINOR(stb.st_rdev); if (MAJOR(stb.st_rdev) != TTY_MAJOR) die("Not running in a virtual console."); if (ioctl(VtFd, KDGKBMODE, &mode) != 0) die("failed to get kbdmode"); #if 0 if (mode != K_XLATE) { // X, etc... sprintf(ttyname, "/dev/console"); if ((VtFd = open(ttyname, O_RDWR)) == -1) die("failed to open /dev/console"); if (ioctl(VtFd, VT_OPENQRY, &free_tty) < 0 || free_tty == -1) die("could not find a free tty\n"); close(VtFd); VtNum = free_tty; sprintf(ttyname, "/dev/tty%d", VtNum); if ((VtFd = open(ttyname, O_RDWR)) == -1) die("could not open tty"); } #endif sprintf(vcsname, "/dev/vcsa%d", VtNum); /* * This is the _only_ place that we use our extra privs if any, * If there is an error, we drop them prior to calling recovery * functions, if we succeed we go back as well. * * Ben Collins <bcollins@debian.org> */ extern uid_t effuid; extern gid_t effgid; seteuid(effuid); setegid(effgid); VcsFd = open(vcsname, O_RDWR); setuid(getuid()); setgid(getgid()); if (VcsFd == -1) { perror("open"); die("failed to open /dev/vcsa*"); } if (read(VcsFd, &vc_data, 4) != 4) { perror("read"); die("failed to read from /dev/vcsa*"); } VideoRows = vc_data[0]; VideoCols = vc_data[1]; CursorX = vc_data[2]; CursorY = vc_data[3]; #ifdef USE_SCRNMAP if (ioctl(VtFd, GIO_SCRNMAP, &toScreen) == -1) die("could not get screen character mapping!"); { memset(fromScreen, 0, sizeof(fromScreen)); for (unsigned c = 0; c < 256; c++) fromScreen[toScreen[c]] = c; } #endif tmp = tcgetattr(VtFd, &Save_termios); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); tmp = tcgetattr(VtFd, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); newt.c_lflag &= ~ (ICANON | ECHO | ISIG); newt.c_iflag = 0; newt.c_cc[VMIN] = 16; newt.c_cc[VTIME] = 1; tmp = tcsetattr(VtFd, TCSAFLUSH, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); /* set keyboard to return MEDIUMRAW mode */ if (ioctl(VtFd, KDSKBMODE, K_MEDIUMRAW) != 0) { perror("Could not activate K_MEDIUMRAW mode"); tmp = tcsetattr(VtFd, 0, &Save_termios); die("could not activate medium raw mode\n"); } /* get keyboard diacritics table */ if (ioctl(VtFd, KDGKBDIACR, &diacr_table) != 0) { perror("Could not get diacritics table"); diacr_table.kb_cnt=0; } signal(SIGWINCH, SigWindowChanged); signal(SIGSEGV, Die); signal(SIGBUS, Die); signal(SIGIOT, Die); signal(SIGQUIT, Die); signal(SIGTERM, Die); signal(SIGPIPE, SIG_IGN); signal(SIGALRM, SIG_IGN); signal(SIGHUP, Die); atexit(Cleanup); #ifdef USE_GPM conn.eventMask = (unsigned short)~0U; conn.defaultMask = GPM_DRAG; conn.minMod = 0; conn.maxMod = (unsigned short)~0U; GpmFd = Gpm_Open(&conn, 0); mouseShow(); #endif return 1; } int ConDone() { if (VtFd != -1) { int tmp; #ifdef USE_GPM if (GpmFd != -1) { mouseHide(); Gpm_Close(); GpmFd = -1; } #endif ioctl(VtFd, KDSKBMODE, K_XLATE); if ((tmp = tcsetattr(VtFd, 0, &Save_termios))) fprintf(stderr, "tcsetattr = %d\n", tmp); } return 1; } int ConSuspend() { int tmp; #ifdef USE_GPM mouseHide(); Gpm_Close(); GpmFd = -1; #endif ioctl(VtFd, KDSKBMODE, K_XLATE); tmp = tcsetattr(VtFd, 0, &Save_termios); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); return 1; } int ConContinue() { #ifdef USE_GPM Gpm_Connect conn; #endif struct termios newt; int tmp; newt.c_lflag = ~ (ICANON | ECHO | ISIG); newt.c_iflag = 0; newt.c_cc[VMIN] = 16; newt.c_cc[VTIME] = 1; tmp = tcsetattr(VtFd, TCSAFLUSH, &newt); if (tmp) fprintf(stderr, "tcsetattr = %d\n", tmp); /* set keyboard to return MEDIUMRAW mode */ if (ioctl(VtFd, KDSKBMODE, K_MEDIUMRAW) != 0) { perror("ioctl KDSKBMODE"); die("could not activate medium raw mode\n"); } #ifdef USE_GPM conn.eventMask = (unsigned short)~0U; conn.defaultMask = GPM_DRAG; conn.minMod = 0; conn.maxMod = (unsigned short)~0U; GpmFd = Gpm_Open(&conn, 0); mouseShow(); #endif return 1; } int ConClear() { int X, Y; TCell Cell(' ', 0x07); ConQuerySize(&X, &Y); ConSetBox(0, 0, X, Y, Cell); ConSetCursorPos(0, 0); return 1; } int ConSetTitle(const char */*Title*/, const char */*STitle*/) { return 1; } int ConGetTitle(char *Title, size_t MaxLen, char *STitle, size_t SMaxLen) { strlcpy(Title, "", MaxLen); strlcpy(STitle, "", SMaxLen); return 1; } int ConPutBox(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; Cell += W, ++i) { if (LastMouseY == Y + i) mouseHide(); conwrite(VcsFd, Cell, W, 4 + ((Y + i) * VideoCols + X) * 2); if (LastMouseY == Y + i) mouseShow(); } return 1; } int ConGetBox(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; Cell += W, ++i) { if (LastMouseY == Y + i) mouseHide(); conread(VcsFd, Cell, W, 4 + ((Y + i) * VideoCols + X) * 2); if (LastMouseY == Y + i) mouseShow(); } return 1; } int ConPutLine(int X, int Y, int W, int H, PCell Cell) { for (int i = 0; i < H; ++i) ConPutBox(X, Y + i, W, 1, Cell); return 1; } int ConSetBox(int X, int Y, int W, int H, TCell Cell) { TDrawBuffer B; MoveCh(B, Cell.GetChar(), Cell.GetAttr(), W); ConPutLine(X, Y, W, H, B); return 1; } int ConScroll(int Way, int X, int Y, int W, int H, TAttr Fill, int Count) { if (Count == 0 || Count > H) return 1; TDrawBuffer B; TCell C[W * H]; #ifdef USE_SCRNMAP noCharTrans = 1; #endif MoveCh(B, ' ', Fill, W); ConGetBox(X, Y, W, H, C); if (Way == csUp) { ConPutBox(X, Y, W, H - Count, C + W * Count); ConPutLine(X, Y + H - Count, W, Count, B); } else { ConPutBox(X, Y + Count, W, H - Count, C); ConPutLine(X, Y, W, Count, B); } #ifdef USE_SCRNMAP noCharTrans = 0; #endif return 1; } int ConSetSize(int /*X*/, int /*Y*/) { return 0; } int ConQuerySize(int *X, int *Y) { if (X) *X = VideoCols; if (Y) *Y = VideoRows; return 1; } int ConSetCursorPos(int X, int Y) { char pos[2]; if (X >= 0 && X < int(VideoCols)) CursorX = X; if (Y >= 0 && Y < int(VideoRows)) CursorY = Y; pos[0] = (char)CursorX; pos[1] = (char)CursorY; lseek(VcsFd, 2, SEEK_SET); write(VcsFd, pos, 2); return 1; } int ConQueryCursorPos(int *X, int *Y) { if (X) *X = CursorX; if (Y) *Y = CursorY; return 1; } int ConShowCursor() { return 0; } int ConHideCursor() { return 0; } int ConCursorVisible() { return 1; } int ConSetMousePos(int /*X*/, int /*Y*/) { return 0; } int ConQueryMousePos(int *X, int *Y) { if (X) *X = LastMouseX; if (Y) *Y = LastMouseY; return 1; } int ConShowMouse() { return 0; } int ConHideMouse() { return 0; } int ConMouseVisible() { return 1; } int ConQueryMouseButtons(int *ButtonCount) { if (ButtonCount) *ButtonCount = 0; return 1; } static TEvent Prev = { evNone }; int ConGetEvent(TEventMask /*EventMask*/, TEvent *Event, int WaitTime, int Delete) { if (Prev.What != evNone) { *Event = Prev; if (Delete) Prev.What = evNone; return 1; } switch (WaitFdPipeEvent(Event, VtFd, #ifdef USE_GPM GpmFd, #else -1, #endif WaitTime)) { default: return 1; case FD_PIPE_ERROR: return 0; case FD_PIPE_1: GetKeyEvent(Event); if (!Delete) Prev = *Event; return 1; #ifdef USE_GPM case FD_PIPE_2: GetMouseEvent(Event); if (!Delete) Prev = *Event; return 1; #endif } } int ConPutEvent(const TEvent& Event) { Prev = Event; return 1; } int ConFlush() {return 0; } int ConGrabEvents(TEventMask /*EventMask*/) { return 0; } static int shift_state = 0; static int lock_state = 0; static int slock_state = 0; static char dead_key = 0; // *INDENT-OFF* static const struct { unsigned int KeySym; unsigned int KeyCode; } KeyTrans[] = { { K(KT_FN, K_F1), kbF1 }, { K(KT_FN, K_F2), kbF2 }, { K(KT_FN, K_F3), kbF3 }, { K(KT_FN, K_F4), kbF4 }, { K(KT_FN, K_F5), kbF5 }, { K(KT_FN, K_F6), kbF6 }, { K(KT_FN, K_F7), kbF7 }, { K(KT_FN, K_F8), kbF8 }, { K(KT_FN, K_F9), kbF9 }, { K(KT_FN, K_F10), kbF10 }, { K(KT_FN, K_F11), kbF11 }, { K(KT_FN, K_F12), kbF12 }, { K(KT_FN, K_INSERT), kbIns | kfGray }, { K(KT_FN, K_REMOVE), kbDel | kfGray }, { K(KT_FN, K_FIND), kbHome | kfGray }, { K(KT_FN, K_SELECT), kbEnd | kfGray }, { K(KT_FN, K_PGUP), kbPgUp | kfGray }, { K(KT_FN, K_PGDN), kbPgDn | kfGray }, { K(KT_CUR, K_UP), kbUp | kfGray }, { K(KT_CUR, K_DOWN), kbDown | kfGray }, { K(KT_CUR, K_LEFT), kbLeft | kfGray }, { K(KT_CUR, K_RIGHT), kbRight | kfGray }, { K(KT_SPEC, K_ENTER), kbEnter }, { K(KT_PAD, K_PENTER), kbEnter | kfGray }, { K(KT_PAD, K_PPLUS), '+' | kfGray }, { K(KT_PAD, K_PMINUS), '-' | kfGray }, { K(KT_PAD, K_PSTAR), '*' | kfGray }, { K(KT_PAD, K_PSLASH), '/' | kfGray }, { K(KT_PAD, K_P0), kbIns }, { K(KT_PAD, K_PDOT), kbDel }, { K(KT_PAD, K_P1), kbEnd }, { K(KT_PAD, K_P2), kbDown }, { K(KT_PAD, K_P3), kbPgDn }, { K(KT_PAD, K_P4), kbLeft }, { K(KT_PAD, K_P5), kbCenter }, { K(KT_PAD, K_P6), kbRight }, { K(KT_PAD, K_P7), kbHome }, { K(KT_PAD, K_P8), kbUp }, { K(KT_PAD, K_P9), kbPgUp }, { K(KT_FN, K_PAUSE), kbPause }, { K(KT_LATIN, 27), kbEsc }, { K(KT_LATIN, 13), kbEnter }, { K(KT_LATIN, 8), kbBackSp }, { K(KT_LATIN, 127), kbDel }, { K(KT_LATIN, 9), kbTab }, { K(KT_SHIFT, KG_SHIFT), kbShift | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_SHIFTL), kbShift | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_SHIFTR), kbShift | kfSpecial | kfModifier | kfGray }, { K(KT_SHIFT, KG_CTRL), kbCtrl | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_CTRLL), kbCtrl | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_CTRLR), kbCtrl | kfSpecial | kfModifier | kfGray }, { K(KT_SHIFT, KG_ALT), kbAlt | kfSpecial | kfModifier }, { K(KT_SHIFT, KG_ALTGR), kbAlt | kfSpecial | kfModifier | kfGray }, { 0, 0 } }; static const struct { unsigned int KeySym; char Diacr; } DeadTrans[] = { { K_DGRAVE, '`' }, { K_DACUTE, '\'' }, { K_DCIRCM, '^' }, { K_DTILDE, '~' }, { K_DDIERE, '"' }, { K_DCEDIL, ',' } }; // *INDENT-ON* int GetKeyEvent(TEvent *Event) { char keycode; Event->What = evNone; if (read(VtFd, &keycode, 1) != 1) return 0; int key = keycode & 0x7F; int press = (keycode & 0x80) ? 0 : 1; unsigned int keysym; int rc; struct kbentry kbe; int shift_final; int ShiftFlags; TKeyCode KeyCode; kbe.kb_index = key; kbe.kb_table = 0; rc = ioctl(VtFd, KDGKBENT, &kbe); keysym = kbe.kb_value; //printf("rc = %d, value = %04X, ktype=%d, kval=%d\n", // rc, keysym, KTYP(keysym), KVAL(keysym)); int ksv = KVAL(keysym); switch(KTYP(keysym)) { case KT_SHIFT: // :-(((, have to differentiate between shifts. if (ksv == KG_SHIFT) { if (key == 54) ksv = KG_SHIFTR; else ksv = KG_SHIFTL; } else if (ksv == KG_CTRL) { if (key == 97) ksv = KG_CTRLR; else ksv = KG_CTRLL; } if (press) shift_state |= (1 << ksv); else shift_state &= ~(1 << ksv); break; case KT_LOCK: // if (press) // lock_state |= (1 << ksv); // else // lock_state &= ~(1 << ksv); if (press) lock_state ^= (1 << ksv); break; case KT_SLOCK: if (press) slock_state |= (1 << ksv); else slock_state &= ~(1 << ksv); break; } shift_final = shift_state ^ lock_state ^ slock_state; if (shift_final & ((1 << KG_SHIFT) | (1 << KG_SHIFTL) | (1 << KG_SHIFTR))) { shift_final |= (1 << KG_SHIFT); shift_final &= ~( (1 << KG_SHIFTL) | (1 << KG_SHIFTR) ); } if (shift_final & ((1 << KG_CTRL) | (1 << KG_CTRLL) | (1 << KG_CTRLR))) { shift_final |= (1 << KG_CTRL); shift_final &= ~( (1 << KG_CTRLL) | (1 << KG_CTRLR) ); } ShiftFlags = 0; if ((shift_final & (1 << KG_SHIFT)) || (shift_final & (1 << KG_SHIFTL)) || (shift_final & (1 << KG_SHIFTR))) ShiftFlags |= kfShift; if ((shift_final & (1 << KG_CTRL)) || (shift_final & (1 << KG_CTRLL)) || (shift_final & (1 << KG_CTRLR))) ShiftFlags |= kfCtrl; // if ((shift_final & (1 << KG_ALT)) || // (shift_final & (1 << KG_ALTGR))) if (shift_final & (1 << KG_ALT)) ShiftFlags |= kfAlt; // printf("shift: %X, lock: %X, slock: %X, final: %X, ShiftFlags: %X\n", // shift_state, lock_state, slock_state, shift_final, ShiftFlags); if (KTYP(keysym) != KT_SLOCK) slock_state = 0; KeyCode = 0; if (key == 14 && keysym == K(KT_LATIN,127)) { // we are running on a system with broken backspace key KeyCode = kbBackSp; } else for(size_t i = 0; i < FTE_ARRAY_SIZE(KeyTrans); ++i) if (KeyTrans[i].KeySym == keysym) { KeyCode = KeyTrans[i].KeyCode; break; } if (KeyCode == 0) { switch (KTYP(keysym)) { case KT_CONS: case KT_FN: //case KT_SPEC: case KT_LOCK: case KT_SLOCK: //case KT_META: case KT_CUR: default: //if (!(shift_final & KG_ALTGR)) // break; dead_key = 0; break; case KT_SHIFT: break; case KT_LETTER: // take caps into account if (0) { ShiftFlags ^= kfShift; shift_final ^= (1 << KG_SHIFT); } // no break case KT_LATIN: // if (shift_final & (1 << KG_ALTGR)) // ShiftFlags &= ~kfAlt; if (ShiftFlags & kfAlt) shift_final &= ~(1 << KG_SHIFT); kbe.kb_index = key; kbe.kb_table = shift_final; rc = ioctl(VtFd, KDGKBENT, &kbe); if (rc != 0) break; keysym = kbe.kb_value; //if (KTYP(keysym) != KT_LATIN && // KTYP(keysym) != KT_LETTER && // KTYP(keysym) != KT_ASCII) // break; KeyCode = KVAL(keysym); if (ShiftFlags & kfAlt) KeyCode = toupper(KeyCode); if (KTYP(keysym) == KT_DEAD) { for (size_t i = 0; i < FTE_ARRAY_SIZE(DeadTrans); ++i) if (DeadTrans[i].KeySym == keysym) { dead_key = DeadTrans[i].Diacr; return 0; } dead_key = 0; return 0; } if (! (ShiftFlags & (kfAlt | kfCtrl)) && dead_key) { for (unsigned i = 0; i < diacr_table.kb_cnt; ++i) if (diacr_table.kbdiacr[i].base == KeyCode && diacr_table.kbdiacr[i].diacr == dead_key) { KeyCode=diacr_table.kbdiacr[i].result; break; } } dead_key = 0; break; } } if (KeyCode == 0) return 0; if (ShiftFlags & kfCtrl) if (KeyCode < 32) KeyCode += 64; KeyCode |= ShiftFlags; if (!press) KeyCode |= kfKeyUp; if (KeyCode != 0) { if (KTYP(keysym) != KT_SHIFT) dead_key = 0; if (KeyCode & kfKeyUp) Event->What = evKeyUp; else Event->What = evKeyDown; Event->Key.Code = KeyCode & ~kfKeyUp; // switching consoles should be done by the kernel, but // it is not (why, since I am not using VT_PROCESS??). // this has a delay if the app is working. // there is also a problem with shift-states (should update it // after getting back, but how to know when that happens, without // using VT_PROCESS?). int vc = -1; // switch (kbCode(Event->Key.Code) | kfCtrl) { switch (kbCode(Event->Key.Code)) { case kfAlt | kfCtrl | kbF1: vc = 1; break; case kfAlt | kfCtrl | kbF2: vc = 2; break; case kfAlt | kfCtrl | kbF3: vc = 3; break; case kfAlt | kfCtrl | kbF4: vc = 4; break; case kfAlt | kfCtrl | kbF5: vc = 5; break; case kfAlt | kfCtrl | kbF6: vc = 6; break; case kfAlt | kfCtrl | kbF7: vc = 7; break; case kfAlt | kfCtrl | kbF8: vc = 8; break; case kfAlt | kfCtrl | kbF9: vc = 9; break; case kfAlt | kfCtrl | kbF10: vc = 10; break; case kfAlt | kfCtrl | kbF11: vc = 11; break; case kfAlt | kfCtrl | kbF12: vc = 12; break; } if (vc != -1) { /* perform the console switch */ ioctl(VtFd, VT_ACTIVATE, vc); Event->What = evNone; // shift_state = lock_state = slock_state = 0; // bad shift_state = slock_state = 0; // bad return 0; } return 1; } return 0; } int GetMouseEvent(TEvent *Event) { #ifdef USE_GPM Gpm_Event e; Event->What = evNone; int rc = Gpm_GetEvent(&e); if (rc == 0) { Gpm_Close(); GpmFd = -1; } else if (rc != -1) { //Gpm_FitEvent(&e); if ((e.type & GPM_MOVE) || (e.type & GPM_DRAG)) Event->What = evMouseMove; else if (e.type & GPM_DOWN) Event->What = evMouseDown; else if (e.type & GPM_UP) Event->What = evMouseUp; else return 0; Event->Mouse.Count = (e.type & GPM_SINGLE) ? 1 : (e.type & GPM_DOUBLE) ? 2 : (e.type & GPM_TRIPLE) ? 3 : 1; Event->Mouse.Buttons = ((e.buttons & GPM_B_LEFT) ? 1 : 0) | ((e.buttons & GPM_B_RIGHT) ? 2 : 0) | ((e.buttons & GPM_B_MIDDLE) ? 4 : 0); e.x--; e.y--; if (e.x < 0) e.x = 0; if (e.y < 0) e.y = 0; if (e.x >= int(VideoCols)) e.x = VideoCols - 1; if (e.y >= int(VideoRows)) e.y = VideoRows - 1; Event->Mouse.X = e.x; Event->Mouse.Y = e.y; Event->Mouse.KeyMask = ((e.modifiers & 1) ? kfShift : 0) | ((e.modifiers & (2 | 8)) ? kfAlt : 0) | ((e.modifiers & 4) ? kfCtrl : 0); if (LastMouseX != e.x || LastMouseY != e.y) { mouseHide(); LastMouseX = e.x; LastMouseY = e.y; mouseShow(); } } #else Event->What = evNone; #endif return 1; } int ConSetCursorSize(int /*Start*/, int /*End*/) { return 1; } static PCell SavedScreen = 0; static int SavedX, SavedY, SaveCursorPosX, SaveCursorPosY; int SaveScreen() { free(SavedScreen); ConQuerySize(&SavedX, &SavedY); SavedScreen = (PCell) malloc(SavedX * SavedY * sizeof(PCell)); if (SavedScreen) ConGetBox(0, 0, SavedX, SavedY, SavedScreen); ConQueryCursorPos(&SaveCursorPosX, &SaveCursorPosY); return 1; } int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; } GUI::GUI(int &argc, char **argv, int XSize, int YSize) : fArgc(argc), fArgv(argv) { ::ConInit(-1, -1); SaveScreen(); ::ConSetSize(XSize, YSize); gui = this; } GUI::~GUI() { RestoreScreen(); ::ConDone(); free(SavedScreen); SavedScreen = 0; gui = 0; } int GUI::ConSuspend() { RestoreScreen(); return ::ConSuspend(); } int GUI::ConContinue() { SaveScreen(); return ::ConContinue(); } int GUI::ShowEntryScreen() { TEvent E; ConHideMouse(); RestoreScreen(); do { gui->ConGetEvent(evKeyDown, &E, -1, 1, 0); } while (E.What != evKeyDown); ConShowMouse(); if (frames) frames->Repaint(); return 1; } int GUI::RunProgram(int /*mode*/, char *Command) { int rc, W, H, W1, H1; ConQuerySize(&W, &H); ConHideMouse(); ConSuspend(); if (*Command == 0) // empty string = shell Command = getenv("SHELL"); rc = (system(Command) == 0); ConContinue(); ConShowMouse(); ConQuerySize(&W1, &H1); if (W != W1 || H != H1) frames->Resize(W1, H1); frames->Repaint(); return rc; } char ConGetDrawChar(unsigned int idx) { static const char *tab = NULL; static size_t tablen = 0; if (!tab) { if (getenv("ISOCONSOLE")) tab = GetGUICharacters("Linux", "++++-|+++++>.*-^v :[>"); else { /* it's hard to pick usable chars between way to many fonts */ tab = GetGUICharacters("Linux", "\xDA\xBF\xC0\xD9\xC4\xB3\xC2\xC3\xB4\xC1\xC5\x1A.\x0A\xC4\x18\x19\xB1\xB0\x1B\x1A"); //tab = GetGUICharacters("Linux", "\xDA\xBF\xC0\xD9\xC4\xB3\xC2\xC3\xB4\xC1\xC5\x1A\xFA\x04\xC4\x18\x19\xB1\xB0\x1B\x1A"); //tab = GetGUICharacters("Linux", "\x0D\x0C\x0E\x0B\x12\x19____+>\x1F\x01\x12\x01\x01 \x02\x01\x01"); } tablen = strlen(tab); } assert(idx < tablen); #ifdef USE_SCRNMAP return fromScreen[(unsigned char)tab[idx]]; #else return tab[idx]; #endif } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/gui.cpp���������������������������������������������������������������������������������������0000644�0001750�0001750�00000000341�11602724002�011722� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� #include "gui.h" int GFrame::isLastFrame() { return (this == Next && this == frames); } int GUI::Start(int &/*argc*/, char ** /*argv*/) { return 1; } void GUI::Stop() { } void GUI::StopLoop() { doLoop = 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_win32.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002347�11602724002�012414� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_win32.cpp * * Copyright (c) 1997, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ // Win32 (NT) specific routines #include "fte.h" #include "c_bind.h" #include "i_view.h" #include "c_history.h" #include "s_util.h" #include "i_modelview.h" // Silence warnings about redefinition, we don't need this here anyway. #undef SEARCH_ALL #include <windows.h> int EView::SysShowHelp(ExState &State, const char *word) { char file[MAXPATH] = ""; if (State.GetStrParam(this, file, sizeof(file) - 1) == 0) if (MView->Win->GetStr("Help file", sizeof(file) - 1, file, HIST_DEFAULT) == 0) return 0; char wordAsk[64] = ""; if (word == 0) { if (State.GetStrParam(this, wordAsk, sizeof(wordAsk) - 1) == 0) if (MView->Win->GetStr("Keyword", sizeof(wordAsk) - 1, wordAsk, HIST_DEFAULT) == 0) return 0; word = wordAsk; } //** Start WinHelp, if (!WinHelp(0, file, HELP_KEY, (DWORD)word)) { Msg(S_ERROR, "Failed to start WinHelp!"); return 0; } return 1; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/fte.def���������������������������������������������������������������������������������������0000644�0001750�0001750�00000000104�07045071263�011677� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NAME fte WINDOWCOMPAT DESCRIPTION 'FTE Text Editor' STACKSIZE 49152 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_direct.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000003357�11602720570�012417� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* s_direct.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef S_DIRECT_H #define S_DIRECT_H #include "sysdep.h" #include <sys/types.h> // error handling needs some work #define fiUNKNOWN 0 #define fiFILE 1 #define fiDIRECTORY 2 class FileInfo { StlString name; // minimum set of file information off_t size; time_t mtime; int type; int mode; public: FileInfo(const char *Name, int type, off_t Size, time_t MTime, int Mode=-1); ~FileInfo(); const char *Name() const { return name.c_str(); } off_t Size() const { return size; } int Type() const { return type; } int Mode() const { return mode; } time_t MTime() const { return mtime; } }; #define ffFAST 1 // optimization for UNIX (return name only, NO TYPE CHECK), ignored on OS/2 and NT #define ffFULLPATH 2 // return full path to files #define ffDIRECTORY 4 // return directories beside files (see ffFAST) #define ffHIDDEN 8 // return hidden files (dot-files for UNIX) #define ffLINK 16 // diagnose location of symbolic link, not link itself class FileFind { char *Directory; char *Pattern; int Flags; #if defined(USE_DIRENT) DIR *dir; #elif defined(OS2) && !defined(USE_DIRENT) unsigned long dir; // should be HDIR, but we don't #include huge os2.h globally #elif defined(NT) && !defined(USE_DIRENT) unsigned long dir; // should be HANDLE #endif public: FileFind(const char *aDirectory, const char *aPattern, int aFlags); ~FileFind(); int FindFirst(FileInfo **fi); int FindNext(FileInfo **fi); }; #endif // S_DIRECT_H ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_cvs.h���������������������������������������������������������������������������������������0000644�0001750�0001750�00000002740�11331412505�011722� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvs.h * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Class providing access to most of CVS commands. */ #ifndef O_CVS_H #define O_CVS_H #include "fte.h" #ifdef CONFIG_OBJ_CVS #include "o_cvsbase.h" class ECvs:public ECvsBase { public: char *LogFile; int Commiting; ECvs (int createFlags,EModel **ARoot,char *Dir,char *ACommand,char *AOnFiles); ECvs (int createFlags,EModel **ARoot); ~ECvs (); void RemoveLogFile (); // Return marked files in allocated space separated list char *MarkedAsList (); // Return CVS status char of file or 0 if unknown // (if char is lowercase, state was guessed from last command invoked upon file) char GetFileStatus(const char *file); virtual void ParseLine (char *line,int len); // Returns 0 if OK virtual int RunPipe(const char *Dir, const char *Command, const char *OnFiles); virtual void ClosePipe (); // Start commit process (opens message buffer), returns 0 if OK int RunCommit(const char *Dir, const char *Command, const char *OnFiles); // Finish commit process (called on message buffer close), returns 0 if OK int DoneCommit (int commit); virtual int CanQuit (); virtual int ConfQuit (GxView *V,int multiFile); virtual int GetContext () {return CONTEXT_CVS;} virtual EEventMap *GetEventMap (); }; extern ECvs *CvsView; #endif #endif // O_CVS_H ��������������������������������./src/port.c����������������������������������������������������������������������������������������0000644�0001750�0001750�00000036475�07045071624�011616� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * port.c: portable versions of often-used calls * ================================================= * (C)1996 by F.Jalvingh; Public domain. * (C)1997 by Markus F.X.J. Oberhumer; Public domain. * * $Header: /cvsroot/fte/fte/src/port.c,v 1.1.1.1 2000/01/30 17:23:32 captnmark Exp $ * * $Log: port.c,v $ * Revision 1.1.1.1 2000/01/30 17:23:32 captnmark * initial import * */ #include "port.h" #ifndef MAXPATH # define MAXPATH 256 #endif /****************************************************************************/ /* */ /* CODING: Windows NT portable calls. */ /* */ /****************************************************************************/ #if defined(NT) #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <port/port.h> #include <string.h> #include <assert.h> /* * plGetcurdir() returns the current directory for the drive specified. Drive * 0=current, 1=a, 2=B etc. */ int plGetcurdir(int drive, char *dir) { char tmp[256], t2[6], org[6]; int rv; //** For NT: get current disk; then change to the requested one, and rest. rv = -1; GetCurrentDirectory(sizeof(tmp), tmp); // Get current disk & dir; assert(tmp[1] == ':'); if(drive == 0) // Is current drive? { strcpy(dir, tmp+3); // Copy all after C:\ to dir, rv = 0; } else { strncpy(org, tmp, 2); // Copy <drive>: org[2] = 0; //** Move to the required drive, *t2 = drive + 'A'-1; // Form drive letter. strcpy(t2+1, ":"); if(! SetCurrentDirectory(t2)) return -1;// Try to move there; if(GetCurrentDirectory(sizeof(tmp), tmp)) { strcpy(dir, tmp+3); // Copy to result, rv = 0; } SetCurrentDirectory(org); // Move back to original.. } return rv; } int plGetdisk(void) { char buf[256]; int d; GetCurrentDirectory(sizeof(buf), buf); d = toupper(*buf) - 'A'; // 0=A, 1=B, etc. if(d < 0 || d > 25) return -1; return d; } int plSetdisk(int drive) { char buf[30]; if( drive < 0 || drive > 25) return -1; *buf = drive + 'A'; strcpy(buf+1, ":"); return SetCurrentDirectory(buf) ? 0 : -1; } /****************************************************************************/ /* */ /* CODING: OS/2 portable calls. */ /* */ /****************************************************************************/ #elif defined(OS2) #define __32BIT__ 1 #define INCL_BASE #define INCL_DOSMISC #define INCL_DOS #define INCL_SUB #define INCL_DOSERRORS #define INCL_DOSFILEMGR #define INCL_NOPMAPI #include <os2.h> /* * plGetcurdir() returns the current directory for the drive specified. */ int plGetcurdir(int drive, char *dir) { #ifdef __32BIT__ ULONG bytes; bytes = 0; DosQueryCurrentDir(drive, NULL, &bytes); if(bytes > MAXPATH) return -1; DosQueryCurrentDir(drive, dir, &bytes); return 0; #else USHORT bytes; bytes = 0; DosQCurDir(drive, NULL, &bytes); if(bytes > MAXPATH) return -1; DosQCurDir(drive, dir, &bytes); return 0; #endif } /* * plGetdisk() returns the current disk's number. A=0, B=1 etc. */ int plGetdisk(void) { #ifdef __32BIT__ ULONG drive, numdrives; DosQueryCurrentDisk(&drive, &numdrives); #else USHORT drive; ULONG numdrives; DosQCurDisk(&drive, &numdrives); #endif return (int)drive - 1; } /* * plSetdisk() makes another drive the current drive. Use A=0, B=1 etc. It * returns 0 on succes. */ int plSetdisk(int drive) { #if defined(__32BIT__) return (int)DosSetDefaultDisk((ULONG)drive + 1); #else return (int)DosSelectDisk((USHORT)drive + 1); /* Bcc getdisk: 'A' = 0; MSC DosSelectdisk: 'A' = 1 */ #endif } /****************************************************************************/ /* */ /* CODING: DOS Extender code - basic functionality & interrupt calls. */ /* */ /****************************************************************************/ #elif defined(DOSP32) /* * The following code is used to handle DOS-specific calls and memory from * within several DOS extender(s), or from plain DOS. To compile for other * DOS extenders simply recode the base calls; the extended calls are defined * in terms of the base calls. * * Currently the following implementations exist: * - Dos4GW i.c.m. the Watcom C compiler * - djgpp v2 */ /*--------------------------------------------------------------------------*/ /* CODING: 32-bits protected mode DOS with DOS4GW and Watcom C++. */ /*--------------------------------------------------------------------------*/ #if defined(__DOS4G__) // Defined when compiled with Watcom for Dos4GW #include <i86.h> #define HIWORD(x) ( (UWORD) ((x) >> 16)) #define LOWORD(x) ( (UWORD) (x)) /* * dosxIntr() does a 16-bit interrupt with translation for the extender. It * is used to call DOS and BIOS interrupts from within C. */ void dosxIntr(int inr, union dosxReg* r) { union REGPACK rp; //** Convert the parameters to a REGPACK structure, rp.x.eax = r->x.eax; rp.x.ebx = r->x.ebx; rp.x.ecx = r->x.ecx; rp.x.edx = r->x.edx; rp.x.esi = r->x.esi; rp.x.edi = r->x.edi; rp.x.ds = r->x.ds; rp.x.es = r->x.es; rp.x.fs = r->x.fs; rp.x.gs = r->x.gs; rp.x.flags = r->x.flags; intr(inr, &rp); //** And translate back.. r->x.eax = rp.x.eax; r->x.ebx = rp.x.ebx; r->x.ecx = rp.x.ecx; r->x.edx = rp.x.edx; r->x.esi = rp.x.esi; r->x.edi = rp.x.edi; r->x.ds = rp.x.ds; r->x.es = rp.x.es; r->x.fs = rp.x.fs; r->x.gs = rp.x.gs; r->x.flags = rp.x.flags; } /* * The Dos4GW extender maps the DOS memory arena (the 1st 1Mb of physical * memory) to the 1st MB of extender memory. So, to access 0040:0087 in the * BIOS data segment we use the linear address 0x487. * * The memory routines translate the seg:off address passed to a linear * address. */ /* * SegToPhys() converts an address in seg:off format to a physical address. */ static void* SegToPhys(ULONG ra) { return (void*) ( ((ULONG) HIWORD(ra) << 4) + (ULONG)LOWORD(ra)); } /* * dosxMemRead() reads the specified #bytes from the DOS real memory to the * buffer specified. The address <ra> is specified as a seg:off address (even * in extended mode); it is translated to the appropriate physical address. */ void dosxMemRead(void* dest, ULONG ra, unsigned nbytes) { memcpy(dest, SegToPhys(ra), nbytes); } /* * dosxMemWrite() writes the specified #bytes to DOS real memory. <ra> is in * seg:off format. */ void dosxMemWrite(ULONG ra, void* src, unsigned nbytes) { memcpy(SegToPhys(ra), src, nbytes); } /* * dosxPMemRead() reads the specified #bytes from physical memory to the * buffer specified. The physical address is the linear address, not a * segmented one! */ void dosxPMemRead(void* dest, ULONG pa, unsigned nbytes) { memcpy(dest, (void*) pa, nbytes); } /* * dosxPMemWrite() writes the specified #bytes to physical memory. */ void dosxPMemWrite(ULONG pa, void* src, unsigned nbytes) { memcpy((void*) pa, src, nbytes); } #elif defined(__DJGPP__) #include <assert.h> #include <dos.h> #include <dpmi.h> #include <go32.h> #include <string.h> #include <sys/movedata.h> /* * dosxIntr() does a 16-bit interrupt with translation for the extender. It * is used to call DOS and BIOS interrupts from within C. */ void dosxIntr(int inr, union dosxReg* r) { __dpmi_regs rp; //** Convert the parameters to a REGPACK structure, rp.d.eax = r->x.eax; rp.d.ebx = r->x.ebx; rp.d.ecx = r->x.ecx; rp.d.edx = r->x.edx; rp.d.esi = r->x.esi; rp.d.edi = r->x.edi; rp.x.ds = r->x.ds; rp.x.es = r->x.es; rp.x.fs = r->x.fs; rp.x.gs = r->x.gs; rp.x.flags = r->x.flags; __dpmi_int(inr, &rp); //** And translate back.. r->x.eax = rp.d.eax; r->x.ebx = rp.d.ebx; r->x.ecx = rp.d.ecx; r->x.edx = rp.d.edx; r->x.esi = rp.d.esi; r->x.edi = rp.d.edi; r->x.ds = rp.x.ds; r->x.es = rp.x.es; r->x.fs = rp.x.fs; r->x.gs = rp.x.gs; r->x.flags = rp.x.flags; } /* * dosxMemRead() reads the specified #bytes from the DOS real memory to the * buffer specified. The address <ra> is specified as a seg:off address (even * in extended mode); it is translated to the appropriate physical address. */ void dosxMemRead(void* dest, ULONG ra, unsigned nbytes) { unsigned x = ((ra & 0xffff0000) >> 12) + (ra & 0xffff); movedata(_dos_ds, x, _my_ds(), (unsigned) dest, nbytes); } /* * dosxMemWrite() writes the specified #bytes to DOS real memory. <ra> is in * seg:off format. */ void dosxMemWrite(ULONG ra, void* src, unsigned nbytes) { unsigned x = ((ra & 0xffff0000) >> 12) + (ra & 0xffff); movedata(_my_ds(), (unsigned) src, _dos_ds, x, nbytes); } /* * dosxPMemRead() reads the specified #bytes from physical memory to the * buffer specified. The physical address is the linear address, not a * segmented one! */ void dosxPMemRead(void* dest, ULONG pa, unsigned nbytes) { assert(0); /* not used */ } /* * dosxPMemWrite() writes the specified #bytes to physical memory. */ void dosxPMemWrite(ULONG pa, void* src, unsigned nbytes) { assert(0); /* not used */ } #else // Not Dos4GW or djgpp # error "Extender type not defined/illegal extender type." #endif /* * dosxDisable() disables interrupts. */ void dosxDisable(void) { #if defined(__WATCOMC__) || defined(__MSC__) _disable(); #elif defined(__DJGPP__) __asm__ __volatile__("cli \n"); #else disable(); #endif } /* * dosxEnable() enables interrupts. */ void dosxEnable(void) { #if defined(__WATCOMC__) || defined(__MSC__) _enable(); #elif defined(__DJGPP__) __asm__ __volatile__("sti \n"); #else enable(); #endif } /****************************************************************************/ /* */ /* CODING: DOS-based portability calls. */ /* */ /****************************************************************************/ #ifdef __WATCOMC__ #include <i86.h> #endif #include <dos.h> /* * plGetcurdir() returns the current directory for the drive specified. Drive * 0=a, 1=B etc. */ int plGetcurdir(int drive, char *dir) { union dosxReg r; #if defined(__32BIT__) && !defined(__DJGPP__) void far *ptr; #endif memset(&r, 0, sizeof(r)); r.w.ax = 0x4700; // Get current directory r.h.dl = drive; // Get drive (0=current, 1=a etc)!! #if defined(__DJGPP__) r.w.ds = _my_ds(); r.x.esi = (unsigned) dir; // Pass the address of the buffer. #elif defined(__32BIT__) ptr = dir; // Get full 16:32 address of dir, r.w.ds = FP_SEG(ptr); r.x.esi = FP_OFF(dir); // Pass the address of the buffer. #else r.w.ds = FP_SEG(dir); r.w.si = FP_OFF(dir); #endif dosxIntr(0x21, &r); return r.x.flags & 0x80 ? -1 : 0; // Carry flag is set? } #if defined(__WATCOMC__) || defined(__DJGPP__) int plSetdisk(int drive) { unsigned ndr; _dos_setdrive(drive +1, &ndr); return 0; } int plGetdisk(void) { unsigned drv; _dos_getdrive(&drv); return drv - 1; } #elif defined(__BORLANDC__) int plSetdisk(int drive) { return setdisk(drive); } int plGetdisk(void) { return getdisk(); } #else # error "Undefined compiler for DOS/Extended DOS" #endif #else # error "Platform not supported." #endif /****************************************************************************/ /* */ /* CODING: an implementation of fnmatch(), when needed... */ /* */ /****************************************************************************/ #if (defined(NT) || defined(DOSP32)) && !defined(__DJGPP__) /* * Wildcard spec's: * ================ * * * matches 0-n characters, so * only removes all. * ? matches any character on that position. * #c matches 0-n occurences of the character c. Note: #? is the same * as *. * a+b Matches either a or b. a and b may be complex expressions. * () Keep expressions together, * * Examples: * --------- * *.(obj+lib+exe) Matches *.exe, *.lib and *.exe. * t#a.* Matches t.*, ta.* taa.* etc * * Small grammar: * ============== * pattern: */ #define ENDCH(x) ((x) == '+' || (x) == ')' || (x) == 0) static int wcMatch(char **pval, char **pw); /* * Next() moves to the next <ch> in the pattern, taking care of ( and ). * It returns a nonzero value in case of error (bad match). */ static int Next(char **pptr, char ch) { int braces; braces = 0; for(;;) { switch(**pptr) { case 0: if(braces == 0) return 0; /* 0 always allowed if not in () */ else return ')'; /* Missing close brace! */ case '(': braces++; break; case ')': if(braces == 0) { if(ch == ')' || ch == '+') return 0; else return '('; /* Missing open brace */ } braces--; break; default: if(**pptr == ch && braces == 0) return 0; } *pptr += 1; } } /* * wcOrs() traverses <pattern> + <pattern> + <pattern>.. */ static int wcOrs(char **pval, char **pw) { char *vsave; int res; for(;;) /* For each orred part, */ { vsave = *pval; /* Save current string, */ res = wcMatch(pval, pw); /* Match part, */ if(res != 0) return res; /* Exit if OK or error. */ *pval = vsave; /* Back to start of string to match */ /**** Match not found. Find next ORred item, ****/ res = Next(pw, '+'); if(res > 0) return res; if(**pw == 0 || **pw == ')') return 0; /* Exit if at eo$ */ if(**pw != '+') return '+'; /* Expected | ?? */ *pw += 1; } } /* * wcMatch() compares the string to match in *pval with the wildcard * part in *pw. It returns True as soon as a match is found, and False * if a match could not be found. */ static int wcMatch(char **pval, char **pw) { char *vsave, *wsave; int res; for(;;) { vsave = *pval; /* Saved string, */ switch(*(*pw)++) { case '+': case ')': case 0: /**** End of wildcarded string. If string is at end too ****/ /**** match is found... ****/ *pw -= 1; /* Back to terminator, */ return **pval == 0; case '?': /**** Match-anything.. ****/ if(**pval == 0) return FALSE; /* Exhausted! No match */ *pval += 1; /* Match one character, */ break; /* And loop, */ case '(': res = wcOrs(pval, pw); /* OR sequence valid? */ if(res == 1) /* 1 -> Matched! */ { /**** OR sequence valid! Move to closing ) ****/ res = Next(pw, ')'); /* Move past OR-sequence */ if(res) return res; /* If error return, */ if(**pw != ')') return ')'; /* Missing ')' !! */ *pw += 1; /* Past ), */ } else return res; /* Not found or Error!! */ break; case '*': /**** 0-n (kleene closure) any-character matches.. ****/ while(**pval != 0) /* While not at end of user $ */ { /**** Compare current part of user string with what's ****/ /**** left of the wildcards... ****/ wsave = *pw; /* Get current wildcard ptr, after * */ vsave = *pval; /* And to current part of $ */ res = wcMatch(pval, pw); /* Check if $ matches, */ if(res != 0) return res; /* Exit if matches or error, */ *pw = wsave; /* Back wildcards, */ *pval = vsave+1; /* Back user $ one pos further, */ } return ENDCH(**pw); /* No match. */ default: if(toupper(**pval) != toupper(*(*pw - 1))) { *pw -= 1; return 0; } *pval += 1; break; } } } /* * strCmpWild() returns -1 on wildcard error, 0 on match and 1 on no match. */ int strCmpWild(char *val, char *wild) { return wcOrs(&val, &wild); } /* * fnmatch() does a wildcarded match. */ int fnmatch(char* pat, char* in, int vv) { return strCmpWild(in, pat) == 1 ? 0 : 1; } #endif // fnmatch() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/clip_pm.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002425�11602724002�012566� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* clip_pm.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #include "clip.h" #define INCL_WIN #include <os2.h> #include <stdlib.h> extern HAB hab; int GetClipText(ClipData *cd) { int rc = 0; char *text; cd->fLen = 0; cd->fChar = 0; if (!WinOpenClipbrd(hab)) return 0; if ((text = (char *) WinQueryClipbrdData(hab, CF_TEXT)) != 0) { cd->fLen = strlen(text); cd->fChar = strdup(text); rc = 1; } WinCloseClipbrd(hab); return rc; } int PutClipText(ClipData *cd) { int rc = 0; ULONG len; void *text; if (!WinOpenClipbrd(hab)) return 0; WinEmptyClipbrd(hab); len = cd->fLen; if (len) { DosAllocSharedMem((void **)&text, 0, len + 1, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE); strncpy((char *)text, cd->fChar, len + 1); if (!WinSetClipbrdData(hab, (ULONG) text, CF_TEXT, CFI_POINTER)) DosBeep(100, 1500); else rc = 1; } WinCloseClipbrd(hab); return rc; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_cmds.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000107675�11333110353�012411� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_cmds.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "egui.h" #include "i_modelview.h" #include "o_buflist.h" #include "s_util.h" int EBuffer::MoveLeft() { if (CP.Col == 0 || !VCount) return 0; SetPos(CP.Col - 1, CP.Row, tmLeft); return 1; } int EBuffer::MoveRight() { if (!VCount) return 0; SetPos(CP.Col + 1, CP.Row, tmRight); return 1; } int EBuffer::MoveUp() { if (CP.Row == 0) return 0; SetPos(CP.Col, CP.Row - 1, tmLeft); return 1; } int EBuffer::MoveDown() { if (CP.Row + 1 >= VCount) return 0; SetPos(CP.Col, CP.Row + 1, tmLeft); return 1; } int EBuffer::MovePrev() { if (MoveLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveNext() { if (CP.Col < LineLen()) if (MoveRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordLeftX(int start) { if (CP.Col > 0) { int wS = start, wE = 1 - start; PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == wE)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == wS)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordRightX(int start) { PELine L = VLine(CP.Row); int C, P; int wS = start, wE = 1 - start; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == wS)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == wE)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordLeft() { return MoveWordLeftX(1); } int EBuffer::MoveWordRight() { return MoveWordRightX(1); } int EBuffer::MoveWordPrev() { if (MoveWordLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordNext() { if (MoveWordRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordEndLeft() { return MoveWordLeftX(0); } int EBuffer::MoveWordEndRight() { return MoveWordRightX(0); } int EBuffer::MoveWordEndPrev() { if (MoveWordEndLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordEndNext() { if (MoveWordEndRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordOrCapLeft() { if (CP.Col > 0) { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordOrCapRight() { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 0)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordOrCapPrev() { if (MoveWordOrCapLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordOrCapNext() { if (MoveWordOrCapRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveWordOrCapEndLeft() { if (CP.Col > 0) { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P > L->Count) P = L->Count; if (P > 0) { while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 0)) P--; C = ScreenPos(L, P); return SetPos(C, CP.Row); } else return 0; } else return 0; } int EBuffer::MoveWordOrCapEndRight() { PELine L = VLine(CP.Row); int C, P; C = CP.Col; P = CharOffset(L, C); if (P >= L->Count) return 0; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 0)) P++; while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; C = ScreenPos(L, P); return SetPos(C, CP.Row); } int EBuffer::MoveWordOrCapEndPrev() { if (MoveWordOrCapEndLeft()) return 1; if (MoveUp() && MoveLineEnd()) return 1; return 0; } int EBuffer::MoveWordOrCapEndNext() { if (MoveWordOrCapEndRight()) return 1; if (MoveDown() && MoveLineStart()) return 1; return 0; } int EBuffer::MoveLineStart() { SetPos(0, CP.Row); return 1; } int EBuffer::MoveLineEnd() { SetPos(LineLen(VToR(CP.Row)), CP.Row); return 1; } int EBuffer::MovePageUp() { return ScrollDown(GetVPort()->Rows); } int EBuffer::MovePageDown() { return ScrollUp(GetVPort()->Rows); } int EBuffer::MovePageLeft() { return ScrollRight(GetVPort()->Cols); } int EBuffer::MovePageRight() { return ScrollRight(GetVPort()->Cols); } int EBuffer::MovePageStart() { SetPos(CP.Col, GetVPort()->TP.Row, tmLeft); return 1; } int EBuffer::MovePageEnd() { SetNearPos(CP.Col, GetVPort()->TP.Row + GetVPort()->Rows - 1, tmLeft); return 1; } int EBuffer::MoveFileStart() { SetPos(0, 0); return 1; } int EBuffer::MoveFileEnd() { SetPos(LineLen(VToR(VCount - 1)), VCount - 1); return 1; } int EBuffer::MoveBlockStart() { if (BB.Col == -1 && BB.Row == -1) return 0; assert(BB.Col >= 0 && BB.Row >= 0 && BB.Row < RCount); if (SetPosR(BB.Col, BB.Row)) return 1; return 0; } int EBuffer::MoveBlockEnd() { if (BE.Col == -1 && BE.Row == -1) return 0; assert(BE.Col >= 0 && BE.Row >= 0 && BE.Row < RCount); if (SetPosR(BE.Col, BE.Row)) return 1; return 0; } int EBuffer::MoveFirstNonWhite() { int C = 0, P = 0; PELine L = VLine(CP.Row); while (C < L->Count) { if (L->Chars[C] == ' ') P++; else if (L->Chars[C] == 9) P = NextTab(P, BFI(this, BFI_TabSize)); else break; C++; } if (SetPos(P, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveLastNonWhite() { int C = LineLen(), P; PELine L = VLine(CP.Row); while (C > 0) { if (L->Chars[C - 1] == ' ' || L->Chars[C - 1] == 9) C--; else break; } P = ScreenPos(VLine(CP.Row), C); if (SetPos(P, CP.Row) == 0) return 0; return 1; } int EBuffer::MovePrevEqualIndent() { int L = VToR(CP.Row); int I = LineIndented(L); while (--L >= 0) if ((RLine(L)->Count > 0) && (LineIndented(L) == I)) return SetPosR(I, L); return 0; } int EBuffer::MoveNextEqualIndent() { int L = VToR(CP.Row); int I = LineIndented(L); while (L++ < RCount - 1) if ((RLine(L)->Count > 0) && (LineIndented(L) == I)) return SetPosR(I, L); return 0; } int EBuffer::MoveNextTab() { int P = CP.Col; P = NextTab(P, BFI(this, BFI_TabSize)); return SetPos(P, CP.Row); } int EBuffer::MovePrevTab() { int P = CP.Col; if (P > 0) { P = ((P - 1) / BFI(this, BFI_TabSize)) * BFI(this, BFI_TabSize); return SetPos(P, CP.Row); } else return 0; } int EBuffer::MoveLineTop() { if (View) if (GetVPort()->SetTop(GetVPort()->TP.Col, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveLineCenter() { if (View) { int Row = CP.Row - GetVPort()->Rows / 2; if (Row < 0) Row = 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, Row) == 0) return 0; } return 1; } int EBuffer::MoveLineBottom() { if (View) { int Row = CP.Row - GetVPort()->Rows + 1; if (Row < 0) Row = 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, Row) == 0) return 0; } return 1; } int EBuffer::MovePrevPos() { if (PrevPos.Col == -1 || PrevPos.Row == -1) return 0; if (SetPosR(PrevPos.Col, PrevPos.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPosCol() { if (SavedPos.Col == -1) return 0; if (SetPos(SavedPos.Col, CP.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPosRow() { if (SavedPos.Row == -1) return 0; if (SetPosR(CP.Col, SavedPos.Row) == 0) return 0; return 1; } int EBuffer::MoveSavedPos() { if (SavedPos.Col == -1 || SavedPos.Row == -1) return 0; if (SetPosR(SavedPos.Col, SavedPos.Row) == 0) return 0; return 1; } int EBuffer::SavePos() { SavedPos = CP; SavedPos.Row = VToR(CP.Row); return 1; } int EBuffer::MoveTabStart() { PELine X = VLine(CP.Row); int C = CharOffset(X, CP.Col); if (C < X->Count) if (X->Chars[C] == 9) return SetPos(ScreenPos(X, C), CP.Row); return 1; } int EBuffer::MoveTabEnd() { PELine X = VLine(CP.Row); int C = CharOffset(X, CP.Col); if (C < X->Count) if (X->Chars[C] == 9) if (ScreenPos(X, C) < CP.Col) return SetPos(ScreenPos(X, C + 1), CP.Row); return 1; } int EBuffer::ScrollLeft(int Cols) { int C = GetVPort()->TP.Col; if (SetNearPos(CP.Col + Cols, CP.Row, tmLeft) == 0) return 0; if (GetVPort()->SetTop(C + Cols, GetVPort()->TP.Row) == 0) return 0; return 1; } int EBuffer::ScrollRight(int Cols) { int C = GetVPort()->TP.Col; if (SetNearPos(CP.Col - Cols, CP.Row, tmLeft) == 0) return 0; if (GetVPort()->SetTop(C - Cols, GetVPort()->TP.Row) == 0) return 0; return 1; } int EBuffer::ScrollDown(int Lines) { int L = GetVPort()->TP.Row; if (SetNearPos(CP.Col, CP.Row - Lines, tmLeft) == 0) return 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, L - Lines) == 0) return 0; return 1; } int EBuffer::ScrollUp(int Lines) { int L = GetVPort()->TP.Row; if (SetNearPos(CP.Col, CP.Row + Lines, tmLeft) == 0) return 0; if (GetVPort()->SetTop(GetVPort()->TP.Col, L + Lines) == 0) return 0; return 1; } int EBuffer::MoveBeginOrNonWhite() { if (CP.Col == 0) return MoveFirstNonWhite(); return MoveLineStart(); } int EBuffer::MoveBeginLinePageFile() { int L = GetVPort()->TP.Row; if (CP.Col == 0 && CP.Row == L) return MoveFileStart(); else if (CP.Col == 0) return MovePageStart(); return MoveLineStart(); } int EBuffer::MoveEndLinePageFile() { int L = GetVPort()->TP.Row + GetVPort()->Rows - 1; int Len = LineLen(); if (CP.Col == Len && CP.Row == L) return MoveFileEnd(); else if (CP.Col == Len) if (MovePageEnd() == 0) return 0; return MoveLineEnd(); } int EBuffer::KillLine() { int Y = VToR(CP.Row); if (Y == RCount - 1) { if (DelText(Y, 0, LineLen())) return 1; } else if (DelLine(Y)) return 1; return 0; } int EBuffer::KillChar() { int Y = VToR(CP.Row); if (CP.Col < LineLen()) { if (DelText(Y, CP.Col, 1)) return 1; } else if (LineJoin()) return 1; return 0; } int EBuffer::KillCharPrev() { if (CP.Col == 0) { if (CP.Row > 0) if (ExposeRow(VToR(CP.Row) - 1) == 0) return 0; if (!MoveUp()) return 0; if (!MoveLineEnd()) return 0; if (LineJoin()) return 1; } else { if (!MovePrev()) return 0; if (DelText(CP.Row, CP.Col, 1)) return 1; } return 0; } int EBuffer::KillWord() { int Y = VToR(CP.Row); if (CP.Col >= LineLen()) { if (KillChar() == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P]); while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++; C = ScreenPos(L, P); if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0; } return 1; } int EBuffer::KillWordPrev() { int Y = VToR(CP.Row); if (CP.Col == 0) { if (KillCharPrev() == 0) return 0; } else if (CP.Col > LineLen()) { if (SetPos(LineLen(), CP.Row) == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P - 1]); while ((P > 0) && (ChClassK(L->Chars[P - 1]) == Class)) P--; C = ScreenPos(L, P); if (DelText(Y, C, CP.Col - C) == 0) return 0; if (SetPos(C, CP.Row) == 0) return 0; } return 1; } int EBuffer::KillWordOrCap() { int Y = VToR(CP.Row); if (CP.Col >= LineLen()) { if (KillChar() == 0) return 0; } else { PELine L = VLine(CP.Row); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P]); if (Class == 1) { if (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1) while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++; while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++; } else while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++; C = ScreenPos(L, P); if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0; } return 1; } int EBuffer::KillWordOrCapPrev() { int Y = VToR(CP.Row); if (CP.Col == 0) { if (KillCharPrev() == 0) return 0; } else if (CP.Col > LineLen()) { if (SetPos(LineLen(), CP.Row) == 0) return 0; } else { PELine L = RLine(Y); int P = CharOffset(L, CP.Col); int C; int Class = ChClassK(L->Chars[P - 1]); if (Class == 1) { if (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0) while ((P > 0) && (WGETBIT(Flags.WordChars, L->Chars[P - 1]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 0)) P--; while ((P > 0) && (WGETBIT(Flags.CapitalChars, L->Chars[P - 1]) == 1)) P--; } else while ((P > 0) && (ChClassK(L->Chars[P - 1]) == Class)) P--; C = ScreenPos(L, P); if (DelText(Y, C, CP.Col - C) == 0) return 0; if (SetPos(C, CP.Row) == 0) return 0; } return 1; } int EBuffer::KillToLineStart() { int Y = VToR(CP.Row); if (DelText(Y, 0, CP.Col) == 0) return 0; if (MoveLineStart() == 0) return 0; return 1; } int EBuffer::KillToLineEnd() { int Y = VToR(CP.Row); if (DelText(Y, CP.Col, LineLen() - CP.Col)) return 1; return 0; } int EBuffer::KillBlock() { return BlockKill(); } int EBuffer::KillBlockOrChar() { if (CheckBlock() == 0) return KillChar(); else return BlockKill(); } int EBuffer::KillBlockOrCharPrev() { if (CheckBlock() == 0) return KillCharPrev(); else return BlockKill(); } int EBuffer::BackSpace() { int Y = VToR(CP.Row); if (CheckBlock() == 1 && BFI(this, BFI_BackSpKillBlock)) { if (BlockKill() == 0) return 0; } else if (BFI(this, BFI_WordWrap) == 2 && CP.Row > 0 && !IsLineBlank(Y - 1) && CP.Col <= BFI(this, BFI_LeftMargin) && CP.Col <= LineIndented(Y)) { if (SetPos(LineLen(Y - 1), CP.Row - 1) == 0) return 0; } else if (CP.Col == 0) { if (CP.Row > 0) if (ExposeRow(VToR(CP.Row) - 1) == 0) return 0; if (MoveUp() == 0) return 0; if (MoveLineEnd() == 0) return 0; if (LineJoin() == 0) return 0; } else { if (BFI(this, BFI_BackSpUnindents) && (LineIndented(Y) >= CP.Col)) { int C = CP.Col, C1 = 0; int L = VToR(CP.Row); C1 = C; while (L > 0 && (IsLineBlank(L - 1) || (C1 = LineIndented(L - 1)) >= C)) L--; if (L == 0) C1 = 0; if (C1 == C) C1--; if (C1 < 0) C1 = 0; if (C1 > C) C1 = C; if (SetPos(C1, CP.Row) == 0) return 0; if (C > LineIndented(Y)) return 0; if (DelText(Y, C1, C - C1) == 0) return 0; } else if (BFI(this, BFI_BackSpKillTab)) { int P; int C = CP.Col, C1; P = CharOffset(RLine(Y), C - 1); C1 = ScreenPos(RLine(Y), P); if (SetPos(C1, CP.Row) == 0) return 0; if (DelText(Y, C1, C - C1) == 0) return 0; } else { if (MovePrev() == 0) return 0; if (DelText(Y, CP.Col, 1) == 0) return 0; } } #ifdef CONFIG_WORDWRAP if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; } #endif if (BFI(this, BFI_Trim)) { Y = VToR(CP.Row); if (TrimLine(Y) == 0) return 0; } return 1; } int EBuffer::Delete() { int Y = VToR(CP.Row); if (CheckBlock() == 1 && BFI(this, BFI_DeleteKillBlock)) { if (BlockKill() == 0) return 0; } else if (CP.Col < LineLen()) { if (BFI(this, BFI_DeleteKillTab)) { int P; int C = CP.Col, C1; P = CharOffset(RLine(Y), C); C1 = ScreenPos(RLine(Y), P + 1); if (DelText(Y, C, C1 - C) == 0) return 0; } else if (DelText(Y, CP.Col, 1) == 0) return 0; } else if (LineJoin() == 0) return 0; #ifdef CONFIG_WORDWRAP if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; if (CP.Col >= LineLen(Y)) if (CP.Row + 1 < VCount) { if (SetPos(BFI(this, BFI_LeftMargin), CP.Row + 1) == 0) return 0; } } #endif if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineInsert() { if (InsLine(VToR(CP.Row), 0)) return 1; return 0; } int EBuffer::LineAdd() { if (InsLine(VToR(CP.Row), 1) && MoveDown()) return 1; return 0; } int EBuffer::LineSplit() { if (SplitLine(VToR(CP.Row), CP.Col) == 0) return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineJoin() { if (JoinLine(VToR(CP.Row), CP.Col)) return 1; return 0; } int EBuffer::LineNew() { if (SplitLine(VToR(CP.Row), CP.Col) == 0) return 0; if (!MoveDown()) return 0; if (CP.Col > 0) { if (!MoveLineStart()) return 0; //int Indent = LineIndented(VToR(CP.Row)); if (!LineIndent()) return 0; //if (Indent > 0) // if (InsText(Row, C, Indent, 0) == 0) // return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row - 1)) == 0) return 0; } return 1; } int EBuffer::LineIndent() { int rc = 1; if (BFI(this, BFI_AutoIndent)) { int L = VToR(CP.Row); switch (BFI(this, BFI_IndentMode)) { #ifdef CONFIG_INDENT_C case INDENT_C: rc = Indent_C(this, L, 1); break; #endif #ifdef CONFIG_INDENT_REXX case INDENT_REXX: rc = Indent_REXX(this, L, 1); break; #endif #ifdef CONFIG_INDENT_SIMPLE case INDENT_SIMPLE: rc = Indent_SIMPLE(this, L, 1); break; #endif default: rc = Indent_Plain(this, L, 1); break; } } if (rc == 0) return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row)) == 0) return 0; return 1; } int EBuffer::LineLen() { return LineLen(VToR(CP.Row)); } int EBuffer::LineCount() { assert(1 == 0); return RCount; } int EBuffer::CLine() { assert(1 == 0); return VToR(CP.Row); } int EBuffer::CColumn() { return CP.Col; } int EBuffer::InsertChar(char aCh) { return InsertString(&aCh, 1); } int EBuffer::TypeChar(char aCh) { // does abbrev expansion if appropriate if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; #ifdef CONFIG_ABBREV //fprintf(stderr, "TypeChar\n"); if (ChClass(aCh) == 0 && BFI(this, BFI_Abbreviations) == 1) { PELine L = VLine(CP.Row); int C, P, P1, C1, Len, R; char Str[256]; EAbbrev *ab; R = VToR(CP.Row); C = CP.Col; P = CharOffset(L, C); if (P >= 0 && P <= L->Count) { //fprintf(stderr, "TypeChar 1\n"); P1 = P; C1 = ScreenPos(L, P); while ((P > 0) && ((ChClass(L->Chars[P - 1]) == 1) || (L->Chars[P - 1] == '_'))) P--; Len = P1 - P; C = ScreenPos(L, P); assert(C1 - C == Len); if (Len > 0 && Len < int (sizeof(Str))) { //fprintf(stderr, "TypeChar 2\n"); memcpy(Str, L->Chars + P, Len); Str[Len] = 0; ab = Mode->FindAbbrev(Str); if (ab) { //fprintf(stderr, "TypeChar 3\n"); if (ab->Replace != 0) { //fprintf(stderr, "TypeChar 4\n"); if (DelText(R, C, C1 - C) == 0) return 0; if (ab->Replace) { //fprintf(stderr, "TypeChar 5 %s <- %s\n", ab->Replace, ab->Match); Len = strlen(ab->Replace); if (InsText(R, C, Len, ab->Replace) == 0) return 0; if (SetPos(C + Len, CP.Row) == 0) return 0; } else { if (SetPos(C, CP.Row) == 0) return 0; } } else { if (((EGUI *)gui)->ExecMacro(View->MView->Win, ab->Cmd) == 0) return 0; } } } } } #endif return InsertString(&aCh, 1); } int EBuffer::InsertString(const char *aStr, size_t aCount) { int P; int C, L; int Y = VToR(CP.Row); if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; if (BFI(this, BFI_Insert) == 0) if (CP.Col < LineLen()) if (KillChar() == 0) return 0; if (InsText(Y, CP.Col, aCount, aStr) == 0) return 0; C = CP.Col; L = VToR(CP.Row); P = CharOffset(RLine(L), C); P += aCount; C = ScreenPos(RLine(L), P); if (SetPos(C, CP.Row) == 0) return 0; if (BFI(this, BFI_Trim)) if (TrimLine(L) == 0) return 0; #ifdef CONFIG_WORDWRAP if (BFI(this, BFI_WordWrap) == 2) { if (DoWrap(0) == 0) return 0; } else if (BFI(this, BFI_WordWrap) == 1) { int P, C = CP.Col; PELine LP; int L; if (C > BFI(this, BFI_RightMargin)) { L = CP.Row; C = BFI(this, BFI_RightMargin); P = CharOffset(LP = RLine(L), C); while ((C > BFI(this, BFI_LeftMargin)) && ((LP->Chars[P] != ' ') && (LP->Chars[P] != 9))) C = ScreenPos(LP, --P); if (P <= BFI(this, BFI_LeftMargin)) { C = BFI(this, BFI_RightMargin); } else C = ScreenPos(LP, P); if (SplitLine(L, C) == 0) return 0; IndentLine(L + 1, BFI(this, BFI_LeftMargin)); if (SetPos(CP.Col - C - 1 + BFI(this, BFI_LeftMargin), CP.Row + 1) == 0) return 0; } } #endif return 1; } int EBuffer::InsertSpacesToTab(int TSize) { int P = CP.Col, P1; if (BFI(this, BFI_InsertKillBlock) == 1) if (CheckBlock() == 1) if (BlockKill() == 0) return 0; if (TSize <= 0) TSize = BFI(this, BFI_TabSize); P1 = NextTab(P, TSize); if (BFI(this, BFI_Insert) == 0) { if (CP.Col < LineLen()) if (DelText(VToR(CP.Row), CP.Col, P1 - P) == 0) return 0; } if (InsText(VToR(CP.Row), CP.Col, P1 - P, 0) == 0) return 0; if (SetPos(P1, CP.Row) == 0) return 0; return 1; } int EBuffer::InsertTab() { return (BFI(this, BFI_SpaceTabs)) ? InsertSpacesToTab(BFI(this, BFI_TabSize)) : InsertChar(9); } int EBuffer::InsertSpace() { return TypeChar(32); } int EBuffer::LineIndented(int Row, const char *indentchars) { ELine *l; if (Row < 0) return 0; if (Row >= RCount) return 0; l = RLine(Row); return ScreenPos(l, LineIndentedCharCount(l, indentchars)); } int EBuffer::LineIndentedCharCount(ELine *l, const char *indentchars) { char *PC; int CC, i; if (! l) return 0; if (! indentchars) indentchars = " \t"; CC = l->Count; PC = l->Chars; for(i = 0; i < CC; i++) { if (! strchr(indentchars, PC[i])) break; } return i; } int EBuffer::IndentLine(int Row, int Indent) { int I, C; int Ind = Indent; if (Row < 0) return 0; if (Row >= RCount) return 0; if (Indent < 0) Indent = 0; I = LineIndented(Row); if (Indent != I) { if (I > 0) if (DelText(Row, 0, I) == 0) return 0; if (Indent > 0) { C = 0; if (BFI(this, BFI_IndentWithTabs)) { char ch = 9; while (BFI(this, BFI_TabSize) <= Indent) { if (InsText(Row, C, 1, &ch) == 0) return 0; Indent -= BFI(this, BFI_TabSize); C += BFI(this, BFI_TabSize); } } if (Indent > 0) if (InsText(Row, C, Indent, 0) == 0) return 0; } } return Ind - I; } #ifdef CONFIG_UNDOREDO int EBuffer::CanUndo() { if (BFI(this, BFI_Undo) == 0) return 0; if (US.Num == 0 || US.UndoPtr == 0) return 0; return 1; } int EBuffer::CanRedo() { if (BFI(this, BFI_Undo) == 0) return 0; if (US.Num == 0 || US.UndoPtr == US.Num) return 0; return 1; } #endif int EBuffer::IsLineBlank(int Row) { PELine X = RLine(Row); int P; for (P = 0; P < X->Count; P++) if (X->Chars[P] != ' ' && X->Chars[P] != 9) return 0; return 1; } #ifdef CONFIG_WORDWRAP #define WFAIL(x) return 0 /*do { puts(#x "\x7"); return -1; } while (0) */ int EBuffer::DoWrap(int WrapAll) { int L, Len, C, P, Ind; PELine LP; int Left = BFI(this, BFI_LeftMargin), Right = BFI(this, BFI_RightMargin); int FirstParaLine; int NoChange = 0, NoChangeX = 0; if (Left >= Right) return 0; L = VToR(CP.Row); FirstParaLine = 0; if (L > 0) if (IsLineBlank(L - 1)) FirstParaLine = L; while (L < RCount) { NoChange = 1; if (VToR(CP.Row) != L || L != FirstParaLine) { if (VToR(CP.Row) == L) if (CP.Col <= LineIndented(L)) if (SetPos(Left, CP.Row) == 0) WFAIL(1); Ind = IndentLine(L, Left); if (VToR(CP.Row) == L) if (SetPos((CP.Col + Ind > 0) ? CP.Col + Ind : 0, CP.Row) == 0) WFAIL(2); NoChange = 0; } Len = LineLen(L); if (IsLineBlank(L)) break; if (Len < Right) { int firstwordbeg = -1; int firstwordend = -1; int X; PELine lp; if (L < RCount - 1) { IndentLine(L + 1, 0); if ((ScreenPos(RLine(L + 1), RLine(L + 1)->Count) == 0) || (RLine(L + 1)->Chars[0] == '>') || (RLine(L + 1)->Chars[0] == '<')) break; } else break; if (L + 1 >= RCount) break; lp = RLine(L + 1); for (X = 0; X < lp->Count; X++) { if (firstwordbeg == -1 && ((lp->Chars[X] != ' ') && (lp->Chars[X] != '\t'))) { firstwordbeg = X; } else if (firstwordend == -1 && ((lp->Chars[X] == ' ' || lp->Chars[X] == '\t'))) { firstwordend = X - 1; } } if (firstwordbeg != -1) if (firstwordend == -1) firstwordend = lp->Count; if (firstwordend == -1) break; if (Right - Len > firstwordend - firstwordbeg) { if (JoinLine(L, Len + 1) == 0) WFAIL(3); NoChange = 0; continue; } else IndentLine(L + 1, Left); } else if (Len > Right) { C = Right; P = CharOffset(LP = RLine(L), C); while ((C > Left) && ((LP->Chars[P] != ' ') && (LP->Chars[P] != 9))) C = ScreenPos(LP, --P); if (P <= Left) { L++; continue; } C = ScreenPos(LP, P); if (SplitLine(L, C) == 0) WFAIL(4); IndentLine(L + 1, Left); if (L < RCount - 2 && LineLen(L + 1) == Left) { if (!IsLineBlank(L + 2)) { if (JoinLine(L + 1, Left) == 0) WFAIL(5); } } if (L == VToR(CP.Row) && CP.Col > C) { if (SetPos(Left + CP.Col - C - 1, CP.Row + 1) == 0) WFAIL(6); } NoChange = 0; L++; continue; } if (WrapAll == 0) if (NoChangeX) { //printf("\n\nBreak OUT = %d\n\x7", L); break; } L++; NoChangeX = NoChange; } if (WrapAll == 1) if (SetPosR(Left, (L < RCount - 2) ? (L + 2) : (L < RCount - 1) ? (L + 1) : (RCount - 1)) == 0) WFAIL(7); return 1; } int EBuffer::WrapPara() { while (VToR(CP.Row) < RCount - 1 && IsLineBlank(VToR(CP.Row))) if (SetPos(CP.Col, CP.Row + 1) == 0) return 0; return DoWrap(1); } #endif int EBuffer::LineCenter() { if (LineTrim() == 0) return 0; int ind = LineIndented(VToR(CP.Row)); int left = BFI(this, BFI_LeftMargin); int right = BFI(this, BFI_RightMargin); int len = LineLen(); //int chs = len - ind; int newind = left + ((right - left) - (len - ind)) / 2; if (newind < left) newind = left; return IndentLine(VToR(CP.Row), newind); } int EBuffer::InsPrevLineChar() { int L = VToR(CP.Row); int C = CP.Col, P; if (L > 0) { L--; if (C < LineLen(L)) { P = CharOffset(RLine(L), C); return InsertChar(RLine(L)->Chars[P]); } } return 0; } int EBuffer::InsPrevLineToEol() { int L = VToR(CP.Row); int C = CP.Col, P; int Len; if (L > 0) { L--; P = CharOffset(RLine(L), C); Len = RLine(L)->Count - P; if (Len > 0) return InsertString(RLine(L)->Chars + P, Len); } return 0; } int EBuffer::LineDuplicate() { int Y = VToR(CP.Row); if (InsLine(Y, 1) == 0) return 0; if (InsChars(Y + 1, 0, RLine(Y)->Count, RLine(Y)->Chars) == 0) return 0; return 1; } int EBuffer::TrimLine(int Row) { PELine L = RLine(Row); int P, X, E; if (L->Count == 0) return 1; P = L->Count; while ((P > 0) && ((L->Chars[P - 1] == ' ') || (L->Chars[P - 1] == 9))) P--; X = ScreenPos(L, P); E = ScreenPos(L, L->Count); if (E - X > 0) if (DelText(Row, X, E - X, 1) == 0) return 0; return 1; } int EBuffer::LineTrim() { return TrimLine(VToR(CP.Row)); } int EBuffer::FileTrim() { for (int L = 0; L < RCount; L++) if (TrimLine(L) == 0) return 0; return 1; } int EBuffer::BlockTrim() { EPoint B, E; int L; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount <= 0) return 0; B = BB; E = BE; Draw(B.Row, E.Row); for (L = B.Row; L <= E.Row; L++) { switch (BlockMode) { case bmStream: if (L < E.Row || E.Col != 0) if (TrimLine(L) == 0) return 0; break; case bmLine: case bmColumn: if (L < E.Row) if (TrimLine(L) == 0) return 0; break; } } return 1; } #define TOGGLE(x) \ Flags.num[BFI_##x] = (Flags.num[BFI_##x]) ? 0 : 1; \ /*Msg(INFO, #x " is now %s.", Flags.num[BFI_##x] ? "ON" : "OFF");*/ \ return 1; #define TOGGLE_R(x) \ Flags.num[BFI_##x] = (Flags.num[BFI_##x]) ? 0 : 1; \ /*Msg(INFO, #x " is now %s.", Flags.num[BFI_##x] ? "ON" : "OFF");*/ \ FullRedraw(); \ return 1; int EBuffer::ToggleAutoIndent() { TOGGLE(AutoIndent); } int EBuffer::ToggleInsert() { TOGGLE(Insert); } int EBuffer::ToggleExpandTabs() { TOGGLE_R(ExpandTabs); } int EBuffer::ToggleShowTabs() { TOGGLE_R(ShowTabs); } int EBuffer::ToggleUndo() { #ifdef CONFIG_UNDOREDO FreeUndo(); TOGGLE(Undo); #endif } int EBuffer::ToggleReadOnly() { TOGGLE(ReadOnly); } int EBuffer::ToggleKeepBackups() { TOGGLE(KeepBackups); } int EBuffer::ToggleMatchCase() { TOGGLE(MatchCase); } int EBuffer::ToggleBackSpKillTab() { TOGGLE(BackSpKillTab); } int EBuffer::ToggleDeleteKillTab() { TOGGLE(DeleteKillTab); } int EBuffer::ToggleSpaceTabs() { TOGGLE(SpaceTabs); } int EBuffer::ToggleIndentWithTabs() { TOGGLE(IndentWithTabs); } int EBuffer::ToggleBackSpUnindents() { TOGGLE(BackSpUnindents); } int EBuffer::ToggleTrim() { TOGGLE(Trim); } int EBuffer::ToggleShowMarkers() { TOGGLE_R(ShowMarkers); } int EBuffer::ToggleHilitTags() { TOGGLE_R(HilitTags); } int EBuffer::ToggleShowBookmarks() { TOGGLE_R(ShowBookmarks); } int EBuffer::ToggleMakeBackups() { TOGGLE(MakeBackups); } int EBuffer::ToggleWordWrap() { BFI(this, BFI_WordWrap) = (BFI(this, BFI_WordWrap) + 1) % 3; /*Msg(INFO, "WordWrap is now %s.", (BFI(this, BFI_WordWrap) == 2) ? "AUTO" : (BFI(this, BFI_WordWrap) == 1) ? "ON" : "OFF"); */ return 1; } int EBuffer::SetLeftMargin() { BFI(this, BFI_LeftMargin) = CP.Col; Msg(S_INFO, "LeftMargin set to %d.", BFI(this, BFI_LeftMargin) + 1); return 1; } int EBuffer::SetRightMargin() { BFI(this, BFI_RightMargin) = CP.Col; Msg(S_INFO, "RightMargin set to %d.", BFI(this, BFI_RightMargin) + 1); return 1; } int EBuffer::ChangeMode(const char *AMode) { if (FindMode(AMode) != 0) { Mode = FindMode(AMode); Flags = Mode->Flags; #ifdef CONFIG_SYNTAX_HILIT HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); #endif FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } int EBuffer::ChangeKeys(const char *AMode) { if (FindMode(AMode) != 0) { Mode = FindMode(AMode); #ifdef CONFIG_SYNTAX_HILIT HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); #endif FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } int EBuffer::ChangeFlags(const char *AMode) { if (FindMode(AMode) != 0) { EMode *XMode; XMode = FindMode(AMode); Flags = XMode->Flags; #ifdef CONFIG_SYNTAX_HILIT HilitProc = 0; if (Mode && Mode->fColorize) HilitProc = GetHilitProc(Mode->fColorize->SyntaxParser); #endif FullRedraw(); return 1; } Msg(S_ERROR, "Mode '%s' not found.", AMode); return 0; } �������������������������������������������������������������������./src/c_config.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000116647�11604417615�012741� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_config.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_config.h" #include "c_bind.h" #include "c_color.h" #include "c_fconfig.h" #include "ftever.h" #include "log.h" #include "o_buflist.h" #include "o_cvsbase.h" #include "o_svnbase.h" #include "s_string.h" #include <fcntl.h> #include <stdio.h> struct GUICharactersEntry { struct GUICharactersEntry *next; char *name; char *chars; }; struct CurPos { off_t sz; const char *a; const char *c; const char *z; int line; const char *name; // filename }; #ifdef CONFIG_INDENT_C extern int C_Indent; extern int C_BraceOfs; extern int C_CaseOfs; extern int C_CaseDelta; extern int C_ClassOfs; extern int C_ClassDelta; extern int C_ColonOfs; extern int C_CommentOfs; extern int C_CommentDelta; extern int C_FirstLevelWidth; extern int C_FirstLevelIndent; extern int C_Continuation; extern int C_ParenDelta; extern int FunctionUsesContinuation; #endif #ifdef CONFIG_INDENT_REXX extern int REXX_Base_Indent; extern int REXX_Do_Offset; #endif extern int ShowVScroll; extern int ShowHScroll; extern int ShowMenuBar; int SystemClipboard = 0; int ScreenSizeX = -1, ScreenSizeY = -1; int ScrollBarWidth = 1; int CursorInsSize[2] = { 90, 100 }; int CursorOverSize[2] = { 0, 100 }; bool CursorBlink = 0; // default is "no" (same as before) int OpenAfterClose = 1; int SelectPathname = 0; char DefaultModeName[32] = ""; RxNode *CompletionFilter = NULL; #if defined(DOS) || defined(DOSP32) char PrintDevice[MAXPATH] = "PRN"; #else char PrintDevice[MAXPATH] = "\\DEV\\PRN"; #endif char CompileCommand[256] = "make"; int KeepHistory = 0; int LoadDesktopOnEntry = 0; int SaveDesktopOnExit = 0; char WindowFont[64] = ""; // Custom RGB colors (if console driver supports them) TRGBColor RGBColor[16]; // true if corresponding triplet in RGBColor is valid bool RGBColorValid [16]; int KeepMessages = 0; int ScrollBorderX = 0; int ScrollBorderY = 0; int ScrollJumpX = 8; int ScrollJumpY = 1; int GUIDialogs = 1; int PMDisableAccel = 0; int SevenBit = 0; int WeirdScroll = 0; int LoadDesktopMode = 0; char HelpCommand[128] = "man -a"; char *ConfigSourcePath = 0; int IgnoreBufferList = 0; static GUICharactersEntry *GUICharacters = NULL; #ifdef CONFIG_OBJ_CVS char CvsCommand[256] = "cvs"; char CvsLogMode[32] = "PLAIN"; #endif #ifdef CONFIG_OBJ_SVN char SvnCommand[256] = "svn"; char SvnLogMode[32] = "PLAIN"; #endif int ReassignModelIds = 0; int RecheckReadOnly = 0; char XShellCommand[256] = "xterm"; int ShowTildeFilesInDirList = 1; // Which characters to get. defaultCharacters if not set, rest filled // with defaultCharacters if too short // List of GUICharacters is freed, only one item remains const char *GetGUICharacters(const char *which, const char *defChars) { GUICharactersEntry *g, *gg, *found = NULL; char *s; size_t i; for (g = GUICharacters; g; g=gg) { gg = g->next; if (strcmp(g->name, which) == 0) { if ((i = strlen(g->chars)) < strlen(defChars)) { s = new char [strlen(defChars) + 1]; assert(s != NULL); strcpy(s, g->chars); strcpy(s + i, defChars + i); delete g->chars; g->chars = s; } if (found) { free(found->chars); free(found->name); free(found); } found = g; } else { free(g->name); free(g->chars); free(g); } } GUICharacters = found; return found ? found->chars : defChars; } static void AppendGUICharacters(const char *string) { const char *s; GUICharactersEntry *g; s = strchr(string, ':'); if (s) { g = new GUICharactersEntry; assert(g != NULL); // allocate memory for name +1 for strncat g->name = (char *)malloc((s-string) + 1); assert(g->name != NULL); // make sure we have zero at start of string *(g->name) = 0; // strncat makes sure that we have zero at the end... strncat(g->name, string, (s-string)); // copy text after ':' to chars... g->chars = strdup(s+1); assert(g->chars != NULL); g->next = GUICharacters; GUICharacters = g; } } #ifdef CONFIG_SYNTAX_HILIT static int AddKeyword(ColorKeywords *tab, char color, const char *keyword) { size_t len = strlen(keyword); if (len < 1 || len >= CK_MAXLEN) return 0; if (tab->key[len]) { size_t lx = strlen(tab->key[len]); char *key; key = (char *)realloc(tab->key[len], lx + len + 1 + 1); assert(key != NULL); tab->key[len] = key; assert(tab->key[len] != 0); strcpy(tab->key[len] + lx, keyword); tab->key[len][lx + len] = color; tab->key[len][lx + len + 1] = 0; } else { tab->key[len] = (char *)malloc(len + 2); assert(tab->key[len] != 0); strcpy(tab->key[len], keyword); tab->key[len][len] = color; tab->key[len][len + 1] = 0; } tab->count[len]++; tab->TotalCount++; return 1; } #endif static int SetModeNumber(EMode *mode, int what, int number) { int j = what; if (j == BFI_LeftMargin || j == BFI_RightMargin) number--; mode->Flags.num[j] = number; return 0; } static int SetModeString(EMode *mode, int what, const char *string) { int j = what; #ifdef CONFIG_SYNTAX_HILIT if (j == BFI_Colorizer) { mode->fColorize = FindColorizer(string); } else #endif if (j == BFI_EventMap) { mode->fEventMap = FindEventMap(string); #ifdef CONFIG_INDENT } else if (j == BFI_IndentMode) { mode->Flags.num[j] = GetIndentMode(string); #endif } else if (j == BFS_WordChars) { SetWordChars(mode->Flags.WordChars, string); } else if (j == BFS_CapitalChars) { SetWordChars(mode->Flags.CapitalChars, string); } else if (j == BFS_FileNameRx) { if (mode->MatchName) free(mode->MatchName); if (mode->MatchNameRx) RxFree(mode->MatchNameRx); mode->MatchName = strdup(string); mode->MatchNameRx = RxCompile(string); } else if (j == BFS_FirstLineRx) { if (mode->MatchLine) free(mode->MatchLine); if (mode->MatchLineRx) RxFree(mode->MatchLineRx); mode->MatchLine = strdup(string); mode->MatchLineRx = RxCompile(string); } else { if (mode->Flags.str[j & 0xFF]) free(mode->Flags.str[j & 0xFF]); mode->Flags.str[j & 0xFF] = strdup(string); } return 0; } // *INDENT-OFF* static int SetGlobalNumber(int what, int number) { STARTFUNC("SetGlobalNumber"); LOG << "What: " << what << " Number: " << number << ENDLINE; switch (what) { #ifdef CONFIG_INDENT_C case FLAG_C_Indent: C_Indent = number; break; case FLAG_C_BraceOfs: C_BraceOfs = number; break; case FLAG_C_CaseOfs: C_CaseOfs = number; break; case FLAG_C_CaseDelta: C_CaseDelta = number; break; case FLAG_C_ClassOfs: C_ClassOfs = number; break; case FLAG_C_ClassDelta: C_ClassDelta = number; break; case FLAG_C_ColonOfs: C_ColonOfs = number; break; case FLAG_C_CommentOfs: C_CommentOfs = number; break; case FLAG_C_CommentDelta: C_CommentDelta = number; break; case FLAG_C_FirstLevelIndent: C_FirstLevelIndent = number; break; case FLAG_C_FirstLevelWidth: C_FirstLevelWidth = number; break; case FLAG_C_Continuation: C_Continuation = number; break; case FLAG_C_ParenDelta: C_ParenDelta = number; break; case FLAG_FunctionUsesContinuation: FunctionUsesContinuation = number; break; #endif #ifdef CONFIG_INDENT_REXX case FLAG_REXX_Indent: REXX_Base_Indent = number; break; case FLAG_REXX_Do_Offset: REXX_Do_Offset = number; break; #endif case FLAG_ScreenSizeX: ScreenSizeX = number; break; case FLAG_ScreenSizeY: ScreenSizeY = number; break; case FLAG_CursorInsertStart: CursorInsSize[0] = number; break; case FLAG_CursorInsertEnd: CursorInsSize[1] = number; break; case FLAG_CursorOverStart: CursorOverSize[0] = number; break; case FLAG_CursorOverEnd: CursorOverSize[1] = number; break; case FLAG_CursorBlink: CursorBlink = number; break; case FLAG_SysClipboard: SystemClipboard = number; break; case FLAG_OpenAfterClose: OpenAfterClose = number; break; case FLAG_ShowVScroll: ShowVScroll = number; break; case FLAG_ShowHScroll: ShowHScroll = number; break; case FLAG_ScrollBarWidth: ScrollBarWidth = number; break; case FLAG_SelectPathname: SelectPathname = number; break; case FLAG_ShowMenuBar: ShowMenuBar = number; break; case FLAG_ShowToolBar: ShowToolBar = number; break; case FLAG_KeepHistory: KeepHistory = number; break; case FLAG_LoadDesktopOnEntry: LoadDesktopOnEntry = number; break; case FLAG_SaveDesktopOnExit: SaveDesktopOnExit = number; break; case FLAG_KeepMessages: KeepMessages = number; break; case FLAG_ScrollBorderX: ScrollBorderX = number; break; case FLAG_ScrollBorderY: ScrollBorderY = number; break; case FLAG_ScrollJumpX: ScrollJumpX = number; break; case FLAG_ScrollJumpY: ScrollJumpY = number; break; case FLAG_GUIDialogs: GUIDialogs = number; break; case FLAG_PMDisableAccel: PMDisableAccel = number; break; case FLAG_SevenBit: SevenBit = number; break; case FLAG_WeirdScroll: WeirdScroll = number; break; case FLAG_LoadDesktopMode: LoadDesktopMode = number; break; case FLAG_IgnoreBufferList: IgnoreBufferList = number; break; case FLAG_ReassignModelIds: ReassignModelIds = number; break; case FLAG_RecheckReadOnly: RecheckReadOnly = number; break; case FLAG_ShowTildeFilesInDirList: ShowTildeFilesInDirList = number; break; default: //printf("Unknown global number: %d\n", what); ENDFUNCRC(-1); } ENDFUNCRC(0); } // *INDENT-ON* static void SetRGBColor(const char *string) { int idx,r,g,b; if (sscanf (string, "%x:%x,%x,%x", &idx, &r, &g, &b) != 4) { fprintf(stderr, "Invalid RGB Definition: %s\n", string); return; } if (idx < 0 || idx > 15) { fprintf(stderr, "Invalid RGB index: (0-f only) (%s)\n", string); return; } if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) { fprintf(stderr, "Invalid RGB palette values (00-ff only): %s\n", string); return; } RGBColorValid[idx] = true; RGBColor[idx].r = (unsigned char) r; RGBColor[idx].g = (unsigned char) g; RGBColor[idx].b = (unsigned char) b; } static int SetGlobalString(long what, const char *string) { STARTFUNC("SetGlobalString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case FLAG_DefaultModeName: strlcpy(DefaultModeName, string, sizeof(DefaultModeName)); break; case FLAG_CompletionFilter: if ((CompletionFilter = RxCompile(string)) == NULL) return -1; break; case FLAG_PrintDevice: strlcpy(PrintDevice, string, sizeof(PrintDevice)); break; case FLAG_CompileCommand: strlcpy(CompileCommand, string, sizeof(CompileCommand)); break; case FLAG_WindowFont: strlcpy(WindowFont, string, sizeof(WindowFont)); break; case FLAG_HelpCommand: strlcpy(HelpCommand, string, sizeof(HelpCommand)); break; case FLAG_GUICharacters: AppendGUICharacters (string); break; #ifdef CONFIG_OBJ_CVS case FLAG_CvsCommand: strlcpy(CvsCommand, string, sizeof(CvsCommand)); break; case FLAG_CvsLogMode: strlcpy(CvsLogMode, string, sizeof(CvsLogMode)); break; #endif #ifdef CONFIG_OBJ_SVN case FLAG_SvnCommand: strlcpy(SvnCommand, string, sizeof(SvnCommand)); break; case FLAG_SvnLogMode: strlcpy(SvnLogMode, string, sizeof(SvnLogMode)); break; #endif case FLAG_RGBColor: SetRGBColor(string); break; case FLAG_XShellCommand: strlcpy(XShellCommand, string, sizeof(XShellCommand)); break; default: //printf("Unknown global string: %ld\n", what); ENDFUNCRC(-1); } ENDFUNCRC(0); } static int SetEventString(EEventMap *Map, int what, const char *string) { STARTFUNC("SetEventString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case EM_MainMenu: case EM_LocalMenu: Map->SetMenu(what, string); break; default: ENDFUNCRC(-1); } ENDFUNCRC(0); } #ifdef CONFIG_SYNTAX_HILIT static int SetColorizeString(EColorize *Colorize, long what, const char *string) { STARTFUNC("SetColorizeString"); LOG << "What: " << what << " String: " << string << ENDLINE; switch (what) { case COL_SyntaxParser: Colorize->SyntaxParser = GetHilitMode(string); break; default: ENDFUNCRC(-1); } ENDFUNCRC(0); } #endif static unsigned char GetObj(CurPos &cp, unsigned short &len) { len = 0; if (cp.c + 3 <= cp.z) { unsigned char c; unsigned char l[2]; c = *cp.c++; memcpy(l, cp.c, 2); len = (l[1] << 8) + l[0]; cp.c += 2; return c; } return 0xFF; } static const char *GetCharStr(CurPos &cp, unsigned short len) { STARTFUNC("GetCharStr"); LOG << "Length: " << len << ENDLINE; const char *p = cp.c; if (cp.c + len > cp.z) { LOG << "End of config file in GetCharStr" << ENDLINE; ENDFUNCRC(0); } cp.c += len; ENDFUNCRC(p); } static int GetNum(CurPos &cp, long &num) { unsigned char n[4]; if (cp.c + 4 > cp.z) return 0; memcpy(n, cp.c, 4); num = (n[3] << 24) + (n[2] << 16) + (n[1] << 8) + n[0]; if ((n[3] > 127) && sizeof(long) > 4) num = num | (~0xFFFFFFFFUL); cp.c += 4; return 1; } static int ReadCommands(CurPos &cp, const char *Name) { STARTFUNC("ReadCommands"); LOG << "Name = " << (Name != NULL ? Name : "(null)") << ENDLINE; unsigned char obj; unsigned short len; long Cmd = NewCommand(Name); long cmdno; if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, cmdno) == 0) ENDFUNCRC(-1); if (cmdno != (Cmd | CMD_EXT)) { fprintf(stderr, "Bad Command map %s -> %ld != %ld\n", Name, Cmd, cmdno); ENDFUNCRC(-1); } while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COMMAND: { // char *s; long cnt; long ign; long cmd; // if ((s = GetCharStr(cp, len)) == 0) return -1; if (GetNum(cp, cmd) == 0) ENDFUNCRC(-1); if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, cnt) == 0) ENDFUNCRC(-1); if (GetObj(cp, len) != CF_INT) ENDFUNCRC(-1); if (GetNum(cp, ign) == 0) ENDFUNCRC(-1); // if (cmd != CmdNum(s)) { // fprintf(stderr, "Bad Command Id: %s -> %d\n", s, cmd); // return -1; // } if (AddCommand(Cmd, cmd, cnt, ign) == 0) { if (Name == 0 || strcmp(Name, "xx") != 0) { fprintf(stderr, "Bad Command Id: %ld\n", cmd); ENDFUNCRC(-1); } } } break; case CF_STRING: { const char *s = GetCharStr(cp, len); if (s == 0) ENDFUNCRC(-1); if (AddString(Cmd, s) == 0) ENDFUNCRC(-1); } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) ENDFUNCRC(-1); if (AddNumber(Cmd, num) == 0) ENDFUNCRC(-1); } break; case CF_VARIABLE: { long num; if (GetNum(cp, num) == 0) ENDFUNCRC(-1); if (AddVariable(Cmd, num) == 0) ENDFUNCRC(-1); } break; case CF_CONCAT: if (AddConcat(Cmd) == 0) ENDFUNCRC(-1); break; case CF_END: ENDFUNCRC(Cmd); default: ENDFUNCRC(-1); } } ENDFUNCRC(-1); } static int ReadMenu(CurPos &cp, const char *MenuName) { unsigned char obj; unsigned short len; int menu = -1, item = -1; menu = NewMenu(MenuName); while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_ITEM: { if (len == 0) { item = NewItem(menu, 0); } else { const char *s = GetCharStr(cp, len); int Cmd; if (s == 0) return -1; item = NewItem(menu, s); if ((obj = GetObj(cp, len)) != CF_MENUSUB) return -1; if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Menus[menu].Items[item].Cmd = Cmd + 65536; } } break; case CF_SUBMENU: { const char *s = GetCharStr(cp, len); const char *w; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((w = GetCharStr(cp, len)) == 0) return -1; item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_NORMAL); } break; case CF_SUBMENUCOND: { const char *s = GetCharStr(cp, len); const char *w; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((w = GetCharStr(cp, len)) == 0) return -1; item = NewSubMenu(menu, s, GetMenuId(w), SUBMENU_CONDITIONAL); } break; case CF_END: return 0; default: return -1; } } return -1; } static int ReadColors(CurPos &cp, const char *ObjName) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_STRING: { const char *sname = GetCharStr(cp, len); const char *svalue; if (sname == 0) return -1; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((svalue = GetCharStr(cp, len)) == 0) return -1; StlString cl(ObjName); cl += '.'; cl += sname; if (SetColor(cl.c_str(), svalue) == 0) return -1; } break; case CF_END: return 0; default: return -1; } } return -1; } #ifdef CONFIG_SYNTAX_HILIT static int ReadHilitColors(CurPos &cp, EColorize *Colorize, const char * /*ObjName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_INT: { long cidx; const char *svalue; if (GetNum(cp, cidx) == 0) return -1; if ((obj = GetObj(cp, len)) != CF_STRING) return -1; if ((svalue = GetCharStr(cp, len)) == 0) return -1; if (Colorize->SetColor(cidx, svalue) == 0) return -1; } break; case CF_END: return 0; default: return -1; } } return -1; } static int ReadKeywords(CurPos &cp, ColorKeywords *keywords, int color) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_STRING: { const char *kname = GetCharStr(cp, len); if (kname == 0) return -1; if (AddKeyword(keywords, (char) color, kname) != 1) return -1; } break; case CF_END: return 0; default: return -1; } } return -1; } #endif static int ReadEventMap(CurPos &cp, EEventMap *Map, const char * /*MapName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_KEY: { EKey *Key; const char *s; int Cmd; if ((s = GetCharStr(cp, len)) == 0) return -1; if ((Key = SetKey(Map, s)) == 0) return -1; if ((obj = GetObj(cp, len)) != CF_KEYSUB) return -1; if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Key->Cmd = Cmd; } break; #ifdef CONFIG_ABBREV case CF_ABBREV: { EAbbrev *Ab; const char *s; const char *x; int Cmd; if ((s = GetCharStr(cp, len)) == 0) return -1; obj = GetObj(cp, len); if (obj == CF_KEYSUB) { if ((Cmd = ReadCommands(cp, 0)) == -1) return -1; Ab = new EAbbrev(s, Cmd); } else if (obj == CF_STRING) { x = GetCharStr(cp, len); Ab = new EAbbrev(s, x); } else return -1; if (Ab) { Map->AddAbbrev(Ab); } } break; #endif case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetEventString(Map, what, val) != 0) return -1; } break; /* case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break;*/ default: return -1; } } break; case CF_END: return 0; default: return -1; } } return -1; } #ifdef CONFIG_SYNTAX_HILIT static int ReadColorize(CurPos &cp, EColorize *Colorize, const char *ModeName) { unsigned char obj; unsigned short len; long LastState = -1; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COLOR: if (ReadHilitColors(cp, Colorize, ModeName) == -1) return -1; break; case CF_KEYWORD: { const char *colorstr; if ((colorstr = GetCharStr(cp, len)) == 0) return -1; unsigned int Col; unsigned int ColBg, ColFg; if (sscanf(colorstr, "%1X %1X", &ColFg, &ColBg) != 2) return 0; Col = ColFg | (ColBg << 4); int color = ChColor(Col); if (ReadKeywords(cp, &Colorize->Keywords, color) == -1) return -1; } break; case CF_HSTATE: { long stateno; long color; if (Colorize->hm == 0) Colorize->hm = new HMachine(); assert(Colorize->hm != 0); if (GetNum(cp, stateno) == 0) return -1; assert(stateno == LastState + 1); obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, color) == 0) return -1; HState newState; newState.InitState(); newState.color = color; Colorize->hm->AddState(newState); LastState = stateno; } break; case CF_HTRANS: { HTrans newTrans; long nextState; long matchFlags; const char *match; long color; if (GetNum(cp, nextState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, matchFlags) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, color) == 0) return -1; obj = GetObj(cp, len); assert(matchFlags & MATCH_REGEXP ? obj == CF_REGEXP : obj == CF_STRING); if ((match = GetCharStr(cp, len)) == 0) return -1; newTrans.InitTrans(); newTrans.matchFlags = matchFlags; newTrans.nextState = nextState; newTrans.color = color; if (newTrans.matchFlags & MATCH_REGEXP) { newTrans.regexp = RxCompile(match); newTrans.matchLen = 0; } else if ((newTrans.matchFlags & MATCH_SET) || (newTrans.matchFlags & MATCH_NOTSET)) { newTrans.matchLen = 1; newTrans.match = (char *)malloc(256/8); assert(newTrans.match != NULL); SetWordChars(newTrans.match, match); } else { newTrans.match = strdup(match); newTrans.matchLen = strlen(match); } Colorize->hm->AddTrans(newTrans); } break; case CF_HWTYPE: { long nextKwdMatchedState; long nextKwdNotMatchedState; long nextKwdNoCharState; long options; const char *wordChars; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdMatchedState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdNotMatchedState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, nextKwdNoCharState) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_INT); if (GetNum(cp, options) == 0) return -1; obj = GetObj(cp, len); assert(obj == CF_STRING); if ((wordChars = GetCharStr(cp, len)) == 0) return -1; Colorize->hm->LastState()->options = options; Colorize->hm->LastState()->nextKwdMatchedState = nextKwdMatchedState; Colorize->hm->LastState()->nextKwdNotMatchedState = nextKwdNotMatchedState; Colorize->hm->LastState()->nextKwdNoCharState = nextKwdNoCharState; if (wordChars && *wordChars) { Colorize->hm->LastState()->wordChars = (char *)malloc(256/8); assert(Colorize->hm->LastState()->wordChars != NULL); SetWordChars(Colorize->hm->LastState()->wordChars, wordChars); } } break; case CF_HWORDS: { const char *colorstr; int color; if ((colorstr = GetCharStr(cp, len)) == 0) return -1; color = hcPlain_Keyword; if (strcmp(colorstr, "-") != 0) { const char *Value = colorstr; int Col; if (*Value == '-') { Value++; if (sscanf(Value, "%1X", &Col) != 1) return -1; Col |= (hcPlain_Background & 0xF0); } else if (Value[1] == '-') { if (sscanf(Value, "%1X", &Col) != 1) return -1; Col <<= 4; Col |= (hcPlain_Background & 0x0F); } else { unsigned int ColBg, ColFg; if (sscanf(colorstr, "%1X %1X", &ColFg, &ColBg) != 2) return 0; Col = ColFg | (ColBg << 4); } color = Col; } if (ReadKeywords(cp, &Colorize->hm->LastState()->keywords, color) == -1) return -1; } break; case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetColorizeString(Colorize, what, val) != 0) return -1; } break; /* case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break;*/ default: return -1; } } break; case CF_END: return 0; default: return -1; } } return -1; } #endif static int ReadMode(CurPos &cp, EMode *Mode, const char * /*ModeName*/) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetModeString(Mode, what, val) != 0) return -1; } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetModeNumber(Mode, what, num) != 0) return -1; } break; default: return -1; } } break; case CF_END: return 0; default: return -1; } } return -1; } static int ReadObject(CurPos &cp, const char *ObjName) { unsigned char obj; unsigned short len; while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_COLOR: if (ReadColors(cp, ObjName) == -1) return -1; break; #ifdef CONFIG_OBJ_MESSAGES case CF_COMPRX: { long file, line, msg; const char *regexp; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, file) == 0) return -1; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, line) == 0) return -1; if (GetObj(cp, len) != CF_INT) return -1; if (GetNum(cp, msg) == 0) return -1; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddCRegexp(file, line, msg, regexp) == 0) return -1; } break; #endif #ifdef CONFIG_OBJ_CVS case CF_CVSIGNRX: { const char *regexp; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddCvsIgnoreRegexp(regexp) == 0) return -1; } break; #endif #ifdef CONFIG_OBJ_SVN case CF_SVNIGNRX: { const char *regexp; if (GetObj(cp, len) != CF_REGEXP) return -1; if ((regexp = GetCharStr(cp, len)) == 0) return -1; if (AddSvnIgnoreRegexp(regexp) == 0) return -1; } break; #endif case CF_SETVAR: { long what; if (GetNum(cp, what) == 0) return -1; switch (GetObj(cp, len)) { case CF_STRING: { const char *val = GetCharStr(cp, len); if (len == 0) return -1; if (SetGlobalString(what, val) != 0) return -1; } break; case CF_INT: { long num; if (GetNum(cp, num) == 0) return -1; if (SetGlobalNumber(what, num) != 0) return -1; } break; default: return -1; } } break; case CF_END: return 0; default: return -1; } } return -1; } static int ReadConfigFile(CurPos &cp) { unsigned char obj; unsigned short len; { const char *p; obj = GetObj(cp, len); assert(obj == CF_STRING); if ((p = GetCharStr(cp, len)) == 0) return -1; if (ConfigSourcePath) free(ConfigSourcePath); ConfigSourcePath = strdup(p); } while ((obj = GetObj(cp, len)) != 0xFF) { switch (obj) { case CF_SUB: { const char *CmdName = GetCharStr(cp, len); if (ReadCommands(cp, CmdName) == -1) return -1; } break; case CF_MENU: { const char *MenuName = GetCharStr(cp, len); if (ReadMenu(cp, MenuName) == -1) return -1; } break; case CF_EVENTMAP: { EEventMap *EventMap = 0; const char *MapName = GetCharStr(cp, len); const char *UpMap = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMap = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((EventMap = FindEventMap(MapName)) == 0) { EEventMap *OrgMap = 0; if (strcmp(UpMap, "") != 0) OrgMap = FindEventMap(UpMap); EventMap = new EEventMap(MapName, OrgMap); } else { if (EventMap->Parent == 0) EventMap->Parent = FindEventMap(UpMap); } if (ReadEventMap(cp, EventMap, MapName) == -1) return -1; } break; #ifdef CONFIG_SYNTAX_HILIT case CF_COLORIZE: { EColorize *Mode = 0; const char *ModeName = GetCharStr(cp, len); const char *UpMode = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMode = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((Mode = FindColorizer(ModeName)) == 0) Mode = new EColorize(ModeName, UpMode); else { if (Mode->Parent == 0) Mode->Parent = FindColorizer(UpMode); } if (ReadColorize(cp, Mode, ModeName) == -1) return -1; } break; #endif case CF_MODE: { EMode *Mode = 0; const char *ModeName = GetCharStr(cp, len); const char *UpMode = 0; if ((obj = GetObj(cp, len)) != CF_PARENT) return -1; if (len > 0) if ((UpMode = GetCharStr(cp, len)) == 0) return -1; // add new mode if ((Mode = FindMode(ModeName)) == 0) { EMode *OrgMode = 0; EEventMap *Map; if (strcmp(UpMode, "") != 0) OrgMode = FindMode(UpMode); Map = FindEventMap(ModeName); if (Map == 0) { EEventMap *OrgMap = 0; if (strcmp(UpMode, "") != 0) OrgMap = FindEventMap(UpMode); Map = new EEventMap(ModeName, OrgMap); } Mode = new EMode(OrgMode, Map, ModeName); Mode->fNext = Modes; Modes = Mode; } else { if (Mode->fParent == 0) Mode->fParent = FindMode(UpMode); } if (ReadMode(cp, Mode, ModeName) == -1) return -1; } break; case CF_OBJECT: { const char *ObjName; if ((ObjName = GetCharStr(cp, len)) == 0) return -1; if (ReadObject(cp, ObjName) == -1) return -1; } break; case CF_EOF: return 0; default: return -1; } } return -1; } int LoadConfig(int /*argc*/, char ** /*argv*/, char *CfgFileName) { STARTFUNC("LoadConfig"); LOG << "Config file: " << CfgFileName << ENDLINE; int fd, rc; char *buffer = 0; struct stat statbuf; CurPos cp; if ((fd = open(CfgFileName, O_RDONLY | O_BINARY)) == -1) ENDFUNCRC(-1); if (fstat(fd, &statbuf) != 0) { close(fd); ENDFUNCRC(-1); } // check that we have enough room for signature (CONFIG_ID + VERNUM) if (statbuf.st_size < (4+4)) { close(fd); DieError(0, "Bad .CNF signature"); ENDFUNCRC(-1); } buffer = (char *) malloc((size_t)statbuf.st_size); if (buffer == 0) { close(fd); ENDFUNCRC(-1); } if (read(fd, buffer, (size_t)statbuf.st_size) != statbuf.st_size) { close(fd); free(buffer); ENDFUNCRC(-1); } close(fd); unsigned char l[4]; unsigned long ln; memcpy(l, buffer, 4); ln = (l[3] << 24) + (l[2] << 16) + (l[1] << 8) + l[0]; if (ln != CONFIG_ID) { free(buffer); DieError(0, "Bad .CNF signature"); ENDFUNCRC(-1); } memcpy(l, buffer + 4, 4); ln = (l[3] << 24) + (l[2] << 16) + (l[1] << 8) + l[0]; if (ln != VERNUM) { LOG << std::hex << ln << " != " << VERNUM << ENDLINE; free(buffer); DieError(0, "Bad .CNF version."); ENDFUNCRC(-1); } cp.name = CfgFileName; cp.sz = statbuf.st_size; cp.a = buffer; cp.c = cp.a + 2 * 4; cp.z = cp.a + cp.sz; cp.line = 1; rc = ReadConfigFile(cp); free(buffer); if (rc == -1) { DieError(1, "Error %s offset %d\n", CfgFileName, cp.c - cp.a); } ENDFUNCRC(rc); } #include "defcfg.h" int UseDefaultConfig() { CurPos cp; int rc; cp.name = "Internal Configuration"; cp.sz = sizeof(DefaultConfig); cp.a = (char *)DefaultConfig; cp.c = (char *)DefaultConfig + 2 * 4; cp.z = cp.a + cp.sz; cp.line = 1; rc = ReadConfigFile(cp); if (rc == -1) DieError(1, "Error %s offset %d\n", cp.name, cp.c - cp.a); return rc; } �����������������������������������������������������������������������������������������./src/c_cmdtab.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000015267�11333110352�012352� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* c_cmdtab.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef CMDTAB_H #define CMDTAB_H #include "c_commands.h" #define TAB(x) \ { Ex##x, #x } // *INDENT-OFF* const struct { unsigned short CmdId; const char* Name; } Command_Table[] = { TAB(Nop), TAB(Fail), TAB(MoveLeft), TAB(MoveRight), TAB(MoveUp), TAB(MoveDown), TAB(MovePrev), TAB(MoveNext), TAB(MoveWordLeft), TAB(MoveWordRight), TAB(MoveWordPrev), TAB(MoveWordNext), TAB(MoveWordEndLeft), TAB(MoveWordEndRight), TAB(MoveWordEndPrev), TAB(MoveWordEndNext), TAB(MoveWordOrCapLeft), TAB(MoveWordOrCapRight), TAB(MoveWordOrCapPrev), TAB(MoveWordOrCapNext), TAB(MoveWordOrCapEndLeft), TAB(MoveWordOrCapEndRight), TAB(MoveWordOrCapEndPrev), TAB(MoveWordOrCapEndNext), TAB(MoveLineStart), TAB(MoveLineEnd), TAB(MovePageUp), TAB(MovePageDown), TAB(MovePageLeft), TAB(MovePageRight), TAB(MovePageStart), TAB(MovePageEnd), TAB(MoveFileStart), TAB(MoveFileEnd), TAB(MoveBlockStart), TAB(MoveBlockEnd), TAB(MoveFirstNonWhite), TAB(MoveLastNonWhite), TAB(MovePrevEqualIndent), TAB(MoveNextEqualIndent), TAB(MovePrevTab), TAB(MoveNextTab), TAB(MoveLineTop), TAB(MoveLineCenter), TAB(MoveLineBottom), TAB(ScrollLeft), TAB(ScrollRight), TAB(ScrollDown), TAB(ScrollUp), TAB(MoveTabStart), TAB(MoveTabEnd), TAB(KillLine), TAB(KillChar), TAB(KillCharPrev), TAB(KillWord), TAB(KillWordPrev), TAB(KillWordOrCap), TAB(KillWordOrCapPrev), TAB(KillToLineStart), TAB(KillToLineEnd), TAB(KillBlock), TAB(KillBlockOrChar), TAB(KillBlockOrCharPrev), TAB(BackSpace), TAB(Delete), TAB(CharCaseUp), TAB(CharCaseDown), TAB(CharCaseToggle), TAB(LineCaseUp), TAB(LineCaseDown), TAB(LineCaseToggle), TAB(LineInsert), TAB(LineAdd), TAB(LineSplit), TAB(LineJoin), TAB(LineNew), TAB(LineIndent), TAB(LineTrim), TAB(FileTrim), TAB(BlockTrim), TAB(InsertSpacesToTab), TAB(InsertTab), TAB(InsertSpace), TAB(WrapPara), TAB(InsPrevLineChar), TAB(InsPrevLineToEol), TAB(LineDuplicate), TAB(BlockBegin), TAB(BlockEnd), TAB(BlockUnmark), TAB(BlockCut), TAB(BlockCopy), TAB(BlockCutAppend), TAB(BlockCopyAppend), TAB(ClipClear), TAB(BlockPaste), TAB(BlockKill), TAB(BlockSort), TAB(BlockSortReverse), TAB(BlockIndent), TAB(BlockUnindent), TAB(BlockClear), TAB(BlockMarkStream), TAB(BlockMarkLine), TAB(BlockMarkColumn), TAB(BlockCaseUp), TAB(BlockCaseDown), TAB(BlockCaseToggle), TAB(BlockExtendBegin), TAB(BlockExtendEnd), TAB(BlockReIndent), TAB(BlockSelectWord), TAB(BlockSelectLine), TAB(BlockSelectPara), TAB(Undo), TAB(Redo), TAB(MatchBracket), TAB(MovePrevPos), TAB(MoveSavedPosCol), TAB(MoveSavedPosRow), TAB(MoveSavedPos), TAB(SavePos), TAB(CompleteWord), TAB(MoveToLine), TAB(MoveToColumn), TAB(BlockPasteStream), TAB(BlockPasteLine), TAB(BlockPasteColumn), TAB(BlockPasteOver), TAB(ShowPosition), TAB(FoldCreate), TAB(FoldCreateByRegexp), TAB(FoldDestroy), TAB(FoldDestroyAll), TAB(FoldPromote), TAB(FoldDemote), TAB(FoldOpen), TAB(FoldOpenNested), TAB(FoldClose), TAB(FoldOpenAll), TAB(FoldCloseAll), TAB(FoldToggleOpenClose), TAB(MoveFoldTop), TAB(MoveFoldPrev), TAB(MoveFoldNext), TAB(PlaceBookmark), TAB(RemoveBookmark), TAB(GotoBookmark), TAB(InsertString), TAB(SelfInsert), TAB(FilePrev), TAB(FileNext), TAB(FileLast), TAB(SwitchTo), TAB(FileReload), TAB(FileSave), TAB(FileSaveAll), TAB(FileSaveAs), TAB(FileWriteTo), TAB(FileOpen), TAB(FileOpenInMode), TAB(FilePrint), TAB(BlockPrint), TAB(BlockRead), TAB(BlockReadStream), TAB(BlockReadLine), TAB(BlockReadColumn), TAB(BlockWrite), TAB(IncrementalSearch), TAB(Find), TAB(FindReplace), TAB(FindRepeat), TAB(FindRepeatOnce), TAB(FindRepeatReverse), TAB(InsertChar), TAB(FileClose), TAB(FileCloseAll), TAB(WinRefresh), TAB(WinHSplit), TAB(WinNext), TAB(WinPrev), TAB(WinClose), TAB(WinZoom), TAB(WinResize), TAB(ExitEditor), TAB(ViewBuffers), TAB(ListRoutines), TAB(DirOpen), TAB(Compile), TAB(CompilePrevError), TAB(CompileNextError), TAB(ViewMessages), TAB(ShowKey), TAB(ShowEntryScreen), TAB(RunProgram), TAB(HilitWord), TAB(SearchWordPrev), TAB(SearchWordNext), TAB(HilitMatchBracket), TAB(MainMenu), TAB(LocalMenu), TAB(ShowMenu), TAB(ChangeMode), TAB(ChangeKeys), TAB(ChangeFlags), TAB(ToggleAutoIndent), TAB(ToggleInsert), TAB(ToggleExpandTabs), TAB(ToggleShowTabs), TAB(ToggleUndo), TAB(ToggleReadOnly), TAB(ToggleKeepBackups), TAB(ToggleMatchCase), TAB(ToggleBackSpKillTab), TAB(ToggleDeleteKillTab), TAB(ToggleSpaceTabs), TAB(ToggleIndentWithTabs), TAB(ToggleBackSpUnindents), TAB(ToggleWordWrap), TAB(ToggleTrim), TAB(ToggleShowMarkers), TAB(ToggleHilitTags), TAB(ToggleShowBookmarks), TAB(ToggleMakeBackups), TAB(SetLeftMargin), TAB(SetRightMargin), TAB(SetPrintDevice), TAB(ChangeTabSize), TAB(ChangeLeftMargin), TAB(ChangeRightMargin), TAB(ToggleSysClipboard), TAB(Cancel), TAB(Activate), TAB(Rescan), TAB(CloseActivate), TAB(ActivateInOtherWindow), TAB(DirGoUp), TAB(DirGoDown), TAB(DirGoRoot), TAB(DirGoto), TAB(DirSearchCancel), TAB(DirSearchNext), TAB(DirSearchPrev), TAB(DeleteFile), TAB(ShowVersion), TAB(ASCIITable), TAB(TypeChar), TAB(CharTrans), TAB(LineTrans), TAB(BlockTrans), TAB(DesktopSave), TAB(DesktopSaveAs), TAB(ChildClose), TAB(BufListFileSave), TAB(BufListFileClose), TAB(BufListSearchCancel), TAB(BufListSearchNext), TAB(BufListSearchPrev), TAB(ViewModeMap), TAB(ClearMessages), TAB(BlockUnTab), TAB(BlockEnTab), TAB(TagFind), TAB(TagFindWord), TAB(TagNext), TAB(TagPrev), TAB(TagPop), TAB(TagLoad), TAB(TagClear), TAB(TagGoto), TAB(BlockMarkFunction), TAB(IndentFunction), TAB(MoveFunctionPrev), TAB(MoveFunctionNext), TAB(Search), TAB(SearchB), TAB(SearchRx), TAB(SearchAgain), TAB(SearchAgainB), TAB(SearchReplace), TAB(SearchReplaceB), TAB(SearchReplaceRx), TAB(InsertDate), TAB(InsertUid), TAB(FrameNew), TAB(FrameClose), TAB(FrameNext), TAB(FramePrev), TAB(ShowHelpWord), TAB(ShowHelp), TAB(ConfigRecompile), TAB(PlaceGlobalBookmark), TAB(RemoveGlobalBookmark), TAB(GotoGlobalBookmark), TAB(MoveBeginOrNonWhite), TAB(MoveBeginLinePageFile), TAB(MoveEndLinePageFile), TAB(PushGlobalBookmark), TAB(PopGlobalBookmark), TAB(SetCIndentStyle), TAB(SetIndentWithTabs), TAB(RunCompiler), TAB(FoldCreateAtRoutines), TAB(LineCenter), TAB(RunProgramAsync), TAB(ListMark), TAB(ListUnmark), TAB(ListToggleMark), TAB(ListMarkAll), TAB(ListUnmarkAll), TAB(ListToggleMarkAll), TAB(Cvs), TAB(RunCvs), TAB(ViewCvs), TAB(ClearCvsMessages), TAB(CvsDiff), TAB(RunCvsDiff), TAB(ViewCvsDiff), TAB(CvsCommit), TAB(RunCvsCommit), TAB(ViewCvsLog), TAB(Svn), TAB(RunSvn), TAB(ViewSvn), TAB(ClearSvnMessages), TAB(SvnDiff), TAB(RunSvnDiff), TAB(ViewSvnDiff), TAB(SvnCommit), TAB(RunSvnCommit), TAB(ViewSvnLog) #if 0 //TAB(ShowMsg), TAB(BlockReadPipe), TAB(BlockWritePipe), TAB(BlockPipe), #endif }; // *INDENT-ON* #endif // CMDTAB_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_svnlog.h������������������������������������������������������������������������������������0000644�0001750�0001750�00000003104�11344266046�012433� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * e_svnlog.h * * S.Pinigin copy o_cvslog.h and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Subclass of EBuffer for writing log for SVN commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #ifndef E_SVNLOG_H #define E_SVNLOG_H #include "e_buffer.h" #ifdef CONFIG_OBJ_SVN class ESvnLog:public EBuffer { public: ESvnLog (int createFlags,EModel **ARoot,char *Directory,char *OnFiles); virtual ~ESvnLog (); // List files into buffer // p - line where to print // fCount - number of files which will be printed // title - title // cnt - total number of files // position - positions of files in list // len - length of files // status - status of files // list - list of filenames // incexc - status of files to print/not to print // exc - incexc is exclusion void ListFiles (int &p,const int fCount,const char *title,const int cnt,const int *position,const int *len,const char *status,const char *list,const char *excinc,const int exc=0); virtual int CanQuit (); virtual int ConfQuit (GxView *V,int multiFile=0); virtual EViewPort *CreateViewPort (EView *V); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; extern ESvnLog *SvnLogView; #endif // CONFIG_OBJ_SVN #endif // E_SVNLOG_H ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_svnlog.cpp����������������������������������������������������������������������������������0000644�0001750�0001750�00000013204�11602724002�012754� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * e_svnlog.cpp * * S.Pinigin copy o_cvslog.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Subclass of EBuffer for writing log for SVN commit. Creates temporary file * used for commit which is deleted when view is closed. Asks for commit or * discard on view close. */ #include "e_svnlog.h" #ifdef CONFIG_OBJ_SVN #include "c_config.h" #include "i_view.h" #include "o_svn.h" #include "s_string.h" #include "sysdep.h" #include <ctype.h> #include <stdio.h> ESvnLog *SvnLogView; ESvnLog::ESvnLog(int createFlags,EModel **ARoot,char *Directory,char *OnFiles) : EBuffer(createFlags,ARoot,NULL) { int i,j,p; char msgFile[MAXPATH]; SvnLogView=this; // Create filename for message #ifdef UNIX // Use this in Unix - it says more to user sprintf(msgFile,"/tmp/fte%d-svn-msg",getpid()); #else tmpnam(msgFile); #endif SetFileName(msgFile,SvnLogMode); // Preload buffer with info InsertLine(0,0, ""); InsertLine(1,60, "SVN: -------------------------------------------------------"); InsertLine(2,59, "SVN: Enter log. Lines beginning with 'SVN:' will be removed"); InsertLine(3,4, "SVN:"); InsertLine(4,18, "SVN: Commiting in "); InsText(4,18,strlen(Directory),Directory); if (OnFiles[0]) { p=5; // Go through files - use GetFileStatus to show what to do with files // First count files int cnt=0;i=0; while (1) { if (OnFiles[i]==0||OnFiles[i]==' ') { while (OnFiles[i]==' ') i++; cnt++; if (!OnFiles[i]) break; } else i++; } int *position=new int[cnt]; int *len=new int[cnt]; char *status=new char[cnt]; // Find out position and status for each file i=j=0;position[0]=0; while (1) { if (OnFiles[i]==0||OnFiles[i]==' ') { // This is not thread-safe! len[j]=i-position[j]; char c=OnFiles[i]; OnFiles[i]=0; status[j]=SvnView->GetFileStatus(OnFiles+position[j]); if (status[j]==0) status[j]='x'; OnFiles[i]=c; while (OnFiles[i]==' ') i++; if (!OnFiles[i]) break; position[++j]=i; } else i++; } // Go through status int fAdded=0,fRemoved=0,fModified=0,fOther=0; for (i=0;i<cnt;i++) switch (toupper(status[i])) { case 'A': fAdded++; break; case 'R': fRemoved++; break; case 'M': fModified++; break; default:fOther++; } // Now list files with given status ListFiles(p, fAdded, "Added", cnt, position, len, status, OnFiles, "Aa"); ListFiles(p, fRemoved, "Removed", cnt, position, len, status, OnFiles, "Rr"); ListFiles(p, fModified, "Modified", cnt, position, len, status, OnFiles, "Mm"); ListFiles(p, fOther, "Other", cnt, position, len, status, OnFiles, "AaRrMm", 1); delete position;delete len;delete status; } else { InsertLine(5,4, "SVN:"); InsertLine(6,30, "SVN: Commiting whole directory"); p=7; } InsertLine(p,4, "SVN:"); InsertLine(p+1,60, "SVN: -------------------------------------------------------"); SetPos(0,0); FreeUndo(); Modified=0; } ESvnLog::~ESvnLog() { SvnLogView=0; } void ESvnLog::ListFiles(int &p,const int fCount,const char *title,const int cnt,const int *position, const int *len,const char *status,const char *list,const char *excinc,const int exc) { if (fCount) { size_t i = strlen(title); InsertLine(p++, 4, "SVN:"); InsertLine(p, 5, "SVN: "); InsText (p,5,i, title); InsText (p,i+=5,5, " file"); i+=5; if (fCount!=1) InsText (p,i++,1, "s"); InsText (p++,i,1, ":"); for (i=0;i<cnt;i++) if (!!strchr(excinc,status[i])^!!exc) { // Should be displayed InsertLine(p,9, "SVN: "); InsText(p,9,1, status+i);InsText (p,10,1, " "); InsText(p++,11,len[i], list+position[i]); } } } // Overridden because we don't want to load file EViewPort *ESvnLog::CreateViewPort(EView *V) { V->Port = new EEditPort(this, V); AddView(V); return V->Port; } int ESvnLog::CanQuit() { return 0; } int ESvnLog::ConfQuit(GxView *V,int /*multiFile*/) { int i; switch (V->Choice(GPC_ERROR,"SVN commit pending",3,"C&ommit","&Discard","&Cancel","")) { case 0: // Commit // First save - this is just try if (Save ()==0) return 0; // Now remove SVN: lines and really save for (i=0;i<RCount;) { PELine l=RLine (i); if (l->Count>=4&&strncmp (l->Chars,"SVN:",4)==0) DelLine (i);else i++; } Save (); // DoneCommit returns 0 if OK return !SvnView->DoneCommit (1); case 1: // Discard SvnView->DoneCommit (0); return 1; case 2: // Cancel default: return 0; } } // Shown in "Closing xxx..." message when closing model void ESvnLog::GetName (char *AName, size_t MaxLen) { strlcpy(AName, "SVN log", MaxLen); } // Shown in buffer list void ESvnLog::GetInfo (char *AInfo, size_t MaxLen) { snprintf(AInfo, MaxLen, "%2d %04d:%03d%cSVN log: %s", ModelNo, 1 + CP.Row, 1 + CP.Col, Modified ? '*' : ' ', FileName); } // Normal and short title (normal for window, short for icon in X) void ESvnLog::GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen) { strlcpy (ATitle, "SVN log", MaxLen); strlcpy (ASTitle, "SVN log", SMaxLen); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/feature.h�������������������������������������������������������������������������������������0000644�0001750�0001750�00000004647�11347737161�012273� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* feature.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ /* some stuff does not yet work */ #ifndef FEATURE_H #define FEATURE_H #ifndef FTE_H #warning Use header file fte.h #endif #define DEFAULT_INTERNAL_CONFIG #undef CONFIG_EMULATE_VI // todo #define CONFIG_CONFIGURABLE #define CONFIG_MOUSE #define CONFIG_CLIPBOARD #define CONFIG_SHELL #define CONFIG_MFRAMES #define CONFIG_MWINDOWS #define CONFIG_MBUFFERS #define CONFIG_MENUS #define CONFIG_SCROLLBARS #define CONFIG_I_SEARCH #define CONFIG_I_ASCII #define CONFIG_HISTORY #define CONFIG_DESKTOP #define CONFIG_BLOCK_STREAM #define CONFIG_BLOCK_COLUMN #define CONFIG_BLOCK_LINE #define CONFIG_IOBLOCKS #define CONFIG_PRINTING #define CONFIG_BOOKMARKS #define CONFIG_WORDWRAP #define CONFIG_ABBREV #define CONFIG_TAGS #define CONFIG_UNDOREDO #define CONFIG_REGEXPS #define CONFIG_FOLDS #undef CONFIG_OBJ_HEXEDIT // todo #undef CONFIG_OBJ_VIEWER // todo #define CONFIG_OBJ_LIST #define CONFIG_OBJ_FILE #ifdef CONFIG_OBJ_LIST #define CONFIG_OBJ_DIRECTORY #define CONFIG_OBJ_ROUTINE #define CONFIG_OBJ_BUFFERS #define CONFIG_OBJ_MESSAGES #define CONFIG_OBJ_CVS #define CONFIG_OBJ_SVN #endif #define CONFIG_SYNTAX_HILIT #define CONFIG_WORD_HILIT #ifdef CONFIG_SYNTAX_HILIT #define CONFIG_INDENT #define CONFIG_HILIT_C #define CONFIG_HILIT_REXX #define CONFIG_HILIT_PERL #define CONFIG_HILIT_ADA #define CONFIG_HILIT_MAKE #define CONFIG_HILIT_IPF #define CONFIG_HILIT_MSG #define CONFIG_HILIT_SH #define CONFIG_HILIT_PASCAL #define CONFIG_HILIT_TEX #define CONFIG_HILIT_FTE #define CONFIG_HILIT_CATBS #define CONFIG_HILIT_SIMPLE #endif #if defined(CONFIG_HILIT_C) #define CONFIG_INDENT_C #endif #if defined(CONFIG_HILIT_SIMPLE) #define CONFIG_INDENT_SIMPLE #endif #if defined(CONFIG_HILIT_REXX) #define CONFIG_INDENT_REXX #endif #define CONFIG_I_COMPLETE #define CONFIG_USE_LOCALE /* Internal keyboard remapping in xfte - CZ support */ //#define CONFIG_HARD_REMAP /* System X11R6 is compiled with X_LOCALE */ //#define X_LOCALE /* Use XtInit */ #define CONFIG_X11_XTINIT /* Drawing fonts with locale support */ #define CONFIG_X11_XMB /* Supply icons in X, requires Xpm library */ #define CONFIG_X11_XICON /* Dissable internal logging mechanism */ #define FTE_NO_LOGGING #define CONFIG_BACKUP #endif // FEATURE_H �����������������������������������������������������������������������������������������./src/o_list.h��������������������������������������������������������������������������������������0000644�0001750�0001750�00000005103�11331412505�012076� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_list.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_LIST_H #define O_LIST_H #include "c_commands.h" #include "o_model.h" #include "c_mode.h" class EList; class EListPort: public EViewPort { public: EList *List; int Row, TopRow, LeftCol; int OldRow, OldTopRow, OldLeftCol, OldCount; EListPort(EList *L, EView *V); virtual ~EListPort(); void StorePos(); void GetPos(); virtual void HandleEvent(TEvent &Event); #ifdef CONFIG_MOUSE virtual void HandleMouse(TEvent &Event); #endif // CONFIG_MOUSE void PaintView(int PaintAll); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); }; class EList: public EModel { public: char *Title; int Row, LeftCol, TopRow, Count; int MouseCaptured; int MouseMoved; int NeedsUpdate, NeedsRedraw; EList(int createFlags, EModel **ARoot, const char *aTitle); virtual ~EList(); virtual EViewPort *CreateViewPort(EView *V); EListPort *GetViewVPort(EView *V); EListPort *GetVPort(); void SetTitle(const char *ATitle); virtual int ExecCommand(ExCommands Command, ExState &State); virtual EEventMap *GetEventMap(); virtual int GetContext(); virtual int BeginMacro(); void HandleEvent(TEvent &Event); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char *FormatLine(int Line); virtual int IsHilited(int Line); virtual int IsMarked(int Line); virtual int Mark(int Line); virtual int Unmark(int Line); int SetPos(int ARow, int ACol); void FixPos(); virtual size_t GetRowLength(int ARow) { return 0; }; virtual void RescanList(); virtual void UpdateList(); virtual void FreeList(); virtual int CanActivate(int Line); virtual int Activate(int No); int MoveLeft(); int MoveRight(); int MoveUp(); int MoveDown(); int MoveLineStart(); int MoveLineEnd(); int MovePageUp(); int MovePageDown(); int ScrollLeft(int Cols); int ScrollRight(int Cols); int ScrollUp(int Rows); int ScrollDown(int Rows); int MovePageStart(); int MovePageEnd(); int MoveFileStart(); int MoveFileEnd(); int Activate(); int Mark(); int Unmark(); int ToggleMark(); int MarkAll(); int UnmarkAll(); int ToggleMarkAll(); int UpdateRows(int minim, int maxim); }; #endif // O_LIST_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_svndiff.cpp���������������������������������������������������������������������������������0000644�0001750�0001750�00000011503�11602724002�013115� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_svndiff.cpp * * S.Pinigin copy o_cvsdiff.cpp and replace cvs/Cvs/CVS to svn/Svn/SVN. * * Class showing output from SVN diff command. Allows copying of lines * to clipboard and allows to jump to lines in real sources. */ #include "o_svndiff.h" #ifdef CONFIG_OBJ_SVN #include "c_bind.h" #include "c_config.h" #include "e_buffer.h" #include "s_util.h" #include "sysdep.h" ESvnDiff *SvnDiffView = 0; ESvnDiff::ESvnDiff(int createFlags, EModel ** ARoot, char *ADir, char *ACommand, char *AOnFiles) : ESvnBase(createFlags, ARoot, "SVN diff"), CurrLine(0), ToLine(0), InToFile(0), CurrFile(0) { SvnDiffView = this; RunPipe(ADir, ACommand, AOnFiles); } ESvnDiff::~ESvnDiff() { SvnDiffView = 0; free(CurrFile); } void ESvnDiff::ParseFromTo(char *line, int /*len */ ) { char* end; // "@@ -1,20 +1,20 @@" // ^ ^^ char* start = strchr(line, '+'); CurrLine = (int)strtol(start, &end, 10) - 1; if(*end == ',') ToLine = CurrLine + atoi(end + 1); else ToLine = CurrLine + 1; if(!(CurrLine < ToLine && ToLine > 0)) CurrLine = ToLine = 0; } //AddLine(0, -1, line); - output only, default color //AddLine(CurrFile, -1, line); - output and tofile, default color //AddLine(CurrFile, CurrLine, line); - output and tofile in line, default color //AddLine(CurrFile, CurrLine, line, 1); - output and tofile in line, color 1 void ESvnDiff::ParseLine(char *line, int len) { if(len > 8 && strncmp(line, "+++ ", 4) == 0) { //"+++ test.txt\t...." free(CurrFile); CurrFile = strdup(line + 4); strtok(CurrFile, " \t"); CurrLine = ToLine = InToFile = 0; AddLine(CurrFile, -1, line); } else { if(len > 8 && strncmp(line, "@@ ", 3) == 0) { // To file or to hunk if(strcmp(line + len - 3, " @@") == 0) { // "@@ -1,20 +1,20 @@" // To hunk if(CurrFile) { ParseFromTo(line, len); AddLine(CurrFile, CurrLine, line, 2); } else { AddLine(0, -1, line); } } else { AddLine(0, -1, line); } } else { if(CurrLine < ToLine) { // Diff line (markable, if CurrFile is set, also hilited) if(*line == '+') { //"+(new line from file)" AddLine(CurrFile, CurrLine, line, 1); CurrLine++; } else { if(*line == '-') { //"-(deleted line from file)" AddLine(0, -1, line); } else { //" (line without change)" AddLine(CurrFile, CurrLine, line); CurrLine++; } } } else { AddLine(0, -1, line); } } } } int ESvnDiff::RunPipe(const char *ADir, const char *ACommand, const char *AOnFiles) { FreeLines(); free(CurrFile); CurrLine = ToLine = InToFile = 0; CurrFile = 0; return ESvnBase::RunPipe(ADir, ACommand, AOnFiles); } int ESvnDiff::ExecCommand(ExCommands Command, ExState & State) { switch (Command) { case ExBlockCopy: return BlockCopy(0); case ExBlockCopyAppend: return BlockCopy(1); default: ; } return EList::ExecCommand(Command, State); } int ESvnDiff::BlockCopy(int Append) { if(SSBuffer == 0) return 0; if(Append) { if(SystemClipboard) GetPMClip(0); } else SSBuffer->Clear(); SSBuffer->BlockMode = bmLine; // How to set these two ? BFI(SSBuffer, BFI_TabSize) = 8; BFI(SSBuffer, BFI_ExpandTabs) = 0; BFI(SSBuffer, BFI_Undo) = 0; // Go through list of marked lines int last = -1; int tl = 0; for(int i = 0; i < LineCount; i++) { if(Lines[i]->Status & 2) { // Marked if(last != i - 1 && tl) { // Gap between this and last marked line SSBuffer->InsLine(tl++, 0); } SSBuffer->InsertLine(tl++, strlen(Lines[i]->Msg + 2), Lines[i]->Msg + 2); last = i; } } if(SystemClipboard) PutPMClip(0); return 1; } // Event map - this name is used in config files when defining eventmap EEventMap* ESvnDiff::GetEventMap() { return FindEventMap("SVNDIFF"); } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_trans.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000014236�11331412503�012600� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_trans.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_history.h" #include "i_modelview.h" #include "i_view.h" #include "o_buflist.h" #include "s_util.h" #include <ctype.h> // FLAW: NULL characters can not be translated, need escaping int ParseTrans(unsigned char *S, unsigned char *D, TransTable tab) { unsigned char Dest[512]; unsigned char A, B; unsigned int i; if (S == 0 || D == 0) return 0; strncpy((char *)Dest, (char *)D, sizeof(Dest) - 1); Dest[sizeof(Dest) - 1] = 0; D = Dest; // no translation for (i = 0; i < 256; i++) tab[i] = (unsigned char)i; while (*S && *D) { if (S[0] && S[1] == '-' && S[2]) { if (S[0] <= S[2]) { A = (*S)++; if (S[0] >= S[2]) S += 2; } else { A = (*S)--; if (S[0] <= S[2]) S += 2; } } else { A = *S++; } if (D[0] && D[1] == '-' && D[2]) { if (D[0] <= D[2]) { B = (*D)++; if (D[0] >= D[2]) D += 2; } else { B = (*D)--; if (D[0] <= D[2]) D += 2; } } else { B = *D++; } tab[A] = B; } if (*S != *D) // one was too short return 0; return 1; } int MakeTrans(TransTable tab, int What) { int i; // no translation for (i = 0; i <= 255; i++) tab[i] = (unsigned char)i; switch (What) { case ccToggle: case ccUp: for (i = 33; i <= 255; i++) if (isalpha(i) && (toupper(i) != i)) tab[i] = (unsigned char) toupper(i); if (What != ccToggle) break; case ccDown: for (i = 33; i <= 255; i++) if (isalpha(i) && (i == tab[i]) && (tolower(i) != i)) tab[i] = (unsigned char) tolower(i); break; default: return 0; } return 1; } int EBuffer::BlockTrans(TransTable tab) { int L, I, B, E; PELine LL; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; for (L = BB.Row; L <= BE.Row; L++) { LL = RLine(L); B = 0; E = 0; switch (BlockMode) { case bmLine: if (L == BE.Row) E = 0; else E = LL->Count; break; case bmColumn: if (L == BE.Row) E = 0; else { B = CharOffset(LL, BB.Col); E = CharOffset(LL, BE.Col); } break; case bmStream: if (L == BB.Row && L == BE.Row) { B = CharOffset(LL, BB.Col); E = CharOffset(LL, BE.Col); } else if (L == BB.Row) { B = CharOffset(LL, BB.Col); E = LL->Count; } else if (L == BE.Row) { B = 0; E = CharOffset(LL, BE.Col); } else { B = 0; E = LL->Count; } break; } if (B > LL->Count) B = LL->Count; if (E > LL->Count) E = LL->Count; if (E > B) { if (ChgChars(L, B, E - B, 0) == 0) return 0; for (I = B; I < E; I++) LL->Chars[I] = tab[(unsigned char)LL->Chars[I]]; } } Draw(BB.Row, BE.Row); return 1; } int EBuffer::CharTrans(TransTable tab) { PELine L = VLine(CP.Row); unsigned int P = CharOffset(L, CP.Col); if (P >= (unsigned int)L->Count) return 0; if (ChgChars(CP.Row, P, 1, 0) == 0) return 0; L->Chars[P] = tab[(unsigned char)L->Chars[P]]; return 1; } int EBuffer::LineTrans(TransTable tab) { PELine L = VLine(CP.Row); int I; if (L->Count > 0) { if (ChgChars(CP.Row, 0, L->Count, 0) == 0) return 0; for (I = 0; I < L->Count; I++) L->Chars[I] = tab[(unsigned char)L->Chars[I]]; } return 1; } int EBuffer::CharCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return CharTrans(tab); } int EBuffer::CharCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return CharTrans(tab); } int EBuffer::CharCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return CharTrans(tab); } int EBuffer::LineCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return LineTrans(tab); } int EBuffer::LineCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return LineTrans(tab); } int EBuffer::LineCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return LineTrans(tab); } int EBuffer::BlockCaseUp() { TransTable tab; MakeTrans(tab, ccUp); return BlockTrans(tab); } int EBuffer::BlockCaseDown() { TransTable tab; MakeTrans(tab, ccDown); return BlockTrans(tab); } int EBuffer::BlockCaseToggle() { TransTable tab; MakeTrans(tab, ccToggle); return BlockTrans(tab); } int EBuffer::GetTrans(ExState &State, TransTable tab) { unsigned char TrS[512] = ""; unsigned char TrD[512] = ""; if (State.GetStrParam(View, (char *)TrS, sizeof(TrS)) == 0) if (View->MView->Win->GetStr("Trans From", sizeof(TrS), (char *)TrS, HIST_TRANS) == 0) return 0; if (State.GetStrParam(View, (char *)TrD, sizeof(TrD)) == 0) if (View->MView->Win->GetStr("Trans To", sizeof(TrS), (char *)TrD, HIST_TRANS) == 0) return 0; if (ParseTrans(TrS, TrD, tab) == 0) { Msg(S_ERROR, "Bad Trans Arguments %s %s.", TrS, TrD); return 0; } return 1; } int EBuffer::CharTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return CharTrans(tab); } int EBuffer::LineTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return LineTrans(tab); } int EBuffer::BlockTrans(ExState &State) { TransTable tab; if (GetTrans(State, tab) == 0) return 0; return BlockTrans(tab); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/o_cvs.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000013510�11344266047�012266� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * o_cvs.cpp * * Contributed by Martin Frydl <frydl@matfyz.cz> * * Class providing access to most of CVS commands. */ #include "o_cvs.h" #ifdef CONFIG_OBJ_CVS #include "i_view.h" #include "e_cvslog.h" #include "o_buflist.h" #include "s_files.h" #include "sysdep.h" #include <stdio.h> static int SameDir(const char *D1, const char *D2) { if (!D1||!D2) return 0; size_t l1=strlen (D1); size_t l2=strlen (D2); if (l1<l2) return strncmp (D1,D2,l1)==0&&strcmp (D2+l1,SSLASH)==0; else if (l1==l2) return !strcmp (D1,D2); else return strncmp (D1,D2,l2)==0&&strcmp (D1+l1,SSLASH)==0; } static const char CvsStatusChars[] = "?UPMCAR"; ECvs *CvsView=0; ECvs::ECvs(int createFlags, EModel **ARoot, char* ADir, char* ACommand, char* AOnFiles) : ECvsBase(createFlags, ARoot, "CVS"), LogFile(0), Commiting(0) { CvsView=this; RunPipe (ADir, ACommand, AOnFiles); } ECvs::ECvs (int createFlags,EModel **ARoot) : ECvsBase (createFlags, ARoot, "CVS"), LogFile(0) { CvsView=this; } ECvs::~ECvs () { CvsView=0; RemoveLogFile (); } void ECvs::RemoveLogFile() { if (LogFile) { unlink (LogFile); free (LogFile); LogFile=0; } } char* ECvs::MarkedAsList() { int i; size_t len=0; // First pass - calculate size for (i=0;i<LineCount;i++) if (Lines[i]->Status&2) len+=strlen (Lines[i]->File)+1; if (len==0) { // Nothing marked, use the file at cursor if (Lines[Row]->Status&4) return strdup (Lines[Row]->File); else return NULL; } char *s=(char *)malloc (len+1); s[0]=0; for (i=0;i<LineCount;i++) if (Lines[i]->Status&2) strcat (strcat (s,Lines[i]->File)," "); s[strlen (s)-1]=0; return s; } char ECvs::GetFileStatus(const char *file) { // Search backward, file can be present several times (old messages) for (int i=LineCount-1;i>=0;i--) if (Lines[i]->File&&filecmp (Lines[i]->File,file)==0) return Lines[i]->Msg[0]; return 0; } void ECvs::ParseLine(char* line, int len) { if (len>2&&line[1]==' '&&strchr (CvsStatusChars,line[0])) { AddLine (line+2,-1,line,5); } else AddLine (0,-1,line); } int ECvs::RunPipe(const char *ADir, const char *ACommand, const char *AOnFiles) { Commiting=0; if (!SameDir (Directory,ADir)) FreeLines (); return ECvsBase::RunPipe (ADir,ACommand,AOnFiles); } void ECvs::ClosePipe() { ECvsBase::ClosePipe (); if (Commiting&&!ReturnCode) { // Successful commit - reload files // Is it safe to do this ? Currently not done, manual reload is needed } Commiting=0; } int ECvs::RunCommit(const char *ADir, const char *ACommand, const char *AOnFiles) { if (!SameDir (Directory,ADir)) FreeLines (); free (Command); free (Directory); free (OnFiles); Command=strdup (ACommand); Directory=strdup (ADir); OnFiles=strdup (AOnFiles); RemoveLogFile (); // Disallow any CVS command while commiting Running=1; // Create message buffer ECvsLog *cvslog=new ECvsLog (0,&ActiveModel,Directory,OnFiles); LogFile=strdup (cvslog->FileName); View->SwitchToModel (cvslog); AddLine (LogFile,-1,"CVS commit start - enter message text",1); return 0; } extern BufferView *BufferList;//!!! int ECvs::DoneCommit(int commit) { Running=0; // Remove line with link to log free (Lines[LineCount-1]->File); free (Lines[LineCount-1]->Msg); LineCount--; UpdateList (); if (commit) { // We need a copy of Command/Directory/OnFiles because RunPipe deletes them! char *ACommand=(char *)malloc (strlen (Command)+strlen (LogFile)+10); char *ADirectory=strdup (Directory); char *AOnFiles=strdup (OnFiles); sprintf (ACommand,"%s -F %s",Command,LogFile); int ret=RunPipe (ADirectory,ACommand,AOnFiles); free (ACommand);free (ADirectory);free (AOnFiles); // We set Commiting after RunPipe since it sets it to 0 // This is OK since FTE is not multi-threaded Commiting=1; if (ActiveView->Model==CvsLogView) { // CvsLogView is currently active, move CvsView just after it if (CvsLogView->Next!=CvsView) { // Need to move, is not at right place yet // Here we use the fact that if current model is closed, // the one just after it (Next) is focused. CvsView->Prev->Next=CvsView->Next; CvsView->Next->Prev=CvsView->Prev; CvsView->Next=CvsLogView->Next; CvsLogView->Next->Prev=CvsView; CvsLogView->Next=CvsView; CvsView->Prev=CvsLogView; } } // else - CvsLogView is not active, there is need to make CvsView // active some other way. However, SwitchToModel() or SelectModel() // calls does not work. Currently I don't know how to do this. !!! return ret; } else { RemoveLogFile(); UpdateList(); return 0; } } // If running, can't be closed without asking int ECvs::CanQuit() { if (Running) return 0;else return 1; } // Ask user if we can close this model int ECvs::ConfQuit(GxView* V, int multiFile) { if (CvsLogView) { // Log is open if (CvsLogView->ConfQuit(V,multiFile)) { // Commit confirmed or discarded - depends on Running ActiveView->DeleteModel(CvsLogView); } else return 0; } if (Running) { // CVS command in progress switch (V->Choice(GPC_ERROR,"CVS command is running",2,"&Kill","&Cancel","")) { case 0: // Kill return 1; case 1: // Cancel default: return 0; } } else return 1; } // Event map - this name is used in config files when defining eventmap EEventMap *ECvs::GetEventMap() { return FindEventMap("CVS"); } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/pmdlg.rc��������������������������������������������������������������������������������������0000644�0001750�0001750�00000012225�07045071613�012100� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* pmdlg */ #include "pmdlg.h" DLGTEMPLATE IDD_FIND BEGIN DIALOG "Find text...", IDD_FIND, 10, 13, 240, 79, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR BEGIN CONTROL "Find", IDL_FIND, 3, 66, 25, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE CONTROL "", IDE_FIND, 37, 20, 198, 55, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Options", 101, 3, 21, 231, 42, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "~Ignore Case", IDC_IGNORECASE, 9, 45, 75, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Rege~xps", IDC_REGEXPS, 9, 34, 77, 11, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Words only", IDC_WORDS, 9, 24, 74, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Block", IDC_BLOCK, 86, 45, 60, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Global", IDC_GLOBAL, 86, 35, 63, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Reverse", IDC_REVERSE, 86, 25, 68, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~All occurences", IDC_ALLOCCURENCES, 155, 45, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Delete line", IDC_DELETELINE, 155, 35, 73, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Join line", IDC_JOINLINE, 155, 25, 75, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE DEFPUSHBUTTON "OK", DID_OK, 3, 3, 51, 14, BS_PUSHBUTTON | BS_DEFAULT | WS_VISIBLE | WS_GROUP | WS_TABSTOP PUSHBUTTON "Cancel", DID_CANCEL, 58, 3, 51, 14 END END DLGTEMPLATE IDD_FINDREPLACE BEGIN DIALOG "Find and replace...", IDD_FINDREPLACE, 9, 27, 240, 91, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR BEGIN CONTROL "Find", IDL_FIND, 4, 78, 29, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE CONTROL "", IDE_FIND, 45, 21, 189, 67, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Replace", IDL_REPLACE, 4, 64, 35, 9, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", IDE_REPLACE, 45, 12, 189, 63, WC_COMBOBOX, CBS_DROPDOWN | LS_HORZSCROLL | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Options", 101, 4, 21, 232, 41, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "~Ignore Case", IDC_IGNORECASE, 9, 45, 77, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Rege~xps", IDC_REGEXPS, 9, 34, 75, 11, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Words only", IDC_WORDS, 9, 24, 77, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Block", IDC_BLOCK, 86, 45, 64, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Global", IDC_GLOBAL, 86, 35, 64, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Reverse", IDC_REVERSE, 86, 25, 68, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~All occurences", IDC_ALLOCCURENCES, 154, 45, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~No prompting", IDC_NOPROMPTING, 154, 35, 72, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE CONTROL "~Join Line", IDC_JOINLINE, 154, 25, 76, 10, WC_BUTTON, BS_AUTOCHECKBOX | WS_VISIBLE | WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", DID_OK, 4, 3, 51, 14, BS_PUSHBUTTON | BS_DEFAULT | WS_VISIBLE | WS_GROUP | WS_TABSTOP PUSHBUTTON "Cancel", DID_CANCEL, 59, 3, 51, 14 END END DLGTEMPLATE IDD_PROMPT BEGIN DIALOG "", IDD_PROMPT, 6, 125, 198, 50, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR BEGIN CONTROL "", IDS_PROMPT, 3, 39, 192, 7, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", IDE_FIELD, 4, 3, 191, 34, WC_COMBOBOX, CBS_DROPDOWN | WS_VISIBLE | WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", DID_OK, 4, 3, 51, 14 PUSHBUTTON "Cancel", DID_CANCEL, 59, 3, 51, 14 END END DLGTEMPLATE IDD_FILEDLG BEGIN DIALOG "", IDD_FILEDLG, 11, -2, 242, 200, FS_DLGBORDER | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SAVEBITS, FCF_TITLEBAR | FCF_SYSMENU BEGIN LTEXT "~Name", DID_FILENAME_TXT, 6, 189, 229, 8, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | NOT WS_GROUP CONTROL "", DID_FILENAME_ED, 5, 143, 234, 45, WC_COMBOBOX, 2 | WS_VISIBLE | WS_GROUP | WS_TABSTOP LTEXT "~Type of file:", DID_FILTER_TXT, 6, 168, 133, 8, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", DID_FILTER_CB, 5, 102, 135, 65, WC_COMBOBOX, 4 | WS_VISIBLE | WS_GROUP | WS_TABSTOP LTEXT "~Drive:", DID_DRIVE_TXT, 145, 168, 91, 8, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", DID_DRIVE_CB, 143, 103, 95, 64, WC_COMBOBOX, 4 | WS_VISIBLE | WS_GROUP | WS_TABSTOP LTEXT "~File:", DID_FILES_TXT, 125, 146, 114, 8, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", DID_FILES_LB, 125, 23, 111, 120, WC_LISTBOX, WS_VISIBLE | WS_TABSTOP LTEXT "Di~rectory:", DID_DIRECTORY_TXT, 5, 146, 110, 8, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP CONTROL "", DID_DIRECTORY_LB, 5, 23, 113, 120, WC_LISTBOX, LS_OWNERDRAW | WS_VISIBLE | WS_TABSTOP CONTROL "Ok", DID_OK, 5, 4, 40, 14, WC_BUTTON, 1024 | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "Cancel", DID_CANCEL, 51, 4, 40, 14, WC_BUTTON, WS_VISIBLE | WS_TABSTOP END END ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_key.h���������������������������������������������������������������������������������������0000644�0001750�0001750�00000001071�11344266047�011721� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_key.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_KEY_H #define I_KEY_H #include "i_oview.h" class ExKey: public ExViewNext { StlString Prompt; TKeyCode Key; char ch; public: ExKey(const char *APrompt); virtual ~ExKey(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); TKeyCode GetKey() const { return Key; } }; #endif // I_KEY_H �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/s_util.cpp������������������������������������������������������������������������������������0000644�0001750�0001750�00000013540�11602724002�012442� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� /* s_util.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "s_util.h" #include "o_buflist.h" #include "s_direct.h" #include "s_files.h" #include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define BUF_SZ (sizeof(FileBuffer)) extern RxNode *CompletionFilter; #ifdef CONFIG_BACKUP // should use DosCopy under OS/2... static int copyfile(char const* f1, char const* f2) { // from F1 to F2 void *buffer; int fd1, fd2; int rd; buffer = FileBuffer; if ((fd1 = open(f1, O_RDONLY | O_BINARY)) == -1) return -1; if ((fd2 = open(f2, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, 0666)) == -1) { close(fd1); return -1; } while ((rd = read(fd1, buffer, BUF_SZ)) > 0) { if (write(fd2, buffer, rd) != rd) { close(fd1); close(fd2); unlink(f2); return -1; } } close(fd2); close(fd1); return 0; } char *MakeBackup(const char *FileName, char *NewName) { // static char NewName[260]; size_t l = strlen(FileName); if (!l) return NULL; /* try 1 */ strcpy(NewName, FileName); strcat(NewName, "~"); if (!IsSameFile(FileName,NewName)) { if (access(NewName, 0) == 0) // Backup already exists? unlink(NewName); // Then delete the file.. if (access(FileName, 0) != 0) // Original found? return NewName; if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; /* file not found */ #endif } /* try 2: 8.3 */ strcpy(NewName, FileName); NewName[l-1] = '~'; if (!IsSameFile(FileName,NewName)) { if (access(NewName, 0) == 0) // Backup exists? unlink(NewName); // Then delete; if (access(FileName, 0) != 0) // Original exists? return NewName; // If not-> return base.. if (copyfile(FileName, NewName) == 0) return NewName; #if 0 if (errno == 2) return NewName; #endif } return NULL; } #endif int GetCharFromEvent(TEvent &E, char *Ch) { *Ch = 0; if (E.Key.Code & kfModifier) return 0; if (kbCode(E.Key.Code) == kbEsc) { *Ch = 27; return 1; } if (kbCode(E.Key.Code) == kbEnter) { *Ch = 13; return 1; } if (kbCode(E.Key.Code) == (kbEnter | kfCtrl)) { *Ch = 10; return 1; } if (kbCode(E.Key.Code) == kbBackSp) { *Ch = 8; return 1; } if (kbCode(E.Key.Code) == (kbBackSp | kfCtrl)) { *Ch = 127; return 1; } if (kbCode(E.Key.Code) == kbTab) { *Ch = 9; return 1; } if (kbCode(E.Key.Code) == kbDel) { *Ch = 127; return 1; } if (keyType(E.Key.Code) == kfCtrl) { *Ch = (char) (E.Key.Code & 0x1F); return 1; } if (isAscii(E.Key.Code)) { *Ch = (char)E.Key.Code; return 1; } return 0; } int CompletePath(const char *Base, char *Match, int Count) { char Name[MAXPATH]; const char *dirp; char *namep; size_t len; int count = 0; char cname[MAXPATH]; int hascname = 0; RxMatchRes RM; FileFind *ff; FileInfo *fi; int rc; if (strcmp(Base, "") == 0) { if (ExpandPath(".", Name, sizeof(Name)) != 0) return -1; } else { if (ExpandPath(Base, Name, sizeof(Name)) != 0) return -1; } // SlashDir(Name); dirp = Name; namep = SepRChr(Name); if (namep == Name) { dirp = SSLASH; namep = Name + 1; } else if (namep == NULL) { namep = Name; dirp = SDOT; } else { *namep = 0; namep++; } len = strlen(namep); strcpy(Match, dirp); SlashDir(Match); cname[0] = 0; ff = new FileFind(dirp, "*", ffDIRECTORY | ffHIDDEN #if defined(USE_DIRENT) | ffFAST // for SPEED #endif ); if (ff == 0) return 0; rc = ff->FindFirst(&fi); while (rc == 0) { const char *dname = fi->Name(); // filter out unwanted files if ((strcmp(dname, ".") != 0) && (strcmp(dname, "..") != 0) && (!CompletionFilter || RxExec(CompletionFilter, dname, strlen(dname), dname, &RM) != 1)) { if (( #if defined(UNIX) strncmp #else // os2, nt, ... strnicmp #endif (namep, dname, len) == 0) && (dname[0] != '.' || namep[0] == '.')) { count++; if (Count == count) { Slash(Match, 1); strcat(Match, dname); if ( #if defined(USE_DIRENT) // for SPEED IsDirectory(Match) #else fi->Type() == fiDIRECTORY #endif ) Slash(Match, 1); } else if (Count == -1) { if (!hascname) { strcpy(cname, dname); hascname = 1; } else { int o = 0; #ifdef UNIX while (cname[o] && dname[o] && (cname[o] == dname[o])) o++; #endif #if defined(OS2) || defined(NT) || defined(DOS) || defined(DOSP32) while (cname[o] && dname[o] && (toupper(cname[o]) == toupper(dname[o]))) o++; #endif cname[o] = 0; } } } } delete fi; rc = ff->FindNext(&fi); } delete ff; if (Count == -1) { Slash(Match, 1); strcat(Match, cname); if (count == 1) SlashDir(Match); } return count; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������./src/log.cpp���������������������������������������������������������������������������������������0000644�0001750�0001750�00000011160�11160327165�011730� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/******************************************************************** The author, Darin McBride, explicitly places this module under the LGPL license. This module must remain free for use, but will not cause software that uses it to be required to be under the GPL or any of its derivitives. ********************************************************************/ #include "log.h" #ifndef FTE_NO_LOGGING #include <time.h> #include <ctype.h> #include "sysdep.h" #if defined(NO_NEW_CPP_FEATURES) #include <iomanip.h> #include <iostream.h> #include <string.h> #include <stdlib.h> #else #include <iomanip> #include <iostream> #include <cstring> #include <cstdlib> using namespace std; #endif /********************************************************************* * * Required variables: * *********************************************************************/ GlobalLog globalLog; GlobalLog::GlobalLog(char const* strLogFile) : m_strLogFile(strdup(strLogFile)), m_bOpened(false) { } bool GlobalLog::OpenLogFile() { if (!m_bOpened && m_strLogFile != NULL) { m_ofsLog.open(m_strLogFile, ios::out /*| ios::text*/ | ios::app /*append*/); if (!m_ofsLog) { m_strLogFile = NULL; m_bOpened = false; } else { m_bOpened = true; //no way with gcc3.0 m_ofsLog.setbuf(NULL, 0); } } return m_bOpened; } // // Operator(): // // useful variable for returning an invalid ofstream to kill off any // output to the logfile with wrong loglevel. static ofstream ofsInvalid; GlobalLog::~GlobalLog() { free(m_strLogFile); } ostream& GlobalLog::operator()() { // Ensure the current file is open: if (!OpenLogFile()) // if it can't be opened, shortcut everything: return ofsInvalid; time_t tNow = time(NULL); struct tm* ptm = localtime(&tNow); char cOldFill = m_ofsLog.fill('0'); m_ofsLog << setw(4) << ptm->tm_year + 1900 << '-' << setw(2) << ptm->tm_mon << '-' << setw(2) << ptm->tm_mday << ' ' << setw(2) << ptm->tm_hour << ':' << setw(2) << ptm->tm_min << ':' << setw(2) << ptm->tm_sec << ' ' << "FTE" << ' '; m_ofsLog.fill(cOldFill); return m_ofsLog; } void GlobalLog::SetLogFile(char const* strNewLogFile) { if (m_strLogFile == NULL || strNewLogFile == NULL || strcmp(m_strLogFile,strNewLogFile) != 0) { free((void*)m_strLogFile); m_strLogFile = strNewLogFile == NULL ? (char *)NULL : strdup(strNewLogFile); m_bOpened = false; } } FunctionLog::FunctionLog(GlobalLog& gl, const char* funcName, unsigned long line) : log(gl), func(funcName), myIndentLevel(++log.indent), indentChar('+') { OutputLine(line) << "Entered function" << ENDLINE; } FunctionLog::~FunctionLog() { indentChar = '+'; OutputLine() << "Exited function" << ENDLINE; --log.indent; } ostream& FunctionLog::RC(unsigned long line) { indentChar = '!'; return OutputLine() << "{" << line << "} Returning rc = "; } ostream& FunctionLog::OutputIndent(ostream& os) { os << FillChar('|', myIndentLevel - 1); //for (int i = 1; i < myIndentLevel; ++i) // os << '|'; os << indentChar << ' '; indentChar = '|'; // reset it to |'s. return os; } ostream& Log__osBinChar(ostream& os, char const& c) { char const cOldFill = os.fill('0'); os << (isprint(c) ? c : '.') << " [0x" << hex << (int)c << dec << "]"; os.fill(cOldFill); return os; } ostream& Log__osFillChar(ostream& os, char const& c, size_t const& len) { for (size_t i = 0; i < len; ++i) os << c; return os; } #define LINE_LENGTH 8 void Log__BinaryData(FunctionLog& LOGOBJNAME, void* bin_data, size_t len, unsigned long line) { for (size_t i = 0; i < len; i += LINE_LENGTH) { ostream& os = LOGOBJNAME.OutputLine(line); size_t j; // as characters for (j = i; j < i + LINE_LENGTH; ++j) { if (j < len) { char const c = ((char*)bin_data)[i+j]; os << (isprint(c) ? c : '.'); } else { os << ' '; } } os << " ["; // as hex values char const cOldFill = os.fill('0'); for (j = i; j < i + LINE_LENGTH; ++j) { if (j < len) { int const c = ((char*)bin_data)[i+j]; if (j != i) os << ','; os << hex << setw(2) << c << dec; } else { os << " "; } } os.fill(cOldFill); os << ']' << ENDLINE; } } #endif // FTE_NO_LOGGING ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/i_modelview.h���������������������������������������������������������������������������������0000644�0001750�0001750�00000001762�11344266047�013133� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* i_modelview.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_MODELVIEW_H #define I_MODELVIEW_H #include "i_oview.h" class EView; class ExModelView: public ExView { EView *View; public: int MouseCaptured; int MouseMoved; ExModelView(EView *AView); virtual ~ExModelView(); virtual void Activate(int gotfocus); virtual EEventMap *GetEventMap(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual int GetContext(); virtual int BeginMacro(); virtual void HandleEvent(TEvent &Event); virtual void UpdateView(); virtual void RepaintView(); virtual void UpdateStatus(); virtual void RepaintStatus(); virtual void Resize(int width, int height); virtual int IsModelView() { return 1; } EView* GetView() { return View; } }; #endif // I_MODELVIEW_H ��������������./src/o_routine.h�����������������������������������������������������������������������������������0000644�0001750�0001750�00000002061�11331412505�012610� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* o_routine.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef O_ROUTINE_H #define O_ROUTINE_H #include "fte.h" #ifdef CONFIG_OBJ_ROUTINE #include "o_list.h" class EBuffer; class RoutineView: public EList { public: EBuffer *Buffer; RoutineView(int createFlags, EModel **ARoot, EBuffer *AB); virtual ~RoutineView(); virtual EEventMap *GetEventMap(); virtual int ExecCommand(ExCommands Command, ExState &State); virtual void DrawLine(PCell B, int Line, int Col, ChColor color, int Width); virtual char* FormatLine(int Line); virtual int Activate(int No); virtual void RescanList(); void UpdateList(); virtual int GetContext(); virtual void GetName(char *AName, size_t MaxLen); virtual void GetInfo(char *AInfo, size_t MaxLen); virtual void GetTitle(char *ATitle, size_t MaxLen, char *ASTitle, size_t SMaxLen); }; #endif #endif // O_ROUTINE_H �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/e_print.cpp�����������������������������������������������������������������������������������0000644�0001750�0001750�00000013072�11344266045�012616� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* e_print.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "c_config.h" #include "o_buflist.h" #include "s_util.h" #include <stdio.h> int EBuffer::BlockPrint() { const char cr = '\r'; const char lf = '\n'; EPoint B, E; int L; int A, Z; PELine LL; FILE *fp; int bc = 0, lc = 0; int error = 0; AutoExtend = 0; if (CheckBlock() == 0) return 0; if (RCount == 0) return 0; B = BB; E = BE; Msg(S_INFO, "Printing to %s...", PrintDevice); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') fp = popen(PrintDevice + 1, "w"); else #endif fp = fopen(PrintDevice, "w"); if (fp == NULL) { Msg(S_INFO, "Failed to write to %s", PrintDevice); return 0; } for (L = B.Row; L <= E.Row; L++) { A = -1; Z = -1; LL = RLine(L); switch (BlockMode) { case bmLine: if (L < E.Row) { A = 0; Z = LL->Count; } break; case bmColumn: if (L < E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } break; case bmStream: if (B.Row == E.Row) { A = CharOffset(LL, B.Col); Z = CharOffset(LL, E.Col); } else if (L == B.Row) { A = CharOffset(LL, B.Col); Z = LL->Count; } else if (L < E.Row) { A = 0; Z = LL->Count; } else if (L == E.Row) { A = 0; Z = CharOffset(LL, E.Col); } break; } if (A != -1 && Z != -1) { if (A < LL->Count) { if (Z > LL->Count) Z = LL->Count; if (Z > A) { if ((int)(fwrite(LL->Chars + A, 1, Z - A, fp)) != Z - A) { error++; break; } else bc += Z - A; } } if (BFI(this, BFI_AddCR) == 1) { if (fwrite(&cr, 1, 1, fp) != 1) { error++; break; } else bc++; } if (BFI(this, BFI_AddLF) == 1) { if (fwrite(&lf, 1, 1, fp) != 1) { error++; break; } else { bc++; lc++; } } if ((lc % 200) == 0) Msg(S_INFO, "Printing, %d lines, %d bytes.", lc, bc); } } if (!error) { fwrite("\f\n", 2, 1, fp); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Printing %d lines, %d bytes.", lc, bc); return 1; } #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Failed to write to %s", PrintDevice); return 0; } int EBuffer::FilePrint() { const char cr = 13; const char lf = 10; int l; FILE *fp; unsigned long ByteCount = 0; int BChars; Msg(S_INFO, "Printing %s to %s...", FileName, PrintDevice); #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') fp = popen(PrintDevice + 1, "w"); else #endif fp = fopen(PrintDevice, "w"); if (fp == NULL) { Msg(S_ERROR, "Error printing %s to %s.", FileName, PrintDevice); return 0; } BChars = 0; for (l = 0; l < RCount; l++) { if ((int) sizeof(FileBuffer) - (BChars + 2) < RLine(l)->Count) { if (BChars) { ByteCount += BChars; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if ((int)(fwrite(FileBuffer, 1, BChars, fp)) != BChars) goto fail; BChars = 0; } } if (RLine(l)->Count > int(sizeof(FileBuffer)) - 2) { assert(BChars == 0); ByteCount += RLine(l)->Count; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if (int(fwrite(RLine(l)->Chars, 1, RLine(l)->Count, fp)) != RLine(l)->Count) goto fail; } else { memcpy(FileBuffer + BChars, RLine(l)->Chars, RLine(l)->Count); BChars += RLine(l)->Count; } if ((l < RCount - 1) || BFI(this, BFI_ForceNewLine)) { assert(int(sizeof(FileBuffer)) >= BChars + 2); if (BFI(this, BFI_AddCR) == 1) FileBuffer[BChars++] = cr; if (BFI(this, BFI_AddLF) == 1) FileBuffer[BChars++] = lf; } } if (BChars) { ByteCount += BChars; Msg(S_INFO, "Printing: %d lines, %d bytes.", l, ByteCount); if ((int)(fwrite(FileBuffer, 1, BChars, fp)) != BChars) goto fail; } BChars = 0; #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); Msg(S_INFO, "Printed %s.", FileName); return 1; fail: if (fp != NULL) { #if !defined(__IBMCPP__) && !defined(__WATCOMC__) if (PrintDevice[0] == '|') pclose(fp); else #endif fclose(fp); } Msg(S_ERROR, "Error printing %s to %s.", FileName, PrintDevice); return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./src/h_msg.cpp�������������������������������������������������������������������������������������0000644�0001750�0001750�00000012130�11344266046�012246� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* h_msg.cpp * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #include "fte.h" #ifdef CONFIG_HILIT_MSG #include "c_bind.h" #include "o_buflist.h" #include <ctype.h> #define hsMSG_Normal 0 #define hsMSG_Header 1 #define hsMSG_Quote 2 #define hsMSG_Tag 3 #define hsMSG_Control 4 int Hilit_MSG(EBuffer *BF, int /*LN*/, PCell B, int Pos, int Width, ELine* Line, hlState& State, hsState *StateMap, int *ECol) { HILIT_VARS(BF->Mode->fColorize->Colors, Line); int is_head = 0, is_quote = 0, is_space = 0, is_tag = 0, is_control = 0; if (Line->Count > 0) { if (State == hsMSG_Header) { if (Line->Chars[0] == ' ' || Line->Chars[0] == '\t') is_head = 1; else State = hsMSG_Normal; } if (State == hsMSG_Normal) { if (Line->Count >= 2 && Line->Chars[0] == '-' && Line->Chars[1] == '-' && (Line->Count == 2 || Line->Chars[2] == ' ')) is_tag = 1; else if (Line->Count >= 2 && Line->Chars[0] == '.' && Line->Chars[1] == '.' && (Line->Count == 2 || Line->Chars[2] == ' ')) is_tag = 1; else if (Line->Count >= 3 && Line->Chars[0] == '-' && Line->Chars[1] == '-' && Line->Chars[2] == '-' && (Line->Count == 3 || Line->Chars[3] == ' ')) is_tag = 1; else if (Line->Count >= 3 && Line->Chars[0] == '.' && Line->Chars[1] == '.' && Line->Chars[2] == '.' && (Line->Count == 3 || Line->Chars[3] == ' ')) is_tag = 1; else if (Line->Count > 10 && memcmp(Line->Chars, " * Origin:", 10) == 0) is_control = 1; else if (Line->Count > 0 && Line->Chars[0] == '\x01') is_control = 1; else for (i = 0; i < Line->Count; i++) { if (i < 30 && Line->Chars[i] == ':' && i < Line->Count - 1 && Line->Chars[i+1] == ' ' && !is_space) { is_head = 1; break; } else if (i < 5 && Line->Chars[i] == '>') { is_quote = 1; break; } else if (Line->Chars[i] == '<' || (Line->Chars[i] == ' ' && i > 0) || Line->Chars[i] == '\t') break; else if (Line->Chars[i] == ' ' || Line->Chars[i] == '\t') is_space = 0; } } } if (is_head) { State = hsMSG_Header; Color = CLR_Header; } else if (is_quote) { State = hsMSG_Quote; Color = CLR_Quotes; } else if (is_tag) { State = hsMSG_Tag; Color = CLR_Tag; } else if (is_control) { State = hsMSG_Control; Color = CLR_Control; } else { State = hsMSG_Normal; Color = CLR_Normal; } ChColor DefColor = Color; #ifdef CONFIG_WORD_HILIT int j = 0; if (BF->Mode->fColorize->Keywords.TotalCount > 0 || BF->GetWordCount() > 0) { /* words have to be hilited, go slow */ for(i = 0; i < Line->Count;) { IF_TAB() else { if (isalpha(*p) || (*p == '_')) { j = 0; while (((i + j) < Line->Count) && (isalnum(Line->Chars[i+j]) || (Line->Chars[i + j] == '_')) ) j++; if (BF->GetHilitWord(Color, Line->Chars + i, j, 1)) ; else { Color = DefColor; } if (StateMap) memset(StateMap + i, State, j); if (B) MoveMem(B, C - Pos, Width, Line->Chars + i, HILIT_CLRD(), j); i += j; len -= j; p += j; C += j; Color = DefColor; continue; } ColorNext(); continue; } } } else #endif // CONFIG_WORD_HILIT if (ExpandTabs) { /* use slow mode */ for (i = 0; i < Line->Count;) { IF_TAB() else { ColorNext(); } } } else { /* fast mode */ if (Pos < Line->Count) { if (Pos + Width < Line->Count) { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, Color, Width); if (StateMap) memset(StateMap, State, Line->Count); } else { if (B) MoveMem(B, 0, Width, Line->Chars + Pos, Color, Line->Count - Pos); if (StateMap) memset(StateMap, State, Line->Count); } } C = Line->Count; } if (State != hsMSG_Header) State = hsMSG_Normal; *ECol = C; return 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./fte.in��������������������������������������������������������������������������������������������0000644�0001750�0001750�00000000611�07275342565�010776� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh if [ ! -f $HOME/.fterc ] then # Is there a .fte/mymain.fte ? If not, create it. if [ ! -f $HOME/.fte/mymain.fte ] then if [ ! -d $HOME/.fte ] then mkdir $HOME/.fte fi cp @@CONFIGDIR@@/mymain.fte $HOME/.fte/mymain.fte fi (cd @@CONFIGDIR@@; @@BINDIR@@/cfte mymain.fte $HOME/.fterc) || exit 1 fi exec @@BINDIR@@/xfte "$@" �����������������������������������������������������������������������������������������������������������������������./doc/����������������������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�11621703701�010416� 5����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/modes.html������������������������������������������������������������������������������������0000644�0001750�0001750�00000024332�07425007230�012420� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Mode Configuration</TITLE></HEAD> <BODY> fte allows each file extension to have a different editing mode. Mode is a collection of editor settings such as keybindings, tab settings, autoindent settings, syntax highlighting,... <P> Syntax of <B>mode</B> command is <P> <PRE> mode NAME { mode settings } mode NAME: PARENT { mode settings } </PRE> <P> Mode with name <I>NAME</I>inherits settings from mode <I>PARENT</I> if parent mode is specified at mode declaration. <P> When editor is searching for a mode to use for a file it will first check if the mode has been overriden by a <A HREF="command.html#ec.FileOpenInMode">FileOpenInMode</A> command or a command line option (<B>-m</B>). <P> Then it will check if the file name matches <A HREF="#ms.FileNameRx">FileNameRx</A> defined in mode declarations. <P> If the mode has still not been found, it will read the first line (max 80 chars) of the file, and attempt to match the <A HREF="#ms.FirstLineRx">FirstLineRx</A> with the first line. <P> If this fails, the editor will use mode specified by <B><A HREF="global.html#gs.DefaultModeName">DefaultModeName</A></B> global setting to load a file. If that mode does not exist, first mode defined in the configuration file will be used. <HR> <H2><A NAME="modesetup">Mode Settings</A></H2> <P> The following settings can be specified for each mode: <H3><A NAME="ms.ExpandTabs">ExpandTabs</A></H3> {0,1} <P> Should be set to 1 if tabs are to be expanded when displayed. Use <A HREF="command.html#ec.ToggleExpandTabs">ToggleExpandTabs</A> command to toggle during editing. <H3><A NAME="ms.TabSize">TabSize</A></H3> {1-32} <P>Tab size when tabs are shown expanded on display. <H3><A NAME="ms.AutoIndent">AutoIndent</A></H3> {0,1} <P>Should be set to 1 if autoindent is to be used. Use <A HREF="command.html#ec.ToggleAutoIndent">ToggleAutoIndent</A> command to toggle it on/off during editing. <H3><A NAME="ms.Insert">Insert</A></H3> {0,1} <P> If set to <B>1</B>, Insert mode is active by default. If set to <B>0</B>, Overwrite mode is active by default. <P> Use <A HREF="command.html#ec.ToggleInsert">ToggleInsert</A> command to toggle it on/off during editing. <H3><A NAME="ms.StripChar">StripChar</A></H3> {ASCII code/-1} <P>This characted will be stripped if it is found the end of any line when the file is being loaded. If it is set to <B>-1</B>, no characted will be stripped. <P>Usually used to strip 13 (CR) characters from DOS text files. <H3><A NAME="ms.LineChar">LineChar</A></H3> {ASCII code/-1} <P>This character is used as a line separator when loading a file. If set to <B>-1</B>, there is no line separator. (<B>WARNING: File will be loaded as one line if LineChar is set to -1</B>). <P>Usually set to 10 (LF) as standard text file line separator. <H3><A NAME="ms.AddCR">AddCR</A></H3> {0,1} <P>If set to <B>1</B>, CR (13, \r) character will be added to end of line when saving. <H3><A NAME="ms.AddLF">AddLF</A></H3> {0,1} <P>If set to <B>1</B>, LF (10, \n) characted will be added to end if line when saving. <H3><A NAME="ms.ForceNewLine">ForceNewLine</A></H3> {0,1} <P>Normally, when saving, the last line is saved without any CR/LF characters. This setting will override that behaviour. <H3><A NAME="ms.Hilit">Hilit</A></H3> {0,1} <P>If set to <B>1</B>, syntax highliting will be active. <H3><A NAME="ms.ShowTabs">ShowTabs</A></H3> {0,1} <P>If set to <B>1</B>, tabs will be visible as circles (EPM-like). <H3><A NAME="ms.IndentMode">IndentMode</A></H3> {PLAIN,C,REXX} <P>Activates the specified smart indent mode. (PLAIN mode specifies no smart audoindenting, just normal autoindent). <H3><A NAME="colorizer">Colorizer</A></H3> Specifies a previously declared <A HREF="#colorizer">colorize</A> mode to use for syntax highlighting in this editing mode. <H3><A NAME="eventmap">EventMap</A></H3> Specify the name of existing eventmap to use for current mode. <H3><A NAME="ms.UndoLimit">UndoLimit</A></H3> {Number} <P>Limit undo to this many recent commands (-1 = unlimited) <H3><A NAME="ms.UndoMoves">UndoMoves</A></H3> {0,1} <P>If set to 1, all cursor movements will be recorded on undo stack. <H3><A NAME="ms.KeepBackups">KeepBackups</A></H3> {0,1} <P>If set to <B>0</B>, backup files will be deleted after a successful save operation. <H3><A NAME="ms.MatchCase">MatchCase</A></H3> {0,1} <P>If set to <B>0</B>, searches will be case insensitive. This can be toggled via <A HREF="command.html#ec.ToggleMatchCase">ToggleMatchCase</A> command when editor is running. <H3><A NAME="ms.BackSpKillTab">BackSpKillTab</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.BackSpace">BackSpace</A> will kill entire tabs instead of converting them to spaces. <H3><A NAME="ms.DeleteKillTab">DeleteKillTab</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.Delete">Delete</A> will kill entire tabs instead of converting them to spaces. <H3><A NAME="ms.BackSpUnindents">BackSpUnindents</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.BackSpace">BackSpace</A> will unindent to previous indentation level if issued on beginning of line. <H3><A NAME="ms.SpaceTabs">SpaceTabs</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.InsertTab">InsertTab</A> command will insert spaces instead of tabs. <H3><A NAME="ms.IndentWithTabs">IndentWithTabs</A></H3> {0,1} <P>If set to 1, indentation will be done using tabs instead of spaces. <H3><A NAME="ms.WordWrap">WordWrap</A></H3> {0,1,2} <P>If set to 1, editor wrap current line when right margin is reached. If set to 2, editor will wrap current paragraph continously. Paragraphs as recognised by <A HREF="command.html#ec.WrapPara">WrapPara</A> command must be separated by blank lines. <H3><A NAME="ms.LeftMargin">LeftMargin</A></H3> {1-xx} <P>Left margin for word wrap (<A HREF="command.html#ec.WrapPara">WrapPara</A> command). <H3><A NAME="ms.RightMargin">RightMargin</A></H3> {1-xx} <P>Right margin for word wrap (<A HREF="command.html#ec.WrapPara">WrapPara</A> command). <H3><A NAME="ms.Trim">Trim</A></H3> {0,1} <P>If set to 1, spaces on the end of line will be trimmed when editing. <H3><A NAME="ms.ShowMarkers">ShowMarkers</A></H3> {0,1} <P>If set to 1, end of line and end of file markers will be shown. <H3><A NAME="ms.CursorTroughTabs">CursorTroughTabs</A></H3> {0,1} <P>If set to 1, editor will allow cursor to be positioned inside tabs. <H3><A NAME="ms.DefFindOpt">DefFindOpt</A></H3> 'options' <P>Default <A HREF="#search.options">search options</A> for <A HREF="command.html#ec.Find">Find</A> command. <H3><A NAME="ms.DefFindReplaceOpt">DefFindReplaceOpt</A></H3> 'options' <P>Default <A HREF="#search.options">search/replace</A> options for <A HREF="command.html#ec.FindReplace">FindReplace</A> command. <H3><A NAME="ms.SaveFolds">SaveFolds</A></H3> {0,1,2} <P>If 0, folds are not saved. If 1, folds are saved at beginning of line, if 2 folds are saved at end of line. <P>Folds are saved as comments in source files, depending on active editing mode. <P> See mode settings <A HREF="#ms.CommentStart">CommentStart</A> and <A HREF="#ms.CommentEnd">CommentEnd</A> for configuration of fold comments. <H3><A NAME="ms.CommentStart">CommentStart</A></H3> "comment-start-string" <P>String that starts comments (for saving folds) <H3><A NAME="ms.CommentEnd">CommentEnd</A></H3> "comment-end-string" <P>String that ends comments <H3><A NAME="ms.AutoHilitParen">AutoHilitParen</A></H3> {0,1} <P>If set to <B>1</B>, editor will automatically highlight the matching bracket if it is visible on screen. This is equivalent to executing <A HREF="command.html#ec.HilitMatchBracket">HilitMatchBracket</A> command. <H3><A NAME="ms.Abbreviations">Abbreviations</A></H3> {0,1} <P>If set to 1, <A HREF="#abbrevs">abbreviation</A> expansion will be active in this mode. <H3><A NAME="ms.BackSpKillBlock">BackSpKillBlock</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.BackSpace">BackSpace</A> command will delete block if it is marked, otherwise it will delete the previous character. <H3><A NAME="ms.DeleteKillBlock">DeleteKillBlock</A></H3> {0,1} <P>If set to 1, <A HREF="command.html#ec.Delete">Delete</A> command will delete block if marked, instead of deleting the character below cursor. <H3><A NAME="ms.PersistentBlocks">PersistentBlocks</A></H3> {0,1} <P>If set to 1, blocks will stay marked even if cursor is moved in the file, if set to 0, block is unmarked as soon as the cursor is moved. <H3><A NAME="ms.InsertKillBlock">InsertKillBlock</A></H3> {0,1} <P>If set to 1, the marked block is deleted when a new character is typed. <H3><A NAME="ms.FileNameRx">FileNameRx</A></H3> "regexp" <P>Must be set to regexp that matches names of files that should be edited in this mode. Has priority over <A HREF="#ms.FirstLineRx">FirstLineRx</A> <H3><A NAME="ms.FirstLineRx">FirstLineRx</A></H3> "regexp" <P>Must be set to regex that matches the first line of files that should be edited in this mode. This is checked only if no <A HREF="#ms.FileNameRx">FileNameRx</A> matches the filename. <H3><A NAME="ms.RoutineRegexp">RoutineRegexp</A></H3> "regexp" <P> Regular expression that matches function header. <P> Used by editor commands: <A HREF="command.html#ec.ListRoutines">ListRoutines</A>, <A HREF="command.html#ec.MoveFunctionPrev">MoveFunctionPrev</A>, <A HREF="command.html#ec.MoveFunctionNext">MoveFunctionNext</A>, <A HREF="command.html#ec.BlockMarkFunction">BlockMarkFunction</A>, <A HREF="command.html#ec.IndentFunction">IndentFunction</A>. <HR> <H2><A NAME="loading">Loading files in various formats</A></H2> <P> Here are settings for loading files in various formats: <P> <DL> <DT>DOS/Win/OS2/NT text files (CR/LF delimited): <DD> <PRE> StripChar 13 LineChar 10 AddCR 1 AddLF 1 </PRE> <BR> <DT>Unix text files (LF delimited): <DD> <PRE> StripChar -1 LineChar 10 AddCR 0 AddLF 1 </PRE> <DT>MAC text files (CR delimited): <DD> <PRE> StripChar -1 LineChar 13 AddCR 1 AddLF 0 </PRE> <DT>Binary files (fixed record length): <DD> <PRE> StripChar -1 LineChar -1 AddCR 0 AddLF 0 LoadMargin 64 ForceNewLine 0 </PRE> </DL> <HR> <H2><A NAME="modes-tabopts">Configuration of Tab options</A></H2> </BODY> </HTML> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/install.html����������������������������������������������������������������������������������0000644�0001750�0001750�00000006202�07045070576�012766� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Installation</TITLE></HEAD> <BODY> This section covers installation and configuration of editor. <H1><A NAME="install-os2">OS/2</A></H1> <H2><A NAME="install-os2-files">Files</A></H2> <P> The following files are included in the archive: <DL> <DT><TT>README</TT> <DD>Release notes, read first! <DT><TT>fte.exe</TT> <DD>Text-mode executable <DT><TT>ftepm.exe</TT> <DD>Presentation Manager executable <DT><TT>fte-def.cnf</TT> <DD>Default compiled configuration file. <DT><TT>fte.inf</TT>, <TT>fte.ipf</TT>, <TT>fte.html</TT>, <TT>fte.txt</TT> <DD>This file, in various formats. <DT><TT>config\*.fte</TT> <DD>Configuration files in source form. <DT><TT>clipserv.exe</TT> <DD>Clipboard server (required for PM clipboard support in text-mode version). <DT><TT>cliputil.exe</TT> <DD>Utility to copy/paste to/from clipboard from command line. <DT><TT>HISTORY</TT> <DD>Revision history. <DT><TT>TODO</TT> <DD>Todo list. <DT><TT>file_id.diz</TT> <DD>Program description for BBS upload. </DL> <H2><A NAME="install-os2-requires">Required files</A></H2> <P> The default configuration files are precompiled into <TT>fte-def.cnf</TT>. This file should be copied to <TT>fte.cnf</TT> for text-mode version, and to <TT>ftepm.cnf</TT> for PM version. Or, you may want to compile your own configuration from source using <I>cfte</I> configuration file compiler. <P> For minimal installation of the text mode version, only <TT>fte.exe</TT> and <TT>fte.cnf</TT> are required. For PM clipboard support <TT>clipserv.EXE</TT> is needed and must be running whenever you wish to use PM clipboard from FTE. <P> To install PM version, <TT>ftepm.exe</TT> and <TT>ftepm.cnf</TT> are needed. <P> To recompile source files, <TT>cfte.exe</TT> and <TT>config\*.fte</TT> files are needed. <P> <P> Place executable files somewhere on your <B>PATH</B>. Compiled configuration files should be located in the same directory as executable and have the same basename with extension <TT>.CNF</TT>. <HR> <H1><A NAME="install-unix">Unix</A></H1> The following files are included in the archive: <DL> <DT><TT>README</TT> <DD>Readme file. <DT><TT>fte</TT> <DD>Linux console-only executable <DT><TT>Xfte</TT> <DD>X11 Xlib executable. <DT><TT>fte-def.cnf</TT> <DD>Default compiled configuration file <DT><TT>fte.html</TT> <DD>Reference manual <DT><TT>config\*.fte</TT> <DD>Configuration files in source form. <DT><TT>HISTORY</TT> <DD>History of changes. <DT><TT>TODO</TT> <DD>Todo list. <DT><TT>file_id.diz</TT> <DD>Program description for BBS upload. <DT><TT>fte-0.38.lsm</TT> <DD>LSM entry for FTE. </DL> <P> The default configuration files are precompiled into <TT>fte-def.cnf</TT>. This file should be copied to <TT>~/.fterc</TT> to be automatically loaded by FTE. You may want to compile your own configuration from source using <I>cfte</I> configuration file compiler. <P> Suggested installation directories: <PRE> /usr/local/bin/fte /usr/local/bin/Xfte /usr/local/bin/cfte /usr/local/etc/fte/system.fterc /usr/local/lib/fte/etc/*.fte /usr/local/lib/fte/lib/fte.html /usr/local/lib/fte/lib/TODO /usr/local/lib/fte/lib/HISTORY /usr/local/lib/fte/lib/README </PRE> </BODY> </HTML> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/colorize.html���������������������������������������������������������������������������������0000644�0001750�0001750�00000014132�07700065715�013144� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Configuration of Syntax Highlighting</TITLE></HEAD> <BODY> Syntax: <PRE> <B>colorize</B> <I>Mode</I>[<B>:</B><I>Parent</I>] <B>{</B> <I><A HREF="#settings">Settings</A></I> <B>}</B> </PRE> <H1><A NAME="settings">Settings</A></H1> <UL> <LI>SyntaxParser <P>Syntax: <PRE> <B>SyntaxParser = "</B><I>Parser</I><B>";</B> </PRE> <P>Activates the specified syntax parser for highlighting mode. Value of <TT><I>Parser</I></TT> can be chosen from:<P> <DL> <DT>PLAIN<DD>No syntax parser, only <A HREF="#hl_keyword">keyword highlighting</A> is available. <DT>SIMPLE<DD><A HREF="#hl_simple">User configurable syntax parser</A> will be defined. <DT>C <DT>REXX <DT>HTML <DT>PERL <DT>MAKE <DT>DIFF<DD>For viewing output of <B>diff</B>. <DT>MERGE<DD>For editing output of <B>rcsmerge</B> (RCS, CVS). <DT>IPF <DT>Ada <DT>MSG<DD>For editing E-Mail, <DT>SH <DT>PASCAL <DT>TEX <DT>FTE <DT>CATBS<DD>For <B>VIEWING ONLY</B> of <B>nroff</B> formatted man-pages (formatted with backspaces). </DL> <P> <LI><A NAME="hl_keyword">Keywords</A> <P>Syntax: <PRE> <B>keyword "</B><A HREF="colors.html"><I>color_specification</I></A><B>" { "</B><I>keyword</I><B>"</B>, ... <B>};</B> </PRE> Multiple keyword sets with different colors can be defined. <P> <LI><A NAME="hl_color">Colors</A> <P>Syntax: <PRE> <B>color { "</B><I>color_name</I><B>", "</B><A HREF="colors.html"><I>color_specification</I></A><B>"</B> ... <B>};</B> </PRE> <P> The following color-names are available, which ones will actually be used depends on the SyntaxParser setting used:<P> <UL> <LI>TODO: make color names dynamic at least for user defined parsers. </UL> </UL> <H1><A NAME="hl_simple">Configurable Syntax Parser</A></H1> <B>This is not fully stabilized yet. Might change in the future.</B> <P> When <B>SyntaxParser</B> is set to "SIMPLE", the following commands can be used to configure the state machine used for parsing the text. <DL> <DT><B>h_state</B> <DD>Defines a new state for the state machine <P> <PRE> <B>h_state</B> <I>state_number</I> <B>{</B> <B>"</B><A HREF="#hl_color"><I>default_color_name</I></A><B>"</B> <B>}</B> </PRE> <B>h_state</B> command takes the following parameters: <P> <DL> <DT><TT><I>state_number</I></TT> <DD>States must be numbered sequentially from 0 without skipping any number. <DT><TT><I>default_color_name</I></TT> <DD>Contains the name of default color used for characters that are not matched by any transition string or keyword. </DL> <P> <DT><B>h_wtype</B> <DD>Specifies the keyword matching parameters for current state. There can be only one <B>h_wtype</B> keyword per state. <PRE> <B>h_wtype {</B> <I>next_state_if_matched</I><B>,</B> <I>next_state_if_not_matched</I><B>,</B> <I>next_state_if_no_keyword</I><B>,</B> <B>"</B><I>state_flags</I><B>",</B> <B>"</B><I>keyword_charset</I><B>"</B> <B>}</B> </PRE> <B>h_wtype</B> takes the following arguments: <P> <DL> <DT><TT><I>next_state_if_matched</I></TT> <DD>The number of the next state if any keyword is matched. Can be -1 to keep current state. <DT><TT><I>next_state_if_not_matched</I></TT> <DD>The number of the next state if no keyword is matched. Can be -1 to keep current state. <DT><TT><I>next_state_if_no_keyword</I></TT> <DD>The number of next state if no keyword is found at all. Can be -1 to keep current state. <DT><TT><I>state_flags</I></TT> <DD>String containing zero or more of the following characters: <P> <DL> <DT><B>i</B> <DD>Keyword matching is performed case-insensitively. </DL> </DL> <P> <DT><B>h_trans</B> <DD>Defines a new state transition for current state. <PRE> <B>h_trans {</B> <I>next_state</I><B>,</B> <I>trans_flags</I><B>,</B> <I>trans_match</I><B>,</B> <I>color_name</I> <B>}</B> </PRE> <P> <B>h_trans</B> command takes the following parameters: <P> <DL> <DT><TT><I>next_state</I></TT> <DD>The number of next state to go if a match is successful. <DT><TT><I>trans_flags</I></TT> <DD>Determines options for matching. Can contain zero or more of the following characters: <P> <DL> <DT><B>^</B> <DD>Matches only at the beginning of the line. <DT><B>$</B> <DD>Matches only at the end of the line. <DT><B>i</B> <DD>Match is case-insensitive. <DT><B>s</B> <DD><TT><I>trans_match</I></TT> is a character set. Matches only if the next character is part of the set. <DT><B>S</B> <DD>Same as 's' but next character must not be part of the set. <DT><B>x</B> <DD><TT><I>trans_match</I></TT> is a regular expression. If some part of expression is enclosed in parentheses, pointer is advanced up to the start of parenthesized match (WARNING: this can cause infinite loops). <DT><B>-</B> <DD>After successfull match, the pointer is not advanced, matching will resume at the same position in next state. (WARNING: this can cause infinite loops). <DT><B>&lt;</B> <DD>The matched character(s) are tagged with current state number. This is important for proper operation of <B><A HREF="command.html#ec.MatchBracket">MatchBracket</A></B> command. MatchBracket will only match braces tagged with same state number. <DT><B>&gt;</B> <DD>The matched character(s) are tagged with next state number. <DT><B>q</B> <DD>On successful match quote the next character (the next character is not used for matching). <DT><B>Q</B> <DD>On successful match quote the end of line (the end of line is not used for matching). </DL> <DT><TT><I>trans_match</I></TT> <DD>When <B>S</B> or <B>s</B> option is used, a character set to be matched. When <B>S</B> or <B>s</B> options are not used, a string to be matched. </DL> <P> <DT><B>h_words</B> <DD>Specifies the set of keywords to match in this state. All characters in keywords must be part of the <TT><I>keyword_charset</I></TT> in <B>h_wtype</B> command for this mode. <P> <PRE> <B>h_words "</B><A HREF="colors.html">color_specification</A><B>" {</B> <B>"</B><I>keyword</I><B>",</B> ... <B>}</B> </PRE> <P> Works the same way as the <B><A HREF="#hl_keyword">keyword</A></B> but keywords are for current state only. <P> Multiple keyword sets with different colors can be defined. <P> '-' can be used for color specifier do use the default keyword color specified in global settings. </DL> </BODY> </HTML> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/regexp.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000007334�07045070603�012610� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Regular Expressions</TITLE></HEAD> <BODY> Regular expressions are a way to specify text patterns when searching for a text in a buffer. Regular expressions consist of normal characters and special operator characters with a special meanings. Operators allow you to anchor matches, match classes of characters, match given pattern several times or match alternate patterns. Operators can be also used to group patterns. <H1><A NAME="regexp-search">Search/Match Operators</A></H1> <DL> <DT><B>\</B> <DD>Quotes the following character. If the following character is not alphanumeric, it will lost it's special meaning, otherwise it will gain a special meaning as described below. <DT><B>\n</B> <DD>Matches a 0x0A (LF) character. <DT><B>\r</B> <DD>Matches a 0x0D (CR) character. <DT><B>\t</B> <DD>Matches a 0x09 (TAB) character. <DT><B>\e</B> <DD>Matches an escape character (0x1B) <DT><B>\s</B> <DD>Matches whitespace (CR, LF, TAB, SPACE) characters. <DT><B>\S</B> <DD>Matches non-whitespace (the reverse of \s) <DT><B>\w</B> <DD>Matches word character [a-zA-Z0-9] <DT><B>\W</B> <DD>Matches non-word character <DT><B>\d</B> <DD>Matches a digit [0-9]. <DT><B>\D</B> <DD>Matches a non-digit. <DT><B>\U</B> <DD>Matches uppercase characters (A-Z) <DT><B>\L</B> <DD>Matches lowercase characters (a-z) <DT><B>\x##</B> <DD>Matches specified hex value (\x0A, \x0D, \x09, etc.) <DT><B>\o###</B> <DD>Matches specified octal value (\o000, \o015, etc.) <DT><B>\N###</B> <DD>Matches specified decimal value (\N000, \N013, \N009, etc.) <DT><B>\C</B> <DD>Starts case sensitive matching. <DT><B>\c</B> <DD>Starts case insensitive matching. <DT><B>^</B> <DD>Match a beginning of line. <DT><B>$</B> <DD>Match an end of line. <DT><B>.</B> <DD>Match any character. <DT><B>&lt;</B> <DD>Match beginning of word (word consists of [A-Za-z0-9]). <DT><B>&gt;</B> <DD>Match end of word. <DT><B>[ ]</B> <DD>Specifies a class of characters ([abc123], [\]\x10], etc). <DT><B>[ - ]</B> <DD>Specified a range of characters ([0-9a-zA-Z_], [0-9], etc) <DT><B>[^ ]</B> <DD>Specifies complement class ([^a-z], [^\-], etc) <DT><B>?</B> <DD>Matches preceeding pattern optionally (a?bc, filename\.?, $?, etc) <DT><B>|</B> <DD>Matches preceeding or next pattern (a|b, c|d, abc|d). Only one character will be used as pattern unless grouped together using {} or (). <DT><B>*</B> <DD>Match zero or more occurances of preceeding pattern. Matching is greedy and will match as much as possible. <DT><B>+</B> <DD>Match one or more occurances of preceeding pattern. Match is greedy. <DT><B>@</B> <DD>Match zero or more occurances of preceeding pattern. Matching is non-greedy and will match as little as possible without causing the rest of the pattern match to fail. <DT><B>#</B> <DD>Match one or more occurances of preceeding pattern. Matching is non-greedy. <DT><B>{ }</B> <DD>Group patterns together to form complex pattern. ( {abc}, {abc}|{cde}, {abc}?, {word}?) <DT><B>( )</B> <DD>Group patterns together to form complex pattern. Also used to save the matched substring into the register which can be used for substitution operation. Up to 9 registers can be used. </DL> <H1><A NAME="regexp-replace">Replacement Operators</A></H1> <DL> <DT><B>\</B> <DD>Causes the next character to lose it's special meaning. <DT><B>\n</B> <DD>Inserts a 0x0A (LF) character. <DT><B>\r</B> <DD>Inserts a 0x0D (CR) character. <DT><B>\t</B> <DD>Inserts a 0x09 (TAB) character. <DT><B>\1 to \9</B> <DD>Recalls stored substrings from registers (\1, \2, \3, to \9). <DT><B>\0</B> <DD>Recalls entire matched pattern. <DT><B>\u</B> <DD>Convert next character to uppercase <DT><B>\l</B> <DD>Convert next character to lowercase <DT><B>\U</B> <DD>Convert to uppercase till \E or \e <DT><B>\L</B> <DD>Convert to lowercase till \E or \e </DL> </BODY> </HTML> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/INDEX�����������������������������������������������������������������������������������������0000644�0001750�0001750�00000000242�07045070576�011222� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������about.html install.html cmdopt.html cfgfiles.html global.html events.html modes.html regexp.html status.html colorize.html colors.html command.html perftips.html ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/status.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000001216�07045070603�012632� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Status Line</TITLE></HEAD> <BODY> <P>Status line displays the following status information: <P><B>position|flags|mode|curchar|mod? filename|winno</B> <P><B>position</B> = line:column <P><B>flags</B> <DL> <DT>I<DD>Insert <DT>A<DD>Autoindent <DT>C<DD>Matches are case sensitive <DT>SLC<DD>Stream, Line, Column block-mode <DT>wW<DD>Automatic word wrap active (w = line, W = paragraph). </DL> <P><B>mode</B> = Mode name as specified in configuration file <P><B>curchar</B> = Decimal ASCII code of character under cursor, or EOL/EOF <P><B>mod?</B> = <B>*</B> if file was modified, <B>%</B> if file is read-only </BODY> </HTML> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/cfgfiles.html���������������������������������������������������������������������������������0000644�0001750�0001750�00000004224�07045070530�013072� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Configuration Files</TITLE></HEAD> <BODY> FTE configuration files are version specific, and must be recompiled with each new version of the editor. <P>On startup, editor will attempt to load a configuration file with the basename as the executable and extension <TT>.CNF</TT>. The configuration file is produced by compiling source files with <I>CFTE</I>. <P>If the command line option <TT>-!</TT> is used, editor will not attempt to load a configuration file and will use default built-in settings. <H1><A NAME="config-compiling">Compiling configuration</A></H1> <P>Configuration files are compiled using <I>CFTE</I> program. <P> <I>cfte</I> should be invoked on <TT>main.fte</TT>, for example: <PRE> [C:\FTE] cfte config\main.fte $ cfte config/main.fte </PRE> <P>This will automatically compile all <TT>*.fte</TT> files included from <TT>main.fte</TT> and produce <TT>fte-new.cnf</TT> if there are no errors in source files. <P>When configuration source files are sucessfully compiled, the resulting file <TT>fte-new.cnf</TT> should be copied to <TT>fte.cnf</TT> and <TT>ftepm.cnf</TT>, or under Unix to <TT>~/.fterc</TT> <P>After FTE is properly configured with the above procedure, you can select Options/Recompile Configuration from FTE menu bar, and FTE will invoke <I>CFTE</I> to recompile the configuration. <H1><A NAME="config-syntax">Configuration file syntax</A></H1> <P> Comments start with character <TT>#</TT> and last until the end of line. <P> Strings can be specified using any of <TT>' " /</TT> characters. <P> Single quoted strings perform no substitution. To enter <TT>'</TT> or <TT>\</TT> into a string precede it with a backslash. <P> Double quoted strings perform the following substitutions: <PRE> \t -> ^I, tab character \r -> ^M, CR \n -> ^J, LF \e -> ^[, escape character \v -> ^L, vertical tab \b -> ^H, backspace \a -> ^G, bell </PRE> <P> Strings started by <TT>/</TT> character require no escaping (except for '/'). Mostly useful for specifying <A HREF="regexp.html">regular expressions</A> without double backslashes that are necessary in single and double quoted strings. </BODY> </HTML> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/command.html����������������������������������������������������������������������������������0000644�0001750�0001750�00000235134�11326137317�012740� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD> <TITLE>Macro Commands</TITLE> </HEAD> <BODY> <UL> <LI><A HREF="#cmd_cursor">Cursor Movement</A> <LI><A HREF="#cmd_delete">Deleting Text</A> <LI><A HREF="#cmd_line">Line Commands</A> <LI><A HREF="#cmd_block">Block Commands</A> <LI><A HREF="#cmd_edit">Text Editing and Insertion</A> <LI><A HREF="#cmd_fold">Folding Text</A> <LI><A HREF="#cmd_bookmark">Bookmarks</A> <LI><A HREF="#cmd_trans">Character Translation</A> <LI><A HREF="#cmd_file">File Commands</A> <LI><A HREF="#cmd_directory">Directory Commands</A> <LI><A HREF="#cmd_search">Search and Replace</A> <LI><A HREF="#cmd_window">Window Commands</A> <LI><A HREF="#cmd_compile">Compiler Support</A> <LI><A HREF="#cmd_cvs">CVS Support</A> <LI><A HREF="#cmd_svn">SVN Support</A> <LI><A HREF="#cmd_tags">TAGS Commands</A> <LI><A HREF="#cmd_option">Option commands</A> <LI><A HREF="#cmd_other">Other commands</A> </UL> <HR><H1><A NAME="cmd_cursor">Cursor Movement</A></H1> <UL> <LI><A HREF="#ec.MoveDown">MoveDown</A> <LI><A HREF="#ec.MoveUp">MoveUp</A> <LI><A HREF="#ec.MoveLeft">MoveLeft</A> <LI><A HREF="#ec.MoveRight">MoveRight</A> <LI><A HREF="#ec.MovePrev">MovePrev</A> <LI><A HREF="#ec.MoveNext">MoveNext</A> <LI><A HREF="#ec.MoveWordLeft">MoveWordLeft</A> <LI><A HREF="#ec.MoveWordRight">MoveWordRight</A> <LI><A HREF="#ec.MoveWordPrev">MoveWordPrev</A> <LI><A HREF="#ec.MoveWordNext">MoveWordNext</A> <LI><A HREF="#ec.MoveWordEndLeft">MoveWordEndLeft</A> <LI><A HREF="#ec.MoveWordEndRight">MoveWordEndRight</A> <LI><A HREF="#ec.MoveWordEndPrev">MoveWordEndPrev</A> <LI><A HREF="#ec.MoveWordEndNext">MoveWordEndNext</A> <LI><A HREF="#ec.MoveWordOrCapLeft">MoveWordOrCapLeft</A> <LI><A HREF="#ec.MoveWordOrCapRight">MoveWordOrCapRight</A> <LI><A HREF="#ec.MoveWordOrCapPrev">MoveWordOrCapPrev</A> <LI><A HREF="#ec.MoveWordOrCapNext">MoveWordOrCapNext</A> <LI><A HREF="#ec.MoveWordOrCapEndLeft">MoveWordOrCapEndLeft</A> <LI><A HREF="#ec.MoveWordOrCapEndRight">MoveWordOrCapEndRight</A> <LI><A HREF="#ec.MoveWordOrCapEndPrev">MoveWordOrCapEndPrev</A> <LI><A HREF="#ec.MoveWordOrCapEndNext">MoveWordOrCapEndNext</A> <LI><A HREF="#ec.MoveLineStart">MoveLineStart</A> <LI><A HREF="#ec.MoveLineEnd">MoveLineEnd</A> <LI><A HREF="#ec.MovePageStart">MovePageStart</A> <LI><A HREF="#ec.MovePageEnd">MovePageEnd</A> <LI><A HREF="#ec.MovePageUp">MovePageUp</A> <LI><A HREF="#ec.MovePageDown">MovePageDown</A> <LI><A HREF="#ec.MoveFileStart">MoveFileStart</A> <LI><A HREF="#ec.MoveFileEnd">MoveFileEnd</A> <LI><A HREF="#ec.MovePageLeft">MovePageLeft</A> <LI><A HREF="#ec.MovePageRight">MovePageRight</A> <LI><A HREF="#ec.MoveBlockStart">MoveBlockStart</A> <LI><A HREF="#ec.MoveBlockEnd">MoveBlockEnd</A> <LI><A HREF="#ec.MoveFirstNonWhite">MoveFirstNonWhite</A> <LI><A HREF="#ec.MoveLastNonWhite">MoveLastNonWhite</A> <LI><A HREF="#ec.MovePrevEqualIndent">MovePrevEqualIndent</A> <LI><A HREF="#ec.MoveNextEqualIndent">MoveNextEqualIndent</A> <LI><A HREF="#ec.MovePrevTab">MovePrevTab</A> <LI><A HREF="#ec.MoveNextTab">MoveNextTab</A> <LI><A HREF="#ec.MoveTabStart">MoveTabStart</A> <LI><A HREF="#ec.MoveTabEnd">MoveTabEnd</A> <LI><A HREF="#ec.MoveLineTop">MoveLineTop</A> <LI><A HREF="#ec.MoveLineCenter">MoveLineCenter</A> <LI><A HREF="#ec.MoveLineBottom">MoveLineBottom</A> <LI><A HREF="#ec.ScrollLeft">ScrollLeft</A> <LI><A HREF="#ec.ScrollRight">ScrollRight</A> <LI><A HREF="#ec.ScrollDown">ScrollDown</A> <LI><A HREF="#ec.ScrollUp">ScrollUp</A> <LI><A HREF="#ec.MoveFoldTop">MoveFoldTop</A> <LI><A HREF="#ec.MoveFoldPrev">MoveFoldPrev</A> <LI><A HREF="#ec.MoveFoldNext">MoveFoldNext</A> <LI><A HREF="#ec.MoveBeginOrNonWhite">MoveBeginOrNonWhite</A> <LI><A HREF="#ec.MoveBeginLinePageFile">MoveBeginLinePageFile</A> <LI><A HREF="#ec.MoveEndLinePageFile">MoveEndLinePageFile</A> <LI><A HREF="#ec.MoveToLine">MoveToLine</A> <LI><A HREF="#ec.MoveToColumn">MoveToColumn</A> <LI><A HREF="#ec.MoveSavedPosCol">MoveSavedPosCol</A> <LI><A HREF="#ec.MoveSavedPosRow">MoveSavedPosRow</A> <LI><A HREF="#ec.MoveSavedPos">MoveSavedPos</A> <LI><A HREF="#ec.SavePos">SavePos</A> <LI><A HREF="#ec.MovePrevPos">MovePrevPos</A> </UL> <P><B>SEE ALSO:</B> <A HREF="modes.html#ms.CursorTroughTabs">CursorTroughTabs</A>, <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.MoveDown">MoveDown</A></H2> Move cursor to next line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveUp">MoveUp</A></H2> Move cursor to previous line <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLeft">MoveLeft</A></H2> Move cursor to previous column. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveRight">MoveRight</A></H2> Move cursor to next column. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePrev">MovePrev</A></H2> Move cursor to previous character. Moves to end of the previous line if cursor is at the beginning of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveNext">MoveNext</A></H2> Move cursor to next character. Moves to the beginning of next line if cursor is at the end of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordLeft">MoveWordLeft</A></H2> Move cursor to the beginning of the word on the left. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordRight">MoveWordRight</A></H2> Move cursor to the beginning of the word on the right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordPrev">MoveWordPrev</A></H2> Move cursor to the beginning of the previous word. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordNext">MoveWordNext</A></H2> Move cursor to the beginning of the next word. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordEndLeft">MoveWordEndLeft</A></H2> Move cursor to the end of the previous word. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordEndRight">MoveWordEndRight</A></H2> Move cursor to the end of the word on the right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordEndPrev">MoveWordEndPrev</A></H2> Move cursor to the end of the previous word. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordEndNext">MoveWordEndNext</A></H2> Move cursor to the end of the next word. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapLeft">MoveWordOrCapLeft</A></H2> Move cursor to the beginning of the word or capital letter on the right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapRight">MoveWordOrCapRight</A></H2> Move cursor to the beginning of the word or capital letter on the left. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapPrev">MoveWordOrCapPrev</A></H2> Move cursor to the beginning of the previous word or to previous capital letter. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapNext">MoveWordOrCapNext</A></H2> Move cursor to the beginning of the next word or to next capital letter. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapEndLeft">MoveWordOrCapEndLeft</A></H2> Move cursor to the end of the word or capitals on the left. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapEndRight">MoveWordOrCapEndRight</A></H2> Move cursor to the end of the word or capitals on the right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapEndPrev">MoveWordOrCapEndPrev</A></H2> Move cursor to the end of the previous word or capitals. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveWordOrCapEndNext">MoveWordOrCapEndNext</A></H2> Move cursor to the end of the next word or capitals. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLineStart">MoveLineStart</A></H2> Move cursor to the beginning of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLineEnd">MoveLineEnd</A></H2> Move cursor to the end of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageStart">MovePageStart</A></H2> Move cursor to the first line on current page. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageEnd">MovePageEnd</A></H2> Move cursor to the last line on currently page. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageUp">MovePageUp</A></H2> Display previous page. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageDown">MovePageDown</A></H2> Display next page. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFileStart">MoveFileStart</A></H2> Move cursor to the beginning of file. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFileEnd">MoveFileEnd</A></H2> Move cursor to the end of file. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageLeft">MovePageLeft</A></H2> Scroll horizontally to display page on the left. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePageRight">MovePageRight</A></H2> Scroll horizontally to display page on the right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveBlockStart">MoveBlockStart</A></H2> Move cursor to the beginning of block. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveBlockEnd">MoveBlockEnd</A></H2> Move cursor to end beginning of block. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFirstNonWhite">MoveFirstNonWhite</A></H2> Move cursor to the first non-blank character on line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLastNonWhite">MoveLastNonWhite</A></H2> Move cursor to the last non-blank character on line. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePrevEqualIndent">MovePrevEqualIndent</A></H2> Move cursor to the previous line with equal indentation. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveNextEqualIndent">MoveNextEqualIndent</A></H2> Move cursor to the next line with equal indentation. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePrevTab">MovePrevTab</A></H2> Move cursor to the previous tab position. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveNextTab">MoveNextTab</A></H2> Move cursor to the next tab position. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveTabStart">MoveTabStart</A></H2> When cursor is on the tab characters, moves it to the beginning of the tab. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveTabEnd">MoveTabEnd</A></H2> When cursor is on the tab characters, moves it to the end of the tab. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLineTop">MoveLineTop</A></H2> Scroll the file to make the current line appear on the top of the window. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLineCenter">MoveLineCenter</A></H2> Scroll the file to make the current line appear on the center of the window. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveLineBottom">MoveLineBottom</A></H2> Scroll the file to make the current line appear on the bottom of the window. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.ScrollLeft">ScrollLeft</A></H2> Scroll screen left. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.ScrollRight">ScrollRight</A></H2> Scroll screen right. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.ScrollDown">ScrollDown</A></H2> Scroll screen down. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.ScrollUp">ScrollUp</A></H2> Scroll screen up. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFoldTop">MoveFoldTop</A></H2> Move to the beginning of current fold. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFoldPrev">MoveFoldPrev</A></H2> Move to the beginning of previous fold. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveFoldNext">MoveFoldNext</A></H2> Move to the beginning of next fold. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveBeginOrNonWhite">MoveBeginOrNonWhite</A></H2> Move to beginning of line, or to first non blank character <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveBeginLinePageFile">MoveBeginLinePageFile</A></H2> Move to the beginning of line. If there already, move to the beginning page. If there already, move to the beginning of file. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveEndLinePageFile">MoveEndLinePageFile</A></H2> Move to the end of line. If there already, move to the end page. If there already, move to the end of file. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveToLine">MoveToLine</A></H2> Move to line number given as argument <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveToColumn">MoveToColumn</A></H2> Move to column given as argument <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveSavedPosCol">MoveSavedPosCol</A></H2> Move to column from saved position <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveSavedPosRow">MoveSavedPosRow</A></H2> Move to line from saved position <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MoveSavedPos">MoveSavedPos</A></H2> Move to saved position <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.SavePos">SavePos</A></H2> Save current cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H2><A NAME="ec.MovePrevPos">MovePrevPos</A></H2> Move to last cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>.<HR><H1><A NAME="cmd_delete">Deleting Text</A></H1> <UL> <LI><A HREF="#ec.KillLine">KillLine</A> <LI><A HREF="#ec.KillChar">KillChar</A> <LI><A HREF="#ec.KillCharPrev">KillCharPrev</A> <LI><A HREF="#ec.KillWord">KillWord</A> <LI><A HREF="#ec.KillWordPrev">KillWordPrev</A> <LI><A HREF="#ec.KillWordOrCap">KillWordOrCap</A> <LI><A HREF="#ec.KillWordOrCapPrev">KillWordOrCapPrev</A> <LI><A HREF="#ec.KillToLineStart">KillToLineStart</A> <LI><A HREF="#ec.KillToLineEnd">KillToLineEnd</A> <LI><A HREF="#ec.KillBlock">KillBlock</A> <LI><A HREF="#ec.KillBlockOrChar">KillBlockOrChar</A> <LI><A HREF="#ec.KillBlockOrCharPrev">KillBlockOrCharPrev</A> <LI><A HREF="#ec.Delete">Delete</A> <LI><A HREF="#ec.BackSpace">BackSpace</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.KillLine">KillLine</A></H2> Delete current line. If the line is the last line in the file, only the text is deleted. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillChar">KillChar</A></H2> Delete character under (after) cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillCharPrev">KillCharPrev</A></H2> Delete character before cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillWord">KillWord</A></H2> Delete the word after cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillWordPrev">KillWordPrev</A></H2> Delete the word before cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillWordOrCap">KillWordOrCap</A></H2> Delete word or capitals after cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillWordOrCapPrev">KillWordOrCapPrev</A></H2> Delete word or capitals before cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillToLineStart">KillToLineStart</A></H2> Delete characters to the beginning of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillToLineEnd">KillToLineEnd</A></H2> Delete characters to the end of line. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillBlock">KillBlock</A></H2> Delete block. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillBlockOrChar">KillBlockOrChar</A></H2> If block is marked, delete it, otherwise delete character under cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.KillBlockOrCharPrev">KillBlockOrCharPrev</A></H2> If block is marked, delete it, otherwise delete character before cursor. <P><B>SEE ALSO:</B> <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.Delete">Delete</A></H2> Delete character under (after) cursor. <P><B>SEE ALSO:</B> <A HREF="modes.html#ms.DeleteKillTab">DeleteKillTab</A>, <A HREF="modes.html#ms.DeleteKillBlock">DeleteKillBlock</A>, <A HREF="#cmd_delete">Deleting Text</A>.<HR><H2><A NAME="ec.BackSpace">BackSpace</A></H2> Delete character before cursor. <P><B>SEE ALSO:</B> <A HREF="modes.html#ms.BackSpKillTab">BackSpKillTab</A>, <A HREF="modes.html#ms.BackSpKillBlock">BackSpKillBlock</A>, <A HREF="#cmd_delete">Deleting Text</A>.<HR><H1><A NAME="cmd_line">Line Commands</A></H1> <UL> <LI><A HREF="#ec.LineInsert">LineInsert</A> <LI><A HREF="#ec.LineAdd">LineAdd</A> <LI><A HREF="#ec.LineSplit">LineSplit</A> <LI><A HREF="#ec.LineJoin">LineJoin</A> <LI><A HREF="#ec.LineNew">LineNew</A> <LI><A HREF="#ec.LineIndent">LineIndent</A> <LI><A HREF="#ec.LineTrim">LineTrim</A> <LI><A HREF="#ec.LineDuplicate">LineDuplicate</A> <LI><A HREF="#ec.LineCenter">LineCenter</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.LineInsert">LineInsert</A></H2> Insert a new line before the current one. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineAdd">LineAdd</A></H2> Add a new line after the current one. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineSplit">LineSplit</A></H2> Split current line after cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineJoin">LineJoin</A></H2> Join current line with next one. If cursor is positioned beyond the end of line, the current line is first padded with whitespace. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineNew">LineNew</A></H2> Append a new line and move to the beginning of new line. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineIndent">LineIndent</A></H2> Reindent current line. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineTrim">LineTrim</A></H2> Trim whitespace at the end of current line. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineDuplicate">LineDuplicate</A></H2> Duplicate the current line. <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H2><A NAME="ec.LineCenter">LineCenter</A></H2> Center the current line <P><B>SEE ALSO:</B> <A HREF="#cmd_line">Line Commands</A>.<HR><H1><A NAME="cmd_block">Block Commands</A></H1> <UL> <LI><A HREF="#ec.BlockBegin">BlockBegin</A> <LI><A HREF="#ec.BlockEnd">BlockEnd</A> <LI><A HREF="#ec.BlockUnmark">BlockUnmark</A> <LI><A HREF="#ec.BlockCut">BlockCut</A> <LI><A HREF="#ec.BlockCopy">BlockCopy</A> <LI><A HREF="#ec.BlockCutAppend">BlockCutAppend</A> <LI><A HREF="#ec.BlockCopyAppend">BlockCopyAppend</A> <LI><A HREF="#ec.BlockClear">BlockClear</A> <LI><A HREF="#ec.BlockPaste">BlockPaste</A> <LI><A HREF="#ec.BlockKill">BlockKill</A> <LI><A HREF="#ec.BlockIndent">BlockIndent</A> <LI><A HREF="#ec.BlockUnindent">BlockUnindent</A> <LI><A HREF="#ec.BlockMarkStream">BlockMarkStream</A> <LI><A HREF="#ec.BlockMarkLine">BlockMarkLine</A> <LI><A HREF="#ec.BlockMarkColumn">BlockMarkColumn</A> <LI><A HREF="#ec.BlockExtendBegin">BlockExtendBegin</A> <LI><A HREF="#ec.BlockExtendEnd">BlockExtendEnd</A> <LI><A HREF="#ec.BlockReIndent">BlockReIndent</A> <LI><A HREF="#ec.BlockSelectWord">BlockSelectWord</A> <LI><A HREF="#ec.BlockSelectLine">BlockSelectLine</A> <LI><A HREF="#ec.BlockSelectPara">BlockSelectPara</A> <LI><A HREF="#ec.BlockPasteStream">BlockPasteStream</A> <LI><A HREF="#ec.BlockPasteLine">BlockPasteLine</A> <LI><A HREF="#ec.BlockPasteColumn">BlockPasteColumn</A> <LI><A HREF="#ec.BlockPrint">BlockPrint</A> <LI><A HREF="#ec.BlockRead">BlockRead</A> <LI><A HREF="#ec.BlockReadStream">BlockReadStream</A> <LI><A HREF="#ec.BlockReadLine">BlockReadLine</A> <LI><A HREF="#ec.BlockReadColumn">BlockReadColumn</A> <LI><A HREF="#ec.BlockWrite">BlockWrite</A> <LI><A HREF="#ec.BlockSort">BlockSort</A> <LI><A HREF="#ec.BlockSortReverse">BlockSortReverse</A> <LI><A HREF="#ec.BlockUnTab">BlockUnTab</A> <LI><A HREF="#ec.BlockEnTab">BlockEnTab</A> <LI><A HREF="#ec.BlockMarkFunction">BlockMarkFunction</A> <LI><A HREF="#ec.BlockTrim">BlockTrim</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BlockBegin">BlockBegin</A></H2> Set block beginning to current position. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockEnd">BlockEnd</A></H2> Set block end to current position. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockUnmark">BlockUnmark</A></H2> Unmark block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockCut">BlockCut</A></H2> Cut selected block to clipboard. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockCopy">BlockCopy</A></H2> Copy selected block to clipboard. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockCutAppend">BlockCutAppend</A></H2> Cut selected block and append it to clipboard. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockCopyAppend">BlockCopyAppend</A></H2> Append selected block to clipboard. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockClear">BlockClear</A></H2> Clear selected block <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockPaste">BlockPaste</A></H2> Paste clipboard to current position. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockKill">BlockKill</A></H2> Delete selected text. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockIndent">BlockIndent</A></H2> Indent block by 1 character. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockUnindent">BlockUnindent</A></H2> Unindent block by 1 character. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockMarkStream">BlockMarkStream</A></H2> Start/stop marking stream block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockMarkLine">BlockMarkLine</A></H2> Start/stop marking line block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockMarkColumn">BlockMarkColumn</A></H2> Start/stop marking column block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockExtendBegin">BlockExtendBegin</A></H2> Start extending selected block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockExtendEnd">BlockExtendEnd</A></H2> Stop extending selected block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockReIndent">BlockReIndent</A></H2> Reindent entire block (C/REXX mode) <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockSelectWord">BlockSelectWord</A></H2> Select word under cursor as block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockSelectLine">BlockSelectLine</A></H2> Select current line as block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockSelectPara">BlockSelectPara</A></H2> Select current paragraph (delimited by blank lines) as block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockPasteStream">BlockPasteStream</A></H2> Paste clipboard to current position as stream block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockPasteLine">BlockPasteLine</A></H2> Paste clipboard to current position as line block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockPasteColumn">BlockPasteColumn</A></H2> Paste clipboard to current position as column block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockPrint">BlockPrint</A></H2> Print a block to configured device. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockRead">BlockRead</A></H2> Read block from file. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockReadStream">BlockReadStream</A></H2> Read block from file as stream block <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockReadLine">BlockReadLine</A></H2> Read block from file as line block <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockReadColumn">BlockReadColumn</A></H2> Read block from file as column block <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockWrite">BlockWrite</A></H2> Write marked block to file. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockSort">BlockSort</A></H2> Sorts the marked block in ascending order. If mode setting MatchCase is set, characters will be compared case sensitively. When block is marked in <A HREF="modes.html#ec.BlockMarkStream"> Stream</A> or <A HREF="#ec.BlockMarkLine">Line</A> mode, the entire lines in marked block will be compared. When block is marked in <A HREF="#ec.BlockMarkColumn">Column</A> mode, only characters within marked columns will be compared. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockSortReverse">BlockSortReverse</A></H2> Sorts the marked block in descending order. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockUnTab">BlockUnTab</A></H2> Remove tabs from marked lines. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockEnTab">BlockEnTab</A></H2> Generate and optimize tabs in marked lines. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockMarkFunction">BlockMarkFunction</A></H2> Mark current function as block. <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H2><A NAME="ec.BlockTrim">BlockTrim</A></H2> Trim end-of-line whitespace <P><B>SEE ALSO:</B> <A HREF="#cmd_block">Block Commands</A>.<HR><H1><A NAME="cmd_edit">Text Editing and Insertion</A></H1> <UL> <LI><A HREF="#ec.Undo">Undo</A> <LI><A HREF="#ec.Redo">Redo</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Undo">Undo</A></H2> Undo last operation <P><B>SEE ALSO:</B> <A HREF="#cmd_edit">Text Editing and Insertion</A>.<HR><H2><A NAME="ec.Redo">Redo</A></H2> Redo last undone operation. <P><B>SEE ALSO:</B> <A HREF="#cmd_edit">Text Editing and Insertion</A>.<HR><H1><A NAME="cmd_fold">Folding Text</A></H1> <UL> <LI><A HREF="#ec.FoldCreate">FoldCreate</A> <LI><A HREF="#ec.FoldCreateByRegexp">FoldCreateByRegexp</A> <LI><A HREF="#ec.FoldCreateAtRoutines">FoldCreateAtRoutines</A> <LI><A HREF="#ec.FoldDestroy">FoldDestroy</A> <LI><A HREF="#ec.FoldDestroyAll">FoldDestroyAll</A> <LI><A HREF="#ec.FoldPromote">FoldPromote</A> <LI><A HREF="#ec.FoldDemote">FoldDemote</A> <LI><A HREF="#ec.FoldOpen">FoldOpen</A> <LI><A HREF="#ec.FoldOpenNested">FoldOpenNested</A> <LI><A HREF="#ec.FoldClose">FoldClose</A> <LI><A HREF="#ec.FoldOpenAll">FoldOpenAll</A> <LI><A HREF="#ec.FoldCloseAll">FoldCloseAll</A> <LI><A HREF="#ec.FoldToggleOpenClose">FoldToggleOpenClose</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FoldCreate">FoldCreate</A></H2> Create fold <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldCreateByRegexp">FoldCreateByRegexp</A></H2> Create folds at lines matching a regular expression <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldCreateAtRoutines">FoldCreateAtRoutines</A></H2> Create folds at lines matching RoutineRx <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldDestroy">FoldDestroy</A></H2> Destroy fold at current line <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldDestroyAll">FoldDestroyAll</A></H2> Destroy all folds in the file <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldPromote">FoldPromote</A></H2> Promote fold to outer level <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldDemote">FoldDemote</A></H2> Demote fold to inner level <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldOpen">FoldOpen</A></H2> Open fold at current line <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldOpenNested">FoldOpenNested</A></H2> Open fold and nested folds <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldClose">FoldClose</A></H2> Close current fold <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldOpenAll">FoldOpenAll</A></H2> Open all folds in the file <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldCloseAll">FoldCloseAll</A></H2> Close all folds in the file <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H2><A NAME="ec.FoldToggleOpenClose">FoldToggleOpenClose</A></H2> Toggle open/close current fold. <P><B>SEE ALSO:</B> <A HREF="#cmd_fold">Folding Text</A>.<HR><H1><A NAME="cmd_bookmark">Bookmarks</A></H1> <UL> <LI><A HREF="#ec.PlaceBookmark">PlaceBookmark</A> <LI><A HREF="#ec.RemoveBookmark">RemoveBookmark</A> <LI><A HREF="#ec.GotoBookmark">GotoBookmark</A> <LI><A HREF="#ec.PlaceGlobalBookmark">PlaceGlobalBookmark</A> <LI><A HREF="#ec.RemoveGlobalBookmark">RemoveGlobalBookmark</A> <LI><A HREF="#ec.GotoGlobalBookmark">GotoGlobalBookmark</A> <LI><A HREF="#ec.PushGlobalBookmark">PushGlobalBookmark</A> <LI><A HREF="#ec.PopGlobalBookmark">PopGlobalBookmark</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.PlaceBookmark">PlaceBookmark</A></H2> Place a file-local bookmark. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.RemoveBookmark">RemoveBookmark</A></H2> Place a file-local bookmark. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.GotoBookmark">GotoBookmark</A></H2> Go to file-local bookmark location. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.PlaceGlobalBookmark">PlaceGlobalBookmark</A></H2> Place global (persistent) bookmark. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.RemoveGlobalBookmark">RemoveGlobalBookmark</A></H2> Remove global bookmark. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.GotoGlobalBookmark">GotoGlobalBookmark</A></H2> Go to global bookmark location. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.PushGlobalBookmark">PushGlobalBookmark</A></H2> Push global bookmark (named as #&lt;num&gt;) to stack. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H2><A NAME="ec.PopGlobalBookmark">PopGlobalBookmark</A></H2> Pop global bookmark from stack. <P><B>SEE ALSO:</B> <A HREF="#cmd_bookmark">Bookmarks</A>.<HR><H1><A NAME="cmd_trans">Character Translation</A></H1> <UL> <LI><A HREF="#ec.CharCaseUp">CharCaseUp</A> <LI><A HREF="#ec.CharCaseDown">CharCaseDown</A> <LI><A HREF="#ec.CharCaseToggle">CharCaseToggle</A> <LI><A HREF="#ec.CharTrans">CharTrans</A> <LI><A HREF="#ec.LineCaseUp">LineCaseUp</A> <LI><A HREF="#ec.LineCaseDown">LineCaseDown</A> <LI><A HREF="#ec.LineCaseToggle">LineCaseToggle</A> <LI><A HREF="#ec.LineTrans">LineTrans</A> <LI><A HREF="#ec.BlockCaseUp">BlockCaseUp</A> <LI><A HREF="#ec.BlockCaseDown">BlockCaseDown</A> <LI><A HREF="#ec.BlockCaseToggle">BlockCaseToggle</A> <LI><A HREF="#ec.BlockTrans">BlockTrans</A> <LI><A HREF="#ec.InsertString">InsertString</A> <LI><A HREF="#ec.InsertSpace">InsertSpace</A> <LI><A HREF="#ec.InsertChar">InsertChar</A> <LI><A HREF="#ec.TypeChar">TypeChar</A> <LI><A HREF="#ec.InsertTab">InsertTab</A> <LI><A HREF="#ec.InsertSpacesToTab">InsertSpacesToTab</A> <LI><A HREF="#ec.SelfInsert">SelfInsert</A> <LI><A HREF="#ec.WrapPara">WrapPara</A> <LI><A HREF="#ec.InsPrevLineChar">InsPrevLineChar</A> <LI><A HREF="#ec.InsPrevLineToEol">InsPrevLineToEol</A> <LI><A HREF="#ec.CompleteWord">CompleteWord</A> <LI><A HREF="#ec.FilePrev">FilePrev</A> <LI><A HREF="#ec.FileNext">FileNext</A> <LI><A HREF="#ec.FileLast">FileLast</A> <LI><A HREF="#ec.SwitchTo">SwitchTo</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.CharCaseUp">CharCaseUp</A></H2> Convert current character to uppercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.CharCaseDown">CharCaseDown</A></H2> Convert current character to lowercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.CharCaseToggle">CharCaseToggle</A></H2> Toggle case of current character <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.CharTrans">CharTrans</A></H2> Translate current character (like perl/sed) <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.LineCaseUp">LineCaseUp</A></H2> Convert current line to uppercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.LineCaseDown">LineCaseDown</A></H2> Convert current line to lowercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.LineCaseToggle">LineCaseToggle</A></H2> Toggle case of current line <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.LineTrans">LineTrans</A></H2> Translate characters on current line <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.BlockCaseUp">BlockCaseUp</A></H2> Convert characters in selected block to uppercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.BlockCaseDown">BlockCaseDown</A></H2> Convert characters in selected block to lowercase <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.BlockCaseToggle">BlockCaseToggle</A></H2> Toggle case of characters in selected block <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.BlockTrans">BlockTrans</A></H2> Translate characters in selected block. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsertString">InsertString</A></H2> Insert argument string at cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsertSpace">InsertSpace</A></H2> Insert space <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsertChar">InsertChar</A></H2> Insert character argument at cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.TypeChar">TypeChar</A></H2> Insert character at cursor position (expanding abbreviations) <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsertTab">InsertTab</A></H2> Insert tab character at cursor position <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsertSpacesToTab">InsertSpacesToTab</A></H2> Insert appropriate number of spaces to simulate a tab. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.SelfInsert">SelfInsert</A></H2> Insert typed character <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.WrapPara">WrapPara</A></H2> Wrap current paragraph <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsPrevLineChar">InsPrevLineChar</A></H2> Insert character in previous line above cursor <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.InsPrevLineToEol">InsPrevLineToEol</A></H2> Insert previous line from cursor to end of line <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.CompleteWord">CompleteWord</A></H2> Complete current word to last word starting with the same prefix. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.FilePrev">FilePrev</A></H2> Switch to previous file in ring. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.FileNext">FileNext</A></H2> Switch to next file in ring. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.FileLast">FileLast</A></H2> Exchange last two files in ring. <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H2><A NAME="ec.SwitchTo">SwitchTo</A></H2> Switch to numbered buffer given as argument <P><B>SEE ALSO:</B> <A HREF="#cmd_trans">Character Translation</A>.<HR><H1><A NAME="cmd_file">File Commands</A></H1> <UL> <LI><A HREF="#ec.FileOpen">FileOpen</A> <LI><A HREF="#ec.FileOpenInMode">FileOpenInMode</A> <LI><A HREF="#ec.FileReload">FileReload</A> <LI><A HREF="#ec.FileSave">FileSave</A> <LI><A HREF="#ec.FileSaveAll">FileSaveAll</A> <LI><A HREF="#ec.FileSaveAs">FileSaveAs</A> <LI><A HREF="#ec.FileWriteTo">FileWriteTo</A> <LI><A HREF="#ec.FilePrint">FilePrint</A> <LI><A HREF="#ec.FileClose">FileClose</A> <LI><A HREF="#ec.FileCloseAll">FileCloseAll</A> <LI><A HREF="#ec.FileTrim">FileTrim</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FileOpen">FileOpen</A></H2> Open file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileOpenInMode">FileOpenInMode</A></H2> Open file in specified mode <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileReload">FileReload</A></H2> Reload current file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileSave">FileSave</A></H2> Save current file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileSaveAll">FileSaveAll</A></H2> Save all modified files <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileSaveAs">FileSaveAs</A></H2> Rename Save current file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileWriteTo">FileWriteTo</A></H2> Write current file into another file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FilePrint">FilePrint</A></H2> Print current file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileClose">FileClose</A></H2> Close current file <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileCloseAll">FileCloseAll</A></H2> Close all open files <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H2><A NAME="ec.FileTrim">FileTrim</A></H2> Trim end-of-line whitespace <P><B>SEE ALSO:</B> <A HREF="#cmd_file">File Commands</A>.<HR><H1><A NAME="cmd_directory">Directory Commands</A></H1> <UL> <LI><A HREF="#ec.DirOpen">DirOpen</A> <LI><A HREF="#ec.DirGoUp">DirGoUp</A> <LI><A HREF="#ec.DirGoDown">DirGoDown</A> <LI><A HREF="#ec.DirGoRoot">DirGoRoot</A> <LI><A HREF="#ec.DirGoto">DirGoto</A> <LI><A HREF="#ec.DirSearchCancel">DirSearchCancel</A> <LI><A HREF="#ec.DirSearchNext">DirSearchNext</A> <LI><A HREF="#ec.DirSearchPrev">DirSearchPrev</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.DirOpen">DirOpen</A></H2> Open directory browser <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirGoUp">DirGoUp</A></H2> Change to parent directory <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirGoDown">DirGoDown</A></H2> Change to currently selected directory <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirGoRoot">DirGoRoot</A></H2> Change to root directory <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirGoto">DirGoto</A></H2> Change to directory given as argument <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirSearchCancel">DirSearchCancel</A></H2> Cancel search <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirSearchNext">DirSearchNext</A></H2> Find next matching file <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H2><A NAME="ec.DirSearchPrev">DirSearchPrev</A></H2> Find previous matching file <P><B>SEE ALSO:</B> <A HREF="#cmd_directory">Directory Commands</A>.<HR><H1><A NAME="cmd_search">Search and Replace</A></H1> <UL> <LI><A HREF="#ec.IncrementalSearch">IncrementalSearch</A> <LI><A HREF="#ec.Find">Find</A> <LI><A HREF="#ec.FindReplace">FindReplace</A> <LI><A HREF="#ec.FindRepeat">FindRepeat</A> <LI><A HREF="#ec.FindRepeatOnce">FindRepeatOnce</A> <LI><A HREF="#ec.FindRepeatReverse">FindRepeatReverse</A> <LI><A HREF="#ec.MatchBracket">MatchBracket</A> <LI><A HREF="#ec.HilitWord">HilitWord</A> <LI><A HREF="#ec.SearchWordPrev">SearchWordPrev</A> <LI><A HREF="#ec.SearchWordNext">SearchWordNext</A> <LI><A HREF="#ec.HilitMatchBracket">HilitMatchBracket</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.IncrementalSearch">IncrementalSearch</A></H2> Incremental search <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.Find">Find</A></H2> Find <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.FindReplace">FindReplace</A></H2> Find and replace <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.FindRepeat">FindRepeat</A></H2> Repeat last find/replace operation <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.FindRepeatOnce">FindRepeatOnce</A></H2> Repeat last find/replace operation only once <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.FindRepeatReverse">FindRepeatReverse</A></H2> Repeat last find/replace operation in reverse <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.MatchBracket">MatchBracket</A></H2> Find matching bracket ([{&lt;&gt;}]) <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.HilitWord">HilitWord</A></H2> Highlight current word everywhere in the file <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.SearchWordPrev">SearchWordPrev</A></H2> Search for previous occurence of word under cursor <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.SearchWordNext">SearchWordNext</A></H2> Search for next occurence of word under cursor <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H2><A NAME="ec.HilitMatchBracket">HilitMatchBracket</A></H2> Highlight matching bracket <P><B>SEE ALSO:</B> <A HREF="#cmd_search">Search and Replace</A>.<HR><H1><A NAME="cmd_window">Window Commands</A></H1> <UL> <LI><A HREF="#ec.WinHSplit">WinHSplit</A> <LI><A HREF="#ec.WinNext">WinNext</A> <LI><A HREF="#ec.WinPrev">WinPrev</A> <LI><A HREF="#ec.WinClose">WinClose</A> <LI><A HREF="#ec.WinZoom">WinZoom</A> <LI><A HREF="#ec.WinResize">WinResize</A> <LI><A HREF="#ec.ViewBuffers">ViewBuffers</A> <LI><A HREF="#ec.ListRoutines">ListRoutines</A> <LI><A HREF="#ec.ExitEditor">ExitEditor</A> <LI><A HREF="#ec.ShowEntryScreen">ShowEntryScreen</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.WinHSplit">WinHSplit</A></H2> Split window horizontally <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.WinNext">WinNext</A></H2> Switch to next (bottom) window <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.WinPrev">WinPrev</A></H2> Switcn to previous (top) window. <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.WinClose">WinClose</A></H2> Close current window <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.WinZoom">WinZoom</A></H2> Delete all windows except for current one <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.WinResize">WinResize</A></H2> Resize current window (+n,-n given as argument) <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.ViewBuffers">ViewBuffers</A></H2> View currently open buffers <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.ListRoutines">ListRoutines</A></H2> Display routines in current source file <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.ExitEditor">ExitEditor</A></H2> Exit FTE. <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H2><A NAME="ec.ShowEntryScreen">ShowEntryScreen</A></H2> View external program output if available <P><B>SEE ALSO:</B> <A HREF="#cmd_window">Window Commands</A>.<HR><H1><A NAME="cmd_compile">Compiler Support</A></H1> <UL> <LI><A HREF="#ec.Compile">Compile</A> <LI><A HREF="#ec.RunCompiler">RunCompiler</A> <LI><A HREF="#ec.ViewMessages">ViewMessages</A> <LI><A HREF="#ec.CompileNextError">CompileNextError</A> <LI><A HREF="#ec.CompilePrevError">CompilePrevError</A> <LI><A HREF="#ec.RunProgram">RunProgram</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Compile">Compile</A></H2> Ask for compile command and run compiler <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H2><A NAME="ec.RunCompiler">RunCompiler</A></H2> Run configured compile command <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H2><A NAME="ec.ViewMessages">ViewMessages</A></H2> View compiler output <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H2><A NAME="ec.CompileNextError">CompileNextError</A></H2> Switch to next compiler error <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H2><A NAME="ec.CompilePrevError">CompilePrevError</A></H2> Switch to previous compiler error <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H2><A NAME="ec.RunProgram">RunProgram</A></H2> Run external program <P><B>SEE ALSO:</B> <A HREF="#cmd_compile">Compiler Support</A>.<HR><H1><A NAME="cmd_cvs">CVS Support</A></H1> <UL> <LI><A HREF="#ec.Cvs">Cvs</A> <LI><A HREF="#ec.RunCvs">RunCvs</A> <LI><A HREF="#ec.ViewCvs">ViewCvs</A> <LI><A HREF="#ec.ClearCvsMessages">ClearCvsMessages</A> <LI><A HREF="#ec.CvsDiff">CvsDiff</A> <LI><A HREF="#ec.RunCvsDiff">RunCvsDiff</A> <LI><A HREF="#ec.ViewCvsDiff">ViewCvsDiff</A> <LI><A HREF="#ec.CvsCommit">CvsCommit</A> <LI><A HREF="#ec.RunCvsCommit">RunCvsCommit</A> <LI><A HREF="#ec.ViewCvsLog">ViewCvsLog</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Cvs">Cvs</A></H2> Ask for CVS options and run CVS <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.RunCvs">RunCvs</A></H2> Run configured CVS command <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.ViewCvs">ViewCvs</A></H2> View CVS output <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.ClearCvsMessages">ClearCvsMessages</A></H2> Clear CVS messages <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.CvsDiff">CvsDiff</A></H2> Ask for CVS diff options and run CVS <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.RunCvsDiff">RunCvsDiff</A></H2> Run configured CVS diff command <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.ViewCvsDiff">ViewCvsDiff</A></H2> View CVS diff output <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.CvsCommit">CvsCommit</A></H2> Ask for CVS commit options and run CVS <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.RunCvsCommit">RunCvsCommit</A></H2> Run configured CVS commit command <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H2><A NAME="ec.ViewCvsLog">ViewCvsLog</A></H2> View CVS log <P><B>SEE ALSO:</B> <A HREF="#cmd_cvs">CVS Support</A>.<HR><H1><A NAME="cmd_svn">SVN Support</A></H1> <UL> <LI><A HREF="#ec.Svn">Svn</A> <LI><A HREF="#ec.RunSvn">RunSvn</A> <LI><A HREF="#ec.ViewSvn">ViewSvn</A> <LI><A HREF="#ec.ClearSvnMessages">ClearSvnMessages</A> <LI><A HREF="#ec.SvnDiff">SvnDiff</A> <LI><A HREF="#ec.RunSvnDiff">RunSvnDiff</A> <LI><A HREF="#ec.ViewSvnDiff">ViewSvnDiff</A> <LI><A HREF="#ec.SvnCommit">SvnCommit</A> <LI><A HREF="#ec.RunSvnCommit">RunSvnCommit</A> <LI><A HREF="#ec.ViewSvnLog">ViewSvnLog</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Svn">Svn</A></H2> Ask for SVN options and run SVN <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.RunSvn">RunSvn</A></H2> Run configured SVN command <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.ViewSvn">ViewSvn</A></H2> View SVN output <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.ClearSvnMessages">ClearSvnMessages</A></H2> Clear SVN messages <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.SvnDiff">SvnDiff</A></H2> Ask for SVN diff options and run SVN <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.RunSvnDiff">RunSvnDiff</A></H2> Run configured SVN diff command <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.ViewSvnDiff">ViewSvnDiff</A></H2> View SVN diff output <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.SvnCommit">SvnCommit</A></H2> Ask for SVN commit options and run SVN <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.RunSvnCommit">RunSvnCommit</A></H2> Run configured SVN commit command <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H2><A NAME="ec.ViewSvnLog">ViewSvnLog</A></H2> View SVN log <P><B>SEE ALSO:</B> <A HREF="#cmd_svn">SVN Support</A>.<HR><H1><A NAME="cmd_tags">TAGS Commands</A></H1> <UL> <LI><A HREF="#ec.TagFind">TagFind</A> <LI><A HREF="#ec.TagFindWord">TagFindWord</A> <LI><A HREF="#ec.TagNext">TagNext</A> <LI><A HREF="#ec.TagPrev">TagPrev</A> <LI><A HREF="#ec.TagPop">TagPop</A> <LI><A HREF="#ec.TagLoad">TagLoad</A> <LI><A HREF="#ec.TagClear">TagClear</A> <LI><A HREF="#ec.TagGoto">TagGoto</A> </UL> fte supports TAGS files generated by programs like ctags. <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.TagFind">TagFind</A></H2> Find word argumen in tag files. <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagFindWord">TagFindWord</A></H2> Find word under cursor in tag files. <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagNext">TagNext</A></H2> Switch to next occurance of tag <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagPrev">TagPrev</A></H2> Switch to previous occurance of tag <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagPop">TagPop</A></H2> Pop saved position from tag stack <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagLoad">TagLoad</A></H2> Load tag file and merge with current tags <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagClear">TagClear</A></H2> Clear loaded tags <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H2><A NAME="ec.TagGoto">TagGoto</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_tags">TAGS Commands</A>.<HR><H1><A NAME="cmd_option">Option commands</A></H1> <UL> <LI><A HREF="#ec.ToggleAutoIndent">ToggleAutoIndent</A> <LI><A HREF="#ec.ToggleInsert">ToggleInsert</A> <LI><A HREF="#ec.ToggleExpandTabs">ToggleExpandTabs</A> <LI><A HREF="#ec.ToggleShowTabs">ToggleShowTabs</A> <LI><A HREF="#ec.ToggleUndo">ToggleUndo</A> <LI><A HREF="#ec.ToggleReadOnly">ToggleReadOnly</A> <LI><A HREF="#ec.ToggleKeepBackups">ToggleKeepBackups</A> <LI><A HREF="#ec.ToggleMatchCase">ToggleMatchCase</A> <LI><A HREF="#ec.ToggleBackSpKillTab">ToggleBackSpKillTab</A> <LI><A HREF="#ec.ToggleDeleteKillTab">ToggleDeleteKillTab</A> <LI><A HREF="#ec.ToggleSpaceTabs">ToggleSpaceTabs</A> <LI><A HREF="#ec.ToggleIndentWithTabs">ToggleIndentWithTabs</A> <LI><A HREF="#ec.ToggleBackSpUnindents">ToggleBackSpUnindents</A> <LI><A HREF="#ec.ToggleWordWrap">ToggleWordWrap</A> <LI><A HREF="#ec.ToggleTrim">ToggleTrim</A> <LI><A HREF="#ec.ToggleShowMarkers">ToggleShowMarkers</A> <LI><A HREF="#ec.ToggleHilitTags">ToggleHilitTags</A> <LI><A HREF="#ec.ToggleShowBookmarks">ToggleShowBookmarks</A> <LI><A HREF="#ec.ToggleMakeBackups">ToggleMakeBackups</A> <LI><A HREF="#ec.SetLeftMargin">SetLeftMargin</A> <LI><A HREF="#ec.SetRightMargin">SetRightMargin</A> <LI><A HREF="#ec.ToggleSysClipboard">ToggleSysClipboard</A> <LI><A HREF="#ec.SetPrintDevice">SetPrintDevice</A> <LI><A HREF="#ec.ChangeTabSize">ChangeTabSize</A> <LI><A HREF="#ec.ChangeLeftMargin">ChangeLeftMargin</A> <LI><A HREF="#ec.ChangeRightMargin">ChangeRightMargin</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ToggleAutoIndent">ToggleAutoIndent</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleInsert">ToggleInsert</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleExpandTabs">ToggleExpandTabs</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleShowTabs">ToggleShowTabs</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleUndo">ToggleUndo</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleReadOnly">ToggleReadOnly</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleKeepBackups">ToggleKeepBackups</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleMatchCase">ToggleMatchCase</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleBackSpKillTab">ToggleBackSpKillTab</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleDeleteKillTab">ToggleDeleteKillTab</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleSpaceTabs">ToggleSpaceTabs</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleIndentWithTabs">ToggleIndentWithTabs</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleBackSpUnindents">ToggleBackSpUnindents</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleWordWrap">ToggleWordWrap</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleTrim">ToggleTrim</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleShowMarkers">ToggleShowMarkers</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleHilitTags">ToggleHilitTags</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleShowBookmarks">ToggleShowBookmarks</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleMakeBackups">ToggleMakeBackups</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.SetLeftMargin">SetLeftMargin</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.SetRightMargin">SetRightMargin</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ToggleSysClipboard">ToggleSysClipboard</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.SetPrintDevice">SetPrintDevice</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ChangeTabSize">ChangeTabSize</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ChangeLeftMargin">ChangeLeftMargin</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H2><A NAME="ec.ChangeRightMargin">ChangeRightMargin</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_option">Option commands</A>.<HR><H1><A NAME="cmd_other">Other commands</A></H1> <UL> <LI><A HREF="#ec.ShowPosition">ShowPosition</A> <LI><A HREF="#ec.ShowVersion">ShowVersion</A> <LI><A HREF="#ec.ShowKey">ShowKey</A> <LI><A HREF="#ec.WinRefresh">WinRefresh</A> <LI><A HREF="#ec.MainMenu">MainMenu</A> <LI><A HREF="#ec.ShowMenu">ShowMenu</A> <LI><A HREF="#ec.LocalMenu">LocalMenu</A> <LI><A HREF="#ec.ChangeMode">ChangeMode</A> <LI><A HREF="#ec.ChangeKeys">ChangeKeys</A> <LI><A HREF="#ec.ChangeFlags">ChangeFlags</A> <LI><A HREF="#ec.Cancel">Cancel</A> <LI><A HREF="#ec.Activate">Activate</A> <LI><A HREF="#ec.Rescan">Rescan</A> <LI><A HREF="#ec.CloseActivate">CloseActivate</A> <LI><A HREF="#ec.ActivateInOtherWindow">ActivateInOtherWindow</A> <LI><A HREF="#ec.DeleteFile">DeleteFile</A> <LI><A HREF="#ec.ASCIITable">ASCIITable</A> <LI><A HREF="#ec.DesktopSave">DesktopSave</A> <LI><A HREF="#ec.ClipClear">ClipClear</A> <LI><A HREF="#ec.DesktopSaveAs">DesktopSaveAs</A> <LI><A HREF="#ec.ChildClose">ChildClose</A> <LI><A HREF="#ec.BufListFileSave">BufListFileSave</A> <LI><A HREF="#ec.BufListFileClose">BufListFileClose</A> <LI><A HREF="#ec.BufListSearchCancel">BufListSearchCancel</A> <LI><A HREF="#ec.BufListSearchNext">BufListSearchNext</A> <LI><A HREF="#ec.BufListSearchPrev">BufListSearchPrev</A> <LI><A HREF="#ec.ViewModeMap">ViewModeMap</A> <LI><A HREF="#ec.ClearMessages">ClearMessages</A> <LI><A HREF="#ec.IndentFunction">IndentFunction</A> <LI><A HREF="#ec.MoveFunctionPrev">MoveFunctionPrev</A> <LI><A HREF="#ec.MoveFunctionNext">MoveFunctionNext</A> <LI><A HREF="#ec.InsertDate">InsertDate</A> <LI><A HREF="#ec.InsertUid">InsertUid</A> <LI><A HREF="#ec.FrameNew">FrameNew</A> <LI><A HREF="#ec.FrameClose">FrameClose</A> <LI><A HREF="#ec.FrameNext">FrameNext</A> <LI><A HREF="#ec.FramePrev">FramePrev</A> <LI><A HREF="#ec.BufferViewNext">BufferViewNext</A> <LI><A HREF="#ec.BufferViewPrev">BufferViewPrev</A> <LI><A HREF="#ec.ShowHelpWord">ShowHelpWord</A> <LI><A HREF="#ec.ShowHelp">ShowHelp</A> <LI><A HREF="#ec.ConfigRecompile">ConfigRecompile</A> <LI><A HREF="#ec.SetCIndentStyle">SetCIndentStyle</A> <LI><A HREF="#ec.SetIndentWithTabs">SetIndentWithTabs</A> <LI><A HREF="#ec.ListMark">ListMark</A> <LI><A HREF="#ec.ListUnmark">ListUnmark</A> <LI><A HREF="#ec.ListToggleMark">ListToggleMark</A> <LI><A HREF="#ec.ListMarkAll">ListMarkAll</A> <LI><A HREF="#ec.ListUnmarkAll">ListUnmarkAll</A> <LI><A HREF="#ec.ListToggleMarkAll">ListToggleMarkAll</A> </UL> <P><B>SEE ALSO:</B> <A HREF="#cmd_cursor">Cursor Movement</A>, <A HREF="#cmd_delete">Deleting Text</A>, <A HREF="#cmd_line">Line Commands</A>, <A HREF="#cmd_block">Block Commands</A>, <A HREF="#cmd_edit">Text Editing and Insertion</A>, <A HREF="#cmd_fold">Folding Text</A>, <A HREF="#cmd_bookmark">Bookmarks</A>, <A HREF="#cmd_trans">Character Translation</A>, <A HREF="#cmd_file">File Commands</A>, <A HREF="#cmd_directory">Directory Commands</A>, <A HREF="#cmd_search">Search and Replace</A>, <A HREF="#cmd_window">Window Commands</A>, <A HREF="#cmd_compile">Compiler Support</A>, <A HREF="#cmd_cvs">CVS Support</A>, <A HREF="#cmd_svn">SVN Support</A>, <A HREF="#cmd_tags">TAGS Commands</A>, <A HREF="#cmd_option">Option commands</A>, <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowPosition">ShowPosition</A></H2> Show internal position information on status line <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowVersion">ShowVersion</A></H2> Show editor version information <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowKey">ShowKey</A></H2> Wait for keypress and display modifiers+key pressed <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.WinRefresh">WinRefresh</A></H2> Refresh display <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.MainMenu">MainMenu</A></H2> Activate main menu <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowMenu">ShowMenu</A></H2> Popup menu specified as argument <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.LocalMenu">LocalMenu</A></H2> Popup context menu <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ChangeMode">ChangeMode</A></H2> Change active mode for current buffer <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ChangeKeys">ChangeKeys</A></H2> Change keybindings for current buffer <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ChangeFlags">ChangeFlags</A></H2> Change option flags for current buffer <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Cancel">Cancel</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Activate">Activate</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.Rescan">Rescan</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.CloseActivate">CloseActivate</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ActivateInOtherWindow">ActivateInOtherWindow</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.DeleteFile">DeleteFile</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ASCIITable">ASCIITable</A></H2> Display ASCII selector in status line. <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.DesktopSave">DesktopSave</A></H2> Save desktop <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ClipClear">ClipClear</A></H2> Clear clipboard <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.DesktopSaveAs">DesktopSaveAs</A></H2> Save desktop under a new name <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ChildClose">ChildClose</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufListFileSave">BufListFileSave</A></H2> Save currently selected file in buffer list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufListFileClose">BufListFileClose</A></H2> Close currently selected file in buffer list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufListSearchCancel">BufListSearchCancel</A></H2> Cancel search <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufListSearchNext">BufListSearchNext</A></H2> Next match in search <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufListSearchPrev">BufListSearchPrev</A></H2> Previous match in search <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ViewModeMap">ViewModeMap</A></H2> View current mode keybindings <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ClearMessages">ClearMessages</A></H2> Clear compiler messages <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.IndentFunction">IndentFunction</A></H2> Indent current function <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.MoveFunctionPrev">MoveFunctionPrev</A></H2> Move cursor to previous function <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.MoveFunctionNext">MoveFunctionNext</A></H2> Move cursor to next function <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.InsertDate">InsertDate</A></H2> Insert date at cursor <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.InsertUid">InsertUid</A></H2> Insert user name at cursor <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FrameNew">FrameNew</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FrameClose">FrameClose</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FrameNext">FrameNext</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.FramePrev">FramePrev</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufferViewNext">BufferViewNext</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.BufferViewPrev">BufferViewPrev</A></H2> <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowHelpWord">ShowHelpWord</A></H2> Show context help on keyword. <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ShowHelp">ShowHelp</A></H2> Show help for FTE. <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ConfigRecompile">ConfigRecompile</A></H2> Recompile editor configuration <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.SetCIndentStyle">SetCIndentStyle</A></H2> Set C indentation style parameters Has the following parameters: C_Indent = 4; C_BraceOfs = 0; C_ParenDelta = -1; C_CaseOfs = 0; C_CaseDelta = 4; C_ClassOfs = 0; C_ClassDelta = 4; C_ColonOfs = -4; C_CommentOfs = 0; C_CommentDelta = 1; C_FirstLevelWidth = -1; C_FirstLevelIndent = 4; C_Continuation = 4; <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.SetIndentWithTabs">SetIndentWithTabs</A></H2> Set value of indent-with-tabs to argument <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListMark">ListMark</A></H2> Mark single line in list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListUnmark">ListUnmark</A></H2> Unmark single line in list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListToggleMark">ListToggleMark</A></H2> Toggle marking of single line in list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListMarkAll">ListMarkAll</A></H2> Mark all lines in list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListUnmarkAll">ListUnmarkAll</A></H2> Unmark all lines in list <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.<HR><H2><A NAME="ec.ListToggleMarkAll">ListToggleMarkAll</A></H2> Toggle marking of all lines in list Delete content's of selection and paste clipboard to current position <P><B>SEE ALSO:</B> <A HREF="#cmd_other">Other commands</A>.</BODY> </HTML> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/perftips.html���������������������������������������������������������������������������������0000644�0001750�0001750�00000000517�07045070602�013145� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Performance Tips</TITLE></HEAD> <BODY> If you want to achieve top performance (necessary for some text editing tasks), here are some tips: <UL> <LI>Use PLAIN hilit mode <LI>Disable Tab Expansion <LI>Disable ShowMarkers <LI>Disable Undo <LI>Disable AutoHilitBracket <LI>Disable Abbreviations. </UL> </BODY> </HTML> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/colors.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000001331�07045070533�012610� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Colors</TITLE></HEAD> <BODY> Colors are configured in COLOR.FTE file. <P> Syntax for color settings is: <P><B>color</B> { { 'name', 'value' } ... } <P>Value is the PC character attribute first char is background color, the second is foreground color. <P>Colors are as follows: <PRE> 0 Black 1 Dark Blue 2 Dark Green 3 Dark Cyan 4 Dark Red 5 Dark Magenta 6 Orange 7 Pale Gray 8 Dark Gray 9 Blue A Green B Cyan C Red D Magenta E Yellow F White </PRE> </BODY> </HTML> q�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/events.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000006000�07045070573�012615� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Event Bindings</TITLE></HEAD> <BODY> eventmap section is used to bind editor commands to user events. <H1><A NAME="keybindings">Keybindings</A></H1> <P> Keybindings are inherited from parent modes unless overriden. <P> Here are some examples of key specifiactions: <DL> <DT>[A]<DD>Uppercase a <DT>[a]<DD>Lowercase a <DT>[;]<DD>Semicolon <DT>[A+A]<DD>Alt+A <DT>[C+B]<DD>Ctrl+B <DT>[A+C+F1]<DD>Alt+Ctrl+F1 <DT>[A+C+S+F1]<DD>Alt+Ctrl+Shift+F1 <DT>[A+Space]<DD>Alt+Space <DT>[C+K_C+B]<DD>Ctrl+K and then Ctrl+B (two keys) <DT>[C+A_C+B_C+C]<DD>Ctrl+A Ctrl+B Ctrl+C must be pressed in sequence. <DT>[G+-]<DD>Gray - <DT>[G++]<DD>Gray + <DT>[C-S-X]<DD>X, ignore the state of Ctrl and Shift keys. <DT>[C+\\]<DD>Ctrl+Backslash <DT>[C+\[]<DD>Ctrl+[ <DT>[C+G-Left]<DD>Ctrl+Left, ignore difference between the two Left keys. <DT>[C+A-A]<DD>Ctrl+A, ignore the state of Alt key. </DL> <P>The following special keys are available (case sensitive): <P><B>F1-F12 Home End PgUp PgDn Insert Delete Up Down Left Right Enter Esc BackSp Space Tab Center</B> <P>Keyname can be preceeded by modifiers <B>(A, C, G, S)</B>. If modifier is followed by a <B>+</B> (plus), the modifier key must be pressed to match the key specification. If the modifier key is followed by <B>-</B> (minus), the state of the modifier key is ignored. <P>Multiple-key combinations can be specified by separating them with <B>_</B> (underline) <P>Keys are bound using the <B>key</B> command: <P><B>key</B> <B>[keyspec]</B> { <A HREF="command.html">editor commands</A> } <P>ASCII characters >= 32 are bound to TypeChar by default. <P>Any number of commands can be bound to a key combination or menu item. They are executed in sequence until one of them fails. <P>See <I>ui_fte.fte</I> configuration file for examples and default configuration. <H1><A NAME="abbrevs">Abbreviations</A></H1> Abbreviations are used to automatically replace some text or run an editor macro when some word is typed in. When a non-word character is entered, the previous word is searched for in the list of abbreviations. When it is found, it is either replaced with a new string or a macro is executed. <P> Syntax: <PRE> abbrev 'old-word' 'new-string' abbrev 'old-word' { Macro } </PRE> <P> Some examples of abbreviations: <PRE> abbrev 'wcsw' 'WinCreateStdWindow'; abbrev 'ifx' { KillWordPrev; InsertString 'if () {'; LineIndent; LineNew; InsertString '}'; LineIndent; MoveUp; MoveLineEnd; 3:MoveLeft; Fail; # do not insert typed character } </PRE> <P> The first one defines a replacement string, while the second one defines an editor macro to be run. <P> For abbreviations to work, setting <A HREF="modes.html#ms.Abbreviations">Abbreviations</A> must be set to 1 for active mode. <H1><A NAME="settings-eventmap">EventMap Settings</A></H1> <H2><A NAME="es.MainMenu">MainMenu</A></H2> "menu" <P>Main menu displayed when editing in this mode. <H2><A NAME="es.LocalMenu">LocalMenu</A></H2> "menu" <P>Local menu used when editing in this mode. </BODY> </HTML> ./doc/about.html������������������������������������������������������������������������������������0000644�0001750�0001750�00000001520�11326137317�012422� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>About FTE</TITLE></HEAD> <BODY> <CENTER> <H2>fte</H2><BR> Version <B>0.50</B><BR> (c) Copyright 1998-2010 Zdenek Kabelac<BR> Version <B>0.46</B><BR> (c) Copyright 1995-1998 Marko Macek<BR> </CENTER> <P>The latest version can be always downloaded from: <A HREF="http://fte.sourceforge.net"><B>http://fte.sourceforge.net</B></A> <P>Please send comments/suggestions/bug reports to: <A HREF="mailto:zdenek.kabelac@gmail.com">zdenek.kabelac@gmail.com</B></A><BR> Original author is <B>Marko.Macek@snet.fri.uni-lj.si</B> or <B>mark@hermes.si</B> <P>See file <A HREF="../README">README</A> for last minute notes. <P>See file <A HREF="../NEWS">NEWS</A> for recent changes and updates. <P>See file <A HREF="../TODO">TODO</A> for possible future additions. <P>See file <A HREF="../BUGS">BUGS</A> for outstanding problems. </BODY> </HTML> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/contents.html���������������������������������������������������������������������������������0000644�0001750�0001750�00000104764�11326137317�013163� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<DL> <LI><A HREF="about.html" TARGET="main"> About FTE</A></LI> <LI><A HREF="install.html" TARGET="main"> Installation</A></LI> <DL> <LI><A HREF="install.html#install-os2" TARGET="main">OS/2</A></LI> <DL> <LI><A HREF="install.html#install-os2-files" TARGET="main">Files</A></LI> <LI><A HREF="install.html#install-os2-requires" TARGET="main">Required files</A></LI> </DL> <LI><A HREF="install.html#install-unix" TARGET="main">Unix</A></LI> </DL> <LI><A HREF="cmdopt.html" TARGET="main"> Command Line Options</A></LI> <DL> <LI><A HREF="cmdopt.html#command-line-options" TARGET="main">Options</A></LI> <LI><A HREF="cmdopt.html#command-line-examples" TARGET="main">Examples</A></LI> </DL> <LI><A HREF="cfgfiles.html" TARGET="main"> Configuration Files</A></LI> <DL> <LI><A HREF="cfgfiles.html#config-compiling" TARGET="main">Compiling configuration</A></LI> <LI><A HREF="cfgfiles.html#config-syntax" TARGET="main">Configuration file syntax</A></LI> </DL> <LI><A HREF="global.html" TARGET="main"> Global Configuration</A></LI> <DL> <LI><A HREF="global.html#set-global" TARGET="main">Global Settings</A></LI> <DL> <LI><A HREF="global.html#gs.DefaultModeName" TARGET="main">DefaultModeName</A></LI> <LI><A HREF="global.html#gs.CompletionFilter" TARGET="main">CompletionFilter</A></LI> <LI><A HREF="global.html#gs.CompileRx" TARGET="main">CompileRx</A></LI> <LI><A HREF="global.html#gs.OpenAfterClose" TARGET="main">OpenAfterClose</A></LI> <LI><A HREF="global.html#gs.SysClipboard" TARGET="main">SysClipboard</A></LI> <LI><A HREF="global.html#gs.ScreenSizeX" TARGET="main">ScreenSizeX</A></LI> <LI><A HREF="global.html#gs.ScreenSizeY" TARGET="main">ScreenSizeY</A></LI> <LI><A HREF="global.html#gs.CursorInsertStart" TARGET="main">CursorInsertStart</A></LI> <LI><A HREF="global.html#gs.CursorInsertEnd" TARGET="main">CursorInsertEnd</A></LI> <LI><A HREF="global.html#gs.CursorOverStart" TARGET="main">CursorOverStart</A></LI> <LI><A HREF="global.html#gs.CursorOverEnd" TARGET="main">CursorOverEnd</A></LI> <LI><A HREF="global.html#gs.SelectPathname" TARGET="main">SelectPathname</A></LI> <LI><A HREF="global.html#gs.ShowMenuBar" TARGET="main">ShowMenuBar</A></LI> <LI><A HREF="global.html#gs.ShowVScroll" TARGET="main">ShowVScroll</A></LI> <LI><A HREF="global.html#gs.ShowHScroll" TARGET="main">ShowHScroll</A></LI> <LI><A HREF="global.html#gs.KeepHistory" TARGET="main">KeepHistory</A></LI> <LI><A HREF="global.html#gs.LoadDesktopOnEntry" TARGET="main">LoadDesktopOnEntry</A></LI> <LI><A HREF="global.html#gs.SaveDesktopOnExit" TARGET="main">SaveDesktopOnExit</A></LI> <LI><A HREF="global.html#gs.KeepMessages" TARGET="main">KeepMessages</A></LI> <LI><A HREF="global.html#gs.ScrollBorderX" TARGET="main">ScrollBorderX</A></LI> <LI><A HREF="global.html#gs.ScrollBorderY" TARGET="main">ScrollBorderY</A></LI> <LI><A HREF="global.html#gs.ScrollJumpX" TARGET="main">ScrollJumpX</A></LI> <LI><A HREF="global.html#gs.ScrollJumpY" TARGET="main">ScrollJumpY</A></LI> <LI>C_*</LI> <LI><A HREF="global.html#gs.REXX_Indent" TARGET="main">REXX_Indent</A></LI> </DL> <LI><A HREF="global.html#global-cmode" TARGET="main">CMode Smart Indentation</A></LI> </DL> <LI><A HREF="events.html" TARGET="main"> Event Bindings</A></LI> <DL> <LI><A HREF="events.html#keybindings" TARGET="main">Keybindings</A></LI> <LI><A HREF="events.html#abbrevs" TARGET="main">Abbreviations</A></LI> <LI><A HREF="events.html#settings-eventmap" TARGET="main">EventMap Settings</A></LI> <DL> <LI><A HREF="events.html#es.MainMenu" TARGET="main">MainMenu</A></LI> <LI><A HREF="events.html#es.LocalMenu" TARGET="main">LocalMenu</A></LI> </DL> </DL> <LI><A HREF="modes.html" TARGET="main"> Mode Configuration</A></LI> <DL> <DL> <LI><A HREF="modes.html#modesetup" TARGET="main">Mode Settings</A></LI> <DL> <LI><A HREF="modes.html#ms.ExpandTabs" TARGET="main">ExpandTabs</A></LI> <LI><A HREF="modes.html#ms.TabSize" TARGET="main">TabSize</A></LI> <LI><A HREF="modes.html#ms.AutoIndent" TARGET="main">AutoIndent</A></LI> <LI><A HREF="modes.html#ms.Insert" TARGET="main">Insert</A></LI> <LI><A HREF="modes.html#ms.StripChar" TARGET="main">StripChar</A></LI> <LI><A HREF="modes.html#ms.LineChar" TARGET="main">LineChar</A></LI> <LI><A HREF="modes.html#ms.AddCR" TARGET="main">AddCR</A></LI> <LI><A HREF="modes.html#ms.AddLF" TARGET="main">AddLF</A></LI> <LI><A HREF="modes.html#ms.ForceNewLine" TARGET="main">ForceNewLine</A></LI> <LI><A HREF="modes.html#ms.Hilit" TARGET="main">Hilit</A></LI> <LI><A HREF="modes.html#ms.ShowTabs" TARGET="main">ShowTabs</A></LI> <LI><A HREF="modes.html#ms.IndentMode" TARGET="main">IndentMode</A></LI> <LI><A HREF="modes.html#colorizer" TARGET="main">Colorizer</A></LI> <LI><A HREF="modes.html#eventmap" TARGET="main">EventMap</A></LI> <LI><A HREF="modes.html#ms.UndoLimit" TARGET="main">UndoLimit</A></LI> <LI><A HREF="modes.html#ms.UndoMoves" TARGET="main">UndoMoves</A></LI> <LI><A HREF="modes.html#ms.KeepBackups" TARGET="main">KeepBackups</A></LI> <LI><A HREF="modes.html#ms.MatchCase" TARGET="main">MatchCase</A></LI> <LI><A HREF="modes.html#ms.BackSpKillTab" TARGET="main">BackSpKillTab</A></LI> <LI><A HREF="modes.html#ms.DeleteKillTab" TARGET="main">DeleteKillTab</A></LI> <LI><A HREF="modes.html#ms.BackSpUnindents" TARGET="main">BackSpUnindents</A></LI> <LI><A HREF="modes.html#ms.SpaceTabs" TARGET="main">SpaceTabs</A></LI> <LI><A HREF="modes.html#ms.IndentWithTabs" TARGET="main">IndentWithTabs</A></LI> <LI><A HREF="modes.html#ms.WordWrap" TARGET="main">WordWrap</A></LI> <LI><A HREF="modes.html#ms.LeftMargin" TARGET="main">LeftMargin</A></LI> <LI><A HREF="modes.html#ms.RightMargin" TARGET="main">RightMargin</A></LI> <LI><A HREF="modes.html#ms.Trim" TARGET="main">Trim</A></LI> <LI><A HREF="modes.html#ms.ShowMarkers" TARGET="main">ShowMarkers</A></LI> <LI><A HREF="modes.html#ms.CursorTroughTabs" TARGET="main">CursorTroughTabs</A></LI> <LI><A HREF="modes.html#ms.DefFindOpt" TARGET="main">DefFindOpt</A></LI> <LI><A HREF="modes.html#ms.DefFindReplaceOpt" TARGET="main">DefFindReplaceOpt</A></LI> <LI><A HREF="modes.html#ms.SaveFolds" TARGET="main">SaveFolds</A></LI> <LI><A HREF="modes.html#ms.CommentStart" TARGET="main">CommentStart</A></LI> <LI><A HREF="modes.html#ms.CommentEnd" TARGET="main">CommentEnd</A></LI> <LI><A HREF="modes.html#ms.AutoHilitParen" TARGET="main">AutoHilitParen</A></LI> <LI><A HREF="modes.html#ms.Abbreviations" TARGET="main">Abbreviations</A></LI> <LI><A HREF="modes.html#ms.BackSpKillBlock" TARGET="main">BackSpKillBlock</A></LI> <LI><A HREF="modes.html#ms.DeleteKillBlock" TARGET="main">DeleteKillBlock</A></LI> <LI><A HREF="modes.html#ms.PersistentBlocks" TARGET="main">PersistentBlocks</A></LI> <LI><A HREF="modes.html#ms.InsertKillBlock" TARGET="main">InsertKillBlock</A></LI> <LI><A HREF="modes.html#ms.FileNameRx" TARGET="main">FileNameRx</A></LI> <LI><A HREF="modes.html#ms.FirstLineRx" TARGET="main">FirstLineRx</A></LI> <LI><A HREF="modes.html#ms.RoutineRegexp" TARGET="main">RoutineRegexp</A></LI> </DL> <LI><A HREF="modes.html#loading" TARGET="main">Loading files in various formats</A></LI> <LI><A HREF="modes.html#modes-tabopts" TARGET="main">Configuration of Tab options</A></LI> </DL> </DL> <LI><A HREF="regexp.html" TARGET="main"> Regular Expressions</A></LI> <DL> <LI><A HREF="regexp.html#regexp-search" TARGET="main">Search/Match Operators</A></LI> <LI><A HREF="regexp.html#regexp-replace" TARGET="main">Replacement Operators</A></LI> </DL> <LI><A HREF="status.html" TARGET="main"> Status Line</A></LI> <LI><A HREF="colorize.html" TARGET="main"> Configuration of Syntax Highlighting</A></LI> <DL> <LI><A HREF="colorize.html#settings" TARGET="main">Settings</A></LI> <LI><A HREF="colorize.html#hl_simple" TARGET="main">Configurable Syntax Parser</A></LI> </DL> <LI><A HREF="colors.html" TARGET="main"> Colors</A></LI> <LI><A HREF="command.html" TARGET="main"> Macro Commands</A></LI> <DL> <LI><A HREF="command.html#cmd_cursor" TARGET="main">Cursor Movement</A></LI> <DL> <LI><A HREF="command.html#ec.MoveDown" TARGET="main">MoveDown</A></LI> <LI><A HREF="command.html#ec.MoveUp" TARGET="main">MoveUp</A></LI> <LI><A HREF="command.html#ec.MoveLeft" TARGET="main">MoveLeft</A></LI> <LI><A HREF="command.html#ec.MoveRight" TARGET="main">MoveRight</A></LI> <LI><A HREF="command.html#ec.MovePrev" TARGET="main">MovePrev</A></LI> <LI><A HREF="command.html#ec.MoveNext" TARGET="main">MoveNext</A></LI> <LI><A HREF="command.html#ec.MoveWordLeft" TARGET="main">MoveWordLeft</A></LI> <LI><A HREF="command.html#ec.MoveWordRight" TARGET="main">MoveWordRight</A></LI> <LI><A HREF="command.html#ec.MoveWordPrev" TARGET="main">MoveWordPrev</A></LI> <LI><A HREF="command.html#ec.MoveWordNext" TARGET="main">MoveWordNext</A></LI> <LI><A HREF="command.html#ec.MoveWordEndLeft" TARGET="main">MoveWordEndLeft</A></LI> <LI><A HREF="command.html#ec.MoveWordEndRight" TARGET="main">MoveWordEndRight</A></LI> <LI><A HREF="command.html#ec.MoveWordEndPrev" TARGET="main">MoveWordEndPrev</A></LI> <LI><A HREF="command.html#ec.MoveWordEndNext" TARGET="main">MoveWordEndNext</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapLeft" TARGET="main">MoveWordOrCapLeft</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapRight" TARGET="main">MoveWordOrCapRight</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapPrev" TARGET="main">MoveWordOrCapPrev</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapNext" TARGET="main">MoveWordOrCapNext</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapEndLeft" TARGET="main">MoveWordOrCapEndLeft</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapEndRight" TARGET="main">MoveWordOrCapEndRight</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapEndPrev" TARGET="main">MoveWordOrCapEndPrev</A></LI> <LI><A HREF="command.html#ec.MoveWordOrCapEndNext" TARGET="main">MoveWordOrCapEndNext</A></LI> <LI><A HREF="command.html#ec.MoveLineStart" TARGET="main">MoveLineStart</A></LI> <LI><A HREF="command.html#ec.MoveLineEnd" TARGET="main">MoveLineEnd</A></LI> <LI><A HREF="command.html#ec.MovePageStart" TARGET="main">MovePageStart</A></LI> <LI><A HREF="command.html#ec.MovePageEnd" TARGET="main">MovePageEnd</A></LI> <LI><A HREF="command.html#ec.MovePageUp" TARGET="main">MovePageUp</A></LI> <LI><A HREF="command.html#ec.MovePageDown" TARGET="main">MovePageDown</A></LI> <LI><A HREF="command.html#ec.MoveFileStart" TARGET="main">MoveFileStart</A></LI> <LI><A HREF="command.html#ec.MoveFileEnd" TARGET="main">MoveFileEnd</A></LI> <LI><A HREF="command.html#ec.MovePageLeft" TARGET="main">MovePageLeft</A></LI> <LI><A HREF="command.html#ec.MovePageRight" TARGET="main">MovePageRight</A></LI> <LI><A HREF="command.html#ec.MoveBlockStart" TARGET="main">MoveBlockStart</A></LI> <LI><A HREF="command.html#ec.MoveBlockEnd" TARGET="main">MoveBlockEnd</A></LI> <LI><A HREF="command.html#ec.MoveFirstNonWhite" TARGET="main">MoveFirstNonWhite</A></LI> <LI><A HREF="command.html#ec.MoveLastNonWhite" TARGET="main">MoveLastNonWhite</A></LI> <LI><A HREF="command.html#ec.MovePrevEqualIndent" TARGET="main">MovePrevEqualIndent</A></LI> <LI><A HREF="command.html#ec.MoveNextEqualIndent" TARGET="main">MoveNextEqualIndent</A></LI> <LI><A HREF="command.html#ec.MovePrevTab" TARGET="main">MovePrevTab</A></LI> <LI><A HREF="command.html#ec.MoveNextTab" TARGET="main">MoveNextTab</A></LI> <LI><A HREF="command.html#ec.MoveTabStart" TARGET="main">MoveTabStart</A></LI> <LI><A HREF="command.html#ec.MoveTabEnd" TARGET="main">MoveTabEnd</A></LI> <LI><A HREF="command.html#ec.MoveLineTop" TARGET="main">MoveLineTop</A></LI> <LI><A HREF="command.html#ec.MoveLineCenter" TARGET="main">MoveLineCenter</A></LI> <LI><A HREF="command.html#ec.MoveLineBottom" TARGET="main">MoveLineBottom</A></LI> <LI><A HREF="command.html#ec.ScrollLeft" TARGET="main">ScrollLeft</A></LI> <LI><A HREF="command.html#ec.ScrollRight" TARGET="main">ScrollRight</A></LI> <LI><A HREF="command.html#ec.ScrollDown" TARGET="main">ScrollDown</A></LI> <LI><A HREF="command.html#ec.ScrollUp" TARGET="main">ScrollUp</A></LI> <LI><A HREF="command.html#ec.MoveFoldTop" TARGET="main">MoveFoldTop</A></LI> <LI><A HREF="command.html#ec.MoveFoldPrev" TARGET="main">MoveFoldPrev</A></LI> <LI><A HREF="command.html#ec.MoveFoldNext" TARGET="main">MoveFoldNext</A></LI> <LI><A HREF="command.html#ec.MoveBeginOrNonWhite" TARGET="main">MoveBeginOrNonWhite</A></LI> <LI><A HREF="command.html#ec.MoveBeginLinePageFile" TARGET="main">MoveBeginLinePageFile</A></LI> <LI><A HREF="command.html#ec.MoveEndLinePageFile" TARGET="main">MoveEndLinePageFile</A></LI> <LI><A HREF="command.html#ec.MoveToLine" TARGET="main">MoveToLine</A></LI> <LI><A HREF="command.html#ec.MoveToColumn" TARGET="main">MoveToColumn</A></LI> <LI><A HREF="command.html#ec.MoveSavedPosCol" TARGET="main">MoveSavedPosCol</A></LI> <LI><A HREF="command.html#ec.MoveSavedPosRow" TARGET="main">MoveSavedPosRow</A></LI> <LI><A HREF="command.html#ec.MoveSavedPos" TARGET="main">MoveSavedPos</A></LI> <LI><A HREF="command.html#ec.SavePos" TARGET="main">SavePos</A></LI> <LI><A HREF="command.html#ec.MovePrevPos" TARGET="main">MovePrevPos</A></LI> </DL> <LI><A HREF="command.html#cmd_delete" TARGET="main">Deleting Text</A></LI> <DL> <LI><A HREF="command.html#ec.KillLine" TARGET="main">KillLine</A></LI> <LI><A HREF="command.html#ec.KillChar" TARGET="main">KillChar</A></LI> <LI><A HREF="command.html#ec.KillCharPrev" TARGET="main">KillCharPrev</A></LI> <LI><A HREF="command.html#ec.KillWord" TARGET="main">KillWord</A></LI> <LI><A HREF="command.html#ec.KillWordPrev" TARGET="main">KillWordPrev</A></LI> <LI><A HREF="command.html#ec.KillWordOrCap" TARGET="main">KillWordOrCap</A></LI> <LI><A HREF="command.html#ec.KillWordOrCapPrev" TARGET="main">KillWordOrCapPrev</A></LI> <LI><A HREF="command.html#ec.KillToLineStart" TARGET="main">KillToLineStart</A></LI> <LI><A HREF="command.html#ec.KillToLineEnd" TARGET="main">KillToLineEnd</A></LI> <LI><A HREF="command.html#ec.KillBlock" TARGET="main">KillBlock</A></LI> <LI><A HREF="command.html#ec.KillBlockOrChar" TARGET="main">KillBlockOrChar</A></LI> <LI><A HREF="command.html#ec.KillBlockOrCharPrev" TARGET="main">KillBlockOrCharPrev</A></LI> <LI><A HREF="command.html#ec.Delete" TARGET="main">Delete</A></LI> <LI><A HREF="command.html#ec.BackSpace" TARGET="main">BackSpace</A></LI> </DL> <LI><A HREF="command.html#cmd_line" TARGET="main">Line Commands</A></LI> <DL> <LI><A HREF="command.html#ec.LineInsert" TARGET="main">LineInsert</A></LI> <LI><A HREF="command.html#ec.LineAdd" TARGET="main">LineAdd</A></LI> <LI><A HREF="command.html#ec.LineSplit" TARGET="main">LineSplit</A></LI> <LI><A HREF="command.html#ec.LineJoin" TARGET="main">LineJoin</A></LI> <LI><A HREF="command.html#ec.LineNew" TARGET="main">LineNew</A></LI> <LI><A HREF="command.html#ec.LineIndent" TARGET="main">LineIndent</A></LI> <LI><A HREF="command.html#ec.LineTrim" TARGET="main">LineTrim</A></LI> <LI><A HREF="command.html#ec.LineDuplicate" TARGET="main">LineDuplicate</A></LI> <LI><A HREF="command.html#ec.LineCenter" TARGET="main">LineCenter</A></LI> </DL> <LI><A HREF="command.html#cmd_block" TARGET="main">Block Commands</A></LI> <DL> <LI><A HREF="command.html#ec.BlockBegin" TARGET="main">BlockBegin</A></LI> <LI><A HREF="command.html#ec.BlockEnd" TARGET="main">BlockEnd</A></LI> <LI><A HREF="command.html#ec.BlockUnmark" TARGET="main">BlockUnmark</A></LI> <LI><A HREF="command.html#ec.BlockCut" TARGET="main">BlockCut</A></LI> <LI><A HREF="command.html#ec.BlockCopy" TARGET="main">BlockCopy</A></LI> <LI><A HREF="command.html#ec.BlockCutAppend" TARGET="main">BlockCutAppend</A></LI> <LI><A HREF="command.html#ec.BlockCopyAppend" TARGET="main">BlockCopyAppend</A></LI> <LI><A HREF="command.html#ec.BlockClear" TARGET="main">BlockClear</A></LI> <LI><A HREF="command.html#ec.BlockPaste" TARGET="main">BlockPaste</A></LI> <LI><A HREF="command.html#ec.BlockKill" TARGET="main">BlockKill</A></LI> <LI><A HREF="command.html#ec.BlockIndent" TARGET="main">BlockIndent</A></LI> <LI><A HREF="command.html#ec.BlockUnindent" TARGET="main">BlockUnindent</A></LI> <LI><A HREF="command.html#ec.BlockMarkStream" TARGET="main">BlockMarkStream</A></LI> <LI><A HREF="command.html#ec.BlockMarkLine" TARGET="main">BlockMarkLine</A></LI> <LI><A HREF="command.html#ec.BlockMarkColumn" TARGET="main">BlockMarkColumn</A></LI> <LI><A HREF="command.html#ec.BlockExtendBegin" TARGET="main">BlockExtendBegin</A></LI> <LI><A HREF="command.html#ec.BlockExtendEnd" TARGET="main">BlockExtendEnd</A></LI> <LI><A HREF="command.html#ec.BlockReIndent" TARGET="main">BlockReIndent</A></LI> <LI><A HREF="command.html#ec.BlockSelectWord" TARGET="main">BlockSelectWord</A></LI> <LI><A HREF="command.html#ec.BlockSelectLine" TARGET="main">BlockSelectLine</A></LI> <LI><A HREF="command.html#ec.BlockSelectPara" TARGET="main">BlockSelectPara</A></LI> <LI><A HREF="command.html#ec.BlockPasteStream" TARGET="main">BlockPasteStream</A></LI> <LI><A HREF="command.html#ec.BlockPasteLine" TARGET="main">BlockPasteLine</A></LI> <LI><A HREF="command.html#ec.BlockPasteColumn" TARGET="main">BlockPasteColumn</A></LI> <LI><A HREF="command.html#ec.BlockPrint" TARGET="main">BlockPrint</A></LI> <LI><A HREF="command.html#ec.BlockRead" TARGET="main">BlockRead</A></LI> <LI><A HREF="command.html#ec.BlockReadStream" TARGET="main">BlockReadStream</A></LI> <LI><A HREF="command.html#ec.BlockReadLine" TARGET="main">BlockReadLine</A></LI> <LI><A HREF="command.html#ec.BlockReadColumn" TARGET="main">BlockReadColumn</A></LI> <LI><A HREF="command.html#ec.BlockWrite" TARGET="main">BlockWrite</A></LI> <LI><A HREF="command.html#ec.BlockSort" TARGET="main">BlockSort</A></LI> <LI><A HREF="command.html#ec.BlockSortReverse" TARGET="main">BlockSortReverse</A></LI> <LI><A HREF="command.html#ec.BlockUnTab" TARGET="main">BlockUnTab</A></LI> <LI><A HREF="command.html#ec.BlockEnTab" TARGET="main">BlockEnTab</A></LI> <LI><A HREF="command.html#ec.BlockMarkFunction" TARGET="main">BlockMarkFunction</A></LI> <LI><A HREF="command.html#ec.BlockTrim" TARGET="main">BlockTrim</A></LI> </DL> <LI><A HREF="command.html#cmd_edit" TARGET="main">Text Editing and Insertion</A></LI> <DL> <LI><A HREF="command.html#ec.Undo" TARGET="main">Undo</A></LI> <LI><A HREF="command.html#ec.Redo" TARGET="main">Redo</A></LI> </DL> <LI><A HREF="command.html#cmd_fold" TARGET="main">Folding Text</A></LI> <DL> <LI><A HREF="command.html#ec.FoldCreate" TARGET="main">FoldCreate</A></LI> <LI><A HREF="command.html#ec.FoldCreateByRegexp" TARGET="main">FoldCreateByRegexp</A></LI> <LI><A HREF="command.html#ec.FoldCreateAtRoutines" TARGET="main">FoldCreateAtRoutines</A></LI> <LI><A HREF="command.html#ec.FoldDestroy" TARGET="main">FoldDestroy</A></LI> <LI><A HREF="command.html#ec.FoldDestroyAll" TARGET="main">FoldDestroyAll</A></LI> <LI><A HREF="command.html#ec.FoldPromote" TARGET="main">FoldPromote</A></LI> <LI><A HREF="command.html#ec.FoldDemote" TARGET="main">FoldDemote</A></LI> <LI><A HREF="command.html#ec.FoldOpen" TARGET="main">FoldOpen</A></LI> <LI><A HREF="command.html#ec.FoldOpenNested" TARGET="main">FoldOpenNested</A></LI> <LI><A HREF="command.html#ec.FoldClose" TARGET="main">FoldClose</A></LI> <LI><A HREF="command.html#ec.FoldOpenAll" TARGET="main">FoldOpenAll</A></LI> <LI><A HREF="command.html#ec.FoldCloseAll" TARGET="main">FoldCloseAll</A></LI> <LI><A HREF="command.html#ec.FoldToggleOpenClose" TARGET="main">FoldToggleOpenClose</A></LI> </DL> <LI><A HREF="command.html#cmd_bookmark" TARGET="main">Bookmarks</A></LI> <DL> <LI><A HREF="command.html#ec.PlaceBookmark" TARGET="main">PlaceBookmark</A></LI> <LI><A HREF="command.html#ec.RemoveBookmark" TARGET="main">RemoveBookmark</A></LI> <LI><A HREF="command.html#ec.GotoBookmark" TARGET="main">GotoBookmark</A></LI> <LI><A HREF="command.html#ec.PlaceGlobalBookmark" TARGET="main">PlaceGlobalBookmark</A></LI> <LI><A HREF="command.html#ec.RemoveGlobalBookmark" TARGET="main">RemoveGlobalBookmark</A></LI> <LI><A HREF="command.html#ec.GotoGlobalBookmark" TARGET="main">GotoGlobalBookmark</A></LI> <LI><A HREF="command.html#ec.PushGlobalBookmark" TARGET="main">PushGlobalBookmark</A></LI> <LI><A HREF="command.html#ec.PopGlobalBookmark" TARGET="main">PopGlobalBookmark</A></LI> </DL> <LI><A HREF="command.html#cmd_trans" TARGET="main">Character Translation</A></LI> <DL> <LI><A HREF="command.html#ec.CharCaseUp" TARGET="main">CharCaseUp</A></LI> <LI><A HREF="command.html#ec.CharCaseDown" TARGET="main">CharCaseDown</A></LI> <LI><A HREF="command.html#ec.CharCaseToggle" TARGET="main">CharCaseToggle</A></LI> <LI><A HREF="command.html#ec.CharTrans" TARGET="main">CharTrans</A></LI> <LI><A HREF="command.html#ec.LineCaseUp" TARGET="main">LineCaseUp</A></LI> <LI><A HREF="command.html#ec.LineCaseDown" TARGET="main">LineCaseDown</A></LI> <LI><A HREF="command.html#ec.LineCaseToggle" TARGET="main">LineCaseToggle</A></LI> <LI><A HREF="command.html#ec.LineTrans" TARGET="main">LineTrans</A></LI> <LI><A HREF="command.html#ec.BlockCaseUp" TARGET="main">BlockCaseUp</A></LI> <LI><A HREF="command.html#ec.BlockCaseDown" TARGET="main">BlockCaseDown</A></LI> <LI><A HREF="command.html#ec.BlockCaseToggle" TARGET="main">BlockCaseToggle</A></LI> <LI><A HREF="command.html#ec.BlockTrans" TARGET="main">BlockTrans</A></LI> <LI><A HREF="command.html#ec.InsertString" TARGET="main">InsertString</A></LI> <LI><A HREF="command.html#ec.InsertSpace" TARGET="main">InsertSpace</A></LI> <LI><A HREF="command.html#ec.InsertChar" TARGET="main">InsertChar</A></LI> <LI><A HREF="command.html#ec.TypeChar" TARGET="main">TypeChar</A></LI> <LI><A HREF="command.html#ec.InsertTab" TARGET="main">InsertTab</A></LI> <LI><A HREF="command.html#ec.InsertSpacesToTab" TARGET="main">InsertSpacesToTab</A></LI> <LI><A HREF="command.html#ec.SelfInsert" TARGET="main">SelfInsert</A></LI> <LI><A HREF="command.html#ec.WrapPara" TARGET="main">WrapPara</A></LI> <LI><A HREF="command.html#ec.InsPrevLineChar" TARGET="main">InsPrevLineChar</A></LI> <LI><A HREF="command.html#ec.InsPrevLineToEol" TARGET="main">InsPrevLineToEol</A></LI> <LI><A HREF="command.html#ec.CompleteWord" TARGET="main">CompleteWord</A></LI> <LI><A HREF="command.html#ec.FilePrev" TARGET="main">FilePrev</A></LI> <LI><A HREF="command.html#ec.FileNext" TARGET="main">FileNext</A></LI> <LI><A HREF="command.html#ec.FileLast" TARGET="main">FileLast</A></LI> <LI><A HREF="command.html#ec.SwitchTo" TARGET="main">SwitchTo</A></LI> </DL> <LI><A HREF="command.html#cmd_file" TARGET="main">File Commands</A></LI> <DL> <LI><A HREF="command.html#ec.FileOpen" TARGET="main">FileOpen</A></LI> <LI><A HREF="command.html#ec.FileOpenInMode" TARGET="main">FileOpenInMode</A></LI> <LI><A HREF="command.html#ec.FileReload" TARGET="main">FileReload</A></LI> <LI><A HREF="command.html#ec.FileSave" TARGET="main">FileSave</A></LI> <LI><A HREF="command.html#ec.FileSaveAll" TARGET="main">FileSaveAll</A></LI> <LI><A HREF="command.html#ec.FileSaveAs" TARGET="main">FileSaveAs</A></LI> <LI><A HREF="command.html#ec.FileWriteTo" TARGET="main">FileWriteTo</A></LI> <LI><A HREF="command.html#ec.FilePrint" TARGET="main">FilePrint</A></LI> <LI><A HREF="command.html#ec.FileClose" TARGET="main">FileClose</A></LI> <LI><A HREF="command.html#ec.FileCloseAll" TARGET="main">FileCloseAll</A></LI> <LI><A HREF="command.html#ec.FileTrim" TARGET="main">FileTrim</A></LI> </DL> <LI><A HREF="command.html#cmd_directory" TARGET="main">Directory Commands</A></LI> <DL> <LI><A HREF="command.html#ec.DirOpen" TARGET="main">DirOpen</A></LI> <LI><A HREF="command.html#ec.DirGoUp" TARGET="main">DirGoUp</A></LI> <LI><A HREF="command.html#ec.DirGoDown" TARGET="main">DirGoDown</A></LI> <LI><A HREF="command.html#ec.DirGoRoot" TARGET="main">DirGoRoot</A></LI> <LI><A HREF="command.html#ec.DirGoto" TARGET="main">DirGoto</A></LI> <LI><A HREF="command.html#ec.DirSearchCancel" TARGET="main">DirSearchCancel</A></LI> <LI><A HREF="command.html#ec.DirSearchNext" TARGET="main">DirSearchNext</A></LI> <LI><A HREF="command.html#ec.DirSearchPrev" TARGET="main">DirSearchPrev</A></LI> </DL> <LI><A HREF="command.html#cmd_search" TARGET="main">Search and Replace</A></LI> <DL> <LI><A HREF="command.html#ec.IncrementalSearch" TARGET="main">IncrementalSearch</A></LI> <LI><A HREF="command.html#ec.Find" TARGET="main">Find</A></LI> <LI><A HREF="command.html#ec.FindReplace" TARGET="main">FindReplace</A></LI> <LI><A HREF="command.html#ec.FindRepeat" TARGET="main">FindRepeat</A></LI> <LI><A HREF="command.html#ec.FindRepeatOnce" TARGET="main">FindRepeatOnce</A></LI> <LI><A HREF="command.html#ec.FindRepeatReverse" TARGET="main">FindRepeatReverse</A></LI> <LI><A HREF="command.html#ec.MatchBracket" TARGET="main">MatchBracket</A></LI> <LI><A HREF="command.html#ec.HilitWord" TARGET="main">HilitWord</A></LI> <LI><A HREF="command.html#ec.SearchWordPrev" TARGET="main">SearchWordPrev</A></LI> <LI><A HREF="command.html#ec.SearchWordNext" TARGET="main">SearchWordNext</A></LI> <LI><A HREF="command.html#ec.HilitMatchBracket" TARGET="main">HilitMatchBracket</A></LI> </DL> <LI><A HREF="command.html#cmd_window" TARGET="main">Window Commands</A></LI> <DL> <LI><A HREF="command.html#ec.WinHSplit" TARGET="main">WinHSplit</A></LI> <LI><A HREF="command.html#ec.WinNext" TARGET="main">WinNext</A></LI> <LI><A HREF="command.html#ec.WinPrev" TARGET="main">WinPrev</A></LI> <LI><A HREF="command.html#ec.WinClose" TARGET="main">WinClose</A></LI> <LI><A HREF="command.html#ec.WinZoom" TARGET="main">WinZoom</A></LI> <LI><A HREF="command.html#ec.WinResize" TARGET="main">WinResize</A></LI> <LI><A HREF="command.html#ec.ViewBuffers" TARGET="main">ViewBuffers</A></LI> <LI><A HREF="command.html#ec.ListRoutines" TARGET="main">ListRoutines</A></LI> <LI><A HREF="command.html#ec.ExitEditor" TARGET="main">ExitEditor</A></LI> <LI><A HREF="command.html#ec.ShowEntryScreen" TARGET="main">ShowEntryScreen</A></LI> </DL> <LI><A HREF="command.html#cmd_compile" TARGET="main">Compiler Support</A></LI> <DL> <LI><A HREF="command.html#ec.Compile" TARGET="main">Compile</A></LI> <LI><A HREF="command.html#ec.RunCompiler" TARGET="main">RunCompiler</A></LI> <LI><A HREF="command.html#ec.ViewMessages" TARGET="main">ViewMessages</A></LI> <LI><A HREF="command.html#ec.CompileNextError" TARGET="main">CompileNextError</A></LI> <LI><A HREF="command.html#ec.CompilePrevError" TARGET="main">CompilePrevError</A></LI> <LI><A HREF="command.html#ec.RunProgram" TARGET="main">RunProgram</A></LI> </DL> <LI><A HREF="command.html#cmd_cvs" TARGET="main">CVS Support</A></LI> <DL> <LI><A HREF="command.html#ec.Cvs" TARGET="main">Cvs</A></LI> <LI><A HREF="command.html#ec.RunCvs" TARGET="main">RunCvs</A></LI> <LI><A HREF="command.html#ec.ViewCvs" TARGET="main">ViewCvs</A></LI> <LI><A HREF="command.html#ec.ClearCvsMessages" TARGET="main">ClearCvsMessages</A></LI> <LI><A HREF="command.html#ec.CvsDiff" TARGET="main">CvsDiff</A></LI> <LI><A HREF="command.html#ec.RunCvsDiff" TARGET="main">RunCvsDiff</A></LI> <LI><A HREF="command.html#ec.ViewCvsDiff" TARGET="main">ViewCvsDiff</A></LI> <LI><A HREF="command.html#ec.CvsCommit" TARGET="main">CvsCommit</A></LI> <LI><A HREF="command.html#ec.RunCvsCommit" TARGET="main">RunCvsCommit</A></LI> <LI><A HREF="command.html#ec.ViewCvsLog" TARGET="main">ViewCvsLog</A></LI> </DL> <LI><A HREF="command.html#cmd_svn" TARGET="main">SVN Support</A></LI> <DL> <LI><A HREF="command.html#ec.Svn" TARGET="main">Svn</A></LI> <LI><A HREF="command.html#ec.RunSvn" TARGET="main">RunSvn</A></LI> <LI><A HREF="command.html#ec.ViewSvn" TARGET="main">ViewSvn</A></LI> <LI><A HREF="command.html#ec.ClearSvnMessages" TARGET="main">ClearSvnMessages</A></LI> <LI><A HREF="command.html#ec.SvnDiff" TARGET="main">SvnDiff</A></LI> <LI><A HREF="command.html#ec.RunSvnDiff" TARGET="main">RunSvnDiff</A></LI> <LI><A HREF="command.html#ec.ViewSvnDiff" TARGET="main">ViewSvnDiff</A></LI> <LI><A HREF="command.html#ec.SvnCommit" TARGET="main">SvnCommit</A></LI> <LI><A HREF="command.html#ec.RunSvnCommit" TARGET="main">RunSvnCommit</A></LI> <LI><A HREF="command.html#ec.ViewSvnLog" TARGET="main">ViewSvnLog</A></LI> </DL> <LI><A HREF="command.html#cmd_tags" TARGET="main">TAGS Commands</A></LI> <DL> <LI><A HREF="command.html#ec.TagFind" TARGET="main">TagFind</A></LI> <LI><A HREF="command.html#ec.TagFindWord" TARGET="main">TagFindWord</A></LI> <LI><A HREF="command.html#ec.TagNext" TARGET="main">TagNext</A></LI> <LI><A HREF="command.html#ec.TagPrev" TARGET="main">TagPrev</A></LI> <LI><A HREF="command.html#ec.TagPop" TARGET="main">TagPop</A></LI> <LI><A HREF="command.html#ec.TagLoad" TARGET="main">TagLoad</A></LI> <LI><A HREF="command.html#ec.TagClear" TARGET="main">TagClear</A></LI> <LI><A HREF="command.html#ec.TagGoto" TARGET="main">TagGoto</A></LI> </DL> <LI><A HREF="command.html#cmd_option" TARGET="main">Option commands</A></LI> <DL> <LI><A HREF="command.html#ec.ToggleAutoIndent" TARGET="main">ToggleAutoIndent</A></LI> <LI><A HREF="command.html#ec.ToggleInsert" TARGET="main">ToggleInsert</A></LI> <LI><A HREF="command.html#ec.ToggleExpandTabs" TARGET="main">ToggleExpandTabs</A></LI> <LI><A HREF="command.html#ec.ToggleShowTabs" TARGET="main">ToggleShowTabs</A></LI> <LI><A HREF="command.html#ec.ToggleUndo" TARGET="main">ToggleUndo</A></LI> <LI><A HREF="command.html#ec.ToggleReadOnly" TARGET="main">ToggleReadOnly</A></LI> <LI><A HREF="command.html#ec.ToggleKeepBackups" TARGET="main">ToggleKeepBackups</A></LI> <LI><A HREF="command.html#ec.ToggleMatchCase" TARGET="main">ToggleMatchCase</A></LI> <LI><A HREF="command.html#ec.ToggleBackSpKillTab" TARGET="main">ToggleBackSpKillTab</A></LI> <LI><A HREF="command.html#ec.ToggleDeleteKillTab" TARGET="main">ToggleDeleteKillTab</A></LI> <LI><A HREF="command.html#ec.ToggleSpaceTabs" TARGET="main">ToggleSpaceTabs</A></LI> <LI><A HREF="command.html#ec.ToggleIndentWithTabs" TARGET="main">ToggleIndentWithTabs</A></LI> <LI><A HREF="command.html#ec.ToggleBackSpUnindents" TARGET="main">ToggleBackSpUnindents</A></LI> <LI><A HREF="command.html#ec.ToggleWordWrap" TARGET="main">ToggleWordWrap</A></LI> <LI><A HREF="command.html#ec.ToggleTrim" TARGET="main">ToggleTrim</A></LI> <LI><A HREF="command.html#ec.ToggleShowMarkers" TARGET="main">ToggleShowMarkers</A></LI> <LI><A HREF="command.html#ec.ToggleHilitTags" TARGET="main">ToggleHilitTags</A></LI> <LI><A HREF="command.html#ec.ToggleShowBookmarks" TARGET="main">ToggleShowBookmarks</A></LI> <LI><A HREF="command.html#ec.ToggleMakeBackups" TARGET="main">ToggleMakeBackups</A></LI> <LI><A HREF="command.html#ec.SetLeftMargin" TARGET="main">SetLeftMargin</A></LI> <LI><A HREF="command.html#ec.SetRightMargin" TARGET="main">SetRightMargin</A></LI> <LI><A HREF="command.html#ec.ToggleSysClipboard" TARGET="main">ToggleSysClipboard</A></LI> <LI><A HREF="command.html#ec.SetPrintDevice" TARGET="main">SetPrintDevice</A></LI> <LI><A HREF="command.html#ec.ChangeTabSize" TARGET="main">ChangeTabSize</A></LI> <LI><A HREF="command.html#ec.ChangeLeftMargin" TARGET="main">ChangeLeftMargin</A></LI> <LI><A HREF="command.html#ec.ChangeRightMargin" TARGET="main">ChangeRightMargin</A></LI> </DL> <LI><A HREF="command.html#cmd_other" TARGET="main">Other commands</A></LI> <DL> <LI><A HREF="command.html#ec.ShowPosition" TARGET="main">ShowPosition</A></LI> <LI><A HREF="command.html#ec.ShowVersion" TARGET="main">ShowVersion</A></LI> <LI><A HREF="command.html#ec.ShowKey" TARGET="main">ShowKey</A></LI> <LI><A HREF="command.html#ec.WinRefresh" TARGET="main">WinRefresh</A></LI> <LI><A HREF="command.html#ec.MainMenu" TARGET="main">MainMenu</A></LI> <LI><A HREF="command.html#ec.ShowMenu" TARGET="main">ShowMenu</A></LI> <LI><A HREF="command.html#ec.LocalMenu" TARGET="main">LocalMenu</A></LI> <LI><A HREF="command.html#ec.ChangeMode" TARGET="main">ChangeMode</A></LI> <LI><A HREF="command.html#ec.ChangeKeys" TARGET="main">ChangeKeys</A></LI> <LI><A HREF="command.html#ec.ChangeFlags" TARGET="main">ChangeFlags</A></LI> <LI><A HREF="command.html#ec.Cancel" TARGET="main">Cancel</A></LI> <LI><A HREF="command.html#ec.Activate" TARGET="main">Activate</A></LI> <LI><A HREF="command.html#ec.Rescan" TARGET="main">Rescan</A></LI> <LI><A HREF="command.html#ec.CloseActivate" TARGET="main">CloseActivate</A></LI> <LI><A HREF="command.html#ec.ActivateInOtherWindow" TARGET="main">ActivateInOtherWindow</A></LI> <LI><A HREF="command.html#ec.DeleteFile" TARGET="main">DeleteFile</A></LI> <LI><A HREF="command.html#ec.ASCIITable" TARGET="main">ASCIITable</A></LI> <LI><A HREF="command.html#ec.DesktopSave" TARGET="main">DesktopSave</A></LI> <LI><A HREF="command.html#ec.ClipClear" TARGET="main">ClipClear</A></LI> <LI><A HREF="command.html#ec.DesktopSaveAs" TARGET="main">DesktopSaveAs</A></LI> <LI><A HREF="command.html#ec.ChildClose" TARGET="main">ChildClose</A></LI> <LI><A HREF="command.html#ec.BufListFileSave" TARGET="main">BufListFileSave</A></LI> <LI><A HREF="command.html#ec.BufListFileClose" TARGET="main">BufListFileClose</A></LI> <LI><A HREF="command.html#ec.BufListSearchCancel" TARGET="main">BufListSearchCancel</A></LI> <LI><A HREF="command.html#ec.BufListSearchNext" TARGET="main">BufListSearchNext</A></LI> <LI><A HREF="command.html#ec.BufListSearchPrev" TARGET="main">BufListSearchPrev</A></LI> <LI><A HREF="command.html#ec.ViewModeMap" TARGET="main">ViewModeMap</A></LI> <LI><A HREF="command.html#ec.ClearMessages" TARGET="main">ClearMessages</A></LI> <LI><A HREF="command.html#ec.IndentFunction" TARGET="main">IndentFunction</A></LI> <LI><A HREF="command.html#ec.MoveFunctionPrev" TARGET="main">MoveFunctionPrev</A></LI> <LI><A HREF="command.html#ec.MoveFunctionNext" TARGET="main">MoveFunctionNext</A></LI> <LI><A HREF="command.html#ec.InsertDate" TARGET="main">InsertDate</A></LI> <LI><A HREF="command.html#ec.InsertUid" TARGET="main">InsertUid</A></LI> <LI><A HREF="command.html#ec.FrameNew" TARGET="main">FrameNew</A></LI> <LI><A HREF="command.html#ec.FrameClose" TARGET="main">FrameClose</A></LI> <LI><A HREF="command.html#ec.FrameNext" TARGET="main">FrameNext</A></LI> <LI><A HREF="command.html#ec.FramePrev" TARGET="main">FramePrev</A></LI> <LI><A HREF="command.html#ec.BufferViewNext" TARGET="main">BufferViewNext</A></LI> <LI><A HREF="command.html#ec.BufferViewPrev" TARGET="main">BufferViewPrev</A></LI> <LI><A HREF="command.html#ec.ShowHelpWord" TARGET="main">ShowHelpWord</A></LI> <LI><A HREF="command.html#ec.ShowHelp" TARGET="main">ShowHelp</A></LI> <LI><A HREF="command.html#ec.ConfigRecompile" TARGET="main">ConfigRecompile</A></LI> <LI><A HREF="command.html#ec.SetCIndentStyle" TARGET="main">SetCIndentStyle</A></LI> <LI><A HREF="command.html#ec.SetIndentWithTabs" TARGET="main">SetIndentWithTabs</A></LI> <LI><A HREF="command.html#ec.ListMark" TARGET="main">ListMark</A></LI> <LI><A HREF="command.html#ec.ListUnmark" TARGET="main">ListUnmark</A></LI> <LI><A HREF="command.html#ec.ListToggleMark" TARGET="main">ListToggleMark</A></LI> <LI><A HREF="command.html#ec.ListMarkAll" TARGET="main">ListMarkAll</A></LI> <LI><A HREF="command.html#ec.ListUnmarkAll" TARGET="main">ListUnmarkAll</A></LI> <LI><A HREF="command.html#ec.ListToggleMarkAll" TARGET="main">ListToggleMarkAll</A></LI> </DL> </DL> <LI><A HREF="perftips.html" TARGET="main"> Performance Tips</A></LI> </DL> ������������./doc/global.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000014157�07045070575�012567� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Global Configuration</TITLE></HEAD> <BODY> <H1><A NAME="set-global">Global Settings</A></H1> The following settings can be used in the <B>GLOBAL</B> section of the configuration file. Some of the options are platform specific (to be fixed). <H2><A NAME="gs.DefaultModeName">DefaultModeName</A></H2> Default mode name for loading/editing files. If not set or invalid, first mode in the configuration file will be used instead. By default set to 'PLAIN'. <H2><A NAME="gs.CompletionFilter">CompletionFilter</A></H2> Files matching this regexp are ignored when doing filename completion. <H2><A NAME="gs.CompileRx">CompileRx</A></H2> Defines <A HREF="regexp.html">regular expressions</A> and thers subpattern indices to match when searching for errors and warnings in compilation output. First number is an index of the subpattern that matches filename. The second must match the line number, the third parameter is the regular expression to match to each line of the compiler output. <H2><A NAME="gs.OpenAfterClose">OpenAfterClose</A></H2> If set to 1, editor will prompt for another file when all files are closed. <H2><A NAME="gs.SysClipboard">SysClipboard</A></H2> When set to 1, editor will use external (PM, X11) clipboard instead of internal one. <H2><A NAME="gs.ScreenSizeX">ScreenSizeX</A></H2> Number of columns visible on screen or window <H2><A NAME="gs.ScreenSizeY">ScreenSizeY</A></H2> Number of lines visible on screen or window <H2><A NAME="gs.CursorInsertStart">CursorInsertStart</A></H2> Starting percentage of cursor size (from top) when in insert mode. <H2><A NAME="gs.CursorInsertEnd">CursorInsertEnd</A></H2> Ending percentage of cursor size when in insert mode. <H2><A NAME="gs.CursorOverStart">CursorOverStart</A></H2> Starting percentage of cursor size when in overstrike mode <H2><A NAME="gs.CursorOverEnd">CursorOverEnd</A></H2> Ending percentage of cursor size when in overstrike mode. <H2><A NAME="gs.SelectPathname">SelectPathname</A></H2> If set to 1, pathname will be selected by default when prompting for a file in <A HREF="command.html#ec.FileOpen">FileOpen</A> function. If set to 0, pathname will not be selected, this allows you to quickly type a new filename, without erasing an entire entryfield. <H2><A NAME="gs.ShowMenuBar">ShowMenuBar</A></H2> If set to 1, main menu bar will be visible. <H2><A NAME="gs.ShowVScroll">ShowVScroll</A></H2> If set to 1, scroll bar will be visible. <H2><A NAME="gs.ShowHScroll">ShowHScroll</A></H2> If set to 1, scroll bar will be visible. <H2><A NAME="gs.KeepHistory">KeepHistory</A></H2> If set to 1, last file position and imput prompt history will be loaded on startup and saved on exit. Can be overriden with command line option '-h'. <H2><A NAME="gs.LoadDesktopOnEntry">LoadDesktopOnEntry</A></H2> If set to 1, all files listed in FTE.DSK in current directory or FTE.EXE directory will be loaded into FTE. The desktop file can be overriden with command line option '-d'. <P> If set to 2, desktop is only loaded (and saved) if there are no files specified on the command line. <H2><A NAME="gs.SaveDesktopOnExit">SaveDesktopOnExit</A></H2> If set to 1, desktop will be automatically saved when <A HREF="command.html#ec.ExitEditor">ExitEditor</A> command is issued. <H2><A NAME="gs.KeepMessages">KeepMessages</A></H2> If set to 1, compiler messages will be kept until deleted by user. <H2><A NAME="gs.ScrollBorderX">ScrollBorderX</A></H2> Horizontal offset to the border before window starts scrolling. <H2><A NAME="gs.ScrollBorderY">ScrollBorderY</A></H2> Vertical offset to the border before window starts scrolling. <H2><A NAME="gs.ScrollJumpX">ScrollJumpX</A></H2> Scroll window by this many columns when cursor reaches scrolling border. <H2><A NAME="gs.ScrollJumpY">ScrollJumpY</A></H2> Scroll window by this many lines when cursor reaches scrolling border. <H2>C_*</H2> Define the C mode smart indentation parameters <P> See section on <A HREF="#global-cmode">configuring C mode indentation</A>. <H2><A NAME="gs.REXX_Indent">REXX_Indent</A></H2> Defines the REXX basic indentation level <H1><A NAME="global-cmode">CMode Smart Indentation</A></H1> <B>Settings for CMode smart indentation</B> <P> <DL> <DT><B>C_Indent</B><DD>Basic C indentation level <DT><B>C_BraceOfs</B><DD>Brace '{' offset <DT><B>C_CaseOfs</B><DD>Offset of case and default statements <DT><B>C_CaseDelta</B><DD>Offsets of statements following case/default. <DT><B>C_ClassOfs</B><DD>Offset of public, private and protected <DT><B>C_ClassDelta</B><DD>Offset of statements following public, private, protected <DT><B>C_ColonOfs</B><DD>Offset of labels <DT><B>C_CommentOfs</B><DD>Offset of comments <DT><B>C_CommentDelta</B><DD>Offset of second line of comments <DT><B>C_FirstLevelWidth</B><DD>Width of the first indentation level (indent of '{' in the function start). <DT><B>C_FirstLevelIndent</B><DD>Indentation of statements in the first indentation level. <DT><B>C_ParenDelta</B><DD>When >= 0, offset of continued text after '('. When set to -1, the offset is equal to position of '(' plus one. </DL> <P> Example 1: <PRE> class line { public: // C_ClassOfs = 0 line(); // C_ClassDelta = 4 ~line(); }; int main() { int x = 1; /* // C_CommentOfs = 0 * check value // C_CommentDelta = 1 */ puts("main"); // C_Indent = 4 if (x) { // C_BraceOfs = 0 switch (x) { case 1: // C_CaseOfs = 0 puts("ok"); // C_CaseDelta = 4 break; } } end: return 0; } </PRE> <P> Example 2: <PRE> class line { public: // C_ClassOfs = 2 line(); // C_ClassDelta = 2 ~line(); }; int main() { int x = 1; /* // C_CommentOfs = 2 ** check value // C_CommentDelta = 0 */ puts("main"); // C_Indent = 4 if (x) { // C_BraceOfs = 0 switch (x) { case 1: // C_CaseOfs = 4 puts("ok"); // C_CaseDelta = 4 break; } } end: return 0; } </PRE> </BODY> </HTML> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/cmdopt.html�����������������������������������������������������������������������������������0000644�0001750�0001750�00000004461�07045070530�012601� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD><TITLE>Command Line Options</TITLE></HEAD> <BODY> The FTE command line syntax is: <P> <TT>fte [[options] [files] ...]</TT> <H1><A NAME="command-line-options">Options</A></H1> <DL> <DT><TT><B>-l</B>line[,column]</TT> <DD>Go to line (and column) in next file specified on command line <DT><TT><B>-m</B>[MOD]E</TT> <DD>Use mode <TT>MODE</TT> for remaining files. If no argument is specified, mode override is cancelled. <DT><TT><B>-C</B>[file]</TT> <DD>Use specified configuration file (compiled). If no argument is specified, the default builtin configuration is used. <DT><TT><B>-D</B>[file.dsk]</TT> <DD>Load/save desktop from file <TT>file.dsk</TT>. If no argument is specified, desktop loading/saving is disabled. <DT><TT><B>-H</B>[file.his]</TT> <DD>Load/save history from file &lt;.his&gt;. If no argument, disable history load/save. <DT><TT><B>-T</B>tags</TT> <DD>Load tags file <TT>tags</TT>. The file must be in the format generated by the <B>ctags</B> program. <DT><TT><B>-t</B>tag</TT> <DD>Lookup tag <TT>tag</TT> and display file containing it. <DT><TT><B>--</B></TT> <DD>The rest of the arguments are not options, but filenames. <DT><TT><B>-+</B></TT> <DD>The next argument is not an option even if starting with a '-'. </DL> <P> Optional arguments are marked by [ and ] brackets. <P> There should not be any delimiter between option and it's arguments. <P> <H1><A NAME="command-line-examples">Examples</A></H1> <DL> <DT><TT>fte -mBIN fte.exe</TT> <DD>load fte.exe in BIN mode <DT><TT>fte -l100,30 win.c</TT> <DD>go to (100,30) in win.c <DT><TT>fte window.cpp</TT> <DD>load file window.cpp <DT><TT>fte -mBIN fte.exe -m fte.cpp</TT> <DD>load fte.exe in binary mode, window.cpp in default mode (C/C++) <DT><TT>fte -mBIN -+ -bla-</TT> <DD>load file -bla- in BIN mode <DT><TT>fte -- -1 -2 -3 -4 -5 -6</TT> <DD>load files -1, -2, -3, -4, -5, -6 <DT><TT>fte -D -H fte.dsk fte.his</TT> <DD>Disable desktop and history loading and saving and load files <TT>fte.dsk</TT> and <TT>fte.his</TT>. </DL> <P>Under OS/2,NT and DOS default history and desktop files are named <TT>FTE.DSK</TT> and <TT>FTE.HIS</TT> respectively. Under Unix they are named <TT>.fte-desktop</TT> and <TT>.fte-history</TT>. The global desktop and history files will be searched in program directory under OS/2 and in user home directory under Unix. </BODY> </HTML> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������./doc/index.html������������������������������������������������������������������������������������0000644�0001750�0001750�00000000332�07637665073�012436� 0����������������������������������������������������������������������������������������������������ustar �neil����������������������������neil�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<HTML> <HEAD> <TITLE>FTE Documentation</TITLE> </HEAD> <FRAMESET COLS="300,*"> <FRAME NAME="contents" SRC="contents.html"> <FRAME NAME="main" SRC="about.html"> </FRAMESET> <NOFRAMES> <BODY> </BODY> ./file_id.diz0000644000175000017500000000047711347455321011773 0ustar neilneilText Mode text editor. Version 0.50.2 Color syntax highlighting for C/C++, REXX, HTML, IPF, PERL, Ada, Pascal, TEX Multiple file/window editing, Column blocks, configurable menus and keyboard bindings, mouse support, undo/redo, regular expression search and replace, folding, background compiler execution. ./COPYING0000644000175000017500000004307607045070330010716 0ustar neilneil GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ./install0000755000175000017500000000522007606335146011260 0ustar neilneil#!/bin/sh # Installing FTE has gotten too complicated for a makefile. Thus, a shell # script. # SETTINGS: # Everything goes into this directory. If it's not set, we'll use a default. PREFIX=${PREFIX:-/usr/local} # INSTALLATION CODE (do not touch): BINDIR=$PREFIX/bin LIBDIR=$PREFIX/lib/fte CONFIGDIR=$LIBDIR/config LOCALCONFIGDIR=$LIBDIR/localconfig # To do some of this stuff, you should be root... if [ -z "$INSTALL_NONROOT" ] then id | grep "^uid=0(" > /dev/null if [ $? -ne 0 ] then echo "We don't recommend installing as non-root. To try anyway," echo "export INSTALL_NONROOT=1 before running the install." echo "NOTE: You should also export PREFIX=/your/home/dir/fte to" echo "give this a chance of working." exit 1 fi else echo "Root-check bypassed - installing at your own risk" fi # Ensure everything is made. make -e all if [ $? -ne 0 ] then echo "Not everything could be made - not going to install it." exit 1 fi # If there is a config directory, remove it. rm -rf $CONFIGDIR # Make the directories we'll need. mkdir -p $BINDIR mkdir -p $LIBDIR mkdir -p $LOCALCONFIGDIR # Set up our binaries. for file in fte xfte cfte sfte vfte nfte do # each binary is either in . or in src (if it exists at all on this platform) for dir in . src do # if this is the right directory for this file, use it. if [ -f $dir/$file ] then # try to copy it. cp $dir/$file $BINDIR 2> /dev/null # if that doesn't work, force it. # NOTE: This may crash any running copy of FTE on some platforms # AIX, Linux: confirmed okay # Sun: confirmed crash if [ $? -ne 0 ] then # Unix has the nice capability of being able to unlink # in-use files. echo "Forcing $file" rm -f $BINDIR/$file cp $dir/$file $BINDIR fi fi done done # Copy our configuration. cp -r config $LIBDIR # Somehow things may not all be properly readable by everyone. chmod a+r $CONFIGDIR/* chmod a+r $CONFIGDIR/*/* # Any CVS directory that is copied over should be uncopied over. rm -rf `find $CONFIGDIR -type d -name CVS` # Set the directories to be world-executable. chmod a+x `find $CONFIGDIR -type d` # If the sysadmin does not have a system-wide config, set it up. # If it already exists DO NOT OVERWRITE IT. if [ ! -f $LOCALCONFIGDIR/systemmain.fte ] then mv $CONFIGDIR/systemmain.fte $LOCALCONFIGDIR fi # Set up the system default rc file. (cd $CONFIGDIR; $BINDIR/cfte main.fte $LIBDIR/system.fterc) # Done. exit 0 ./README0000644000175000017500000000306711326137317010545 0ustar neilneil FTE Kit, Version 0.49.13 Copyright 1994-1998 by Marko Macek. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or b) the "Artistic License" which comes with this Kit. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details. You should have received a copy of the Artistic License with this Kit, in the file named "Artistic". If not, I'll be glad to provide one. You should also have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------- Email: Marko.Macek@gmx.net or mark@hermes.si WWW: http://www.kiss.uni-lj.si/~k4fr0235/fte/ See file NEWS for a list of recent changes. See file TODO for a list of possible future additions. See file FTE.HTML/FTE.INF for installation instructions. See file BUGS for a list of unresolved problems. Contributors: - F.Jalvingh NT/Win95/DOS port. - Markus F.X.J. Oberhumer DOS port (DJGPP) ./TODO0000644000175000017500000000220610305625200010334 0ustar neilneilTodo list (needs to be updated) ----------------------------------------------------------------------- - improve documentation - configurable smart indentation like in C/JAVA/PERL/REXX modes for any mode - fully support clipboard in every prompt - draw mode - piping block to program, redirection of program output to buffer - hex mode editing - shell window support - Menus should determine keybindings automatically. - Regexp optimizer and improved regexps. - multiple frame support for gui version. - Win32 gui version. Here are some more: - command to center the lines in block (BlockCenter) - command to wrap entire paragraph - commands to load/close desktop - remove all modal states (when getting input) (needed for kbd macros and multiframe). - fix win95 compiler execution - OS2: see if we can avoid clipserv under OS/2 using Ilya's fake-PM trick. - make configuration editor in Java (support only subset of config files?) - see if we could use java as the macro language - X11: set WM_COMMAND - Linux: make it run on tty. - Linux: fix the console version (capslock, numlock, ...) Comments and suggestions are appreciated! ./Artistic0000644000175000017500000001374007045070310011361 0ustar neilneil The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End ./NEWS0000644000175000017500000005424211605613416010364 0ustar neilneilRevision history ----------------------------------------------------------------------- 0.50.2b6 -- 2011 + Allow \r at the end-of-line when looking for the end-of-heredoc in Perl hilighting mode to make it easier to read files created on windows and transfered to unix incorrectly. + Add ShowTildeFilesInDirList global config option to allow hiding of *~ in the directory list (most of the time, I don't want this) default is true. ! Allow open-brace on same line as function name in shell mode + Added permission flags to the directory listings on unix to show rwx at a glance - makes it easier to debug certain issues, know if you can write to the file, etc. ! Compilation fixes for Windows compilers + Allow JAVA colorizer to be used for javascript files (.js) - Ongoing conversion of return codes to return consistently 1 for success or 0 for failure ! Colorizing man pages again (using MAN_KEEP_FORMATTING) + adding 2nd FD for WaitFdPipeEvent() so used in con_linux.cpp 0.50.2b5 -- March 2010 + Allowed -m flag to take lower-cased version of mode names ! .t files are perl test files, added. 0.50.2b4 -- February 2010 ! Fixed memory leaks on exits - properly destroy all buffers ! Fixed tags scanning push/pop ! Made mfte (motif version) compilable ! NCurses now handles tripple mouse clicks ! SLang even 5 clicks - and it's much better with wheel scrolling (anyone has some idea what is broken with ncurses....??) + Started to use StlString and StlVector templates - should save some code lines and make the code more readable + more constructors are using constructor initializers + simplified Xorg string printing - though there might be some errors... 0.50.2b3 -- January 2010 + Completely new keyboard handling for Slang version - it gets usable - still not as comfortable as X version, but good enough especially in gnome-terminal (more Esc sequences could be easily integrated) - Ongoing size_t conversion ! Fixed mouse handling for ncurses ! Fixed A_BOLD usage for ncurses + Adapted also keyboard handling for ncurses version + Extended with wheel scroll (HACK - use Ctrl key and scroll mouse down makes the window scrolling upward - somewhat faster then regular upward scroll - not sure why is this so much faster) ! Fixed portability issue for 'vfte' for bigendian machines - Slightly modified set of extra character displayed for vfte ! Fixed screen resize for both sfte and nfte tty frontends - Make usage of TCell class more consistent (across unix targets) - Changing some defines to enums and update functions parameters for this ! Remove linking of libncurses for vfte - not needed ! Fixed cursor movement in Slang version - color 0 was mistakenly modified - Cleanup of header file include - fte.h is now only 'base' header ! Fixed bug tracker issue: 1325707 on Linux platform - using _FILE_OFFSET_BITS 64 for 32bit compilation ! Fixed weird stack trashing due to passing of <0 numbers as unsigned + Updated several menu entries, add 'find' command example 0.50.2b2 -- January 2010 + Applied a few submitted patches from various Inet developers ! Fixed -noi18n option typo (-no18n) ! Fixed mask reset that caused problem with -noi18n startup ! Fixed few more memory leaks ! Fixed and extended some menu entries ! Fixed keyboard focus (noticable with twm) - Using more size_t - Cleanup of some compiler warnings - Some code indention 0.50.2b1 -- March 2009 - Cleanup for new Debian package - Various 64bit compilation and gcc cleanup ! Fixing bugs in pipe handling + Speeding XWindow Expose refresh and cleaning a bit this code - Adding more const - Reusing Pipe routines across unix targets 0.50.1 -- September 2006 - Cleanup and Debian package update 0.50.0 -- 2003 - Many internal and some external changes - Some bugs fixed in this release + cfte: added -p[reprocess] command line parameter, it can be used to debug configuration files. ! X11: XShellCommand is used to specify used shell under X11. $TERM is no longer used as shell. 0.46b5 + Version numbering changed. - Readonly files are not editable when loaded. - Author email/homepage changed + updated some modes (HTML) + new modes (sml, mod3, sl, sql, 4gl, sgml) - source code cleanups (warnings, const correct) + new commands: - RunProgramAsync + new macro expansion variables: - FileDirectory - FileBaseName - FileExtension + X11: support for I18N, XMB ! bug fixes: - crash on bookmark handling (pop/push) - crash when restored position outside valid file - win95 compiler execution should work again - run compiler (sync) in dosx version - linux console version fixes: - crash on cols/rows > 127 - crash in SaveAll if non-visible file requires interaction - java indentation fix (private/protected methods) + Shift+Ins support in input lines - X11: support for mouse wheel :) - ability to save All files on exit - portability fixes 0.46 ! bug fixes ! coredump when $DISPLAY not set fixed ! occasional coredump at exit from PM version fixed. ! X11: check for invalid -geometry (larger than 255x255). + colors are specified using a palette in the configuration file + ShowHelp command (view .INF file under OS/2, .HLP under Win*, manpage under UNIX). Context Sensitive. + configuration file preprocessor %if(), %endif, %define + Global (persistent) Bookmarks commands + Push/Pop bookmark + Under UNIX it should now print using lpr + SIOD mode contributed. + command FileTrim,BlockTrim - trim whitespace at end of lines + mode option to strip whitespace at EOF on FileSave. (TrimOnSave) + C/C++ indentation style is now selectable from menu + compile command configurable per mode (CompileCommand option) + command to compile without asking anything (RunCompiler) + only load desktop when no arguments on command line (option) (this is achieved by setting LoadDesktopOnEntry=2 in global.fte) + create folds with RoutineRx (command FoldCreateAtRoutines) + command to center current line (LineCenter) + OS/2: does not need 'clipserv' anymore (experimental, please report bugs). + Readonly files are not editable when loaded. 0.45 -- February 1997 ! bug fixes. ! some command line option changes (-h = help now, -H = history). + support for multiple frames in the PM version. + first win32 console version. 0.44 -- November 28 0.44b6 -- November 1996 ! Bug fixes in Linux pipe handling. ! Bug fixes in OS/2 PM version. ! Fixed repainting bugs in Messages view. 0.44b5 -- November 1996 ! Minor bug fixes. ! Changes in syntax highlighting configuration. 0.44b4 -- October 1996 ! Minor bug fixes and numerous performance improvements. + New commands: BlockEnTab, BlockUnTab. + Configurable syntax highlighting. Modes HTML/IPF/Ada/Pascal/... are now configured externally. + CTags support. New commands: TagFind, TagFindWord, TagNext, TagPrev, TagPop, TagLoad, TagClear. Needs external ctags utility to create tags file. Tagfile and tag to find can be given on command line. + New option: KeepMessages. New command: ClearMessages. + X11: added support for selection copy/paste. + PM: Accept file dropped on editor window. + PM: Optional toolbar (not configurable yet). New option: ShowToolBar. + PM: GUI dialogs (find/replace, file, ...). New option: GUIDialogs. + PM: Conditional cascade menus can now be used. + PM: Alt+Fx accelerators can now be disabled with PMDisableAccel option. - Removed WSStyleSearch flag. ! PM: Rollup of editor window should now work (tested with title.dll) ! Menus can now be overriden by predefining them. ! Unix: completion of .* (dot) files now works. ! Various fixes to C-mode smart indentation. ! BlockReadXXX caused crashes when used with bad filename. + Incremental search can now be continued by using up/down arrow. ! ExitEditor doesn't close files immediatelly after discard. Desktop is now properly saved after cancelling ExitEditor command. + PM: Bigger file selection dialog box with history and save position. + New commands: IndentFunction, BlockMarkFunction, MoveFunctionPrev, MoveFunctionNext. Contributed by: jalving@ibm.net 0.43 -- 15 July 1996 ! Minor bug fixes. ! Upper/Lower block in column mode could cause a crash. ! CompleteWord command occasionally inserted garbage when previous match was found in the same line. 0.42 -- July 1996 ! Several minor bug fixes. ! PM version doesn't crash when non-existant file is loaded on startup. ! HilitWord command now works again. + Setting for HilitWord color. + ViewModeMap command is back. 0.41 -- June 1996 ! Compile command crashed depending on command input. ! Substrings were matched for keywords in smart indentation (C,REXX) ! InsertSpacesToTab command always returned fail status. ! CFTE now compiles to temporary file first and replaces original on success only. ! CFTE returns correct errorlevel on failure (0 = ok, 1 = fail). ! SavePos/PrevPos is now stored using real line number, not virtual (folded). + BlockSort command. + UndoMoves setting can be set for mode to enable undo/redo of all cursor movements. + BlockCutAppend, BlockCopyAppend commands to append cut/copied block to clipboard. + Error message locations now track the position better when a file is edited (lines are added/removed). 0.40 -- June 1996 ! Keyword inheritance was not properly handled in colorize modes. ! Colors were not inherited in colorize modes. ! OS2: Keys Alt+, F10, Alt+Enter, Alt+Space are available for remapping. ! Some startup window sizing problems fixed. ! Fixed several bugs in configuration files (no bindings for MSG mode, some Alt+ menu shortcuts). ! Abbreviation expansion could abort with 'asssertion failed'. + Performance improvements (MatchBracket and related stuff). + OS2: Window position is now saved. + FTE now remembers the directory the compilation was started from and will resolve all relative pathnames found in error messages using this directory. The current directory is determined by currently active file or directory. If Messages are already open, FTE will use directory from there instead of the current one. The current directory of message list is always the directory the compilation was started from. 0.39 -- May 96 ! Fixed crash in Compile commands when repeating it. ! Multi-key bindings inserted an ascii char if the 2+ key was not valid. ! when inserting ) in Cmode, it failed to advance the cursor when there was no match and AutoHilitParen was set to 1. + EventMap variable to define keymap to use for mode. ! MoveToLine shows correct default line value when folds are used. - Did some reorganization of config files to make adding new binding sets easier. 0.38 -- May 96 ! Many bug fixes (mostly minor). + BlockWrite command can now append to a file. + Directory browser. ! PERL: properly highlight s[][], tr[][]. + Configuration files must now be compiled. + Syntax highlighting definitions now independant of editing mode. + Event mappings now independant of editing mode. + Abbreviatons. Can expand the text or run a macro. + Searching can now check for words without using regular expressions. + Loading files is now almost twice as fast. + File positions and prompt history is now saved in file FTE.HIS. + The list of loaded files is saved on exit to FTE.DSK. Files are automatically loaded on startup. Several settings and command line options are available to configure this. + On startup, only the first file is actually loaded. Other files are loaded only as they are needed. + BlockTrans, CharTrans and LineTrans commands. Can translate characters according to arguments (BlockTrans 'a-z' 'A-Z', etc). + When cursor is over the bracket, the matching bracket can be higlighted automatically of visible on screen. ! InsPrevLineChar, InsPrevLineToEol failed when tabs were on previous line. + Nonpersistent blocks (with various options and commands). + ... 0.37 -- Dec 95 - Status line can now be hidden. Also changed it's look. - Changed the syntax of keyboard bindings. Now it is possible to better emulate the wordstar two-key behavior. See documentation for details. It is also possible to define different commands for gray/white keys. ! MENU shortcuts now work. + New command: FileWriteTo ! Fixed crash when trying to center nonexistant line in file. - Changing folds now modifies the file. - When CursorTroughTabs was set to 0, certain movement commands would behave incorrectly. + S-Ins will perform Paste operation in prompts. + New Command: WinResize and WinClose. Windows can be also resized by a mouse. 0.36 -- Oct 95 ! Fixed when editor would crash when saving a folded file, but no folds are configured for active mode. ! Fixed minor bug in C mode indentation. + New command: InsertSpacesToTab (takes optional tabsize argument). 0.35 -- Oct 95 KillWordPrev now works correctly. FindReplace command works correctly if WSStyleSearch == 1. 0.34 -- 1995/10/15 Minor fixes & docs updates... 0.33 -- 1995/10/01 ! SIGBREAK handler now works again. ! Fixes in C/C++ smart indentation (if in switch, ...) + Pascal highlighting mode. + Printing. + Rewritten folding. Now supports nested folds, opening, closing folds, and persistent folds. + New folding commands: FoldCreate, FoldDestroy, FoldOpen, FoldClose, FoldPromote, FoldDemote, FoldCreateByRegexp, FoldOpenAll, FoldOpenNested, FoldCloseAll, FoldDestroyAll, FoldToggleOpenClose, MoveFoldPrev, MoveFoldNext. + New settings: SaveFolds, CommentStart, CommentEnd. + Word characters can be configured using WordChars setting. 0.32 -- 1995/08/15 + New search routines. (Find, FindReplace, FindRepeat, FindRepeatReverse, FindRepeatOnce, ...) + Block-local searches. + In buffer-list, most recently used files will now be listed first. + Main menu bar can now be hidden. + Performance improvements. + Bookmarks! New commands: PlaceBookmark, GotoBookmark, RemoveBookmark + Files can now be saved and closed from window list. + Optimized CMode indentation. Also more configurable. 0.31 -- 1995/07/31 ! Bug fixed in undo/redo when UndoLimit reached. 0.30 -- 1995/07/30 + Folding support. + New commands: FoldLine, UnfoldLine, UnfoldNextLine, UnfoldAll, ClearFolds, FoldIndent, FoldRegexp, FoldBlock, UnfoldBlock, FoldBlockRegexp ! BackSpace at eof when TrimLine is enabled will not abort. + Incremental search (IncrementalSearch). + PgUp/PgDn on a file prompt will show a list of files. + New command: CompleteWord 0.29 1995/07/20 Regexps can now be case insensitive (\C,\c). BlockRead/BlockReadColumn/BlockWrite commands. Block marking can now be undone. Commands that prompt for string/int values can now take string/int arguments. Multiple compile-regex statements can be specified simultaneously Minor bug-fixes in regexps ([\x00-\xFF] now works). Filter for filename completion. New commands: SwitchTo ChangeKeys ChangeFlags ShowMenu New options: CompletionFilter DefaultModeName 0.28 1995/07/08 - Needs to have documentation updated. Mostly rewritten PERL highlighting. Works much better now. Completely new config file syntax. New commands: ASCIITable, LoadFileInMode CMode indentation should now work for Perl (close enough). Highlighting for ADA and Email messages. 0.27 1995/06/19 Minor bug fixes. 0.26 1995/06/18 New commands: {Char,Line,Block}Case{Up,Down,Toggle} New setting: LoadAfterQuit -- if set to 1, editor will prompt to load another file before exiting. New setting: ShowScrollBar {0,1}. 0.25 1995/06/12 Minor bug fix in REXX highlighting ("\"", ...) Bug fixes in word wrap. BlockCut now doesn't move the cursor to the block beginning. New commands: MoveLineTop, MoveLineCenter, MoveLineBottom. Editor will now check if the file has changed before the first modification. Found text is now highlighted. New CMode setting: C.BraceOfs and command: ChangeCBraceOfs New commands: MovePrevPos, SavePos, MoveSavedPos, MoveSavedPosCol, MoveSavedPosRow 0.24 1995/06/06 When checking for file modification time of last change is now used instead of the time of last access. Wildcard support for file loading. 0.23 1995/06/04 Ctrl+C and Ctrl+Break are now disabled. Ctrl+S and Ctrl+C keys are now again recognised in Windowed mode. Fixed problem when spawning a subprocess in Windowed mode. New command: ShowEntryScreen ListRoutines in CMode only shows functions not their prototypes. New setting: SysClipboard - if set to 1, editor will automatically use system clipboard. New command: ToggleSysClipboard. Minor bug fix in PM clipboard support. New commands: BlockPasteStream, BlockPasteColumn and BlockPasteLine. BlockPaste command will now always paste in current block mode, not in the last Copy/Cut mode. More than 4 commands can be bound to a key (actually this worked since 0.18, but was not documented). New command: FileReload. Editor will now check if file has changed on disk before saving it. 0.22 1995/05/28 But fix in regular expressions (nested +#*@). Changes in regular expression syntax. New function: ListRoutines. Shows functions in current buffer. New setting: RoutineRx 0.21 1995/05/21 REXX mode smart indentation. KillWord & KillWordPrev commands now actually work. Pressing Ctrl+Enter to begin Search will toggle case sensitivity of search. New option 'Trim' and commands 'ToggleTrim', 'LineTrim'. Removes whitespace from end of lines. New option 'ShowMarkers' and command 'ToggleShowMarkers'. Shows end of line and end of file markers. Bug fix in PERL highlighting (caused lockups) Bug fixes and improvements in regular expressions. 0.20 1995/05/18 Major bug fixes in word wrap. New commands: MovePrevTab, MoveNextTab. Bug fixes in BlockIndent and BlockUnindent (stream/line mode) 0.19 1995/05/16 Function names in REXX are now highlighted. WordWrap can be set to 0 - disabled, 1 - wrap line at right margin and 2 - wrap paragraph continously. Function ToggleAutoWrap renamed to ToggleWordWrap. New way to set left/right margin (SetLeftMargin, SetLeftMargin) Minor fix in PERL highlighting. 0.18 1995/05/13 PERL Syntax Higlighting. Memory allocation problem in tab expansion. Wordwrap now strips all spaces on beginning of line (except on the first line of the paragraph). Tabs can be set to any number between 1 and 32. Changed names of buffer flags (WrapOn -> AutoWrap, UndoRedo -> Undo, ShowTab -> ShowTabs) New commands: ToggleAutoIndent, ToggleExpandTabs, ToggleShowTabs, ToggleUndo, ToggleReadOnly, ToggleKeepBackups, ToggleMatchCase, ToggleBackSpKillTab, ToggleDeleteKillTab, ToggleSpaceTabs, ToggleIndentWithTabs, ToggleBackSpUnindents, ToggleAutoWrap. New commands: WinRefresh, ChangeTabSize, ChangeCIndent, ChangeLeftMargin, ChangeRightMargin. 0.17 1995/05/10 Minor fix in word-wrap. Screen repaint problems when shelling out fixed. Blinking disabled for full-screen, high-intensity background colors can now be used. 0.16 1995/05/06 Minor speedups in screen handling and highlighting. Regular expressions can now match start and end of words using . Regexp replace can paste entire matched string using &. Regexp search/replace could match part of just replaced string. New commands: MoveLastNonWhite, MovePrevEqualIndent and MoveNextEqualIndent, LineDuplicate, InsPrevLineChar, InsPrevLineToEol. New color config. 'C.Function' for functions in C highlighting mode. Improved CMode hilit, preprocessor hiliting improved (strings, comments, numbers) 0.15 1995/04/29 Speed improvement in CMode auto indent. Delete command can now delete full tabs instead of converting them to spaces. When closing a modified file, editor prompts you to save it. Automatic indentation can now use tabs. Manual and automatic wordwrap. 1995/04/24 Backspace can now delete full tabs instead of converting them to spaces (See BackSpace and KillBackTab). Backspace can unindent to previous indentation level. 1995/04/20 Basic mouse support. 1995/04/12 Configurable colors/keywords in C/REXX mode. 0.14 1995/04/07 Characters could not be entered using AltGr on international keyboards. Immediatelly doing an undo on a newly loaded file deleted the first line. Ascii characters >= 128 can be now entered without quote command (C-Q). IPF Syntax highlighting. 0.13 1995/04/03 Bug fix in regular expressions. Bug fixes in compiler support Editor clipboard can now be copied to/from PM clipboard. 0.12 1995/03/30 Compiler support + error message parsing 1995/03/25 Paren matching (Command: MatchBracket). Bug fixes in CMode smart indentation. 0.11 1995/03/11 Unlimited undo now works again. 1995/03/18 Entire blocks of C code can now be reindented (BlockReIndent) Search can now be case insensitive (SearchMatchCase - toggle). Option: MatchCase, Command: SearchMatchCase Regular expression find/replace works (case sensitive only) 1995/03/19 Fixed a bug in redo (last command could not be undone) New option: KeepBackups -- if set to 0, backup files will be deleted after a succesful save. 0.10 1995/03/06 Fixed CMode indent when tabs are present in the file. Prompts now retain previous text only if you try to edit it. 1995/03/04 4DOS/4OS2 style filename completion (FileOpen, ...). 1995/02/25 New load routine, much faster in some cases. Undo/Redo can now be limited (if you hate to waste memory). 1995/02/19 C Mode indentation level can now be specified (C.Indent) Bug fixes in screen redraw. Editor will now scroll text instead of always redisplaying the screen. Regular expressions (Search only). 0.09 1995/02/08 First public release (Version 0.09b) ./BUGS0000644000175000017500000000170707645304550010353 0ustar neilneilNOTE: This file possibly cointains incorrect information and probably will be removed from future release. To report bugs, please use our issue tracker at: http://sourceforge.net/tracker/?group_id=943 Thank you. --------------------------------------------------------------------- OS/2 notes and limitations: - pm controls are not disabled while a modal entryfield is active. - pm subwindows can not be resized. - does not handle multiple frames well (dialogs are modal for all). Linux notes and limitations: - Console version: Runs only on linux console. Requires rw access to /dev/vcsa?? devices. Runs in raw mode, so switch consoles using Ctrl+Alt+Fn. Currently operates in no-translation screen mode. Console cut/paste does not currently work. - X11 version: If your backspace key does not work, make sure it is defined as BackSpace (using loadkeys/xmodmap). - Some stuff may still be OS/2 centric. This will be fixed in the future.
        C-E A-C" { HTML_CAPTION } item "&Header
        C-E A-H" { HTML_TH } item "&Row
        C-E A-D" { HTML_TD } item "Co&lumn