From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/sandbox/index.html | 172 +++++++++++++++++++++++++++ files/ja/sandbox/js_compilescript/index.html | 114 ++++++++++++++++++ 2 files changed, 286 insertions(+) create mode 100644 files/ja/sandbox/index.html create mode 100644 files/ja/sandbox/js_compilescript/index.html (limited to 'files/ja/sandbox') diff --git a/files/ja/sandbox/index.html b/files/ja/sandbox/index.html new file mode 100644 index 0000000000..497bd4aa54 --- /dev/null +++ b/files/ja/sandbox/index.html @@ -0,0 +1,172 @@ +--- +title: Sandbox +slug: Sandbox +tags: + - サンドボックス + - テンポラリー + - デモ +translation_of: Sandbox +--- +

日本語ライブサンプルテスト

+ +
<span class="hello">こんにちは</span>、<span class="world">世界!</span>
+ +
.hello {
+  font-weight: bold;
+}
+.world {
+  color: #ffffff;
+  background-color: #003333;
+}
+ +

結果:

+ +

{{ EmbedLiveSample('日本語ライブサンプルテスト', '100%', '208px') }}

+ + + +

------------------------------------------------------------------------------------------------------------------

+ +

太字ABC 斜体ABC 下線ABC 打ち消し線ABC 下付きABC 上付きABC Inline Code (Ctrl-O) Keystroke or User-entered Text (Alt-Ctrl-A)

+ +

------------------------------------------------------------------------------------------------------------------

+ +

記事タイトル検索 / リンクテキスト

+ +

------------------------------------------------------------------------------------------------------------------

+ +

↓↓↓↓↓ ブロックスタイル ↓↓↓↓↓

+ +

------------------------------------------------------------------------------------------------------------------

+ +

None

+ +

------------------------------------------------------------------------------------------------------------------

+ +
+

Note Box

+
+ +

------------------------------------------------------------------------------------------------------------------

+ +
+

Warning Box

+
+ +

------------------------------------------------------------------------------------------------------------------

+ +
+

Two Columns ?

+
+ +

------------------------------------------------------------------------------------------------------------------

+ +
+

Three Columns ?

+
+ +

------------------------------------------------------------------------------------------------------------------

+ +
Syntax Box
+ +

------------------------------------------------------------------------------------------------------------------

+ + + +

------------------------------------------------------------------------------------------------------------------

+ +

↓↓↓↓↓ インラインスタイル ↓↓↓↓↓

+ +

------------------------------------------------------------------------------------------------------------------

+ +

Summary

+ +

------------------------------------------------------------------------------------------------------------------

+ +

↓↓↓↓↓  ↓↓↓↓↓

+ +

------------------------------------------------------------------------------------------------------------------

+ +
+

ブロック引用文

+
+ +

------------------------------------------------------------------------------------------------------------------

+ +

Heading Level 2 (Ctrl-2)

+ +

------------------------------------------------------------------------------------------------------------------

+ +

Heading Level 3 (Ctrl-3)

+ +

------------------------------------------------------------------------------------------------------------------

+ +

Heading Level 4 (Ctrl-4)

+ +

------------------------------------------------------------------------------------------------------------------

+ +
Heading Level 5 (Ctrl-5)
+ +

------------------------------------------------------------------------------------------------------------------

+ +
Preformatted Text (Ctrl-P)
+ +

------------------------------------------------------------------------------------------------------------------

+ +
    +
  1. 番号付きリスト
  2. +
  3. 番号付きリスト +
      +
    1. インデント
    2. +
    +
  4. +
  5. インデント解除
  6. +
+ +

------------------------------------------------------------------------------------------------------------------

+ + + +

------------------------------------------------------------------------------------------------------------------

+ +
+
Description List - Description Term
+
Description List - Description Value
+
+ +

------------------------------------------------------------------------------------------------------------------

+ + + + + + + + + + + + + + + + + + + +
キャプション
表#tableIdヘッダ
ヘッダ11
ヘッダ12
+ +


+ ------------------------------------------------------------------------------------------------------------------

+ +

------------------------------------------------------------------------------------------------------------------

diff --git a/files/ja/sandbox/js_compilescript/index.html b/files/ja/sandbox/js_compilescript/index.html new file mode 100644 index 0000000000..4a8cc95ddf --- /dev/null +++ b/files/ja/sandbox/js_compilescript/index.html @@ -0,0 +1,114 @@ +--- +title: JS CompileScript +slug: Sandbox/JS_CompileScript +tags: + - JSAPI Reference + - SpiderMonkey +translation_of: Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_CompileScript +--- + + + + +

