Skip to content

Commit

Permalink
Import from googlecode archive
Browse files Browse the repository at this point in the history
  • Loading branch information
barbieri committed Jul 30, 2016
0 parents commit 760200c
Show file tree
Hide file tree
Showing 330 changed files with 40,889 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Code Playground
===============

This area is to keep code I write but isn't part of a project.


COPYING / LICENSE
=================

Code present here is under GNU GPL unless a different license is stated.


AUTHOR
======

Gustavo Sverzut Barbieri <barbieri at gmail.com>

99 changes: 99 additions & 0 deletions c-tests/introspection.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Simulates basics of structure introspection using C.
*
* Compile:
*
* gcc -o introspection introspection.c -Wall -std=c99
*
*/
#include <stdio.h>

#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
#define typeof(v) __typeof__(v)

struct map
{
const char *name;
enum {
MAP_TYPE_UNKNOWN,
MAP_TYPE_INT,
MAP_TYPE_STR,
MAP_TYPE_DOUBLE
} type;
unsigned offset;
};

#define _STR(v) #v
#define STR(v) _STR(v)
#define MAP(strtype, field, fieldtype) \
{STR(field), fieldtype, offsetof(strtype, field)}
#define MAP_SENTINEL {NULL, MAP_TYPE_UNKNOWN, 0}


static void
print_map_int(const struct map *map, const void *data)
{
const void *value;

value = ((const char *)data) + map->offset;

printf("%s=", map->name);
switch (map->type) {
case MAP_TYPE_UNKNOWN:
printf("<ERROR>");
break;
case MAP_TYPE_INT:
printf("%d", *(int *)value);
break;
case MAP_TYPE_STR:
printf("%s", *(char **)value);
break;
case MAP_TYPE_DOUBLE:
printf("%f", *(double *)value);
break;
}
}

static void
print_map(const struct map *map, const void *data)
{
const struct map *p;

for (p = map; p->name != NULL; p++) {
print_map_int(p, data);
if ((p + 1)->name != NULL)
putchar(' ');
}

putchar('\n');
}

struct row
{
int i;
char *s;
double f;
};

int
main(void)
{
const struct row *p, *p_end;
const struct row rows[] = {
{1, "test", 12.34},
{2, "abc", 5678.9},
{3, "xxx", 2.0},
};
const struct map map[] = {
MAP(struct row, i, MAP_TYPE_INT),
MAP(struct row, s, MAP_TYPE_STR),
MAP(struct row, f, MAP_TYPE_DOUBLE),
MAP_SENTINEL
};

p_end = rows + sizeof(rows) / sizeof(*rows);
for (p = rows; p < p_end; p++)
print_map(map, p);

return 0;
}
1 change: 1 addition & 0 deletions dot-files/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These are not code, but my ~/.* files with my favorite settings.
84 changes: 84 additions & 0 deletions dot-files/Xresources
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
!Xft.hintstyle: hintmedium
!Xft.hinting: true
Xft.dpi: 75

!! NOTE: programming and terminal fonts (why their name seems changed?! ;-P)
!!
!! * terminus is excellent size for reading longer texts but still compact
!! to fit 60 columns in 800px screens with enough room (better than
!! proggyclean for instance):
!! -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-15
!!
!! * proggytinysz is very small, but can be tiring for longer text so just
!! used for terminals
!! -windows-proggytinysz-medium-r-normal--10-80-96-96-c-60-iso8859-1


Emacs.toolBar: off
Emacs.menuBar: off
Emacs.verticalScrollBars: off
Emacs*geometry: 80x60-1+0
Emacs*font: -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-15
Emacs*background: rgb:00/00/00
Emacs*foreground: rgb:d9/d9/d9
Emacs*cursorColor: rgb:ff/00/ff
Emacs*pointerColor: rgb:ff/ff/ff

