generate pkgconfig file (don't commit yet i fucked it up)
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
IoI_xD 2026-07-15 17:32:53 -07:00
commit c705d2b98c
375 changed files with 203503 additions and 203476 deletions

4
tools/.gitignore vendored
View file

@ -1,2 +1,2 @@
font
fuzzer
font
fuzzer

View file

@ -1,24 +1,24 @@
CC = gcc
CFLAGS = `pkg-config --cflags freetype2` -I../include
LDFLAGS =
LIBS = `pkg-config --libs freetype2`
.PHONY: all clean
.SUFFIXES: .c .o
all: fuzzer font icon-converter icon-converter
fuzzer: fuzzer.o
$(CC) -g -L../src/ -Wl,-R../src -o $@ fuzzer.o -lMw
font: font.o
$(CC) $(LDFLAGS) -o $@ font.o $(LIBS)
icon-converter: icon-converter.o
$(CC) -o $@ icon-converter.o -lm
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o font fuzzer icon-converter
CC = gcc
CFLAGS = `pkg-config --cflags freetype2` -I../include
LDFLAGS =
LIBS = `pkg-config --libs freetype2`
.PHONY: all clean
.SUFFIXES: .c .o
all: fuzzer font icon-converter icon-converter
fuzzer: fuzzer.o
$(CC) -g -L../src/ -Wl,-R../src -o $@ fuzzer.o -lMw
font: font.o
$(CC) $(LDFLAGS) -o $@ font.o $(LIBS)
icon-converter: icon-converter.o
$(CC) -o $@ icon-converter.o -lm
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o font fuzzer icon-converter

View file

@ -1,20 +1,20 @@
#!/bin/sh
MAKE=make
if which gmake >/dev/null 2>&1; then
MAKE=gmake
fi
VERSION=`cat include/Mw/Version.h | grep -E 'MwVERSION' | grep -oE '"[^"]+"' | sed 's/"//g'`
$MAKE clean
OLD=`pwd`
rm -rf /tmp/milsko-$VERSION *.tar.gz
mkdir -p /tmp/milsko-$VERSION
cp -rf * /tmp/milsko-$VERSION/
cd /tmp
tar czvf /tmp/milsko-$VERSION.tar.gz milsko-$VERSION
rm -rf /tmp/milsko-$VERSION
mv /tmp/milsko-$VERSION.tar.gz $OLD/
#!/bin/sh
MAKE=make
if which gmake >/dev/null 2>&1; then
MAKE=gmake
fi
VERSION=`cat include/Mw/Version.h | grep -E 'MwVERSION' | grep -oE '"[^"]+"' | sed 's/"//g'`
$MAKE clean
OLD=`pwd`
rm -rf /tmp/milsko-$VERSION *.tar.gz
mkdir -p /tmp/milsko-$VERSION
cp -rf * /tmp/milsko-$VERSION/
cd /tmp
tar czvf /tmp/milsko-$VERSION.tar.gz milsko-$VERSION
rm -rf /tmp/milsko-$VERSION
mv /tmp/milsko-$VERSION.tar.gz $OLD/

View file

@ -1,48 +1,48 @@
#!/usr/bin/env perl
open(IN, "<", "resource/rgb.txt");
open(OUT, ">", "src/color.c");
print(OUT "#include <Mw/Milsko.h>\n");
print(OUT "\n");
print(OUT "#include \"../external/stb_ds.h\"\n");
print(OUT "\n");
print(OUT "struct color {\n");
print(OUT " char* key;\n");
print(OUT " MwU32 value;\n");
print(OUT "};\n");
print(OUT "\n");
print(OUT "static struct color* colors = NULL;\n");
print(OUT "\n");
print(OUT "MwLLColor MwParseColorName(MwWidget handle, const char* color){\n");
print(OUT " MwRGB rgb;\n");
print(OUT " MwParseColorNameNoAllocate(color, &rgb);\n");
print(OUT
" return MwLLAllocColor(handle->lowlevel, rgb.red, rgb.green, rgb.blue);\n"
);
print(OUT "}\n");
print(OUT "\n");
print(OUT "void MwParseColorNameNoAllocate(const char* color, MwRGB* rgb){\n");
print(OUT " MwU32 v = shget(colors, color);");
print(OUT " rgb->red = (v >> 16) & 0xff;");
print(OUT " rgb->green = (v >> 8) & 0xff;");
print(OUT " rgb->blue = (v >> 0) & 0xff;");
print(OUT "}\n");
print(OUT "\n");
print(OUT "static void add_color(const char* name, int red, int green, int blue){\n");
print(OUT " MwU32 v = (red << 16) | (green << 8) | (blue << 0);\n");
print(OUT " shput(colors, name, v);\n");
print(OUT "}\n");
print(OUT "\n");
print(OUT "void MwColorTableInit(void){\n");
print(OUT " sh_new_strdup(colors);\n");
print(OUT " shdefault(colors, 0);\n");
while (my $l = <IN>) {
$l =~ s/\r?\n$//;
if ($l =~ /^[ \t]*([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+(.+)$/) {
print(OUT " add_color(\"$4\", $1, $2, $3);\n");
}
}
print(OUT "}\n");
close(OUT);
close(IN);
#!/usr/bin/env perl
open(IN, "<", "resource/rgb.txt");
open(OUT, ">", "src/color.c");
print(OUT "#include <Mw/Milsko.h>\n");
print(OUT "\n");
print(OUT "#include \"../external/stb_ds.h\"\n");
print(OUT "\n");
print(OUT "struct color {\n");
print(OUT " char* key;\n");
print(OUT " MwU32 value;\n");
print(OUT "};\n");
print(OUT "\n");
print(OUT "static struct color* colors = NULL;\n");
print(OUT "\n");
print(OUT "MwLLColor MwParseColorName(MwWidget handle, const char* color){\n");
print(OUT " MwRGB rgb;\n");
print(OUT " MwParseColorNameNoAllocate(color, &rgb);\n");
print(OUT
" return MwLLAllocColor(handle->lowlevel, rgb.red, rgb.green, rgb.blue);\n"
);
print(OUT "}\n");
print(OUT "\n");
print(OUT "void MwParseColorNameNoAllocate(const char* color, MwRGB* rgb){\n");
print(OUT " MwU32 v = shget(colors, color);");
print(OUT " rgb->red = (v >> 16) & 0xff;");
print(OUT " rgb->green = (v >> 8) & 0xff;");
print(OUT " rgb->blue = (v >> 0) & 0xff;");
print(OUT "}\n");
print(OUT "\n");
print(OUT "static void add_color(const char* name, int red, int green, int blue){\n");
print(OUT " MwU32 v = (red << 16) | (green << 8) | (blue << 0);\n");
print(OUT " shput(colors, name, v);\n");
print(OUT "}\n");
print(OUT "\n");
print(OUT "void MwColorTableInit(void){\n");
print(OUT " sh_new_strdup(colors);\n");
print(OUT " shdefault(colors, 0);\n");
while (my $l = <IN>) {
$l =~ s/\r?\n$//;
if ($l =~ /^[ \t]*([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+(.+)$/) {
print(OUT " add_color(\"$4\", $1, $2, $3);\n");
}
}
print(OUT "}\n");
close(OUT);
close(IN);

View file

@ -1,136 +1,136 @@
#!/usr/bin/env perl
my $font = $ARGV[0];
my $name = $ARGV[1];
my $out = $ARGV[2];
my $char = "";
my $bmp = 0;
my $w = 0;
my $h = 0;
my $ln = 0;
my $com = 0;
my $nocom = 0;
my $MAX = 16;
if ($name) {
print("#include <Mw/Milsko.h>\n");
print("\n");
}
open(IN, "<", $font) or die;
while (my $l = <IN>) {
$l =~ s/\r?\n$//g;
if (!$name && ($l =~ /^STARTCHAR ("?)(.+)\1$/)) {
if (!($2 =~ /_mask$/)) {
print("$2\n");
}
}
elsif ($name && ($l =~ /^COPYRIGHT ("?)(.+)\1$/)) {
if (!$com) {
print("/**\n");
}
else {
print(" *\n");
}
print(" * Copyright notice:\n");
print(" * $2\n");
if (!$com) {
print(" */\n");
}
}
elsif ($name && ($l =~ /^COMMENT ("?)(.+)\1$/)) {
if (!$nocom) {
if (!$com) {
$com = 1;
print("/**\n");
}
print(" * $2\n");
}
}
elsif ($name && ($l =~ /^ENDPROPERTIES$/)) {
if ($com) {
print(" */\n");
$com = 0;
$nocom = 1;
}
}
elsif (
$name
&& ( ($l =~ /^STARTCHAR ("?)\Q$name\E\1$/)
|| ($l =~ /^STARTCHAR ("?)\Q${name}\E_(mask)\1$/))
)
{
my $suffix = "";
if ($2) {
$suffix = "Mask";
}
$char = $name;
print("MwCursor MwCursor$out$suffix = {\n");
}
elsif ($name
&& $char
&& ($l =~ /^BBX (\-?[0-9]+) (\-?[0-9]+) (\-?[0-9]+) (\-?[0-9]+)$/))
{
print(" $1, $2, $3, $4,\n");
$w = $1 + 0;
$h = $2 + 0;
}
elsif ($name && $char && ($l =~ /^BITMAP$/)) {
print(" {\n");
$bmp = 1;
$ln = 0;
}
elsif ($name && $char && ($l =~ /^ENDCHAR$/)) {
$bmp = 0;
$char = "";
for (my $i = 0 ; $i < ($MAX - $h) ; $i++) {
if ($i == ($MAX - $h - 1)) {
print(" 0\n");
}
else {
print(" 0,\n");
}
}
print(" }\n");
print("};\n");
}
elsif ($bmp) {
my $txt = "";
my $c = 0;
my $n = 0;
my $incr = 0;
my $num = 0;
while ($c < $w) {
if (($c % 8) == 0) {
$n = hex("0x" . substr($l, $incr, 2));
$incr += 2;
}
$num = $num << 1;
if ($n & (1 << 7)) {
$num = $num | 1;
$txt = $txt . "#";
}
else {
$num = $num | 0;
$txt = $txt . ".";
}
$n = $n << 1;
$c = $c + 1;
}
$ln = $ln + 1;
if ($ln == $MAX) {
print(" $num /* $txt */\n");
}
else {
print(" $num, /* $txt */\n");
}
}
}
close(IN);
#!/usr/bin/env perl
my $font = $ARGV[0];
my $name = $ARGV[1];
my $out = $ARGV[2];
my $char = "";
my $bmp = 0;
my $w = 0;
my $h = 0;
my $ln = 0;
my $com = 0;
my $nocom = 0;
my $MAX = 16;
if ($name) {
print("#include <Mw/Milsko.h>\n");
print("\n");
}
open(IN, "<", $font) or die;
while (my $l = <IN>) {
$l =~ s/\r?\n$//g;
if (!$name && ($l =~ /^STARTCHAR ("?)(.+)\1$/)) {
if (!($2 =~ /_mask$/)) {
print("$2\n");
}
}
elsif ($name && ($l =~ /^COPYRIGHT ("?)(.+)\1$/)) {
if (!$com) {
print("/**\n");
}
else {
print(" *\n");
}
print(" * Copyright notice:\n");
print(" * $2\n");
if (!$com) {
print(" */\n");
}
}
elsif ($name && ($l =~ /^COMMENT ("?)(.+)\1$/)) {
if (!$nocom) {
if (!$com) {
$com = 1;
print("/**\n");
}
print(" * $2\n");
}
}
elsif ($name && ($l =~ /^ENDPROPERTIES$/)) {
if ($com) {
print(" */\n");
$com = 0;
$nocom = 1;
}
}
elsif (
$name
&& ( ($l =~ /^STARTCHAR ("?)\Q$name\E\1$/)
|| ($l =~ /^STARTCHAR ("?)\Q${name}\E_(mask)\1$/))
)
{
my $suffix = "";
if ($2) {
$suffix = "Mask";
}
$char = $name;
print("MwCursor MwCursor$out$suffix = {\n");
}
elsif ($name
&& $char
&& ($l =~ /^BBX (\-?[0-9]+) (\-?[0-9]+) (\-?[0-9]+) (\-?[0-9]+)$/))
{
print(" $1, $2, $3, $4,\n");
$w = $1 + 0;
$h = $2 + 0;
}
elsif ($name && $char && ($l =~ /^BITMAP$/)) {
print(" {\n");
$bmp = 1;
$ln = 0;
}
elsif ($name && $char && ($l =~ /^ENDCHAR$/)) {
$bmp = 0;
$char = "";
for (my $i = 0 ; $i < ($MAX - $h) ; $i++) {
if ($i == ($MAX - $h - 1)) {
print(" 0\n");
}
else {
print(" 0,\n");
}
}
print(" }\n");
print("};\n");
}
elsif ($bmp) {
my $txt = "";
my $c = 0;
my $n = 0;
my $incr = 0;
my $num = 0;
while ($c < $w) {
if (($c % 8) == 0) {
$n = hex("0x" . substr($l, $incr, 2));
$incr += 2;
}
$num = $num << 1;
if ($n & (1 << 7)) {
$num = $num | 1;
$txt = $txt . "#";
}
else {
$num = $num | 0;
$txt = $txt . ".";
}
$n = $n << 1;
$c = $c + 1;
}
$ln = $ln + 1;
if ($ln == $MAX) {
print(" $num /* $txt */\n");
}
else {
print(" $num, /* $txt */\n");
}
}
}
close(IN);

View file

@ -1,4 +1,4 @@
#!/bin/sh
doxygen
rm -rf /var/www/milsko-doxygen
cp -rf doxygen/html /var/www/milsko-doxygen
#!/bin/sh
doxygen
rm -rf /var/www/milsko-doxygen
cp -rf doxygen/html /var/www/milsko-doxygen

View file

@ -1,70 +1,70 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
#include FT_BDF_H
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
FT_Library lib;
FT_Face face;
int i;
int ay = 0;
int ax = 0;
int sy = 0;
int sx = 0;
BDF_PropertyRec rec;
FT_Init_FreeType(&lib);
if(FT_New_Face(lib, argv[1], 0, &face)) {
fprintf(stderr, "bad 1\n");
return 1;
}
if(FT_Set_Pixel_Sizes(face, 0, atoi(argv[2]))) {
fprintf(stderr, "bad 2\n");
return 1;
}
FT_Get_BDF_Property(face, "COPYRIGHT", &rec);
printf("#include <Mw/Milsko.h>\n");
printf("\n");
printf("/**\n");
printf(" * Copyright notice:\n");
printf(" * \"%s\"\n", rec.u.atom);
printf(" */\n");
printf("MwFont MwFontData[] = {\n");
for(i = 0; i < 0x100; i++) {
int y, x;
FT_Bitmap bitmap;
unsigned char n;
if(FT_Load_Char(face, i, FT_LOAD_RENDER | FT_LOAD_COLOR)) {
continue;
}
FT_Bitmap_Init(&bitmap);
FT_Bitmap_Convert(lib, &face->glyph->bitmap, &bitmap, 1);
printf("\t{%d, %d, {", face->glyph->bitmap_left, face->glyph->bitmap_top);
for(y = 0; y < atoi(argv[2]) - bitmap.rows; y++) {
printf("0%s", y == atoi(argv[2]) - 1 ? "" : ", ");
}
for(y = 0; y < bitmap.rows; y++) {
n = 0;
for(x = 0; x < bitmap.width; x++) {
unsigned char b = bitmap.buffer[bitmap.width * y + x] ? 1 : 0;
n = n << 1;
n = n | b;
}
printf("%d%s", n, y == (bitmap.rows - 1) ? "" : ", ");
}
printf("}}%s /* %d */\n", i == (0x100 - 1) ? "" : ", ", i);
FT_Bitmap_Done(lib, &bitmap);
sx += face->glyph->advance.x >> 6;
}
printf("};\n");
}
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
#include FT_BDF_H
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
FT_Library lib;
FT_Face face;
int i;
int ay = 0;
int ax = 0;
int sy = 0;
int sx = 0;
BDF_PropertyRec rec;
FT_Init_FreeType(&lib);
if(FT_New_Face(lib, argv[1], 0, &face)) {
fprintf(stderr, "bad 1\n");
return 1;
}
if(FT_Set_Pixel_Sizes(face, 0, atoi(argv[2]))) {
fprintf(stderr, "bad 2\n");
return 1;
}
FT_Get_BDF_Property(face, "COPYRIGHT", &rec);
printf("#include <Mw/Milsko.h>\n");
printf("\n");
printf("/**\n");
printf(" * Copyright notice:\n");
printf(" * \"%s\"\n", rec.u.atom);
printf(" */\n");
printf("MwFont MwFontData[] = {\n");
for(i = 0; i < 0x100; i++) {
int y, x;
FT_Bitmap bitmap;
unsigned char n;
if(FT_Load_Char(face, i, FT_LOAD_RENDER | FT_LOAD_COLOR)) {
continue;
}
FT_Bitmap_Init(&bitmap);
FT_Bitmap_Convert(lib, &face->glyph->bitmap, &bitmap, 1);
printf("\t{%d, %d, {", face->glyph->bitmap_left, face->glyph->bitmap_top);
for(y = 0; y < atoi(argv[2]) - bitmap.rows; y++) {
printf("0%s", y == atoi(argv[2]) - 1 ? "" : ", ");
}
for(y = 0; y < bitmap.rows; y++) {
n = 0;
for(x = 0; x < bitmap.width; x++) {
unsigned char b = bitmap.buffer[bitmap.width * y + x] ? 1 : 0;
n = n << 1;
n = n | b;
}
printf("%d%s", n, y == (bitmap.rows - 1) ? "" : ", ");
}
printf("}}%s /* %d */\n", i == (0x100 - 1) ? "" : ", ", i);
FT_Bitmap_Done(lib, &bitmap);
sx += face->glyph->advance.x >> 6;
}
printf("};\n");
}

View file

@ -1,76 +1,76 @@
#include <Mw/Milsko.h>
#include <Mw/StringDefs.h>
#define WIDGET_AMOUNT 16
#define H(h) {&h, #h}
typedef struct cls_pair {
MwClass* cls;
const char* name;
} cls_pair_t;
cls_pair_t classes[] = {H(MwBoxClass), H(MwButtonClass), H(MwCheckBoxClass), H(MwComboBoxClass), H(MwEntryClass), H(MwFrameClass), H(MwImageClass), H(MwLabelClass), H(MwListBoxClass), H(MwMenuClass), H(MwNumberEntryClass), H(MwProgressBarClass), H(MwRadioBoxClass), H(MwScrollBarClass), H(MwSeparatorClass), H(MwTreeViewClass), H(MwViewportClass)};
char* int_params[] = {/*MwNx, MwNy, MwNwidth, MwNheight,*/ MwNorientation, MwNminValue, MwNmaxValue, MwNvalue, MwNchangedBy, MwNareaShown, MwNchecked, MwNalignment, MwNbold, MwNmain, MwNleftPadding, MwNhasHeading, MwNhasBorder, MwNinverted, MwNmodernLook, MwNwaitMS, MwNhideInput, MwNsingleClickSelectable, MwNflat, MwNshowArrows, MwNpadding, MwNborderWidth, MwNfillArea, MwNratio, MwNfixedSize, MwNmargin, MwNbitmapFont, MwNsevenSegment, MwNlength, MwNforceInverted, MwNisRounded, MwNdarkTheme};
unsigned long maxxes[] = {UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX};
int main() {
int i, j = 0, max = 0;
char input;
MwWidget window, widget;
unsigned long upper_limit;
printf("How many iteration do you want to do? Type -1 if you wanna run it forever.\n");
scanf("%d", &max);
printf("What upper limit of int params do you want to test?\n");
for(i = 0; i < (sizeof(maxxes) / sizeof(unsigned long)); i++) {
printf("%d) %lu\n", i, maxxes[i]);
}
get_input:
input = getchar();
switch(input) {
case '0':
upper_limit = maxxes[0];
break;
case '1':
upper_limit = maxxes[1];
break;
case '2':
upper_limit = maxxes[2];
break;
case '3':
upper_limit = maxxes[3];
break;
default:
upper_limit = maxxes[0];
// printf("Invalid value. Pick 0-3.\n");
// goto get_input;
}
MwLibraryInit();
window = MwCreateWidget(MwWindowClass, "window", NULL, 0, 0, 400, 400);
while(MwPending(window) && (max == -1 || j < max)) {
int class_num = rand() % (sizeof(classes) / sizeof(cls_pair_t));
widget = MwCreateWidget(*classes[class_num].cls, classes[class_num].name, window, 0, 0, 100, 100);
printf("%s\n", classes[class_num].name);
/* apply int params with random scale */
for(i = 0; i < (sizeof(int_params) / sizeof(void*)); i++) {
unsigned long number = rand() % upper_limit;
printf("> %s = %lu\n", int_params[i], number);
MwVaApply(widget, int_params[i], number, NULL);
}
MwStep(window);
MwDestroyWidget(widget);
printf("\n");
j++;
}
MwFreeWidget(window);
}
#include <Mw/Milsko.h>
#include <Mw/StringDefs.h>
#define WIDGET_AMOUNT 16
#define H(h) {&h, #h}
typedef struct cls_pair {
MwClass* cls;
const char* name;
} cls_pair_t;
cls_pair_t classes[] = {H(MwBoxClass), H(MwButtonClass), H(MwCheckBoxClass), H(MwComboBoxClass), H(MwEntryClass), H(MwFrameClass), H(MwImageClass), H(MwLabelClass), H(MwListBoxClass), H(MwMenuClass), H(MwNumberEntryClass), H(MwProgressBarClass), H(MwRadioBoxClass), H(MwScrollBarClass), H(MwSeparatorClass), H(MwTreeViewClass), H(MwViewportClass)};
char* int_params[] = {/*MwNx, MwNy, MwNwidth, MwNheight,*/ MwNorientation, MwNminValue, MwNmaxValue, MwNvalue, MwNchangedBy, MwNareaShown, MwNchecked, MwNalignment, MwNbold, MwNmain, MwNleftPadding, MwNhasHeading, MwNhasBorder, MwNinverted, MwNmodernLook, MwNwaitMS, MwNhideInput, MwNsingleClickSelectable, MwNflat, MwNshowArrows, MwNpadding, MwNborderWidth, MwNfillArea, MwNratio, MwNfixedSize, MwNmargin, MwNbitmapFont, MwNsevenSegment, MwNlength, MwNforceInverted, MwNisRounded, MwNdarkTheme};
unsigned long maxxes[] = {UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX};
int main() {
int i, j = 0, max = 0;
char input;
MwWidget window, widget;
unsigned long upper_limit;
printf("How many iteration do you want to do? Type -1 if you wanna run it forever.\n");
scanf("%d", &max);
printf("What upper limit of int params do you want to test?\n");
for(i = 0; i < (sizeof(maxxes) / sizeof(unsigned long)); i++) {
printf("%d) %lu\n", i, maxxes[i]);
}
get_input:
input = getchar();
switch(input) {
case '0':
upper_limit = maxxes[0];
break;
case '1':
upper_limit = maxxes[1];
break;
case '2':
upper_limit = maxxes[2];
break;
case '3':
upper_limit = maxxes[3];
break;
default:
upper_limit = maxxes[0];
// printf("Invalid value. Pick 0-3.\n");
// goto get_input;
}
MwLibraryInit();
window = MwCreateWidget(MwWindowClass, "window", NULL, 0, 0, 400, 400);
while(MwPending(window) && (max == -1 || j < max)) {
int class_num = rand() % (sizeof(classes) / sizeof(cls_pair_t));
widget = MwCreateWidget(*classes[class_num].cls, classes[class_num].name, window, 0, 0, 100, 100);
printf("%s\n", classes[class_num].name);
/* apply int params with random scale */
for(i = 0; i < (sizeof(int_params) / sizeof(void*)); i++) {
unsigned long number = rand() % upper_limit;
printf("> %s = %lu\n", int_params[i], number);
MwVaApply(widget, int_params[i], number, NULL);
}
MwStep(window);
MwDestroyWidget(widget);
printf("\n");
j++;
}
MwFreeWidget(window);
}

View file

@ -1,105 +1,105 @@
#!/usr/bin/env perl
our $clean = 0;
my @objs = ();
sub compile {
my ($source) = @_;
my $object = "";
my $dir = "";
$dir = $source;
$dir =~ s/\/([^\/]+)$//;
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT "\$ if f\$search(\"$object;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"CC $object\"\n");
print(OUT
"\$ cc /include_directory=(\"./include\",\"./$dir\") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=$object $source\n"
);
print(OUT "\$ endif\n");
push(@objs, $object);
}
sub clean {
my ($source) = @_;
my $object = "";
my $dir = "";
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT
"\$ if f\$search(\"$object\") .nes. \"\" then delete $object;*\n");
}
sub thing {
if ($clean) {
clean($_[0]);
}
else {
compile($_[0]);
}
}
sub scan {
my ($dir) = @_;
opendir(my $dh, $dir);
while (my $file = readdir($dh)) {
if ( !(($dir . "/" . $file) eq "src/widget/opengl.c")
&& !(($dir . "/" . $file) eq "src/widget/vulkan.c")
&& !(($dir . "/" . $file) eq "external/stb_truetype.c")
&& !(($dir . "/" . $file) eq "external/stb_image.c")
&& ($file =~ /\.c$/))
{
thing($dir . "/" . $file);
}
}
closedir($dh);
}
for (my $i = 0 ; $i < 2 ; $i++) {
$clean = $i;
open(OUT, ">", $i == 0 ? "vms/build.com" : "vms/clean.com");
scan("src");
scan("src/cursor");
scan("src/widget");
scan("src/dialog");
scan("src/font");
scan("src/icon");
scan("src/abstract");
scan("external");
thing("src/backend/x11.c");
if ($i == 0) {
print(OUT "\$ if f\$search(\"[.src]MwSHR.exe;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"LINK [.src]MwSHR.exe\"\n");
print(OUT "\$ OPEN /WRITE LINK_OPT LINK.OPT\n");
foreach my $obj (@objs) {
print(OUT "\$ WRITE LINK_OPT \"$obj\"\n");
}
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DECW\$XLIBSHR/SHARE\"\n");
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DPML\$SHR/SHARE\"\n");
print(OUT "\$ CLOSE LINK_OPT\n");
print(OUT "\$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options\n");
print(OUT "\$ DELETE LINK.OPT;*\n");
print(OUT "\$ endif\n");
}
else {
clean("src/MwSHR.exe");
}
close(OUT);
}
#!/usr/bin/env perl
our $clean = 0;
my @objs = ();
sub compile {
my ($source) = @_;
my $object = "";
my $dir = "";
$dir = $source;
$dir =~ s/\/([^\/]+)$//;
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT "\$ if f\$search(\"$object;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"CC $object\"\n");
print(OUT
"\$ cc /include_directory=(\"./include\",\"./$dir\") /define=(_MILSKO,USE_X11,NO_IMAGE) /object=$object $source\n"
);
print(OUT "\$ endif\n");
push(@objs, $object);
}
sub clean {
my ($source) = @_;
my $object = "";
my $dir = "";
$source =~ s/^(.+)\/([^\/]+)$/[\/\1]\2/;
$source =~ s/\//\./g;
$object = $source;
$object =~ s/\.c$/.obj/;
print(OUT
"\$ if f\$search(\"$object\") .nes. \"\" then delete $object;*\n");
}
sub thing {
if ($clean) {
clean($_[0]);
}
else {
compile($_[0]);
}
}
sub scan {
my ($dir) = @_;
opendir(my $dh, $dir);
while (my $file = readdir($dh)) {
if ( !(($dir . "/" . $file) eq "src/widget/opengl.c")
&& !(($dir . "/" . $file) eq "src/widget/vulkan.c")
&& !(($dir . "/" . $file) eq "external/stb_truetype.c")
&& !(($dir . "/" . $file) eq "external/stb_image.c")
&& ($file =~ /\.c$/))
{
thing($dir . "/" . $file);
}
}
closedir($dh);
}
for (my $i = 0 ; $i < 2 ; $i++) {
$clean = $i;
open(OUT, ">", $i == 0 ? "vms/build.com" : "vms/clean.com");
scan("src");
scan("src/cursor");
scan("src/widget");
scan("src/dialog");
scan("src/font");
scan("src/icon");
scan("src/abstract");
scan("external");
thing("src/backend/x11.c");
if ($i == 0) {
print(OUT "\$ if f\$search(\"[.src]MwSHR.exe;*\") .eqs. \"\"\n");
print(OUT "\$ then\n");
print(OUT "\$ write sys\$output \"LINK [.src]MwSHR.exe\"\n");
print(OUT "\$ OPEN /WRITE LINK_OPT LINK.OPT\n");
foreach my $obj (@objs) {
print(OUT "\$ WRITE LINK_OPT \"$obj\"\n");
}
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DECW\$XLIBSHR/SHARE\"\n");
print(OUT "\$ WRITE LINK_OPT \"SYS\$LIBRARY:DPML\$SHR/SHARE\"\n");
print(OUT "\$ CLOSE LINK_OPT\n");
print(OUT "\$ link /SHAREABLE=[.src]MwSHR.exe LINK.OPT/options\n");
print(OUT "\$ DELETE LINK.OPT;*\n");
print(OUT "\$ endif\n");
}
else {
clean("src/MwSHR.exe");
}
close(OUT);
}

View file

@ -1,235 +1,235 @@
#!/usr/bin/env perl
my @cfiles = ();
my @examples = ();
sub scan {
opendir(DIR, $_[0]);
my @files = readdir(DIR);
foreach my $f (@files) {
if ($f =~ /^vulkan\.c$/) {
next;
}
if ($f =~ /\.c$/) {
push(@cfiles, $_[0] . "/" . $f);
}
}
closedir(DIR);
}
sub scan_examples {
opendir(DIR, $_[0]);
my @files = readdir(DIR);
foreach my $f (@files) {
if ($f =~ /^glutlayer\.c$/) {
next;
}
if ($f =~ /\.c$/) {
push(@examples, $_[0] . "/" . $f);
}
}
closedir(DIR);
}
sub cobjs {
my $r = "";
foreach my $f (@cfiles) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$_[0]/g;
$r = $r . " " . $_[1] . $b;
}
return $r;
}
sub generate {
my ($output, $type) = @_;
my $cc = "";
my $link = "";
my $suffix = 1;
my $symbolic = "";
my $dir = "\\";
my $del = "del /f /q";
my $out = "";
my $dllout = "";
my $exeout = "";
my $def = "";
my $inc = "";
my $cdll = "";
my $dll = "";
my $exe = "";
my $prefobj = "";
my $needlibs = "";
my $lib = "";
my $c_dllout = "";
my $c_dllafter = "";
if ($type eq "Borland") {
$cc = "bcc32 -c";
$link = "bcc32";
$out = "-o";
$dllout = "-e";
$exeout = "-e";
$def = "-D";
$inc = "-I";
$dll = "-tWD";
$lib = "-l";
$c_dllafter = "implib src${dir}Mw.lib src${dir}Mw.dll";
}
elsif ($type eq "MSVC") {
$cc = "cl /TC /c /nologo";
$link = "link /nologo";
$out = "/Fo";
$dllout = "/OUT:";
$exeout = "/OUT:";
$def = "/D";
$inc = "/I";
$dll = "/DLL";
}
elsif ($type eq "Watcom") {
$cc = "wcc386 -bt=nt -q";
$link = "wlink option quiet";
$out = "-fo=";
$dllout = "name ";
$exeout = "name ";
$def = "-d";
$inc = "-i=";
$cdll = "-bd";
$dll = "system nt_dll";
$exe = "system nt";
$lib = "library ";
$suffix = 0; # watcom suffix rule works kinda strange
$symbolic = ".SYMBOLIC";
$dir = "/";
$del = "%erase";
$prefobj = "file ";
$needlibs = "${lib}clib3r.lib";
$c_dllout = "option implib=src${dir}Mw.lib";
}
open(OUT, ">", $output);
print(OUT "CC = $cc\n");
print(OUT "LD = $link\n");
print(OUT "\n");
print(OUT
"MW_CFLAGS = ${cdll} ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}_MILSKO_BUILD ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
);
print(OUT "MW_LDFLAGS = $dll\n");
print(OUT "EXE_CFLAGS = ${inc}include\n");
print(OUT "EXE_LDFLAGS = $exe");
print(OUT "\n");
if ($suffix) {
print(OUT ".SUFFIXES: .obj .c\n");
}
print(OUT "all: src${dir}Mw.dll");
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $b");
}
print(OUT "\n");
print(OUT "lib: src${dir}Mw.dll\n");
print(OUT "examples:");
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $b");
}
print(OUT "\n");
print(OUT "clean: $symbolic\n");
foreach my $f (@cfiles) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
print(OUT " $del src${dir}Mw.dll\n");
print(OUT " $del src${dir}Mw.lib\n");
foreach my $f (@examples) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
print(OUT "\n");
foreach my $f (@examples) {
my $b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
my $o = $f;
$o =~ s/\.c$/.obj/;
$o =~ s/\//$dir/g;
print(OUT "$b: $o src${dir}Mw.dll\n");
print(OUT
" \$(LD) \$(EXE_LDFLAGS) $exeout\$@ $prefobj$o $needlibs ${lib}src${dir}Mw.lib"
);
if ($f =~ /gldemos/) {
print(OUT " ${lib}opengl32.lib ${lib}glu32.lib");
}
print(OUT "\n");
print(OUT "\n");
print(OUT "$o: $f\n");
print(OUT " \$(CC) \$(EXE_CFLAGS) ${out}\$@ $f\n");
print(OUT "\n");
}
print(OUT "\n");
print(OUT "src${dir}Mw.dll: " . cobjs($dir) . "\n");
print( OUT " \$(LD) \$(MW_LDFLAGS) $c_dllout $dllout\$@ "
. cobjs($dir, $prefobj)
. " $needlibs ${lib}opengl32.lib ${lib}gdi32.lib ${lib}user32.lib ${lib}advapi32.lib\n"
);
print(OUT " $c_dllafter\n");
print(OUT "\n");
if ($suffix) {
print(OUT ".c.obj:\n");
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ \$<\n");
}
else {
print(OUT "\n");
foreach my $f (@cfiles) {
my $o = $f;
$o =~ s/\.c$/.obj/;
print(OUT "$o: $f\n");
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ $f\n");
}
}
close(OUT);
}
scan("src");
scan("external");
scan("external/libz/src");
scan("src/icon");
scan("src/cursor");
scan("src/widget");
scan("src/text");
scan("src/text/font");
scan("src/dialog");
scan("src/abstract");
push(@cfiles, "src/backend/gdi.c");
@cfiles = sort(@cfiles);
scan_examples("examples/basic");
scan_examples("examples/gldemos");
@examples = sort(@examples);
generate("BorMakefile", "Borland");
generate("NTMakefile", "MSVC");
generate("WatMakefile", "Watcom");
#!/usr/bin/env perl
my @cfiles = ();
my @examples = ();
sub scan {
opendir(DIR, $_[0]);
my @files = readdir(DIR);
foreach my $f (@files) {
if ($f =~ /^vulkan\.c$/) {
next;
}
if ($f =~ /\.c$/) {
push(@cfiles, $_[0] . "/" . $f);
}
}
closedir(DIR);
}
sub scan_examples {
opendir(DIR, $_[0]);
my @files = readdir(DIR);
foreach my $f (@files) {
if ($f =~ /^glutlayer\.c$/) {
next;
}
if ($f =~ /\.c$/) {
push(@examples, $_[0] . "/" . $f);
}
}
closedir(DIR);
}
sub cobjs {
my $r = "";
foreach my $f (@cfiles) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$_[0]/g;
$r = $r . " " . $_[1] . $b;
}
return $r;
}
sub generate {
my ($output, $type) = @_;
my $cc = "";
my $link = "";
my $suffix = 1;
my $symbolic = "";
my $dir = "\\";
my $del = "del /f /q";
my $out = "";
my $dllout = "";
my $exeout = "";
my $def = "";
my $inc = "";
my $cdll = "";
my $dll = "";
my $exe = "";
my $prefobj = "";
my $needlibs = "";
my $lib = "";
my $c_dllout = "";
my $c_dllafter = "";
if ($type eq "Borland") {
$cc = "bcc32 -c";
$link = "bcc32";
$out = "-o";
$dllout = "-e";
$exeout = "-e";
$def = "-D";
$inc = "-I";
$dll = "-tWD";
$lib = "-l";
$c_dllafter = "implib src${dir}Mw.lib src${dir}Mw.dll";
}
elsif ($type eq "MSVC") {
$cc = "cl /TC /c /nologo";
$link = "link /nologo";
$out = "/Fo";
$dllout = "/OUT:";
$exeout = "/OUT:";
$def = "/D";
$inc = "/I";
$dll = "/DLL";
}
elsif ($type eq "Watcom") {
$cc = "wcc386 -bt=nt -q";
$link = "wlink option quiet";
$out = "-fo=";
$dllout = "name ";
$exeout = "name ";
$def = "-d";
$inc = "-i=";
$cdll = "-bd";
$dll = "system nt_dll";
$exe = "system nt";
$lib = "library ";
$suffix = 0; # watcom suffix rule works kinda strange
$symbolic = ".SYMBOLIC";
$dir = "/";
$del = "%erase";
$prefobj = "file ";
$needlibs = "${lib}clib3r.lib";
$c_dllout = "option implib=src${dir}Mw.lib";
}
open(OUT, ">", $output);
print(OUT "CC = $cc\n");
print(OUT "LD = $link\n");
print(OUT "\n");
print(OUT
"MW_CFLAGS = ${cdll} ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}_MILSKO_BUILD ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
);
print(OUT "MW_LDFLAGS = $dll\n");
print(OUT "EXE_CFLAGS = ${inc}include\n");
print(OUT "EXE_LDFLAGS = $exe");
print(OUT "\n");
if ($suffix) {
print(OUT ".SUFFIXES: .obj .c\n");
}
print(OUT "all: src${dir}Mw.dll");
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $b");
}
print(OUT "\n");
print(OUT "lib: src${dir}Mw.dll\n");
print(OUT "examples:");
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $b");
}
print(OUT "\n");
print(OUT "clean: $symbolic\n");
foreach my $f (@cfiles) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
print(OUT " $del src${dir}Mw.dll\n");
print(OUT " $del src${dir}Mw.lib\n");
foreach my $f (@examples) {
my $b = $f;
$b =~ s/\.c$/.obj/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
foreach my $f (@examples) {
$b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
print(OUT " $del $b\n");
}
print(OUT "\n");
foreach my $f (@examples) {
my $b = $f;
$b =~ s/\.c$/.exe/;
$b =~ s/\//$dir/g;
my $o = $f;
$o =~ s/\.c$/.obj/;
$o =~ s/\//$dir/g;
print(OUT "$b: $o src${dir}Mw.dll\n");
print(OUT
" \$(LD) \$(EXE_LDFLAGS) $exeout\$@ $prefobj$o $needlibs ${lib}src${dir}Mw.lib"
);
if ($f =~ /gldemos/) {
print(OUT " ${lib}opengl32.lib ${lib}glu32.lib");
}
print(OUT "\n");
print(OUT "\n");
print(OUT "$o: $f\n");
print(OUT " \$(CC) \$(EXE_CFLAGS) ${out}\$@ $f\n");
print(OUT "\n");
}
print(OUT "\n");
print(OUT "src${dir}Mw.dll: " . cobjs($dir) . "\n");
print( OUT " \$(LD) \$(MW_LDFLAGS) $c_dllout $dllout\$@ "
. cobjs($dir, $prefobj)
. " $needlibs ${lib}opengl32.lib ${lib}gdi32.lib ${lib}user32.lib ${lib}advapi32.lib\n"
);
print(OUT " $c_dllafter\n");
print(OUT "\n");
if ($suffix) {
print(OUT ".c.obj:\n");
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ \$<\n");
}
else {
print(OUT "\n");
foreach my $f (@cfiles) {
my $o = $f;
$o =~ s/\.c$/.obj/;
print(OUT "$o: $f\n");
print(OUT " \$(CC) \$(MW_CFLAGS) ${out}\$@ $f\n");
}
}
close(OUT);
}
scan("src");
scan("external");
scan("external/libz/src");
scan("src/icon");
scan("src/cursor");
scan("src/widget");
scan("src/text");
scan("src/text/font");
scan("src/dialog");
scan("src/abstract");
push(@cfiles, "src/backend/gdi.c");
@cfiles = sort(@cfiles);
scan_examples("examples/basic");
scan_examples("examples/gldemos");
@examples = sort(@examples);
generate("BorMakefile", "Borland");
generate("NTMakefile", "MSVC");
generate("WatMakefile", "Watcom");

View file

@ -1,12 +1,12 @@
#!/usr/bin/env perl
open(IN, "<", "resource/harvard.txt");
print("const char* harvard[] = {\n");
while (my $l = <IN>) {
$l =~ s/\r?\n$//;
if ($l =~ /^[ \t]*[0-9]+\. (.+)$/) {
print(" \"" . $1 . "\",\n");
}
}
print(" NULL\n");
print("};\n");
close(IN);
#!/usr/bin/env perl
open(IN, "<", "resource/harvard.txt");
print("const char* harvard[] = {\n");
while (my $l = <IN>) {
$l =~ s/\r?\n$//;
if ($l =~ /^[ \t]*[0-9]+\. (.+)$/) {
print(" \"" . $1 . "\",\n");
}
}
print(" NULL\n");
print("};\n");
close(IN);

View file

@ -1,36 +1,36 @@
#define STB_IMAGE_IMPLEMENTATION
#include "../external/stb_image.h"
#include <stdio.h>
int main(int argc, char** argv) {
unsigned char* rgba;
int width, height, bpp;
int i;
if(argc != 3) {
printf("Usage: %s input name\n", argv[0]);
return 1;
}
rgba = stbi_load(argv[1], &width, &height, &bpp, 4);
printf("MwU32 %s[] = {\n", argv[2]);
printf(" (%d << 16) | %d,\n", width, height);
for(i = 0; i < width * height; i++) {
unsigned char* px = &rgba[i * 4];
unsigned int p = 0;
int j;
for(j = 0; j < 4; j++) {
p = p << 8;
p = p | px[j];
}
printf(" 0x%x,\n", p);
}
printf(" 0\n");
printf("};\n");
free(rgba);
}
#define STB_IMAGE_IMPLEMENTATION
#include "../external/stb_image.h"
#include <stdio.h>
int main(int argc, char** argv) {
unsigned char* rgba;
int width, height, bpp;
int i;
if(argc != 3) {
printf("Usage: %s input name\n", argv[0]);
return 1;
}
rgba = stbi_load(argv[1], &width, &height, &bpp, 4);
printf("MwU32 %s[] = {\n", argv[2]);
printf(" (%d << 16) | %d,\n", width, height);
for(i = 0; i < width * height; i++) {
unsigned char* px = &rgba[i * 4];
unsigned int p = 0;
int j;
for(j = 0; j < 4; j++) {
p = p << 8;
p = p | px[j];
}
printf(" 0x%x,\n", p);
}
printf(" 0\n");
printf("};\n");
free(rgba);
}

View file

@ -1,44 +1,44 @@
#!/bin/sh
echo '/*!' > include/Mw/Resource/Icon.h
echo ' * @file Mw/Resource/Icon.h' >> include/Mw/Resource/Icon.h
echo ' * @brief Icon' >> include/Mw/Resource/Icon.h
echo ' */' >> include/Mw/Resource/Icon.h
echo '#ifndef __MW_RESOURCE_ICON_H__' >> include/Mw/Resource/Icon.h
echo '#define __MW_RESOURCE_ICON_H__' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#include <Mw/MachDep.h>' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#ifdef __cplusplus' >> include/Mw/Resource/Icon.h
echo 'extern "C" {' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
for i in resource/icon/*.png; do
LOWER=`echo $i | rev | cut -d"/" -f1 | rev | cut -d"." -f1`
OUT=src/icon/$LOWER.c
NAME=`echo -n $LOWER | perl -e 'my $l = <>;$l =~ s/^(.)/uc($1)/e;print($l);'`
NAME=MwIcon$NAME
GEO=`convert $i json:- 2>/dev/null | jq -r '(.[0].image.geometry.width | tostring) + "x" + (.[0].image.geometry.height | tostring)'`
WIDTH=`echo $GEO | cut -dx -f1`
HEIGHT=`echo $GEO | cut -dx -f2`
echo '#include <Mw/Milsko.h>' > $OUT
echo >> $OUT
echo "MwU32 $NAME[] = {" >> $OUT
echo " ($WIDTH << 16) | $HEIGHT," >> $OUT
convert $i txt:- 2>/dev/null | grep -oE '#[0-9a-fA-F]{8}' | sed 's/^#/ 0x/' | sed -E 's/$/,/' >> $OUT
echo " 0" >> $OUT
echo "};" >> $OUT
echo $NAME
done | while read a; do
echo $a
echo '/*!' >> include/Mw/Resource/Icon.h
echo " * @brief `echo $a | sed s/MwIcon//` icon" >> include/Mw/Resource/Icon.h
echo ' */' >> include/Mw/Resource/Icon.h
echo "MWDECL MwU32 $a[];" >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
done
echo '' >> include/Mw/Resource/Icon.h
echo '#ifdef __cplusplus' >> include/Mw/Resource/Icon.h
echo '}' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h
#!/bin/sh
echo '/*!' > include/Mw/Resource/Icon.h
echo ' * @file Mw/Resource/Icon.h' >> include/Mw/Resource/Icon.h
echo ' * @brief Icon' >> include/Mw/Resource/Icon.h
echo ' */' >> include/Mw/Resource/Icon.h
echo '#ifndef __MW_RESOURCE_ICON_H__' >> include/Mw/Resource/Icon.h
echo '#define __MW_RESOURCE_ICON_H__' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#include <Mw/MachDep.h>' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#ifdef __cplusplus' >> include/Mw/Resource/Icon.h
echo 'extern "C" {' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
for i in resource/icon/*.png; do
LOWER=`echo $i | rev | cut -d"/" -f1 | rev | cut -d"." -f1`
OUT=src/icon/$LOWER.c
NAME=`echo -n $LOWER | perl -e 'my $l = <>;$l =~ s/^(.)/uc($1)/e;print($l);'`
NAME=MwIcon$NAME
GEO=`convert $i json:- 2>/dev/null | jq -r '(.[0].image.geometry.width | tostring) + "x" + (.[0].image.geometry.height | tostring)'`
WIDTH=`echo $GEO | cut -dx -f1`
HEIGHT=`echo $GEO | cut -dx -f2`
echo '#include <Mw/Milsko.h>' > $OUT
echo >> $OUT
echo "MwU32 $NAME[] = {" >> $OUT
echo " ($WIDTH << 16) | $HEIGHT," >> $OUT
convert $i txt:- 2>/dev/null | grep -oE '#[0-9a-fA-F]{8}' | sed 's/^#/ 0x/' | sed -E 's/$/,/' >> $OUT
echo " 0" >> $OUT
echo "};" >> $OUT
echo $NAME
done | while read a; do
echo $a
echo '/*!' >> include/Mw/Resource/Icon.h
echo " * @brief `echo $a | sed s/MwIcon//` icon" >> include/Mw/Resource/Icon.h
echo ' */' >> include/Mw/Resource/Icon.h
echo "MWDECL MwU32 $a[];" >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
done
echo '' >> include/Mw/Resource/Icon.h
echo '#ifdef __cplusplus' >> include/Mw/Resource/Icon.h
echo '}' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h
echo '' >> include/Mw/Resource/Icon.h
echo '#endif' >> include/Mw/Resource/Icon.h

View file

@ -1,9 +1,9 @@
#!/bin/sh
povray +A +W256 +H256 +Ologo.png resource/logo/logo.pov
povray +A +W1280 +H640 +Obanner.png resource/logo/banner.pov
povray +A +W1280 +H640 +Obanner-nodejs.png Declare=NODEJS=1 resource/logo/banner.pov
povray +A +W102 +H47 +O102x47.png resource/logo/102x47.pov
mv logo.png banner.png banner-nodejs.png resource/logo/
magick resource/logo/logo.png -scale x64 resource/logo/logo64.png
magick 102x47.png resource/logo/overlay-102x47.png -compose over -composite resource/logo/102x47.png
rm -f 102x47.png
#!/bin/sh
povray +A +W256 +H256 +Ologo.png resource/logo/logo.pov
povray +A +W1280 +H640 +Obanner.png resource/logo/banner.pov
povray +A +W1280 +H640 +Obanner-nodejs.png Declare=NODEJS=1 resource/logo/banner.pov
povray +A +W102 +H47 +O102x47.png resource/logo/102x47.pov
mv logo.png banner.png banner-nodejs.png resource/logo/
magick resource/logo/logo.png -scale x64 resource/logo/logo64.png
magick 102x47.png resource/logo/overlay-102x47.png -compose over -composite resource/logo/102x47.png
rm -f 102x47.png

View file

@ -1,6 +1,6 @@
#!/bin/sh
for i in linux win32 win64 doxygen; do
rm -rf ../milsko-$i
cp -rf . ../milsko-$i
rm -rf ../milsko-$i/.svn
done
#!/bin/sh
for i in linux win32 win64 doxygen; do
rm -rf ../milsko-$i
cp -rf . ../milsko-$i
rm -rf ../milsko-$i/.svn
done

View file

@ -1,121 +1,121 @@
#!/usr/bin/env perl
our $WIDTH = 80;
sub l {
my $len = 0;
my $last = 0;
my @msg = split(/ /, $_[0]);
foreach my $m (@msg) {
$len += 1 + length($m);
$last = 0;
if ($len > $WIDTH) {
print(OUT "\n");
$len = 0;
$last = 1;
}
print(OUT "$m ");
}
if (!$last) {
print(OUT "\n");
}
}
sub c {
my ($msg) = @_;
my $len = length($msg);
if ($_[1]) {
$len = $_[1];
}
print(OUT (" " x (($WIDTH - $len) / 2)) . "$msg\n");
}
sub h {
my ($msg) = @_;
print(OUT "\n");
print(OUT "$msg\n");
print(OUT ("-" x length($msg)) . "\n");
print(OUT "\n");
}
open(IN, "<", "include/Mw/Version.h");
my @lines = <IN>;
close(IN);
my @match = grep(/MwVERSION/, @lines);
my $ver = $match[0];
$ver =~ /\"([^"]+)\"/;
$ver = $1;
open(OUT, ">", "README.txt");
l("");
l("Greetings - Welcome to the Milsko GUI Toolkit (Version " . $ver . ")");
l("");
l(
" This document contains a brief summary of the contents of this source distributions and building instructions for Milsko GUI Toolkit."
);
l("");
c("Requirements");
l("");
l(" Milsko requires either");
l(" * A Windows environment with GDI (so anything NT or 9x)");
#l(" * A MacOS environment with Cocoa (10.4 or above supported)");
l(" * A Unix-like environment with Wayland and/or X11 for runtime.");
l("");
l(" To build Milsko for Windows, you must have one of following compilers:");
l(" * Visual C++ 6.0 or newer");
l(" * Borland C++ 5.5 or newer");
l(" * Open Watcom 2.0 or newer");
l(" * MinGW-w64");
l("");
l(" and for Unix-like and MacOS:");
l(" * GNU C Compiler");
l(" * Clang");
l("");
l("");
c("Contents");
l("");
c(" At the top level of this hierarchy there are seven directories:", 60);
l("");
c(" src - Contains the source for Milsko library", 60);
l("");
c(" include - Contains the headers for Milsko", 60);
l("");
c(" doc - Contains the documentation for Milsko", 60);
l("");
c(" external - Contains the external dependency that Milsko uses", 60);
l("");
c(" resource - Contains the resources used by maintainers", 60);
l("");
c(" tools - Contains the tools used by maintainers", 60);
l("");
l("");
c("Building Milsko");
l("");
l(" Building Milsko depends on the platform you use, and the compiler you use."
);
h("A. Visual C++");
l("1) Run `nmake -f NTMakefile'.");
h("B. Borland C++");
l("1) Run `make -f BorMakefile'.");
h("C. Open Watcom");
l("1) Run `wmake -f WatMakefile'.");
h("D. MinGW-w64/GCC/Clang");
l("1) Determine if you need Vulkan and/or OpenGL.");
l("");
l("2) Either:");
l(" a.) Run `./configure'. For help, run `./configure --help'.");
l(
" b.) Use CMake; i.e. `cmake -B build`. (if contributing, name the build folder build as that's what's included in the .gitignore)"
);
l("");
l("3) Run `make'.");
l("");
l(" -- Nishi (nishi\@nishi.boats)");
close(OUT);
#!/usr/bin/env perl
our $WIDTH = 80;
sub l {
my $len = 0;
my $last = 0;
my @msg = split(/ /, $_[0]);
foreach my $m (@msg) {
$len += 1 + length($m);
$last = 0;
if ($len > $WIDTH) {
print(OUT "\n");
$len = 0;
$last = 1;
}
print(OUT "$m ");
}
if (!$last) {
print(OUT "\n");
}
}
sub c {
my ($msg) = @_;
my $len = length($msg);
if ($_[1]) {
$len = $_[1];
}
print(OUT (" " x (($WIDTH - $len) / 2)) . "$msg\n");
}
sub h {
my ($msg) = @_;
print(OUT "\n");
print(OUT "$msg\n");
print(OUT ("-" x length($msg)) . "\n");
print(OUT "\n");
}
open(IN, "<", "include/Mw/Version.h");
my @lines = <IN>;
close(IN);
my @match = grep(/MwVERSION/, @lines);
my $ver = $match[0];
$ver =~ /\"([^"]+)\"/;
$ver = $1;
open(OUT, ">", "README.txt");
l("");
l("Greetings - Welcome to the Milsko GUI Toolkit (Version " . $ver . ")");
l("");
l(
" This document contains a brief summary of the contents of this source distributions and building instructions for Milsko GUI Toolkit."
);
l("");
c("Requirements");
l("");
l(" Milsko requires either");
l(" * A Windows environment with GDI (so anything NT or 9x)");
#l(" * A MacOS environment with Cocoa (10.4 or above supported)");
l(" * A Unix-like environment with Wayland and/or X11 for runtime.");
l("");
l(" To build Milsko for Windows, you must have one of following compilers:");
l(" * Visual C++ 6.0 or newer");
l(" * Borland C++ 5.5 or newer");
l(" * Open Watcom 2.0 or newer");
l(" * MinGW-w64");
l("");
l(" and for Unix-like and MacOS:");
l(" * GNU C Compiler");
l(" * Clang");
l("");
l("");
c("Contents");
l("");
c(" At the top level of this hierarchy there are seven directories:", 60);
l("");
c(" src - Contains the source for Milsko library", 60);
l("");
c(" include - Contains the headers for Milsko", 60);
l("");
c(" doc - Contains the documentation for Milsko", 60);
l("");
c(" external - Contains the external dependency that Milsko uses", 60);
l("");
c(" resource - Contains the resources used by maintainers", 60);
l("");
c(" tools - Contains the tools used by maintainers", 60);
l("");
l("");
c("Building Milsko");
l("");
l(" Building Milsko depends on the platform you use, and the compiler you use."
);
h("A. Visual C++");
l("1) Run `nmake -f NTMakefile'.");
h("B. Borland C++");
l("1) Run `make -f BorMakefile'.");
h("C. Open Watcom");
l("1) Run `wmake -f WatMakefile'.");
h("D. MinGW-w64/GCC/Clang");
l("1) Determine if you need Vulkan and/or OpenGL.");
l("");
l("2) Either:");
l(" a.) Run `./configure'. For help, run `./configure --help'.");
l(
" b.) Use CMake; i.e. `cmake -B build`. (if contributing, name the build folder build as that's what's included in the .gitignore)"
);
l("");
l("3) Run `make'.");
l("");
l(" -- Nishi (nishi\@nishi.boats)");
close(OUT);

View file

@ -1,11 +1,11 @@
#!/bin/sh
for out in src/font/ttf.c src/font/boldttf.c; do
echo '#include <Mw/Milsko.h>' > $out
echo '' >> $out
echo '#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)' >> $out
done
xxd -n MwTTFData -i resource/font/IBMPlexMono.ttf | sed s/_len/Size/ >> src/font/ttf.c
xxd -n MwBoldTTFData -i resource/font/IBMPlexMono-Bold.ttf | sed s/_len/Size/ >> src/font/boldttf.c
for out in src/font/ttf.c src/font/boldttf.c; do
echo '#endif' >> $out
done
#!/bin/sh
for out in src/font/ttf.c src/font/boldttf.c; do
echo '#include <Mw/Milsko.h>' > $out
echo '' >> $out
echo '#if defined(USE_STB_TRUETYPE) || defined(USE_FREETYPE2)' >> $out
done
xxd -n MwTTFData -i resource/font/IBMPlexMono.ttf | sed s/_len/Size/ >> src/font/ttf.c
xxd -n MwBoldTTFData -i resource/font/IBMPlexMono-Bold.ttf | sed s/_len/Size/ >> src/font/boldttf.c
for out in src/font/ttf.c src/font/boldttf.c; do
echo '#endif' >> $out
done

View file

@ -1,7 +1,7 @@
#!/bin/sh
MAKE=make
if which gmake >/dev/null 2>&1; then
MAKE=gmake
fi
./tools/genmk.pl
$MAKE format
#!/bin/sh
MAKE=make
if which gmake >/dev/null 2>&1; then
MAKE=gmake
fi
./tools/genmk.pl
$MAKE format

View file

@ -1,13 +1,13 @@
#!/bin/sh
set -e
wmake -f WatMakefile
rm -rf milsko
mkdir -p milsko-examples
cp src/Mw.dll milsko-examples/
cp examples/basic/*.exe milsko-examples/
for i in examples/gldemos/*.exe; do
cp $i milsko-examples/gl`echo $i | rev | cut -d/ -f1 | rev`
done
rm -f milsko-examples.zip
cp resource/logo/logo.png examples/picture.jpg examples/picture.png milsko-examples/
zip -rv milsko-examples.zip milsko-examples
#!/bin/sh
set -e
wmake -f WatMakefile
rm -rf milsko
mkdir -p milsko-examples
cp src/Mw.dll milsko-examples/
cp examples/basic/*.exe milsko-examples/
for i in examples/gldemos/*.exe; do
cp $i milsko-examples/gl`echo $i | rev | cut -d/ -f1 | rev`
done
rm -f milsko-examples.zip
cp resource/logo/logo.png examples/picture.jpg examples/picture.png milsko-examples/
zip -rv milsko-examples.zip milsko-examples