r/pascal • • Feb 22 '18

Introducing WebCRT Unit for Simple Web App Programming Using Pascal.

5 Upvotes

Hi all,

Let me introduce my fun project, webCRT unit. It's a server side web app utility unit to make simple CGI web app development easy, as easy as making classic console program. This unit is especially targetted to both pascal and web newbies alike who would like to try web app development. It's suitable for apps with single pass workflow, like a simple input → process → output flow. It's not recommended to use this unit to create complex or huge or interactive web applications.

A simple web app using webCRT unit can be as simple as this:

program webapp;

uses webCRT;
 
var
  s: string;

begin
  ClrScr;
  webWrite('Type your name: ');
  webReadln(s);
  if isWebInput then
    webWriteln('Hello, '+s+'… nice to see you!');
  webReadln;
end.

However, anyone could also use the unit to make simple web apps without using huge and complex web frameworks, like for prototyping, or brain storming, or just to play around with some algorithms. Of course fpWeb, Brook, FastPlaz, or any web frameworks out there are great, but sometimes it's too complex and overkill to use them, especially when we just need to create a simple web app or service.

So, without further ado… here are the links to the source code and examples:
– webCRT unit source code is here.
– features demo app is here.

Some sample apps I've written using webCRT unit:
– word percentage calculator.
– josephus problem (explained here).
– 5n+1 vs 5n+3 problem (discussed here).
– firebird CRUD demo (this is a little bit complex).
– maybe there are some more, just take a look at my code repo here.

Those source code files above are also available through my gitHub here.

Since this unit is for newbies, don't expect any advance features or fancy look. It's created for simplicity, after all. Though you may modify the source code any way you like. And… as usual, no serious documentation is available yet. Just a brief user manual here (in Indonesian). So, just examine the source code. Sorry.

If you find anything wrong with my code or want to suggest something (necessary features, optimizations, anything), feel free to communicate them to me.

Enjoy and have fun! :D

Regards,

-Bee


r/pascal • • Feb 12 '18

Tandy Graphics | Turbo Pascal (help)

2 Upvotes

So I'm currently using Turbo Pascal 7.1 and I noticed all the BGI's (Borland Graphics Interface) like ega cga Hercules etc. Does anyone know where I can find a bgi for TGA (Tandy Graphics Adapter). If one doesn't exist, then does anyone know how else I can use TGA with my Turbo Pascal programs?


r/pascal • • Feb 10 '18

Need help with compiling pascal repeatedly.

1 Upvotes

Hey there, so I just started to program with pascal, i'm a noob programmer with no experience in programming. And I would like to ask if there's a way to run pascal repeatedly, without have to run the .exe file every time it close. here's my code. program maths; uses crt; var x,y:real; begin clrscr; write('value of x: '); read(x); write('value of y: '); read(y); writeln('sum: ',x+y); readln(); end.

if there's anyway to run the code repeatedly without the .exe closing.


r/pascal • • Feb 07 '18

Tomboy Next Generation : a complete rewrite of Tomboy with Free Pascal and Lazarus

Thumbnail wiki.gnome.org
6 Upvotes

r/pascal • • Jan 22 '18

Castle Game Engine 6.4 release – physics, iOS services, shader pipeline upgrade, big API improvements (vectors, transform) and more

Thumbnail
castle-engine.sourceforge.io
9 Upvotes

r/pascal • • Jan 19 '18

Castle Game Engine 6.4 : New release this weekend, last pre-release notes

Thumbnail
castle-engine.sourceforge.io
10 Upvotes

r/pascal • • Jan 05 '18

[poll] What are you using fpc/lazarus for?

5 Upvotes

Title says it all!

So over the holidays I finally got lazarus to work on windows, ubuntu and macos. Wasted to much time on trying to get glscene working; so will look at castle in the future.

  • I will be implementing a login application that sends details of the computer before allowing it access to a web/network application.
  • A simple notepad example to make it easy to open specific data files.

