[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] here is the patch
From: |
Vladimir Moushkov |
Subject: |
[Tinycc-devel] here is the patch |
Date: |
Tue, 15 Apr 2003 22:46:14 +0300 |
User-agent: |
KMail/1.5 |
:)
As "outputs memory" i mean tcc directy executes the compiled code.
btw in using tcc as interpreter mode you cannot use more than one argument
because tcc recognize all arguments as one.
so
#!/bin/tcc -I/usr/include/sys -L/lib will be taken as:
#!/bin/tcc "-I/usr/include/sys -L/lib"
this is because thekernel (or the lib c??) takes all the argumetns in one
argv[1] file paramter as argv[2]. It is possible to recognize more than
parameter if we makes parser for that.
regards,
vlindos
--------------------------------------------------------------------------------------------
--- tcc.c Mon Apr 14 01:42:15 2003
+++ tcc.newmode Wed Apr 16 17:54:09 2003
@@ -9510,7 +9510,6 @@
int print_search_dirs;
s = tcc_new();
- output_type = TCC_OUTPUT_EXE;
optind = 1;
outfile = NULL;
@@ -9521,6 +9520,32 @@
nb_libraries = 0;
reloc_output = 0;
print_search_dirs = 0;
+
+#ifdef WIN32
+ i = strrchr(argv[0], '\\') - argv[0];
+#else
+ i = strrchr(argv[0], '/') - argv[0];
+#endif
+ if (i < 0 || i > strlen(argv[0])){
+ r = tcc_malloc(strlen(argv[0] + 1)*sizeof(char));
+ strcpy(r, argv[0]);
+ } else {
+ r = tcc_malloc((strlen(argv[0]) - i)*sizeof(char));
+ strcpy(r, argv[0] + i + 1);
+ }
+#ifdef WIN32
+ if(strcmp(r, "tci")==0 || strcmp(r, "tci.exe")==0))
+#else
+ if(strcmp(r, "tci")==0){
+#endif
+ multiple_files = 0;
+ output_type = TCC_OUTPUT_MEMORY;
+ }
+ else
+ // unknown or standard binary output
+ output_type = TCC_OUTPUT_EXE;
+
+ tcc_free(r);
while (1) {
if (optind >= argc) {
if (nb_files == 0 && !print_search_dirs)
--------------------------------------------------------------------------------------------
- [Tinycc-devel] here is the patch,
Vladimir Moushkov <=