Euphoria-library-routines
ユーフォリア-ライブラリルーチン
多数のライブラリルーチンが提供されています。 いくつかは、インタプリタ ex.exe、exw.exeまたはexu に直接組み込まれています。 その他はEuphoriaで記述されており、それらを使用するには euphoria \ include ディレクトリに.eファイルの1つを含める必要があります。
どのようなオブジェクトが渡され、返される可能性があるかを示すために、次のプレフィックスが使用されます-
S.No | Prefix & Description |
---|---|
1 |
x 一般的なオブジェクト(原子またはシーケンス) |
2 |
s シーケンス |
3 |
a 原子 |
4 |
i 整数 |
5 |
fn ファイル番号として使用される整数 |
6 |
st 文字列シーケンス、または単一文字のアトム |
定義済みのタイプ
これらの型で変数を宣言するだけでなく、値が特定の型であるかどうかをテストするために、通常の関数のように変数を呼び出すこともできます。
integer | − | test if an object is an integer |
atom | − | test if an object is an atom |
sequence | − | test if an object is a sequence |
object | − | test if an object is an object (always true) |
シーケンス操作
length | − | return the length of a sequence |
repeat | − | repeat an object n times to form a sequence of length n |
reverse | − | reverse a sequence |
append | − | add a new element to the end of a sequence |
prepend | − | add a new element to the beginning of a sequence |
検索と並べ替え
compare | − | compare two objects |
equal | − | test if two objects are identical |
find | − | find an object in a sequence - start searching from element number 1 |
find_from | − | find an object in a sequence - start searching from any element number |
match | − | find a sequence as a slice of another sequence - start searching from element number 1 |
match_from | − | find a sequence as a slice of another sequence - start searching from any element number |
sort | − | sort the elements of a sequence into ascending order |
custom_sort | − | sort the elements of a sequence based on a compare function that you supply |
パターンマッチング
lower | − | convert an atom or sequence to lower case |
upper | − | convert an atom or sequence to upper case |
wildcard_match | − | match a pattern containing ? and * wildcards |
wildcard_file | − | match a file name against a wildcard specification |
Math
これらのルーチンは、個々のアトムまたは値のシーケンスに適用できます。
sqrt | − | calculate the square root of an object |
rand | − | generate random numbers |
sin | − | calculate the sine of an angle |
arcsin | − | calculate the angle with a given sine |
cos | − | calculate the cosine of an angle |
arccos | − | calculate the angle with a given cosine |
tan | − | calculate the tangent of an angle |
arctan | − | calculate the arc tangent of a number |
log | − | calculate the natural logarithm |
floor | − | round down to the nearest integer |
remainder | − | calculate the remainder when a number is divided by another |
power | − | calculate a number raised to a power |
PI | − | the mathematical value PI (3.14159…) |
ビットごとの論理演算
これらのルーチンは、数値をバイナリビットのコレクションとして扱い、数値のバイナリ表現の対応するビットに対して論理演算が実行されます。
ビットを左または右にシフトするルーチンはありませんが、2の累乗で乗算または除算することで同じ効果を実現できます。
and_bits | − | perform logical AND on corresponding bits |
or_bits | − | perform logical OR on corresponding bits |
xor_bits | − | perform logical XOR on corresponding bits |
not_bits | − | perform logical NOT on all bits |
ファイルおよびデバイスI/O
ファイルまたはデバイスで入力または出力を行うには、最初にファイルまたはデバイスを開き、次に以下のルーチンを使用して読み取りまたは書き込みを行ってから、ファイルまたはデバイスを閉じる必要があります。 http://www.rapideuphoria.com/lib_h_o#open [open()]は、他のI/Oルーチンの最初の引数として使用するファイル番号を提供します。 特定のファイル/デバイスが自動的に(テキストファイルとして)開かれます-
- 0-標準入力
- 1-標準出力
- 2-標準エラー
open | − | open a file or device |
close | − | close a file or device |
flush | − | flush out buffered data to a file or device |
lock_file | − | lock a file or device |
unlock_file | − | unlock a file or device |
− | ##print a Euphoria object on one line, with braces and commas \{,,} to show the structure | |
pretty_print | − | ##print a Euphoria object in a nice readable form, using multiple lines and appropriate indentation |
? x | − | ##shorthand for print(1, x) |
sprint | − | return a printed Euphoria object as a string sequence |
printf | − | formatted print to a file or device |
sprintf | − | formatted print returned as a string sequence |
puts | − | output a string sequence to a file or device |
getc | − | read the next character from a file or device |
gets | − | ##read the next line from a file or device |
get_bytes | − | ##read the next n bytes from a file or device |
prompt_string | − | prompt the user to enter a string |
get_key | − | ##check for key pressed by the user, don’t wait |
wait_key | − | wait for user to press a key |
get | − | read the representation of any Euphoria object from a file |
prompt_number | − | prompt the user to enter a number |
value | − | read the representation of any Euphoria object from a string |
seek | − | move to any byte position within an open file |
where | − | report the current byte position in an open file |
current_dir | − | return the name of the current directory |
chdir | − | change to a new current directory |
dir | − | return complete info on all files in a directory |
walk_dir | − | recursively walk through all files in a directory |
allow_break | − | allow control-c/control-Break to terminate your program or not |
check_break | − | check if user has pressed control-c or control-Break |
マウスのサポート(DOS32およびLinux)
Windows XPでは、DOSマウスを(非フルスクリーン)ウィンドウで動作させる場合は、DOSウィンドウのプロパティでクイック編集モードを無効にする必要があります。
get_mouse | − | return mouse "events" (clicks, movements) |
mouse_events | − | select mouse events to watch for |
mouse_pointer | − | display or hide the mouse pointer |
オペレーティング・システム
time | − | number of seconds since a fixed point in the past |
tick_rate | − | set the number of clock ticks per second (DOS32) |
date | − | current year, month, day, hour, minute, second etc. |
command_line | − | command-line used to run this program |
getenv | − | get value of an environment variable |
system | − | execute an operating system command line |
system_exec | − | execute a program and get its exit code |
abort | − | terminate execution |
sleep | − | suspend execution for a period of time |
platform | − | find out which operating system are we running on |
特別なマシン依存ルーチン
machine_func | − | specialized internal operations with a return value |
machine_proc | − | specialized internal operations with no return value |
デバッグ
trace | − | dynamically turns tracing on or off |
profile | − | dynamically turns profiling on or off |
グラフィックスとサウンド
次のルーチンを使用すると、画面に情報を表示できます。 DOSでは、PC画面を多くのグラフィックモードのいずれかに配置できます。
次のルーチンは、すべてのテキストモードとピクセルグラフィックモードで動作します。
clear_screen | − | clear the screen |
position | − | set cursor line and column |
get_position | − | return cursor line and column |
graphics_mode | − | select a new pixel-graphics or text mode (DOS32) |
video_config | − | return parameters of current mode |
scroll | − | scroll text up or down |
wrap | − | control line wrap at right edge of screen |
text_color | − | set foreground text color |
bk_color | − | set background color |
palette | − | change color for one color number (DOS32) |
all_palette | − | change color for all color numbers (DOS32) |
get_all_palette | − | get the palette values for all colors (DOS32) |
read_bitmap | − | read a bitmap (.bmp) file and return a palette and a 2-d sequence of pixels |
save_bitmap | − | create a bitmap (.bmp) file, given a palette and a 2-d sequence of pixels |
get_active_page | − | return the page currently being written to (DOS32) |
set_active_page | − | change the page currently being written to (DOS32) |
get_display_page | − | return the page currently being displayed (DOS32) |
set_display_page | − | change the page currently being displayed (DOS32) |
sound | − | make a sound on the PC speaker (DOS32) |
次のルーチンは、モードでのみテキストで動作します
cursor | − | select cursor shape |
text_rows | − | set number of lines on text screen |
get_screen_char | − | get one character from the screen |
put_screen_char | − | put one or more characters on the screen |
save_text_image | − | save a rectangular region from a text screen |
display_text_image | − | display an image on the text screen |
次のルーチンは、ピクセルグラフィックモードでのみ動作します(DOS32)
pixel | − | set color of a pixel or set of pixels |
get_pixel | − | read color of a pixel or set of pixels |
draw_line | − | connect a series of graphics points with a line |
polygon | − | draw an n-sided figure |
ellipse | − | draw an ellipse or circle |
save_screen | − | save the screen to a bitmap (.bmp) file |
save_image | − | save a rectangular region from a pixel-graphics screen |
display_image | − | display an image on the pixel-graphics screen |
マルチタスク
task_clock_start | − | restart the scheduler’s clock |
task_clock_stop | − | stop the scheduler’s clock |
task_create | − | create a new task |
task_list | − | get a list of all tasks |
task_schedule | − | schedule a task for execution |
task_self | − | return the task id of the current task |
task_status | − | the current status (active, suspended, terminated) of a task |
task_suspend | − | Suspend a task. |
task_yield | − | Yield control, so the scheduler can pick a new task to run. |