diff --git a/fonttool.py b/fonttool.py index 3eafaacf6..0ccc23409 100755 --- a/fonttool.py +++ b/fonttool.py @@ -247,7 +247,6 @@ structures laid out as follows: args = parser.parse_args() cp_first = args.first - cp_dest = args.dest if args.last is None: cp_last = cp_first else: @@ -278,7 +277,7 @@ structures laid out as follows: ft.commit() elif args.command == 'copy': for i in range(cp_first, cp_last + 1): - ft.code_points[i + (cp_dest - cp_first)] = ft.code_points[i] + ft.code_points[i + (args.dest - cp_first)] = ft.code_points[i] ft.commit() elif args.command == 'inspect': lut = [' ', '░░', '▒▒', '▓▓'] diff --git a/newelement.py b/newelement.py deleted file mode 100755 index c7d151944..000000000 --- a/newelement.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python3 -import sys -import re - -if len(sys.argv) != 2: - name = input('element name: ') -else: - name = sys.argv[1] - -if re.search('[^A-Z0-9-]', name): - sys.exit('element names should only contain uppercase letters, digits and hyphens (you can change the Name property of the element to whatever later though, which is what shows up in menus)') - -path = 'src/simulation/elements/' + name + '.cpp' - -def get_elements(): - elements = dict() - with open('src/simulation/ElementNumbers.h', 'r') as numbers: - for nm, pt in re.findall('ELEMENT_DEFINE\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+)\\s*\\)', numbers.read()): - elements[nm] = int(pt) - return elements - -elements = get_elements() -if name in elements: - sys.exit('element already exists') -max_id = 0 -for nm, pt in elements.items(): - pt_id = int(pt) - if max_id < pt_id: - max_id = pt_id -new_id = max_id + 1 - -with open(path, 'w') as elem: - elem.write(r"""#include "simulation/ElementCommon.h" - -static int update(UPDATE_FUNC_ARGS); -static int graphics(GRAPHICS_FUNC_ARGS); - -void Element::Element_{0}() -{{ - Identifier = "DEFAULT_PT_{0}"; - Name = "{0}"; - Colour = PIXPACK(0xFFFFFF); - MenuVisible = 1; - MenuSection = SC_SPECIAL; - Enabled = 1; - - // element properties here - - Update = &update; - Graphics = &graphics; -}} - -static int update(UPDATE_FUNC_ARGS) -{{ - // update code here - - return 0; -}} - -static int graphics(GRAPHICS_FUNC_ARGS) -{{ - // graphics code here - // return 1 if nothing dynamic happens here - - return 0; -}} - -""".format(name)) - elem.close() - -print('element file \'{0}\' successfully created '.format(path)) -input('now add \'ELEMENT_DEFINE({0}, {1});\' to \'src/simulation/ElementNumbers.h\', then press enter'.format(name, str(new_id))) -while True: - elements = get_elements() - if name in elements and elements[name] == new_id: - break - input('nope; try doing that again, then press enter') diff --git a/src/meson.build b/src/meson.build index 4c7425196..ac2b84c0b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,7 +39,6 @@ subdir('json') if uopt_lua != 'none' subdir('lua') endif -subdir('powdertoyjava') subdir('resampler') subdir('simulation') subdir('tasks') diff --git a/src/powdertoyjava/OpenGLCanvasMacOS.h b/src/powdertoyjava/OpenGLCanvasMacOS.h deleted file mode 100644 index cca87659a..000000000 --- a/src/powdertoyjava/OpenGLCanvasMacOS.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifdef USE_JNI -#import - -#import -#import - -NSOpenGLPixelFormat* defaultPixelFormat(); - -NSOpenGLContext* ensureContext(NSOpenGLContext* openGLContext, NSView *view); - -typedef struct { - JAWT* awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_MacOSXDrawingSurfaceInfo* dsi_mac; - NSView *view; - NSOpenGLContext* openGLContext; -} ContextInfo; - -ContextInfo* getContext(JNIEnv *env, jobject canvas); - -void freeContext(JNIEnv *env, jobject canvas, ContextInfo* ci); - -#ifdef __cplusplus -extern "C" { -#endif - JNIEXPORT jboolean JNICALL Java_OpenGLCanvas_beginOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_endOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_updateOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_allocOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_releaseOpenGL(JNIEnv *env, jobject canvas); -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/powdertoyjava/OpenGLCanvasMacOS.mm b/src/powdertoyjava/OpenGLCanvasMacOS.mm deleted file mode 100644 index 0145936c7..000000000 --- a/src/powdertoyjava/OpenGLCanvasMacOS.mm +++ /dev/null @@ -1,169 +0,0 @@ -#ifdef USE_JNI -#include "OpenGLCanvasMacOS.h" - -static jfieldID ctxID = NULL; - -NSOpenGLPixelFormat* defaultPixelFormat() -{ - NSOpenGLPixelFormatAttribute attributes [] = { - NSOpenGLPFAWindow, - NSOpenGLPFADoubleBuffer, - NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)16, - 0 - }; - return [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; -} - -NSOpenGLContext* ensureContext(NSOpenGLContext* openGLContext, NSView *view) { - NSOpenGLContext* _openGLContext = openGLContext; - if (!_openGLContext) { - NSOpenGLPixelFormat* pixelFormat = defaultPixelFormat(); - _openGLContext = [[NSOpenGLContext alloc] - initWithFormat:pixelFormat - shareContext:nil]; - [pixelFormat release]; - } - if ([_openGLContext view] != view) { - [_openGLContext setView:view]; - } - [_openGLContext makeCurrentContext]; - - return _openGLContext; -} - -ContextInfo* getContext(JNIEnv *env, jobject canvas) -{ - if (!ctxID) { - jclass cls = env->GetObjectClass(canvas); - ctxID = env->GetFieldID(cls, "openGLContext", "J"); - } - - ContextInfo *ci = (ContextInfo *)(long)(env->GetLongField(canvas, ctxID)); - - if (!ci) { - ci = (ContextInfo *)calloc(sizeof(ContextInfo), 1); - ci->awt = (JAWT *)calloc(sizeof(JAWT), 1); - env->SetLongField(canvas, ctxID, (jlong)(long)ci); - } - - return ci; -} - -void freeContext(JNIEnv *env, jobject canvas, ContextInfo* ci) -{ - if (ci) { - free(ci->awt); - free(ci); - env->SetLongField(canvas, ctxID, 0L); - } -} - -JNIEXPORT jboolean JNICALL Java_OpenGLCanvas_beginOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - // Lock the drawing surface - // You must lock EACH TIME before drawing - jint lock = ci->ds->Lock(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert((lock & JAWT_LOCK_ERROR) == 0); - - // Get the drawing surface info - ci->dsi = ci->ds->GetDrawingSurfaceInfo(ci->ds); - - // Check DrawingSurfaceInfo. This can be NULL on Mac OS X - // if the windowing system is not ready - if (ci->dsi != NULL) { - // Get the platform-specific drawing info - // We will use this to get at Cocoa and CoreGraphics - // See - ci->dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)ci->dsi->platformInfo; - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - - // Get the corresponding peer from the caller canvas - ci->view = ci->dsi_mac->cocoaViewRef; - ci->openGLContext = ensureContext(ci->openGLContext, ci->view); - - return JNI_TRUE; - } - - return JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_endOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - [ci->openGLContext flushBuffer]; - - // Free the DrawingSurfaceInfo - ci->ds->FreeDrawingSurfaceInfo(ci->dsi); - if (env->ExceptionOccurred()){ - env->ExceptionDescribe(); - } - - // Unlock the drawing surface - // You must unlock EACH TIME when done drawing - ci->ds->Unlock(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_updateOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - [ci->openGLContext update]; -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_allocOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - jboolean result = JNI_FALSE; - - // get the AWT - ci->awt->version = JAWT_VERSION_1_4; - result = JAWT_GetAWT(env, ci->awt); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert(result != JNI_FALSE); - - // Get the drawing surface. This can be safely cached. - // Anything below the DS (DSI, contexts, etc) - // can possibly change/go away and should not be cached. - ci->ds = ci->awt->GetDrawingSurface(env, canvas); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert(ci->ds != NULL); - - NSLog(@"Alloc Context %d", ci); -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_releaseOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - NSLog(@"Release Context %d", ci); - if (ci->openGLContext) { - if ([ci->openGLContext view] /* == self */) { - [ci->openGLContext clearDrawable]; - } - [ci->openGLContext release]; - } - - // Free the drawing surface (if not caching it) - ci->awt->FreeDrawingSurface(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - - freeContext(env, canvas, ci); -} -#endif diff --git a/src/powdertoyjava/OpenGLCanvasWin32.cpp b/src/powdertoyjava/OpenGLCanvasWin32.cpp deleted file mode 100644 index 633cbdb24..000000000 --- a/src/powdertoyjava/OpenGLCanvasWin32.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#if defined(USE_JNI) && defined(WIN) -#include "OpenGLCanvasWin32.h" - -static jfieldID ctxID = NULL; - -int defaultPixelFormat(PIXELFORMATDESCRIPTOR* pfd) -{ - ::ZeroMemory( pfd, sizeof( PIXELFORMATDESCRIPTOR ) ); - pfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); - pfd->nVersion = 1; - pfd->dwFlags = PFD_DRAW_TO_WINDOW | - PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd->iPixelType = PFD_TYPE_RGBA; - pfd->cColorBits = 24; - pfd->cDepthBits = 16; - pfd->iLayerType = PFD_MAIN_PLANE; - return 0; -} - -HGLRC ensureContext(JAWT_Win32DrawingSurfaceInfo* dsi_win, HGLRC hRC) { - - if (!hRC) { - int iFormat; - PIXELFORMATDESCRIPTOR pfd; - defaultPixelFormat(&pfd); - - iFormat = ChoosePixelFormat( dsi_win->hdc, &pfd ); - SetPixelFormat( dsi_win->hdc, iFormat, &pfd ); - - hRC = wglCreateContext( dsi_win->hdc ); - } - if (1 && wglGetCurrentDC() != dsi_win->hdc) { - wglMakeCurrent( dsi_win->hdc, hRC ); - } - - return hRC; -} - -ContextInfo* getContext(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci; - if (!ctxID) { - jclass cls = env->GetObjectClass(canvas); - ctxID = env->GetFieldID(cls, "openGLContext", "J"); - } - - ci = (ContextInfo *)(long)(env->GetLongField(canvas, ctxID)); - - if (!ci) { - ci = (ContextInfo *)calloc(sizeof(ContextInfo), 1); - ci->awt = (JAWT *)calloc(sizeof(JAWT), 1); - env->SetLongField(canvas, ctxID, (jlong)(long)ci); - } - - return ci; -} - -void freeContext(JNIEnv *env, jobject canvas, ContextInfo* ci) -{ - if (ci) { - free(ci->awt); - free(ci); - env->SetLongField(canvas, ctxID, 0L); - } -} - -JNIEXPORT jboolean JNICALL Java_OpenGLCanvas_beginOpenGL(JNIEnv *env, jobject canvas) -{ - jint lock; - ContextInfo *ci = getContext(env, canvas); - - // Get the drawing surface. This can be safely cached -- not in win32 - // Anything below the DS (DSI, contexts, etc) - // can possibly change/go away and should not be cached. - ci->ds = ci->awt->GetDrawingSurface(env, canvas); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert(ci->ds != NULL); - - // Lock the drawing surface - // You must lock EACH TIME before drawing - lock = ci->ds->Lock(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert((lock & JAWT_LOCK_ERROR) == 0); - - // Get the drawing surface info - ci->dsi = ci->ds->GetDrawingSurfaceInfo(ci->ds); - - // Check DrawingSurfaceInfo. This can be NULL on Mac OS X - // if the windowing system is not ready - if (ci->dsi != NULL) { - // Get the platform-specific drawing info - // We will use this to get at Cocoa and CoreGraphics - // See - ci->dsi_win = (JAWT_Win32DrawingSurfaceInfo*)ci->dsi->platformInfo; - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - - // Get the corresponding peer from the caller canvas - ci->hRC = ensureContext(ci->dsi_win, ci->hRC); - - return JNI_TRUE; - } - - return JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_endOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - SwapBuffers( ci->dsi_win->hdc ); - - // Free the DrawingSurfaceInfo - ci->ds->FreeDrawingSurfaceInfo(ci->dsi); - if (env->ExceptionOccurred()){ - env->ExceptionDescribe(); - } - - // Unlock the drawing surface - // You must unlock EACH TIME when done drawing - ci->ds->Unlock(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - - // Free the drawing surface (if not caching it) - ci->awt->FreeDrawingSurface(ci->ds); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_updateOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - wglMakeCurrent( ci->dsi_win->hdc, ci->hRC ); -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_allocOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - - jboolean result = JNI_FALSE; - - // get the AWT - ci->awt->version = JAWT_VERSION_1_4; - result = JAWT_GetAWT(env, ci->awt); - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - } - assert(result != JNI_FALSE); -} - -JNIEXPORT void JNICALL Java_OpenGLCanvas_releaseOpenGL(JNIEnv *env, jobject canvas) -{ - ContextInfo *ci = getContext(env, canvas); - if (ci->hRC) { - wglDeleteContext(ci->hRC); - } - - freeContext(env, canvas, ci); -} -#endif diff --git a/src/powdertoyjava/OpenGLCanvasWin32.h b/src/powdertoyjava/OpenGLCanvasWin32.h deleted file mode 100644 index 5039669ad..000000000 --- a/src/powdertoyjava/OpenGLCanvasWin32.h +++ /dev/null @@ -1,36 +0,0 @@ -#include "Config.h" -#ifdef USE_JNI -#import - -#include -#include -#include - -int defaultPixelFormat(PIXELFORMATDESCRIPTOR* pfd); - -HGLRC ensureContext(JAWT_Win32DrawingSurfaceInfo* dsi_win, HGLRC hRC); - -typedef struct { - JAWT* awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_Win32DrawingSurfaceInfo* dsi_win; - HGLRC hRC; -} ContextInfo; - -ContextInfo* getContext(JNIEnv *env, jobject canvas); - -void freeContext(JNIEnv *env, jobject canvas, ContextInfo* ci); - -#ifdef __cplusplus -extern "C" { -#endif - JNIEXPORT jboolean JNICALL Java_OpenGLCanvas_beginOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_endOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_updateOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_allocOpenGL(JNIEnv *env, jobject canvas); - JNIEXPORT void JNICALL Java_OpenGLCanvas_releaseOpenGL(JNIEnv *env, jobject canvas); -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/powdertoyjava/PowderToyJava.cpp b/src/powdertoyjava/PowderToyJava.cpp deleted file mode 100644 index b0ab4c09b..000000000 --- a/src/powdertoyjava/PowderToyJava.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#if defined(USE_JNI) - -#include -#include - -#include "Config.h" -#include "PowderToyJava.h" -#include "graphics/Graphics.h" - -#include "game/GameController.h" - -GameController * gameController; -ui::Engine * engine; - -int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0; -float fps = 0, delta = 1.0f; - -JNIEXPORT void JNICALL Java_PowderToy_initialise(JNIEnv * env, jobject canvas) -{ - ui::Engine::Ref().g = new Graphics(); - - engine = &ui::Engine::Ref(); - engine->Begin(WINDOWW, WINDOWH); - - gameController = new GameController(); - engine->ShowWindow(gameController->GetView()); - engine->SetFps(fps); -} - -JNIEXPORT void JNICALL Java_PowderToy_tick(JNIEnv * env, jobject canvas) -{ - engine->Tick(); -} - -JNIEXPORT void JNICALL Java_PowderToy_draw(JNIEnv * env, jobject canvas) -{ - engine->Draw(); - engine->g->Finalise(); -} - -JNIEXPORT void JNICALL Java_PowderToy_finish(JNIEnv * env, jobject canvas) -{ - ui::Engine::Ref().CloseWindow(); - delete gameController; - delete ui::Engine::Ref().g; -} - -JNIEXPORT jint JNICALL Java_PowderToy_getWidth(JNIEnv * env, jobject canvas) -{ - return WINDOWW; -} - -JNIEXPORT jint JNICALL Java_PowderToy_getHeight(JNIEnv * env, jobject canvas) -{ - return WINDOWH; -} - -JNIEXPORT void JNICALL Java_PowderToy_mousePressed(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton) -{ - engine->onMouseClick(mouseX, mouseY, mouseButton); -} - -JNIEXPORT void JNICALL Java_PowderToy_mouseReleased(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton) -{ - engine->onMouseUnclick(mouseX, mouseY, mouseButton); -} - -JNIEXPORT void JNICALL Java_PowderToy_mouseMoved(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY) -{ - engine->onMouseMove(mouseX, mouseY); -} - -#endif diff --git a/src/powdertoyjava/PowderToyJava.h b/src/powdertoyjava/PowderToyJava.h deleted file mode 100644 index 3c6edfd71..000000000 --- a/src/powdertoyjava/PowderToyJava.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Config.h" -#include - -#ifndef POWDERTOYJAVA -#define POWDERTOYJAVA - -#ifdef __cplusplus -extern "C" { -#endif - JNIEXPORT void JNICALL Java_PowderToy_initialise(JNIEnv *, jobject); - JNIEXPORT void JNICALL Java_PowderToy_tick(JNIEnv *, jobject); - JNIEXPORT void JNICALL Java_PowderToy_draw(JNIEnv *, jobject); - JNIEXPORT void JNICALL Java_PowderToy_finish(JNIEnv *, jobject); - JNIEXPORT jint JNICALL Java_PowderToy_getWidth(JNIEnv * env, jobject canvas); - JNIEXPORT jint JNICALL Java_PowderToy_getHeight(JNIEnv * env, jobject canvas); - JNIEXPORT void JNICALL Java_PowderToy_mousePressed(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton); - JNIEXPORT void JNICALL Java_PowderToy_mouseReleased(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton); - JNIEXPORT void JNICALL Java_PowderToy_mouseMoved(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY); -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/powdertoyjava/meson.build b/src/powdertoyjava/meson.build deleted file mode 100644 index cc189cd8e..000000000 --- a/src/powdertoyjava/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -powder_files += files( - 'OpenGLCanvasWin32.cpp', - 'PowderToyJava.cpp', -) diff --git a/subprojects/tpt-bzip2/Makefile b/subprojects/tpt-bzip2/Makefile deleted file mode 100644 index f8a17722e..000000000 --- a/subprojects/tpt-bzip2/Makefile +++ /dev/null @@ -1,217 +0,0 @@ -# ------------------------------------------------------------------ -# This file is part of bzip2/libbzip2, a program and library for -# lossless, block-sorting data compression. -# -# bzip2/libbzip2 version 1.0.8 of 13 July 2019 -# Copyright (C) 1996-2019 Julian Seward -# -# Please read the WARNING, DISCLAIMER and PATENTS sections in the -# README file. -# -# This program is released under the terms of the license contained -# in the file LICENSE. -# ------------------------------------------------------------------ - -SHELL=/bin/sh - -# To assist in cross-compiling -CC=gcc -AR=ar -RANLIB=ranlib -LDFLAGS= - -BIGFILES=-D_FILE_OFFSET_BITS=64 -CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) - -# Where you want it installed when you do 'make install' -PREFIX=/usr/local - - -OBJS= blocksort.o \ - huffman.o \ - crctable.o \ - randtable.o \ - compress.o \ - decompress.o \ - bzlib.o - -all: libbz2.a bzip2 bzip2recover test - -bzip2: libbz2.a bzip2.o - $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 - -bzip2recover: bzip2recover.o - $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o - -libbz2.a: $(OBJS) - rm -f libbz2.a - $(AR) cq libbz2.a $(OBJS) - @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ - -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ - echo $(RANLIB) libbz2.a ; \ - $(RANLIB) libbz2.a ; \ - fi - -check: test -test: bzip2 - @cat words1 - ./bzip2 -1 < sample1.ref > sample1.rb2 - ./bzip2 -2 < sample2.ref > sample2.rb2 - ./bzip2 -3 < sample3.ref > sample3.rb2 - ./bzip2 -d < sample1.bz2 > sample1.tst - ./bzip2 -d < sample2.bz2 > sample2.tst - ./bzip2 -ds < sample3.bz2 > sample3.tst - cmp sample1.bz2 sample1.rb2 - cmp sample2.bz2 sample2.rb2 - cmp sample3.bz2 sample3.rb2 - cmp sample1.tst sample1.ref - cmp sample2.tst sample2.ref - cmp sample3.tst sample3.ref - @cat words3 - -install: bzip2 bzip2recover - if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi - if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi - if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi - if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi - if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi - cp -f bzip2 $(PREFIX)/bin/bzip2 - cp -f bzip2 $(PREFIX)/bin/bunzip2 - cp -f bzip2 $(PREFIX)/bin/bzcat - cp -f bzip2recover $(PREFIX)/bin/bzip2recover - chmod a+x $(PREFIX)/bin/bzip2 - chmod a+x $(PREFIX)/bin/bunzip2 - chmod a+x $(PREFIX)/bin/bzcat - chmod a+x $(PREFIX)/bin/bzip2recover - cp -f bzip2.1 $(PREFIX)/man/man1 - chmod a+r $(PREFIX)/man/man1/bzip2.1 - cp -f bzlib.h $(PREFIX)/include - chmod a+r $(PREFIX)/include/bzlib.h - cp -f libbz2.a $(PREFIX)/lib - chmod a+r $(PREFIX)/lib/libbz2.a - cp -f bzgrep $(PREFIX)/bin/bzgrep - ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep - ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep - chmod a+x $(PREFIX)/bin/bzgrep - cp -f bzmore $(PREFIX)/bin/bzmore - ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless - chmod a+x $(PREFIX)/bin/bzmore - cp -f bzdiff $(PREFIX)/bin/bzdiff - ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp - chmod a+x $(PREFIX)/bin/bzdiff - cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 - chmod a+r $(PREFIX)/man/man1/bzgrep.1 - chmod a+r $(PREFIX)/man/man1/bzmore.1 - chmod a+r $(PREFIX)/man/man1/bzdiff.1 - echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 - echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 - echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 - echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 - -clean: - rm -f *.o libbz2.a bzip2 bzip2recover \ - sample1.rb2 sample2.rb2 sample3.rb2 \ - sample1.tst sample2.tst sample3.tst - -blocksort.o: blocksort.c - @cat words0 - $(CC) $(CFLAGS) -c blocksort.c -huffman.o: huffman.c - $(CC) $(CFLAGS) -c huffman.c -crctable.o: crctable.c - $(CC) $(CFLAGS) -c crctable.c -randtable.o: randtable.c - $(CC) $(CFLAGS) -c randtable.c -compress.o: compress.c - $(CC) $(CFLAGS) -c compress.c -decompress.o: decompress.c - $(CC) $(CFLAGS) -c decompress.c -bzlib.o: bzlib.c - $(CC) $(CFLAGS) -c bzlib.c -bzip2.o: bzip2.c - $(CC) $(CFLAGS) -c bzip2.c -bzip2recover.o: bzip2recover.c - $(CC) $(CFLAGS) -c bzip2recover.c - - -distclean: clean - rm -f manual.ps manual.html manual.pdf - -DISTNAME=bzip2-1.0.8 -dist: check manual - rm -f $(DISTNAME) - ln -s -f . $(DISTNAME) - tar cvf $(DISTNAME).tar \ - $(DISTNAME)/blocksort.c \ - $(DISTNAME)/huffman.c \ - $(DISTNAME)/crctable.c \ - $(DISTNAME)/randtable.c \ - $(DISTNAME)/compress.c \ - $(DISTNAME)/decompress.c \ - $(DISTNAME)/bzlib.c \ - $(DISTNAME)/bzip2.c \ - $(DISTNAME)/bzip2recover.c \ - $(DISTNAME)/bzlib.h \ - $(DISTNAME)/bzlib_private.h \ - $(DISTNAME)/Makefile \ - $(DISTNAME)/LICENSE \ - $(DISTNAME)/bzip2.1 \ - $(DISTNAME)/bzip2.1.preformatted \ - $(DISTNAME)/bzip2.txt \ - $(DISTNAME)/words0 \ - $(DISTNAME)/words1 \ - $(DISTNAME)/words2 \ - $(DISTNAME)/words3 \ - $(DISTNAME)/sample1.ref \ - $(DISTNAME)/sample2.ref \ - $(DISTNAME)/sample3.ref \ - $(DISTNAME)/sample1.bz2 \ - $(DISTNAME)/sample2.bz2 \ - $(DISTNAME)/sample3.bz2 \ - $(DISTNAME)/dlltest.c \ - $(DISTNAME)/manual.html \ - $(DISTNAME)/manual.pdf \ - $(DISTNAME)/manual.ps \ - $(DISTNAME)/README \ - $(DISTNAME)/README.COMPILATION.PROBLEMS \ - $(DISTNAME)/README.XML.STUFF \ - $(DISTNAME)/CHANGES \ - $(DISTNAME)/libbz2.def \ - $(DISTNAME)/libbz2.dsp \ - $(DISTNAME)/dlltest.dsp \ - $(DISTNAME)/makefile.msc \ - $(DISTNAME)/unzcrash.c \ - $(DISTNAME)/spewG.c \ - $(DISTNAME)/mk251.c \ - $(DISTNAME)/bzdiff \ - $(DISTNAME)/bzdiff.1 \ - $(DISTNAME)/bzmore \ - $(DISTNAME)/bzmore.1 \ - $(DISTNAME)/bzgrep \ - $(DISTNAME)/bzgrep.1 \ - $(DISTNAME)/Makefile-libbz2_so \ - $(DISTNAME)/bz-common.xsl \ - $(DISTNAME)/bz-fo.xsl \ - $(DISTNAME)/bz-html.xsl \ - $(DISTNAME)/bzip.css \ - $(DISTNAME)/entities.xml \ - $(DISTNAME)/manual.xml \ - $(DISTNAME)/format.pl \ - $(DISTNAME)/xmlproc.sh - gzip -v $(DISTNAME).tar - -# For rebuilding the manual from sources on my SuSE 9.1 box - -MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \ - entities.xml manual.xml - -manual: manual.html manual.ps manual.pdf - -manual.ps: $(MANUAL_SRCS) - ./xmlproc.sh -ps manual.xml - -manual.pdf: $(MANUAL_SRCS) - ./xmlproc.sh -pdf manual.xml - -manual.html: $(MANUAL_SRCS) - ./xmlproc.sh -html manual.xml diff --git a/vsproject.py b/vsproject.py deleted file mode 100755 index db032aaa9..000000000 --- a/vsproject.py +++ /dev/null @@ -1,314 +0,0 @@ -#!/usr/bin/env python3 -import os -from pathlib import Path -import uuid - -cl_compile = [] -cl_include = [] -source_dirs = set() -for root, subdirs, files in os.walk('src'): - for file in [os.path.join(root, f) for f in files]: - lowerfile = file.lower() - add_source_dir = False - if lowerfile.endswith('.cpp') or lowerfile.endswith('.c'): - cl_compile.append(file) - add_source_dir = True - if lowerfile.endswith('.hpp') or lowerfile.endswith('.h'): - cl_include.append(file) - add_source_dir = True - if add_source_dir: - path = Path(root) - for i in range(len(path.parents) - 1): - parent = path.parents[i] - if not str(parent) in source_dirs: - source_dirs.add(str(parent)) - source_dirs.add(os.path.dirname(file)) - -sln = open("The-Powder-Toy.sln", 'w') -sln.write(r"""Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "The-Powder-Toy", "The-Powder-Toy.vcxproj", "{57F7954F-6975-4DEE-8C4F-F9B083E05985}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Static|Win32 = Static|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Debug|Win32.ActiveCfg = Debug|Win32 - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Debug|Win32.Build.0 = Debug|Win32 - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Release|Win32.ActiveCfg = Release|Win32 - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Release|Win32.Build.0 = Release|Win32 - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Static|Win32.ActiveCfg = Static|Win32 - {57F7954F-6975-4DEE-8C4F-F9B083E05985}.Static|Win32.Build.0 = Static|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -""") -sln.close() - -vcxproj = open("The-Powder-Toy.vcxproj", 'w') -vcxproj.write(r""" - - - - Debug - Win32 - - - Release - Win32 - - - Static - Win32 - - - - {57F7954F-6975-4DEE-8C4F-F9B083E05985} - Win32Proj - 10.0.17763.0 - - - - Application - true - v142 - - - Application - false - v142 - - - Application - false - v142 - - - - - - - - - - - - - - - - false - $(SolutionDir)Build\ - Powder - $(ProjectDir)includes;$(ProjectDir)includes/SDL2;$(ProjectDir)includes/luajit-2.0;$(ProjectDir)data;$(ProjectDir)src;$(ProjectDir)resources;$(IncludePath) - $(ProjectDir)Libraries;$(LibraryPath) - - - false - $(SolutionDir)Build\ - Powder - $(ProjectDir)includes;$(ProjectDir)includes/SDL2;$(ProjectDir)includes/luajit-2.0;$(ProjectDir)data;$(ProjectDir)src;$(ProjectDir)resources;$(IncludePath) - $(ProjectDir)Libraries;$(LibraryPath) - - - false - $(SolutionDir)Build\ - Powder - $(ProjectDir)includes;$(ProjectDir)includes/SDL2;$(ProjectDir)includes/luajit-2.0;$(ProjectDir)data;$(ProjectDir)src;$(ProjectDir)resources;$(IncludePath) - $(ProjectDir)Staticlibs;$(LibraryPath) - - - - WIN;X86;X86_SSE2;USE_SDL;STABLE;GRAVFFT;LUACONSOLE;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level1 - ProgramDatabase - true - Disabled - Fast - $(IntDir)\%(RelativeDir) - - - MachineX86 - true - Windows - SDL2.lib;SDL2main.lib;shell32.lib;libbz2.lib;pthreadVC2.lib;luajit2.0.lib;libfftw3f-3.lib;zlib.lib;libcurl.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - WIN;X86;X86_SSE2;USE_SDL;STABLE;GRAVFFT;LUACONSOLE;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDLL - Level1 - ProgramDatabase - true - Fast - StreamingSIMDExtensions2 - $(IntDir)\%(RelativeDir) - - - MachineX86 - true - Windows - true - true - SDL2.lib;SDL2main.lib;shell32.lib;libbz2.lib;pthreadVC2.lib;luajit2.0.lib;libfftw3f-3.lib;zlib.lib;libcurl.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - WIN;X86;X86_SSE2;USE_SDL;STABLE;GRAVFFT;LUACONSOLE;ZLIB_WINAPI;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;PTW32_STATIC_LIB;CURL_STATICLIB;%(PreprocessorDefinitions) - MultiThreaded - Level1 - ProgramDatabase - true - Fast - StreamingSIMDExtensions2 - $(IntDir)\%(RelativeDir) - - - MachineX86 - true - Windows - true - true - SDL2.lib;SDL2main.lib;shell32.lib;libbz2.lib;pthreadVC2.lib;luajit2.0.lib;libfftw3f-3.lib;zlib.lib;libcurl.lib;ws2_32.lib;Wldap32.lib;crypt32.lib;winmm.lib;dxguid.lib;imm32.lib;version.lib;SetupApi.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - false - - - - - - - - """) -vcxproj.write('\n '.join([('') for p in cl_compile])) -vcxproj.write(r""" - - - - - - - - - - - """) -vcxproj.write('\n '.join([('') for p in cl_include])) -vcxproj.write(r""" - - - - - - - - - - - - - - - - - - - -""") -vcxproj.close() - -filters = open("The-Powder-Toy.vcxproj.filters", 'w') -filters.write(r""" - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {fc5911e1-d5ba-4da3-9cfa-5631c6914487} - - """) -filters.write('\n '.join([('\n {' + str(uuid.uuid4()) + '}\n ') for p in source_dirs])) -filters.write(r""" - - - """) -filters.write('\n '.join([('\n ' + os.path.dirname(p) + '\n ') for p in cl_compile])) -filters.write(r""" - - - - src\simulation - - - data - - - data - - - data - - - data - - - data - - - data - - - data - - """) -filters.write('\n '.join([('\n ' + os.path.dirname(p) + '\n ') for p in cl_include])) -filters.write(r""" - - resources - - - - - resources - - - - - src\graphics - - - src\graphics - - - src\graphics - - - - - - - - src\lua\socket - - - -""") -filters.close()