Check-in [75e4d5fbed]
Overview
Comment:Merged in alternate trunk from old development
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 75e4d5fbed3b1022159ff937586fe21b6730e6b1
User & Date: rkeene on 2014-05-05 16:22:07
Other Links: manifest | tags
References
2014-05-05
21:12
Reverted [75e4d5fbed] and updated to do integration work in our driver directly check-in: cbac5b0590 user: rkeene tags: trunk
Context
2014-05-05
16:29
Fixed incorrectly applied previous commit check-in: 4e6359ae47 user: rkeene tags: trunk
16:22
Merged in alternate trunk from old development check-in: 75e4d5fbed user: rkeene tags: trunk
2014-05-04
07:27
Updated ignores with Win32 targets check-in: 1ffb02b806 user: rkeene tags: trunk
2014-05-01
22:10
Updated to download "tcc" into "tcc" directory check-in: 9474ae442e user: rkeene tags: trunk
Changes

Added .fossil-settings/ignore-glob version [163df1cbc6].

            1  +aclocal.m4
            2  +aclocal/shobj.m4
            3  +aclocal/tcl.m4
            4  +aclocal/versionscript.m4
            5  +config.guess
            6  +config.sub
            7  +config.log
            8  +config.status
            9  +configure
           10  +install-sh
           11  +Makefile
           12  +pkgIndex.tcl
           13  +tcc/*
           14  +work/*
           15  +INST/*
           16  +tcc4tcl.o
           17  +tcc4tcl-static.a
           18  +tcc4tcl.so
           19  +tcc4tcl.sl
           20  +tcc4tcl.dll
           21  +tcc4tcl.dll.def
           22  +tcc4tcl.dll.a
           23  +tcc4tcl.dylib
           24  +tcc4tcl.syms
           25  +tcc4tcl.vers
           26  +TEST-STATUS
           27  +__TMP__

Added COPYING version [fdeb196b87].

            1  +		  GNU LESSER GENERAL PUBLIC LICENSE
            2  +		       Version 2.1, February 1999
            3  +
            4  + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
            5  +     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
            6  + Everyone is permitted to copy and distribute verbatim copies
            7  + of this license document, but changing it is not allowed.
            8  +
            9  +[This is the first released version of the Lesser GPL.  It also counts
           10  + as the successor of the GNU Library Public License, version 2, hence
           11  + the version number 2.1.]
           12  +
           13  +			    Preamble
           14  +
           15  +  The licenses for most software are designed to take away your
           16  +freedom to share and change it.  By contrast, the GNU General Public
           17  +Licenses are intended to guarantee your freedom to share and change
           18  +free software--to make sure the software is free for all its users.
           19  +
           20  +  This license, the Lesser General Public License, applies to some
           21  +specially designated software packages--typically libraries--of the
           22  +Free Software Foundation and other authors who decide to use it.  You
           23  +can use it too, but we suggest you first think carefully about whether
           24  +this license or the ordinary General Public License is the better
           25  +strategy to use in any particular case, based on the explanations below.
           26  +
           27  +  When we speak of free software, we are referring to freedom of use,
           28  +not price.  Our General Public Licenses are designed to make sure that
           29  +you have the freedom to distribute copies of free software (and charge
           30  +for this service if you wish); that you receive source code or can get
           31  +it if you want it; that you can change the software and use pieces of
           32  +it in new free programs; and that you are informed that you can do
           33  +these things.
           34  +
           35  +  To protect your rights, we need to make restrictions that forbid
           36  +distributors to deny you these rights or to ask you to surrender these
           37  +rights.  These restrictions translate to certain responsibilities for
           38  +you if you distribute copies of the library or if you modify it.
           39  +
           40  +  For example, if you distribute copies of the library, whether gratis
           41  +or for a fee, you must give the recipients all the rights that we gave
           42  +you.  You must make sure that they, too, receive or can get the source
           43  +code.  If you link other code with the library, you must provide
           44  +complete object files to the recipients, so that they can relink them
           45  +with the library after making changes to the library and recompiling
           46  +it.  And you must show them these terms so they know their rights.
           47  +
           48  +  We protect your rights with a two-step method: (1) we copyright the
           49  +library, and (2) we offer you this license, which gives you legal
           50  +permission to copy, distribute and/or modify the library.
           51  +
           52  +  To protect each distributor, we want to make it very clear that
           53  +there is no warranty for the free library.  Also, if the library is
           54  +modified by someone else and passed on, the recipients should know
           55  +that what they have is not the original version, so that the original
           56  +author's reputation will not be affected by problems that might be
           57  +introduced by others.
           58  +
           59  +  Finally, software patents pose a constant threat to the existence of
           60  +any free program.  We wish to make sure that a company cannot
           61  +effectively restrict the users of a free program by obtaining a
           62  +restrictive license from a patent holder.  Therefore, we insist that
           63  +any patent license obtained for a version of the library must be
           64  +consistent with the full freedom of use specified in this license.
           65  +
           66  +  Most GNU software, including some libraries, is covered by the
           67  +ordinary GNU General Public License.  This license, the GNU Lesser
           68  +General Public License, applies to certain designated libraries, and
           69  +is quite different from the ordinary General Public License.  We use
           70  +this license for certain libraries in order to permit linking those
           71  +libraries into non-free programs.
           72  +
           73  +  When a program is linked with a library, whether statically or using
           74  +a shared library, the combination of the two is legally speaking a
           75  +combined work, a derivative of the original library.  The ordinary
           76  +General Public License therefore permits such linking only if the
           77  +entire combination fits its criteria of freedom.  The Lesser General
           78  +Public License permits more lax criteria for linking other code with
           79  +the library.
           80  +
           81  +  We call this license the "Lesser" General Public License because it
           82  +does Less to protect the user's freedom than the ordinary General
           83  +Public License.  It also provides other free software developers Less
           84  +of an advantage over competing non-free programs.  These disadvantages
           85  +are the reason we use the ordinary General Public License for many
           86  +libraries.  However, the Lesser license provides advantages in certain
           87  +special circumstances.
           88  +
           89  +  For example, on rare occasions, there may be a special need to
           90  +encourage the widest possible use of a certain library, so that it becomes
           91  +a de-facto standard.  To achieve this, non-free programs must be
           92  +allowed to use the library.  A more frequent case is that a free
           93  +library does the same job as widely used non-free libraries.  In this
           94  +case, there is little to gain by limiting the free library to free
           95  +software only, so we use the Lesser General Public License.
           96  +
           97  +  In other cases, permission to use a particular library in non-free
           98  +programs enables a greater number of people to use a large body of
           99  +free software.  For example, permission to use the GNU C Library in
          100  +non-free programs enables many more people to use the whole GNU
          101  +operating system, as well as its variant, the GNU/Linux operating
          102  +system.
          103  +
          104  +  Although the Lesser General Public License is Less protective of the
          105  +users' freedom, it does ensure that the user of a program that is
          106  +linked with the Library has the freedom and the wherewithal to run
          107  +that program using a modified version of the Library.
          108  +
          109  +  The precise terms and conditions for copying, distribution and
          110  +modification follow.  Pay close attention to the difference between a
          111  +"work based on the library" and a "work that uses the library".  The
          112  +former contains code derived from the library, whereas the latter must
          113  +be combined with the library in order to run.
          114  +
          115  +		  GNU LESSER GENERAL PUBLIC LICENSE
          116  +   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
          117  +
          118  +  0. This License Agreement applies to any software library or other
          119  +program which contains a notice placed by the copyright holder or
          120  +other authorized party saying it may be distributed under the terms of
          121  +this Lesser General Public License (also called "this License").
          122  +Each licensee is addressed as "you".
          123  +
          124  +  A "library" means a collection of software functions and/or data
          125  +prepared so as to be conveniently linked with application programs
          126  +(which use some of those functions and data) to form executables.
          127  +
          128  +  The "Library", below, refers to any such software library or work
          129  +which has been distributed under these terms.  A "work based on the
          130  +Library" means either the Library or any derivative work under
          131  +copyright law: that is to say, a work containing the Library or a
          132  +portion of it, either verbatim or with modifications and/or translated
          133  +straightforwardly into another language.  (Hereinafter, translation is
          134  +included without limitation in the term "modification".)
          135  +
          136  +  "Source code" for a work means the preferred form of the work for
          137  +making modifications to it.  For a library, complete source code means
          138  +all the source code for all modules it contains, plus any associated
          139  +interface definition files, plus the scripts used to control compilation
          140  +and installation of the library.
          141  +
          142  +  Activities other than copying, distribution and modification are not
          143  +covered by this License; they are outside its scope.  The act of
          144  +running a program using the Library is not restricted, and output from
          145  +such a program is covered only if its contents constitute a work based
          146  +on the Library (independent of the use of the Library in a tool for
          147  +writing it).  Whether that is true depends on what the Library does
          148  +and what the program that uses the Library does.
          149  +  
          150  +  1. You may copy and distribute verbatim copies of the Library's
          151  +complete source code as you receive it, in any medium, provided that
          152  +you conspicuously and appropriately publish on each copy an
          153  +appropriate copyright notice and disclaimer of warranty; keep intact
          154  +all the notices that refer to this License and to the absence of any
          155  +warranty; and distribute a copy of this License along with the
          156  +Library.
          157  +
          158  +  You may charge a fee for the physical act of transferring a copy,
          159  +and you may at your option offer warranty protection in exchange for a
          160  +fee.
          161  +
          162  +  2. You may modify your copy or copies of the Library or any portion
          163  +of it, thus forming a work based on the Library, and copy and
          164  +distribute such modifications or work under the terms of Section 1
          165  +above, provided that you also meet all of these conditions:
          166  +
          167  +    a) The modified work must itself be a software library.
          168  +
          169  +    b) You must cause the files modified to carry prominent notices
          170  +    stating that you changed the files and the date of any change.
          171  +
          172  +    c) You must cause the whole of the work to be licensed at no
          173  +    charge to all third parties under the terms of this License.
          174  +
          175  +    d) If a facility in the modified Library refers to a function or a
          176  +    table of data to be supplied by an application program that uses
          177  +    the facility, other than as an argument passed when the facility
          178  +    is invoked, then you must make a good faith effort to ensure that,
          179  +    in the event an application does not supply such function or
          180  +    table, the facility still operates, and performs whatever part of
          181  +    its purpose remains meaningful.
          182  +
          183  +    (For example, a function in a library to compute square roots has
          184  +    a purpose that is entirely well-defined independent of the
          185  +    application.  Therefore, Subsection 2d requires that any
          186  +    application-supplied function or table used by this function must
          187  +    be optional: if the application does not supply it, the square
          188  +    root function must still compute square roots.)
          189  +
          190  +These requirements apply to the modified work as a whole.  If
          191  +identifiable sections of that work are not derived from the Library,
          192  +and can be reasonably considered independent and separate works in
          193  +themselves, then this License, and its terms, do not apply to those
          194  +sections when you distribute them as separate works.  But when you
          195  +distribute the same sections as part of a whole which is a work based
          196  +on the Library, the distribution of the whole must be on the terms of
          197  +this License, whose permissions for other licensees extend to the
          198  +entire whole, and thus to each and every part regardless of who wrote
          199  +it.
          200  +
          201  +Thus, it is not the intent of this section to claim rights or contest
          202  +your rights to work written entirely by you; rather, the intent is to
          203  +exercise the right to control the distribution of derivative or
          204  +collective works based on the Library.
          205  +
          206  +In addition, mere aggregation of another work not based on the Library
          207  +with the Library (or with a work based on the Library) on a volume of
          208  +a storage or distribution medium does not bring the other work under
          209  +the scope of this License.
          210  +
          211  +  3. You may opt to apply the terms of the ordinary GNU General Public
          212  +License instead of this License to a given copy of the Library.  To do
          213  +this, you must alter all the notices that refer to this License, so
          214  +that they refer to the ordinary GNU General Public License, version 2,
          215  +instead of to this License.  (If a newer version than version 2 of the
          216  +ordinary GNU General Public License has appeared, then you can specify
          217  +that version instead if you wish.)  Do not make any other change in
          218  +these notices.
          219  +
          220  +  Once this change is made in a given copy, it is irreversible for
          221  +that copy, so the ordinary GNU General Public License applies to all
          222  +subsequent copies and derivative works made from that copy.
          223  +
          224  +  This option is useful when you wish to copy part of the code of
          225  +the Library into a program that is not a library.
          226  +
          227  +  4. You may copy and distribute the Library (or a portion or
          228  +derivative of it, under Section 2) in object code or executable form
          229  +under the terms of Sections 1 and 2 above provided that you accompany
          230  +it with the complete corresponding machine-readable source code, which
          231  +must be distributed under the terms of Sections 1 and 2 above on a
          232  +medium customarily used for software interchange.
          233  +
          234  +  If distribution of object code is made by offering access to copy
          235  +from a designated place, then offering equivalent access to copy the
          236  +source code from the same place satisfies the requirement to
          237  +distribute the source code, even though third parties are not
          238  +compelled to copy the source along with the object code.
          239  +
          240  +  5. A program that contains no derivative of any portion of the
          241  +Library, but is designed to work with the Library by being compiled or
          242  +linked with it, is called a "work that uses the Library".  Such a
          243  +work, in isolation, is not a derivative work of the Library, and
          244  +therefore falls outside the scope of this License.
          245  +
          246  +  However, linking a "work that uses the Library" with the Library
          247  +creates an executable that is a derivative of the Library (because it
          248  +contains portions of the Library), rather than a "work that uses the
          249  +library".  The executable is therefore covered by this License.
          250  +Section 6 states terms for distribution of such executables.
          251  +
          252  +  When a "work that uses the Library" uses material from a header file
          253  +that is part of the Library, the object code for the work may be a
          254  +derivative work of the Library even though the source code is not.
          255  +Whether this is true is especially significant if the work can be
          256  +linked without the Library, or if the work is itself a library.  The
          257  +threshold for this to be true is not precisely defined by law.
          258  +
          259  +  If such an object file uses only numerical parameters, data
          260  +structure layouts and accessors, and small macros and small inline
          261  +functions (ten lines or less in length), then the use of the object
          262  +file is unrestricted, regardless of whether it is legally a derivative
          263  +work.  (Executables containing this object code plus portions of the
          264  +Library will still fall under Section 6.)
          265  +
          266  +  Otherwise, if the work is a derivative of the Library, you may
          267  +distribute the object code for the work under the terms of Section 6.
          268  +Any executables containing that work also fall under Section 6,
          269  +whether or not they are linked directly with the Library itself.
          270  +
          271  +  6. As an exception to the Sections above, you may also combine or
          272  +link a "work that uses the Library" with the Library to produce a
          273  +work containing portions of the Library, and distribute that work
          274  +under terms of your choice, provided that the terms permit
          275  +modification of the work for the customer's own use and reverse
          276  +engineering for debugging such modifications.
          277  +
          278  +  You must give prominent notice with each copy of the work that the
          279  +Library is used in it and that the Library and its use are covered by
          280  +this License.  You must supply a copy of this License.  If the work
          281  +during execution displays copyright notices, you must include the
          282  +copyright notice for the Library among them, as well as a reference
          283  +directing the user to the copy of this License.  Also, you must do one
          284  +of these things:
          285  +
          286  +    a) Accompany the work with the complete corresponding
          287  +    machine-readable source code for the Library including whatever
          288  +    changes were used in the work (which must be distributed under
          289  +    Sections 1 and 2 above); and, if the work is an executable linked
          290  +    with the Library, with the complete machine-readable "work that
          291  +    uses the Library", as object code and/or source code, so that the
          292  +    user can modify the Library and then relink to produce a modified
          293  +    executable containing the modified Library.  (It is understood
          294  +    that the user who changes the contents of definitions files in the
          295  +    Library will not necessarily be able to recompile the application
          296  +    to use the modified definitions.)
          297  +
          298  +    b) Use a suitable shared library mechanism for linking with the
          299  +    Library.  A suitable mechanism is one that (1) uses at run time a
          300  +    copy of the library already present on the user's computer system,
          301  +    rather than copying library functions into the executable, and (2)
          302  +    will operate properly with a modified version of the library, if
          303  +    the user installs one, as long as the modified version is
          304  +    interface-compatible with the version that the work was made with.
          305  +
          306  +    c) Accompany the work with a written offer, valid for at
          307  +    least three years, to give the same user the materials
          308  +    specified in Subsection 6a, above, for a charge no more
          309  +    than the cost of performing this distribution.
          310  +
          311  +    d) If distribution of the work is made by offering access to copy
          312  +    from a designated place, offer equivalent access to copy the above
          313  +    specified materials from the same place.
          314  +
          315  +    e) Verify that the user has already received a copy of these
          316  +    materials or that you have already sent this user a copy.
          317  +
          318  +  For an executable, the required form of the "work that uses the
          319  +Library" must include any data and utility programs needed for
          320  +reproducing the executable from it.  However, as a special exception,
          321  +the materials to be distributed need not include anything that is
          322  +normally distributed (in either source or binary form) with the major
          323  +components (compiler, kernel, and so on) of the operating system on
          324  +which the executable runs, unless that component itself accompanies
          325  +the executable.
          326  +
          327  +  It may happen that this requirement contradicts the license
          328  +restrictions of other proprietary libraries that do not normally
          329  +accompany the operating system.  Such a contradiction means you cannot
          330  +use both them and the Library together in an executable that you
          331  +distribute.
          332  +
          333  +  7. You may place library facilities that are a work based on the
          334  +Library side-by-side in a single library together with other library
          335  +facilities not covered by this License, and distribute such a combined
          336  +library, provided that the separate distribution of the work based on
          337  +the Library and of the other library facilities is otherwise
          338  +permitted, and provided that you do these two things:
          339  +
          340  +    a) Accompany the combined library with a copy of the same work
          341  +    based on the Library, uncombined with any other library
          342  +    facilities.  This must be distributed under the terms of the
          343  +    Sections above.
          344  +
          345  +    b) Give prominent notice with the combined library of the fact
          346  +    that part of it is a work based on the Library, and explaining
          347  +    where to find the accompanying uncombined form of the same work.
          348  +
          349  +  8. You may not copy, modify, sublicense, link with, or distribute
          350  +the Library except as expressly provided under this License.  Any
          351  +attempt otherwise to copy, modify, sublicense, link with, or
          352  +distribute the Library is void, and will automatically terminate your
          353  +rights under this License.  However, parties who have received copies,
          354  +or rights, from you under this License will not have their licenses
          355  +terminated so long as such parties remain in full compliance.
          356  +
          357  +  9. You are not required to accept this License, since you have not
          358  +signed it.  However, nothing else grants you permission to modify or
          359  +distribute the Library or its derivative works.  These actions are
          360  +prohibited by law if you do not accept this License.  Therefore, by
          361  +modifying or distributing the Library (or any work based on the
          362  +Library), you indicate your acceptance of this License to do so, and
          363  +all its terms and conditions for copying, distributing or modifying
          364  +the Library or works based on it.
          365  +
          366  +  10. Each time you redistribute the Library (or any work based on the
          367  +Library), the recipient automatically receives a license from the
          368  +original licensor to copy, distribute, link with or modify the Library
          369  +subject to these terms and conditions.  You may not impose any further
          370  +restrictions on the recipients' exercise of the rights granted herein.
          371  +You are not responsible for enforcing compliance by third parties with
          372  +this License.
          373  +
          374  +  11. If, as a consequence of a court judgment or allegation of patent
          375  +infringement or for any other reason (not limited to patent issues),
          376  +conditions are imposed on you (whether by court order, agreement or
          377  +otherwise) that contradict the conditions of this License, they do not
          378  +excuse you from the conditions of this License.  If you cannot
          379  +distribute so as to satisfy simultaneously your obligations under this
          380  +License and any other pertinent obligations, then as a consequence you
          381  +may not distribute the Library at all.  For example, if a patent
          382  +license would not permit royalty-free redistribution of the Library by
          383  +all those who receive copies directly or indirectly through you, then
          384  +the only way you could satisfy both it and this License would be to
          385  +refrain entirely from distribution of the Library.
          386  +
          387  +If any portion of this section is held invalid or unenforceable under any
          388  +particular circumstance, the balance of the section is intended to apply,
          389  +and the section as a whole is intended to apply in other circumstances.
          390  +
          391  +It is not the purpose of this section to induce you to infringe any
          392  +patents or other property right claims or to contest validity of any
          393  +such claims; this section has the sole purpose of protecting the
          394  +integrity of the free software distribution system which is
          395  +implemented by public license practices.  Many people have made
          396  +generous contributions to the wide range of software distributed
          397  +through that system in reliance on consistent application of that
          398  +system; it is up to the author/donor to decide if he or she is willing
          399  +to distribute software through any other system and a licensee cannot
          400  +impose that choice.
          401  +
          402  +This section is intended to make thoroughly clear what is believed to
          403  +be a consequence of the rest of this License.
          404  +
          405  +  12. If the distribution and/or use of the Library is restricted in
          406  +certain countries either by patents or by copyrighted interfaces, the
          407  +original copyright holder who places the Library under this License may add
          408  +an explicit geographical distribution limitation excluding those countries,
          409  +so that distribution is permitted only in or among countries not thus
          410  +excluded.  In such case, this License incorporates the limitation as if
          411  +written in the body of this License.
          412  +
          413  +  13. The Free Software Foundation may publish revised and/or new
          414  +versions of the Lesser General Public License from time to time.
          415  +Such new versions will be similar in spirit to the present version,
          416  +but may differ in detail to address new problems or concerns.
          417  +
          418  +Each version is given a distinguishing version number.  If the Library
          419  +specifies a version number of this License which applies to it and
          420  +"any later version", you have the option of following the terms and
          421  +conditions either of that version or of any later version published by
          422  +the Free Software Foundation.  If the Library does not specify a
          423  +license version number, you may choose any version ever published by
          424  +the Free Software Foundation.
          425  +
          426  +  14. If you wish to incorporate parts of the Library into other free
          427  +programs whose distribution conditions are incompatible with these,
          428  +write to the author to ask for permission.  For software which is
          429  +copyrighted by the Free Software Foundation, write to the Free
          430  +Software Foundation; we sometimes make exceptions for this.  Our
          431  +decision will be guided by the two goals of preserving the free status
          432  +of all derivatives of our free software and of promoting the sharing
          433  +and reuse of software generally.
          434  +
          435  +			    NO WARRANTY
          436  +
          437  +  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
          438  +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
          439  +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
          440  +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
          441  +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
          442  +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
          443  +PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
          444  +LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
          445  +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
          446  +
          447  +  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
          448  +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
          449  +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
          450  +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
          451  +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
          452  +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
          453  +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
          454  +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
          455  +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
          456  +DAMAGES.
          457  +
          458  +		     END OF TERMS AND CONDITIONS
          459  +
          460  +           How to Apply These Terms to Your New Libraries
          461  +
          462  +  If you develop a new library, and you want it to be of the greatest
          463  +possible use to the public, we recommend making it free software that
          464  +everyone can redistribute and change.  You can do so by permitting
          465  +redistribution under these terms (or, alternatively, under the terms of the
          466  +ordinary General Public License).
          467  +
          468  +  To apply these terms, attach the following notices to the library.  It is
          469  +safest to attach them to the start of each source file to most effectively
          470  +convey the exclusion of warranty; and each file should have at least the
          471  +"copyright" line and a pointer to where the full notice is found.
          472  +
          473  +    <one line to give the library's name and a brief idea of what it does.>
          474  +    Copyright (C) <year>  <name of author>
          475  +
          476  +    This library is free software; you can redistribute it and/or
          477  +    modify it under the terms of the GNU Lesser General Public
          478  +    License as published by the Free Software Foundation; either
          479  +    version 2 of the License, or (at your option) any later version.
          480  +
          481  +    This library is distributed in the hope that it will be useful,
          482  +    but WITHOUT ANY WARRANTY; without even the implied warranty of
          483  +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
          484  +    Lesser General Public License for more details.
          485  +
          486  +    You should have received a copy of the GNU Lesser General Public
          487  +    License along with this library; if not, write to the Free Software
          488  +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
          489  +
          490  +Also add information on how to contact you by electronic and paper mail.
          491  +
          492  +You should also get your employer (if you work as a programmer) or your
          493  +school, if any, to sign a "copyright disclaimer" for the library, if
          494  +necessary.  Here is a sample; alter the names:
          495  +
          496  +  Yoyodyne, Inc., hereby disclaims all copyright interest in the
          497  +  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
          498  +
          499  +  <signature of Ty Coon>, 1 April 1990
          500  +  Ty Coon, President of Vice
          501  +
          502  +That's all there is to it!
          503  +
          504  +

Modified build/autogen.sh from [257c5a2cf3] to [95541498bc].

     1      1   #! /bin/bash
     2      2   
     3      3   # Download latest copy of autoconf macros
     4      4   (
            5  +	mkdir aclocal >/dev/null 2>/dev/null
     5      6   	cd aclocal || exit 1
     6      7   
     7      8   	for file in shobj.m4 tcl.m4 versionscript.m4; do
     8      9   		rm -f "${file}"
     9     10   
    10     11   		wget -O "${file}.new" "http://rkeene.org/devel/autoconf/${file}" || continue
    11     12   

Added build/makearch.info version [38688ff634].

            1  +# This is the name of the utility, it will be prefixed to the tarball name
            2  +UTIL="tcc4tcl"
            3  +
            4  +# This is the name of output files that should exist after configure 
            5  +# procedures.
            6  +BINS="tcc4tcl.so"
            7  +
            8  +# This lists the name of files that are required to exist
            9  +## TEST-STATUS is only created if "make test" succeeds
           10  +REQS="pkgIndex.tcl TEST-STATUS"
           11  +
           12  +# Version of utility, if empty it will be guessed.
           13  +# If set to "auto" it will be maintained in a file called .version
           14  +# in the source directory and the revision will be incremented
           15  +# each time a "makearch" is done.
           16  +#
           17  +# If @@SVNLCR@@ is used anywhere in this version number, it will be
           18  +# replaced with the highest last-changed-rev from the output of
           19  +#   svn info -R    (or 0)
           20  +VERS="0.3"
           21  +
           22  +# Space sperated list of documents, if they exist, they will be
           23  +# prefixed with the contents of the DOC_HDR file and substitution
           24  +# will occur:
           25  +#     @@UTIL@@ becomes the utility name ${UTIL}
           26  +#     @@VERS@@ becomes the utility version
           27  +#     @@DATE@@ becomes the current date
           28  +DOCS="README"
           29  +DOC_HDR="HEADER"
           30  +
           31  +# These files follow the same convention as DOCS, but don't have the header
           32  +# tacked onto them.
           33  +UPDATE_VARS="configure.ac configure"
           34  +
           35  +# This script is executed immediately after copying the files
           36  +# to a temp directory to attempt to compile
           37  +BEFORE="build/pre.sh"
           38  +
           39  +# This script is executed immediately prior to creation of the
           40  +# tarball
           41  +AFTER=""
           42  +
           43  +# Files matching these (space-seperated) patterns are deleted
           44  +TMPS="*.out HEADER build work INST"

Added build/tcc-patches/0.9.26/tcc-0.9.26-crosscompilefixes.diff version [6575644e6a].

            1  +diff -uNr tcc-0.9.26.orig/configure tcc-0.9.26-1crosscompilefixes/configure
            2  +--- tcc-0.9.26.orig/configure	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1crosscompilefixes/configure	2014-05-02 01:27:11.267140003 -0500
            4  +@@ -46,16 +46,8 @@
            5  + tcc_lddir=
            6  + confvars=
            7  + 
            8  +-cpu=`uname -m`
            9  +-
           10  +-# OS specific
           11  + targetos=`uname -s`
           12  +-case $targetos in
           13  +-  MINGW32*)  mingw32=yes;;
           14  +-  DragonFly) noldl=yes;;
           15  +-  OpenBSD)   noldl=yes;;
           16  +-  *) ;;
           17  +-esac
           18  ++cpu=`uname -m`
           19  + 
           20  + # find source path
           21  + # XXX: we assume an absolute path is given when launching configure, 
           22  +@@ -68,47 +60,6 @@
           23  +     source_path_used="no"
           24  + fi
           25  + 
           26  +-case "$cpu" in
           27  +-  i386|i486|i586|i686|i86pc|BePC|i686-AT386)
           28  +-    cpu="x86"
           29  +-  ;;
           30  +-  x86_64)
           31  +-    cpu="x86-64"
           32  +-  ;;
           33  +-  arm*)
           34  +-    case "$cpu" in
           35  +-      arm|armv4l)
           36  +-        cpuver=4
           37  +-      ;;
           38  +-      armv5tel|armv5tejl)
           39  +-        cpuver=5
           40  +-      ;;
           41  +-      armv6j|armv6l)
           42  +-        cpuver=6
           43  +-      ;;
           44  +-      armv7a|armv7l)
           45  +-        cpuver=7
           46  +-      ;;
           47  +-    esac
           48  +-    cpu="armv4l"
           49  +-  ;;
           50  +-  alpha)
           51  +-    cpu="alpha"
           52  +-  ;;
           53  +-  "Power Macintosh"|ppc|ppc64)
           54  +-    cpu="powerpc"
           55  +-  ;;
           56  +-  mips)
           57  +-    cpu="mips"
           58  +-  ;;
           59  +-  s390)
           60  +-    cpu="s390"
           61  +-  ;;
           62  +-  *)
           63  +-    cpu="unknown"
           64  +-  ;;
           65  +-esac
           66  +-
           67  + for opt do
           68  +   eval opt=\"$opt\"
           69  +   case "$opt" in
           70  +@@ -156,6 +107,8 @@
           71  +   ;;
           72  +   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
           73  +   ;;
           74  ++  --os=*) targetos=`echo $opt | cut -d '=' -f 2-`
           75  ++  ;;
           76  +   --enable-gprof) gprof="yes"
           77  +   ;;
           78  +   --enable-mingw32) mingw32="yes" ; cross_prefix="i686-pc-mingw32-" ; cpu=x86
           79  +@@ -181,6 +134,55 @@
           80  +   esac
           81  + done
           82  + 
           83  ++# OS specific
           84  ++case $targetos in
           85  ++  MINGW32*|mingw32*)  mingw32=yes;;
           86  ++  DragonFly) noldl=yes;;
           87  ++  OpenBSD)   noldl=yes;;
           88  ++  *) ;;
           89  ++esac
           90  ++
           91  ++case "$cpu" in
           92  ++  i386|i486|i586|i686|i86pc|BePC|i686-AT386)
           93  ++    cpu="x86"
           94  ++  ;;
           95  ++  x86_64)
           96  ++    cpu="x86-64"
           97  ++  ;;
           98  ++  arm*)
           99  ++    case "$cpu" in
          100  ++      arm|armv4l)
          101  ++        cpuver=4
          102  ++      ;;
          103  ++      armv5tel|armv5tejl)
          104  ++        cpuver=5
          105  ++      ;;
          106  ++      armv6j|armv6l)
          107  ++        cpuver=6
          108  ++      ;;
          109  ++      armv7a|armv7l)
          110  ++        cpuver=7
          111  ++      ;;
          112  ++    esac
          113  ++    cpu="armv4l"
          114  ++  ;;
          115  ++  alpha)
          116  ++    cpu="alpha"
          117  ++  ;;
          118  ++  "Power Macintosh"|ppc|ppc64)
          119  ++    cpu="powerpc"
          120  ++  ;;
          121  ++  mips)
          122  ++    cpu="mips"
          123  ++  ;;
          124  ++  s390)
          125  ++    cpu="s390"
          126  ++  ;;
          127  ++  *)
          128  ++    cpu="unknown"
          129  ++  ;;
          130  ++esac
          131  ++
          132  + # Checking for CFLAGS
          133  + if test -z "$CFLAGS"; then
          134  +     CFLAGS="-Wall -g -O2"
          135  +@@ -270,6 +272,8 @@
          136  +   --disable-static         make libtcc.so instead of libtcc.a
          137  +   --disable-rpath          disable use of -rpath with the above
          138  +   --with-libgcc            use /lib/libgcc_s.so.1 instead of libtcc.a
          139  ++  --cpu=...                Specify CPU
          140  ++  --os=...                 Specify OS
          141  +   --enable-mingw32         build windows version on linux with mingw32
          142  +   --enable-cygwin          build windows version on windows with cygwin
          143  +   --enable-cross           build cross compilers
          144  +diff -uNr tcc-0.9.26.orig/lib/Makefile tcc-0.9.26-1crosscompilefixes/lib/Makefile
          145  +--- tcc-0.9.26.orig/lib/Makefile	2013-02-15 08:24:00.000000000 -0600
          146  ++++ tcc-0.9.26-1crosscompilefixes/lib/Makefile	2014-05-02 01:55:55.407140003 -0500
          147  +@@ -47,24 +47,22 @@
          148  + ifeq "$(TARGET)" "i386-win32"
          149  +  OBJ = $(addprefix $(DIR)/,$(WIN32_O))
          150  +  TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
          151  +- XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
          152  +- XAR = $(DIR)/tiny_libmaker$(EXESUF)
          153  ++ XCC = $(CC) -I$(top_srcdir)/win32 -I$(top_srcdir)/include
          154  + else
          155  + ifeq "$(TARGET)" "x86_64-win32"
          156  +  OBJ = $(addprefix $(DIR)/,$(WIN64_O))
          157  +  TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
          158  +- XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
          159  +- XAR = $(DIR)/tiny_libmaker$(EXESUF)
          160  ++ XCC = $(CC) -I$(top_srcdir)/win32 -I$(top_srcdir)/include
          161  + else
          162  + ifeq "$(TARGET)" "i386"
          163  +  OBJ = $(addprefix $(DIR)/,$(I386_O))
          164  +  TGT = -DTCC_TARGET_I386
          165  +- XCC ?= $(TCC) -B$(TOP)
          166  ++ XCC ?= $(CC) -I$(TOP)
          167  + else
          168  + ifeq "$(TARGET)" "x86_64"
          169  +  OBJ = $(addprefix $(DIR)/,$(X86_64_O))
          170  +  TGT = -DTCC_TARGET_X86_64
          171  +- XCC ?= $(TCC) -B$(TOP)
          172  ++ XCC ?= $(CC) -I$(TOP)
          173  + else
          174  +  $(error libtcc1.a not supported on target '$(TARGET)')
          175  + endif
          176  +diff -uNr tcc-0.9.26.orig/win32/lib/crt1.c tcc-0.9.26-1crosscompilefixes/win32/lib/crt1.c
          177  +--- tcc-0.9.26.orig/win32/lib/crt1.c	2013-02-15 08:24:00.000000000 -0600
          178  ++++ tcc-0.9.26-1crosscompilefixes/win32/lib/crt1.c	2014-05-02 01:56:11.277140003 -0500
          179  +@@ -19,7 +19,6 @@
          180  + 
          181  + int _start(void)
          182  + {
          183  +-    __TRY__
          184  +     int argc; char **argv; char **env; int ret;
          185  +     _startupinfo start_info = {0};
          186  + 
          187  +diff -uNr tcc-0.9.26.orig/win32/lib/wincrt1.c tcc-0.9.26-1crosscompilefixes/win32/lib/wincrt1.c
          188  +--- tcc-0.9.26.orig/win32/lib/wincrt1.c	2013-02-15 08:24:00.000000000 -0600
          189  ++++ tcc-0.9.26-1crosscompilefixes/win32/lib/wincrt1.c	2014-05-02 01:56:15.197140003 -0500
          190  +@@ -11,7 +11,6 @@
          191  + 
          192  + int _winstart(void)
          193  + {
          194  +-    __TRY__
          195  +     char *szCmd;
          196  +     STARTUPINFO startinfo;
          197  +     int fShow;

Added build/tcc-patches/0.9.26/tcc-0.9.26-elfsearchforlibtcc.diff version [55426902b7].

            1  +diff -uNr tcc-0.9.26.orig/tccelf.c tcc-0.9.26-1elfsearchforlibtcc/tccelf.c
            2  +--- tcc-0.9.26.orig/tccelf.c	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1elfsearchforlibtcc/tccelf.c	2014-05-03 23:24:08.325640003 -0500
            4  +@@ -1349,7 +1349,27 @@
            5  + static inline int tcc_add_support(TCCState *s1, const char *filename)
            6  + {
            7  +     char buf[1024];
            8  ++    char *path;
            9  ++    void *check;
           10  ++    int i;
           11  ++
           12  +     snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, filename);
           13  ++    check = tcc_open(s1, buf);
           14  ++    if (check != NULL) {
           15  ++        tcc_close();
           16  ++    } else {
           17  ++        for (i = 0; i < s1->nb_library_paths; i++) {
           18  ++            path = s1->library_paths[i];
           19  ++            snprintf(buf, sizeof(buf), "%s/%s", path, filename);
           20  ++            check = tcc_open(s1, buf);
           21  ++
           22  ++            if (check != NULL) {
           23  ++                tcc_close();
           24  ++                break;
           25  ++            }
           26  ++        }
           27  ++    }
           28  ++
           29  +     return tcc_add_file(s1, buf);
           30  + }
           31  + 

Added build/tcc-patches/0.9.26/tcc-0.9.26-gnusourcesafety.diff version [483d740ff0].

            1  +diff -uNr tcc-0.9.26.orig/tcc.h tcc-0.9.26-1gnusourcesafety/tcc.h
            2  +--- tcc-0.9.26.orig/tcc.h	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1gnusourcesafety/tcc.h	2014-05-02 10:45:54.576640002 -0500
            4  +@@ -21,7 +21,9 @@
            5  + #ifndef _TCC_H
            6  + #define _TCC_H
            7  + 
            8  ++#ifndef _GNU_SOURCE
            9  + #define _GNU_SOURCE
           10  ++#endif
           11  + #include "config.h"
           12  + 
           13  + #ifdef CONFIG_TCCBOOT

Added build/tcc-patches/0.9.26/tcc-0.9.26-setlibpathsooner.diff version [cf9c3b4d2d].

            1  +diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1setlibpathsooner/libtcc.c
            2  +--- tcc-0.9.26.orig/libtcc.c	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1setlibpathsooner/libtcc.c	2014-05-03 23:19:00.965640003 -0500
            4  +@@ -888,7 +888,7 @@
            5  +     macro_ptr = NULL;
            6  + }
            7  + 
            8  +-LIBTCCAPI TCCState *tcc_new(void)
            9  ++LIBTCCAPI TCCState *tcc_new(const char *init_lib_path)
           10  + {
           11  +     TCCState *s;
           12  +     char buffer[100];
           13  +@@ -900,11 +900,15 @@
           14  +     if (!s)
           15  +         return NULL;
           16  +     tcc_state = s;
           17  ++    if (init_lib_path == NULL) {
           18  + #ifdef _WIN32
           19  +-    tcc_set_lib_path_w32(s);
           20  ++        tcc_set_lib_path_w32(s);
           21  + #else
           22  +-    tcc_set_lib_path(s, CONFIG_TCCDIR);
           23  ++        tcc_set_lib_path(s, CONFIG_TCCDIR);
           24  + #endif
           25  ++    } else {
           26  ++        tcc_set_lib_path(s, init_lib_path);
           27  ++    }
           28  +     s->output_type = TCC_OUTPUT_MEMORY;
           29  +     preprocess_new();
           30  +     s->include_stack_ptr = s->include_stack;
           31  +diff -uNr tcc-0.9.26.orig/libtcc.h tcc-0.9.26-1setlibpathsooner/libtcc.h
           32  +--- tcc-0.9.26.orig/libtcc.h	2013-02-15 08:24:00.000000000 -0600
           33  ++++ tcc-0.9.26-1setlibpathsooner/libtcc.h	2014-05-03 23:20:14.785640003 -0500
           34  +@@ -14,7 +14,7 @@
           35  + typedef struct TCCState TCCState;
           36  + 
           37  + /* create a new TCC compilation context */
           38  +-LIBTCCAPI TCCState *tcc_new(void);
           39  ++LIBTCCAPI TCCState *tcc_new(const char *init_lib_path);
           40  + 
           41  + /* free a TCC compilation context */
           42  + LIBTCCAPI void tcc_delete(TCCState *s);

