ScalpiEditor

Diff
Login

Diff

Differences From Artifact [a7ae18fa7c]:

To Artifact [37f64c571b]:


114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128







-
+







            __ConsoleAnsiOutputFontStyle_unbold__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_color_yellow__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_commentary__
        #define __AppEditorTheme_commentary__ \ 
        #define __AppEditorTheme_commentary__ \
            __ConsoleAnsiOutputFontStyle_start__ \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_color_yellow__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_current__
        #define __AppEditorTheme_current__ \
153
154
155
156
157
158
159
160

161
162

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184
185
186
153
154
155
156
157
158
159

160
161

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186







-
+

-
+
















-
+







            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_color_light_green__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_current_rune__
        #define __AppEditorTheme_current_rune__ \
            __ConsoleAnsiOutputFontStyle_start__         \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \ 
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__           \
            __ConsoleAnsiOutputFontStyle_color_magenta__ \ 
            __ConsoleAnsiOutputFontStyle_color_magenta__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_disabled__
        #define __AppEditorTheme_disabled__ \
            __ConsoleAnsiOutputFontStyle_start__  \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__  \
            __ConsoleAnsiOutputFontStyle_sep__  \
            __ConsoleAnsiOutputFontStyle_color_magenta__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_easy_motion__
        #define __AppEditorTheme_easy_motion__ \
            __ConsoleAnsiOutputFontStyle_start__ \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_color_yellow__ \
            __ConsoleAnsiOutputFontStyle_end__
    // # __AppEditorTheme_folded__
        #define __AppEditorTheme_folded__ \ 
        #define __AppEditorTheme_folded__ \
            __ConsoleAnsiOutputFontStyle_start__ \
            __ConsoleAnsiOutputFontStyle_bold__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_bg_color_zero__ \
            __ConsoleAnsiOutputFontStyle_sep__ \
            __ConsoleAnsiOutputFontStyle_color_zero__ \
            __ConsoleAnsiOutputFontStyle_end__
1121
1122
1123
1124
1125
1126
1127

1128
1129
1130
1131
1132
1133







1134

1135
1136
1137
1138
1139






1140
1141
1142
1143
1144
1145
1146
1121
1122
1123
1124
1125
1126
1127
1128






1129
1130
1131
1132
1133
1134
1135
1136
1137





1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150







+
-
-
-
-
-
-
+
+
+
+
+
+
+

