/* Grep Editor - DMS - feb 98 - by Sylvain HUET */ /* Revised Jul. '98 - by Marc BARILLEY */ typeof choice=tab [ObjText ObjBox];; typeof editWin= ObjWin ;; fun getPatt(l)= if l==nil then nil else let l->[q n] in if !strcmp hd q "patt" then [hd tl q hd tl tl q]::getPatt n else getPatt n;; fun setChoice (l,i)= if l==nil || i>=8 then 0 else let l->[[a b] n] in let choice.i -> [tx c] in { _SETtext tx a; _SELcombo c (atoi b); setChoice n i+1 };; fun onechoice (i,x)= _CRtext _channel editWin 5 5+i*25 10 20 ET_ALIGN_CENTER itoa i; let _CRcombo _channel editWin 195 5+i*25 115 90 CB_NOEDIT "" -> c in { /* loc( _ADDcombo c 1000 "second arg"; ) */ _ADDcombo c 1000 (_locEditor "350-GREPED-secondarg" nil); /* loc( _ADDcombo c 1000 "following args"; ) */ _ADDcombo c 1000 (_locEditor "360-GREPED-followinga" nil); /* loc( _ADDcombo c 1000 "whole line"; ) */ _ADDcombo c 1000 (_locEditor "370-GREPED-wholeline" nil); /* loc( _ADDcombo c 1000 "none"; ) */ _ADDcombo c 1000 (_locEditor "380-GREPED-none" nil); _SELcombo c 0; [ _CReditLine _channel editWin 20 5+i*25 170 22 ET_DOWN+ET_AHSCROLL "" c ] };; fun load (l) = setChoice getPatt l 0; 0;; fun getText (i)= if i==8 then nil else let choice.i -> [tx c] in let _GETtext tx -> s in let if s==nil || (strlen s)==0 then "*" else s -> patt in ("event"::(strcatn "out"::(itoa i)::"."::patt::nil)::nil):: ("patt"::patt::(let _GETcombo c ->[m _] in itoa m)::nil):: getText i+1;; fun save (filename, n)= ("action"::"input"::nil):: getText 0;; fun IniEditor (filename)= let startEditor _channel nil nil nil 315 210 WN_NORMAL EDITOR_NORMAL filename "dms/admin/grep/grep.dmc" nil nil @load @save nil -> ed in ( set editWin = getEditWin ed; set choice = create_tab 8 @onechoice 0; if filename==nil then nil else openDMI ed ); 0;;