Added build/tcc-patches/0.9.26/tcc-0.9.26-tcl.diff version [e03734effa].

            1  +--- tcc-0.9.26.orig/configure	2013-02-15 08:24:00.000000000 -0600
            2  ++++ tcc-0.9.26-1tcl/configure	2014-05-01 19:50:10.103740647 -0500
            3  +@@ -43,6 +43,7 @@
            4  + tcc_libpaths=""
            5  + tcc_crtprefix=""
            6  + tcc_elfinterp=""
            7  ++tcc_tcl_path=""
            8  + tcc_lddir=
            9  + confvars=
           10  + 
           11  +@@ -154,6 +155,8 @@
           12  +   ;;
           13  +   --elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
           14  +   ;;
           15  ++  --with-tcl=*) tcc_tcl_path=`echo $opt | cut -d '=' -f 2-`
           16  ++  ;;
           17  +   --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
           18  +   ;;
           19  +   --enable-gprof) gprof="yes"
           20  +@@ -278,6 +281,7 @@
           21  +   --libpaths=...           specify system library paths, colon separated
           22  +   --crtprefix=...          specify locations of crt?.o, colon separated
           23  +   --elfinterp=...          specify elf interpreter
           24  ++  --with-tcl=...           specify path to Tcl
           25  + EOF
           26  + #echo "NOTE: The object files are build at the place where configure is launched"
           27  + exit 1
           28  +@@ -339,6 +343,25 @@
           29  +   esac
           30  + fi
           31  + 
           32  ++print_tcl_defs() {
           33  ++	(
           34  ++		tclConfig="$1"
           35  ++		. "${tclConfig}"
           36  ++		LDFLAGS="$LDFLAGS $TCL_LIB_SPEC $TCL_LIBS"
           37  ++		CFLAGS="$CFLAGS $TCL_INCLUDE_SPEC -DHAVE_TCL_H=1"
           38  ++		set | egrep '^(CFLAGS|LDFLAGS)='
           39  ++	)
           40  ++}
           41  ++
           42  ++if [ -n "${tcc_tcl_path}" ]; then
           43  ++	for tcc_tcl_path_file in ${tcc_tcl_path}/{,lib,lib64}/tclConfig.sh; do
           44  ++		if [ -f "${tcc_tcl_path_file}" ]; then
           45  ++			eval `print_tcl_defs "${tcc_tcl_path_file}"`
           46  ++			break
           47  ++		fi
           48  ++	done
           49  ++fi
           50  ++
           51  + cat <<EOF
           52  + Binary  directory   $bindir
           53  + TinyCC directory    $tccdir
           54  +--- tcc-0.9.26.orig/tcc.h	2013-02-15 08:24:00.000000000 -0600
           55  ++++ tcc-0.9.26-1tcl/tcc.h	2014-05-01 19:50:24.973630534 -0500
           56  +@@ -23,6 +23,9 @@
           57  + 
           58  + #define _GNU_SOURCE
           59  + #include "config.h"
           60  ++#ifdef HAVE_TCL_H
           61  ++#  include <tcl.h>
           62  ++#endif
           63  + 
           64  + #ifdef CONFIG_TCCBOOT
           65  + #include "tccboot.h"

