Monthly Archives: October 2016

TCC – dynarray_add

This is very common function in TCC state.

here is main logical.

1
2
3
4
5
6
7
dynarray_add(void ***ptab, int *nb_ptr, void *data) 
{
...
pp= *ptab; nb=*nb_ptr;
pp[nb++] = data;
...
}

what dynarray_add do is simple. input array has just 3 parts that is double pointer, index and value.

then assign data to double pointer just like assign string to char array.

Here is sample call stack, it call to add pathname into library_paths.

1
2
3
dynarray_add(p_ary, p_nb_ary, str.data);
tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char *in)
tcc_split_path(s, (void ***)&s->library_paths, &s->nb_library_paths, pathname);

the define of library_paths is following

1
2
3
4
5
6
struct TCCState {
...
    char **library_paths;
    int nb_library_paths;
...
}

ionic side menu left button and right button disappear

When doing Ionic project, one problem that sometime nav buttons for side menu will disappear, this is very annoying.

Here is sample code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<ion-side-menu-content>
  <ion-nav-bar class="bar-positive">
 
    <ion-nav-buttons side="left">
      <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
      </button>
    </ion-nav-buttons>
 
    <ion-nav-buttons side="right">
      <button class="button button-icon button-clear ion-navicon" menu-toggle="right">
      </button>
 
    </ion-nav-buttons>
  </ion-nav-bar>
 
  <ion-nav-view name="centre-panel"></ion-nav-view>
 
</ion-side-menu-content>

The solution is following: adding enable-menu-with-back-views=”true” to ion-side-menus

1
<ion-side-menus enable-menu-with-back-views="true">