How to develop Linux programs in easy language
Easy Language version 3.6 is a cross-platform version, which can support Windows, Linux and Unixlinux platform developmentIn the Easy Language version 3.6 environment mirror, you can compile programs based on Windows in the Windows environment, and compile Programs under Linux can be distributed on multiple platforms. When publishing separately, just select different operating systems.
Here, we would like to inform Yi Language users once again that if you compile a program based on Windows, you can use Yi Language version 3.6 to compile directly. There will be no impact on cross-platform and it will be the same as the previous operation. If you want to develop programs based on Linux systems, please see the instructions below.
All statements in this chapter and the following assume that you have downloaded Yi Language version 3.6 from Yi Language website, but the installation has been completed without any changes.
One interface
After running Easy Language version 3.6, you will see the following startup screen:
Normally, if you are writing a Windows program, you only need to select the first icon.
The "Windows Console Program" icon indicates that you can compile a windowless console program under Windows.
To generate a Linux program, please select the 3rd "
Linux program” icon.
Select the icon and click OK, or double-click the icon and Yi Language will switch to the assembly window and manually create the following code:
Here, I am afraid you will notice that the "_Startup window" is not generated now. This is because it only supports windowless console programs of Linux for the time being, and the window feature is not currently supported. The information box is also difficult to pop up.
First, let’s take a look at the changes in the menu of Yi Language version 3.6 compared to previous versions:
Easy Language version 3.6 has an additional option in the "Program" menu. We click "Program" → "Program Configuration" and the "Program Configuration Dialog Box" will appear, as shown on the right.
Easy Language version 3.6 will have an additional "Program Type" combo box. Since what we just selected is to compile a Linux program, it selects a Linux console program.
Let’s take a look at the program menu again. No matter what type of program you compile, you will use the two submenus of "Compile" as pointed by the arrow in the picture or "Independent Compilation" below.
We select different program types in the program configuration selection box, and the corresponding type of program will be compiled
Note: Easy Language Linux version currently only supports windowless console programs.
Easy Language Linux version currently only supports some commands.
Second platform conversion
If you have selected a certain platform to compile code, you only need to select "Linux console program" through the "Program Configuration Dialog" → "Program Type", and you can easily compile a program that can run on the Linux platform.
Just now our compilation target platform is Linux, we can switch to the Windows platform, as shown on the right.
You can observe the changes in the title bar of Yi Language after switching to the Windows target platform, as shown in the picture on the right.
Three code compilation
After creating a new Linux program, we can enter the following code:
The "standard output ()" and "standard input ()" are newly reduced commands and can be found in the support library subfolder.
After that, we select the menu "Program" → "Compile", or press F7 to save the code we just compiled into a file, for example, the file name is soft. As shown on the right.
Note: The compiled Linux program does not have a fixed suffix name.
Note: The file name can also be an English name. But the target Linux system must support English.
Four execution of Linux programs
Note: The following operations are all under the Linux platform. If the Linux operating system is not installed, please select a version of the Linux operating system. And it also supports English Linux operating system. The file name can also be taken as an English name.
We will put the file soft we just compiled in the main directory of the Linux platform, and at the same time put the file in the same directory, run the Terminal program, we will see the following interface
First we list all the files under the current folder:
Nowadays, the font of soft file is white. It is difficult for us to execute it under Linux. After entering soft, the following error message will appear:
We only need to enter "chmod775 program name". The format of this command is deep in Linux, and we can run the soft program under Linux. The function of entering this command is to give the specified program executable permissions.
At this time, after we use the ls command to list all the fileslinux platform development, the font of the soft file will be changed to another color:
At this time, after we run soft again, we can execute the Linux program we compiled under the Windows platform yesterday. After we enter 20 and 30 according to the program's prompts, we can see that the program will manually output the result 50, and then the program will end manually.
Remark 1:
There are 3 support library files for running Linux programs compiled in Easy Language:
1: File krnln.so (system core support library)
This library is one of the basic libraries of Yi Language System. It requires the support of Yi System version 3.6. It provides 47 library-defined data types, 579 commands, and 330 library-defined constants.
2: File dp1.so (data operation support library one)
This library is a general support library, which requires the support of Easy System version 3.6 and the system core support library version 3.0. It provides 7 command Linux environment configurations and 2 library definition constants.
3: File cncnv.so (Chinese character encoding conversion support library)
This library is a general support library. It requires the support of Easy System version 3.6 and the system core support library version 3.0. It provides 1 command and 5 library definition constants.
The above three are support library files under Yi Language Linux. To run a Linux program compiled by Yi Language, you must bring the relevant support library files. The support library files can be placed in the following three places:
1. Place it in the same directory as the program files
2. Place it under /lib
3. Place it under /usr/lib
Note 2:
To run the program in the terminal, you must add "./" after the program name
Class library list:
Class library name
Download
Instructions
Demo class library in this chapter
linux.e
Demonstrates the multiplication operation under Linux
Word guessing game
guess the word.e
The notebook randomly generates a number for you to guess the mini game
Predict product prices
Price prediction.e
A small game similar to word guessing game
The above is the detailed content of Easy Language version 3.6: cross-platform programming, supports Windows, Linux and Unix. For more information, please follow other related articles on the PHP Chinese website!