From: "Arobase, Salle multimédia" Newsgroups: comp.os.cpm Subject: What is COMAL ? Date: Wed, 20 Mar 2002 02:42:32 +0100 Organization: Wanadoo, l'internet avec France Telecom Lines: 222 Message-ID: NNTP-Posting-Host: apoitiers-102-2-1-124.abo.wanadoo.fr X-Trace: wanadoo.fr 1016642930 5514 193.253.213.124 (20 Mar 2002 16:48:50 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 20 Mar 2002 16:48:50 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 I found the following file while searching. Among other things, I learned that the IBM PC version was called "IBM PC COMAL 2.2". There were also a "MacCOMAL" and a "AmigaCOMAL". Hope that you will find this file as interesting as I found it. I can't stand to have it under CP/M-86 Plus! Yours Sincerely, "French Luser" WHATSCML.TXT ------------ (Edited by Emmanuel ROCHE.) WHAT IS COMAL? -------------- COMAL was designed with the BEGINNER in mind, including many interactive features. It is tolerant of mistakes, yet discourages bad habits. This allows a beginner to develop skills necessary in advanced structured programming languages, such as, well, COMAL. The widely acclaimed TURTLE GRAPHICS are an integral part of COMAL, and have been for nearly a decade. ADVANCED PROGRAMMERS also pick COMAL as their language of choice. They utilize the many advanced and powerful features of COMAL that beginners do not need to even know about. However, as beginners' programming skills improve, COMAL always presents even more power and features for them to use. Let's examine some features that attract beginning programmers and keep advanced programmers. In direct mode, you interact directly with the computer. You type in a command, and COMAL responds right away. A beginner usually starts with a PRINT statement. The PRINT statement tells the computer to display a message on the screen. This is an important command. Would you want a program to calculate your mortgage payment, if it couldn't tell you the answer? In its simplest form, the PRINT statement can display a text constant. For example, type: PRINT "hello" and COMAL responds with: hello COMAL is also good with calculations. When you balance your checkbook, COMAL can help. If your starting balance is $313.76 and you wrote two checks ($250.00 and $125.98) type: PRINT 313.76-250.00-125.98 COMAL immediately responds with: -62.22 No wonder that check bounced. Actually, a useful program is usually harder than this. But don't worry, COMAL helps you in many ways. COMAL provides a full screen editor to help you write programs. You don't have to load a special program to use this editor. Just type in the program lines from direct mode, as described above. A program line consists of a line number followed by a statement. With its AUTO command, COMAL can provide the line number for you. You just type in the statement. COMAL's editor doesn't sit around watching you type either. It tries to figure out what you are telling it. If it doesn't understand, it will tell you right when you enter the line! Often, it offers advice on how to fix mistakes. This is when you will like COMAL's insert, delete, and cursor features. You don't retype the entire line, just the corrections. I can hear you saying, "Ok, COMAL is friendly, but what can it really do?" The power of COMAL comes from its commands, file handling ability, and program structures. You have already seen the PRINT command. COMAL provides several commands to deal with numeric and text data. The data can be provided to a running program from DATA statements in the program, from a file stored on disk, or by the person using the program. COMAL supports all the usual math operators such as addition, subtraction, multiplication, and division. It also knows logarithms, trig functions, two methods for generating random numbers, and a lot more. Text strings may be added together or have sub-strings extracted from them. A built-in string search even tells the position of one string within another if there is a match. Comparison operators allow strings and numbers to be sorted. Numbers can be converted to text format, and back again. COMAL supports two kinds of data files. SEQUENTIAL files read data from start to finish. You can write to sequential files or read from them, but not both at the same time. RANDOM ACCESS files are good if you store lots of records together, but only access a few at a time. You can read any record, update the information, and write it back. You don't have to start at the beginning of the file. Normally, COMAL uses the screen for all its output. But a special option redirects PRINT statements to your printer or even a disk file. You SELECT the output location. Later, you SELECT the screen again. Easy so far! But it is COMAL's structures that simplify programming, and keep advanced users from switching to another language. COMAL has four loop structures, two conditional branching structures, named procedures and functions with parameters, and an error trapping structure. The loop structures execute one or more consecutive statements over and over. Most loops have a one-line short form. The REPEAT and WHILE loops are similar. Both loop an indefinite number of times. The difference is when they decide to stop. The REPEAT loop places its test at the end of the loop. Thus, the statements inside the loop will always be executed at least once. The WHILE loop places the test at the start, so it is possible to skip the statements inside altogether. COMAL also includes the FOR loop. It counts from a starting value to the terminating value. This not only lets you specify the exact number of times the loop should execute, but also gives you a counter to use for other things. The last loop structure is LOOP. Like REPEAT and WHILE loops, the statements inside are executed an indefinite number of times. However, it's EXIT is from the middle, not the ends, and you can specify exactly how many loops to take as an option. The conditional structures choose one section of code over another, based on a comparison. A multi-line IF structure has its primary test on the first line (optional ELIF secondary tests are also allowed). If the test is true, its statements are executed. Otherwise, an ELSE section is executed (if you include it). A one-line IF is also available. The CASE structure evaluates one expression at the start (either a number or a text string). The value is compared to the values in the WHEN statements. If the main expression value matches a value in a WHEN statement, the section of code below that WHEN statement is executed. If there is no match, the section of code below the optional OTHERWISE statement is executed. COMAL automatically indents lines within structures for you! It also capitalizes keywords, and puts variable names in lower case. This makes it easy to follow the program. COMAL also allows you to store program segments on disk. You recall them into future programs using the MERGE command. Lines are renumbered automatically to fit the new program. COMAL is a powerful language. However, no language can include everything. That's why COMAL includes the possibility to extend itself. You can write long routines, give them names, and call them with a single command, just like a PRINT statement. These routines can be called from direct mode or a running program. These are procedures and functions. A procedure is usually a set of statements that work well together. Information can be transferred to and from procedures through variables called parameters. Functions are like procedures -- multi-line structures which can have parameters, and are called with a single statement. The difference is that, unlike a procedure, a function also returns a value (string or numeric) to the statement which called it. Don't overlook COMAL's error handling structure. A language which permits interaction with a user should anticipate the possibility for errors which are difficult to resolve. A classic example is division by zero. Many languages give you two choices: test every expression before it has a chance to cause an error, or let the system crash. The first method has two drawbacks: it slows program execution, and the test itself may cause a crash. COMAL gives you a third choice -- utilize its Error Handler! This structure can be used to minimize the effects of errors. The Handler can't create the data in a missing file in the case of a FILE NOT FOUND error, but it can give you a second chance to put the correct disk in the disk drive. Since the Error Handler is a true structure, it is easy to use. Advanced programmers can utilize it fully, complete with nested Error Handlers. Finally, COMAL can be extended and expanded indefinitely with "packages". Beginners can use packages without knowing how they are created. Advanced programmers will find packages an exciting way to tailor the COMAL system to their needs. The above description is not a complete review of COMAL, but should give you an idea of what to expect. All COMAL 2.0 implementations are compatible, and include these features. Plus, each adds its own special characteristics (such as mouse, windows and speech in AmigaCOMAL). Trace commands are often included, to help follow program flow. For a free copy of the 24 page COMAL INFO booklet, send a Self Addressed Stamped (45 cents) Envelope to: COMAL Users Group USA Ltd 5501 Groveland Terrace Madison, WI 53716 EOF