How-to
A how-to is an informal and often short video or text describing how to accomplish a specific task. A how-to is usually meant to help non-experts and consequently may leave out details that are important only to experts. Bellow you can find some simple and quick howtos.

How to use context help

If you have a (*.chm) which explains something based on keyword index, then you can set up user tools to look up keyword you just have typed in without escaping from the Editor.

The following example shows how to set up 'User Tools' to use Win32API help file. Let´s assume that you extracted the Win32API help file (Win32.chm) in the following directory. C:\Win32API\Win32.chm

  1. Open Preferences dialog box and select User Tools page
  2. Select an empty slot and fill with the following arguments.
  • Menu Text: Win32API Context Help
  • Command: C:\Win32API\Win32.chm
  • Argument: $(CurrWord)
  • Initial dir: $(FileDir)
  • Hot key: F1
  • Close on exit: Yes
  • Save before execute: No

After that, you can press F1 to see the search index when the caret is on the word you want to look up.

How to use a online service

If you want to a online service to look-up a word which you have just typed in without escaping from the Editor, then

  1. Open Preferences dialog box and select User Tools page
  2. Select an empty slot and fill with the following arguments.
  • Menu Text: Online Service
  • Command: C:\Program Files\Mozilla Firefox\firefox.exe
  • Argument: https://dictionary.cambridge.org/spellcheck/english/?q=$(CurrWord)
  • Initial dir: $(FileDir)
  • Hot key: Ctrl+F1
  • Close on exit: Yes
  • Save before execute: No

After that, you can press Ctrl+F1 to see the contents when the caret is on the word you want to look up.

How to install or add a extra compiler
The platform already brings Harbour, MinGW-w64, TCC, FASM, FB and FP as native compilers but you may want to add another of your choice, so here is how to do it. In this example, we will install and use Enbarcadero Borland C++ 5.8.2 compiler which is free to use. Of course, there are more compilers available (Pelles C or FB for example). It is up to you which compiler or language you want to add and use.

  1. Download Borland C++ 5.8.2 compiler.
  2. Unzip it to c:\borland\bcc582
  3. Make sure that the directory containing bcc32.exe is in your system environment path. bcc32.exe is located in the \bin subdirectory of the c:\borland\bcc582.
  4. Make sure that there is a bcc32.cfg and a ilink32.cfg file in the \bin subdirectory of your compiler. Its needed to set the compiler options for the Include and Lib paths. This is what the files should contain:

bcc32.cfg

-I"c:\borland\bcc582\include;c:\borland\bcc582\include\dinkumware"
-L"c:\borland\bcc582\lib"
ilink32.cfg
/L"c:\borland\bcc582\lib"
Once you you have finished this steps you can now add it to the platform.

  1. Open Preferences dialog box and select User Tools page
  2. Select an empty slot and fill with the following arguments.
  • Menu Text: Compile C++ with BCC
  • Command: C:\Borland\bcc582\bin\bcc32.exe
  • Argument: $(FileName)
  • Initial dir: $(FileDir)
  • Hot key: Ctrl+F7
  • Capture output: Yes
  • Save before execute: Yes

After that, you can press Ctrl+F7 to compile code with Borland C++.

Using GIT to clone a git repository
Open the PTSource Shell and issue the command :
git clone git://github.com/gituser/repository_name

Now you shoud have a repository copy in you computer, can then configure, make and make install if you wish.

Using CVS to clone a CVS repository
Open the PTSource Shell and issue the command :
cvs -z3 -d:pserver:anonymous@repository_name.cvs.sourceforge.net:/cvsroot/repository_name co -P modulename

Now you shoud have a repository copy in you computer, can then configure, make and make install if you wish.

Using RSYNC to clone a CVS repository
Open the PTSource Shell and issue the command :
rsync -ai a.cvs.sourceforge.net::cvsroot/repository_name/ /my/local/dest/dir/

Now you shoud have a repository copy in you computer, can then configure, make and make install if you wish.

How to compile a TCL script into an EXE
In this example we have a the birds.tcl script in the Birds directory.

Open the PTSource Shell and issue the command :

 cd Birds
 freewrap birds.tcl
