Check-in [7256978106]
Overview
Comment:Updated to fail to open files and set path to library
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 72569781067f4247d4b3f676a34d2e477d1ff56c
User & Date: rkeene on 2014-05-02 03:32:24
Other Links: manifest | tags
Context
2014-05-02
03:43
Updated library paths check-in: 8c5cb4e725 user: rkeene tags: trunk
03:32
Updated to fail to open files and set path to library check-in: 7256978106 user: rkeene tags: trunk
03:10
Updated to create additional install directories check-in: ae8cc5e6e3 user: rkeene tags: trunk
Changes

Modified build/tcc-patches/0.9.26/tcc-0.9.26-tclio.diff from [81bcf0a4f9] to [e6c607249f].

     1      1   diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tclio/libtcc.c
     2      2   --- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
     3         -+++ tcc-0.9.26-1tclio/libtcc.c	2014-05-01 20:13:50.626814210 -0500
            3  ++++ tcc-0.9.26-1tclio/libtcc.c	2014-05-01 21:14:22.272599405 -0500
     4      4   @@ -669,7 +669,7 @@
     5      5        bf->line_num = 1;
     6      6        bf->ifndef_macro = 0;
     7      7        bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
     8      8   -    bf->fd = -1;
     9      9   +    bf->fd = NULL;
    10     10        bf->prev = file;
