2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Divide scheme.tl to mtproto.tl and api.tl.

This commit is contained in:
John Preston
2019-08-08 11:15:16 +01:00
parent fb00d523c3
commit b999d87388
4 changed files with 132 additions and 132 deletions

View File

@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
'''
import glob, re, binascii, os, sys
input_file = ''
input_files = []
output_path = ''
next_output_path = False
for arg in sys.argv[1:]:
@@ -19,9 +19,9 @@ for arg in sys.argv[1:]:
elif re.match(r'^-o(.+)', arg):
output_path = arg[2:]
else:
input_file = arg
input_files.append(arg)
if input_file == '':
if len(input_files) == 0:
print('Input file required.')
sys.exit(1)
if output_path == '':
@@ -92,14 +92,16 @@ textSerializeMethods = '';
forwards = '';
forwTypedefs = '';
with open(input_file) as f:
for line in f:
layerline = re.match(r'// LAYER (\d+)', line)
if (layerline):
layerIndex = int(layerline.group(1));
layer = 'inline constexpr mtpPrime CurrentLayer = mtpPrime(' + str(layerIndex) + ');';
else:
lines.append(line);
for input_file in input_files:
lines.append('---types---')
with open(input_file) as f:
for line in f:
layerline = re.match(r'// LAYER (\d+)', line)
if (layerline):
layerIndex = int(layerline.group(1));
layer = 'inline constexpr mtpPrime CurrentLayer = mtpPrime(' + str(layerIndex) + ');';
else:
lines.append(line);
for line in lines:
nocomment = re.match(r'^(.*?)//', line)