diff --git a/neercs/Makefile.am b/neercs/Makefile.am
index b4814d9..9bdee43 100644
--- a/neercs/Makefile.am
+++ b/neercs/Makefile.am
@@ -61,4 +61,4 @@ old_sources = \
old/term.c \
old/widgets.c \
old/widgets.h \
- old/wm.c
+ old/wm.cpp
diff --git a/neercs/neercs.vcxproj b/neercs/neercs.vcxproj
index 052995c..66b92e7 100644
--- a/neercs/neercs.vcxproj
+++ b/neercs/neercs.vcxproj
@@ -36,11 +36,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/neercs/neercs.vcxproj.filters b/neercs/neercs.vcxproj.filters
index 47d3a61..3ccf4e3 100644
--- a/neercs/neercs.vcxproj.filters
+++ b/neercs/neercs.vcxproj.filters
@@ -8,6 +8,75 @@
video
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old\python
+
+
+ old\python
+
@@ -17,11 +86,32 @@
video
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old
+
+
+ old\python
+
{8598edd6-ce35-4250-b16e-4237b34ebd2a}
+
+ {ac200501-b60f-4451-9005-a29f3cf9bf75}
+
+
+ {9140687d-c5b2-4302-8121-9b12ebf3908e}
+
diff --git a/neercs/old/actions.c b/neercs/old/actions.c
index 4a882c3..26f7c4a 100644
--- a/neercs/old/actions.c
+++ b/neercs/old/actions.c
@@ -12,7 +12,10 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include
#include
#include
diff --git a/neercs/old/ansi.c b/neercs/old/ansi.c
index 2689e22..bc4f180 100644
--- a/neercs/old/ansi.c
+++ b/neercs/old/ansi.c
@@ -11,7 +11,15 @@
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if defined _MSC_VER
+# define inline __inline
+#endif
+
#include
#include
#include "neercs.h"
@@ -533,9 +541,9 @@ long int import_term(struct screen_list *screen_list, struct screen *sc,
/* FIXME better parsing */
if (buffer[i + 2] == '?')
{
- char arg[5];
+ char arg[5], *end;
int a = 0;
- int c, p;
+ int c, p, Pm;
for (p = 0; p < 4; p++)
{
if (buffer[i + 3 + p] >= '0'
@@ -551,8 +559,7 @@ long int import_term(struct screen_list *screen_list, struct screen *sc,
break;
}
}
- char *end;
- int Pm = strtol(arg, &end, 10);
+ Pm = strtol(arg, &end, 10);
c = buffer[i + 3 + (end - arg)];
@@ -878,7 +885,7 @@ long int import_term(struct screen_list *screen_list, struct screen *sc,
skip += final;
- string = malloc(final - (semicolon + 1) + 1);
+ string = (char *)malloc(final - (semicolon + 1) + 1);
memcpy(string, buffer + i + (semicolon + 1),
final - (semicolon + 1));
string[final - (semicolon + 1)] = '\0';
diff --git a/neercs/old/attach.c b/neercs/old/attach.c
index 8a57d5e..6685914 100644
--- a/neercs/old/attach.c
+++ b/neercs/old/attach.c
@@ -12,6 +12,12 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
+
#include
#include
#include
@@ -27,7 +33,6 @@
#include
-#include "config.h"
#include "neercs.h"
char *build_socket_path(char *socket_dir, char *session_name,
@@ -422,3 +427,4 @@ void attach(struct screen_list *screen_list)
}
}
+#endif
diff --git a/neercs/old/client.c b/neercs/old/client.c
index 725092c..2c161a7 100644
--- a/neercs/old/client.c
+++ b/neercs/old/client.c
@@ -12,7 +12,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -296,3 +300,6 @@ int mainloop_tick(char **pbuf, struct screen_list *screen_list)
return 1;
}
+
+#endif
+
diff --git a/neercs/old/configuration.c b/neercs/old/configuration.c
index 66a544e..b5c28b4 100644
--- a/neercs/old/configuration.c
+++ b/neercs/old/configuration.c
@@ -11,6 +11,12 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
+
#include
#include
#include
@@ -566,3 +572,6 @@ char *get_delay(struct screen_list *screen_list)
sprintf(r, "%d", screen_list->requested_delay);
return r;
}
+
+#endif
+
diff --git a/neercs/old/effects.c b/neercs/old/effects.c
index 7999141..4b824bc 100644
--- a/neercs/old/effects.c
+++ b/neercs/old/effects.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -276,3 +280,6 @@ int close_screen_recurrent(struct screen_list *screen_list,
screen_list->changed = 1;
return 1;
}
+
+#endif
+
diff --git a/neercs/old/grab.c b/neercs/old/grab.c
index a3f1c31..4f71c70 100644
--- a/neercs/old/grab.c
+++ b/neercs/old/grab.c
@@ -10,7 +10,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#define _XOPEN_SOURCE 500 /* getsid() */
@@ -391,3 +395,6 @@ long select_process(struct screen_list *screen_list)
}
return ret;
}
+
+#endif
+
diff --git a/neercs/old/help.c b/neercs/old/help.c
index 253ff53..aa802be 100644
--- a/neercs/old/help.c
+++ b/neercs/old/help.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -74,3 +78,5 @@ void draw_help(struct screen_list *screen_list)
caca_printf(screen_list->cv, x, y++, "");
caca_printf(screen_list->cv, x, y, "See http://caca.zoy.org/wiki/neercs for more informations");
}
+
+#endif
diff --git a/neercs/old/input.c b/neercs/old/input.c
index d36b5e7..d2b40f8 100644
--- a/neercs/old/input.c
+++ b/neercs/old/input.c
@@ -11,7 +11,11 @@
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include
#include
#include "neercs.h"
diff --git a/neercs/old/lock.c b/neercs/old/lock.c
index 925c297..b5650ec 100644
--- a/neercs/old/lock.c
+++ b/neercs/old/lock.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -219,3 +223,5 @@ int validate_lock(struct screen_list *screen_list, char *user, char *pass)
return 1;
}
+
+#endif
diff --git a/neercs/old/main.c b/neercs/old/main.c
index 621fcdf..edfaf91 100644
--- a/neercs/old/main.c
+++ b/neercs/old/main.c
@@ -12,7 +12,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -26,8 +30,6 @@
#include
#include
-
-
#if !defined HAVE_GETOPT_LONG
# include "mygetopt.h"
#elif defined HAVE_GETOPT_H
@@ -322,3 +324,6 @@ int handle_command_line(int argc, char *argv[],
}
return s;
}
+
+#endif
+
diff --git a/neercs/old/mygetopt.c b/neercs/old/mygetopt.c
index 44f6863..ad1b79e 100644
--- a/neercs/old/mygetopt.c
+++ b/neercs/old/mygetopt.c
@@ -15,7 +15,9 @@
* mygetopt.c: getopt_long reimplementation
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
#include
#include
@@ -44,7 +46,7 @@ int mygetopt(int argc, char *const _argv[], const char *optstring,
if (flag[0] == '-' && flag[1] != '-')
{
- char *tmp;
+ char const *tmp;
int ret = flag[1];
if (ret == '\0')
diff --git a/neercs/old/mytrace.c b/neercs/old/mytrace.c
index 7d8a7f0..e1ce6c9 100644
--- a/neercs/old/mytrace.c
+++ b/neercs/old/mytrace.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -783,3 +787,6 @@ static void print_registers(pid_t pid)
#endif /* DEBUG */
#endif /* USE_GRAB */
+
+#endif /* _WIN32 */
+
diff --git a/neercs/old/mytrace.h b/neercs/old/mytrace.h
index d0f9d61..bcf5ea6 100644
--- a/neercs/old/mytrace.h
+++ b/neercs/old/mytrace.h
@@ -10,6 +10,8 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
+#if !defined _WIN32
+
#include
struct mytrace;
@@ -31,3 +33,5 @@ int mytrace_exec(struct mytrace *t, char const *command);
int mytrace_tcgets(struct mytrace *t, int fd, struct termios *tos);
int mytrace_tcsets(struct mytrace *t, int fd, struct termios *tos);
int mytrace_sctty(struct mytrace *t, int fd);
+
+#endif
diff --git a/neercs/old/python/interpreter.c b/neercs/old/python/interpreter.c
index 267d860..bac7d9d 100644
--- a/neercs/old/python/interpreter.c
+++ b/neercs/old/python/interpreter.c
@@ -10,7 +10,9 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
#ifdef USE_PYTHON
diff --git a/neercs/old/python/py_module.c b/neercs/old/python/py_module.c
index 17ce2b6..874de0d 100644
--- a/neercs/old/python/py_module.c
+++ b/neercs/old/python/py_module.c
@@ -10,7 +10,9 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
#ifdef USE_PYTHON
diff --git a/neercs/old/recurrent.c b/neercs/old/recurrent.c
index 7c8de1b..b4d3b2e 100644
--- a/neercs/old/recurrent.c
+++ b/neercs/old/recurrent.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -110,3 +114,5 @@ int remove_recurrent(struct recurrent_list *list, int n)
list->count--;
return 0;
}
+
+#endif
diff --git a/neercs/old/screen_list.c b/neercs/old/screen_list.c
index a9871c1..ba91edc 100644
--- a/neercs/old/screen_list.c
+++ b/neercs/old/screen_list.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -214,3 +218,6 @@ void free_screen_list(struct screen_list *screen_list)
free(screen_list);
}
+
+#endif
+
diff --git a/neercs/old/screens.c b/neercs/old/screens.c
index 94e2954..49101af 100644
--- a/neercs/old/screens.c
+++ b/neercs/old/screens.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -332,3 +336,6 @@ int update_screens_contents(struct screen_list *screen_list)
}
return refresh;
}
+
+#endif
+
diff --git a/neercs/old/screensaver.c b/neercs/old/screensaver.c
index 9e9ab89..2226daa 100644
--- a/neercs/old/screensaver.c
+++ b/neercs/old/screensaver.c
@@ -11,7 +11,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -185,3 +189,5 @@ void screensaver_flying_toasters(struct screen_list *screen_list)
d->s[i] = ((d->s[i] + 24) % (3 * PRECISION));
}
}
+
+#endif
diff --git a/neercs/old/server.c b/neercs/old/server.c
index 3c450e2..56dfe9a 100644
--- a/neercs/old/server.c
+++ b/neercs/old/server.c
@@ -12,7 +12,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#include
#include
@@ -678,3 +682,5 @@ long long get_us(void)
gettimeofday(&tv, NULL);
return (tv.tv_sec * (1000000) + tv.tv_usec);
}
+
+#endif
diff --git a/neercs/old/term.c b/neercs/old/term.c
index 032f9b5..468683e 100644
--- a/neercs/old/term.c
+++ b/neercs/old/term.c
@@ -10,7 +10,11 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if !defined _WIN32
#define _XOPEN_SOURCE
#include
@@ -131,3 +135,6 @@ int update_terms(struct screen_list *screen_list)
}
return refresh;
}
+
+#endif
+
diff --git a/neercs/old/widgets.c b/neercs/old/widgets.c
index a181660..f0eae7d 100644
--- a/neercs/old/widgets.c
+++ b/neercs/old/widgets.c
@@ -18,7 +18,7 @@ static void widget_ibox_del_char(struct input_box *box);
struct input_box *widget_ibox_init(caca_canvas_t *cv, int w, int h)
{
- struct input_box *box = malloc(sizeof(struct input_box));
+ struct input_box *box = (struct input_box *)malloc(sizeof(struct input_box));
if (!box)
return NULL;
box->cv = cv;
diff --git a/neercs/old/widgets.h b/neercs/old/widgets.h
index b8e045d..b5f3b83 100644
--- a/neercs/old/widgets.h
+++ b/neercs/old/widgets.h
@@ -10,7 +10,9 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
#include
#include
diff --git a/neercs/old/wm.c b/neercs/old/wm.cpp
similarity index 95%
rename from neercs/old/wm.c
rename to neercs/old/wm.cpp
index 006192a..908f60c 100644
--- a/neercs/old/wm.c
+++ b/neercs/old/wm.cpp
@@ -11,19 +11,33 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
-#include "config.h"
+#if defined HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if defined _XBOX
+# define _USE_MATH_DEFINES /* for M_PI */
+# include
+# undef near /* Fuck Microsoft */
+# undef far /* Fuck Microsoft again */
+#elif defined _WIN32
+# define _USE_MATH_DEFINES /* for M_PI */
+# define WIN32_LEAN_AND_MEAN
+# include
+#endif
#include
#include
#include
#include
+#include "core.h"
#include "neercs.h"
void resize_screen(struct screen *s, int w, int h)
{
- caca_canvas_t *old, *new;
+ caca_canvas_t *oldc, *newc;
if (w == s->w && h == s->h)
return;
@@ -39,12 +53,12 @@ void resize_screen(struct screen *s, int w, int h)
* caca_set_canvas_boundaries() is bugged as hell, so let's resize it by
* hands
*/
- old = s->cv;
- new = caca_create_canvas(w, h);
- caca_blit(new, 0, 0, old, NULL);
- s->cv = new;
- caca_gotoxy(new, caca_get_cursor_x(old), caca_get_cursor_y(old));
- caca_free_canvas(old);
+ oldc = s->cv;
+ newc = caca_create_canvas(w, h);
+ caca_blit(newc, 0, 0, oldc, NULL);
+ s->cv = newc;
+ caca_gotoxy(newc, caca_get_cursor_x(oldc), caca_get_cursor_y(oldc));
+ caca_free_canvas(oldc);
set_tty_size(s->fd, w, h);
s->orig_w = s->w;
@@ -446,8 +460,8 @@ void wm_refresh_cube(struct screen_list *screen_list)
if (screen_list->cube.side == 1)
angle = -angle;
- float sina = sin(angle);
- float cosa = cos(angle);
+ float sina = lol::sin(angle);
+ float cosa = lol::cos(angle);
for (i = 0; i < 12; i++)
{