Added build/tcc-patches/0.9.26/tcc-0.9.26-tclio.diff version [8fe78dd24b].

            1  +diff -uNr tcc-0.9.26.orig/libtcc.c tcc-0.9.26-1tclio/libtcc.c
            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-02 01:30:08.967140003 -0500
            4  +@@ -669,7 +669,7 @@
            5  +     bf->line_num = 1;
            6  +     bf->ifndef_macro = 0;
            7  +     bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
            8  +-    bf->fd = -1;
            9  ++    bf->fd = NULL;
           10  +     bf->prev = file;
           11  +     file = bf;
           12  + }
           13  +@@ -677,26 +677,35 @@
           14  + ST_FUNC void tcc_close(void)
           15  + {
           16  +     BufferedFile *bf = file;
           17  +-    if (bf->fd > 0) {
           18  +-        close(bf->fd);
           19  ++    if (bf->fd != NULL) {
           20  ++        Tcl_Close(NULL,bf->fd);
           21  +         total_lines += bf->line_num;
           22  +     }
           23  +     file = bf->prev;
           24  +     tcc_free(bf);
           25  + }
           26  + 
           27  +-ST_FUNC int tcc_open(TCCState *s1, const char *filename)
           28  ++ST_FUNC Tcl_Channel tcc_open(TCCState *s1, const char *filename)
           29  + {
           30  +-    int fd;
           31  +-    if (strcmp(filename, "-") == 0)
           32  +-        fd = 0, filename = "stdin";
           33  +-    else
           34  +-        fd = open(filename, O_RDONLY | O_BINARY);
           35  +-    if ((s1->verbose == 2 && fd >= 0) || s1->verbose == 3)
           36  +-        printf("%s %*s%s\n", fd < 0 ? "nf":"->",
           37  ++    Tcl_Channel fd;
           38  ++    Tcl_Obj *path;
           39  ++
           40  ++    if (strcmp(filename, "-") == 0) {
           41  ++        fd = Tcl_GetStdChannel(TCL_STDIN);
           42  ++        filename = "stdin";
           43  ++    } else {
           44  ++        path = Tcl_NewStringObj(filename,-1);
           45  ++        Tcl_IncrRefCount(path);
           46  ++        fd = Tcl_FSOpenFileChannel(NULL,path, "r", 0);
           47  ++        Tcl_DecrRefCount(path);
           48  ++    }
           49  ++
           50  ++    if ((s1->verbose == 2 && fd != NULL) || s1->verbose == 3)
           51  ++        printf("%s %*s%s\n", fd == NULL ? "nf":"->",
           52  +                (int)(s1->include_stack_ptr - s1->include_stack), "", filename);
           53  +-    if (fd < 0)
           54  +-        return -1;
           55  ++    if (fd == NULL) {
           56  ++        return NULL;
           57  ++    }
           58  + 
           59  +     tcc_open_bf(s1, filename, 0);
           60  +     file->fd = fd;
           61  +@@ -1099,7 +1108,8 @@
           62  + {
           63  +     const char *ext;
           64  +     ElfW(Ehdr) ehdr;
           65  +-    int fd, ret, size;
           66  ++    int ret, size;
           67  ++    Tcl_Channel ret_chan, fd;
           68  + 
           69  +     /* find source file type with extension */
           70  +     ext = tcc_fileextension(filename);
           71  +@@ -1113,11 +1123,12 @@
           72  + #endif
           73  + 
           74  +     /* open the file */
           75  +-    ret = tcc_open(s1, filename);
           76  +-    if (ret < 0) {
           77  ++    ret = 0;
           78  ++    ret_chan = tcc_open(s1, filename);
           79  ++    if (ret_chan == NULL) {
           80  +         if (flags & AFF_PRINT_ERROR)
           81  +             tcc_error_noabort("file '%s' not found", filename);
           82  +-        return ret;
           83  ++        return -1;
           84  +     }
           85  + 
           86  +     /* update target deps */
           87  +@@ -1151,8 +1162,8 @@
           88  + 
           89  +     fd = file->fd;
           90  +     /* assume executable format: auto guess file type */
           91  +-    size = read(fd, &ehdr, sizeof(ehdr));
           92  +-    lseek(fd, 0, SEEK_SET);
           93  ++    size = Tcl_Read(fd, (char *)&ehdr, sizeof(ehdr));
           94  ++    Tcl_Seek(fd, 0, SEEK_SET);
           95  +     if (size <= 0) {
           96  +         tcc_error_noabort("could not read header");
           97  +         goto the_end;
           98  +diff -uNr tcc-0.9.26.orig/tcc.h tcc-0.9.26-1tclio/tcc.h
           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-02 01:30:08.967140003 -0500
          101  +@@ -429,7 +429,7 @@
          102  + typedef struct BufferedFile {
          103  +     uint8_t *buf_ptr;
          104  +     uint8_t *buf_end;
          105  +-    int fd;
          106  ++    Tcl_Channel fd;
          107  +     struct BufferedFile *prev;
          108  +     int line_num;    /* current line number - here to simplify code */
          109  +     int ifndef_macro;  /* #ifndef macro / #endif search */
          110  +@@ -1045,7 +1045,7 @@
          111  + ST_FUNC Sym *global_identifier_push(int v, int t, int c);
          112  + 
          113  + ST_FUNC void tcc_open_bf(TCCState *s1, const char *filename, int initlen);
          114  +-ST_FUNC int tcc_open(TCCState *s1, const char *filename);
          115  ++ST_FUNC Tcl_Channel tcc_open(TCCState *s1, const char *filename);
          116  + ST_FUNC void tcc_close(void);
          117  + 
          118  + ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags);
          119  +@@ -1226,8 +1226,8 @@
          120  + ST_FUNC void relocate_section(TCCState *s1, Section *s);
          121  + 
          122  + ST_FUNC void tcc_add_linker_symbols(TCCState *s1);
          123  +-ST_FUNC int tcc_load_object_file(TCCState *s1, int fd, unsigned long file_offset);
          124  +-ST_FUNC int tcc_load_archive(TCCState *s1, int fd);
          125  ++ST_FUNC int tcc_load_object_file(TCCState *s1, Tcl_Channel fd, unsigned long file_offset);
          126  ++ST_FUNC int tcc_load_archive(TCCState *s1, Tcl_Channel fd);
          127  + ST_FUNC void tcc_add_bcheck(TCCState *s1);
          128  + 
          129  + ST_FUNC void build_got_entries(TCCState *s1);
          130  +@@ -1239,7 +1239,7 @@
          131  + #endif
          132  + 
          133  + #ifndef TCC_TARGET_PE
          134  +-ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level);
          135  ++ST_FUNC int tcc_load_dll(TCCState *s1, Tcl_Channel fd, const char *filename, int level);
          136  + ST_FUNC int tcc_load_ldscript(TCCState *s1);
          137  + ST_FUNC uint8_t *parse_comment(uint8_t *p);
          138  + ST_FUNC void minp(void);
          139  +@@ -1313,7 +1313,7 @@
          140  + 
          141  + #ifdef TCC_TARGET_COFF
          142  + ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f);
          143  +-ST_FUNC int tcc_load_coff(TCCState * s1, int fd);
          144  ++ST_FUNC int tcc_load_coff(TCCState * s1, Tcl_Channel fd);
          145  + #endif
          146  + 
          147  + /* ------------ tccasm.c ------------ */
          148  +@@ -1335,7 +1335,7 @@
          149  + 
          150  + /* ------------ tccpe.c -------------- */
          151  + #ifdef TCC_TARGET_PE
          152  +-ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd);
          153  ++ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd);
          154  + ST_FUNC int pe_output_file(TCCState * s1, const char *filename);
          155  + ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value);
          156  + ST_FUNC SValue *pe_getimport(SValue *sv, SValue *v2);
          157  +diff -uNr tcc-0.9.26.orig/tcccoff.c tcc-0.9.26-1tclio/tcccoff.c
          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-02 01:30:08.967140003 -0500
          160  +@@ -858,10 +858,11 @@
          161  +     return 0;
          162  + }
          163  + 
          164  +-ST_FUNC int tcc_load_coff(TCCState * s1, int fd)
          165  ++ST_FUNC int tcc_load_coff(TCCState * s1, Tcl_Channel fd)
          166  + {
          167  + // tktk TokenSym *ts;
          168  + 
          169  ++    int native_fd;
          170  +     FILE *f;
          171  +     unsigned int str_size;
          172  +     char *Coff_str_table, *name;
          173  +@@ -869,8 +870,14 @@
          174  +     struct syment csym;
          175  +     char name2[9];
          176  +     FILHDR file_hdr;		/* FILE HEADER STRUCTURE              */
          177  ++    int tcl_ret;
          178  + 
          179  +-    f = fdopen(fd, "rb");
          180  ++    tcl_ret = Tcl_GetChannelHandle(fd, TCL_READABLE, &native_fd);
          181  ++    if (tcl_ret != TCL_OK) {
          182  ++	tcc_error("Unable to open .out file for input");
          183  ++    }
          184  ++
          185  ++    f = fdopen(native_fd, "rb");
          186  +     if (!f) {
          187  + 	tcc_error("Unable to open .out file for input");
          188  +     }
          189  +diff -uNr tcc-0.9.26.orig/tccelf.c tcc-0.9.26-1tclio/tccelf.c
          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-02 01:30:08.967140003 -0500
          192  +@@ -2334,13 +2334,13 @@
          193  +     return ret;
          194  + }
          195  + 
          196  +-static void *load_data(int fd, unsigned long file_offset, unsigned long size)
          197  ++static void *load_data(Tcl_Channel fd, unsigned long file_offset, unsigned long size)
          198  + {
          199  +     void *data;
          200  + 
          201  +     data = tcc_malloc(size);
          202  +-    lseek(fd, file_offset, SEEK_SET);
          203  +-    read(fd, data, size);
          204  ++    Tcl_Seek(fd, file_offset, SEEK_SET);
          205  ++    Tcl_Read(fd, data, size);
          206  +     return data;
          207  + }
          208  + 
          209  +@@ -2354,7 +2354,7 @@
          210  + /* load an object file and merge it with current files */
          211  + /* XXX: handle correctly stab (debug) info */
          212  + ST_FUNC int tcc_load_object_file(TCCState *s1, 
          213  +-                                int fd, unsigned long file_offset)
          214  ++                                Tcl_Channel fd, unsigned long file_offset)
          215  + { 
          216  +     ElfW(Ehdr) ehdr;
          217  +     ElfW(Shdr) *shdr, *sh;
          218  +@@ -2372,7 +2372,7 @@
          219  + 
          220  +     stab_index = stabstr_index = 0;
          221  + 
          222  +-    if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr))
          223  ++    if (Tcl_Read(fd, (char *) &ehdr, sizeof(ehdr)) != sizeof(ehdr))
          224  +         goto fail1;
          225  +     if (ehdr.e_ident[0] != ELFMAG0 ||
          226  +         ehdr.e_ident[1] != ELFMAG1 ||
          227  +@@ -2499,9 +2499,9 @@
          228  +         size = sh->sh_size;
          229  +         if (sh->sh_type != SHT_NOBITS) {
          230  +             unsigned char *ptr;
          231  +-            lseek(fd, file_offset + sh->sh_offset, SEEK_SET);
          232  ++            Tcl_Seek(fd, file_offset + sh->sh_offset, SEEK_SET);
          233  +             ptr = section_ptr_add(s, size);
          234  +-            read(fd, ptr, size);
          235  ++            Tcl_Read(fd, ptr, size);
          236  +         } else {
          237  +             s->data_offset += size;
          238  +         }
          239  +@@ -2657,7 +2657,7 @@
          240  + }
          241  + 
          242  + /* load only the objects which resolve undefined symbols */
          243  +-static int tcc_load_alacarte(TCCState *s1, int fd, int size)
          244  ++static int tcc_load_alacarte(TCCState *s1, Tcl_Channel fd, int size)
          245  + {
          246  +     int i, bound, nsyms, sym_index, off, ret;
          247  +     uint8_t *data;
          248  +@@ -2666,7 +2666,7 @@
          249  +     ElfW(Sym) *sym;
          250  + 
          251  +     data = tcc_malloc(size);
          252  +-    if (read(fd, data, size) != size)
          253  ++    if (Tcl_Read(fd, data, size) != size)
          254  +         goto fail;
          255  +     nsyms = get_be32(data);
          256  +     ar_index = data + 4;
          257  +@@ -2684,7 +2684,7 @@
          258  +                     printf("%5d\t%s\t%08x\n", i, p, sym->st_shndx);
          259  + #endif
          260  +                     ++bound;
          261  +-                    lseek(fd, off, SEEK_SET);
          262  ++                    Tcl_Seek(fd, off, SEEK_SET);
          263  +                     if(tcc_load_object_file(s1, fd, off) < 0) {
          264  +                     fail:
          265  +                         ret = -1;
          266  +@@ -2701,7 +2701,7 @@
          267  + }
          268  + 
          269  + /* load a '.a' file */
          270  +-ST_FUNC int tcc_load_archive(TCCState *s1, int fd)
          271  ++ST_FUNC int tcc_load_archive(TCCState *s1, Tcl_Channel fd)
          272  + {
          273  +     ArchiveHeader hdr;
          274  +     char ar_size[11];
          275  +@@ -2711,10 +2711,10 @@
          276  +     unsigned long file_offset;
          277  + 
          278  +     /* skip magic which was already checked */
          279  +-    read(fd, magic, sizeof(magic));
          280  ++    Tcl_Read(fd, magic, sizeof(magic));
          281  +     
          282  +     for(;;) {
          283  +-        len = read(fd, &hdr, sizeof(hdr));
          284  ++        len = Tcl_Read(fd, (char *) &hdr, sizeof(hdr));
          285  +         if (len == 0)
          286  +             break;
          287  +         if (len != sizeof(hdr)) {
          288  +@@ -2731,7 +2731,7 @@
          289  +         }
          290  +         ar_name[i + 1] = '\0';
          291  +         //        printf("name='%s' size=%d %s\n", ar_name, size, ar_size);
          292  +-        file_offset = lseek(fd, 0, SEEK_CUR);
          293  ++        file_offset = Tcl_Seek(fd, 0, SEEK_CUR);
          294  +         /* align to even */
          295  +         size = (size + 1) & ~1;
          296  +         if (!strcmp(ar_name, "/")) {
          297  +@@ -2747,7 +2747,7 @@
          298  +             if (tcc_load_object_file(s1, fd, file_offset) < 0)
          299  +                 return -1;
          300  +         }
          301  +-        lseek(fd, file_offset + size, SEEK_SET);
          302  ++        Tcl_Seek(fd, file_offset + size, SEEK_SET);
          303  +     }
          304  +     return 0;
          305  + }
          306  +@@ -2756,7 +2756,7 @@
          307  + /* load a DLL and all referenced DLLs. 'level = 0' means that the DLL
          308  +    is referenced by the user (so it should be added as DT_NEEDED in
          309  +    the generated ELF file) */
          310  +-ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
          311  ++ST_FUNC int tcc_load_dll(TCCState *s1, Tcl_Channel fd, const char *filename, int level)
          312  + { 
          313  +     ElfW(Ehdr) ehdr;
          314  +     ElfW(Shdr) *shdr, *sh, *sh1;
          315  +@@ -2767,7 +2767,7 @@
          316  +     const char *name, *soname;
          317  +     DLLReference *dllref;
          318  +     
          319  +-    read(fd, &ehdr, sizeof(ehdr));
          320  ++    Tcl_Read(fd, (char *) &ehdr, sizeof(ehdr));
          321  + 
          322  +     /* test CPU specific stuff */
          323  +     if (ehdr.e_ident[5] != ELFDATA2LSB ||
          324  +diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1tclio/tccpe.c
          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-02 01:30:08.967140003 -0500
          327  +@@ -1505,10 +1505,10 @@
          328  + 
          329  + /* ------------------------------------------------------------- */
          330  + 
          331  +-static int read_mem(int fd, unsigned offset, void *buffer, unsigned len)
          332  ++static int read_mem(Tcl_Channel fd, unsigned offset, void *buffer, unsigned len)
          333  + {
          334  +-    lseek(fd, offset, SEEK_SET);
          335  +-    return len == read(fd, buffer, len);
          336  ++    Tcl_Seek(fd, offset, SEEK_SET);
          337  ++    return len == Tcl_Read(fd, buffer, len);
          338  + }
          339  + 
          340  + /* -------------------------------------------------------------
          341  +@@ -1516,7 +1516,7 @@
          342  +  *  as generated by 'windres.exe -O coff ...'.
          343  +  */
          344  + 
          345  +-static int pe_load_res(TCCState *s1, int fd)
          346  ++static int pe_load_res(TCCState *s1, Tcl_Channel fd)
          347  + {
          348  +     struct pe_rsrc_header hdr;
          349  +     Section *rsrc_section;
          350  +@@ -1571,11 +1571,11 @@
          351  +     return a;
          352  + }
          353  + 
          354  +-static char *get_line(char *line, int size, int fd)
          355  ++static char *get_line(char *line, int size, Tcl_Channel fd)
          356  + {
          357  +     int n;
          358  +     for (n = 0; n < size - 1; )
          359  +-        if (read(fd, line + n, 1) < 1 || line[n++] == '\n')
          360  ++        if (Tcl_Read(fd, line + n, 1) < 1 || line[n++] == '\n')
          361  +             break;
          362  +     if (0 == n)
          363  +         return NULL;
          364  +@@ -1584,7 +1584,7 @@
          365  + }
          366  + 
          367  + /* ------------------------------------------------------------- */
          368  +-static int pe_load_def(TCCState *s1, int fd)
          369  ++static int pe_load_def(TCCState *s1, Tcl_Channel fd)
          370  + {
          371  +     int state = 0, ret = -1, dllindex = 0;
          372  +     char line[400], dllname[80], *p;
          373  +@@ -1627,7 +1627,7 @@
          374  + #define TINY_IMPDEF_GET_EXPORT_NAMES_ONLY
          375  + #include "win32/tools/tiny_impdef.c"
          376  + 
          377  +-static int pe_load_dll(TCCState *s1, const char *dllname, int fd)
          378  ++static int pe_load_dll(TCCState *s1, const char *dllname, Tcl_Channel fd)
          379  + {
          380  +     char *p, *q;
          381  +     int index;
          382  +@@ -1642,7 +1642,7 @@
          383  + }
          384  + 
          385  + /* ------------------------------------------------------------- */
          386  +-ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, int fd)
          387  ++ST_FUNC int pe_load_file(struct TCCState *s1, const char *filename, Tcl_Channel fd)
          388  + {
          389  +     int ret = -1;
          390  +     char buf[10];
          391  +diff -uNr tcc-0.9.26.orig/tccpp.c tcc-0.9.26-1tclio/tccpp.c
          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-02 01:30:08.967140003 -0500
          394  +@@ -360,13 +360,13 @@
          395  +     int len;
          396  +     /* only tries to read if really end of buffer */
          397  +     if (bf->buf_ptr >= bf->buf_end) {
          398  +-        if (bf->fd != -1) {
          399  ++        if (bf->fd != NULL) {
          400  + #if defined(PARSE_DEBUG)
          401  +             len = 8;
          402  + #else
          403  +             len = IO_BUF_SIZE;
          404  + #endif
          405  +-            len = read(bf->fd, bf->buffer, len);
          406  ++            len = Tcl_Read(bf->fd, bf->buffer, len);
          407  +             if (len < 0)
          408  +                 len = 0;
          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  + 
          419  +diff -uNr tcc-0.9.26.orig/win32/tools/tiny_impdef.c tcc-0.9.26-1tclio/win32/tools/tiny_impdef.c
          420  +--- tcc-0.9.26.orig/win32/tools/tiny_impdef.c	2013-02-15 08:24:00.000000000 -0600
          421  ++++ tcc-0.9.26-1tclio/win32/tools/tiny_impdef.c	2014-05-02 01:31:28.497140003 -0500
          422  +@@ -161,7 +161,7 @@
          423  + /* -------------------------------------------------------------- */
          424  + #endif
          425  + 
          426  +-char *get_export_names(int fd)
          427  ++char *get_export_names(Tcl_Channel fd)
          428  + {
          429  +     int l, i, n, n0;
          430  +     char *p;

Added build/tcc-patches/0.9.26/tcc-0.9.26-win32useopenlibs.diff version [44e95e05fe].

            1  +diff -uNr tcc-0.9.26.orig/tccpe.c tcc-0.9.26-1win32useopenlibs/tccpe.c
            2  +--- tcc-0.9.26.orig/tccpe.c	2013-02-15 08:24:00.000000000 -0600
            3  ++++ tcc-0.9.26-1win32useopenlibs/tccpe.c	2014-05-04 02:20:25.285150002 -0500
            4  +@@ -38,6 +38,9 @@
            5  + # define ADDR3264 DWORD
            6  + #endif
            7  + 
            8  ++#ifdef TCC_IS_NATIVE
            9  ++#include <psapi.h>
           10  ++#endif
           11  + #ifdef _WIN32
           12  + void dbg_printf (const char *fmt, ...)
           13  + {
           14  +@@ -831,7 +834,27 @@
           15  +                     if (dllref) {
           16  +                         if ( !dllref->handle )
           17  +                             dllref->handle = LoadLibrary(dllref->name);
           18  +-                        v = (ADDR3264)GetProcAddress(dllref->handle, name);
           19  ++                        if (dllref->handle) {
           20  ++                            v = (ADDR3264)GetProcAddress(dllref->handle, name);
           21  ++                        }
           22  ++                    }
           23  ++                    if (!v) {
           24  ++                        HANDLE cur_proc = GetCurrentProcess();
           25  ++                        HMODULE *modules;
           26  ++                        DWORD needed, i;
           27  ++
           28  ++                        needed = 0;
           29  ++                        EnumProcessModules(cur_proc, NULL, 0, &needed);
           30  ++                        modules = tcc_malloc(needed);
           31  ++                        if (EnumProcessModules(cur_proc, modules, needed, &needed)) {
           32  ++                            for (i = 0; i < needed / sizeof(HMODULE); i++) {
           33  ++                                v = (ADDR3264)GetProcAddress(modules[i], name);
           34  ++                                if (v) {
           35  ++                                    break;
           36  ++                                }
           37  ++                            }
           38  ++                        }
           39  ++                        tcc_free(modules);
           40  +                     }
           41  +                     if (!v)
           42  +                         tcc_error_noabort("undefined symbol '%s'", name);
           43  +@@ -1209,9 +1232,35 @@
           44  + 
           45  +             const char *name = symtab_section->link->data + sym->st_name;
           46  +             unsigned type = ELFW(ST_TYPE)(sym->st_info);
           47  +-            int imp_sym = pe_find_import(pe->s1, sym);
           48  ++            int imp_sym;
           49  +             struct import_symbol *is;
           50  + 
           51  ++            imp_sym = pe_find_import(pe->s1, sym);
           52  ++            if (0 == imp_sym) {
           53  ++                HANDLE cur_proc = GetCurrentProcess();
           54  ++                HMODULE *modules;
           55  ++                DWORD needed, i;
           56  ++                const char *symname;
           57  ++                void *addr;
           58  ++
           59  ++                symname = pe_export_name(pe->s1, sym);
           60  ++
           61  ++                needed = 0;
           62  ++                EnumProcessModules(cur_proc, NULL, 0, &needed);
           63  ++                modules = tcc_malloc(needed);
           64  ++                if (EnumProcessModules(cur_proc, modules, needed, &needed)) {
           65  ++                    for (i = 0; i < needed / sizeof(HMODULE); i++) {
           66  ++                        addr = GetProcAddress(modules[i], symname);
           67  ++                        if (addr) {
           68  ++                            put_elf_sym( pe->s1->dynsymtab_section, (ADDR3264) addr, sizeof(addr), ELFW(ST_INFO)(STB_GLOBAL, STT_OBJECT), 0, SHN_UNDEF, symname);
           69  ++                            imp_sym = pe_find_import(pe->s1, sym);
           70  ++                            break;
           71  ++                        }
           72  ++                    }
           73  ++                }
           74  ++                tcc_free(modules);
           75  ++            }
           76  ++
           77  +             if (0 == imp_sym)
           78  +                 goto not_found;
           79  + 

Added headers.awk version [ea9e38a74d].

            1  +/^# [0-9][0-9]* /{
            2  +	file = $3;
            3  +
            4  +	gsub(/^"/, "", file);
            5  +	gsub(/"$/, "", file);
            6  +
            7  +	destfile = file;
            8  +	if (!gsub(/^.*\/include\//, "", destfile)) {
            9  +		if (!gsub(/^.*\/include-fixed\//, "fix/", destfile)) {
           10  +			next
           11  +		}
           12  +	}
           13  +
           14  +	if (file ~ /</) {
           15  +		next;
           16  +	}
           17  +
           18  +	if (file !~ /\.h$/) {
           19  +		next;
           20  +	}
           21  +
           22  +	copy[file] = destfile;
           23  +}
           24  +
           25  +END{
           26  +	for (key in copy) {
           27  +		print key, copy[key];
           28  +	}
           29  +}

Modified pkgIndex.tcl.in from [da39a3ee5e] to [00c586db9f].

            1  +package ifneeded tcc4tcl @PACKAGE_VERSION@ [list source [file join $dir tcc4tcl.tcl]]

Modified tcc4tcl.c from [f5d4fd88e2] to [aa505b066c].

     1      1   /*
     2      2    *  TclTCC - Tcl binding to Tiny C Compiler
     3      3    * 
     4      4    *  Copyright (c) 2007 Mark Janssen
            5  + *  Copyright (c) 2014 Roy Keene
     5      6    *
     6      7    * This library is free software; you can redistribute it and/or
     7      8    * modify it under the terms of the GNU Lesser General Public
     8      9    * License as published by the Free Software Foundation; either
     9     10    * version 2 of the License, or (at your option) any later version.
    10     11    *
    11     12    * This library is distributed in the hope that it will be useful,
................................................................................
    14     15    * Lesser General Public License for more details.
    15     16    *
    16     17    * You should have received a copy of the GNU Lesser General Public
    17     18    * License along with this library; if not, write to the Free Software
    18     19    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    19     20    */
    20     21   
    21         -static void TccErrorFunc(Tcl_Interp * interp, char * msg) {
    22         -    Tcl_AppendResult(interp, msg, "\n", NULL);
           22  +#include <tcl.h>
           23  +#include <stdlib.h>
           24  +#include "tcc.h"
           25  +
           26  +struct TclTCCState {
           27  +	TCCState *s;
           28  +	int relocated;
           29  +};
           30  +
           31  +static void Tcc4tclErrorFunc(Tcl_Interp * interp, char * msg) {
           32  +	Tcl_AppendResult(interp, msg, "\n", NULL);
    23     33   }
    24     34   
           35  +static void Tcc4tclCCommandDeleteProc (ClientData cdata) {
           36  +	struct TclTCCState *ts;
           37  +	TCCState *s ;
    25     38   
    26         -static void TccCCommandDeleteProc (ClientData cdata) {
    27         -    TCCState * s ;
    28         -    s = (TCCState *)cdata;
    29         -    Tcl_DecrRefCount(s->tcc_lib_path);
    30         -    /* We can delete the compiler if the output was not to memory */
    31         -    if (s->output_type != TCC_OUTPUT_MEMORY) {
    32         -        tcc_delete(s);
    33         -    }
           39  +	ts = (struct TclTCCState *) cdata;
           40  +	s = ts->s;
           41  +
           42  +	/* We can delete the compiler if the output was not to memory */
           43  +	if (s->output_type != TCC_OUTPUT_MEMORY) {
           44  +		tcc_delete(s);
           45  +		ts->s = NULL;
           46  +	}
           47  +
           48  +	ckfree((void *) ts);
    34     49   }
    35     50   
    36         -static int TccHandleCmd ( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){
    37         -    unsigned long val;
    38         -    int index;
    39         -    int res;
    40         -    TCCState * s = (TCCState *)cdata ;
    41         -    Tcl_Obj * sym_addr;
           51  +static int Tcc4tclHandleCmd ( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){
           52  +	unsigned long val;
           53  +	void *val_p;
           54  +	int index;
           55  +	int res;
           56  +	struct TclTCCState *ts;
           57  +	TCCState *s;
           58  +	Tcl_Obj *sym_addr;
           59  +	static CONST char *options[] = {
           60  +		"add_include_path", "add_file",  "add_library", 
           61  +		"add_library_path", "add_symbol", "command", "compile",
           62  +		"define", "get_symbol", "output_file", "undefine",    (char *) NULL
           63  +	};
           64  +	enum options {
           65  +		TCLTCC_ADD_INCLUDE, TCLTCC_ADD_FILE, TCLTCC_ADD_LIBRARY, 
           66  +		TCLTCC_ADD_LIBRARY_PATH, TCLTCC_ADD_SYMBOL, TCLTCC_COMMAND, TCLTCC_COMPILE,
           67  +		TCLTCC_DEFINE, TCLTCC_GET_SYMBOL, TCLTCC_OUTPUT_FILE, TCLTCC_UNDEFINE
           68  +	};
    42     69   
    43         -    static CONST char *options[] = {
    44         -        "add_include_path", "add_file",  "add_library", 
    45         -        "add_library_path", "add_symbol", "command", "compile",
    46         -        "define", "get_symbol", "output_file", "undefine",    (char *) NULL
    47         -    };
    48         -    enum options {
    49         -        TCLTCC_ADD_INCLUDE, TCLTCC_ADD_FILE, TCLTCC_ADD_LIBRARY, 
    50         -        TCLTCC_ADD_LIBRARY_PATH, TCLTCC_ADD_SYMBOL, TCLTCC_COMMAND, TCLTCC_COMPILE,
    51         -        TCLTCC_DEFINE, TCLTCC_GET_SYMBOL, TCLTCC_OUTPUT_FILE, TCLTCC_UNDEFINE
    52         -    };
    53         -
           70  +	ts = (struct TclTCCState *) cdata;
           71  +	s = ts->s;
    54     72   
    55     73       if (objc < 2) {
    56     74           Tcl_WrongNumArgs(interp, 1, objv, "subcommand arg ?arg ...?");
    57     75           return TCL_ERROR;
    58     76       }
    59     77   
    60     78       if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0,
................................................................................
    93    111               if (objc != 3) {
    94    112                   Tcl_WrongNumArgs(interp, 2, objv, "path");
    95    113                   return TCL_ERROR;
    96    114               } else {
    97    115                   tcc_add_library_path(s, Tcl_GetString(objv[2]));
    98    116                   return TCL_OK;
    99    117               }
          118  +#if 0
   100    119           case TCLTCC_ADD_SYMBOL:
   101    120               if (objc != 4) {
   102    121                   Tcl_WrongNumArgs(interp, 2, objv, "symbol value");
   103    122                   return TCL_ERROR;
   104    123               }
   105    124               Tcl_GetLongFromObj(interp,objv[3], &val);
          125  +
   106    126               tcc_add_symbol(s,Tcl_GetString(objv[2]),val); 
   107    127               return TCL_OK; 
          128  +#endif
   108    129           case TCLTCC_COMMAND:
   109    130               if (objc != 4) {
   110    131                   Tcl_WrongNumArgs(interp, 2, objv, "tclname cname");
   111    132                   return TCL_ERROR;
   112    133               }
   113         -            if (!s->relocated) {     
   114         -                if(tcc_relocate(s)!=0) {
          134  +            if (!ts->relocated) {     
          135  +                if(tcc_relocate(s, TCC_RELOCATE_AUTO)!=0) {
   115    136                       Tcl_AppendResult(interp, "relocating failed", NULL);
   116    137                       return TCL_ERROR;
   117    138                   } else {
   118         -                    s->relocated=1;
          139  +                    ts->relocated=1;
   119    140                   }
   120    141               }
   121         -            if (tcc_get_symbol(s,&val,Tcl_GetString(objv[3]))!=0) {
          142  +
          143  +            val_p = tcc_get_symbol(s, Tcl_GetString(objv[3]));
          144  +            if (val_p == NULL) {
   122    145   		    Tcl_AppendResult(interp, "symbol '", Tcl_GetString(objv[3]),"' not found", NULL);
   123    146   		    return TCL_ERROR;
   124    147   	    }
   125    148   
   126    149               /*printf("symbol: %x\n",val); */
   127         -            Tcl_CreateObjCommand(interp,Tcl_GetString(objv[2]),(void *)val,NULL,NULL);
          150  +            Tcl_CreateObjCommand(interp,Tcl_GetString(objv[2]),val_p,NULL,NULL);
   128    151               return TCL_OK;
   129    152           case TCLTCC_COMPILE:
   130         -            if(s->relocated == 1) {
          153  +            if(ts->relocated == 1) {
   131    154                   Tcl_AppendResult(interp, "code already relocated, cannot compile more",NULL);
   132    155                   return TCL_ERROR;
   133    156               }
   134    157               if (objc != 3) {
   135    158                   Tcl_WrongNumArgs(interp, 2, objv, "ccode");
   136    159                   return TCL_ERROR;
   137    160               } else {
................................................................................
   154    177               tcc_define_symbol(s,Tcl_GetString(objv[2]),Tcl_GetString(objv[3]));
   155    178               return TCL_OK;
   156    179           case TCLTCC_GET_SYMBOL:
   157    180               if (objc != 3) {
   158    181                   Tcl_WrongNumArgs(interp, 2, objv, "symbol");
   159    182                   return TCL_ERROR;
   160    183               }
   161         -            if (!s->relocated) {     
   162         -                if(tcc_relocate(s)!=0) {
          184  +            if (!ts->relocated) {     
          185  +                if(tcc_relocate(s, TCC_RELOCATE_AUTO)!=0) {
   163    186                       Tcl_AppendResult(interp, "relocating failed", NULL);
   164    187                       return TCL_ERROR;
   165    188                   } else {
   166         -                    s->relocated=1;
          189  +                    ts->relocated=1;
   167    190                   }
   168    191               }
   169         -            if(tcc_get_symbol(s,&val,Tcl_GetString(objv[2]))!=0) {
          192  +            val_p = tcc_get_symbol(s,Tcl_GetString(objv[2]));
          193  +            if(val_p == NULL) {
   170    194                   Tcl_AppendResult(interp, "symbol '", Tcl_GetString(objv[2]),"' not found", NULL);
   171    195                   return TCL_ERROR;
   172    196               }
   173         -            sym_addr = Tcl_NewLongObj(val);
          197  +            sym_addr = Tcl_NewWideIntObj((Tcl_WideInt) val_p);
   174    198               Tcl_SetObjResult(interp, sym_addr);
   175    199               return TCL_OK; 
   176    200           case TCLTCC_OUTPUT_FILE:
   177    201               if (objc != 3) {
   178    202                   Tcl_WrongNumArgs(interp, 2, objv, "filename");
   179    203                   return TCL_ERROR;
   180    204               }
   181         -            if (s->relocated) {     
          205  +            if (ts->relocated) {     
   182    206                   Tcl_AppendResult(interp, "code already relocated, cannot output to file", NULL);
   183    207                   return TCL_ERROR;
   184    208               }
   185    209               if (s->output_type == TCC_OUTPUT_MEMORY) {     
   186    210                   Tcl_AppendResult(interp, "output_type memory not valid for output to file", NULL);
   187    211                   return TCL_ERROR;
   188    212               }
   189         -#ifdef WIN32
   190         -            res = tcc_output_pe(s,Tcl_GetString(objv[2]));
   191         -#else
   192    213               res = tcc_output_file(s,Tcl_GetString(objv[2]));
   193         -#endif
   194    214   
   195    215               if (res!=0) {
   196    216                   Tcl_AppendResult(interp, "output to file failed", NULL);
   197    217                   return TCL_ERROR;
   198    218               } else {
   199    219                   return TCL_OK;
   200    220               }
................................................................................
   207    227               return TCL_OK;
   208    228           default:
   209    229               Tcl_Panic("internal error during option lookup");
   210    230       }
   211    231       return TCL_OK;
   212    232   } 
   213    233   
   214         -static int TccCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){
   215         -    TCCState * s;
   216         -    static CONST char *types[] = {
   217         -        "memory", "exe", "dll", "obj", "preprocess",    (char *) NULL
   218         -    };
   219         -    int index;
   220         -    if (objc < 3 || objc > 4) {
   221         -        Tcl_WrongNumArgs(interp, 1, objv, "tcc_libary_path ?output_type? handle");
   222         -        return TCL_ERROR;
   223         -    }
   224         -    if (objc == 3) {
   225         -        index = TCC_OUTPUT_MEMORY;
   226         -    } else {
   227         -        if (Tcl_GetIndexFromObj(interp, objv[2], types, "type", 0,
   228         -                    &index) != TCL_OK) {
   229         -            return TCL_ERROR;
   230         -        }
   231         -    }
   232         -    s = tcc_new(objv[1]);
   233         -    tcc_set_error_func(s, interp, (void *)&TccErrorFunc);
   234         -    s->relocated = 0;
   235         -    /*printf("type: %d\n", index); */
   236         -    tcc_set_output_type(s,index);
   237         -    Tcl_CreateObjCommand(interp,Tcl_GetString(objv[objc-1]),TccHandleCmd,s,TccCCommandDeleteProc);
          234  +static int Tcc4tclCreateCmd( ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]){
          235  +	struct TclTCCState *ts;
          236  +	TCCState *s;
          237  +    	int index;
          238  +	static CONST char *types[] = {
          239  +		"memory", "exe", "dll", "obj", "preprocess",    (char *) NULL
          240  +	};
          241  +
          242  +	if (objc < 3 || objc > 4) {
          243  +		Tcl_WrongNumArgs(interp, 1, objv, "tcc_libary_path ?output_type? handle");
          244  +		return TCL_ERROR;
          245  +	}
          246  +
          247  +	if (objc == 3) {
          248  +		index = TCC_OUTPUT_MEMORY;
          249  +	} else {
          250  +		if (Tcl_GetIndexFromObj(interp, objv[2], types, "type", 0, &index) != TCL_OK) {
          251  +			return TCL_ERROR;
          252  +		}
          253  +	}
          254  +
          255  +	s = tcc_new(Tcl_GetString(objv[1]));
          256  +	if (s == NULL) {
          257  +		return(TCL_ERROR);
          258  +	}
          259  +
          260  +	tcc_set_error_func(s, interp, (void *)&Tcc4tclErrorFunc);
          261  +
          262  +	ts = (void *) ckalloc(sizeof(*ts));
          263  +	ts->s = s;
          264  +    	ts->relocated = 0;
          265  +
          266  +	/*printf("type: %d\n", index); */
          267  +	tcc_set_output_type(s,index);
          268  +	Tcl_CreateObjCommand(interp,Tcl_GetString(objv[objc-1]),Tcc4tclHandleCmd,ts,Tcc4tclCCommandDeleteProc);
   238    269   
   239         -    return TCL_OK;
          270  +	return TCL_OK;
   240    271   }
   241    272   
   242         -DLL_EXPORT int Tcc_Init(Tcl_Interp *interp)
   243         -{
   244         -    if (Tcl_InitStubs(interp, "8.4" , 0) == 0L) {
   245         -        return TCL_ERROR;
   246         -    }
   247         -    Tcl_CreateObjCommand(interp,PACKAGE_NAME,TccCreateCmd,NULL,NULL);
   248         -    Tcl_PkgProvide(interp,PACKAGE_NAME,PACKAGE_VERSION);
   249         -    return TCL_OK;
   250         -}
          273  +int Tcc4tcl_Init(Tcl_Interp *interp) {
          274  +#ifdef USE_TCL_STUBS
          275  +	if (Tcl_InitStubs(interp, "8.4" , 0) == 0L) {
          276  +		return TCL_ERROR;
          277  +	}
          278  +#endif
          279  +
          280  +	Tcl_CreateObjCommand(interp, PACKAGE_NAME, Tcc4tclCreateCmd, NULL, NULL);
          281  +	Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
   251    282   
   252         -
   253         -
          283  +	return TCL_OK;
          284  +}

Added tcc4tcl.syms.in version [98fca54777].

            1  +@SYMPREFIX@Tcc4tcl_Init

Modified tcc4tcl.tcl from [b543309b89] to [271b665fc7].

     1      1   # tcc.tcl - library routines for the tcc wrapper (Mark Janssen)
     2      2   
     3         -namespace eval tcc {
            3  +namespace eval tcc4tcl {
     4      4      variable dir 
     5      5      variable libs
     6      6      variable includes
     7      7      variable count
     8      8      variable command_count
     9      9      variable commands
    10     10   
    11     11      set dir [file dirname [info script]]
    12         -   if {[info command ::tcc] == ""} {
    13         -      catch { load {} tcc }
           12  +   if {[info command ::tcc4tcl] == ""} {
           13  +      catch { load {} tcc4tcl }
    14     14      }
    15         -   if {[info command ::tcc] == ""} {
    16         -       switch -exact -- $::tcl_platform(platform) {
    17         -	       windows { load $dir/tcc04.dll tcc }
    18         -	       unix { load $dir/libtcc0.4.so tcc }
    19         -	       default {error "unsupport platform"}
    20         -       }
           15  +   if {[info command ::tcc4tcl] == ""} {
           16  +       load [file join $dir tcc4tcl[info sharedlibextension]] tcc4tcl
    21     17      }
    22     18      set libs $dir/lib
    23     19      set includes $dir/include
    24     20      set count 0
    25     21      set command_count 0
    26     22      array set commands {}
    27     23      proc new {} {
    28     24          variable dir
    29     25          variable count
    30     26          set handle tcc_[incr count]
    31         -       tcc $dir $handle
           27  +       tcc4tcl $dir $handle
    32     28          return tcc_$count
    33     29      }
    34     30      proc tclcommand {handle name ccode} {
    35     31          variable commands
    36     32          variable command_count
    37     33          set cname _tcc_tcl_command_[incr command_count]
    38     34          set code    {#include "tcl.h"}
................................................................................
    53     49              set tclcommand [join [lrange [split $cmd ,] 1 end] {}]
    54     50              set handle [lindex [split $cmd ,] 0]
    55     51              $handle command $tclcommand $cname
    56     52           }
    57     53          return
    58     54      }
    59     55   }
    60         -proc tcc::to_dll {code dll {libs {}}} {
    61         -    tcc $::tcc::dir dll tcc_1
    62         -    tcc_1 add_library tcl8.5 
    63         -    tcc_1 add_library_path .
           56  +proc tcc4tcl::to_dll {code dll {libs {}}} {
           57  +    tcc4tcl $::tcc4tcl::dir dll tcc_1
    64     58       foreach lib $libs {tcc_1 add_library $lib}
    65     59       if {$::tcl_platform(platform) eq "windows"} {
    66     60           tcc_1 define DLL_EXPORT {__declspec(dllexport)} 
    67         -        set f [open $::tcc::dir/c/dllcrt1.c]
           61  +        set f [open $::tcc4tcl::dir/c/dllcrt1.c]
    68     62           tcc_1 compile [read $f]
    69     63           close $f
    70         -        set f [open $::tcc::dir/c/dllmain.c]
           64  +        set f [open $::tcc4tcl::dir/c/dllmain.c]
    71     65           tcc_1 compile [read $f]
    72     66           close $f
    73     67       } else {
    74     68           tcc_1 define DLL_EXPORT ""
    75     69       }
    76     70       tcc_1 compile $code
    77     71       tcc_1 output_file $dll
    78     72       rename tcc_1 {}
    79     73   }
    80         -proc ::tcc::Log {args} {
           74  +proc ::tcc4tcl::Log {args} {
    81     75     # puts $args
    82     76   }
    83         -proc ::tcc::reset {} {
           77  +proc ::tcc4tcl::reset {} {
    84     78     variable tcc
    85     79     set tcc(code)   ""
    86     80     set tcc(cfiles) [list]
    87     81     set tcc(tk) 0
    88     82   }
    89     83   # Custom helpers
    90         -proc ::tcc::checkname {n} {expr {[regexp {^[a-zA-Z0-9_]+$} $n] > 0}}
    91         -proc ::tcc::cleanname {n} {regsub -all {[^a-zA-Z0-9_]+} $n _}
           84  +proc ::tcc4tcl::checkname {n} {expr {[regexp {^[a-zA-Z0-9_]+$} $n] > 0}}
           85  +proc ::tcc4tcl::cleanname {n} {regsub -all {[^a-zA-Z0-9_]+} $n _}
    92     86   
    93         -proc ::tcc::ccode {code} {
           87  +proc ::tcc4tcl::ccode {code} {
    94     88     variable tcc
    95     89     Log "INJECTING CCODE"
    96     90     append tcc(code) $code \n
    97     91   }
    98         -proc ::tcc::cc {code} {
           92  +proc ::tcc4tcl::cc {code} {
    99     93     variable tcc
   100     94     if {![info exists tcc(cc)]} {
   101     95         set tcc(cc) tcc1
   102         -      tcc $tcc::dir $tcc(cc)
   103         -      $tcc(cc) add_library tcl8.5
   104         -      $tcc(cc) add_include_path [file join $::tcc::dir include]
           96  +      tcc4tcl $::tcc4tcl::dir $tcc(cc)
   105     97     }
   106     98     Log code:$code
   107     99     $tcc(cc) compile $code
   108    100   }
   109    101   #----------------------------------------------------------- New DLL API
   110         -proc ::tcc::dll {{name ""}} {
          102  +proc ::tcc4tcl::dll {{name ""}} {
   111    103       variable count
   112    104       if {$name eq ""} {set name dll[incr count]}
   113         -    namespace eval ::tcc::dll::$name {
          105  +    namespace eval ::tcc4tcl::dll::$name {
   114    106           variable code "#include <tcl.h>\n" ;# always needed
   115    107           variable cmds {}
   116    108       }
   117         -    proc ::$name {cmd args} "::tcc::dll::\$cmd $name \$args"
          109  +    proc ::$name {cmd args} "::tcc4tcl::dll::\$cmd $name \$args"
   118    110       return $name
   119    111   }
   120         -namespace eval ::tcc::dll {}
   121         -proc ::tcc::dll::ccode {name argl} {
          112  +namespace eval ::tcc4tcl::dll {}
          113  +proc ::tcc4tcl::dll::ccode {name argl} {
   122    114       append ${name}::code \n [lindex $argl 0]
   123    115       return
   124    116   }
   125         -proc ::tcc::dll::cproc {name argl} {
          117  +proc ::tcc4tcl::dll::cproc {name argl} {
   126    118       foreach {pname pargs rtype body} $argl break
   127         -    set code [::tcc::wrapCmd $pname $pargs $rtype cx_$pname $body]
          119  +    set code [::tcc4tcl::wrapCmd $pname $pargs $rtype cx_$pname $body]
   128    120       lappend ${name}::cmds $pname cx_$pname
   129    121       append ${name}::code \n $code
   130    122       return
   131    123   }
   132         -proc ::tcc::dll::write {name argl} {
          124  +proc ::tcc4tcl::dll::write {name argl} {
   133    125       set (-dir) .
   134    126       set (-code) "" ;# possible extra code to go into the _Init function
   135    127       set (-libs) ""
   136    128       set (-name) [string tolower $name]
   137    129       array set "" $argl
   138    130       append ${name}::code \n \
   139         -        [::tcc::wrapExport $(-name) [set ${name}::cmds] $(-code)]
          131  +        [::tcc4tcl::wrapExport $(-name) [set ${name}::cmds] $(-code)]
   140    132       set outfile $(-dir)/$(-name)[info sharedlibextension]
   141         -    ::tcc::to_dll [set ${name}::code] $outfile $(-libs)
          133  +    ::tcc4tcl::to_dll [set ${name}::code] $outfile $(-libs)
   142    134   }
   143    135   #---------------------------------------------------------------------
   144         -proc ::tcc::wrap {name adefs rtype {body "#"}} {
          136  +proc ::tcc4tcl::wrap {name adefs rtype {body "#"}} {
   145    137     set cname c_$name
   146    138     set wname tcl_$name
   147    139     array set types {}
   148    140     set names {}
   149    141     set cargs {}
   150    142     set cnames {}  
   151    143     # if first arg is "Tcl_Interp*", pass it without counting it as a cmd arg
................................................................................
   265    257     }
   266    258     if {$rtype != "ok"} {append cbody "  return TCL_OK;" \n}
   267    259   
   268    260     #puts ----code:\n$code
   269    261     #puts ----cbody:\n$cbody
   270    262     list $code $cbody
   271    263   }
   272         -proc ::tcc::wrapCmd {tclname argl rtype cname body} {
          264  +proc ::tcc4tcl::wrapCmd {tclname argl rtype cname body} {
   273    265       foreach {code cbody} [wrap $tclname $argl $rtype $body] break
   274    266       append code "\nstatic int $cname"
   275    267       append code {(ClientData cdata,Tcl_Interp *ip,
   276    268           int objc,Tcl_Obj* CONST objv[])} " \{"
   277    269       append code \n$cbody \n\}\n
   278    270   }
   279         -proc ::tcc::wrapExport {name cmds {body ""}} {
          271  +proc ::tcc4tcl::wrapExport {name cmds {body ""}} {
   280    272       set code "DLL_EXPORT int [string totitle $name]_Init(Tcl_Interp *interp)"
   281    273       append code " \{\n"
   282    274       foreach {tclname cname} $cmds {
   283    275           append code \
   284    276               "Tcl_CreateObjCommand(interp,\"$tclname\",$cname,NULL,NULL);\n"
   285    277       }
   286    278       append code $body
   287    279       append code "\nreturn TCL_OK;\n\}"
   288    280   }
   289    281   #---------------------------------------------------------------------
   290         -proc ::tcc::cproc {name adefs rtype {body "#"}} {
          282  +proc ::tcc4tcl::cproc {name adefs rtype {body "#"}} {
   291    283     foreach {code cbody} [wrap $name $adefs $rtype $body] break
   292    284     ccode $code
   293    285     set ns [namespace current]
   294    286     uplevel 1 [list ${ns}::ccommand $name {dummy ip objc objv} $cbody]
   295    287   }
   296    288   #---------------------------------------------------------------------
   297         -proc ::tcc::cdata {name data} {
          289  +proc ::tcc4tcl::cdata {name data} {
   298    290     # Extract bytes from data
   299    291     binary scan $data c* bytes
   300    292       set inittext "\n"
   301    293     set line ""
   302    294     set n 0
   303    295     set l 0
   304    296     foreach c $bytes {
................................................................................
   321    313     append cbody "Tcl_SetByteArrayObj(Tcl_GetObjResult(ip), (unsigned char*) script, $count);\n"
   322    314     append cbody "return TCL_OK;" "\n"
   323    315     set ns [namespace current]
   324    316     uplevel 1 [list ${ns}::ccommand $name {dummy ip objc objv} $cbody]
   325    317     return $name
   326    318   }
   327    319   #-------------------------------------------------------------------
   328         -proc ::tcc::ccommand {procname anames args} {
          320  +proc ::tcc4tcl::ccommand {procname anames args} {
   329    321     variable tcc
   330    322     # Fully qualified proc name
   331    323     if {[string match "::*" $procname]} {
   332    324       # procname is already absolute
   333    325     } else {
   334    326       set nsfrom [uplevel 1 {namespace current}]    
   335    327       if {$nsfrom eq "::"} {set nsfrom ""}
................................................................................
   365    357     append code "}" "\n"
   366    358     set ns [namespace current]
   367    359     uplevel 1 [list ${ns}::cc $code]
   368    360     Log "CREATING TCL COMMAND $procname / $cname"
   369    361     uplevel 1 [list $tcc(cc) command $procname $cname]
   370    362     unset tcc(cc) ;# can't be used for compiling anymore
   371    363   }
   372         -proc ::tcc::tk {args} {
          364  +proc ::tcc4tcl::tk {args} {
   373    365     variable tcc
   374    366     set tcc(tk) 1
   375    367   }
   376         -::tcc::reset
   377         -namespace eval tcc {namespace export cproc ccode cdata}
          368  +::tcc4tcl::reset
          369  +namespace eval tcc4tcl {namespace export cproc ccode cdata}
   378    370   

Added test version [c72233bf30].

            1  +#! /usr/bin/env tclsh
            2  +
            3  +source tcc4tcl.tcl
            4  +tcc4tcl::cproc test {int i} int { return(i+42); }
            5  +tcc4tcl::cproc test1 {int i} int { return(i+42); }
            6  +puts [test 1]