Alien-TinyCC
view release on metacpan or search on metacpan
inc/My/Build.pm view on Meta::CPAN
}
use File::Copy;
use File::Spec;
sub ACTION_devsetup {
my $self = shift;
system qw(git submodule init);
system qw(git submodule update);
my $hook_filename = File::Spec->catfile(qw<.git hooks pre-commit>);
copy 'git-pre-commit-hook.pl' => $hook_filename;
chmod 0755, $hook_filename;
}
# Reset the tcc source code. This only makes sense if the person has
# src checked out as a git submodule, but then again, the actions for
# which this exists are generally considered author actions anyway.
sub reset_src {
chdir 'src';
system qw( git reset --hard HEAD );
chdir '..';
}
inc/My/Build.pm view on Meta::CPAN
sub ACTION_disttest {
my $self = shift;
reset_src;
$self->SUPER::ACTION_disttest;
}
sub apply_patches {
my ($filename, @patches) = @_;
# make the file read-write (and executable, but that doesn't matter)
chmod 0700, $filename;
open my $in_fh, '<', $filename
or die "Unable to open $filename for patching!";
open my $out_fh, '>', "$filename.new"
or die "Unable to open $filename.new for patching!";
LINE: while (my $line = <$in_fh>) {
# Apply each basic test regex, and call the function if it matches
for (my $i = 0; $i < @patches; $i += 2) {
if ($line =~ $patches[$i]) {
my $next_line = $patches[$i+1]->($in_fh, $out_fh, $line);
inc/My/Build.pm view on Meta::CPAN
}
print $out_fh $line;
}
close $in_fh;
close $out_fh;
unlink $filename;
rename "$filename.new" => $filename;
# make sure it's executable; we may be patching ./configure
chmod 0700, $filename;
}
1;
2) Introduction
We assume here that you know ANSI C. Look at the example ex1.c to know
what the programs look like.
The include file <tcclib.h> can be used if you want a small basic libc
include support (especially useful for floppy disks). Of course, you
can also use standard headers, although they are slower to compile.
You can begin your C script with '#!/usr/local/bin/tcc -run' on the first
line and set its execute bits (chmod a+x your_script). Then, you can
launch the C code as a shell or perl script :-) The command line
arguments are put in 'argc' and 'argv' of the main functions, as in
ANSI C.
3) Examples
ex1.c: simplest example (hello world). Can also be launched directly
as a script: './ex1.c'.
ex2.c: more complicated example: find a number with the four
src/win32/include/io.h view on Meta::CPAN
#endif
/* Some defines for _access nAccessMode (MS doesn't define them, but
* it doesn't seem to hurt to add them). */
#define F_OK 0 /* Check for file existence */
#define X_OK 1 /* Check for execute permission. */
#define W_OK 2 /* Check for write permission */
#define R_OK 4 /* Check for read permission */
_CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode);
_CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode);
_CRTIMP int __cdecl _chsize(int _FileHandle,long _Size);
_CRTIMP int __cdecl _close(int _FileHandle);
_CRTIMP int __cdecl _commit(int _FileHandle);
_CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode);
_CRTIMP int __cdecl _dup(int _FileHandle);
_CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst);
_CRTIMP int __cdecl _eof(int _FileHandle);
_CRTIMP long __cdecl _filelength(int _FileHandle);
_CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData);
_CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData);
src/win32/include/io.h view on Meta::CPAN
__int64 __cdecl _telli64(int _FileHandle);
#endif
#ifndef NO_OLDNAMES
#ifndef _UWIN
int __cdecl chdir (const char *);
char *__cdecl getcwd (char *, int);
int __cdecl mkdir (const char *);
char *__cdecl mktemp(char *);
int __cdecl rmdir (const char*);
int __cdecl chmod (const char *, int);
#endif /* _UWIN */
#endif /* Not NO_OLDNAMES */
_CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode);
#ifndef __cplusplus
_CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...);
_CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...);
#else
extern "C++" _CRTIMP int __cdecl _open(const char *_Filename,int _Openflag,int _PermissionMode = 0);
extern "C++" _CRTIMP int __cdecl _sopen(const char *_Filename,int _Openflag,int _ShareFlag,int _PermissionMode = 0);
#endif
#ifndef _WIO_DEFINED
#define _WIO_DEFINED
_CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode);
_CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode);
_CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode);
_CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData);
_CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData);
_CRTIMP int __cdecl _wunlink(const wchar_t *_Filename);
_CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename);
_CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData);
intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData);
src/win32/include/io.h view on Meta::CPAN
#endif
int __cdecl __lock_fhandle(int _Filehandle);
void __cdecl _unlock_fhandle(int _Filehandle);
_CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle);
_CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags);
#ifndef NO_OLDNAMES
int __cdecl access(const char *_Filename,int _AccessMode);
int __cdecl chmod(const char *_Filename,int _AccessMode);
int __cdecl chsize(int _FileHandle,long _Size);
int __cdecl close(int _FileHandle);
int __cdecl creat(const char *_Filename,int _PermissionMode);
int __cdecl dup(int _FileHandle);
int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst);
int __cdecl eof(int _FileHandle);
long __cdecl filelength(int _FileHandle);
int __cdecl isatty(int _FileHandle);
int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes);
long __cdecl lseek(int _FileHandle,long _Offset,int _Origin);
src/win32/include/tchar.h view on Meta::CPAN
#define _tfdopen _wfdopen
#define _tfsopen _wfsopen
#define _tfopen _wfopen
#define _tfreopen _wfreopen
#define _tperror _wperror
#define _tpopen _wpopen
#define _ttempnam _wtempnam
#define _ttmpnam _wtmpnam
#define _taccess _waccess
#define _tchmod _wchmod
#define _tcreat _wcreat
#define _tfindfirst _wfindfirst
#define _tfindfirst32 _wfindfirst32
#define _tfindfirst64 _wfindfirst64
#define _tfindfirsti64 _wfindfirsti64
#define _tfindfirst32i64 _wfindfirst32i64
#define _tfindfirst64i32 _wfindfirst64i32
#define _tfindnext _wfindnext
#define _tfindnext32 _wfindnext32
#define _tfindnext64 _wfindnext64
src/win32/include/tchar.h view on Meta::CPAN
#define _tfdopen _fdopen
#endif
#define _tfsopen _fsopen
#define _tfopen fopen
#define _tfreopen freopen
#define _tperror perror
#define _tpopen _popen
#define _ttempnam _tempnam
#define _ttmpnam tmpnam
#define _tchmod _chmod
#define _tcreat _creat
#define _tfindfirst _findfirst
#define _tfindfirst32 _findfirst32
#define _tfindfirst64 _findfirst64
#define _tfindfirsti64 _findfirsti64
#define _tfindfirst32i64 _findfirst32i64
#define _tfindfirst64i32 _findfirst64i32
#define _tfindnext _findnext
#define _tfindnext32 _findnext32
#define _tfindnext64 _findnext64
src/win32/include/wchar.h view on Meta::CPAN
wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
_CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
_CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
#endif
#ifndef _WIO_DEFINED
#define _WIO_DEFINED
_CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode);
_CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode);
_CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode);
_CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData);
_CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData);
_CRTIMP int __cdecl _wunlink(const wchar_t *_Filename);
_CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename);
_CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData);
intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData);
_CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData);
src/win32/lib/msvcrt.def view on Meta::CPAN
_calloc_dbg
_cexit
_cgets
_cgets_s
_cgetws
_cgetws_s
_chdir
_chdrive
_chgsign
_chkesp
_chmod
_chsize
_chsize_s
_chvalidator
_chvalidator_l
_clearfp
_close
_commit
_commode
_control87
_controlfp
src/win32/lib/msvcrt.def view on Meta::CPAN
_vwprintf_l
_vwprintf_p
_vwprintf_p_l
_vwprintf_s_l
_waccess
_waccess_s
_wasctime
_wasctime_s
_wassert
_wchdir
_wchmod
_wcmdln
_wcreat
_wcscoll_l
_wcsdup
_wcsdup_dbg
_wcserror
_wcserror_s
_wcsftime_l
_wcsicmp
_wcsicmp_l
( run in 0.261 second using v1.01-cache-2.11-cpan-496ff517765 )