author | nemo |
Fri, 05 Jan 2018 16:12:19 -0500 | |
changeset 12879 | 286e170f4f6b |
parent 12621 | d972b31f8881 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10015
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4 | 17 |
*) |
18 |
||
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uConsole; |
22 |
interface |
|
23 |
||
785 | 24 |
|
4 | 25 |
procedure WriteToConsole(s: shortstring); |
8437 | 26 |
procedure WriteLnToConsole(s: shortstring); |
27 |
||
28 |
var lastConsoleline : shortstring; |
|
29 |
||
30 |
implementation |
|
12621 | 31 |
uses uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF}; |
8437 | 32 |
|
33 |
||
34 |
procedure WriteToConsole(s: shortstring); |
|
4 | 35 |
begin |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
36 |
{$IFNDEF NOCONSOLE} |
8437 | 37 |
AddFileLog('[Con] ' + s); |
5661
45618bdce725
Fixed AddFileLog, there's now a log created in /sdcard/Android/data/org.hedgewars.mobile/cache/Data/
Xeli
parents:
5460
diff
changeset
|
38 |
{$IFDEF ANDROID} |
8437 | 39 |
//TODO integrate this function in the uMobile record |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6528
diff
changeset
|
40 |
Log.__android_log_write(Log.Android_LOG_DEBUG, 'HW_Engine', ShortStringAsPChar('[Con]' + s)); |
5286 | 41 |
{$ELSE} |
8437 | 42 |
Write(stderr, s); |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
43 |
{$ENDIF} |
5286 | 44 |
{$ENDIF} |
4 | 45 |
end; |
46 |
||
47 |
procedure WriteLnToConsole(s: shortstring); |
|
48 |
begin |
|
3825 | 49 |
{$IFNDEF NOCONSOLE} |
8437 | 50 |
WriteToConsole(s); |
5286 | 51 |
{$IFNDEF ANDROID} |
8437 | 52 |
WriteLn(stderr, ''); |
3818
e668970413e6
add a noconsole symbol, update the project file for appstore distribution
koda
parents:
3777
diff
changeset
|
53 |
{$ENDIF} |
5286 | 54 |
{$ENDIF} |
9958 | 55 |
lastConsoleline:= s; |
4 | 56 |
end; |
10490 | 57 |
{$IFDEF ANDROID} |
6444 | 58 |
function ShortStringAsPChar(s: shortstring) : PChar; |
6027 | 59 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6528
diff
changeset
|
60 |
if Length(s) = High(s) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6528
diff
changeset
|
61 |
Dec(s[0]); |
6027 | 62 |
s[Ord(Length(s))+1] := #0; |
10490 | 63 |
// returning pointer to stack, rly? |
6990
40e5af28d026
change every return value into a more pascal-ish form, using the name of the fucntion (helps the parser and macpas compaitilibity)
koda
parents:
6982
diff
changeset
|
64 |
ShortStringAsPChar:= @s[1]; |
6027 | 65 |
end; |
10490 | 66 |
{$ENDIF} |
4 | 67 |
|
68 |
end. |