Fixed warning for declarations without prototype
This commit is contained in:
parent
50a3586d2f
commit
614af18466
@ -1,25 +0,0 @@
|
||||
import socket
|
||||
import time
|
||||
import sys
|
||||
|
||||
server = "irc.rizon.net" #settings
|
||||
channel = "#soranowoto"
|
||||
botnick = "assam__"
|
||||
|
||||
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
|
||||
print("connecting to:"+server)
|
||||
|
||||
irc.connect((server, 6667))
|
||||
irc.send(bytes("NICK "+ botnick +"\n", encoding='utf8'))
|
||||
irc.send(bytes("PASS PekoRrat\n", encoding='utf8'))
|
||||
irc.send(bytes("USER "+ botnick +" " + "assam assam " + "assam\n", encoding='utf8'))
|
||||
time.sleep(5)
|
||||
irc.send(bytes("JOIN "+ channel +"\n", encoding='utf8'))
|
||||
|
||||
while 1:
|
||||
text=irc.recv(2040)
|
||||
print(text)
|
||||
|
||||
if text.find(bytes('PING', encoding='utf8')) != -1: #check if 'PING' is found
|
||||
irc.send(bytes('PONG ', encoding='utf8') + text.split()[1] + bytes('\r\n', encoding='utf8') )
|
||||
|
@ -1,26 +0,0 @@
|
||||
import socket, string, time, thread
|
||||
SERVER = 'irc.rizon.net'
|
||||
PORT = 6667
|
||||
NICKNAME = 'GataGoto'
|
||||
CHANNEL = '#soranowoto'
|
||||
|
||||
def main():
|
||||
global IRC
|
||||
IRC = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
IRC.connect((SERVER, PORT))
|
||||
thread.start_new_thread(Listener(),("Thread No:1",2))
|
||||
|
||||
def send_data(command):
|
||||
IRC.send(command + '\n')
|
||||
|
||||
def Listener():
|
||||
send_data('USER Blah')
|
||||
send_data('NICK Blah')
|
||||
while (1):
|
||||
buffer = IRC.recv(1024)
|
||||
msg = string.split(buffer)
|
||||
if msg[0] == "PING":
|
||||
print('Pinged!')
|
||||
IRC.send("PONG %s" % msg[1] + '\n')
|
||||
|
||||
main()
|
@ -4,7 +4,7 @@
|
||||
|
||||
inline bool _SetSocketBlockingEnabled(int fd, bool blocking);
|
||||
|
||||
struct Socket *socket_create(){
|
||||
struct Socket *socket_create(void){
|
||||
struct Socket *self = malloc(sizeof(struct Socket));
|
||||
self->queue = queue_create();
|
||||
return self;
|
||||
@ -36,7 +36,7 @@ void socket_init(struct Socket* self){
|
||||
queue_init(self->queue, QUEUE_SIZE);
|
||||
}
|
||||
|
||||
struct Socket *socket_init_start(){
|
||||
struct Socket *socket_init_start(void){
|
||||
struct Socket *sock = socket_create();
|
||||
socket_init(sock);
|
||||
socket_listen(sock);
|
||||
@ -61,7 +61,7 @@ void socket_listen(struct Socket *self){
|
||||
}
|
||||
}
|
||||
|
||||
void socket_accept(struct Socket *self){
|
||||
void socket_accept(struct Socket *self){
|
||||
int addrlen = sizeof(self->address);
|
||||
if ((self->endpoint = accept(self->server_fd, (struct sockaddr *)&(self->address), (socklen_t *)&addrlen)) < 0)
|
||||
{
|
||||
@ -75,12 +75,12 @@ void socket_accept(struct Socket *self){
|
||||
}
|
||||
|
||||
void update_queue(struct Socket* self){
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
Sets socket as blocking
|
||||
Returns true on success, or false if there was an error
|
||||
Returns true on success, or false if there was an error
|
||||
*/
|
||||
bool _SetSocketBlockingEnabled(int fd, bool blocking)
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef _SOCK_H_
|
||||
#define _SOCK_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h> //TODO Unnecessary
|
||||
#include <unistd.h>
|
||||
|
||||
@ -23,17 +23,17 @@ struct Socket{
|
||||
int server_fd; // File descriptor
|
||||
struct sockaddr_in address; // Socket address
|
||||
int opt;
|
||||
int endpoint;
|
||||
int endpoint;
|
||||
queue_t *queue;
|
||||
};
|
||||
|
||||
struct Socket *socket_create();
|
||||
struct Socket *socket_create(void);
|
||||
void socket_init(struct Socket*);
|
||||
void socket_destroy(struct Socket*);
|
||||
struct Socket *socket_init_start();
|
||||
struct Socket *socket_init_start(void);
|
||||
|
||||
void socket_listen(struct Socket*);
|
||||
void socket_accept();
|
||||
void socket_accept(struct Socket* self);
|
||||
|
||||
void update_queue(struct Socket*);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "bitmap.h"
|
||||
|
||||
CharacterAtlas* makeBitmaps(){
|
||||
CharacterAtlas* makeBitmaps(void){
|
||||
/////// FREETYPE2 INIT
|
||||
FT_Library ft;
|
||||
if (FT_Init_FreeType(&ft)){
|
||||
@ -60,5 +60,3 @@ CharacterAtlas* makeBitmaps(){
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ typedef struct CharacterAtlas {
|
||||
int hashmap[MAP_SIZE];
|
||||
} CharacterAtlas;
|
||||
|
||||
CharacterAtlas *makeBitmaps();
|
||||
CharacterAtlas *makeBitmaps(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@ void player_init(struct Player *self) {
|
||||
check_error(mpv_set_option(self->handle, "osc", MPV_FORMAT_FLAG, &val));
|
||||
}
|
||||
|
||||
struct Player* player_create() {
|
||||
struct Player* player_create(void) {
|
||||
return malloc(sizeof(struct Player));
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ struct Player {
|
||||
mpv_render_context *ctx;
|
||||
};
|
||||
|
||||
struct Player* player_create();
|
||||
struct Player* player_create(void);
|
||||
void player_init(struct Player *self);
|
||||
void player_destroy(struct Player *self);
|
||||
|
||||
|
@ -20,7 +20,7 @@ float quadVertices[] = {
|
||||
int fbo_width = 1920;
|
||||
int fbo_height = 1080;
|
||||
|
||||
struct Renderer* renderer_create() {
|
||||
struct Renderer* renderer_create(void) {
|
||||
return malloc(sizeof(struct Renderer));
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ struct Renderer{
|
||||
struct Shader shader;
|
||||
|
||||
|
||||
// TODO: all of these should be more generically defined
|
||||
// TODO: all of these should be more generically defined
|
||||
struct VBO screenVBO;
|
||||
struct VAO screenVAO;
|
||||
|
||||
@ -47,7 +47,7 @@ struct Renderer{
|
||||
CharacterAtlas *atlas;
|
||||
};
|
||||
|
||||
struct Renderer* renderer_create();
|
||||
struct Renderer* renderer_create(void);
|
||||
void renderer_init(struct Renderer *self);
|
||||
void renderer_destroy(struct Renderer *self);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "vao.h"
|
||||
|
||||
struct VAO vao_create() {
|
||||
struct VAO vao_create(void) {
|
||||
struct VAO self;
|
||||
glGenVertexArrays(1, &self.handle);
|
||||
return self;
|
||||
|
@ -9,7 +9,7 @@ struct VAO {
|
||||
GLuint handle;
|
||||
};
|
||||
|
||||
struct VAO vao_create();
|
||||
struct VAO vao_create(void);
|
||||
void vao_destroy(struct VAO self);
|
||||
|
||||
void vao_bind(struct VAO self);
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void _init();
|
||||
static void _update();
|
||||
static void _render();
|
||||
static void _destroy();
|
||||
static void _tick();
|
||||
static void _init(void);
|
||||
static void _update(void);
|
||||
static void _render(void);
|
||||
static void _destroy(void);
|
||||
static void _tick(void);
|
||||
|
||||
static void _size_callback(GLFWwindow *handle, int width, int height);
|
||||
static void _error_callback(int code, const char *description);
|
||||
@ -65,7 +65,7 @@ struct Window *window_create(FWindow init, FWindow destroy, FWindow tick, FWind
|
||||
return window;
|
||||
}
|
||||
|
||||
void window_loop() {
|
||||
void window_loop(void) {
|
||||
_init();
|
||||
|
||||
while (!glfwWindowShouldClose(window->handle)) {
|
||||
@ -121,27 +121,27 @@ static void _error_callback(int code, const char *description) {
|
||||
fprintf(stderr, "GLFW error %d: %s\n", code, description);
|
||||
}
|
||||
|
||||
static void _init() {
|
||||
static void _init(void) {
|
||||
window->init();
|
||||
}
|
||||
|
||||
static void _destroy() {
|
||||
static void _destroy(void) {
|
||||
window->destroy();
|
||||
player_destroy(player);
|
||||
renderer_destroy(renderer);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
static void _tick() {
|
||||
static void _tick(void) {
|
||||
window->ticks++;
|
||||
window->tick();
|
||||
}
|
||||
|
||||
static void _update() {
|
||||
static void _update(void) {
|
||||
window->update();
|
||||
}
|
||||
|
||||
static void _render() {
|
||||
static void _render(void) {
|
||||
window->frames++;
|
||||
window->render();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ struct Button {
|
||||
};
|
||||
|
||||
|
||||
typedef void (*FWindow)();
|
||||
typedef void (*FWindow)(void);
|
||||
|
||||
struct Window {
|
||||
GLFWwindow *handle;
|
||||
@ -40,6 +40,6 @@ struct Window {
|
||||
u64 ticks, tps, tick_remainder;
|
||||
};
|
||||
|
||||
void window_loop();
|
||||
void window_loop(void);
|
||||
struct Window *window_create(FWindow init, FWindow destroy, FWindow tick, FWindow update, FWindow render);
|
||||
#endif
|
||||
|
20
src/main.c
20
src/main.c
@ -2,14 +2,14 @@
|
||||
|
||||
bool SetSocketBlockingEnabled(int fd, bool blocking);
|
||||
|
||||
void _setup(){
|
||||
sock = socket_init_start();
|
||||
//window = window_create(init, destroy, tick, update, render);
|
||||
//player = player_create();
|
||||
//renderer = renderer_create();
|
||||
void _setup(void){
|
||||
//sock = socket_init_start();
|
||||
window = window_create(init, destroy, tick, update, render);
|
||||
player = player_create();
|
||||
renderer = renderer_create();
|
||||
|
||||
//player_init(player);
|
||||
//renderer_init(renderer);
|
||||
player_init(player);
|
||||
renderer_init(renderer);
|
||||
|
||||
/* Glyph shenanigans */
|
||||
//mat4s transformation = glms_ortho(0.0f, (float)(window_width), 0.0f, (float)window_height, -100, 100);
|
||||
@ -19,9 +19,7 @@ int main(int argc, char const *argv[]){
|
||||
if (argc < 2){ return -1;}
|
||||
_setup();
|
||||
|
||||
//player_loadfile(player, argv[1]);
|
||||
//window_loop();
|
||||
player_loadfile(player, argv[1]);
|
||||
window_loop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "safe_queue.h"
|
||||
|
||||
queue_t *queue_create(){
|
||||
queue_t *queue_create(void){
|
||||
queue_t *self = malloc(sizeof(queue_t));
|
||||
self->mutex = malloc(sizeof(pthread_mutex_t));
|
||||
return self;
|
||||
@ -39,7 +39,7 @@ int queue_write(queue_t *self, void* handle) {
|
||||
if (((self->head + 1) % self->size) == self->tail) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
pthread_mutex_lock(self->mutex);
|
||||
self->data[self->head] = handle;
|
||||
self->head = (self->head + 1) % self->size;
|
||||
|
@ -14,7 +14,7 @@ typedef struct {
|
||||
pthread_mutex_t *mutex;
|
||||
} queue_t;
|
||||
|
||||
queue_t *queue_create();
|
||||
queue_t *queue_create(void);
|
||||
void queue_init(queue_t *, size_t);
|
||||
void queue_destroy(queue_t *);
|
||||
queue_t *queue_init_create(size_t);
|
||||
|
@ -1,32 +1,32 @@
|
||||
#include "window_setup.h"
|
||||
|
||||
static inline void _check_error(int);
|
||||
static inline void _check_error(int);
|
||||
static inline void _processGLFWInput(GLFWwindow *window, mpv_handle *ctx);
|
||||
|
||||
|
||||
void init() {
|
||||
void init(void) {
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
void destroy(void) {
|
||||
}
|
||||
|
||||
void tick() {
|
||||
void tick(void) {
|
||||
}
|
||||
|
||||
void update() {
|
||||
void update(void) {
|
||||
_processGLFWInput(window->handle, player->handle);
|
||||
|
||||
if (wakeup)
|
||||
{
|
||||
if ((mpv_render_context_update(player->ctx) & MPV_RENDER_UPDATE_FRAME))
|
||||
{
|
||||
mpv_render_context_render(player->ctx, renderer->params_fbo);
|
||||
mpv_render_context_render(player->ctx, renderer->params_fbo);
|
||||
glViewport(0, 0, window->size.x, window->size.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void render(){
|
||||
void render(void){
|
||||
shader_bind(renderer->shaders[SHADER_MPV]);
|
||||
|
||||
vao_bind(renderer->screenVAO);
|
||||
@ -66,4 +66,3 @@ static inline void _check_error(int status)
|
||||
//exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "gfx/renderer.h"
|
||||
#include "gfx/window.h" // Also imports player.h and renderer.h
|
||||
|
||||
/*
|
||||
/*
|
||||
Global variables
|
||||
*/
|
||||
extern struct Window *window;
|
||||
@ -15,12 +15,12 @@ extern struct Renderer *renderer;
|
||||
extern int wakeup;
|
||||
|
||||
/*
|
||||
Window functions
|
||||
Window functions
|
||||
*/
|
||||
void init();
|
||||
void destroy();
|
||||
void tick();
|
||||
void update();
|
||||
void render();
|
||||
void init(void);
|
||||
void destroy(void);
|
||||
void tick(void);
|
||||
void update(void);
|
||||
void render(void);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user