exutils.pas 856 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. unit exutils;
  2. interface
  3. {$mode objfpc}
  4. uses
  5. ctypes,
  6. xml2,
  7. SysUtils;
  8. procedure docdump(doc: xmlDocPtr);
  9. procedure printf(const msg: string; const args: array of const);
  10. procedure printf(const msg: string);
  11. procedure printfn(const msg: string; const args: array of const);
  12. procedure printfn(const msg: string);
  13. implementation
  14. procedure docdump(doc: xmlDocPtr);
  15. var
  16. mem: xmlCharPtr;
  17. size: cint;
  18. begin
  19. mem := nil;
  20. xmlDocDumpMemory(doc, mem, size);
  21. writeln(pchar(mem));
  22. xmlFree(mem);
  23. end;
  24. procedure printf(const msg: string; const args: array of const);
  25. begin
  26. write(Format(msg, args));
  27. end;
  28. procedure printf(const msg: string);
  29. begin
  30. write(msg);
  31. end;
  32. procedure printfn(const msg: string; const args: array of const);
  33. begin
  34. writeln(Format(msg, args));
  35. end;
  36. procedure printfn(const msg: string);
  37. begin
  38. writeln(msg);
  39. end;
  40. end.