Add(MainForm,1642918,196,98)
{
Width=574
Height=642
Point(onKeyDown)
}
Add(InlineCode,4114780,329,154)
{
WorkPoints=#6:doWork|
EventPoints=#5:onRes|
DataPoints=#5:Value|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|23: Value: THI_Event;|22: onRes: THI_Event;|46: procedure doWork(var dt:TData; idx:word);|0:|5: end;|0:|52:function MayBeHyph(p: PChar; pos: Integer): Boolean;|0:|14:implementation|0:|0:|4:type|64: TSymbol = (st_Empty, st_NoDefined, st_Glas, st_Sogl, st_Spec);|39: TSymbAr = array [0..1000] of TSymbol;|21: PSymbAr = ^TSymbAr;|5:const|19: //HypSymb = #$1F;|16: HypSymb = '-';|57: Spaces = [',', ';', ':', '.', '?', '!', '/', #10, #13];|52: GlasChar = ['Й', 'й', 'У', 'у', 'Е', 'е','Ю', 'ю',|60: 'А', 'а', 'О', 'о', 'Э', 'э', 'Я', 'я', 'И', 'и', |15: { english }|70: 'e', 'E', 'u', 'U', 'i', 'I', 'o', 'O', 'a', 'A', 'j', 'J'];|53: SoglChar = ['Г', 'г', 'Ц', 'ц', 'К', 'к', 'Н', 'н',|49: 'Ш', 'ш', 'щ', 'Щ', 'З', 'з', 'Х', 'х',|69: 'Ф', 'ф', 'В', 'в', 'П', 'п', 'Р', 'р', 'Л', 'л', 'Д', 'д',|69: 'Ж', 'ж', 'Ч', 'ч', 'С', 'с', 'М', 'м', 'т', 'T', 'б', 'Б',|15: { english }|59: 'q', 'Q', 'w', 'W', 'r', 'R', 't', 'T', 'y', 'Y',|59: 'p', 'P', 's', 'S', 'd', 'D', 'f', 'F', 'g', 'G',|59: 'h', 'H', 'k', 'K', 'l', 'L', 'z', 'Z', 'x', 'X',|60: 'c', 'C', 'v', 'V', 'b', 'B', 'n', 'N', 'm', 'M'];|44: SpecSign = ['Ы', 'ы', 'Ь', 'ь', 'Ъ', 'ъ'];|2: |34:function isSogl(c: Char): Boolean;|5:begin|26: Result := c in SoglChar;|4:end;|0:|34:function isGlas(c: Char): Boolean;|5:begin|26: Result := c in GlasChar;|4:end;|0:|38:function isSpecSign(c: Char): Boolean;|5:begin|26: Result := c in SpecSign;|4:end;|0:|39:function GetSymbType(c: Char): TSymbol;|5:begin|25: if isSogl(c) then begin|22: Result := st_Sogl;|9: exit;|6: end;|25: if isGlas(c) then begin|22: Result := st_Glas;|9: exit;|6: end;|29: if isSpecSign(c) then begin|22: Result := st_Spec;|9: exit;|6: end;|25: Result := st_NoDefined;|4:end;|0:|62:function isSlogMore(c: pSymbAr; start, len: Integer): Boolean;|3:var|13: i: Integer;|5:begin|34: for I := Start to Len-1 do begin|38: if c^[i] = st_NoDefined then begin|22: Result := false;|11: exit;|8: end;|24: if (c^[i] = st_Glas)|64: and ((c^[i+1] <> st_Nodefined) or (I <> Start)) then begin|23: Result := True;|13: exit;|8: end;|6: end;|18: Result := false;|4:end;|0:|55:function Red_GlasMore(p: PChar; pos: Integer): Boolean;|5:begin|29: while p[pos] <> #0 do begin|34: if p[pos] in Spaces then begin|22: Result := False;|11: Exit;|8: end;|32: if isGlas(p[pos]) then begin|21: Result := True;|11: Exit;|8: end;|13: Inc(pos);|6: end;|18: Result := False;|4:end;|0:|55:function Red_SlogMore(p: PChar; pos: Integer): Boolean;|3:var|26: BeSogl, BeGlas: Boolean;|5:begin|35: BeSogl := False; BeGlas := False;|29: while p[pos] <> #0 do begin|35: if p[pos] in Spaces then Break;|48: if not BeGlas then BeGlas := isGlas(p[pos]);|48: if not BeSogl then BeSogl := isSogl(p[pos]);|13: Inc(pos);|6: end;|30: Result := BeGlas and BeSogl;|4:end;|0:|52:function MayBeHyph(p: PChar; pos: Integer): Boolean;|3:var|13: i: Integer;|15: len: Integer;|5:begin|11: I := pos;|19: Len := StrLen(p);|51: Result := (Len > 3) and (i > 2) and (i < Len - 2)|30: and (not (p[i] in Spaces))|63: and (not (p[i + 1] in Spaces)) and (not (p[i-1] in Spaces))|64: and ((isSogl(p[i]) and isGlas(p[i - 1]) and isSogl(p[i + 1])|50: and Red_SlogMore(p, i + 1)) or ((isGlas(p[i]))|49: and (isSogl(p[i - 1])) and (isSogl(p[i + 1]))|46: and (isGlas(p[i + 2]))) or ((isGlas(p[i]))|49: and (isSogl(p[i - 1])) and (isGlas(p[i + 1]))|57: and Red_SlogMore(p, i + 1)) or ((isSpecSign(p[i]))));|4:end;|0:|0:|0:|29:procedure THiAsmClass.doWork;|17:var s, p: string;|13:r,i: Integer;|16:qwerty: Boolean;|5:begin|23: s := ToString(dt); |27: i:=ToIntegerEvent(Value);|7: r:=i;|2: |0:|23: while Length(s) > r do|6: begin|16: qwerty :=true;|8: i:=r;|19: while qwerty do |8: begin|26: if (S[i]= ' ') then |8: begin |17: qwerty:=false; |19: p:=Copy(S, 1, i);|25: S :=CopyEnd( S, i+1 );|25: _hi_onEvent(onRes,p); |7: end |5:else |31:if MayBeHyph(PChar(s), i) then|6: begin|17: qwerty:=false; |21: p:=Copy(S, 1, i+1);|27: S :=CopyEnd( S, i+2 ); |29: _hi_onEvent(onRes,p+'-'); |5: end;|9: dec(i);|4:end;|3: |5:end; |24:_hi_onEvent(onRes,S); |4:end;|0:|4:end.|
link(onRes,2536302:doAdd,[])
link(Value,2622461:Text,[])
}
Add(Button,7044045,196,154)
{
Left=15
Top=20
link(onClick,8765111:doData,[])
}
Add(DoData,8765111,266,154)
{
link(onEventData,4114780:doWork,[])
link(Data,413353:Text,[])
}
Add(Memo,413353,266,91)
{
Top=50
Width=555
Height=110
Font=[MS Sans Serif,12,0,0,1]
Strings=#153:Сборник изначально планировался как обзор, но постепенно превратился в справочник для писателя, которому пришла в голову гиблая мысль написать о космосе.|
}
Add(Memo,2536302,434,154)
{
Top=170
Width=555
Height=255
Font=[MS Sans Serif,12,0,0,1]
ScrollBars=2
}
Add(Edit,2622461,329,91)
{
Left=115
Top=20
Text="24"
DataType=2
}
Ответов: 2059
Рейтинг: 132
|
|||
|
|||
карма: 6 |
|