xterm*popOnBell: on
xterm*VT100.geometry: 80x40
xterm*geometry: 80x40
xterm*background: rgb:00/00/00
xterm*foreground: rgb:d9/d9/d9
xterm*font: -windows-proggytinysz-medium-r-normal--10-80-96-96-c-60-iso8859-1
xterm*color4: rgb:66/66/ff
xterm*color12: rgb:aa/aa/ff

!! transparent background: (+cpu/mem, and not so nice w/ my current wallpaper)
! URxvt.depth: 32
! URxvt.background: rgba:0000/0000/0000/dddd
!! solid version:
URxvt.depth: 24
URxvt.background: rgb:00/00/00
URxvt.foreground: rgb:d9/d9/d9
URxvt.color3: rgb:aa/77/11
URxvt.color4: rgb:55/66/ff
URxvt.color12: rgb:77/88/ff
URxvt.colorURL: rgb:d9/ff/ff
URxvt.cursorColor: rgb:ff/00/ff
URxvt.pointerColor: rgb:ff/ff/ff
URxvt.fading: 20
URxvt.scrollBar: off
!! I *hate* bold fonts in terminal, use intensity colors instead. Disable them
URxvt.boldFont:
URxvt.italicFont:
URxvt.boldItalicFont:
URxvt.intensityStyles: on
URxvt.font: -windows-proggytinysz-medium-r-normal--10-80-96-96-c-60-iso8859-1
!! C-M-[0-7] to change font sizes (useful for presentations)
URxvt.keysym.C-M-0: command:\033]50;-windows-proggytinysz-medium-r-normal--10-80-96-96-c-60-iso8859-1\007
URxvt.keysym.C-M-1: command:\033]50;-xos4-terminus-medium-r-normal--12-120-72-72-c-60-*-u\007
URxvt.keysym.C-M-2: command:\033]50;-xos4-terminus-medium-r-normal--16-160-72-72-c-*-*-u\007
URxvt.keysym.C-M-3: command:\033]50;-xos4-terminus-medium-r-normal--20-200-72-72-c-*-*-u\007
URxvt.keysym.C-M-4: command:\033]50;-xos4-terminus-medium-r-normal--22-220-72-72-c-*-*-u\007
URxvt.keysym.C-M-5: command:\033]50;-xos4-terminus-medium-r-normal--24-240-72-72-c-*-*-u\007
URxvt.keysym.C-M-6: command:\033]50;-xos4-terminus-medium-r-normal--28-280-72-72-c-*-*-u\007
URxvt.keysym.C-M-7: command:\033]50;-xos4-terminus-medium-r-normal--32-320-72-72-c-*-*-u\007
!! C-M-[8-9] to change terminal size
URxvt.keysym.C-M-8: command:\033[8;40;80t\007
URxvt.keysym.C-M-9: command:\033[8;80;120t\007

URxvt.saveLines: 5000
!! add ":" to cutchars, as grep/gcc and others output filename:message
URxvt.cutchars: '`"&()*,;<=>?@[]^{|}:~'
! URxvt.perl-ext: default,tabbed,matcher
URxvt.perl-ext: default,matcher
URxvt.urgentOnBell: true
URxvt.visualBell: true
URxvt.pointerBlank: true
URxvt.perl-lib: /home/gustavo/.urxvt/perl
URxvt.tabbed.tabbar-bg: 4
URxvt.tabbed.tabbar-fg: 0
URxvt.tabbed.tab-bg: 3
URxvt.tabbed.tab-fg: 15
URxvt.matcher.button: 1
URxvt.urlLauncher: /usr/bin/chromium
14 changes: 14 additions & 0 deletions dot-files/edje-lua-mode.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(require 'mmm-mode)
(require 'mmm-auto)
(require 'mmm-vars)

(mmm-add-classes
'((edje-lua
:submode lua
:face mmm-code-submode-face
:front "lua_script[ ]*\{"
:back "\}")))

;; (mmm-add-mode-ext-class 'edje-mode nil 'edje-lua)

(provide 'edje-lua-mode)
Loading

0 comments on commit 760200c

Please sign in to comment.