]> git.sur5r.net Git - i3/i3/blob - src/commands.c
3afd6c5e8ace7e89b234d7d46e5e9b93aac1851a
[i3/i3] / src / commands.c
1 /*
2  * vim:ts=8:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  *
6  * © 2009 Michael Stapelberg and contributors
7  *
8  * See file LICENSE for license information.
9  *
10  */
11 #include <stdbool.h>
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <assert.h>
15 #include <unistd.h>
16 #include <string.h>
17
18 #include <xcb/xcb.h>
19
20 #include "util.h"
21 #include "data.h"
22 #include "table.h"
23 #include "layout.h"
24 #include "i3.h"
25 #include "xinerama.h"
26
27 static bool focus_window_in_container(xcb_connection_t *conn, Container *container,
28                 direction_t direction) {
29         /* If this container is empty, we’re done */
30         if (container->currently_focused == NULL)
31                 return false;
32
33         /* Get the previous/next client or wrap around */
34         Client *candidate = NULL;
35         if (direction == D_UP) {
36                 if ((candidate = CIRCLEQ_PREV_OR_NULL(&(container->clients), container->currently_focused, clients)) == NULL)
37                         candidate = CIRCLEQ_LAST(&(container->clients));
38         }
39         else if (direction == D_DOWN) {
40                 if ((candidate = CIRCLEQ_NEXT_OR_NULL(&(container->clients), container->currently_focused, clients)) == NULL)
41                         candidate = CIRCLEQ_FIRST(&(container->clients));
42         } else LOG("Direction not implemented!\n");
43
44         /* If we could not switch, the container contains exactly one client. We return false */
45         if (candidate == container->currently_focused)
46                 return false;
47
48         /* Set focus */
49         set_focus(conn, candidate);
50
51         return true;
52 }
53
54 typedef enum { THING_WINDOW, THING_CONTAINER } thing_t;
55
56 static void focus_thing(xcb_connection_t *conn, direction_t direction, thing_t thing) {
57         LOG("focusing direction %d\n", direction);
58
59         int new_row = current_row,
60             new_col = current_col;
61
62         Container *container = CUR_CELL;
63         Workspace *t_ws = c_ws;
64
65         /* There always is a container. If not, current_col or current_row is wrong */
66         assert(container != NULL);
67
68         if (container->workspace->fullscreen_client != NULL) {
69                 LOG("You're in fullscreen mode. Won't switch focus\n");
70                 return;
71         }
72
73         /* TODO: for horizontal default layout, this has to be expanded to LEFT/RIGHT */
74         if (direction == D_UP || direction == D_DOWN) {
75                 if (thing == THING_WINDOW)
76                         /* Let’s see if we can perform up/down focus in the current container */
77                         if (focus_window_in_container(conn, container, direction))
78                                 return;
79
80                 if (direction == D_DOWN && cell_exists(current_col, current_row+1))
81                         new_row++;
82                 else if (direction == D_UP && cell_exists(current_col, current_row-1))
83                         new_row--;
84                 else {
85                         /* Let’s see if there is a screen down/up there to which we can switch */
86                         LOG("container is at %d with height %d\n", container->y, container->height);
87                         i3Screen *screen;
88                         int destination_y = (direction == D_UP ? (container->y - 1) : (container->y + container->height + 1));
89                         if ((screen = get_screen_containing(container->x, destination_y)) == NULL) {
90                                 LOG("Wrapping screen around vertically\n");
91                                 /* No screen found? Then wrap */
92                                 screen = get_screen_most((direction == D_UP ? D_DOWN : D_UP));
93                         }
94                         t_ws = &(workspaces[screen->current_workspace]);
95                         new_row = (direction == D_UP ? (t_ws->rows - 1) : 0);
96                 }
97         } else if (direction == D_LEFT || direction == D_RIGHT) {
98                 if (direction == D_RIGHT && cell_exists(current_col+1, current_row))
99                         new_col++;
100                 else if (direction == D_LEFT && cell_exists(current_col-1, current_row))
101                         new_col--;
102                 else {
103                         /* Let’s see if there is a screen left/right here to which we can switch */
104                         LOG("container is at %d with width %d\n", container->x, container->width);
105                         i3Screen *screen;
106                         int destination_x = (direction == D_LEFT ? (container->x - 1) : (container->x + container->width + 1));
107                         if ((screen = get_screen_containing(destination_x, container->y)) == NULL) {
108                                 LOG("Wrapping screen around horizontally\n");
109                                 screen = get_screen_most((direction == D_LEFT ? D_RIGHT : D_LEFT));
110                         }
111                         t_ws = &(workspaces[screen->current_workspace]);
112                         new_col = (direction == D_LEFT ? (t_ws->cols - 1) : 0);
113                 }
114         } else {
115                 LOG("direction unhandled\n");
116                 return;
117         }
118
119         /* Bounds checking */
120         if (new_col >= t_ws->cols)
121                 new_col = (t_ws->cols - 1);
122         if (new_row >= t_ws->rows)
123                 new_row = (t_ws->rows - 1);
124
125         if (t_ws->table[new_col][new_row]->currently_focused != NULL)
126                 set_focus(conn, t_ws->table[new_col][new_row]->currently_focused);
127 }
128
129 /*
130  * Tries to move the window inside its current container.
131  *
132  * Returns true if the window could be moved, false otherwise.
133  *
134  */
135 static bool move_current_window_in_container(xcb_connection_t *conn, Client *client,
136                 direction_t direction) {
137         assert(client->container != NULL);
138
139         Client *other = (direction == D_UP ? CIRCLEQ_PREV(client, clients) :
140                                              CIRCLEQ_NEXT(client, clients));
141
142         if (other == CIRCLEQ_END(&(client->container->clients)))
143                 return false;
144
145         LOG("i can do that\n");
146         /* We can move the client inside its current container */
147         CIRCLEQ_REMOVE(&(client->container->clients), client, clients);
148         if (direction == D_UP)
149                 CIRCLEQ_INSERT_BEFORE(&(client->container->clients), other, client, clients);
150         else CIRCLEQ_INSERT_AFTER(&(client->container->clients), other, client, clients);
151         render_layout(conn);
152         return true;
153 }
154
155 /*
156  * Moves the current window or whole container to the given direction, creating a column/row if
157  * necessary.
158  *
159  */
160 static void move_current_window(xcb_connection_t *conn, direction_t direction) {
161         LOG("moving window to direction %s\n", (direction == D_UP ? "up" : (direction == D_DOWN ? "down" :
162                                             (direction == D_LEFT ? "left" : "right"))));
163         /* Get current window */
164         Container *container = CUR_CELL,
165                   *new = NULL;
166
167         /* There has to be a container, see focus_window() */
168         assert(container != NULL);
169
170         /* If there is no window or the dock window is focused, we’re done */
171         if (container->currently_focused == NULL ||
172             container->currently_focused->dock)
173                 return;
174
175         /* As soon as the client is moved away, the next client in the old
176          * container needs to get focus, if any. Therefore, we save it here. */
177         Client *current_client = container->currently_focused;
178         Client *to_focus = CIRCLEQ_NEXT_OR_NULL(&(container->clients), current_client, clients);
179         if (to_focus == NULL)
180                 to_focus = CIRCLEQ_PREV_OR_NULL(&(container->clients), current_client, clients);
181
182         switch (direction) {
183                 case D_LEFT:
184                         /* If we’re at the left-most position, move the rest of the table right */
185                         if (current_col == 0) {
186                                 expand_table_cols_at_head(c_ws);
187                                 new = CUR_CELL;
188                         } else
189                                 new = CUR_TABLE[--current_col][current_row];
190                         break;
191                 case D_RIGHT:
192                         if (current_col == (c_ws->cols-1))
193                                 expand_table_cols(c_ws);
194
195                         new = CUR_TABLE[++current_col][current_row];
196                         break;
197                 case D_UP:
198                         if (move_current_window_in_container(conn, current_client, D_UP))
199                                 return;
200
201                         /* if we’re at the up-most position, move the rest of the table down */
202                         if (current_row == 0) {
203                                 expand_table_rows_at_head(c_ws);
204                                 new = CUR_CELL;
205                         } else
206                                 new = CUR_TABLE[current_col][--current_row];
207                         break;
208                 case D_DOWN:
209                         if (move_current_window_in_container(conn, current_client, D_DOWN))
210                                 return;
211
212                         if (current_row == (c_ws->rows-1))
213                                 expand_table_rows(c_ws);
214
215                         new = CUR_TABLE[current_col][++current_row];
216                         break;
217         }
218
219         /* Remove it from the old container and put it into the new one */
220         remove_client_from_container(conn, current_client, container);
221         CIRCLEQ_INSERT_TAIL(&(new->clients), current_client, clients);
222
223         /* Update data structures */
224         current_client->container = new;
225         container->currently_focused = to_focus;
226         new->currently_focused = current_client;
227
228         Workspace *workspace = container->workspace;
229
230         /* delete all empty columns/rows */
231         cleanup_table(conn, workspace);
232
233         /* Fix colspan/rowspan if it’d overlap */
234         fix_colrowspan(conn, workspace);
235
236         render_layout(conn);
237
238         set_focus(conn, current_client);
239 }
240
241 static void move_current_container(xcb_connection_t *conn, direction_t direction) {
242         LOG("moving container to direction %s\n", (direction == D_UP ? "up" : (direction == D_DOWN ? "down" :
243                                             (direction == D_LEFT ? "left" : "right"))));
244         /* Get current window */
245         Container *container = CUR_CELL,
246                   *new = NULL;
247
248         Container **old = &CUR_CELL;
249
250         /* There has to be a container, see focus_window() */
251         assert(container != NULL);
252
253         switch (direction) {
254                 case D_LEFT:
255                         /* If we’re at the left-most position, move the rest of the table right */
256                         if (current_col == 0) {
257                                 expand_table_cols_at_head(c_ws);
258                                 new = CUR_CELL;
259                                 old = &CUR_TABLE[current_col+1][current_row];
260                         } else
261                                 new = CUR_TABLE[--current_col][current_row];
262                         break;
263                 case D_RIGHT:
264                         if (current_col == (c_ws->cols-1))
265                                 expand_table_cols(c_ws);
266
267                         new = CUR_TABLE[++current_col][current_row];
268                         break;
269                 case D_UP:
270                         /* if we’re at the up-most position, move the rest of the table down */
271                         if (current_row == 0) {
272                                 expand_table_rows_at_head(c_ws);
273                                 new = CUR_CELL;
274                                 old = &CUR_TABLE[current_col][current_row+1];
275                         } else
276                                 new = CUR_TABLE[current_col][--current_row];
277                         break;
278                 case D_DOWN:
279                         if (current_row == (c_ws->rows-1))
280                                 expand_table_rows(c_ws);
281
282                         new = CUR_TABLE[current_col][++current_row];
283                         break;
284         }
285
286         LOG("old = %d,%d and new = %d,%d\n", container->col, container->row, new->col, new->row);
287
288         /* Swap the containers */
289         int col = new->col;
290         int row = new->row;
291
292         *old = new;
293         new->col = container->col;
294         new->row = container->row;
295
296         CUR_CELL = container;
297         container->col = col;
298         container->row = row;
299
300         Workspace *workspace = container->workspace;
301
302         /* delete all empty columns/rows */
303         cleanup_table(conn, workspace);
304
305         /* Fix colspan/rowspan if it’d overlap */
306         fix_colrowspan(conn, workspace);
307
308         render_layout(conn);
309 }
310
311 /*
312  * "Snaps" the current container (not possible for windows, because it works at table base)
313  * to the given direction, that is, adjusts cellspan/rowspan
314  *
315  */
316 static void snap_current_container(xcb_connection_t *conn, direction_t direction) {
317         LOG("snapping container to direction %d\n", direction);
318
319         Container *container = CUR_CELL;
320
321         assert(container != NULL);
322
323         switch (direction) {
324                 case D_LEFT:
325                         /* Snap to the left is actually a move to the left and then a snap right */
326                         if (!cell_exists(container->col - 1, container->row) ||
327                                 CUR_TABLE[container->col-1][container->row]->currently_focused != NULL) {
328                                 LOG("cannot snap to left - the cell is already used\n");
329                                 return;
330                         }
331
332                         move_current_window(conn, D_LEFT);
333                         snap_current_container(conn, D_RIGHT);
334                         return;
335                 case D_RIGHT: {
336                         /* Check if the cell is used */
337                         int new_col = container->col + container->colspan;
338                         if (!cell_exists(new_col, container->row) ||
339                                 CUR_TABLE[new_col][container->row]->currently_focused != NULL) {
340                                 LOG("cannot snap to right - the cell is already used\n");
341                                 return;
342                         }
343
344                         /* Check if there are other cells with rowspan, which are in our way.
345                          * If so, reduce their rowspan. */
346                         for (int i = container->row-1; i >= 0; i--) {
347                                 LOG("we got cell %d, %d with rowspan %d\n",
348                                                 new_col, i, CUR_TABLE[new_col][i]->rowspan);
349                                 while ((CUR_TABLE[new_col][i]->rowspan-1) >= (container->row - i))
350                                         CUR_TABLE[new_col][i]->rowspan--;
351                                 LOG("new rowspan = %d\n", CUR_TABLE[new_col][i]->rowspan);
352                         }
353
354                         container->colspan++;
355                         break;
356                 }
357                 case D_UP:
358                         if (!cell_exists(container->col, container->row - 1) ||
359                                 CUR_TABLE[container->col][container->row-1]->currently_focused != NULL) {
360                                 LOG("cannot snap to top - the cell is already used\n");
361                                 return;
362                         }
363
364                         move_current_window(conn, D_UP);
365                         snap_current_container(conn, D_DOWN);
366                         return;
367                 case D_DOWN: {
368                         LOG("snapping down\n");
369                         int new_row = container->row + container->rowspan;
370                         if (!cell_exists(container->col, new_row) ||
371                                 CUR_TABLE[container->col][new_row]->currently_focused != NULL) {
372                                 LOG("cannot snap down - the cell is already used\n");
373                                 return;
374                         }
375
376                         for (int i = container->col-1; i >= 0; i--) {
377                                 LOG("we got cell %d, %d with colspan %d\n",
378                                                 i, new_row, CUR_TABLE[i][new_row]->colspan);
379                                 while ((CUR_TABLE[i][new_row]->colspan-1) >= (container->col - i))
380                                         CUR_TABLE[i][new_row]->colspan--;
381                                 LOG("new colspan = %d\n", CUR_TABLE[i][new_row]->colspan);
382
383                         }
384
385                         container->rowspan++;
386                         break;
387                 }
388         }
389
390         render_layout(conn);
391 }
392
393 /*
394  * Moves the currently selected window to the given workspace
395  *
396  */
397 static void move_current_window_to_workspace(xcb_connection_t *conn, int workspace) {
398         LOG("Moving current window to workspace %d\n", workspace);
399
400         Container *container = CUR_CELL;
401
402         assert(container != NULL);
403
404         /* t_ws (to workspace) is just a container pointer to the workspace we’re switching to */
405         Workspace *t_ws = &(workspaces[workspace-1]);
406
407         Client *current_client = container->currently_focused;
408         if (current_client == NULL) {
409                 LOG("No currently focused client in current container.\n");
410                 return;
411         }
412         Client *to_focus = CIRCLEQ_NEXT_OR_NULL(&(container->clients), current_client, clients);
413         if (to_focus == NULL)
414                 to_focus = CIRCLEQ_PREV_OR_NULL(&(container->clients), current_client, clients);
415
416         if (t_ws->screen == NULL) {
417                 LOG("initializing new workspace, setting num to %d\n", workspace-1);
418                 t_ws->screen = container->workspace->screen;
419                 /* Copy the dimensions from the virtual screen */
420                 memcpy(&(t_ws->rect), &(container->workspace->screen->rect), sizeof(Rect));
421         }
422
423         Container *to_container = t_ws->table[t_ws->current_col][t_ws->current_row];
424
425         assert(to_container != NULL);
426
427         CIRCLEQ_REMOVE(&(container->clients), current_client, clients);
428         SLIST_REMOVE(&(container->workspace->focus_stack), current_client, Client, focus_clients);
429
430         CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
431         SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients);
432         LOG("Moved.\n");
433
434         current_client->container = to_container;
435         container->currently_focused = to_focus;
436         to_container->currently_focused = current_client;
437
438         /* If we’re moving it to an invisible screen, we need to unmap it */
439         if (to_container->workspace->screen->current_workspace != to_container->workspace->num) {
440                 LOG("This workspace is not visible, unmapping\n");
441                 xcb_unmap_window(conn, current_client->frame);
442         }
443
444         /* delete all empty columns/rows */
445         cleanup_table(conn, container->workspace);
446
447         render_layout(conn);
448 }
449
450 static void show_workspace(xcb_connection_t *conn, int workspace) {
451         Client *client;
452         xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
453         /* t_ws (to workspace) is just a convenience pointer to the workspace we’re switching to */
454         Workspace *t_ws = &(workspaces[workspace-1]);
455
456         LOG("show_workspace(%d)\n", workspace);
457
458         /* Store current_row/current_col */
459         c_ws->current_row = current_row;
460         c_ws->current_col = current_col;
461
462         /* Check if the workspace has not been used yet */
463         if (t_ws->screen == NULL) {
464                 LOG("initializing new workspace, setting num to %d\n", workspace);
465                 t_ws->screen = c_ws->screen;
466                 /* Copy the dimensions from the virtual screen */
467                 memcpy(&(t_ws->rect), &(t_ws->screen->rect), sizeof(Rect));
468         }
469
470         if (c_ws->screen != t_ws->screen) {
471                 /* We need to switch to the other screen first */
472                 LOG("moving over to other screen.\n");
473                 c_ws = &(workspaces[t_ws->screen->current_workspace]);
474                 current_col = c_ws->current_col;
475                 current_row = c_ws->current_row;
476                 if (CUR_CELL->currently_focused != NULL)
477                         warp_pointer_into(conn, CUR_CELL->currently_focused);
478                 else {
479                         Rect *dims = &(c_ws->screen->rect);
480                         xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
481                                          dims->x + (dims->width / 2), dims->y + (dims->height / 2));
482                 }
483         }
484
485         /* Check if we need to change something or if we’re already there */
486         if (c_ws->screen->current_workspace == (workspace-1))
487                 return;
488
489         t_ws->screen->current_workspace = workspace-1;
490
491         /* TODO: does grabbing the server actually bring us any (speed)advantages? */
492         //xcb_grab_server(conn);
493
494         ignore_enter_notify_forall(conn, c_ws, true);
495
496         /* Unmap all clients of the current workspace */
497         int unmapped_clients = 0;
498         FOR_TABLE(c_ws)
499                 CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients) {
500                         xcb_unmap_window(conn, client->frame);
501                         unmapped_clients++;
502                 }
503
504         /* If we did not unmap any clients, the workspace is empty and we can destroy it */
505         if (unmapped_clients == 0)
506                 c_ws->screen = NULL;
507
508         /* Unmap the stack windows on the current workspace, if any */
509         struct Stack_Window *stack_win;
510         SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
511                 if (stack_win->container->workspace == c_ws)
512                         xcb_unmap_window(conn, stack_win->window);
513
514         ignore_enter_notify_forall(conn, c_ws, false);
515
516         c_ws = &workspaces[workspace-1];
517         current_row = c_ws->current_row;
518         current_col = c_ws->current_col;
519         LOG("new current row = %d, current col = %d\n", current_row, current_col);
520
521         ignore_enter_notify_forall(conn, c_ws, true);
522
523         /* Map all clients on the new workspace */
524         FOR_TABLE(c_ws)
525                 CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients)
526                         xcb_map_window(conn, client->frame);
527
528         /* Map all stack windows, if any */
529         SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
530                 if (stack_win->container->workspace == c_ws)
531                         xcb_map_window(conn, stack_win->window);
532
533         ignore_enter_notify_forall(conn, c_ws, false);
534
535         /* Restore focus on the new workspace */
536         if (CUR_CELL->currently_focused != NULL)
537                 set_focus(conn, CUR_CELL->currently_focused);
538         else xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
539
540         //xcb_ungrab_server(conn);
541
542         render_layout(conn);
543 }
544
545 /*
546  * Parses a command, see file CMDMODE for more information
547  *
548  */
549 void parse_command(xcb_connection_t *conn, const char *command) {
550         LOG("--- parsing command \"%s\" ---\n", command);
551         /* Hmm, just to be sure */
552         if (command[0] == '\0')
553                 return;
554
555         /* Is it an <exec>? Then execute the given command. */
556         if (STARTS_WITH(command, "exec ")) {
557                 LOG("starting \"%s\"\n", command + strlen("exec "));
558                 start_application(command+strlen("exec "));
559                 return;
560         }
561
562         /* Is it an <exit>? */
563         if (STARTS_WITH(command, "exit"))
564                 exit(0);
565
566         /* Is it <restart>? Then restart in place. */
567         if (STARTS_WITH(command, "restart")) {
568                 LOG("restarting \"%s\"...\n", application_path);
569                 execl(application_path, application_path, NULL);
570                 /* not reached */
571         }
572
573         /* Is it 'f' for fullscreen? */
574         if (command[0] == 'f') {
575                 if (CUR_CELL->currently_focused == NULL)
576                         return;
577                 toggle_fullscreen(conn, CUR_CELL->currently_focused);
578                 return;
579         }
580
581         /* Is it just 's' for stacking or 'd' for default? */
582         if ((command[0] == 's' || command[0] == 'd') && (command[1] == '\0')) {
583                 LOG("Switching mode for current container\n");
584                 switch_layout_mode(conn, CUR_CELL, (command[0] == 's' ? MODE_STACK : MODE_DEFAULT));
585                 return;
586         }
587
588         enum { WITH_WINDOW, WITH_CONTAINER } with = WITH_WINDOW;
589
590         /* Is it a <with>? */
591         if (command[0] == 'w') {
592                 command++;
593                 /* TODO: implement */
594                 if (command[0] == 'c') {
595                         with = WITH_CONTAINER;
596                         command++;
597                 } else {
598                         LOG("not yet implemented.\n");
599                         return;
600                 }
601         }
602
603         /* It's a normal <cmd> */
604         char *rest = NULL;
605         enum { ACTION_FOCUS, ACTION_MOVE, ACTION_SNAP } action = ACTION_FOCUS;
606         direction_t direction;
607         int times = strtol(command, &rest, 10);
608         if (rest == NULL) {
609                 LOG("Invalid command (\"%s\")\n", command);
610                 return;
611         }
612
613         if (*rest == '\0') {
614                 /* No rest? This was a tag number, not a times specification */
615                 show_workspace(conn, times);
616                 return;
617         }
618
619         if (*rest == 'm' || *rest == 's') {
620                 action = (*rest == 'm' ? ACTION_MOVE : ACTION_SNAP);
621                 rest++;
622         }
623
624         int workspace = strtol(rest, &rest, 10);
625
626         if (rest == NULL) {
627                 LOG("Invalid command (\"%s\")\n", command);
628                 return;
629         }
630
631         if (*rest == '\0') {
632                 move_current_window_to_workspace(conn, workspace);
633                 return;
634         }
635
636         /* Now perform action to <where> */
637         while (*rest != '\0') {
638                 if (*rest == 'h')
639                         direction = D_LEFT;
640                 else if (*rest == 'j')
641                         direction = D_DOWN;
642                 else if (*rest == 'k')
643                         direction = D_UP;
644                 else if (*rest == 'l')
645                         direction = D_RIGHT;
646                 else {
647                         LOG("unknown direction: %c\n", *rest);
648                         return;
649                 }
650
651                 if (action == ACTION_FOCUS)
652                         focus_thing(conn, direction, (with == WITH_WINDOW ? THING_WINDOW : THING_CONTAINER));
653                 else if (action == ACTION_MOVE) {
654                         if (with == WITH_WINDOW)
655                                 move_current_window(conn, direction);
656                         else move_current_container(conn, direction);
657                 }
658                 else if (action == ACTION_SNAP)
659                         snap_current_container(conn, direction);
660
661                 rest++;
662         }
663
664         LOG("--- done ---\n");
665 }