1
0
mirror of https://github.com/abakh/nbsdgames.git synced 2024-12-04 14:46:22 -05:00

trying to fix plan9 compile for all nbsdgames with ifdefs

This commit is contained in:
Jens Staal 2020-06-11 22:46:57 +02:00
parent d7463823d6
commit ca39c007d1
11 changed files with 97 additions and 12 deletions

View File

@ -14,6 +14,12 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define size 4
#endif
typedef signed char byte;
byte size;
byte py,px;
@ -178,7 +184,9 @@ void gameplay(void){
erase();
}
int main(int argc, char** argv){
#ifndef Plan9
size=4;
#endif
if(argc==2){
if(!strcmp("help",argv[1])){
printf("Usage: %s [size]\n",argv[0]);

View File

@ -14,6 +14,11 @@
#define HLEN LEN/2
#define WID 80
#define HWID WID/2
#ifdef Plan9
#define usleep(1000x) sleep(x) /*milliseconds*/
#endif
typedef signed char byte;
chtype colors[4]={A_NORMAL,A_STANDOUT};
byte fish[10]={0};//positions
@ -394,7 +399,7 @@ void main(void){
if(!hooknum)
break;
if(input!=ERR){
sleep(1);
usleep(100000);
flushinp();
}
}

View File

@ -14,6 +14,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define size 8
#define size2 16
#endif
typedef signed char byte;
typedef unsigned char ubyte;
byte size,size2;//size2 is there to avoid a lot of multiplications
@ -162,7 +169,9 @@ void gameplay(void){
erase();
}
int main(int argc, char** argv){
#ifndef Plan9
size=8;
#endif
if(argc>=2){
size=atoi(argv[1]);
if(size<3 || size>19){
@ -199,8 +208,10 @@ int main(int argc, char** argv){
}
}
else if(size>8)//big sizes depend on color display
#ifndef Plan9
size=8;
size2=size*2;
#endif
chtype board[size][size2];
bool show[size][size2];
int input;

View File

@ -23,6 +23,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define len 10
#define wid 40
#endif
typedef signed char byte;
int len,wid,py,px;
int immunity,flight,notrail;

View File

@ -16,6 +16,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define len 8
#define wid 8
#endif
typedef signed char byte;
int len,wid,py,px,flags;
int untouched;
@ -226,7 +233,9 @@ int main(int argc, char** argv){
}
else
#ifndef Plan9
len=wid=8;
#endif
if(argc==4){
if( !sscanf(argv[3],"%d",&mscount)){
puts("Invalid input.");

View File

@ -5,19 +5,19 @@ APE=/sys/src/ape
TARG=\
battleship \
checkers \
# fifteen \
fifteen \
fisher \
jewels \
# memoblocks \
# miketron \
# mines \
# muncher \
# pipes \
# rabbithole \
memoblocks \
miketron \
mines \
muncher \
pipes \
rabbithole \
redsquare \
reversi \
# sos \
# sudoku
sos \
sudoku
BIN=/$objtype/bin/games
@ -27,6 +27,7 @@ UPDATE=\
</sys/src/cmd/mkmany
#function draw() conflicts with libdraw
CFLAGS= -c -D_POSIX_SOURCE -D_BSD_EXTENSION -DPlan9 -Ddraw=nb_draw
$O.out: /$objtype/lib/ape/libcurses.a

View File

@ -21,6 +21,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define len 10
#define wid 40
#endif
typedef signed char byte;
int len,wid,py,px;
int immunity;

View File

@ -26,6 +26,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define wid 20
#define len 14
#endif
typedef signed char byte;
typedef unsigned char bitbox;
int len,wid,py,px,fy,fx;//p: pointer f: fluid
@ -361,8 +368,10 @@ int main(int argc, char** argv){
}
else{
#ifndef Plan9
wid=20;
len=14;
#endif
}
initscr();
mousemask(ALL_MOUSE_EVENTS,NULL);

View File

@ -20,6 +20,13 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
/* The Plan9 compiler can not handle VLAs */
#ifdef Plan9
#define len 10
#define wid 20
#endif
typedef signed char byte;
typedef unsigned char bitbox;
int len,wid,py,px;
@ -193,6 +200,7 @@ int main(int argc, char** argv){
autoset=1;
}
initscr();
#ifndef Plan9
if(autoset){
if((LINES-7)/2 < 10)
len=10;
@ -204,6 +212,7 @@ int main(int argc, char** argv){
else
wid=(COLS-5)/2;
}
#endif
int carrot_count= (len*wid)/50;
int carrots_found;
time_t tstart , now, giventime=len*wid/5;

View File

@ -15,6 +15,12 @@ No rights are reserved and this software comes with no warranties of any kind to
compile with -lncurses
*/
#ifdef Plan9
#define len 5
#define wid 6
#endif
typedef signed char byte;
int len,wid,py,px;
chtype colors[6]={A_BOLD};
@ -256,8 +262,10 @@ int main(int argc, char** argv){
}
else{
#ifndef Plan9
len=5;
wid=6;
#endif
}
if(argc==4){
if( !sscanf(argv[3],"%d",&dpt)){

View File

@ -17,6 +17,13 @@ compile with -lncurses
NOTE: This program is only made for entertainment porpuses. The puzzles are generated by randomly clearing tiles on the table and are guaranteed to have a solution , but are not guaranteed to have only one unique solution.
*/
/* the Plan9 compiler can not handle VLAs */
#if defined Plan9
#define size 3
#define s 9
#endif
typedef signed char byte;
byte _wait=0, waitcycles=0;//apparently 'wait' conflicts with a variable in a library macOS includes by default
byte size,s;//s=size*size
@ -314,7 +321,9 @@ int main(int argc,char** argv){
size = *argv[1]-'0';
}
else
#ifndef Plan9
size=3;
#endif
if(argc>2){
if (strlen(argv[2])>1 || argv[2][0]-'0'>4 || argv[2][0]-'0'<= 0 ){
printf("1 <= diff <=4\n");
@ -345,7 +354,9 @@ int main(int argc,char** argv){
colors[b]=COLOR_PAIR(b+1);
}
}
#ifndef Plan9
s= size*size;
#endif
char board[s][s];
char empty[s][s];
char game[s][s];