Modern Pascal

Last updated
Modern Pascal
Original author(s) Ozz Nixon
Developer(s) 3F, LLC
Modern Pascal Solutions, LLC
Initial release2000;21 years ago (2000)
Stable release
2.0 / February 26, 2020;17 months ago (2020-02-26)
Written in Pascal, Object Pascal, Free Pascal, Turbo Pascal
Operating system macOS, Linux, Solaris, FreeBSD, OpenBSD, Windows DOS/32
Platform IA-32, x86-64
Type CLI Server scripting networking
License Proprietary
Website modernpascal.com

Modern Pascal (sometimes stylized as ModernPascal) is a closed source, cross-platform, interpreter, compiler, and runtime system (environment) for command line, server-side and networking applications. Modern Pascal applications are written in Pascal and Object Pascal, and can be run within the Modern Pascal runtime on the operating systems Microsoft Windows, Linux, macOS, FreeBSD, Solaris and DOS/32. Its work is hosted and supported by the 3F, LLC and partner MP Solutions, LLC.

Contents

Modern Pascal provides a blocking I/O application programming interface (API) technology commonly used for operating system applications.

Modern Pascal CodeRunner contains a built-in library to allow applications to act as a Web server without software such as Apache HTTP Server or Internet Information Services (IIS).

History

Modern Pascal was invented in 2000 by Ozz Nixon while also codeveloping DXJavaScript with Alexander Baronovski. Ozz was inspired by the Borland Kylix project in 1999, where he met with Borland's Pascal Team and shared his programming language "Modern Pascal". Ozz ported his commercial socket suite DXSock to Kylix then started developing Modern Pascal so he run pascal scripts on Microsoft Windows, Linux, and OS X. [1]

In 2002, version 1.1 was released. It could run most Turbo Pascal (DOS) syntax. It was the last version using Variants internally as variable and code instances. It introduced support for built-in RTL units, allowing extending the language grammar to support CRT/Display and TCP/IP Socket calls.

In 2005, version 1.2 was released. It was available for 64-bit platforms, with native 64-bit binaries and internal support for 64-bit numbers and memory addresses.

In 2007, version 1.3 was released. It added cross-platform support for dynamic libraries, .so, .dylib, .DLL. It was the first version able to develop graphical user interface (GUI) applications for native Windows, and Linux Qt. By supporting external libraries, the language was no longer limited to a command line or web server script engine role.

In 2008, version 1.4 was released. It had a fork internally called DECisioning LANguage (DECLAN) for use in the credit and financial industry. It also introduced TDataset compatibility with the Borland Delphi compiler along with the ability to connect to databases via built-in ODBC support. This allows leveraging almost all SQL database engines for command line and Web use.

In 2009, version 1.5 was released. It was a redesign of the parser phase Lexicon. It is the first version to begin including syntax from other popular languages like +=, -=, *-, /= from C and JavaScript. It was available as a native Apache Module for Windows, Linux, and OS X.

In 2010, version 1.6 was released. It incorporates more built-in RTL units: ciphers, compressions, hashs. It focused on migrating applications to web and needed built-in support for common ciphers, hashes, and compression algorithms used by representational state transfer (RESTful) applications.

In 2011, version 1.7 was released. It was a redesign of the Apache Module. From this release forward, Modern Pascal was no longer built into the Apache Module. Modern Pascal Celerity was introduced, inspired by the design of Adobe ColdFusion nTier back end to web servers. This means in a future release FastCGI, ISAPI, and even old CGI and NSAPI interfaces could be deployed. Version 1.7 also introduced an old Pascal 3.0 feature named Chaining in a slightly more modern style.

In 2013, version 1.8 was released. It introduced support for Delphi-like classes, smart records, unions, and self instantiation. It was the first version where Modern Pascal began to become a Pascal dialect.

In 2014, version 1.9 was built but not released. It was used to build DevelopIP, a large scale public website.

In 2015, version 2.0 was begun. It is a fork of lape. While prior versions were fast and efficient, they were not fast enough for some larger customers. Benchmarks then showed v2.0 can process over 100 million instructions a second, roughly 8 times faster than version 1.9, and far faster than alternative Pascal script engines. July 2015, version 2.0 entered its final private Beta cycle. The team ported code snippets and old applications to 2.0 and published the code on GitHub.

In 2017, version 2.0 was released. It includes native dBase III+, IV, V, VII, Clipper, and FoxPro support. During the 24 months of development, 3F has ported to GitHub, Source to 17 BBSes (including QuickBBS, TPBoard, Hermes), BinkP (Fidonet) Protocol, multiple Tossers, Adventure Game Studio (1984), Custom Micro Solutions, Inc. Accounting and Point of Sale Software, Web RIA Applications. 3F also introduced transparent support for Extended ASCII, ANSI, and UTF8 graphics.

In 2018-2019, Included native access to Premier SQL Middleware server. Extended the video and communications unit to translate CodePage 437 8bit characters to UTF8 characters. Added support for ASPELL and deployed Linux, Mac and Windows binaries on github.

Overview

Modern Pascal Command Line Interface allows creating and running DOS-like programs, using Pascal and decades of free source code, for a wide range of business classes, and command utilities.

Modern Pascal Celerity allows creating programs similar to stand-alone middleware or a backend engine. Combined with the Apache Module, Celerity can be used to create a wide range of web script programs.

Modern Pascal CodeRunner allows creating standalone networking tools, including web servers, email servers, and chat servers. CodeRunner manages Transmission Control Protocol (TCP) communications for code, even Transport Layer Security (TLS, formerly Secure Sockets Layer (SSL)). For development, simply focus on what happens after a connection is established.

Code sample

Here is a code sample for the game Loot: [2]

programGame.Loot.Example;usesMath;constMaxProbability=1000;typeLootType=(Bloodstone,Copper,Emeraldite,Gold,Heronite,Platinum,Shadownite,Silver,Soranite,Umbrarite,Cobalt,Iron,Nothing);Looter=ClassProbabilites:Array[0..12]ofLongint;Choose:privatefunction:LootTypeofobject;AsString:privatefunction(l:LootType):Stringofobject;End;functionLooter.Choose:LootType;varLoop,randomValue:Word;BeginrandomValue:=Random(MaxProbability-1);Loop:=0;WhileProbabilites[Loopmod13]<randomValuedoInc(Loop);Result:=LootType(Loopmod13);End;functionLooter.AsString(l:LootType):String;BeginCaselofBloodstone:Result:='Bloodstone';Copper:Result:='Copper';Emeraldite:Result:='Emeraldite';Gold:Result:='Gold';Heronite:Result:='Heronite';Platinum:Result:='Platinum';Shadownite:Result:='Shadownite';Silver:Result:='Silver';Soranite:Result:='Soranite';Umbrarite:Result:='Umbrarite';Cobalt:Result:='Cobalt';Iron:Result:='Iron';ElseResult:='';End;End;procedureLooter.Free;BeginEnd;// Must be listed after all other implementation //procedureLooter.Init;BeginRandomize;withSelfdobegin// used to link methods to instance!Probabilites[0]:=10;Probabilites[1]:=77;Probabilites[2]:=105;Probabilites[3]:=125;Probabilites[4]:=142;Probabilites[5]:=159;Probabilites[6]:=172;Probabilites[7]:=200;Probabilites[8]:=201;Probabilites[9]:=202;Probabilites[10]:=216;Probabilites[11]:=282;Probabilites[12]:=MaxProbability;// to avoid RTTI/VMT overhead:TMethod(@asstring):=[@Looter.AsString,@self];TMethod(@choose):=[@Looter.Choose,@self];TMethod(@free):=[@Looter.Free,@self];End;End;varloot:looter;n:longint;beginloot.init;forn:=0to99doWriteln(Loot.AsString(Loot.choose));// for n:=0 to 99 do Writeln(Loot.choose); {this used built-in macro to convert Enum to String}loot.free;end.

OUTPUT

Shows a random list of loot that could be found while navigating a maze/map game.

Replaced the original code sample with something that is easier to read/follow.

Hello World

Modern Pascal can run Turbo Pascal syntax. Thus, the Hello world program be coded as in normal Pascal "Hello World".

programHelloWorld;beginWriteln('Hello, World!');end.

Modern Pascal supports Brief Pascal, so statements can be executed with less formality.

Writeln('Hello, World!');

Built-in units

In Pascal nomenclature, a reusable set of methods is termed a Unit, other languages often call these modules or libraries. Modern Pascal has built-in units to handle display, environment calls like file system input/output (I/O), sockets for networking TCP, binary data (buffers), classes and objects, cryptography functions, data streams, regular expression, collections, logging, configuration files using ini, comma-separated values (CSV) or SDF (similar to CSV) formats, databases through Open Database Connectivity (ODBC), built-in dBase, Clipper and FoxPro, and other core functions.

Dependencies

Modern Pascal operates with no need for third-party libraries. It can optionally require OpenSSL to achieve TLS–SSL listeners and clients.

Files included

Threading