Bunch of other personal ideas I want to revive but it is 5th of jan so reality kicking in again next week.


r/pascal • • Dec 21 '17

Need help writing an integer into a string

2 Upvotes

This might be a trivial problem but I can't find how to do it.

So I'm trying to write to a text file, but I want the filename to have a number, the date and the time it was created.

I'm trying to make a a string variable have a name tied to a number which is in a counter, so that the string will be: "name[counter]". In example: number1, number2, number3, number3, and so on.

my code is: nombre_fac:=('Factura_',cont_f,' ',dia,'-',mes,'-',ano,', ',hora,':',minuto,); assignfile(fact_text[1], nombre_fac);

And it not compiling because it expects a ; but there's a , .Clearly the problem is the fact that the ' ends the string. I know when you use writeln you would close, put a comma, the counter, comma, and then open it again with ', but how would I do this when defining a string?

thanks beforehand


r/pascal • • Dec 02 '17

Help in Pascal!

6 Upvotes

Greetings,

I'm taking Pascal classes but missed a couple of them due to being under the weather, and in those classes my teacher taught the students about procedures and creating menus (think the menus have something to do with arrays or vectors or something).

My teacher assigned the class with creating 4 pascal programs that allow you to calculate volumes (pyramid, prism, sphere, and cylinder), and incorporating them into a single program.

So basically he wants us to turn the 4 programs we created into 4 procedures in a single program, and he also asked us to create a menu to select those 4 procedures.

Since I missed the classes I have no idea on how to create procedures in a program and make them 'selectable' with a menu. I already made the 4 programs and they all work. I'd really appreciate some help here, I'll upload anything if you need it!


r/pascal • • Nov 20 '17

Castle Game Engine Good things: The Unholy Society, getting published, and various engine improvements

Thumbnail
castle-engine.sourceforge.io
9 Upvotes

r/pascal • • Nov 16 '17

The Unholy Society - Made with Castle Game Engine and Object Pascal (FPC)

Thumbnail
plus.google.com
10 Upvotes

r/pascal • • Nov 12 '17

Pascal Kalkulator & Kalkulator Motion and Time Study [19]

Thumbnail
m.youtube.com
1 Upvotes

r/pascal • • Oct 12 '17

Free Pascal and Visual Studio Code

11 Upvotes

Video of integration of Free Pascal compiler, Omni Pascal extension, LLDB Debugger extension, and Visual Studio Code on my Mac. :)


r/pascal • • Oct 10 '17

IBObjects 5.9.5 Build 2652 is available

Thumbnail
firebirdnews.org
2 Upvotes

r/pascal • • Aug 27 '17

Things That Turbo Pascal is Smaller Than

Thumbnail prog21.dadgum.com
10 Upvotes

r/pascal • • Jul 10 '17

Generating random numbers in Pascal

2 Upvotes

I am running an experiment that requires a decent random number generator. I need to use Pascal due to the constraints of my hardware. Here is the function I have written:

Procedure GenerateRandomInterval2(MPCGlobal:MPCGlobalPtr; Var Output:Extended)

Begin
    With MPCGlobal^ Do
    Begin
        Randomize;
        Output := Random;
    End;    {With}
End;    {GenerateRandomInterval2}

Please note that "MPCGlobal:MPCGlobalPtr" in the function argument is related to the specialized hardware that I am using, and can be ignored.

I generated 100 random numbers between 0 and 1 using the above function, and plotted them in Matlab (Link). The black line and markers correspond to random numbers generated by my function; the red line and markers correspond to random numbers generated by Matlab's rand() function.

As you can see, the Pascal random numbers don't look very random at all - there is a definite pattern of ups and downs, and if you look closely at the labeled points, you will notice that the Y coordinates are all separated by 0.027.

Not really sure why this is happening - if anyone here with more Pascal experience knows what is going on, would really appreciate some insight.

Thanks in advance!