<commit_before>(* **************************************************************** *)
(*     Copyright (C) 1999-2010, <NAME>, All right reserved.     *)
(* **************************************************************** *)
(* This program is free software; you can redistribute it under the *)
(* terms of the Artistic License, as specified in the LICENSE file. *)
(* **************************************************************** *)

unit Macro;

interface

uses hashs, error, gmrdrv, parser, classes; 

type

  TMacroDrv = class
    constructor create; virtual; abstract;
    procedure execute(inNode: PParseNode); virtual; abstract;
   protected
    Ferr: TError;
    Fgmr: TGmr;
    FoutCode: TStringList;
    FoutData: TStringList;
    FsearchDirs: string;
    FgiantError: boolean;
   public
    property err: TError read Ferr write Ferr;
    property gmr: TGmr read Fgmr write Fgmr;
    property outCode: TStringList read FoutCode write FoutCode;
    property outData: TStringList read FoutData write FoutData;
    property searchDirs: string read FsearchDirs write FSearchDirs;
    property giantError: boolean read FgiantError write FgiantError;
  end;

  TMacroClass = class of TMacroDrv;

implementation

end.
 
<commit_msg>Add a join method to all macro drivers.<commit_after>(* **************************************************************** *)
(*     Copyright (C) 1999-2010, <NAME>, All right reserved.     *)
(* **************************************************************** *)
(* This program is free software; you can redistribute it under the *)
(* terms of the Artistic License, as specified in the LICENSE file. *)
(* **************************************************************** *)

unit Macro;

interface

uses hashs, error, gmrdrv, parser, classes; 

type

  TMacroDrv = class(TPersistent)
    constructor create; virtual; abstract;
    procedure execute(inNode: PParseNode); virtual; abstract;
   protected
    Ferr: TError;
    Fgmr: TGmr;
    FoutCode: TStringList;
    FoutData: TStringList;
    FsearchDirs: string;
    FgiantError: boolean;
    function join(data: strArr; joinStr: string = #10; lower: word = 0; upper: word = 65535): string;
   public
    property err: TError read Ferr write Ferr;
    property gmr: TGmr read Fgmr write Fgmr;
    property outCode: TStringList read FoutCode write FoutCode;
    property outData: TStringList read FoutData write FoutData;
    property searchDirs: string read FsearchDirs write FSearchDirs;
    property giantError: boolean read FgiantError write FgiantError;
  end;

  TMacroClass = class of TMacroDrv;

implementation

function TMacroDrv.join(data: strArr; joinStr: string = #10; lower: word = 0; upper: word = 65535): string;
var i: word;
begin
  result := '';
  if length(data) <= lower then exit;
  for i := lower to length(data)-1 do
  begin
    if i > upper then break;
    result := result + data[i] + joinStr;
  end;
end;


end.
 

{'fraction_non_alphanumeric': 0.20826220553089791, 'fraction_numerical': 0.011266643905769888, 'mean_word_length': 4.376146788990826, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5133205', 'n_tokens_mistral': 867, 'n_tokens_neox': 808, 'n_words': 289}