⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yabasic.htm

📁 Linux下VB解释器
💻 HTM
📖 第 1 页 / 共 2 页
字号:
      Although <span class="acronym">basic</span> has its reputation as a language for beginning programmers,      this is not an introduction to programming at large. Rather this text assumes, that      the reader has some (moderate) experience with writing and starting computer programs.</p><p>    </p></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2455854"></a>About <span class="application">yabasic</span></h2></div></div></div><p><span class="application">yabasic</span> is a traditional basic interpreter. It understands most of the typical basic-constructs, like <code class="function">goto</code>, <code class="function">gosub</code>, line numbers, <code class="function">read</code>, <code class="function">data</code> or string-variables with a trailing '<code class="literal">$</code>'. But on the other hand, <span class="application">yabasic</span> implements some more advanced programming-constructs like subroutines or libraries (but <span class="emphasis"><em>not</em></span> objects). <span class="application">yabasic</span> works much the same under Unix and Windows.</p><p><span class="application">yabasic</span> puts emphasis on giving results quickly and easily; therefore simple commands are provided to open a graphic window, print the graphics or control the console screen and get keyboard or mouse information. The example below opens a window, draws a circle and prints the graphic:</p><pre class="programlisting">open window 100,100open printercircle 50,50,40text 10,50,"Press any key to get a printout"clear screeninkey$close printerclose window</pre><p>This example has fewer lines, than it would have in many other programming languages. In the end however <span class="application">yabasic</span> lacks behind more advanced and modern programming languages like C++ or Java. But as far as it goes it tends to give you results more quickly and easily.</p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="chapter_program_windows"></a>Chapter聽2.聽The <span class="application">yabasic</span>-program under Windows</h2></div></div></div><div class="toc"><dl><dt><span class="sect1"><a href="#id2455307">Starting <span class="application">yabasic</span></a></span></dt><dt><span class="sect1"><a href="#id2455554">Options</a></span></dt><dt><span class="sect1"><a href="#id2452869">The context Menu</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2455307"></a>Starting <span class="application">yabasic</span></h2></div></div></div><p>Once, <span class="application">yabasic</span> has been set up correctly, there are three ways to start it:</p><div class="orderedlist"><ol type="1"><li><p><span class="emphasis"><em>Rightclick on your desktop:</em></span> The desktop menu appears with a submenu named <span class="emphasis"><em>new</em></span>. From this submenu choose <span class="application">yabasic</span>. This will create a new icon on your desktop. If you rightclick on this icon, its <a href="#windows_context_menu">context menu</a> will appear; choose <span class="guilabel">Execute</span> to execute the program.</p></li><li><p>As a variant of the way described above, you may simply <span class="emphasis"><em>create a file with the ending <code class="filename">.yab</code></em></span> (e.g. with your favorite editor). Everything else then works as described above.</p></li><li><p><span class="emphasis"><em>From the start-menu:</em></span> Choose <span class="application">yabasic</span> from your start-menu. A console-window will open and you will be asked to type in your program. Once you are finished, you need to type <code class="literal">return</code> twice, and <span class="application">yabasic</span> will parse and execute your program.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This is <span class="emphasis"><em>not</em></span> the preferred way of starting <span class="application">yabasic</span> ! Simply because the program, that you have typed, <span class="emphasis"><em>can not be saved</em></span> and will be lost inevitably ! There is no such thing as a <code class="function">save</code>-command and therefore no way to conserve the program, that you have typed. This mode is only intended for quick hacks, and short programs.</p></div></li></ol></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2455554"></a>Options</h2></div></div></div><p>Under Windows <span class="application">yabasic</span> will mostly be invoked by double-clicking on an appropriate icon; this way you do not have a chance to specify any of the commandline options below. However, advanced users may add some of those options to the appropriate entries in the registry.</p><p>All the options below may be abbreviated, as long as the abbreviation does not become ambiguous. For example, you may write <code class="literal">-e</code> instead of <code class="literal">-execute</code>.</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">-help</code> or <code class="literal">-?</code></span></dt><dd><p>Prints a short help message, which itself describes two further help-options.</p></dd><dt><span class="term"><code class="literal">-version</code></span></dt><dd><p>Prints the version of <span class="application">yabasic</span>.</p></dd><dt><span class="term"><code class="literal">-geometry +<em class="replaceable"><code>X-POSITION</code></em>+<em class="replaceable"><code>Y-POSITION</code></em></code></span></dt><dd><p>Sets the position of the graphic window, that is opened by <code class="function">open window</code> (the <span class="emphasis"><em>size</em></span> of this window, of course, is specified within the <code class="function">open window</code>-command). An example would be <code class="literal">-geometry +20+10</code>, which would place the graphic window 10 pixels below the upper border and 20 pixels right of the left border of the screen. This value cannot be changed, once <span class="application">yabasic</span> has been started.</p></dd><dt><span class="term"><code class="literal">-font <em class="replaceable"><code>NAME-OF-FONT</code></em></code></span></dt><dd><p>Name of the font, which will be used for graphic-text; can be any of <code class="literal">decorative, dontcare, modern, roman, script, swiss</code>. You may append a fontsize (measured in pixels) to any of those fontnames; for example <code class="literal">-font swiss30</code> chooses a swiss-type font with a size of 30 pixels.</p></dd><dt><span class="term"><code class="literal">-bind <em class="replaceable"><code>NAME-OF-STANDALONE-PROGRAM</code></em></code></span></dt><dd><p>Create a standalone program (whose name is specified by <em class="replaceable"><code>NAME-OF-STANDALONE-PROGRAM</code></em>) from the <span class="application">yabasic</span>-program, that is specified on the commandline. See the section about <a href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a> for details.</p></dd><dt><span class="term"><code class="literal">-execute <em class="replaceable"><code>A-PROGRAM-AS-A-SINGLE-STRING</code></em></code></span></dt><dd><p>With this option you may specify some <span class="application">yabasic</span>-code to be executed rigth away.This is useful for very short programs, which you do not want to save within a file. If this option is given, <span class="application">yabasic</span> will not read any code from a file. Let's say, you have forgotten some of the square numbers between 1 and 10; in this case the command <code class="literal">yabasic -e 'for a=1 to 10:print a*a:next a'</code> will give you the answer immediately.</p></dd><dt><span class="term"><code class="literal">-infolevel <em class="replaceable"><code>INFOLEVEL</code></em></code></span></dt><dd><p>Change the <span class="emphasis"><em>infolevel</em></span> of yabasic, where <em class="replaceable"><code>INFOLEVEL</code></em> can be one of <code class="literal">debug</code>, <code class="literal">note</code>, <code class="literal">warning</code>, <code class="literal">error</code> and <code class="literal">fatal</code> (the default is <code class="literal">warning</code>). This option changes the amount of debugging-information <span class="application">yabasic</span> produces. However, normally only the author of <span class="application">yabasic</span> (<span class="emphasis"><em>me</em></span> !) would want to change this.</p></dd><dt><span class="term"><code class="literal">-doc <em class="replaceable"><code>NAME-OF-A-PROGRAM</code></em></code></span></dt><dd><p>Print the <span class="emphasis"><em>embedded documentation</em></span> of the named program. The embedded documentation of a program consists of all the comments within the program, which start with the special keyword <code class="function"><a href="#ref_doc" title="doc">doc</a></code>. This documentation can also be seen by choosing the corresponding entry from the context-menu of any <span class="application">yabasic</span>-program.</p></dd><dt><span class="term"><code class="literal">-librarypath <em class="replaceable"><code>DIRECTORY-WITH-LIBRARIES</code></em></code></span></dt><dd><p>Change the directory, wherein libraries will be searched and imported (with the <code class="function"><a href="#ref_import" title="import">import</a></code>-command). See also <code class="function"><a href="#ref_import" title="import">this entry</a></code> for more information about the way, libraries are searched.</p></dd></dl></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2452869"></a>The context Menu</h2></div></div></div><p>Like every other icon under Windows, the icon of every <span class="application">yabasic</span>-program has a <span class="emphasis"><em>context menu</em></span> offering the most frequent operations, that may be applied to a <span class="application">yabasic</span>-program.</p><div class="variablelist"><dl><dt><span class="term"><span class="guilabel">Execute</span></span></dt><dd><p>This will invoke <span class="application">yabasic</span> to execute your program. The same happens, if you <span class="emphasis"><em>doubleclick</em></span> on the icon.</p></dd><dt><span class="term"><span class="guilabel">Edit</span></span></dt><dd><p><span class="application">notepad</span> will be invoked, allowing you to edit your program.</p></dd><dt><span class="term"><span class="guilabel">View docu</span></span></dt><dd><p>This will present the embedded documentation of your program. Embedded documentation is created with the special comment <code class="function"><a href="#ref_doc" title="doc">doc</a></code>.</p></dd></dl></div></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="chapter_program_unix"></a>Chapter聽3.聽The <span class="application">yabasic</span>-program under Unix</h2></div></div></div><div class="toc"><dl><dt><span class="sect1"><a href="#id2453000">Starting <span class="application">yabasic</span></a></span></dt><dt><span class="sect1"><a href="#id2510849">Options</a></span></dt><dt><span class="sect1"><a href="#id2511361">Setting defaults</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2453000"></a>Starting <span class="application">yabasic</span></h2></div></div></div><p>If your system administrator (vulgo <span class="emphasis"><em>root</em></span>) has installed <span class="application">yabasic</span> correctly, there are three ways to start it:</p><div class="orderedlist"><ol type="1"><li><p>You may use your favorite editor (<span class="application">emacs</span>, <span class="application">vi</span> ?) to put your program into a file (e.g. <code class="filename">foo</code>). Make sure that the very first line starts with the characters '<code class="literal">#!</code>'  followed by the full pathname of <span class="application">yabasic</span> (e.g. '<code class="literal">#!/usr/local/bin/yabasic</code>'). This <span class="emphasis"><em>she-bang</em></span>-line ensures, that your Unix will invoke <span class="application">yabasic</span> to execute your program (see also the entry for the <a href="#ref_hash" title="#">hash</a>-character). Moreover, you will need to change the permissions of your <span class="application">yabasic</span>-program <code class="filename">foo</code>, e.g. <code class="literal">chmod u+x foo</code>. After that you may invoke <span class="application">yabasic</span> to invoke your program by simply typing <code class="literal">foo</code> (without even mentioning <span class="application">yabasic</span>). However, if your <code class="envar">PATH</code>-variable does not contain a single dot ('<code class="literal">.</code>') you will have to type the full pathname of your program: e.g. <code class="filename">/home/ihm/foo</code> (or at least <code class="filename">./foo</code>).</p></li><li><p>Save your program into a file (e.g. <code class="filename">foo</code>) and type <code class="literal">yabasic foo</code>. This assumes, that the directory, where <span class="application">yabasic</span> resides, is contained within your <code class="envar">PATH</code>-variable.</p></li><li><p>Finally your may simply type <strong class="userinput"><code>yabasic</code></strong> (maybe it will be necessary to include its full pathname). This will make <span class="application">yabasic</span> come up and you will be asked to type in your program. Once you are finished, you need to type <code class="literal">return</code> twice, and <span class="application">yabasic</span> will parse and execute your program.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This is <span class="emphasis"><em>not</em></span> the preferred way of starting <span class="application">yabasic</span> ! Simply because the program, that you have typed, <span class="emphasis"><em>can not be saved</em></span> and will be lost inevitably ! There is no such thing as a <code class="function">save</code>-command and therefore no way to conserve the program, that you have typed. This mode is only intended for quick hacks, and short programs, i.e. for using <span class="application">yabasic</span> as some sort of fancy desktop calculator.</p></div></li></ol></div></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id2510849"></a>Options</h2></div></div></div><p><span class="application">yabasic</span> accepts a number of options on the commandline. All these options below may be abbreviated, as long as the abbreviation does not become ambigous. For example you may write <code class="literal">-e</code> instead of <code class="literal">-execute</code>.</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">-help</code> or <code class="literal">-?</code></span></dt><dd><p>Prints a short help message, which itself describes two further help-options.</p></dd><dt><span class="term"><code class="literal">-version</code></span></dt><dd><p>Prints the version of <span class="application">yabasic</span>.</p></dd><dt><span class="term"><code class="literal">-fg <em class="replaceable"><code>FOREGROUND-COLOR</code></em></code> or <code class="literal">-foreground <em class="replaceable"><code>FOREGROUND-COLOR</code></em></code></span></dt><dd><p>Define the foreground color for the graphics-window (that will be opened with <code class="function"><a href="#ref_open_window" title="open window">open window</a></code>). The usual X11 colornames, like <span class="emphasis"><em>red</em></span>, <span class="emphasis"><em>green</em></span>, 鈥

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -