Skip to content
Snippets Groups Projects
Commit 8bda4921 authored by Stephen Hurd's avatar Stephen Hurd
Browse files

With the CMakeLists.txt files in the main repo, we don't need

to maintain anything here except the config file.

We just jelly it into anyone who uses the library, British style.
parent 63bab3f2
Branches
No related tags found
No related merge requests found
Showing with 47 additions and 35975 deletions
cmake_minimum_required(VERSION 3.11) cmake_minimum_required(VERSION 3.11)
project (XPDevPlus CXX) project (XPDevPlus CXX)
add_subdirectory(ciolib) include("FetchContent")
add_subdirectory(comio)
add_subdirectory(encode) include(ExternalProject)
add_subdirectory(hash)
add_subdirectory(uifc) add_compile_options(-include xpdevplus.h)
add_subdirectory(xpdev)
FetchContent_Declare(
CONIO
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/conio
SOURCE_SUBDIR src/conio
)
FetchContent_MakeAvailable(CONIO)
FetchContent_Declare(
COMIO
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/comio
SOURCE_SUBDIR src/comio
)
FetchContent_MakeAvailable(COMIO)
FetchContent_Declare(
Encode
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/encode
SOURCE_SUBDIR src/encode
)
FetchContent_MakeAvailable(Encode)
FetchContent_Declare(
Hash
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/hash
SOURCE_SUBDIR src/hash
)
FetchContent_MakeAvailable(Hash)
FetchContent_Declare(
UIFC
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/uifc
SOURCE_SUBDIR src/uifc
)
FetchContent_MakeAvailable(UIFC)
FetchContent_Declare(
XPDev
URL https://gitlab.synchro.net/main/sbbs/-/archive/master/sbbs-master.tar.gz?path=src/xpdev
SOURCE_SUBDIR src/xpdev
)
FetchContent_MakeAvailable(XPDev)
enable_language(C) enable_language(C)
set(SOURCE set(SOURCE
......
project (ConIOLib C)
cmake_minimum_required(VERSION 3.11)
INCLUDE (CheckFunctionExists)
find_package(X11)
# So on BSD, this causes the find to fail. However, it's required for Linux
# This is because on BSD, ncursesw.h does not exist, but libraries use
# ncurses.h
set(CURSES_NEED_WIDE TRUE)
find_package(Threads REQUIRED)
if(NOT WIN32)
find_package(Curses)
find_package(PkgConfig)
pkg_check_modules(SDL2 sdl2)
endif()
set(SOURCE
allfonts.c
ansi_cio.c
ciolib.c
ciolib.rc
cterm.c
mouse.c
syncicon64.c
utf8_codepages.c
vidmodes.c
xbr.c
)
set(HEADER
ciolib.h
cterm.h
keys.h
mouse.h
utf8_codepages.h
vidmodes.h
)
if(WIN32)
list(APPEND SOURCE win32cio.c ciolib.rc)
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(CURSES_FOUND)
list(APPEND SOURCE curs_cio.c)
set(USE_CURSES_ANYWAY TRUE)
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "(Free|Open|Net)BSD")
list(APPEND SOURCE curs_cio.c)
set(USE_CURSES_ANYWAY TRUE)
else()
message(FATAL_ERROR "ncursesw not found")
endif()
endif()
endif()
if(X11_FOUND)
list(APPEND SOURCE x_events.c x_cio.c)
set(NEED_BITMAP TRUE)
set(NEED_DLOPEN TRUE)
set(NEED_SCALE TRUE)
endif()
if(SDL2_INCLUDE_DIRS)
list(APPEND SOURCE sdl_con.c)
list(APPEND SOURCE sdlfuncs.c)
set(NEED_SCALE TRUE)
if(WIN32)
list(APPEND SOURCE SDL_win32_main.c)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND SOURCE SDLMain.m)
endif()
set(NEED_BITMAP TRUE)
set(NEED_DLOPEN TRUE)
endif()
if(NEED_BITMAP)
list(APPEND SOURCE bitmap_con.c)
endif()
if(NEED_SCALE)
list(APPEND SOURCE scale.c)
endif()
add_library(ciolib OBJECT ${SOURCE})
target_include_directories(ciolib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(CURSES_FOUND)
if(${CMAKE_SYSTEM_NAME} MATCHES "(Free|Open|Net)BSD")
list(APPEND SOURCE curs_cio.c)
set(USE_CURSES_ANYWAY TRUE)
endif()
endif()
if(X11_FOUND)
target_include_directories(ciolib PRIVATE ${X11_INCLUDE_DIR})
else()
target_compile_definitions(ciolib PRIVATE NO_X)
endif()
if(SDL2_INCLUDE_DIRS)
target_include_directories(ciolib PUBLIC ${SDL2_INCLUDE_DIRS})
set(WITH_SDL TRUE PARENT_SCOPE)
endif()
if(NOT WIN32)
target_link_libraries(ciolib pthread)
endif()
if(USE_CURSES_ANYWAY)
if(CURSES_FOUND)
if (CURSES_HAVE_NCURSES_NCURSES_H)
target_compile_definitions(ciolib PRIVATE DEBIAN_HATES_YOU)
elseif(CURSES_HAVE_NCURSES_H)
target_compile_definitions(ciolib PRIVATE N_CURSES_LIB)
endif()
target_link_libraries(ciolib ${NCURSES_LIBRARIES})
else()
target_link_libraries(ciolib ${CURSES_NCURSES_LIBRARY})
target_link_libraries(ciolib ${CURSES_TINFO_LIBRARY_NAME})
endif()
endif()
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
if(HAVE_VASPRINTF)
target_compile_definitions(ciolib PRIVATE HAVE_VASPRINTF)
endif()
target_link_libraries(ciolib hash encode xpdev)
/conio.dsp/1.15/Thu Jun 1 21:57:02 2006//
/conio_sdl.dsp/1.1/Thu Oct 11 06:30:16 2007//
D
src/conio
:pserver:deuce@cvs.synchro.net:/cvsroot/sbbs
1) NO GLOBALS (ESCDELAY etc will be in the struct with accessors)
2) An init function that returns a struct with a bunch of function pointers in
it.
3) UIFC will need to have the ability for the ciolib struct to be passed to
it.
4) Will support multiple independent windows.
5) There will be a compatability library for JUST conio stuff.
6) Any advanced features not in the conio API will not be present.
7) Unicode (UTF-8) support... likely X11 first, followed by Curses, SDL and
Win32.
8) ANSI mode may never get proper unicode support... or at least not until
everything else works.
9) Unicode support will support GR access of the C1 set. Most importantly,
this means CSI (\x9b). This is actually somewhat silly since it will take
two bytes regardless, but if UCS-2 or something gets added in the future,
it may make a difference, and there's no reason to show control codes.
10) Greatly expanded attribute sets, and in UTF-8 mode there will be no
hackiness. The great bright/bold debate will rage on though... possibly a
new set/reset mode will be added to control it.
11) Double-height/Double-width/Double-size modes. As is tradition, all the
cells covered by the glyph must be the same character and attributes. This
opens a whole can of worms regarding how further updates work etc. I'll
strive to keep it sane and compatible, which may be impossible.
12) A Unicode cell will potentially have multiple codepoints "in" it.
13) We need a way to specify the initial mode.
Some sort of state checkpoint thing... you "save" the checkpoint, and send that
ID back and you get the same state returned.
Stack and state save thing
For CONIOng:
Layers:
0 - Solid fixed background (doesn't scoll)
1 - Text area background (scrolls, text area)
2 - Text area background bitmap (scrolls, text area)
3 - Text area background pixel (scrolls, text area)
4 - Bitmap background (doesn't scroll)
5 - Pixel background (doesn't scroll)
6 - Text area foreground (scrolls, text area)
7 - Text area foreground bitmap (scrolls, text area)
8 - Text area foreground pixel (scrolls, text area)
9 - Bitmap foreground (doesn't scroll)
10 - Pixel foreground layer (doesn't scroll)
Layer Attributes:
Layer 0: "colour"
Layer 1: <none>
Layer 2: <none>
Layer 3: "hidden"
Layer 4: <none>
Layer 5: "hidden"
Layer 6: <none>
Layer 7: <none>
Layer 8: "hidden"
Layer 9: <none>
Layer 10: "hidden"
A text area can be defined as having a given width and height with the
top-left corner positioned at any pixel location. Text areas use a fixed
width font, and have multiple planes... text background, background bitmap,
background pixels, text foreground, foreground bitmap, foreground pixels
It will have the following attributes:
Fonts
Codepage
Tab stops
Cursor position
Auto-wrap
Blink enabled
Cursor vidible
Palette definition
Foreground visible
Foreground bitmaps visible
Foreground pixels visible
Background visible
Background bitmaps visible
Background pixels visible
Z-index
"Current" cell attributes (see below)
Each character cell will have the following attributes:
Codepoints (array)
Foreground colour
Background colour
Font
Flags
- Fast Blink
- Slow Blink
- Bold
- Italic
- Negative
- Concealed
- Underline
- Overstrike
- Double underline
- Double overstrike
- Double-wide
- Double-high
- Superscript
- Subscript
Bitmap layers contain zero or more bitmaps (likely WebP, maybe others)
which have a stacking order in the layer. Attributes:
position
hidden
paused (not animated)
Z-index
Pixel layers are simply an array of pixels that may be directly
manipulated. No attributes are planned.
For the bitmap and pixel layers associated with a text area, they will
scroll with the text in that area.
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#include "SDL.h"
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare
it ourselves here. */
@interface NSApplication(SDL_Missing_Methods)
- (void)setAppleMenu:(NSMenu *)menu;
@end
/* Use this flag to determine whether we use SDLMain.nib or not */
#define SDL_USE_NIB_FILE 0
/* Use this flag to determine whether we use CPS (docking) or not */
#define SDL_USE_CPS 1
#ifdef SDL_USE_CPS
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
static BOOL gCalledAppMainline = FALSE;
static NSString *getApplicationName(void)
{
const NSDictionary *dict;
NSString *appName = 0;
/* Determine the application name */
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
return appName;
}
#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
#endif
@interface NSApplication (SDLApplication)
@end
@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
chdir(parentdir); /* chdir to the binary app's parent */
}
CFRelease(url);
CFRelease(url2);
}
}
#if SDL_USE_NIB_FILE
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
}
#else
static void setApplicationMenu(void)
{
/* warning: this code is very odd */
NSMenu *appleMenu;
NSMenuItem *menuItem;
NSString *title;
NSString *appName;
appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Hide " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@""];
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@""];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@""];
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
[[NSApp mainMenu] addItem:menuItem];
/* Tell the application object that this is now the application menu */
[NSApp setAppleMenu:appleMenu];
/* Finally give up our references to the objects */
[appleMenu release];
[menuItem release];
}
/* Create a window menu */
static void setupWindowMenu(void)
{
NSMenu *windowMenu;
NSMenuItem *windowMenuItem;
NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@""];
[windowMenu addItem:menuItem];
[menuItem release];
/* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
/* Finally give up our references to the objects */
[windowMenu release];
[windowMenuItem release];
}
/* Replacement for NSApplicationMain */
static void CustomApplicationMain (int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDLMain *sdlMain;
/* If there's no Window Server (ie: remote headless), go in dry. */
if (_CGSDefaultConnection() == NULL) {
XPDEV_main(argc, argv, environ);
return;
}
/* Ensure the application object is initialised */
[NSApplication sharedApplication];
#ifdef SDL_USE_CPS
{
CPSProcessSerNum PSN;
/* Tell the dock about us */
if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
#endif /* SDL_USE_CPS */
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu();
setupWindowMenu();
/* Create SDLMain and make it the app delegate */
sdlMain = [[SDLMain alloc] init];
[NSApp setDelegate:sdlMain];
/* Start the main event loop */
[NSApp run];
[sdlMain release];
[pool release];
}
#endif
/*
* Catch document open requests...this lets us notice files when the app
* was launched by double-clicking a document, or when a document was
* dragged/dropped on the app's icon. You need to have a
* CFBundleDocumentsType section in your Info.plist to get this message,
* apparently.
*
* Files are added to gArgv, so to the app, they'll look like command line
* arguments. Previously, apps launched from the finder had nothing but
* an argv[0].
*
* This message may be received multiple times to open several docs on launch.
*
* This message is ignored once the app's mainline has been called.
*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
const char *temparg;
size_t arglen;
char *arg;
char **newargv;
if (!gFinderLaunch) /* MacOS is passing command line args. */
return FALSE;
if (gCalledAppMainline) /* app has started, ignore this document. */
return FALSE;
temparg = [filename UTF8String];
arglen = SDL_strlen(temparg) + 1;
arg = (char *) SDL_malloc(arglen);
if (arg == NULL)
return FALSE;
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
SDL_free(arg);
return FALSE;
}
gArgv = newargv;
SDL_strlcpy(arg, temparg, arglen);
gArgv[gArgc++] = arg;
gArgv[gArgc] = NULL;
return TRUE;
}
extern char **environ;
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
#if SDL_USE_NIB_FILE
/* Set the main menu to contain the real app name instead of "SDL App" */
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif
/* Hand off to main application code */
gCalledAppMainline = TRUE;
status = SDL_main_env (gArgc, gArgv, environ);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
}
#if SDL_USE_NIB_FILE
NSApplicationMain (argc, argv);
#else
CustomApplicationMain (argc, argv);
#endif
return 0;
}
/*
SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
The WinMain function -- calls your program's main() function
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <windows.h>
#include <malloc.h> /* For _alloca() */
#define DIR_SEPERATOR TEXT("/")
#include <direct.h>
#include "ciolib.h" /* ciolib_appname */
/* Parse a command line buffer into arguments */
static int ParseCommandLine(char *cmdline, char **argv)
{
char *bufp;
int argc;
argc = 0;
for ( bufp = cmdline; *bufp; ) {
/* Skip leading whitespace */
while ( isspace(*bufp) ) {
++bufp;
}
/* Skip over argument */
if ( *bufp == '"' ) {
++bufp;
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && (*bufp != '"') ) {
++bufp;
}
} else {
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && ! isspace(*bufp) ) {
++bufp;
}
}
if ( *bufp ) {
if ( argv ) {
*bufp = '\0';
}
++bufp;
}
}
if ( argv ) {
argv[argc] = NULL;
}
return(argc);
}
extern int CIOLIB_main(int argc, char **argv);
/* This is where execution begins [console apps] */
static int console_main(int argc, char *argv[], char **env)
{
int n;
char *bufp, *appname;
/* Get the class name from argv[0] */
appname = argv[0];
if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
appname = bufp+1;
} else
if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
appname = bufp+1;
}
if ( (bufp=strrchr(appname, '.')) == NULL )
n = strlen(appname);
else
n = (bufp-appname);
bufp = (char *)alloca(n+1);
if ( bufp == NULL ) {
return 1;
}
strncpy(bufp, appname, n);
bufp[n] = '\0';
ciolib_appname = bufp;
/* Run the application main() code */
n=CIOLIB_main(argc, argv);
/* Exit cleanly, calling atexit() functions */
exit(n);
/* Hush little compiler, don't you cry... */
return(n);
}
/* This is where execution begins [windowed apps] */
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
HINSTANCE handle;
char **argv;
int argc;
char *cmdline;
char *bufp;
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
keep them open. This is a hack.. hopefully it will be fixed
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
*/
handle = LoadLibrary(TEXT("DDRAW.DLL"));
if ( handle != NULL ) {
FreeLibrary(handle);
}
/* Grab the command line (use alloca() on Windows) */
bufp = GetCommandLine();
cmdline = (char *)alloca(strlen(bufp)+1);
if ( cmdline == NULL ) {
return 1;
}
strcpy(cmdline, bufp);
/* Parse it into argv and argc */
argc = ParseCommandLine(cmdline, NULL);
argv = (char **)alloca((argc+1)*(sizeof *argv));
if ( argv == NULL ) {
return 1;
}
ParseCommandLine(cmdline, argv);
/* Run the main program (after a little SDL initialization) */
return(console_main(argc, argv, _environ));
}
This diff is collapsed.
This diff is collapsed.
/* $Id: ansi_cio.h,v 1.11 2018/07/24 01:10:58 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#if (defined CIOLIB_IMPORTS)
#undef CIOLIB_IMPORTS
#endif
#if (defined CIOLIB_EXPORTS)
#undef CIOLIB_EXPORTS
#endif
#include "ciolib.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int CIOLIB_ANSI_TIMEOUT;
extern int (*ciolib_ansi_readbyte_cb)(void);
extern int (*ciolib_ansi_writebyte_cb)(const unsigned char ch);
extern int (*ciolib_ansi_initio_cb)(void);
extern int (*ciolib_ansi_writestr_cb)(const unsigned char *str, size_t len);
int ansi_readbyte_cb(void);
int ansi_writebyte_cb(const unsigned char ch);
int ansi_initio_cb(void);
int ansi_writestr_cb(const unsigned char *str, size_t len);
int ansi_puttext(int sx, int sy, int ex, int ey, void *fill);
int ansi_gettext(int sx, int sy, int ex, int ey, void *fill);
void ansi_textattr(int);
int ansi_kbhit(void);
void ansi_delay(long msec);
int ansi_wherey(void);
int ansi_wherex(void);
int ansi_putch(int ch);
void ansi_gotoxy(int x, int y);
int ansi_initciolib(long inmode);
void ansi_gettextinfo(struct text_info *info);
void ansi_setcursortype(int type);
int ansi_getch(void);
int ansi_getche(void);
void ansi_beep(void);
void ansi_textmode(int mode);
void ansi_suspend(void);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
#ifndef BITMAP_CON_H
#define BITMAP_CON_H
#include "vidmodes.h"
#include "threadwrap.h"
struct rectangle {
int x;
int y;
int width;
int height;
};
struct rectlist {
struct rectangle rect;
uint32_t *data;
struct rectlist *next;
};
extern struct video_stats vstat;
extern pthread_mutex_t vstatlock;
extern pthread_mutex_t blinker_lock;
#ifndef BITMAP_CIOLIB_DRIVER
/* Called from ciolib */
int bitmap_puttext(int sx, int sy, int ex, int ey, void *fill);
int bitmap_vmem_puttext(int sx, int sy, int ex, int ey, struct vmem_cell *fill);
int bitmap_vmem_gettext(int sx, int sy, int ex, int ey, struct vmem_cell *fill);
void bitmap_gotoxy(int x, int y);
void bitmap_setcursortype(int type);
int bitmap_setfont(int font, int force, int font_no);
int bitmap_getfont(int fnum);
int bitmap_loadfont(const char *filename);
int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy);
void bitmap_clreol(void);
void bitmap_clrscr(void);
void bitmap_getcustomcursor(int *s, int *e, int *r, int *b, int *v);
void bitmap_setcustomcursor(int s, int e, int r, int b, int v);
int bitmap_getvideoflags(void);
void bitmap_setvideoflags(int flags);
int bitmap_attr2palette(uint8_t attr, uint32_t *fgp, uint32_t *bgp);
int bitmap_setpixel(uint32_t x, uint32_t y, uint32_t colour);
int bitmap_setpixels(uint32_t sx, uint32_t sy, uint32_t ex, uint32_t ey, uint32_t x_off, uint32_t y_off, struct ciolib_pixels *, void *mask);
struct ciolib_pixels *bitmap_getpixels(uint32_t sx, uint32_t sy, uint32_t ex, uint32_t ey, int force);
int bitmap_get_modepalette(uint32_t p[16]);
int bitmap_set_modepalette(uint32_t p[16]);
uint32_t bitmap_map_rgb(uint16_t r, uint16_t g, uint16_t b);
void bitmap_replace_font(uint8_t id, char *name, void *data, size_t size);
int bitmap_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b);
#endif
#ifdef BITMAP_CIOLIB_DRIVER
/* Called from drivers */
int bitmap_drv_init_mode(int mode, int *width, int *height);
int bitmap_drv_init(void (*drawrect_cb) (struct rectlist *data)
,void (*flush) (void));
void bitmap_drv_request_pixels(void);
void bitmap_drv_request_some_pixels(int x, int y, int width, int height);
void bitmap_drv_free_rect(struct rectlist *rect);
#endif
#endif
This diff is collapsed.
This diff is collapsed.
/* ========================================================================= */
/* Icons. */
/* ========================================================================= */
1 ICON "syncicon64.ico"
#!/usr/bin/perl
use MIME::Decoder;
my @fontfiles=glob("/usr/share/syscons/fonts/*.fnt");
$decoder = new MIME::Decoder 'x-uuencode' or die "unsupported";
my $fonts=0;
open COUT, "> allfonts.c";
print COUT "#include <stdio.h> /* NULL */\n\n";
print COUT "#include \"allfonts.h\"\n\n";
my $started;
my %fontdata;
foreach my $fontfile (@fontfiles) {
my $width,$height;
my $decoded=`uudecode -o /dev/stdout $fontfile`;
my $bytes=length($decoded);
my $fname=$fontfile;
$fname =~ s/\.fnt$//;
$fname =~ s/^.*\///;
$fname =~ s/-/_/g;
if($fname =~ /([0-9]+)x([0-9]+)/) {
$width=$1;
$height=$2;
}
my $lines=0;
$started=0;
$fontdata{$fname}="\"";
while(length($decoded)) {
my $ch=substr($decoded,0,1);
$decoded=substr($decoded,1);
$fontdata{$fname}.='\x'.unpack("H2",$ch);
$lines++;
if($height && !($lines % $height)) {
if(length($decoded)) {
$fontdata{$fname}.="\"\n\t\t\"";
}
}
}
$fontdata{$fname}.="\"\n\t";
$fonts++;
}
open IN, "< /usr/share/syscons/fonts/INDEX.fonts";
my %fonts;
my %fontsizes;
while (<IN>) {
next if(/^\s*#/);
chomp;
my ($filename, $lang, $desc) = split(/:/);
next unless ($lang eq 'en');
next if ($filename !~ /\.fnt$/);
$filename =~ s/\..*?$//;
$filename =~ s/-/_/g;
$filename =~ s/_(8x[0-9]*)$//;
if($1 eq '8x16') {
$fontsizes{$filename} |=1;
}
elsif($1 eq '8x14') {
$fontsizes{$filename} |=2;
}
elsif($1 eq '8x8') {
$fontsizes{$filename} |=4;
}
else {
print STDERR "Unknown font size: $1\n";
}
$desc =~ s/"/\\"/g;
$desc =~ s/\s+8x[0-9]*//g;
$desc =~ s/,\s*$//g;
$fonts{$filename}=$desc;
}
close IN;
my $arraysize=(scalar keys %fonts)+1;
print COUT "struct conio_font_data_struct conio_fontdata[".$arraysize."] = {\n";
$started=0;
foreach my $font (keys %fonts) {
if($started) {
print COUT "\t,{";
}
else {
print COUT "\t {";
$started=1;
}
if($fontsizes{$font} & 1) {
print COUT $fontdata{"$font\_8x16"};
print COUT ", ";
}
else {
print COUT "NULL, ";
}
if($fontsizes{$font} & 2) {
print COUT $fontdata{"$font\_8x14"};
print COUT ", ";
}
else {
print COUT "NULL, ";
}
if($fontsizes{$font} & 4) {
print COUT $fontdata{"$font\_8x8"};
print COUT ", ";
}
else {
print COUT "NULL, ";
}
print COUT "\"$fonts{$font}\"}\n";
}
print COUT "\t,{NULL, NULL, NULL, NULL}\n";
print COUT "};\n";
close COUT;
open HOUT,"> allfonts.h";
print HOUT <<ENDOFHEADER;
#ifndef _ALLFONTS_H_
#define _ALLFONTS_H_
struct conio_font_data_struct {
char *eight_by_sixteen;
char *eight_by_fourteen;
char *eight_by_eight;
char *desc;
};
extern struct conio_font_data_struct conio_fontdata[$arraysize];
#endif
ENDOFHEADER
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment