Function to compare string to char ftw
authorunc0rr
Fri, 11 May 2012 21:10:58 +0400
changeset 7054 7e8fb07ef91c
parent 7053 8c9dcaedc7a8
child 7055 4c495c8f02da
Function to compare string to char ftw
hedgewars/hwengine.pas
hedgewars/pas2c.h
hedgewars/pas2cSystem.pas
tools/pas2c.hs
--- a/hedgewars/hwengine.pas	Fri May 11 20:01:57 2012 +0400
+++ b/hedgewars/hwengine.pas	Fri May 11 21:10:58 2012 +0400
@@ -97,7 +97,7 @@
             DoTimer:= true;
             end;
         gsSuspend:
-            exit;
+            exit(false);
             end;
 
     SwapBuffers;
--- a/hedgewars/pas2c.h	Fri May 11 20:01:57 2012 +0400
+++ b/hedgewars/pas2c.h	Fri May 11 21:10:58 2012 +0400
@@ -76,6 +76,7 @@
 string255 _strappend(string255 s, char c);
 string255 _strprepend(char c, string255 s);
 bool _strcompare(string255 a, string255 b);
+bool _strcomparec(string255 a, char b);
 bool _strncompare(string255 a, string255 b);
 char * _pchar(string255 s);
 
@@ -99,6 +100,8 @@
 void BlockWrite_(int f, void * p, int size);
 void close(int f);
 
+void write(string255 s);
+
 bool DirectoryExists(string255 dir);
 bool FileExists(string255 filename);
 
@@ -114,6 +117,7 @@
 
 bool Assigned(void * a);
 
+void randomize();
 int random(int max);
 int abs(int i);
 double sqr(double n);
@@ -123,3 +127,6 @@
 
 string255 ParamStr(int n);
 int ParamCount();
+
+#define val(a, b) _val(a, (LongInt*)&(b))
+void _val(string255 str, LongInt * a);
--- a/hedgewars/pas2cSystem.pas	Fri May 11 20:01:57 2012 +0400
+++ b/hedgewars/pas2cSystem.pas	Fri May 11 21:10:58 2012 +0400
@@ -134,7 +134,7 @@
     Assigned : function : boolean;
     
     _strconcat, _strappend, _strprepend : function : string;
-    _strcompare, _strncompare : function : boolean;
+    _strcompare, _strncompare, _strcomparec : function : boolean;
 
     png_structp, png_set_write_fn, png_get_io_ptr,
     png_get_libpng_ver, png_create_write_struct,
--- a/tools/pas2c.hs	Fri May 11 20:01:57 2012 +0400
+++ b/tools/pas2c.hs	Fri May 11 21:10:58 2012 +0400
@@ -673,7 +673,8 @@
         ("+", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcat" (BTFunction 2 BTString))
         ("+", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strappend" (BTFunction 2 BTString))
         ("+", BTChar, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strprepend" (BTFunction 2 BTString))
-        ("==", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcompare" (BTFunction 2 BTBool))
+        ("==", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcomparec" (BTFunction 2 BTBool))
+        ("==", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcompare" (BTFunction 2 BTBool))
         ("!=", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strncompare" (BTFunction 2 BTBool))
         ("&", BTBool, _) -> return $ parens e1 <+> text "&&" <+> parens e2
         ("|", BTBool, _) -> return $ parens e1 <+> text "||" <+> parens e2