................................................................................
    93     93   +    size = Tcl_Read(fd, (char *)&ehdr, sizeof(ehdr));
    94     94   +    Tcl_Seek(fd, 0, SEEK_SET);
    95     95        if (size <= 0) {
    96     96            tcc_error_noabort("could not read header");
    97     97            goto the_end;
    98     98   diff -uNr tcc-0.9.26.orig/tcc.h tcc-0.9.26-1tclio/tcc.h
    99     99   --- tcc-0.9.26.orig/tcc.h	2013-02-15 08:24:00.000000000 -0600
   100         -+++ tcc-0.9.26-1tclio/tcc.h	2014-05-01 19:55:39.093986611 -0500
          100  ++++ tcc-0.9.26-1tclio/tcc.h	2014-05-01 21:14:22.294602204 -0500
   101    101   @@ -429,7 +429,7 @@
   102    102    typedef struct BufferedFile {
   103    103        uint8_t *buf_ptr;
   104    104        uint8_t *buf_end;
   105    105   -    int fd;
   106    106   +    Tcl_Channel fd;
   107    107        struct BufferedFile *prev;
................................................................................
   152    152   -ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd);
   153    153   +ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd);
   154    154    ST_FUNC int pe_output_file(TCCState * s1, const char *filename);
   155    155    ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value);
   156    156    ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2);
   157    157   diff -uNr tcc-0.9.26.orig/tcccoff.c tcc-0.9.26-1tclio/tcccoff.c
   158    158   --- tcc-0.9.26.orig/tcccoff.c	2013-02-15 08:24:00.000000000 -0600
   159         -+++ tcc-0.9.26-1tclio/tcccoff.c	2014-05-01 20:02:37.695836363 -0500
          159  ++++ tcc-0.9.26-1tclio/tcccoff.c	2014-05-01 21:14:22.295602331 -0500
   160    160   @@ -858,10 +858,11 @@
   161    161        return 0;
   162    162    }
   163    163    
   164    164   -ST_FUNC int tcc_load_coff(TCCState * s1, int fd)
   165    165   +ST_FUNC int tcc_load_coff(TCCState * s1, Tcl_Channel fd)
   166    166    {
................................................................................
   184    184   +
   185    185   +    f = fdopen(native_fd, "rb");
   186    186        if (!f) {
   187    187    	tcc_error("Unable to open .out file for input");
   188    188        }
   189    189   diff -uNr tcc-0.9.26.orig/tccelf.c tcc-0.9.26-1tclio/tccelf.c
   190    190   --- tcc-0.9.26.orig/tccelf.c	2013-02-15 08:24:00.000000000 -0600
   191         -+++ tcc-0.9.26-1tclio/tccelf.c	2014-05-01 20:14:26.278515126 -0500
          191  ++++ tcc-0.9.26-1tclio/tccelf.c	2014-05-01 21:14:22.301603094 -0500
   192    192   @@ -2334,13 +2334,13 @@
   193    193        return ret;
   194    194    }
   195    195    
   196    196   -static void *load_data(int fd, unsigned long file_offset, unsigned long size)
   197    197   +static void *load_data(Tcl_Channel fd, unsigned long file_offset, unsigned long size)
   198    198    {
................................................................................
   319    319   -    read(fd, &ehdr, sizeof(ehdr));
   320    320   +    Tcl_Read(fd, (char *) &ehdr, sizeof(ehdr));
   321    321    
   322    322        /* test CPU specific stuff */
   323    323        if (ehdr.e_ident[5] != ELFDATA2LSB ||
   324    324   diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1tclio/tccpe.c
   325    325   --- tcc-0.9.26.orig/tccpe.c	2013-02-15 08:24:00.000000000 -0600
   326         -+++ tcc-0.9.26-1tclio/tccpe.c	2014-05-01 20:09:11.572909155 -0500
          326  ++++ tcc-0.9.26-1tclio/tccpe.c	2014-05-01 21:14:22.302603222 -0500
   327    327   @@ -1505,10 +1505,10 @@
   328    328    
   329    329    /* ------------------------------------------------------------- */
   330    330    
   331    331   -static int read_mem(int fd, unsigned offset, void *buffer, unsigned len)
   332    332   +static int read_mem(Tcl_Channel fd, unsigned offset, void *buffer, unsigned len)
   333    333    {
................................................................................
   386    386   -ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd)
   387    387   +ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd)
   388    388    {
   389    389        int ret = -1;
   390    390        char buf[10];
   391    391   diff -uNr tcc-0.9.26.orig/tccpp.c tcc-0.9.26-1tclio/tccpp.c
   392    392   --- tcc-0.9.26.orig/tccpp.c	2013-02-15 08:24:00.000000000 -0600
   393         -+++ tcc-0.9.26-1tclio/tccpp.c	2014-05-01 20:12:26.967021662 -0500
          393  ++++ tcc-0.9.26-1tclio/tccpp.c	2014-05-01 22:25:10.373511188 -0500
   394    394   @@ -360,13 +360,13 @@
   395    395        int len;
   396    396        /* only tries to read if really end of buffer */
   397    397        if (bf->buf_ptr >= bf->buf_end) {
   398    398   -        if (bf->fd != -1) {
   399    399   +        if (bf->fd != NULL) {
   400    400    #if defined(PARSE_DEBUG)
................................................................................
   403    403                len = IO_BUF_SIZE;
   404    404    #endif
   405    405   -            len = read(bf->fd, bf->buffer, len);
   406    406   +            len = Tcl_Read(bf->fd, bf->buffer, len);
   407    407                if (len < 0)
   408    408                    len = 0;
   409    409            } else {
          410  +@@ -1484,7 +1484,7 @@
          411  +                 goto include_done;
          412  +             }
          413  + 
          414  +-            if (tcc_open(s1, buf1) < 0)
          415  ++            if (tcc_open(s1, buf1) == NULL)
          416  + include_trynext:
          417  +                 continue;
          418  + 

Modified tcltcc.c from [056e832bbd] to [cebccc8dc1].

   256    256   		}
   257    257   	}
   258    258   
   259    259   	s = tcc_new();
   260    260   	if (s == NULL) {
   261    261   		return(TCL_ERROR);
   262    262   	}
          263  +
          264  +	s->tcc_lib_path = Tcl_GetString(objv[1]);
   263    265   
   264    266   	tcc_set_error_func(s, interp, (void *)&TccErrorFunc);
   265    267   
   266    268   	ts = (void *) ckalloc(sizeof(*ts));
   267    269   	ts->s = s;
   268    270       	ts->relocated = 0;
   269    271