Pārlūkot izejas kodu

neercs: start porting the old code to Windows; this breaks the Visual Studio

build until further fixes are made.
master
Sam Hocevar pirms 12 gadiem
vecāks
revīzija
e42a4263d6
28 mainītis faili ar 298 papildinājumiem un 41 dzēšanām
  1. +1
    -1
      neercs/Makefile.am
  2. +28
    -0
      neercs/neercs.vcxproj
  3. +90
    -0
      neercs/neercs.vcxproj.filters
  4. +4
    -1
      neercs/old/actions.c
  5. +13
    -6
      neercs/old/ansi.c
  6. +7
    -1
      neercs/old/attach.c
  7. +8
    -1
      neercs/old/client.c
  8. +9
    -0
      neercs/old/configuration.c
  9. +8
    -1
      neercs/old/effects.c
  10. +8
    -1
      neercs/old/grab.c
  11. +7
    -1
      neercs/old/help.c
  12. +5
    -1
      neercs/old/input.c
  13. +7
    -1
      neercs/old/lock.c
  14. +8
    -3
      neercs/old/main.c
  15. +4
    -2
      neercs/old/mygetopt.c
  16. +8
    -1
      neercs/old/mytrace.c
  17. +4
    -0
      neercs/old/mytrace.h
  18. +3
    -1
      neercs/old/python/interpreter.c
  19. +3
    -1
      neercs/old/python/py_module.c
  20. +7
    -1
      neercs/old/recurrent.c
  21. +8
    -1
      neercs/old/screen_list.c
  22. +8
    -1
      neercs/old/screens.c
  23. +7
    -1
      neercs/old/screensaver.c
  24. +7
    -1
      neercs/old/server.c
  25. +8
    -1
      neercs/old/term.c
  26. +1
    -1
      neercs/old/widgets.c
  27. +3
    -1
      neercs/old/widgets.h
  28. +24
    -10
      neercs/old/wm.cpp

+ 1
- 1
neercs/Makefile.am Parādīt failu

@@ -61,4 +61,4 @@ old_sources = \
old/term.c \
old/widgets.c \
old/widgets.h \
old/wm.c
old/wm.cpp

+ 28
- 0
neercs/neercs.vcxproj Parādīt failu

@@ -36,11 +36,39 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="neercs.h" />
<ClInclude Include="old\mygetopt.h" />
<ClInclude Include="old\mytrace.h" />
<ClInclude Include="old\neercs.h" />
<ClInclude Include="old\python\py_module.h" />
<ClInclude Include="old\widgets.h" />
<ClInclude Include="video\render.h" />
<ClInclude Include="video\text-render.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="neercs.cpp" />
<ClCompile Include="old\actions.c" />
<ClCompile Include="old\ansi.c" />
<ClCompile Include="old\attach.c" />
<ClCompile Include="old\client.c" />
<ClCompile Include="old\configuration.c" />
<ClCompile Include="old\effects.c" />
<ClCompile Include="old\grab.c" />
<ClCompile Include="old\help.c" />
<ClCompile Include="old\input.c" />
<ClCompile Include="old\lock.c" />
<ClCompile Include="old\main.c" />
<ClCompile Include="old\mygetopt.c" />
<ClCompile Include="old\mytrace.c" />
<ClCompile Include="old\python\interpreter.c" />
<ClCompile Include="old\python\py_module.c" />
<ClCompile Include="old\recurrent.c" />
<ClCompile Include="old\screens.c" />
<ClCompile Include="old\screensaver.c" />
<ClCompile Include="old\screen_list.c" />
<ClCompile Include="old\server.c" />
<ClCompile Include="old\term.c" />
<ClCompile Include="old\widgets.c" />
<ClCompile Include="old\wm.cpp" />
<ClCompile Include="video\render.cpp" />
<ClCompile Include="video\text-render.cpp" />
</ItemGroup>


+ 90
- 0
neercs/neercs.vcxproj.filters Parādīt failu

@@ -8,6 +8,75 @@
<ClCompile Include="video\text-render.cpp">
<Filter>video</Filter>
</ClCompile>
<ClCompile Include="old\actions.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\ansi.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\attach.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\client.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\configuration.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\effects.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\grab.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\help.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\input.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\lock.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\main.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\mygetopt.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\mytrace.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\recurrent.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\screen_list.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\screens.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\screensaver.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\server.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\term.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\widgets.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\wm.cpp">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\python\interpreter.c">
<Filter>old\python</Filter>
</ClCompile>
<ClCompile Include="old\python\py_module.c">
<Filter>old\python</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="neercs.h" />
@@ -17,11 +86,32 @@
<ClInclude Include="video\text-render.h">
<Filter>video</Filter>
</ClInclude>
<ClInclude Include="old\mygetopt.h">
<Filter>old</Filter>
</ClInclude>
<ClInclude Include="old\mytrace.h">
<Filter>old</Filter>
</ClInclude>
<ClInclude Include="old\neercs.h">
<Filter>old</Filter>
</ClInclude>
<ClInclude Include="old\widgets.h">
<Filter>old</Filter>
</ClInclude>
<ClInclude Include="old\python\py_module.h">
<Filter>old\python</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="video">
<UniqueIdentifier>{8598edd6-ce35-4250-b16e-4237b34ebd2a}</UniqueIdentifier>
</Filter>
<Filter Include="old">
<UniqueIdentifier>{ac200501-b60f-4451-9005-a29f3cf9bf75}</UniqueIdentifier>
</Filter>
<Filter Include="old\python">
<UniqueIdentifier>{9140687d-c5b2-4302-8121-9b12ebf3908e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<LolFxCompile Include="video\blurh.lolfx">


+ 4
- 1
neercs/old/actions.c Parādīt failu

@@ -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 <caca.h>
#include <errno.h>
#include <string.h>


+ 13
- 6
neercs/old/ansi.c Parādīt failu

@@ -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 <string.h>
#include <caca.h>
#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';


+ 7
- 1
neercs/old/attach.c Parādīt failu

@@ -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 <errno.h>
#include <fcntl.h>
#include <glob.h>
@@ -27,7 +33,6 @@

#include <caca.h>

#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

+ 8
- 1
neercs/old/client.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -296,3 +300,6 @@ int mainloop_tick(char **pbuf, struct screen_list *screen_list)

return 1;
}

