Convert dispd to C.
This commit is contained in:
parent
8e988c1bf1
commit
114aa29878
|
@ -5,9 +5,9 @@ include ../build-aux/version.mak
|
||||||
include ../build-aux/dirs.mak
|
include ../build-aux/dirs.mak
|
||||||
|
|
||||||
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
|
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
|
||||||
CXXFLAGS?=$(OPTLEVEL)
|
CFLAGS?=$(OPTLEVEL)
|
||||||
|
|
||||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
CFLAGS:=$(CFLAGS) -Wall -Wextra
|
||||||
CPPFLAGS:=$(CPPFLAGS) -I include
|
CPPFLAGS:=$(CPPFLAGS) -I include
|
||||||
|
|
||||||
CLIENT_OBJS:=\
|
CLIENT_OBJS:=\
|
||||||
|
@ -15,16 +15,12 @@ client/library.o \
|
||||||
client/session.o \
|
client/session.o \
|
||||||
client/window.o \
|
client/window.o \
|
||||||
|
|
||||||
SERVER_OBJS:=\
|
BINS:=client/libdispd.a
|
||||||
server/dispd.o \
|
|
||||||
|
|
||||||
BINS:=server/dispd client/libdispd.a
|
|
||||||
|
|
||||||
all: $(BINS)
|
all: $(BINS)
|
||||||
|
|
||||||
.PHONY: all headers client server clean install install-include-dirs \
|
.PHONY: all headers client clean install install-include-dirs \
|
||||||
install-headers install-client-dirs install-client install-server-dirs \
|
install-headers install-client-dirs install-client
|
||||||
install-server
|
|
||||||
|
|
||||||
headers:
|
headers:
|
||||||
|
|
||||||
|
@ -33,21 +29,16 @@ client: client/libdispd.a
|
||||||
client/libdispd.a: $(CLIENT_OBJS)
|
client/libdispd.a: $(CLIENT_OBJS)
|
||||||
$(AR) rcs $@ $(CLIENT_OBJS)
|
$(AR) rcs $@ $(CLIENT_OBJS)
|
||||||
|
|
||||||
server: server/dispd
|
|
||||||
|
|
||||||
server/dispd: $(SERVER_OBJS)
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(SERVER_OBJS) -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(CLIENT_OBJS) $(SERVER_OBJS)
|
rm -f $(CLIENT_OBJS)
|
||||||
rm -f $(BINS)
|
rm -f $(BINS)
|
||||||
rm -f *.o client/*.o server/*.o
|
rm -f *.o client/*.o
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.c
|
||||||
$(CXX) -std=gnu++11 -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Installation into sysroot
|
# Installation into sysroot
|
||||||
install: install-headers install-client install-server
|
install: install-headers install-client
|
||||||
|
|
||||||
install-include-dirs: headers
|
install-include-dirs: headers
|
||||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||||
|
@ -60,9 +51,3 @@ install-client-dirs:
|
||||||
|
|
||||||
install-client: install-client-dirs client
|
install-client: install-client-dirs client
|
||||||
cp -P client/libdispd.a $(DESTDIR)$(LIBDIR)
|
cp -P client/libdispd.a $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
install-server-dirs:
|
|
||||||
mkdir -p $(DESTDIR)$(BINDIR)
|
|
||||||
|
|
||||||
install-server: install-server-dirs server
|
|
||||||
install server/dispd $(DESTDIR)$(BINDIR)
|
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
#ifndef INCLUDE_DISPD_FRAMEBUFFER_H
|
#ifndef INCLUDE_DISPD_FRAMEBUFFER_H
|
||||||
#define INCLUDE_DISPD_FRAMEBUFFER_H
|
#define INCLUDE_DISPD_FRAMEBUFFER_H
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct dispd_framebuffer
|
struct dispd_framebuffer
|
||||||
{
|
{
|
||||||
struct dispd_window* window;
|
struct dispd_window* window;
|
||||||
|
@ -40,8 +36,4 @@ struct dispd_framebuffer
|
||||||
int height;
|
int height;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
library.cpp
|
library.c
|
||||||
Main entry point of the Sortix Display Daemon.
|
Main entry point of the Sortix Display Daemon.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
extern "C" bool dispd_initialize(int* argc, char*** argv)
|
bool dispd_initialize(int* argc, char*** argv)
|
||||||
{
|
{
|
||||||
if ( !dispd__session_initialize(argc, argv) )
|
if ( !dispd__session_initialize(argc, argv) )
|
||||||
return false;
|
return false;
|
|
@ -17,7 +17,7 @@
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
session.cpp
|
session.c
|
||||||
Handles session management.
|
Handles session management.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -38,13 +39,15 @@
|
||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
const uint64_t ONE_AND_ONLY_DEVICE = 0;
|
static const uint64_t ONE_AND_ONLY_DEVICE = 0;
|
||||||
const uint64_t ONE_AND_ONLY_CONNECTOR = 0;
|
static const uint64_t ONE_AND_ONLY_CONNECTOR = 0;
|
||||||
|
|
||||||
struct dispd_session* global_session = NULL;
|
struct dispd_session* global_session = NULL;
|
||||||
|
|
||||||
bool dispd__session_initialize(int* /*argc*/, char*** /*argv*/)
|
bool dispd__session_initialize(int* argc, char*** argv)
|
||||||
{
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
size_t size = sizeof(struct dispd_session);
|
size_t size = sizeof(struct dispd_session);
|
||||||
global_session = (struct dispd_session*) malloc(size);
|
global_session = (struct dispd_session*) malloc(size);
|
||||||
if ( !global_session )
|
if ( !global_session )
|
|
@ -17,7 +17,7 @@
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
window.cpp
|
window.c
|
||||||
Handles windows.
|
Handles windows.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <ioleast.h>
|
#include <ioleast.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -39,7 +40,6 @@
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
extern "C"
|
|
||||||
struct dispd_window* dispd_create_window_game_rgba(struct dispd_session* session)
|
struct dispd_window* dispd_create_window_game_rgba(struct dispd_session* session)
|
||||||
{
|
{
|
||||||
if ( session->current_window )
|
if ( session->current_window )
|
||||||
|
@ -55,7 +55,7 @@ struct dispd_window* dispd_create_window_game_rgba(struct dispd_session* session
|
||||||
return session->current_window = window;
|
return session->current_window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" bool dispd_destroy_window(struct dispd_window* window)
|
bool dispd_destroy_window(struct dispd_window* window)
|
||||||
{
|
{
|
||||||
free(window->cached_buffer);
|
free(window->cached_buffer);
|
||||||
free(window);
|
free(window);
|
|
@ -41,7 +41,7 @@ struct dispd_framebuffer;
|
||||||
|
|
||||||
bool dispd_initialize(int* argc, char*** argv);
|
bool dispd_initialize(int* argc, char*** argv);
|
||||||
|
|
||||||
struct dispd_session* dispd_attach_default_session();
|
struct dispd_session* dispd_attach_default_session(void);
|
||||||
bool dispd_detach_session(struct dispd_session* session);
|
bool dispd_detach_session(struct dispd_session* session);
|
||||||
|
|
||||||
bool dispd_session_setup_game_rgba(struct dispd_session* session);
|
bool dispd_session_setup_game_rgba(struct dispd_session* session);
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
|
||||||
|
|
||||||
This file is part of dispd.
|
|
||||||
|
|
||||||
dispd 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 3 of the License, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
dispd is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with dispd. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
dispd.cpp
|
|
||||||
Main entry point of the Sortix Display Daemon.
|
|
||||||
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int main(int /*argc*/, char* /*argv*/[])
|
|
||||||
{
|
|
||||||
fprintf(stderr, "dispd is not implemented as a server yet.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
Loading…
Reference in New Issue