+
-
-
-
-
-
+
+
+
+
+
+







                /// 255.255.255.255:65535
                /// 127.  0.  0.  1:27015
                ///   0.  0.  0.  1:    0
                char buffer[25];
                size_t len;
            };
        // # __NetworkTcpServer__
            #if __with_network__
            struct __NetworkTcpServer__ {
                bool                    __NetworkTcpServer_ready__;
                __OsNetworkTcpHandle__  __NetworkTcpServer_socketHandle__;
                size_t                  __NetworkTcpServer_maxWaitingClients__;
                uint16_t                port;
            };
                struct __NetworkTcpServer__ {
                    bool                    __NetworkTcpServer_ready__;
                    __OsNetworkTcpHandle__  __NetworkTcpServer_socketHandle__;
                    size_t                  __NetworkTcpServer_maxWaitingClients__;
                    uint16_t                port;
                };
            #endif
        // # __NetworkTcpVisitor__
            #if __with_network__
            struct __NetworkTcpVisitor__ {
                __OsNetworkTcpHandle__ socket_handle;
                struct network_tcp_Ip  ip;
                struct sockaddr_in     addr;
            };
                struct __NetworkTcpVisitor__ {
                    __OsNetworkTcpHandle__ socket_handle;
                    struct network_tcp_Ip  ip;
                    struct sockaddr_in     addr;
                };
            #endif
        // # __TerminalInput__
            struct __TerminalInput__ {
                // usage:
                // call __TerminalInput_updateBuffer__ for update unreaded
                // use __TerminalInput_grab__ in loop for get keys
                
                size_t ungrabed;
1425
1426
1427
1428
1429
1430
1431
1432

1433
1434
1435
1436
1437
1438
1439
1429
1430
1431
1432
1433
1434
1435

1436
1437
1438
1439
1440
1441
1442
1443







-
+







    // # __OsMem_alloc__
        bool                __OsMem_alloc__                      ( uintptr_t *ret_data_addr, size_t size);
    // # __OsMem_free__
        void                __OsMem_free__                       ( uintptr_t ret_data_addr);
    // # __Os_getTick__
        uint64_t            __Os_getTick__                       ();
    // # __Os_sleep__
        void                __Os_sleep__                         ( uint64_t ms);
        void __Os_sleep__( uint64_t ms);
    // # __TerminalInput_shift__
        void                __TerminalInput_shift__              ( struct __TerminalInput__ *t, size_t val);
    // # __Terminal_Output_Cursor_shiftDown__
        void __Terminal_Output_Cursor_shiftDown__(struct __Terminal__ *terminal, size_t delta);
    // # __Terminal_Output_Cursor_shiftLeft__
        void __Terminal_Output_Cursor_shiftLeft__(struct __Terminal__ *terminal, size_t delta);
    // # __Terminal_Output_Cursor_shiftRight__
1466
1467
1468
1469
1470
1471
1472


1473
1474
1475
1476
1477
1478
1479
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485







+
+







        size_t              __Text_countIndent__                 ( char* text, size_t text_len, size_t tab_size);
    // # __Text_formatU64ToBuffer__
        size_t              __Text_formatU64ToBuffer__           ( char *buffer, uint64_t number, size_t min_width);
    // # __ZText_countLen__
        size_t              __ZText_countLen__                   ( const char text[]);
    // # print_trace_example
        void                print_trace_example                  ( int anyarg, struct __Trace__* prev_trace);
    // # real_main
        bool real_main(int args_len, char** args_ptr);
    // # tests
        bool                tests                                ();
// globals
    // # __AppEditorViewsEasyMotionHorizontalContext_vtable__
        const struct __AppEditorViewsVTable__* __AppEditorViewsEasyMotionHorizontalContext_vtable__;
    // # __AppEditorViewsEasyMotionHorizontal_context__
        void*                                  __AppEditorViewsEasyMotionHorizontal_context__;
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608






1609
1610
1611
1612
1613
1614
1615
1602
1603
1604
1605
1606
1607
1608






1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621







-
-
-
-
-
-
+
+
+
+
+
+







        struct __ConsoleAnsi_input_Key_SequenceParser_fromBytes_SequenceInfo__ __ConsoleAnsi_input_Key_SequenceParser_sequences_9__[] = {
            { .__ConsoleAnsi_input_Key_SequenceParser_fromBytes_SequenceInfo_text__ = "\x5B\x32\x37\x3B\x35\x3B\x31\x33\x7E", .key = __ConsoleAnsiInputKey_ctrl_enter__ },
            { .__ConsoleAnsi_input_Key_SequenceParser_fromBytes_SequenceInfo_text__ = "[27;5;44~", .key = __ConsoleAnsiInputKey_ctrl_triangular_open_quotation_mark__ },
            { .__ConsoleAnsi_input_Key_SequenceParser_fromBytes_SequenceInfo_text__ = "[27;5;46~", .key = __ConsoleAnsiInputKey_ctrl_triangular_close_quotation_mark__ },
        };
    // # __ConsoleAnsi_input_Key_SequenceParser_fromBytes_parsers__
        struct __ConsoleAnsi_input_Key_SequenceParser_fromBytes_parser__ __ConsoleAnsi_input_Key_SequenceParser_fromBytes_parsers__[] = {
            { .text_len = 9, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_9__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_9__ },
            { .text_len = 5, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_5__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_5__ },
            { .text_len = 4, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_4__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_4__ },
            { .text_len = 3, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_3__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_3__ },
            { .text_len = 2, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_2__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_2__ },
            { .text_len = 1, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_1__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_1__ },
            { .text_len = 9, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_9__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_9__[0] },
            { .text_len = 5, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_5__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_5__[0] },
            { .text_len = 4, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_4__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_4__[0] },
            { .text_len = 3, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_3__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_3__[0] },
            { .text_len = 2, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_2__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_2__[0] },
            { .text_len = 1, .len = __arrayLen__(__ConsoleAnsi_input_Key_SequenceParser_sequences_1__), .ptr = &__ConsoleAnsi_input_Key_SequenceParser_sequences_1__[0] },
        };
    // # __ConsoleAnsi_input_Key_SequenceParser_fromBytes__
        bool __ConsoleAnsi_input_Key_SequenceParser_fromBytes__(
            struct __ConsoleAnsiInputKey_SequenceParser__ *out,
            const char                                    *data,
            size_t                                        data_len
        ) {
1749
1750
1751
1752
1753
1754
1755
1756

1757
1758
1759
1760
1761
1762
1763
1755
1756
1757
1758
1759
1760
1761

1762
1763
1764
1765
1766
1767
1768
1769







-
+







        void __AppEditorHistoryNote_free__(
            struct __AppEditorHistoryNote__* ptr
        ) {
            __AlignedPtr_freeAny__(ptr, sizeof(struct __AppEditorHistoryNote__));
        }
    // # __AppEditorLine_alloc__
        bool __AppEditorLine_alloc__(struct __AppEditorLine__ **ptr) {
            return __AlignedPtr_alloc__( ptr, __Type_getAlign__(struct __AppEditorLine__), __Type_getSize__(struct __AppEditorLine__) );
            return __AlignedPtr_allocAny__(ptr, __Type_getAlign__(struct __AppEditorLine__), __Type_getSize__(struct __AppEditorLine__) );
        }
    // # __AppEditorLine_free__
        void __AppEditorLine_free__(struct __AppEditorLine__ *line) {
            __AlignedPtr_freeAny__(line, __Type_getSize__(struct __AppEditorLine__));
        }
    // # __AppEditorLine_init__
        void __AppEditorLine_init__(
3486
3487
3488
3489
3490
3491
3492
3493

3494
3495
3496
3497
3498
3499
3500
3492
3493
3494
3495
3496
3497
3498

3499
3500
3501
3502
3503
3504
3505
3506







-
+







        ) {
            bool ok = true;
                size_t readed = 0;
                while (ok and (readed < buffer_len)) {
                    __OsFile_setPos__(file, offset + readed);
                    #if __target_os__ == __TargetOs_windows__
                        __OsFile_setPos__(file, offset + readed);
                        size_t readed_atom = 0;
                        LPDWORD readed_atom = 0;
                        if (ReadFile(file, &buffer[readed], buffer_len - readed, &readed_atom, NULL)) {
                            readed += readed_atom;
                        } else {
                            ok = false;
                        }
                    #elif __target_os__ == __TargetOs_linux__
                        __OsFile_setPos__(file, offset + readed);
3697
3698
3699
3700
3701
3702
3703

3704
3705
3706
3707
3708
3709
3710
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717







+







                return ms;
            #else
                #error "not implemented current __target_os__ or not defined. (expected __TargetOs_ value)"
            #endif
        }
    // # __Os_sleep__
        void __Os_sleep__(uint64_t ms) {
            int a = 10;
            #if __target_os__ == __TargetOs_windows__
                Sleep(ms);
            #elif __target_os__ == __TargetOs_linux__
                struct timespec delay;
                delay.tv_sec = ms / 1000;
                delay.tv_nsec = (ms % 1000) * 1000000;
                nanosleep(&delay, NULL);
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4567
4568
4569
4570
4571
4572
4573

4574
4575
4576
4577
4578
4579
4580







-







    // # isStartWith
        bool isStartWith(struct Slice* a, struct Slice* b) {
            return (a->len >= b->len) && __Mem_isEql__(a->ptr, b->ptr, b->len);
        }
    // # main
        #ifndef __COMPILED_FROM_ZIG_FILE__
            int main(int args_len, char** args_ptr) {
                trace_example();
                if (real_main(args_len, args_ptr)) return 0;
                return 1;
            }
        #endif
    // # printHex
        void printHex(char* buffer_ptr, uintptr_t buffer_len) {
            for (int i = 0; i < buffer_len; i++) {