Modern Pascal operates using a single thread model, using blocking I/O calls. Celerity and CodeRunner are self-threading engines allowing Modern Pascal to support tens of thousands of concurrent connections. The design of a single thread for each instance of code means it can be used to build reliable applications. The design goal of a Modern Pascal application is that any skill level of programmer should be able to operate without fear of memory leak, variable collision between threads, etc. This approach allows for scaling with the number of CPU cores of the machine it is running. The negative of this approach is the increase in thread switching contexts. Modern Pascal has been tested on a base Dell laptop handling over 50,000 concurrent connections or scripts.

Related Research Articles

In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program, typically to process user requests.

VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers with error handling, subroutines, and other advanced programming constructs. It can give the user complete control over many aspects of their computing environment.

Liberty BASIC

Liberty BASIC (LB) is a commercial computer programming language and integrated development environment (IDE). It has an interpreter, developed in Smalltalk, which recognizes its own dialect of the BASIC programming language. It runs on 16- and 32-bit Windows and OS/2.

ScriptBasic is a scripting language variant of BASIC. The source of the interpreter is available as a C program under the LGPL license.

In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations that are often referred to by their own names ; see the versions section. Almost all Windows programs interact with the Windows API. On the Windows NT line of operating systems, a small number use the Native API.

D (programming language) Multi-paradigm system programming language

D, also known as Dlang, is a multi-paradigm system programming language created by Walter Bright at Digital Mars and released in 2001. Andrei Alexandrescu joined the design and development effort in 2007. Though it originated as a re-engineering of C++, D is a distinct language. It has redesigned some core C++ features, while also sharing characteristics of other languages, notably Java, Python, Ruby, C#, and Eiffel.

Nullsoft Scriptable Install System

Nullsoft Scriptable Install System (NSIS) is a script-driven installer authoring tool for Microsoft Windows backed by Nullsoft, the creators of Winamp. NSIS is released under a combination of free software licenses, primarily the zlib license. It has become a widely used alternative to commercial proprietary products like InstallShield, with users including Amazon.com, Dropbox, Google, Ubisoft, FL Studio, BitTorrent, and McAfee.

Delphi (software)

Delphi is a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, mobile, web, and console software, currently developed and maintained by Embarcadero Technologies.

Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.

Borland Kylix is a compiler and integrated development environment (IDE) formerly sold by Borland, but later discontinued. It is a Linux software development environment based on Borland Delphi and Borland C++ Builder, which runs under Microsoft Windows. Continuing Delphi's classical Greek theme, Kylix is the name for an ancient Greek drinking cup. The closest supported equivalent to Kylix is the free Lazarus IDE package, designed to be code-compatible with Delphi. As of 2010 the project has been resurrected in the form of Delphi cross compiler for Mac and Linux, as shown in the Embarcadero's Delphi and C++ Builder roadmap. As of September 2011 with Kylix discontinued the framework for cross-platform development by Embarcadero is FireMonkey.

In computer programming, an entry point is a point in a program where the execution of a program begins, and where the program has access to command line arguments.

IP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system.

An HTML Application (HTA) is a Microsoft Windows program whose source code consists of HTML, Dynamic HTML, and one or more scripting languages supported by Internet Explorer, such as VBScript or JScript. The HTML is used to generate the user interface, and the scripting language is used for the program logic. An HTA executes without the constraints of the internet browser security model; in fact, it executes as a "fully trusted" application.

PowerShell Cross-platform command-line interface and scripting language for system and network administration

PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core. The former is built on the .NET Framework, the latter on .NET Core.

A batch file is a script file in DOS, OS/2 and Microsoft Windows. It consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as IF, FOR, and GOTO labels. The term "batch" is from batch processing, meaning "non-interactive execution", though a batch file may not process a batch of multiple data.

Node.js JavaScript runtime environment

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser. Consequently, Node.js represents a "JavaScript everywhere" paradigm, unifying web-application development around a single programming language, rather than different languages for server-side and client-side scripts.

Seed is a JavaScript interpreter and a library of the GNOME project to create standalone applications in JavaScript. It uses the JavaScript engine JavaScriptCore of the WebKit project. It is possible to easily create modules in C.

Smart Pascal is a dialect of the Object Pascal computer language that is derived from Delphi Web Script, but is enhanced and adapted for Smart Mobile Studio, a commercial development suite that generates JavaScript rather than machine code.

Nim (programming language) Programming language

Nim is an imperative, general-purpose, multi-paradigm, statically typed, systems, compiled programming language designed and developed by Andreas Rumpf. It is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and JavaScript, and supporting compiling to those same languages.

References

  1. "Evolution of Modern Pascal: Public Blog". All Nu.de. Retrieved 28 March 2018.
  2. "Modern Pascal Language Samples". Modern Pascal Solutions, LLC. Retrieved 18 March 2018.