#endif


+ 9
- 0
neercs/old/configuration.c Parādīt failu

@@ -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 <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -566,3 +572,6 @@ char *get_delay(struct screen_list *screen_list)
sprintf(r, "%d", screen_list->requested_delay);
return r;
}

#endif


+ 8
- 1
neercs/old/effects.c Parādīt failu

@@ -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 <stdio.h>
#include <stdlib.h>
@@ -276,3 +280,6 @@ int close_screen_recurrent(struct screen_list *screen_list,
screen_list->changed = 1;
return 1;
}

#endif


+ 8
- 1
neercs/old/grab.c Parādīt failu

@@ -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


+ 7
- 1
neercs/old/help.c Parādīt failu

@@ -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 <stdio.h>
#include <stdlib.h>
@@ -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

+ 5
- 1
neercs/old/input.c Parādīt failu

@@ -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 <caca.h>
#include <string.h>
#include "neercs.h"


+ 7
- 1
neercs/old/lock.c Parādīt failu

@@ -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 <stdio.h>
#include <stdlib.h>
@@ -219,3 +223,5 @@ int validate_lock(struct screen_list *screen_list, char *user, char *pass)

return 1;
}

#endif

+ 8
- 3
neercs/old/main.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -26,8 +30,6 @@
#include <sys/time.h>
#include <time.h>



#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


+ 4
- 2
neercs/old/mygetopt.c Parādīt failu

@@ -15,7 +15,9 @@
* mygetopt.c: getopt_long reimplementation
*/

#include "config.h"
#if defined HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <string.h>
@@ -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')


+ 8
- 1
neercs/old/mytrace.c Parādīt failu

@@ -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 <errno.h>
#include <fcntl.h>
@@ -783,3 +787,6 @@ static void print_registers(pid_t pid)
#endif /* DEBUG */

#endif /* USE_GRAB */

#endif /* _WIN32 */


+ 4
- 0
neercs/old/mytrace.h Parādīt failu

@@ -10,6 +10,8 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

#if !defined _WIN32

#include <termios.h>

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

+ 3
- 1
neercs/old/python/interpreter.c Parādīt failu

@@ -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



+ 3
- 1
neercs/old/python/py_module.c Parādīt failu

@@ -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



+ 7
- 1
neercs/old/recurrent.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -110,3 +114,5 @@ int remove_recurrent(struct recurrent_list *list, int n)
list->count--;
return 0;
}

#endif

+ 8
- 1
neercs/old/screen_list.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -214,3 +218,6 @@ void free_screen_list(struct screen_list *screen_list)

free(screen_list);
}

#endif


+ 8
- 1
neercs/old/screens.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -332,3 +336,6 @@ int update_screens_contents(struct screen_list *screen_list)
}
return refresh;
}

#endif


+ 7
- 1
neercs/old/screensaver.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -185,3 +189,5 @@ void screensaver_flying_toasters(struct screen_list *screen_list)
d->s[i] = ((d->s[i] + 24) % (3 * PRECISION));
}
}

#endif

+ 7
- 1
neercs/old/server.c Parādīt failu

@@ -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 <stdio.h>
#include <string.h>
@@ -678,3 +682,5 @@ long long get_us(void)
gettimeofday(&tv, NULL);
return (tv.tv_sec * (1000000) + tv.tv_usec);
}

#endif

+ 8
- 1
neercs/old/term.c Parādīt failu

@@ -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 <stdlib.h>
@@ -131,3 +135,6 @@ int update_terms(struct screen_list *screen_list)
}
return refresh;
}

#endif


+ 1
- 1
neercs/old/widgets.c Parādīt failu

@@ -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;


+ 3
- 1
neercs/old/widgets.h Parādīt failu

@@ -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 <stdio.h>
#include <string.h>


neercs/old/wm.c → neercs/old/wm.cpp Parādīt failu

@@ -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 <xtl.h>
# 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 <windows.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <caca.h>

#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++)
{

Notiek ielāde…
Atcelt
Saglabāt