You now should have a full portable exe from a tcl script.
How to compile a TCL script with BWidget LIB into an EXE
In this example we have a tcl application using the BWidget LIB (full example on SAMPLES/TclTk).

Open the main application file, in this case main.tcl and before package require BWidget add:

lappend auto_path /PTSOURCE/Platform/PTEditor/lib/tcl8.4/bwidget/
Open the PTSource Shell and issue the command :
 cd ..
 cd samples
 cd tcltk
 cd bwidget
freewrap main.tcl -f bwidget.db
You now should have a full portable exe from a tcl script.
How to compile a Python script into an EXE
In this example we have a python application called ftp.pyt (full example on SAMPLES/Python).

Open the PTSource Shell and issue the command :

 cd ..
 cd samples
 cd python
 pyinstaller --noconsole ftp.pyt
You now should have a full portable exe in a dist folder from a python script.
How to check exe dependencies with depends
Open the PTSource Shell and issue the command :

 depends exetocheck.exe

You will get a list of the exe dependencies

How to import lib definition files for TCC
To link with DLLs, TCC uses import definition files (.def) instead of libraries.

The included 'tiny_impdef' program may be used to make additional .def files for any DLL. For example:

Open the PTSource Shell and issue the command :

     tiny_impdef opengl32.dll

Put opengl32.def into the tcc/lib directory at “C:\PTSOURCE\Platform\PTEditor\bin\lib”.

Specify :

#pragma comment (lib, "opengl32")
at the top of your code to link a program that uses opengl32.dll or compile at the command line using the -lopengl32 switch.
     tcc -lopengl32 yourprogram.c
if it is a dll use the -shared switch.
tcc -shared -lopengl32 yourprogram.c
Using Premake
Premake is a command line utility which reads a scripted definition of a software project and, most commonly, uses it to generate project files for toolsets like Visual Studio, Xcode, or GNU Make. A sample Premake script.
workspace "MyWorkspace"
   configurations { "Debug", "Release" }

project "MyProject"
   kind "ConsoleApp"
   language "C++"
   files { "**.h", "**.cpp" }

   filter { "configurations:Debug" }
      defines { "DEBUG" }
      flags { "Symbols" }

   filter { "configurations:Release" }
      defines { "NDEBUG" }
      optimize "On"
Running Premake. Create a premake5.lua file in your project directory. Open the PTSource Shell a run premake.
$ premake5 vs2015
Building configurations...
Running action 'vs2015'...
Generating MyWorkspace.sln...
Generating MyProject.vcxproj...
Generating MyProject.vcxproj.user...
Done.
The above will generate a project for VS2015. Since PTSource comes already with MinGW-w64 so if we want to generate a Makefile for MinGW-w64.
$ premake5 gmake
Building configurations...
Running action 'gmake'...
Generating MyWorkspace.sln...
Generating MyProject.vcxproj...
Generating MyProject.vcxproj.user...
Done.
The above will generate a MinGW-w64 Makefile wich you can compile with make. Premake can generate C, C++, or C# projects targeting:

  • Microsoft Visual Studio 2008-2015
  • GNU Make, including Cygwin and MinGW
  • Xcode
  • Codelite

Premake generated projects can support:

  • 32- and 64-bit builds
  • Xbox 360 (Visual Studio only)

Vanilla JavaScript from the console or in scripts
Open the PTSource Shell and issue the js command. If you start the program without parameters you will get a Javascript shell, in which you can write and test javascript.

js> function test() {
print('test');
}
js> test
function test() {
    print("test");
}
js> test();
test
js> function test() {
print('test');
test2(123);
}
js> function test2(param) {
print ('test2: ' + param);
}
js> test();
test
test2: 123
js>

To exit the shell, just press Ctrl+C.

Generate a MinGW lib from a DLL
Open the PTSource Shell and issue the commands.


gendef.exe csfml-graphics-2.dll
dlltool.exe -d csfml-graphics-2.def -D csfml-graphics-2.dll -l libcsfml-graphics.a

We use cookies to personalize and enhance your experience on our site. By using our site, you agree to our use of cookies.
  More information about cookies