diff --git a/data/common/File Managers/fNav/fnav.set b/data/common/File Managers/fNav/fnav.set
index b525b59eee..b3a92e9a1a 100644
--- a/data/common/File Managers/fNav/fnav.set
+++ b/data/common/File Managers/fNav/fnav.set
@@ -1 +1 @@
-/sys/TinyPad: asm, inc, txt, mac, log, dat
/sys/media/kiv: gif, bmp, png, tga, jpg, ico, cur, tif, tiff, jpeg, ppm, pgm, pbm, pnm, pcx, wbmp, xcf
/sys/Network/Webview: htm, html, mht, xhtml
/sys/fb2read: fb2
/sys/develop/cObj: obj
/sys/skincfg: skn
/sys/rtfRead: rtf
/sys/develop/t_edit: cpp, h, c, c--, pas, set, ext, ini
/sys/media/pixie/pixie: mp3
/sys/media/AC97SND: wav, xm
/sys/media/MIDAMP: mid
/sys/media/listplay: m3u, lap, asf
/sys/shell: sh
/sys/3d/view3ds: 3ds, asc
/sys/graph: cvs
/sys/unz: zip, 7z
/kolibrios/media/updf: pdf
/kolibrios/media/fplay: avi, mpg, mov, flv, wmv, vob, mkv, mp4, mpeg, divx, 3gp, webm
/kolibrios/emul/zsnes: smc
/kolibrios/emul/psx4all: mcr
/kolibrios/emul/fceu/fceu: nes
/kolibrios/emul/e80/e80: sna
/kolibrios/emul/gameboy: gb, gbc
/kolibrios/emul/pokemini: min
/sys/develop/heed:
\ No newline at end of file
+/sys/TinyPad: asm, inc, txt, mac, log, dat
/sys/media/kiv: gif, bmp, png, tga, jpg, ico, cur, tif, tiff, jpeg, ppm, pgm, pbm, pnm, pcx, wbmp, xcf
/sys/Network/Webview: htm, html, mht, xhtml
/sys/fb2read: fb2
/sys/develop/cObj: obj
/sys/skincfg: skn
/sys/rtfRead: rtf
/sys/develop/t_edit: cpp, h, c, c--, pas, set, ext, ini
/sys/media/pixie/pixie: mp3
/sys/media/AC97SND: wav, xm
/sys/media/MIDAMP: mid
/sys/media/listplay: m3u, lap, asf
/sys/shell: sh
/sys/3d/view3ds: 3ds, asc
/sys/graph: cvs
/sys/unz: zip, 7z
/sys/table: csv
/kolibrios/media/updf: pdf
/kolibrios/media/fplay: avi, mpg, mov, flv, wmv, vob, mkv, mp4, mpeg, divx, 3gp, webm
/kolibrios/emul/zsnes: smc
/kolibrios/emul/psx4all: mcr
/kolibrios/emul/fceu/fceu: nes
/kolibrios/emul/e80/e80: sna
/kolibrios/emul/gameboy: gb, gbc
/kolibrios/emul/pokemini: min
/sys/develop/heed:
\ No newline at end of file
diff --git a/data/common/File Managers/icons.ini b/data/common/File Managers/icons.ini
index fd2a31f395..579a9c17d8 100644
--- a/data/common/File Managers/icons.ini
+++ b/data/common/File Managers/icons.ini
@@ -165,6 +165,7 @@ c=27
java=27
pas=27
fb2=29
+csv=21
[icons32]
=45
@@ -219,3 +220,4 @@ vox=30
rft=85
mobi=85
djvu=85
+csv=28
\ No newline at end of file
diff --git a/data/common/File Managers/kfar.ini b/data/common/File Managers/kfar.ini
index b0065fcbcf..758d3486eb 100644
--- a/data/common/File Managers/kfar.ini
+++ b/data/common/File Managers/kfar.ini
@@ -60,6 +60,7 @@ gbc=/kolibrios/emul/gameboy
min=/kolibrios/emul/pokemini
nc=/kolibrios/utils/cnc_editor/cnc_editor
kf=/sys/KF_VIEW
+csv=/sys/table
[Menu]
AsmMenu1=&Edit,/sys/TinyPad
diff --git a/data/common/File Managers/kfm.ini b/data/common/File Managers/kfm.ini
index 01a9123963..9d8d64dfb5 100644
--- a/data/common/File Managers/kfm.ini
+++ b/data/common/File Managers/kfm.ini
@@ -179,9 +179,10 @@ mid /sys/media/midamp
rtf /sys/rtfread
3ds /sys/3d/view3ds
asc /sys/3d/view3ds
-lif /kolibrios/demos/life2
skn /sys/skincfg
kf /sys/KF_VIEW
+csv /sys/table
+lif /kolibrios/demos/life2
pdf /kolibrios/media/updf
avi /kolibrios/media/fplay_run
mpg /kolibrios/media/fplay_run
diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini
index ae5124faa3..268a63972b 100644
--- a/data/common/settings/assoc.ini
+++ b/data/common/settings/assoc.ini
@@ -139,6 +139,8 @@ midi=/sys/media/midamp
rtf=/sys/rtfread
+csv=/sys/table
+
grf=/sys/graph
com=$DosBox
@@ -176,4 +178,3 @@ bas=/kolibrios/develop/TinyBasic/TinyBasic
vox=/kolibrios/3D/voxel_editor/VOXEL_EDITOR
-
diff --git a/programs/cmm/txtread/txtread.c b/programs/cmm/txtread/txtread.c
index f808d06c33..3bd1f1400b 100644
--- a/programs/cmm/txtread/txtread.c
+++ b/programs/cmm/txtread/txtread.c
@@ -126,6 +126,7 @@ void main()
{
InitDlls();
OpenDialog_init stdcall (#o_dialog);
+ if (param) strcpy(#openfile_path, #param);
LoadIniSettings();
EventSetColorScheme(curcol_scheme);
kfont.init(DEFAULT_FONT);
diff --git a/programs/games/rforces/trunk/cmp.bat b/programs/games/rforces/trunk/cmp.bat
index 226f2b268d..1bed63aeb1 100644
--- a/programs/games/rforces/trunk/cmp.bat
+++ b/programs/games/rforces/trunk/cmp.bat
@@ -4,4 +4,5 @@ call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
@link /nologo /manifest:no /entry:crtStartUp /subsystem:native /base:0 /fixed /align:16 /nodefaultlib rforces.obj kosFile.obj kosSyst.obj mcsmemm.obj
@pe2kos rforces.exe rforces
@del rforces.exe
+@del *.obj
pause
\ No newline at end of file
diff --git a/programs/other/graph/hello.cpp b/programs/other/graph/hello.cpp
index ac9ac3ab14..9a1feac607 100644
--- a/programs/other/graph/hello.cpp
+++ b/programs/other/graph/hello.cpp
@@ -1,6 +1,5 @@
#include "func.h"
#include "parser.h"
-#include "kolibri.h"
#include "use_library.h"
const char header[] = "Graph";
diff --git a/programs/other/graph/hello.dsp b/programs/other/graph/hello.dsp
index b415fa839f..1065ea0932 100644
--- a/programs/other/graph/hello.dsp
+++ b/programs/other/graph/hello.dsp
@@ -76,10 +76,6 @@ SOURCE=.\hello.cpp
# End Source File
# Begin Source File
-SOURCE=.\kolibri.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\KosFile.cpp
# End Source File
# Begin Source File
@@ -112,10 +108,6 @@ SOURCE=.\func.h
# End Source File
# Begin Source File
-SOURCE=.\kolibri.h
-# End Source File
-# Begin Source File
-
SOURCE=.\KosFile.h
# End Source File
# Begin Source File
diff --git a/programs/other/graph/kolibri.cpp b/programs/other/graph/kolibri.cpp
deleted file mode 100644
index d3f5a12faa..0000000000
--- a/programs/other/graph/kolibri.cpp
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/programs/other/graph/kolibri.h b/programs/other/graph/kolibri.h
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/programs/other/table/build.bat b/programs/other/table/build.bat
index 3e41cba6b6..9f67cb2bfb 100644
--- a/programs/other/table/build.bat
+++ b/programs/other/table/build.bat
@@ -2,8 +2,8 @@ call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
@cl /c /O2 /nologo /GS- /GR- /fp:fast *.cpp
@link /nologo /manifest:no /entry:crtStartUp /subsystem:native /base:0 /fixed /align:16 /nodefaultlib hello.obj *.obj
-@del *.kex
-@pe2kos hello.exe hello.kex
+@del table
+@pe2kos hello.exe table
@del hello.exe
@del *.obj
pause
\ No newline at end of file
diff --git a/programs/other/table/calc.cpp b/programs/other/table/calc.cpp
index 9fabd24a61..3e5954ee92 100644
--- a/programs/other/table/calc.cpp
+++ b/programs/other/table/calc.cpp
@@ -588,6 +588,31 @@ char *Kos_FileRead(kosFileInfo &fileInfo, int &code)
return r;
}
+char GetCsvSeparator(char *fname)
+{
+ char buffer[512];
+ kosFileInfo fileInfo;
+
+ rtlDebugOutString("hi");
+ rtlDebugOutString(fname);
+
+ strcpy(fileInfo.fileURL, fname);
+ fileInfo.OffsetLow = 0;
+ fileInfo.OffsetHigh = 0;
+ fileInfo.dataCount = 512;
+ fileInfo.rwMode = 0;
+ fileInfo.bufferPtr = (Byte *)buffer;
+
+ if (kos_FileSystemAccess(&fileInfo) == 0) {
+ int separ_coma = chrnum(buffer, ',');
+ int separ_semicolon = chrnum(buffer, ';');
+ //kos_DebugValue(",", separ_coma);
+ //kos_DebugValue(";", separ_semicolon);
+ if (separ_semicolon>separ_coma) return ';';
+ }
+ return ',';
+}
+
int LoadCSV(char *fname)
{
// clear the table
@@ -598,6 +623,8 @@ int LoadCSV(char *fname)
fileInfo.OffsetLow = 0;
fileInfo.OffsetHigh = 0;
+ char separator = GetCsvSeparator(fileInfo.fileURL);
+
char *line;
int col = 1, row = 1;
@@ -626,7 +653,7 @@ int LoadCSV(char *fname)
{
char c = line[i];
if (!c)
- c = ';';
+ c = separator;
int yes_semicolon = 0;
switch (inPar)
@@ -638,7 +665,7 @@ int LoadCSV(char *fname)
}
else
{
- if (c == ';')
+ if (c == separator)
yes_semicolon = 1;
}
break;
@@ -652,7 +679,7 @@ int LoadCSV(char *fname)
}
/*else
{
- if (c == ';')
+ if (c == separator)
yes_semicolon = 1;
}*/
@@ -660,7 +687,7 @@ int LoadCSV(char *fname)
}
if (yes_semicolon)
{
- // итак, line[i] = ';'
+ // итак, line[i] = separator
int tmp = line[start] == '"' ? 1 : 0;
int sz = i - start - tmp * 2;
if (sz > 0)
diff --git a/programs/other/table/hello.cpp b/programs/other/table/hello.cpp
index dc7046046f..f86a0844d8 100644
--- a/programs/other/table/hello.cpp
+++ b/programs/other/table/hello.cpp
@@ -6,7 +6,12 @@
#include "calc.h"
#include "use_library.h"
-#define TABLE_VERSION "0.99"
+#ifdef AUTOBUILD
+extern char params[1024];
+#endif
+char params[1024];
+
+#define TABLE_VERSION "0.99.1"
// strings
const char *sFileSign = "KolibriTable File\n";
@@ -1043,6 +1048,22 @@ void process_key()
}
}
+void EventLoadFile()
+{
+ stop_edit();
+ int r = LoadFile(fname);
+ char *result;
+ if (r > 0) {
+ calculate_values();
+ sel_moved = 0;
+ draw_grid();
+ result = (char*)msg_load;
+ }
+ else if (r == -1) result = (char*)er_file_not_found;
+ else if (r == -2) result = (char*)er_format;
+ kos_AppRun("/sys/@notify", result);
+}
+
void process_button()
{
Dword button;
@@ -1063,18 +1084,7 @@ void process_button()
break;
case LOAD_BUTTON:
- stop_edit();
- int r = LoadFile(fname);
- char *result;
- if (r > 0) {
- calculate_values();
- sel_moved = 0;
- draw_grid();
- result = (char*)msg_load;
- }
- else if (r == -1) result = (char*)er_file_not_found;
- else if (r == -2) result = (char*)er_format;
- kos_AppRun("/sys/@notify", result);
+ EventLoadFile();
break;
}
if (button >= COL_HEAD_BUTTON && button < ROW_HEAD_BUTTON)
@@ -1102,6 +1112,11 @@ void kos_Main()
kos_InitHeap();
load_edit_box();
init();
+ if (params[0]) {
+ strcpy(fname, params);
+ file_box.size = file_box.pos = strlen(fname);
+ EventLoadFile();
+ }
kos_SetMaskForEvents(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
for (;;)
{
diff --git a/programs/other/table/kosSyst.cpp b/programs/other/table/kosSyst.cpp
index 742367b5fc..3efa143287 100644
--- a/programs/other/table/kosSyst.cpp
+++ b/programs/other/table/kosSyst.cpp
@@ -9,6 +9,7 @@
#ifdef AUTOBUILD
char kosExePath[1024];
char exeStack[16384];
+extern char params[1024];
// must be alphabetically first in the image
#pragma data_seg(".1seg")
extern "C" struct
@@ -28,7 +29,7 @@ extern "C" struct
0, // filled by doexe2.asm
0, // filled by doexe2.asm
exeStack + sizeof(exeStack),
- NULL,
+ params,
kosExePath
};
#pragma data_seg()
diff --git a/programs/other/table/parser.cpp b/programs/other/table/parser.cpp
index d8ec281aaf..d11cbdbece 100644
--- a/programs/other/table/parser.cpp
+++ b/programs/other/table/parser.cpp
@@ -928,3 +928,15 @@ int look_up(char *s)
return 0; // search command/function name
}
+unsigned int chrnum(char* text, char symbol)
+{
+ int num = 0;
+ int i = 0;
+ while(text[i])
+ {
+ if (text[i] == symbol) num++;
+ i++;
+ }
+ return num;
+}
+
diff --git a/programs/other/table/parser.h b/programs/other/table/parser.h
index e3c18faa15..f7ea450326 100644
--- a/programs/other/table/parser.h
+++ b/programs/other/table/parser.h
@@ -57,6 +57,8 @@ int look_up(char *s);
bool strcmp(char *s1, char *s2);
bool strncmp(char *s1, char *s2, int n);
+unsigned int chrnum(char* text, char symbol);
+
extern double epsilon;