Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure _tostr_proc(var s:string);
- begin
- replace(s, '\', '\\');
- replace(s, '"', '\"');
- end;
- function _getType(dt:PScData):integer;
- begin
- Result := dt.getType;
- if(Result = data_code)or(Result = data_array)then
- Result := dt.getSubType;
- end;
- function _toCode(data:PScData; toType:byte):PScData;
- var ok:boolean;
- begin
- Result := data;
- ok := false;
- case toType of
- data_int:
- case _getType(data) of
- data_null:
- // Преобразовать NULL в int
- begin
- Result := MakeData('0', true);
- ok := true;
- end;
- // Преобразовать string в int
- data_str:
- begin
- Result := MakeData('S2I(', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- // Преобразовать string в real
- data_real:
- begin
- Result := MakeData('R2I(', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- end;
- data_str:
- case _getType(data) of
- // Преобразовать null в str
- data_null:
- begin
- Result := MakeData('""');
- ok := true;
- end;
- // Преобразовать int в str
- data_int:
- begin
- Result := MakeData('I2S(', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- // Преобразовать real в str
- data_real:
- begin
- Result := MakeData('R2S(, ', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- end;
- data_real:
- case _getType(data) of
- // Преобразовать null в real
- data_null:
- begin
- Result := MakeData('0.0', true);
- ok := true;
- end;
- // Преобразовать string в real
- data_str:
- begin
- Result := MakeData('S2R(', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- // Преобразовать int в real
- data_int:
- begin
- Result := MakeData('I2R(', true);
- Result.AddValue(data, true);
- Result.AddValue(MakeData(')', true), true);
- ok := true;
- end;
- end
- end;
- if ok then Result.SetSubType(toType);
- end;
- function _cpp_type(b:byte):string;
- begin
- case b of
- data_int: result := 'int';
- data_str: result := 'string';
- data_real: result := 'real';
- else
- Result := '';
- end;
- end;
- function lng_proc(parser:TParser; obj:pointer; index:integer; args:TArgs):TScData;
- begin
- end;
- procedure fill_lng_object(var methods:TAObjMethod; var count:integer);
- begin
- end;
- // change this for your pack settings
- const
- lng_count = 1;
- lngs:array[0..lng_count-1] of TLangRec = (
- (entry:'MapInitialize'; name:'JASS'; str_del_o: '"'; str_del_c: '"'; op_del: ' + '; var_mask:'%n%i'; tostr_proc:_tostr_proc)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement