lisp2arx
Visual Programming for AutoLisp Mathématiques en programmation Lisp.. doc2cpp,doc2lsp, sld2lsp, bmp2dcl, free__GifCcapture for all-CAD'platforms..
Lista Forumurilor Pe Tematici
lisp2arx | Reguli | Inregistrare | Login

POZE LISP2ARX

Nu sunteti logat.
Nou pe simpatie:
Mariatha
Femeie
25 ani
Prahova
cauta Barbat
25 - 52 ani
lisp2arx / Delphi , InnoPascal / Delphi32- StrPos with DoublesCheck  
Autor
Mesaj Pagini: 1
admin
Administrator

Din: Bucharest
Inregistrat: acum 13 ani
Postari: 508


Code:

Var nth,gap,idx:integer;
    xlen:integer;
    xorg:pchar;
    filer:pchar;
    ttd:array[0..4] of Cardinal;
Begin
       ttd[0]:=GetTickCount;
       if (mp3<1) then exit;
       xorg:=nil;
       for gap:=1 to mp3 do
          xlen:=Str_PosW(mHomePageUrl,'.3xff',length(mHomePageUrl),4,xorg);

End;



Code:

Function Str_PosW(LargeStr,Tmti0Str:PCHAR;Ext2Max,Ext2Min:integer;Out xorg:pchar):integer;
Var filet,filer,subs,gnu:pchar;
    nLen,gap,nth:integer;
    keyb:record com:integer;end;
    LimMax:integer;
    areal:single;
Label Backz,OnSelEndOk;
Begin xorg:=nil;
      result:=RTCAN;

      if (Ext2Max<4)or (Ext2Min>Ext2Max)or (ext2Min<4) then
        Begin xorg:=AnsiStrPos(LargeStr,Tmti0Str);
              if (xorg>=LargeStr) then
                    result:=integer(xorg)-+1;
              Exit;
        End;
     filer:=LargeStr;
     filet:=filer;
     areal:=psingle(Tmti0Str)^;
     nth:=1;
     gap:=0;
     gap:=RTCAN;
     if (Ext2Min=4) then
         Begin for nth:=1  to Ext2Max do
                if (filer^=#0) then exit else
                 if (psingle(filer)^=areal) then begin gap:=nth;break;end else inc(filer);
               if (gap>0) then goto OnSelEndOk else exit;

        End else

     if (Ext2Min=8) then
         Begin for nth:=1 to Ext2Max do
              if (filer^=#0) then exit else
                  if (pdouble(filer)^=pdouble(Tmti0Str)^) then begin gap:=nth;break;end else inc(filer);
               if (gap>0) then goto OnSelEndOk else exit;
        End;
     filer:=LargeStr;
     filet:=filer;

Backz: filer:=filet;
       nLen:=Ext2Min;
       gap:=0;
       subs:=Tmti0Str;
       for nth:=nth to Ext2Max do
              if (filer^=#0) then exit else
              if (psingle(filer)^=areal) then begin gap:=nth;break;end else inc(filer);
       if (gap<1) then exit;
       if (nLen=4) then
             Begin gap:=integer(filer)-integer(LargeStr)+1;
                   goto OnSelEndOk;
              End;

        filet:=filer;
        while (nLen>3)and((psingle(filet)^=psingle(subs)^)) do
        begin  dec(nLen);inc(filet);inc(subs);
               dec(nLen);inc(filet);inc(subs);
               dec(nLen);inc(filet);inc(subs);
               dec(nLen);inc(filet);inc(subs);
        end;
        if (filet^<>subs^) then goto Backz else dec(nLen);
        if (nLen=0) then
          Begin gap:=integer(filer)-integer(LargeStr)+1;
                goto OnSelEndOk;
                End;
        inc(filet);
        inc(subs);
        Case Ext2Min and 3 of
        3: Begin  if (filet^<>subs^) then goto Backz;
                  inc(filer);inc(subs);
                  if (filet^<>subs^) then goto Backz;
                  inc(filer);inc(subs);
                  if (filet^<>subs^) then goto Backz;
                  gap:=integer(filer)-integer(LargeStr)+1;
                  goto OnSelEndOk;

            End;

        2: Begin  if (filet^<>subs^) then goto Backz;
                  inc(filer);inc(subs);
                  if (filet^<>subs^) then goto Backz;
                  inc(filer);inc(subs);
            End;

        1: Begin  if (filet^<>subs^) then goto Backz;
                  inc(filer);inc(subs);
            End;
         End;
        nth:=integer(filet)-integer(LargeStr)+1;
        if (filet^=subs^) then Begin gap:=nth;goto OnSelEndOk;End;
  goto Backz;
OnSelEndOk:
     result:=gap;
     xorg:=LargeStr;
     inc(xorg,gap);
End;//off-Str_PosW



Code:

function Pos(const SubStr, Str: _ShortStr; Offset: Integer): Integer;
{$IFDEF PUREPASCAL}
var
  I, LIterCnt, L, J: Integer;
  PSubStr, PS: _PAnsiChr;
begin
  L := _PStrLen(SubStr);
  { Calculate the number of possible iterations. Not valid if Offset < 1. }
  LIterCnt := _PStrLen(Str) - Offset - L + 1;

  { Only continue if the number of iterations is positive or zero (there is space to check) }
  if (Offset > 0) and (LIterCnt >= 0) and (L > 0) then
  begin
    PSubStr := @SubStr[1];
    PS := @Str[1];
    Inc(PS, Offset - 1);

    for I := 0 to LIterCnt do
    begin
      J := 0;
      while (J >= 0) and (J < L) do
      begin
        if PS[I + J] = PSubStr[J] then
          Inc(J)
        else
          J := -1;
      end;
      if J >= L then
        Exit(I + Offset);
    end;
  end;

  Result := 0;
end;



_______________________________________


pus acum 2 ani
   
Pagini: 1  

Mergi la