Ver Mensaje Individual
  #3  
Antiguo 15-03-2009
JXJ JXJ is offline
Miembro
 
Registrado: abr 2005
Posts: 2.475
Reputación: 22
JXJ Va por buen camino
si asi es....es un arrary de pchar..

estoy convirtiendo la version modificada de synedit.
el synedit Studio..

para que sea compatible con delphi 2009 win32

http://yaoqiaofeng.blog.163.com/blog...7101974839201/

de aqui lo descargas.

http://www.box.net/shared/jt3hcg79zr

LongWord(pc^) := $3D3D3D3D;

es el archivo simplexml.pas
hasta donde he logrado convertir a delphi 2009 win32
por que una vez compilado e instalador pasare a su uso y ver si todo va bien.

la unidad con la definicion de pchars

Código Delphi [-]

unit SimpleXML;

{$I SynUniHighlighter.inc}

interface

uses
  Windows, SysUtils, Classes;

const
  BinXmlSignatureSize = Length('< binary-xml >');
  BinXmlSignature: String = '< binary-xml >';

  BINXML_USE_WIDE_CHARS = 1;
  BINXML_COMPRESSED = 2;

  XSTR_NULL = '{{null}}';
  
  NODE_INVALID = $00000000;
  NODE_ELEMENT = $00000001;
  NODE_ATTRIBUTE = $00000002;
  NODE_TEXT = $00000003;
  NODE_CDATA_SECTION = $00000004;
  NODE_ENTITY_REFERENCE = $00000005;
  NODE_ENTITY = $00000006;
  NODE_PROCESSING_INSTRUCTION = $00000007;
  NODE_COMMENT = $00000008;
  NODE_DOCUMENT = $00000009;
  NODE_DOCUMENT_TYPE = $0000000A;
  NODE_DOCUMENT_FRAGMENT = $0000000B;
  NODE_NOTATION = $0000000C;


implementation

uses
{$IFDEF SYN_COMPILER_6_UP}
  Variants, DateUtils;
{$ELSE}
  SimpleXML_D5Emulate;
{$ENDIF}


function IsXmlDataString(const aData: String): Boolean;
var
  i: Integer;
begin
  Result := Copy(aData, 1, BinXmlSignatureSize) = BinXmlSignature;
  if not Result then begin
    i := 1;
    while (i <= Length(aData)) and (aData[i] in [#10, #13, #9, ' ']) do
      Inc(i);
    Result := Copy(aData, i, Length(')) = ';
  end;
end;

function XmlIsInBinaryFormat(const aData: String): Boolean;
begin
  Result := Copy(aData, 1, BinXmlSignatureSize) = BinXmlSignature
end;

var
  Base64Map: array [0..63] of Char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

type
  PChars = ^TChars;
  TChars = packed record a, b, c, d: Char end;
  POctet = ^TOctet;
  TOctet = packed record a, b, c: Byte; end;

procedure OctetToChars(po: POctet; aCount: Integer; pc: PChars);

var
  o: Integer;
begin
  if aCount = 1 then begin
    o := po.a shl 16;
    LongWord(pc^) := $3D3D3D3D;
    pc.a := Base64Map[(o shr 18) and $3F];
    pc.b := Base64Map[(o shr 12) and $3F];
  end
  else if aCount = 2 then begin
    o := po.a shl 16 or po.b shl 8;
    LongWord(pc^) := $3D3D3D3D;
    pc.a := Base64Map[(o shr 18) and $3F];
    pc.b := Base64Map[(o shr 12) and $3F];
    pc.c := Base64Map[(o shr 6) and $3F];
  end
  else if aCount > 2 then begin
    o := po.a shl 16 or po.b shl 8 or po.c;
    LongWord(pc^) := $3D3D3D3D;
    pc.a := Base64Map[(o shr 18) and $3F];
    pc.b := Base64Map[(o shr 12) and $3F];
    pc.c := Base64Map[(o shr 6) and $3F];
    pc.d := Base64Map[o and $3F];
  end;
end;

function BinToBase64(const aBin; aSize, aMaxLineLength: Integer): String;
var
  o: POctet;
  c: PChars;
  aCount: Integer;
  i: Integer;
begin
  o := @aBin;
  aCount := aSize;
  SetLength(Result, ((aCount + 2) div 3)*4);
  c := PChars(Result);
  while aCount > 0 do begin
    OctetToChars(o, aCount, c);
    Inc(o);
    Inc(c);
    Dec(aCount, 3);
  end;
  if aMaxLineLength > 0 then begin
    i := aMaxLineLength;
    while i <= Length(Result) do begin
      Insert(#13#10, Result, i);
      Inc(i, 2 + aMaxLineLength);
    end
  end;
end;

function CharTo6Bit(c: Char): Byte;
begin
  if (c >= 'A') and (c <= 'Z') then
    Result := Ord(c) - Ord('A')
  else if (c >= 'a') and (c <= 'z') then
    Result := Ord(c) - Ord('a') + 26
  else if (c >= '0') and (c <= '9') then
    Result := Ord(c) - Ord('0') + 52
  else if c = '+' then
    Result := 62
  else if c = '/' then
    Result := 63
  else
    Result := 0
end;
Responder Con Cita