Path: Compilers : Pascal :
Path: Pascal :

Pascal to C Pascal to C translator...

  pascal.exe - pascal to C translator written in C++ and compiled for win32
  pascal.linux - pascal to C translator written in C++ and compiled for i386 linux
  pascal.freebsd - pascal to C translator written in C++ and compiled for amd64 FreeBSD

Run time library:
[STRING FUNCTIONS]
BinStr    Construct binary representation of integer
Chr       Convert ASCII code to character
Concat    Concatenate two strings
Copy      Copy part of a string
Delete    Delete part of a string
HexStr    Construct hexadecimal representation of integer
Insert    Insert one string in another
Length    Return length of string
Lowercase Convert string to all-lowercase
OctStr    Construct octal representation of integer
Pos       Calculate position of one string in another
SetLength Set length of a string
SetString Set contents and length of a string
Str       Convert number to string representation
StringOfChar    Create string consisting of a number of characters
Upcase    Convert string to all-uppercase
Val       Convert string to number

[FILE FUNCTIONS]
Append    Open a file in append mode
Assign    Assign a name to a file
Blockread    Read data from a file into memory
Blockwrite    Write data from memory to a file
Close    Close a file
Eof    Check for end of file
Eoln    Check for end of line
Erase    Delete file from disk
Filepos    Position in file
Filesize    Size of file
Flush    Write file buffers to disk
IOresult    Return result of last file IO operation
Read    Read from file into variable
Readln    Read from file into variable and goto next line
Rename    Rename file on disk
Reset    Open file for reading
Rewrite    Open file for writing
Seek    Set file position
SeekEof    Set file position to end of file
SeekEoln    Set file position to end of line
SetTextBuf    Set size of file buffer
Truncate    Truncate the file at position
Write    Write variable to file
WriteLn    Write variable to file and append newline

[MATH FUNCTIONS]
Abs    Calculate absolute value
Arctan    Calculate inverse tangent
Cos    Calculate cosine of angle
Dec    Decrease value of variable
Exp    Exponentiate
Frac    Return fractional part of floating point value
Hi    Return high byte/word of value
Inc    Increase value of variable
Int    Calculate integer part of floating point value
Ln    Calculate logarithm
Lo    Return low byte/word of value
Odd    Is a value odd or even ?
Pi    Return the value of pi
Random    Generate random number
Randomize    Initialize random number generator
Round    Round floating point value to nearest integer number
Sin    Calculate sine of angle
Sqr    Calculate the square of a value
Sqrt    Calculate the square root of a value
Swap    Swap high and low bytes/words of a variable
Trunc    Truncate a floating point value

[MEMORY FUNCTIONS]
Addr    Return address of variable
Assigned    Check if a pointer is valid
CompareByte    Compare 2 memory buffers byte per byte
CompareChar    Compare 2 memory buffers byte per byte
CompareDWord    Compare 2 memory buffers byte per byte
CompareWord    Compare 2 memory buffers byte per byte
CSeg    Return code segment
Dispose    Free dynamically allocated memory
DSeg    Return data segment
FillByte    Fill memory region with 8-bit pattern
FillChar    Fill memory region with certain character
FillDWord    Fill memory region with 32-bit pattern
FillQWord    Fill memory region with 64-bit pattern
FillWord    Fill memory region with 16-bit pattern
Freemem    Release allocated memory
Getmem    Allocate new memory
GetMemoryManager    Return current memory manager
High    Return highest index of open array or enumerated
IndexByte    Find byte-sized value in a memory range
IndexChar    Find char-sized value in a memory range
IndexDWord    Find DWord-sized (32-bit) value in a memory range
IndexQWord    Find QWord-sized value in a memory range
IndexWord    Find word-sized value in a memory range
IsMemoryManagerSet    Is the memory manager set
Low    Return lowest index of open array or enumerated
Move    Move data from one location in memory to another
MoveChar0    Move data till first zero character
New    Dynamically allocate memory for variable
Ofs    Return offset of variable
Ptr    Combine segment and offset to pointer
ReAllocMem    Resize a memory block on the heap
Seg    Return segment
SetMemoryManager    Set a memory manager
Sptr    Return current stack pointer
SSeg    Return stack segment register value

[OPERATING SYSTEM FUNCTIONS]
Chdir    Change working directory
Getdir    Return current working directory
Halt    Halt program execution
Paramcount    Number of parameters with which program was called
Paramstr    Retrieve parameters with which program was called
Mkdir    Make a directory
Rmdir    Remove a directory
Runerror    Abort program execution with error condition

[MISC FUNCTIONS]
Assert    Conditionally abort program with error
Break    Abort current loop
Continue    Next cycle in current loop
Exclude    Exclude an element from a set
Exit    Exit current function or procedure
Include    Include an element into a set
LongJmp    Jump to execution point
Ord    Return ordinal value of enumerated type
Pred    Return previous value of ordinal type
SetJmp    Mark execution point for jump
SizeOf    Return size of variable or type
Succ    Return next value of ordinal type

C source code for the run time library:

  libp.h
  libp.c

Example programs:

  hello.p - pascal hello world
  hello.c - translated to C
  array.p
  function.p
  goto.p
  hello.p
  if.p
  loop.p
  pascal_cgi.p
  hello2.p
  pointer.p
  procedure.p
  record.p
  switch.p
  filetest.p
  enum.p
  with.p

Related Downloads and Links:

  Turbo Pascal - the Turbo Pascal compiler for DOS
  Freee Pascal - the free pascal compiler (FPC) for UNIX like operating systems
  Symantic Pascal - symantic think pascal compiler disk images fora mac68k hardware

Pascal Wish List:

- for someone to implemnt all the Turbo Pascal functions and procedures to get code from Turbo Pascal to work in a modern computer
- for people to use my HTTP file upload bulitin board servcie to share pascal code with the community of users of this web site
- for people to use my web based message baord to communicate bugs and problems they find and how to solve them