Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
NishiOwO committed Feb 12, 2025
1 parent 97c969d commit 7903b9f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 45 deletions.
21 changes: 0 additions & 21 deletions compat/Sysutils.pp

This file was deleted.

23 changes: 1 addition & 22 deletions compgen
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,5 @@
SOURCE=`ls -d ./src/*.pp`
if [ "$PC" = "fpc" ]; then
echo "./highball$EXEC: `echo $SOURCE | sed 's/\.\/src\//\.\.\/src\//g'`"
echo " fpc $FPARGS -FE. ../src/highball.pp"
elif [ "$PC" = "p2c" ]; then
echo "WARN: Not supported"
CFILES="Sysutils.c `echo $SOURCE | sed 's/\.\/src\///g' | tr '\\r\\n' ' ' | sed 's/\.pp/.c/g'`"
OBJS="`echo $CFILES | sed 's/\.c/.o/g'`"
for OUT in $CFILES; do
IN=../src/`echo $OUT | sed 's/\.c/.pp/g'`
cd src
if [ ! -f $IN ]; then
IN=../compat/`echo $OUT | sed 's/\.c/.pp/g'`
fi
cd ..
echo "$OUT: $IN"
echo " p2c -LTurbo -I../src/%s.pp -I../compat/%s.pp -o $OUT -a $IN"
done
for OUT in $OBJS; do
IN=`echo $OUT | sed 's/\.o/.c/g'`
echo "$OUT: $CFILES"
echo " $CC $CFLAGS -c -o $OUT $IN"
done
echo "./highball$EXEC: $OBJS"
echo " $CC $LDFLAGS -o ./highball$EXEC $OBJS -lp2c"
echo " fpc -Mobjfpc -Sh $FPARGS -FE. ../src/highball.pp"
fi
2 changes: 2 additions & 0 deletions config.default.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
; This is default config file for Highball.

[server]
port = 4000
13 changes: 13 additions & 0 deletions src/HighballConfig.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
unit HighballConfig;

interface
type
THighballConfig = record
ServerPort : Integer;
end;

var
HighballParsedConfig : THighballConfig = (
ServerPort : 4000;
);

function HighballParseConfig(ConfPath : String) : Integer;

implementation
Expand All @@ -13,6 +23,9 @@ function HighballParseConfig(ConfPath : String) : Integer;
begin
HighballParseConfig := 0;
INI := TINIFile.Create(ConfPath);

HighballParsedConfig.ServerPort := INI.ReadInteger('server', 'port', HighballParsedConfig.ServerPort);

INI.Free();
end;

Expand Down
6 changes: 4 additions & 2 deletions src/HighballServer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ implementation
uses
fphttpapp,
httpdefs,
httproute;
httproute,
HighballConfig,
Sysutils;

function HighballServerStart : Integer;
begin
HighballServerStart := 0;
WriteLn('Started server');
Application.Port := 1999;
Application.Port := HighballParsedConfig.ServerPort;
Application.Threaded := True;
Application.Initialize;
Application.Run;
Expand Down

0 comments on commit 7903b9f

Please sign in to comment.