Unix Programming Environment

Even though the UNIX system introduces a number of innovative programs and techniques, no single program or idea makes it work well. Instead, what makes it effective is the approach to programming, a philosophy of using the computer. Although that philosophy cant be written down in a single sentence, at its heart is the idea that the power of a system comes more from the relationships among programs than from the programs themselves.

PTSource Shell

PTSource Shell is a Unix Programming Environment compatible environment that runs natively on Microsoft Windows. Its goal is to allow programs of Unix-like systems to be recompiled and run natively on Windows with minimal source code modifications by providing them with the same underlying API they would expect in those systems. PTSource Shell provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. Thus it is possible to launch Windows applications from the PTSource Shell environment, as well as to use PTSource Shell tools and applications within the Windows operating context.

Using the Shell

A non-quoted backslash \ is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline. If a \newline pair appears, and the backslash itself is not quoted, the \newline is treated as a line continuation (that is, it is removed from the input stream and effectively ignored). So moving in dirs in the Shell its slightly different so if you want to walk thru dirs you shoud use / instead of \ as in *nix.

Example

cd c:\   
# This is wrong and it will return c:
cd c:/   
# This is right and it will return c:\
cd c:\\
# This is also right and it will return c:\

Development Environment

The Shell as MinGW-w64 and Harbour already configured to build for Win32 and Win64.

Standard make commands :
  • make (standard *nix make)
  • hbmk32 (HarbourMG make for x86 GUI)
  • hbmk64 (HarbourMG make for x64 GUI)
  • hbmk32c (HarbourMG make for x86 CONSOLE)
  • hbmk64c (HarbourMG make for x64 CONSOLE)
  • tcc32 (TCC make for x86)
  • tcc64 (TCC make for x64)
  • makefasm (FASM for x86 and x64)
  • makensis (Generates installer from NSI)
BashRC and aliases

The Shell uses a simple ini file called PTShell.ini in the PTSource directory as its RC startup it fully supports aliases and it reads by default as fallows :

alias vim='vi'
alias edit='nano'
alias joe='nano'
alias h='history'
alias mc='gmc'
alias nc='gmc'
alias more='less'
alias ls='ls --color'
alias dir='ls -la --color'
alias l='ls -lh'
alias k='tree -h'
alias back='cd $OLDPWD'
alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
alias curl='curl -k'
alias npm='npm -g'
alias pip='python -m pip --disable-pip-version-check'
alias cls='printf "\033c"'
EDITOR='nano'
FCEDIT='nano'
BASH='bash'
SHELL='bash'
CC='gcc'
CXX='g++.exe'
CPP='gcc.exe -E'
M4='m4.exe'
PERL='perl.exe'
TERM=vt100
HOME=C:\\PTSOURCE\\Platform\\PTEditor\\home
HISTFILE=C:\\PTSOURCE\\Platform\\PTEditor\\home\\bash_history
HISTSIZE=200
HISTFILESIZE=200
PATH0=C:\\PTSOURCE\\Platform\\PTEditor
PATH1=C:\\PTSOURCE\\Platform\\PTEditor\\bin
#x86 MinGW and Harbour
PATH2=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\mingw32\\bin
PATH3=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\harbour32\\bin
#x64 MinGW and Harbour
#PATH2=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\mingw64\\bin
#PATH3=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\harbour64\\bin
PATH4=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\fasm32_64
PATH5=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\nsis32
#x86 FreeBasic
PATH6=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\fbc32
#x64 FreeBasic
#PATH6=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\fbc64
PATH7=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\fpc32
PATH8=C:\\PTSOURCE\\Platform\\PTEditor\\libexec\\python
PATH9=C:\\PTSOURCE\\Platform\\PTEditor\\libexec\\phphum
PATH10=C:\\PTSOURCE\\Platform\\PTEditor\\libexec\\nodejs
PATH11=C:\\PTSOURCE\\Platform\\PTEditor\\libexec\\nodejs\\node_modules\\npm
PATH12=C:\\PTSOURCE\\Platform\\PTEditor\\libexec\\git-core
PATH=$PATH0:$PATH1:$PATH2:$PATH3:$PATH4:$PATH5:$PATH6:$PATH7:$PATH8:$PATH9:$PATH10:$PATH11:$PATH12
MANPATH=C:\\PTSOURCE\\Platform\\PTEditor\\man
SAMPLES=C:\\PTSOURCE\\Platform\\PTEditor\\samples
FASMINC=C:\\PTSOURCE\\Platform\\PTEditor\\builder\\comp\\fasm32_64\\INCLUDE
export HOME PATH HISTFILE HISTSIZE HISTFILESIZE MANPATH EDITOR SHELL TERM BASH SAMPLES CC CXX CPP M4 PERL FASMINC
export PYTHONWARNINGS=ignore:::pip._internal.cli.base_command pip list
LOGIN_SHELL=true
cd $HOME

It can be edited to fit your needs.

Simple compilation commands examples from the Shell
  • gcc -c *.c && gcc *.o -o [binary file name]
  • make [clean|install]
  • ptsmake32 [*.prg|*.hbc]
  • ptsmake64 [*.prg|*.hbc]

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