Jump to content

Recommended Posts

Posted (edited)

Disclaimer: I recommend not doing this if you have zero knowledge of the potential problems it could cause.

Today I spent some time learning Lua scripting and implemented tcc (Tiny C Compiler) inside SciTE. So now when I hit F5 the c/cpp is compiled and run using the tcc compiler.

I was wondering does anyone have any hints or tips? I will be modifying the cpp.properties file a little more and then will upload to the site.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

No. Here is my heavily edited cpp.properties file for C/C++ files.

# Define SciTE settings for C++, C.

file.patterns.cpp=*.c;*.cc;*.cpp;*.cxx;*.h;*.hh;*.hpp;*.hxx;*.ipp;*.m;*.mm;*.sma
file.patterns.cplusplus=*.cc;*.cpp;*.cxx
filter.cpp=C/C++ (c cc cpp cxx cs vala h hh hxx hpp ipp dlg rc rc2 mak)|\
$(file.patterns.cpp);*.mak;make*|

lexer.$(file.patterns.cpp)=cpp
lexer.$(file.patterns.cplusplus)=cpp

# Keywords for C++11, by guinness 03/2013.
keywordclass.cpp=alignas alignof and and_eq asm auto bitand bitor  \
bool break case catch char char16_t char32_t class  \
compl const constexpr const_cast continue decltype default delete  \
do double dynamic_cast else enum explicit export extern  \
false float for friend goto if inline int  \
long mutable namespace new noexcept not not_eq nullptr  \
operator or or_eq private protected public register reinterpret_cast  \
return short signed sizeof static static_assert static_cast struct  \
switch template this thread_local throw true try typedef  \
typeid typename union unsigned using virtual void volatile  \
wchar_t while xor xor_eq
keywords.$(file.patterns.cpp)=$(keywordclass.cpp)

#~ word.chars.cxx=$(chars.alpha)$(chars.numeric)_#
#~ word.characters.$(file.patterns.cpp)=$(word.chars.cxx)

autocompleteword.automatic
autocomplete.cpp.start.characters=$(chars.alpha)$(chars.numeric)_

api.$(file.patterns.cpp)=$(SciteDefaultHome)\api\c.api;$(SciteDefaultHome)\api\cpp.api
calltip.cpp.word.characters=$(chars.alpha)$(chars.numeric)_
calltip.cpp.ignorecase=1
calltip.cpp.end.definition=)
calltip.cpp.parameters.separators=,

comment.block.cpp=//~
comment.stream.start.cpp=/*
comment.stream.end.cpp=*/
comment.box.start.cpp=/*
comment.box.middle.cpp= *
comment.box.end.cpp= */

# Folding

word.characters.$(file.patterns.javafx)=$(word.chars.cxx)$-

statement.indent.$(file.patterns.cpp)=5 case default do else for if private protected public while
statement.end.$(file.patterns.cpp)=10 ;
statement.lookback.$(file.patterns.cpp)=20
block.start.$(file.patterns.cpp)=10 {
block.end.$(file.patterns.cpp)=10 }

preprocessor.symbol.$(file.patterns.cpp)=#
preprocessor.start.$(file.patterns.cpp)=if ifdef ifndef
preprocessor.middle.$(file.patterns.cpp)=else elif
preprocessor.end.$(file.patterns.cpp)=endif

# C++ styles - Visual Studio, by guinness 03/2013.

# Default
style.cpp.32=$(font.base)
# White space
style.cpp.0=fore:#000000
# Comment: /* */.
style.cpp.1=fore:#008000
# Line Comment: //.
style.cpp.2=fore:#008000
# Doc comment: block comments beginning with /** or /*!
style.cpp.3=fore:#008000
# Number
style.cpp.4=fore:#000000
# Keyword
style.cpp.5=fore:#0000FF
# Double quoted string
style.cpp.6=fore:#000000
# Single quoted string
style.cpp.7=fore:#000000
# UUIDs (only in IDL)
style.cpp.8=fore:#000000
# Preprocessor
style.cpp.9=fore:#0000FF
# Operators
style.cpp.10=fore:#000000
# Identifiers
#~ style.cpp.11=
# End of line where string is not closed
style.cpp.12=fore:#FF0000,$(font.base),back:#0000FF,eolfilled
# Doc Comment Line: line comments beginning with /// or //!.
style.cpp.15=fore:#008000
# Keywords2
style.cpp.16=fore:#000000
# Comment keyword
style.cpp.17=fore:#008000
# Comment keyword error
style.cpp.18=fore:#FF0000
# Raw strings for C++0x
#~ style.cpp.20=$(colour.string),back:#FFF3FF,eolfilled

# Braces are only matched in operator style
braces.cpp.style=10

# Visit http://bellard.org/tcc/ and place all files inside a folder called located in the SciTE directory.
tcc="$(SciteDefaultHome)\tcc\tcc.exe"
command.compile.$(file.patterns.cpp)=$(tcc) "$(FilePath)"
command.build.$(file.patterns.cpp)=$(tcc) "$(FilePath)"
command.go.$(file.patterns.cpp)=$(tcc) -run "$(FilePath)" $(1) $(2) $(3) $(4)

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Nothing stopping you.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thanks Jos. I'm using the c.api and cpp.api files and just working my way around keyword highlighting.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

It can compile C++ code too.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I was looking into TCC but couldn't find anything that stated it will compile C++, which is why I went with Code::Blocks and used the included GCC.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Hmm, don't know where I got that idea from. Anyway, just change the filepath to gcc then in SciTE. I will stick with tcc for now.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I was trying to teach myself C++ at the time, haven't gotten very far with it. :)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

Everything is pretty much working out of the box. I'm currently learning lua, so I'm using jaberwocky6669's as inspiration.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

nice job, guinness.. I can't help but associate SciTE with AutoIt myself.. plus I'm so used to just using Code::Blocks or Visual Studio nowadays.

A few things to mention though: before I began using Tiny C Compiler for C (not C++) programs, I had to update the headers and the definition files so that I was able to compile using XP+ API functions. You can get the headers from a mingw-win32 apid distribution (such as here). The definition files for the various DLL's can be created using tiny_impdef and placed in the LIB folder.

The code output of TCC is really terrible by the way. While the executables are super-small for basic code, the binary code that is output is horrible. For simple tasks, however, its more than good enough.

There are other free C compiler alternatives, too: LCC-Win32 is a nice step up, although its a bit buggy (always compile with -fno-inline). GCC is great, of course (plus includes a C++ compiler), and Pelles C compiler is probably the best package out there for C11 coding (with a full GUI to boot). Then of course you have online compiler/IDE's which are fun to experiment with..

My contributions:

  Reveal hidden contents

Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFsProcess CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen)Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery

Wrappers/Modifications of others' contributions:

_DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity)

UDF's added support/programming to:

_ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne)

(All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...