Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
a92ac340
Commit
a92ac340
authored
Aug 12, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
many fixes. Autogenerated code probably works
parent
811df367
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
23 deletions
+70
-23
.gitignore
.gitignore
+3
-0
Makefile.in
Makefile.in
+47
-16
auto.h
auto.h
+1
-1
scheme.tl
scheme.tl
+1
-0
tl-parser.c
tl-parser.c
+3
-0
tlc.c
tlc.c
+5
-1
tools.c
tools.c
+9
-4
tree.h
tree.h
+1
-1
No files found.
.gitignore
View file @
a92ac340
...
...
@@ -7,3 +7,6 @@ config.log
config.status
.idea/
nbproject/
auto.c
auto-header.h
scheme.tlo
Makefile.in
View file @
a92ac340
...
...
@@ -4,40 +4,71 @@ CFLAGS=@CFLAGS@
LDFLAGS
=
@LDFLAGS@
CPPFLAGS
=
@CPPFLAGS@
DEFS
=
@DEFS@
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-Wno-deprecated-declarations
-fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
COMPILE_FLAGS
=
${
CFLAGS
}
${
CPPFLAGS
}
${
DEFS
}
-Wall
-Wextra
-Werror
-Wno-deprecated-declarations
-fno-strict-aliasing
-fno-omit-frame-pointer
-ggdb
-Wno-unused-parameter
EXTRA_LIBS
=
@LIBS@ @EXTRA_LIBS@
LOCAL_LDFLAGS
=
-rdynamic
-ggdb
${
EXTRA_LIBS
}
LINK_FLAGS
=
${
LDFLAGS
}
${
LOCAL_LDFLAGS
}
HEADERS
=
${
srcdir
}
/constants.h
${
srcdir
}
/include.h
${
srcdir
}
/interface.h
${
srcdir
}
/LICENSE.h
${
srcdir
}
/loop.h
${
srcdir
}
/mtproto-client.h
${
srcdir
}
/mtproto-common.h
${
srcdir
}
/net.h
${
srcdir
}
/no-preview.h
${
srcdir
}
/queries.h
${
srcdir
}
/structures.h
${
srcdir
}
/telegram.h
${
srcdir
}
/tree.h
${
srcdir
}
/config.h
${
srcdir
}
/binlog.h
${
srcdir
}
/tools.h
${
srcdir
}
/lua-tg.h
DEP
=
${
srcdir
}
/dep
AUTO
=
${
srcdir
}
/auto
EXE
=
${
srcdir
}
/bin
OBJ
=
${
srcdir
}
/objs
DIR_LIST
=
${
DEP
}
${
AUTO
}
${
EXE
}
${
OBJ
}
${
DEP
}
/auto
${
OBJ
}
/auto
EXE_LIST
=
${
EXE
}
/generate
${
EXE
}
/tlc
${
EXE
}
/telegram-cli
TG_OBJECTS
=
${
OBJ
}
/main.o
${
OBJ
}
/loop.o
${
OBJ
}
/interface.o
${
OBJ
}
/net.o
${
OBJ
}
/mtproto-common.o
${
OBJ
}
/mtproto-client.o
${
OBJ
}
/queries.o
${
OBJ
}
/structures.o
${
OBJ
}
/binlog.o
${
OBJ
}
/lua-tg.o
${
OBJ
}
/auto/auto.o
TLC_OBJECTS
=
${
OBJ
}
/tlc.o
${
OBJ
}
/tl-parser.o
${
OBJ
}
/crc32.o
GENERATE_OBJECTS
=
${
OBJ
}
/generate.o
COMMON_OBJECTS
=
${
OBJ
}
/tools.o
OBJ_LIST
=
${
TG_OBJECTS
}
${
TLC_OBJECTS
}
${
GENERATE_OBJECTS
}
${
COMMON_OBJECTS
}
OBJ_C
=
${
TLC_OBJECTS
}
${
GENERATE_OBJECTS
}
${
COMMON_OBJECTS
}
DEPENDENCE_C
=
$
(
subst
${
OBJ_C
}
/,
${
DEP
}
/,
$
(
patsubst %.o,%.d,
${
OBJ_C
}
))
DEPENDENCE
=
$
(
subst
${
OBJ_LIST
}
/,
${
DEP
}
/,
$
(
patsubst %.o,%.d,
${
OBJ_LIST
}
))
DEPENDENCE_LIST
=
${
DEPENDENCE_C
}
${
DEPENDENCE
}
INCLUDE
=
-I
.
-I
${
srcdir
}
CC
=
@CC@
OBJECTS
=
main.o loop.o interface.o net.o mtproto-common.o mtproto-client.o queries.o structures.o binlog.o tools.o lua-tg.o
TLC_OBJECTS
=
tlc.o tl-parser.o tools.o crc32.o
GENERATE_OBJECTS
=
generate.o tools.o
.SUFFIXES
:
.SUFFIXES
:
.c .h .o
all
:
telegram tlc generate
all
:
${EXE_LIST} ${DIR_LIST}
create_dirs_and_headers
:
${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h
create_dirs
:
${DIR_LIST}
${DIR_LIST}
:
@
test
-d
$@
||
mkdir
-p
$@
-include
${DEPENDENCE_LIST}
${TG_OBJECTS}
:
${OBJ}/%.o: %.c | create_dirs_and_headers
${
CC
}
${
INCLUDE
}
${
COMPILE_FLAGS
}
-c
-MP
-MD
-MF
${
DEP
}
/
$*
.d
-MQ
${
OBJ
}
/
$*
.o
-o
$@
$<
${OBJ_C}
:
${OBJ}/%.o: %.c | create_dirs
${
CC
}
${
INCLUDE
}
${
COMPILE_FLAGS
}
-c
-MP
-MD
-MF
${
DEP
}
/
$*
.d
-MQ
${
OBJ
}
/
$*
.o
-o
$@
$<
${OBJECTS} ${TLC_OBJECTS}
:
${HEADERS}
${EXE}/tlc
:
${TLC_OBJECTS} ${COMMON_OBJECTS}
${
CC
}
${
TLC_OBJECTS
}
${
COMMON_OBJECTS
}
${
LINK_FLAGS
}
-o
$@
telegram
:
${
OBJECTS}
${
CC
}
${
OBJECTS
}
${
LINK_FLAGS
}
-o
$@
${EXE}/telegram-cli
:
${TG_OBJECTS} ${COMMON_
OBJECTS}
${
CC
}
${
TG_OBJECTS
}
${
COMMON_
OBJECTS
}
${
LINK_FLAGS
}
-o
$@
tlc
:
${TLC
_OBJECTS}
${
CC
}
${
TLC
_OBJECTS
}
${
LINK_FLAGS
}
-o
$@
${EXE}/generate
:
${GENERATE_OBJECTS} ${COMMON
_OBJECTS}
${
CC
}
${
GENERATE_OBJECTS
}
${
COMMON
_OBJECTS
}
${
LINK_FLAGS
}
-o
$@
.c.o
:
${
CC
}
${
COMPILE_FLAGS
}
${
INCLUDE
}
-c
$<
-o
$@
${AUTO}/scheme.tlo
:
${srcdir}/scheme.tl ${EXE}/tlc
${
EXE
}
/tlc
-e
$@
${
srcdir
}
/scheme.tl
tlc
:
${GENERATE_OBJECTS}
${
CC
}
${
GENERATE_OBJECTS
}
${
LINK_FLAGS
}
-o
$@
${AUTO}/auto.c
:
${AUTO}/scheme.tlo ${EXE}/generate
${
EXE
}
/generate
${
AUTO
}
/scheme.tlo
>
$@
${AUTO}/auto-header.h
:
${AUTO}/scheme.tlo ${EXE}/generate
${
EXE
}
/generate
-H
${
AUTO
}
/scheme.tlo
>
$@
clean
:
rm
-rf
*
.o telegram
config.log config.status
>
/dev/null
||
echo
"all clean"
rm
-rf
${
DIR_LIST
}
config.log config.status
>
/dev/null
||
echo
"all clean"
auto.h
View file @
a92ac340
...
...
@@ -19,6 +19,6 @@ struct paramed_type {
#define INT2PTR(x) (void *)(long)(((long)x) * 2 + 1)
#define PTR2INT(x) ((((long)x) - 1) / 2)
#include "auto-header.h"
#include "auto
/auto
-header.h"
#endif
scheme.tl
0 → 120000
View file @
a92ac340
scheme12.tl
\ No newline at end of file
tl-parser.c
View file @
a92ac340
...
...
@@ -37,6 +37,7 @@
#include "crc32.h"
#include "tl-tl.h"
#include "tools.h"
#include "config.h"
extern
int
verbosity
;
extern
int
schema_version
;
...
...
@@ -1013,6 +1014,7 @@ struct tl_var *tl_get_var (char *_id, int len) {
return
w
;
}
}
tfree
(
id
,
len
+
1
);
return
0
;
}
...
...
@@ -1133,6 +1135,7 @@ struct tl_constructor *tl_add_constructor (struct tl_type *a, const char *_id, i
assert
(
magic
&&
magic
!=
(
unsigned
)
-
1
);
}
len
=
x
;
if
(
*
id
!=
'_'
)
{
struct
tl_constructor
_t
=
{.
id
=
id
};
if
(
tree_lookup_tl_constructor
(
tl_constructor_tree
,
&
_t
))
{
...
...
tlc.c
View file @
a92ac340
...
...
@@ -36,7 +36,7 @@
#include <signal.h>
#include "config.h"
#include <execinfo.h>
#include <stdarg.h>
int
verbosity
;
int
output_expressions
;
...
...
@@ -62,6 +62,10 @@ int vkext_write (const char *filename) {
void
logprintf
(
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
logprintf
(
const
char
*
format
__attribute__
((
unused
)),
...)
{
va_list
ap
;
va_start
(
ap
,
format
);
vfprintf
(
stderr
,
format
,
ap
);
va_end
(
ap
);
}
void
hexdump
(
int
*
in_ptr
,
int
*
in_end
)
{
...
...
tools.c
View file @
a92ac340
...
...
@@ -138,6 +138,8 @@ void *talloc (size_t size) {
*
(
int
*
)(
p
+
RES_PRE
+
size
)
=
size
^
0x7bed7bed
;
*
(
int
*
)(
p
+
RES_AFTER
+
4
+
size
)
=
used_blocks
;
blocks
[
used_blocks
++
]
=
p
;
tcheck
();
return
p
+
8
;
#else
void
*
p
=
malloc
(
size
);
...
...
@@ -227,9 +229,12 @@ void tcheck (void) {
for
(
i
=
0
;
i
<
used_blocks
;
i
++
)
{
void
*
ptr
=
blocks
[
i
];
int
size
=
(
*
(
int
*
)
ptr
)
^
0xbedabeda
;
assert
(
*
(
int
*
)(
ptr
+
4
)
==
size
);
assert
(
*
(
int
*
)(
ptr
+
RES_PRE
+
size
)
==
(
size
^
0x7bed7bed
));
assert
(
*
(
int
*
)(
ptr
+
RES_PRE
+
4
+
size
)
==
i
);
if
(
!
(
*
(
int
*
)(
ptr
+
4
)
==
size
)
||
!
(
*
(
int
*
)(
ptr
+
RES_PRE
+
size
)
==
(
size
^
0x7bed7bed
))
||
!
(
*
(
int
*
)(
ptr
+
RES_PRE
+
4
+
size
)
==
i
))
{
logprintf
(
"Bad block at address %p (size %d, num %d)
\n
"
,
ptr
,
size
,
i
);
assert
(
0
&&
"Bad block"
);
}
}
for
(
i
=
0
;
i
<
free_blocks_cnt
;
i
++
)
{
void
*
ptr
=
free_blocks
[
i
];
...
...
@@ -243,7 +248,7 @@ void tcheck (void) {
}
}
}
logprintf
(
"ok. Used_blocks = %d. Free blocks = %d
\n
"
,
used_blocks
,
free_blocks_cnt
);
//
logprintf ("ok. Used_blocks = %d. Free blocks = %d\n", used_blocks, free_blocks_cnt);
}
void
texists
(
void
*
ptr
,
int
size
)
{
...
...
tree.h
View file @
a92ac340
...
...
@@ -21,8 +21,8 @@
#include <stdio.h>
#include <memory.h>
#include <tools.h>
#include <assert.h>
#include "tools.h"
#pragma pack(push,4)
#define DEFINE_TREE(X_NAME, X_TYPE, X_CMP, X_UNSET) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment