diff --git a/xmdev/build.sh b/xmdev/build.sh new file mode 100755 index 0000000..d15dd83 --- /dev/null +++ b/xmdev/build.sh @@ -0,0 +1,2 @@ +#!/bin/sh +../scripts/buildapp.sh xmdev "$@" diff --git a/xmdev/src/icons/disk-small.xbm b/xmdev/src/icons/disk-small.xbm new file mode 100644 index 0000000..5f29a06 --- /dev/null +++ b/xmdev/src/icons/disk-small.xbm @@ -0,0 +1,9 @@ +#define disk_small_width 24 +#define disk_small_height 24 +static unsigned char disk_small_bits[] = { + 0xff, 0xff, 0x0f, 0x01, 0x00, 0x10, 0x01, 0x3c, 0x20, 0x81, 0xc3, 0x41, + 0xc1, 0x00, 0x83, 0x21, 0x00, 0x84, 0x11, 0x00, 0x88, 0x19, 0x00, 0x99, + 0x09, 0x80, 0x90, 0x09, 0x40, 0x90, 0xe5, 0x00, 0xa0, 0x05, 0x1b, 0xa0, + 0x05, 0xd8, 0xa0, 0x05, 0x00, 0xa7, 0x09, 0x02, 0x90, 0x09, 0x01, 0x90, + 0x99, 0x0c, 0x98, 0x11, 0xf8, 0x88, 0x21, 0xe0, 0x8f, 0xc1, 0x80, 0xbf, + 0x81, 0xc3, 0xbf, 0x01, 0x3c, 0xbc, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff }; diff --git a/xmdev/src/icons/disk.xbm b/xmdev/src/icons/disk.xbm new file mode 100644 index 0000000..d9507b4 --- /dev/null +++ b/xmdev/src/icons/disk.xbm @@ -0,0 +1,27 @@ +#define disk_width 48 +#define disk_height 48 +static unsigned char disk_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x04, 0x14, 0x00, 0xf0, 0x0f, 0x00, 0x09, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x13, 0x14, 0x80, 0x0f, 0xf0, 0x01, 0x24, + 0xf4, 0xff, 0x01, 0x80, 0xff, 0x2f, 0x14, 0x70, 0x00, 0x00, 0x0e, 0x28, + 0xf4, 0x3f, 0x00, 0x00, 0xfc, 0x2f, 0x14, 0x0c, 0x00, 0x00, 0x30, 0x28, + 0xf4, 0x07, 0x00, 0x00, 0xe0, 0x2f, 0x14, 0x07, 0x00, 0x00, 0xe4, 0x28, + 0xf4, 0x03, 0x00, 0x00, 0xc2, 0x2f, 0x94, 0x01, 0x00, 0x00, 0x81, 0x29, + 0xf4, 0x01, 0x00, 0x80, 0x80, 0x2f, 0xd4, 0x00, 0x00, 0x40, 0x00, 0x2b, + 0xf4, 0x00, 0x00, 0x20, 0x30, 0x2f, 0xd4, 0x00, 0x00, 0x10, 0x0c, 0x2b, + 0x74, 0x00, 0xc0, 0x03, 0x03, 0x2e, 0x74, 0x00, 0x60, 0xc5, 0x00, 0x2e, + 0x74, 0x00, 0x30, 0x0a, 0x00, 0x2e, 0x74, 0x00, 0x90, 0x0d, 0x00, 0x2e, + 0x74, 0x00, 0xb0, 0x09, 0x00, 0x2e, 0x74, 0x00, 0x50, 0x0c, 0x00, 0x2e, + 0x74, 0x00, 0xa6, 0x06, 0x00, 0x2e, 0x74, 0xe0, 0xc1, 0x03, 0x00, 0x2e, + 0xf4, 0x1c, 0x08, 0x00, 0x00, 0x2f, 0xd4, 0x00, 0x04, 0x00, 0x00, 0x2b, + 0xf4, 0x00, 0x02, 0x00, 0x00, 0x2f, 0x94, 0x01, 0x01, 0x00, 0x80, 0x29, + 0xf4, 0x81, 0xc0, 0x01, 0x80, 0x2f, 0x14, 0x43, 0x80, 0x0f, 0xc0, 0x28, + 0xf4, 0x27, 0x00, 0xf6, 0xe0, 0x2f, 0x14, 0x06, 0x00, 0x18, 0x6f, 0x28, + 0xf4, 0x0f, 0x00, 0x20, 0xf0, 0x2f, 0x14, 0x38, 0x00, 0xc0, 0x00, 0x2b, + 0xf4, 0x7f, 0x00, 0x00, 0x43, 0x2e, 0x14, 0xe0, 0x01, 0x80, 0x87, 0x2a, + 0xf4, 0xff, 0x0f, 0xf0, 0x1f, 0x2e, 0x14, 0x00, 0xfe, 0x7f, 0xe0, 0x29, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/filesystem-small.xbm b/xmdev/src/icons/filesystem-small.xbm new file mode 100644 index 0000000..f55d0cd --- /dev/null +++ b/xmdev/src/icons/filesystem-small.xbm @@ -0,0 +1,9 @@ +#define filesystem_small_width 24 +#define filesystem_small_height 24 +static unsigned char filesystem_small_bits[] = { + 0xf0, 0xff, 0x0f, 0x10, 0x00, 0x08, 0xd0, 0xff, 0x0b, 0x50, 0x00, 0x0a, + 0x50, 0x81, 0x0a, 0x50, 0x00, 0x0a, 0x50, 0x00, 0x0a, 0x50, 0x3c, 0x0a, + 0x50, 0x81, 0x0a, 0x50, 0x00, 0x0a, 0xd0, 0xff, 0x0b, 0x10, 0x00, 0x08, + 0xd0, 0xff, 0x0b, 0xd0, 0xff, 0x0b, 0x50, 0x00, 0x0a, 0x50, 0x81, 0x0a, + 0x50, 0x00, 0x0a, 0x50, 0x00, 0x0a, 0x50, 0x3c, 0x0a, 0x50, 0x81, 0x0a, + 0x50, 0x00, 0x0a, 0xd0, 0xff, 0x0b, 0x10, 0x00, 0x08, 0xf0, 0xff, 0x0f }; diff --git a/xmdev/src/icons/filesystem.xbm b/xmdev/src/icons/filesystem.xbm new file mode 100644 index 0000000..da0bd2d --- /dev/null +++ b/xmdev/src/icons/filesystem.xbm @@ -0,0 +1,27 @@ +#define filesystem_width 48 +#define filesystem_height 48 +static unsigned char filesystem_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, + 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, + 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x00, + 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00, + 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00, + 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, + 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00, + 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, + 0x00, 0x1e, 0x00, 0x00, 0x78, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/generic-small.xbm b/xmdev/src/icons/generic-small.xbm new file mode 100644 index 0000000..c44f452 --- /dev/null +++ b/xmdev/src/icons/generic-small.xbm @@ -0,0 +1,9 @@ +#define generic_small_width 24 +#define generic_small_height 24 +static unsigned char generic_small_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xcc, 0x01, + 0x00, 0x80, 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0x01, 0x00, 0xc0, 0x00, + 0x00, 0xc0, 0x00, 0x00, 0x60, 0x00, 0x00, 0x30, 0x00, 0x00, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/generic.xbm b/xmdev/src/icons/generic.xbm new file mode 100644 index 0000000..161a1b1 --- /dev/null +++ b/xmdev/src/icons/generic.xbm @@ -0,0 +1,27 @@ +#define generic_width 48 +#define generic_height 48 +static unsigned char generic_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, + 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x03, 0x00, + 0x00, 0x00, 0x30, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x10, 0xe0, 0x03, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, + 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/icon.xbm b/xmdev/src/icons/icon.xbm new file mode 100644 index 0000000..16bca62 --- /dev/null +++ b/xmdev/src/icons/icon.xbm @@ -0,0 +1,27 @@ +#define icon_width 48 +#define icon_height 48 +static unsigned char icon_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x04, 0x14, 0x00, 0xf0, 0x0f, 0x00, 0x09, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x13, 0x14, 0x80, 0x0f, 0xf0, 0x01, 0x24, + 0xf4, 0xff, 0x01, 0x80, 0xff, 0x2f, 0x14, 0x70, 0x00, 0x00, 0x0e, 0x28, + 0xf4, 0x3f, 0x00, 0x00, 0xfc, 0x2f, 0x14, 0x0c, 0x00, 0x00, 0x30, 0x28, + 0xf4, 0x07, 0x00, 0x00, 0xe0, 0x2f, 0x14, 0x07, 0x00, 0x00, 0xe4, 0x28, + 0xf4, 0x03, 0x00, 0x00, 0xc2, 0x2f, 0x94, 0x01, 0x00, 0x00, 0x81, 0x29, + 0xf4, 0x01, 0x00, 0x80, 0x80, 0x2f, 0xd4, 0x00, 0x00, 0x40, 0x00, 0x2b, + 0xf4, 0x00, 0x00, 0x20, 0x30, 0x2f, 0xd4, 0x00, 0x00, 0x10, 0x0c, 0x2b, + 0x74, 0x00, 0xc0, 0x03, 0x03, 0x2e, 0x74, 0x00, 0x60, 0xc5, 0x00, 0x2e, + 0x74, 0x00, 0x30, 0x0a, 0x00, 0x2e, 0x74, 0x00, 0x90, 0x0d, 0x00, 0x2e, + 0x74, 0x00, 0xb0, 0x09, 0x00, 0x2e, 0x74, 0x00, 0x50, 0x0c, 0x00, 0x2e, + 0x74, 0x00, 0xa6, 0x06, 0x00, 0x2e, 0x74, 0xe0, 0xc1, 0x03, 0x00, 0x2e, + 0xf4, 0x1c, 0x08, 0x00, 0x00, 0x2f, 0xd4, 0x00, 0x04, 0x00, 0x00, 0x2b, + 0xf4, 0x00, 0x02, 0x00, 0x00, 0x2f, 0x94, 0x01, 0x01, 0x00, 0x80, 0x29, + 0xf4, 0x81, 0xc0, 0x01, 0x80, 0x2f, 0x14, 0x43, 0x80, 0x0f, 0xc0, 0x28, + 0xf4, 0x27, 0x00, 0xf6, 0xe0, 0x2f, 0x14, 0x06, 0x00, 0x18, 0x6f, 0x28, + 0xf4, 0x0f, 0x00, 0x20, 0xf0, 0x2f, 0x14, 0x38, 0x00, 0xc0, 0x00, 0x2b, + 0xf4, 0x7f, 0x00, 0x00, 0x43, 0x2e, 0x14, 0xe0, 0x01, 0x80, 0x87, 0x2a, + 0xf4, 0xff, 0x0f, 0xf0, 0x1f, 0x2e, 0x14, 0x00, 0xfe, 0x7f, 0xe0, 0x29, + 0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x2f, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/rom-small.xbm b/xmdev/src/icons/rom-small.xbm new file mode 100644 index 0000000..2eb2903 --- /dev/null +++ b/xmdev/src/icons/rom-small.xbm @@ -0,0 +1,9 @@ +#define rom_small_width 24 +#define rom_small_height 24 +static unsigned char rom_small_bits[] = { + 0xe0, 0xff, 0x07, 0x20, 0x00, 0x04, 0xf0, 0xff, 0x0f, 0x28, 0x00, 0x14, + 0xf0, 0xff, 0x0f, 0x28, 0x42, 0x14, 0xf0, 0xc3, 0x0f, 0x28, 0x42, 0x14, + 0xf0, 0xc3, 0x0f, 0x28, 0x42, 0x14, 0xf0, 0xc3, 0x0f, 0x28, 0x42, 0x14, + 0xf0, 0xc3, 0x0f, 0x28, 0x42, 0x14, 0xf0, 0xc3, 0x0f, 0x28, 0x42, 0x14, + 0xf0, 0xff, 0x0f, 0x28, 0x00, 0x14, 0xf0, 0xff, 0x0f, 0x28, 0x00, 0x14, + 0xf0, 0xff, 0x0f, 0xe8, 0xff, 0x17, 0xf0, 0xff, 0x0f, 0x08, 0x00, 0x10 }; diff --git a/xmdev/src/icons/rom.xbm b/xmdev/src/icons/rom.xbm new file mode 100644 index 0000000..27dc84a --- /dev/null +++ b/xmdev/src/icons/rom.xbm @@ -0,0 +1,27 @@ +#define rom_width 48 +#define rom_height 48 +static unsigned char rom_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0x0c, 0x00, 0x00, 0x60, 0x02, + 0x40, 0xfc, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x0f, 0x00, 0x00, 0xe0, 0x05, + 0xc0, 0xfc, 0xff, 0xff, 0x7f, 0x06, 0x00, 0x0f, 0x00, 0x00, 0xe0, 0x01, + 0x80, 0xfc, 0xff, 0xff, 0x7f, 0x02, 0x40, 0x0c, 0x00, 0x00, 0x60, 0x04, + 0x40, 0xff, 0xff, 0xff, 0xff, 0x05, 0xc0, 0x0c, 0x00, 0x00, 0x60, 0x06, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0x0c, 0x08, 0x20, 0x60, 0x02, + 0x40, 0xfc, 0x0f, 0xe0, 0x7f, 0x04, 0x40, 0x0f, 0x08, 0x20, 0xe0, 0x05, + 0xc0, 0xfc, 0x0f, 0xe0, 0x7f, 0x06, 0x00, 0x0f, 0x08, 0x20, 0xe0, 0x01, + 0x80, 0xfc, 0x0f, 0xe0, 0x7f, 0x02, 0x40, 0x0c, 0x08, 0x20, 0x60, 0x04, + 0x40, 0xff, 0x0f, 0xe0, 0xff, 0x05, 0xc0, 0x0c, 0x08, 0x20, 0x60, 0x06, + 0x00, 0xff, 0x0f, 0xe0, 0xff, 0x01, 0x80, 0x0c, 0x08, 0x20, 0x60, 0x02, + 0x40, 0xfc, 0x0f, 0xe0, 0x7f, 0x04, 0x40, 0x0f, 0x08, 0x20, 0xe0, 0x05, + 0xc0, 0xfc, 0x0f, 0xe0, 0x7f, 0x06, 0x00, 0x0f, 0x08, 0x20, 0xe0, 0x01, + 0x80, 0xfc, 0x0f, 0xe0, 0x7f, 0x02, 0x40, 0x0c, 0x08, 0x20, 0x60, 0x04, + 0x40, 0xff, 0x0f, 0xe0, 0xff, 0x05, 0xc0, 0x0c, 0x08, 0x20, 0x60, 0x06, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0x0c, 0x00, 0x00, 0x60, 0x02, + 0x40, 0xfc, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x0f, 0x00, 0x00, 0xe0, 0x05, + 0xc0, 0xfc, 0xff, 0xff, 0x7f, 0x06, 0x00, 0x0f, 0x00, 0x00, 0xe0, 0x01, + 0x80, 0xfc, 0xff, 0xff, 0x7f, 0x02, 0x40, 0x0c, 0x00, 0x00, 0x60, 0x04, + 0x40, 0xff, 0xff, 0xff, 0xff, 0x05, 0xc0, 0x0c, 0x00, 0x00, 0x60, 0x06, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0xfc, 0xff, 0xff, 0x7f, 0x02, + 0x40, 0xfc, 0xff, 0xff, 0x7f, 0x04, 0x40, 0xff, 0xff, 0xff, 0xff, 0x05, + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/tty-small.xbm b/xmdev/src/icons/tty-small.xbm new file mode 100644 index 0000000..76c64a1 --- /dev/null +++ b/xmdev/src/icons/tty-small.xbm @@ -0,0 +1,9 @@ +#define tty_small_width 24 +#define tty_small_height 24 +static unsigned char tty_small_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x0f, 0x08, 0x00, 0x10, + 0xe8, 0xff, 0x17, 0x28, 0xfe, 0x17, 0x28, 0xc0, 0x17, 0x28, 0xfe, 0x17, + 0x28, 0xfc, 0x17, 0xe8, 0xff, 0x17, 0xe8, 0xff, 0x17, 0xe8, 0xff, 0x17, + 0xe8, 0xff, 0x17, 0xe8, 0xff, 0x17, 0x08, 0x00, 0x10, 0x08, 0x00, 0x13, + 0xf0, 0xff, 0x0f, 0x00, 0x81, 0x00, 0xf8, 0xff, 0x1f, 0x04, 0x00, 0x20, + 0x82, 0xff, 0x41, 0x02, 0x00, 0x40, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/icons/tty.xbm b/xmdev/src/icons/tty.xbm new file mode 100644 index 0000000..ba7a560 --- /dev/null +++ b/xmdev/src/icons/tty.xbm @@ -0,0 +1,27 @@ +#define tty_width 48 +#define tty_height 48 +static unsigned char tty_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xfd, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0x80, 0xf2, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xfd, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xf0, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x60, 0x00, 0x00, 0x00, 0x33, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, + 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, + 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, + 0x0c, 0xc0, 0xff, 0xff, 0x03, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, + 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/xmdev/src/main.c b/xmdev/src/main.c new file mode 100644 index 0000000..0910625 --- /dev/null +++ b/xmdev/src/main.c @@ -0,0 +1,304 @@ +#define _XOPEN_SOURCE +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "icons/generic.xbm" +#include "icons/generic-small.xbm" +#include "icons/icon.xbm" +#include "icons/disk.xbm" +#include "icons/disk-small.xbm" +#include "icons/rom.xbm" +#include "icons/rom-small.xbm" +#include "icons/tty.xbm" +#include "icons/tty-small.xbm" +#include "icons/filesystem.xbm" +#include "icons/filesystem-small.xbm" + +XtAppContext application; +XmdStringMap *devices; +Widget container; +Pixmap iconsLarge[5] = { 0 }; +Pixmap iconsSmall[5] = { 0 }; + +typedef enum { + DeviceKindGeneric, + DeviceKindDisk, + DeviceKindRom, + DeviceKindFilesystem, + DeviceKindTTY +} DeviceKind; + +typedef struct { + Widget widget; + DeviceKind kind; + String name; + String mountPoint; + String label; +} Device; + +void loadIconPixmaps (void); +void refreshDevices (void); +Device * DeviceNew (String name, DeviceKind kind); +void DeviceDelete (ConstString name); +void DeviceFree (Device *this); +void DeviceSetKind (Device *this, DeviceKind kind); +void DeviceSetMountPoint (Device *this, ConstString mountPoint); +void DeviceSetLabel (Device *this, ConstString label); +int readBlockDevice (FILE *stream, Device **); +int readLsblkPair (FILE *stream, String *key, String *value); + +int main (int argc, char *argv[]) { + devices = XmdStringMapNew(); + + Widget window = XtVaAppInitialize ( + &application, "Devices", + NULL, 0, + &argc, argv, + NULL, + XmNtitle, "Devices", + XmNiconName, "Devices", + NULL); + Pixmap iconPixmap = XmdLoadBitmapIcon(window, icon); + XtVaSetValues ( + window, + XmNiconPixmap, iconPixmap, + NULL); + container = XtVaCreateManagedWidget ( + "container", xmContainerWidgetClass, window, + XmNlayoutType, XmSPATIAL, + XmNspatialStyle, XmGRID, + NULL); + + loadIconPixmaps(); + refreshDevices(); + + XtRealizeWidget(window); + XtAppMainLoop(application); +} + +void loadIconPixmaps (void) { + #define dev(kind, name) \ + iconsLarge[DeviceKind##kind] = XmdLoadBitmapIcon(container, name); \ + iconsSmall[DeviceKind##kind] = XmdLoadBitmapIcon(container, name##_small) + dev(Generic, generic); + dev(Disk, disk); + dev(Rom, rom); + dev(Filesystem, filesystem); + dev(TTY, tty); +} + +void refreshDevices (void) { + XtUnmanageChild(container); + + pid_t child = 0; + FILE *stream = XmdVaPipedExecPath ( + "lsblk", &child, "r", + "", "-P", "-o", "NAME,TYPE,MOUNTPOINTS,LABEL", NULL); + if (stream == NULL) { + /* TODO error */ + return; + } + Device *device = NULL; + while (readBlockDevice(stream, &device) != EOF) { + /* do something with device? */ + } + fclose(stream); + waitpid(child, NULL, 0); + + XtManageChild(container); +} + +int readBlockDevice (FILE *stream, Device **device) { + DeviceKind kind = DeviceKindGeneric; + String name = NULL; + String mountPoint = NULL; + String label = NULL; + + int ch = 0; + while (1) { + String key = NULL; + String value = NULL; + ch = readLsblkPair(stream, &key, &value); + + if (strcmp(key, "NAME") == 0) { + XtFree(name); + name = value; + } else if (strcmp(key, "TYPE") == 0) { + if (strcmp(value, "disk") == 0) { + kind = DeviceKindDisk; + } else if (strcmp(value, "rom") == 0) { + kind = DeviceKindRom; + } else if (strcmp(value, "part") == 0) { + kind = DeviceKindFilesystem; + } + XtFree(value); + } else if (strcmp(key, "MOUNTPOINTS") == 0) { + XtFree(mountPoint); + mountPoint = value; + } else if (strcmp(key, "LABEL") == 0) { + XtFree(label); + label = value; + } else { + XtFree(value); + } + XtFree(key); + + while ((ch = fgetc(stream)) == ' '); + if (ch == EOF || ch == '\n') break; + ungetc(ch, stream); + } + + if (name != NULL) { + *device = XmdStringMapGet(devices, name); + if (*device == NULL) { + *device = DeviceNew(name, kind); + } else { + DeviceSetKind(*device, kind); + } + DeviceSetMountPoint(*device, mountPoint); + DeviceSetLabel(*device, label); + } + + XtFree(name); + XtFree(mountPoint); + XtFree(label); + return ch; +} + +int readLsblkPair (FILE *stream, String *key, String *value) { + int ch = 0; + int escapeCh = 0; + char null = 0; + + *key = NULL; + *value = NULL; + + XmdBuffer *keyBuffer = XmdBufferNew(char); + while (isalpha(ch = fgetc(stream))) XmdBufferPush(keyBuffer, &ch); + XmdBufferPush(keyBuffer, &null); + *key = XmdBufferBreak(keyBuffer); + + fgetc(stream); /* skip = */ + + XmdBuffer *valueBuffer = XmdBufferNew(char); + enum { + stateGetString, + stateGetEscape, + + } state = stateGetString; + while (1) { + ch = fgetc(stream); + if (ch == EOF) goto end; + + switch (state) { + case stateGetString: + switch (ch) { + case '"': goto end; + case '\\': state = stateGetEscape; break; + default: XmdBufferPush(valueBuffer, &ch); break; + } + break; + + case stateGetEscape: + ch = fgetc(stream); /* skip x */ + int digit = tolower(ch); + if ( + (digit < '0' || digit > '9') && + (digit < 'a' || digit > 'f') + ) { + ungetc(ch, stream); + XmdBufferPush(valueBuffer, &escapeCh); + state = stateGetString; + break; + } + digit -= '0'; + if (digit > 9) digit -= 'a' - '9' - 1; + escapeCh *= 16; + escapeCh += digit; + break; + } + } + end: + XmdBufferPush(valueBuffer, &null); + *value = XmdBufferBreak(valueBuffer); + if (strlen(*value) == 0) { + XtFree(*value); + *value = NULL; + } + return ch; +} + +Device *DeviceNew (String name, DeviceKind kind) { + Device *this = XtNew(Device); + this->mountPoint = NULL; + this->label = NULL; + this->name = XtNewString(name); + XmString string = XmStringCreateLocalized(name); + this->widget = XtVaCreateManagedWidget ( + "device", xmIconGadgetClass, container, + XmNalignment, XmALIGNMENT_CENTER, + XmNlabelString, string, + NULL); + XmStringFree(string); + DeviceSetKind(this, kind); + XmdStringMapSet(devices, name, this); + return this; +} + +void DeviceDelete (ConstString name) { + DeviceFree(XmdStringMapSet(devices, name, NULL)); +} + +void DeviceFree (Device *this) { + if (this == NULL) return; + XtDestroyWidget(this->widget); + XtFree((char *)(this->name)); + XtFree((char *)(this->mountPoint)); + XtFree((char *)(this->label)); + XtFree((char *)(this)); +} + +void DeviceSetKind (Device *this, DeviceKind kind) { + XtVaSetValues ( + this->widget, + XmNlargeIconPixmap, iconsLarge[kind], + XmNsmallIconPixmap, iconsSmall[kind], + NULL); + this->kind = kind; +} + +void DeviceSetMountPoint (Device *this, ConstString mountPoint) { + XtFree(this->mountPoint); + this->mountPoint = XtNewString(mountPoint); +} + +void DeviceSetLabel (Device *this, ConstString label) { + XtFree(this->label); + this->label = XtNewString(label); + + XmString string = NULL; + if (label == NULL) { + string = XmStringCreateLocalized(this->name); + } else { + string = XmStringCreateLocalized(this->label); + } + XtVaSetValues ( + this->widget, + XmNlabelString, string, + NULL); + XmStringFree(string); +}