スクリプトを実行するためにコンパイルします。

+ +

構文

+ +
JSScript * JS_CompileScript(JSContext *cx, JSObject *obj,
+    const char *bytes, size_t length, const char *filename,
+    uintN lineno);
+
+JSScript * JS_CompileUCScript(JSContext *cx, JSObject *obj,
+    const jschar *chars, size_t length, const char *filename,
+    uintN lineno);
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cxJSContext *ランタイムへのアクセスに用いるJavaScriptコンテキストへのポインタPointer to a JS context from which to derive runtime information. {{ Jsapi-requires-request() }}
objJSObject *スクリプトと関連付けるオブジェクトObject with which the script is associated.
sourceconst char * or const jschar *コンパイル対象のスクリプト文字列String containing the script to compile.
lengthsize_tsourceの文字列長The length, in characters, of <code>source</code>.
filenameconst char *エラーメッセージ出力に利用されるスクリプトのファイル名またはそのURLを示す文字列Name of file or URL containing the function. Used to report filename or URL in error messages.
linenouintNsourceの先頭行番号。エラーメッセージとして出力される行数に使われるもので、1以上の値を取ります。Line number of the first line of <code>source</code>. Must be greater than zero. Used to report the offending line in the file or URL if an error occurs.
+ +

解説

+ +

JS_CompileScript は、スクリプト文字列 source をコンパイルする関数です。JS_CompileUCScript はスクリプト文字列にUnicodeを引数に取る関数です。 <code>JS_CompileScript</code> compiles a script, <code>source</code>, for execution. <code>JS_CompileUCScript</code> is the Unicode version of the function.

+ +

スクリプトは JavaScript オブジェクトobjと関連付けられます。引数 bytes はスクリプト文字列、length は文字列長をそれぞれ取ります。 The script is associated with a JS object. <code>bytes</code> is the string containing the text of the script. <code>length</code> indicates the size of the text version of the script in bytes.

+ +

filename はスクリプトのファイル名あるいは URL を引数として取ります。ここで指定した情報は、コンパイルエラーが発生したときのエラーメッセージに利用されます。lineno も同様にエラーメッセージとして出力される行番号として利用されます。 スクリプトが巨大なファイルの一部でない場合は、lineno1 に設定すればよいでしょう(基本的にファイルの先頭行は 0 でなく1で示します)。 <code>filename</code> is the name of the file (or URL) containing the script. This information is included in error messages if an error occurs during compilation. Similarly, <code>lineno</code> is used to report the line number of the script or file where an error occurred during compilation. If the script is not part of a larger document, <code>lineno</code> should be <code>1</code> (as the first line of a file is universally considered to be line <code>1</code>, not line <code>0</code>).

+ +

コンパイルが成功したとき、JS_CompileScript および JS_CompileUCScript はコンパイルされたスクリプトへのポインタを返します。失敗したときはエラーメッセージを出力し、NULL を値として返します。 On success, <code>JS_CompileScript</code> and <code>JS_CompileUCScript</code> return a pointer to the newly compiled script. Otherwise, they report an error and return <code>NULL</code>.

+ +
{{ Warning('コンパイルによってできたJSScript の中には、コンパイル中に生成された文字列などのオブジェクトが含まれます。これらのオブジェクトは、即座にガベージコレクションされ消去される危険があります。ガベージコレクションから JSObject を保護するために、呼び元は JS_NewScriptObject を使う必要があります。この操作は、JS_Compile*を実行したら、他のJSAPIを呼ぶ前に即座に行わねばなりません。')}}
+ +

スクリプト文字列を引数として与えるのではなく、外部ファイルから読み込ませる場合には JS_CompileFile を代わりに用いてください。 To compile a script from an external file source rather than passing the actual script as an argument, use <code>JS_CompileFile</code> instead of <code>JS_CompileScript</code>.

+ +

利用例

+ +
/* Sample program - execute a script repeatedly until an error occurs. */
+JSScript *script;
+JSObject *srcobj;
+
+script = JS_CompileFile(cx, global, filename);
+if (script == NULL)
+    return JS_FALSE;
+
+scrobj = JS_NewScriptObject(cx, script);
+if (scrobj == NULL
+    || !JS_AddNamedRoot(cx, &scrobj, "scrobj"))
+    return JS_FALSE;
+
+for (;;) {
+    jsval result;
+
+    if (!JS_ExecuteScript(cx, global, script, &result))
+        break;
+    JS_GC(cx);
+}
+
+JS_RemoveRoot(cx, &scrobj);
+
+ +

関連項目

+ + -- cgit v1.2.3-54-g00ecf