mirror of
https://github.com/janet-lang/janet
synced 2025-05-05 08:54:15 +00:00
Fix indentation, converting some tabs to spaces.
This commit is contained in:
parent
dbcbb4466d
commit
ef5f80ad38
@ -442,7 +442,7 @@ static JanetSlot janetc_tuple(JanetFopts opts, Janet x) {
|
|||||||
JanetCompiler *c = opts.compiler;
|
JanetCompiler *c = opts.compiler;
|
||||||
const Janet *t = janet_unwrap_tuple(x);
|
const Janet *t = janet_unwrap_tuple(x);
|
||||||
return janetc_maker(opts,
|
return janetc_maker(opts,
|
||||||
janetc_toslots(c, t, janet_tuple_length(t)),
|
janetc_toslots(c, t, janet_tuple_length(t)),
|
||||||
JOP_MAKE_TUPLE);
|
JOP_MAKE_TUPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void janet_description_b(JanetBuffer *buffer, Janet x) {
|
|||||||
{
|
{
|
||||||
const char *n = janet_abstract_type(janet_unwrap_abstract(x))->name;
|
const char *n = janet_abstract_type(janet_unwrap_abstract(x))->name;
|
||||||
string_description_b(buffer, n, janet_unwrap_abstract(x));
|
string_description_b(buffer, n, janet_unwrap_abstract(x));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case JANET_CFUNCTION:
|
case JANET_CFUNCTION:
|
||||||
{
|
{
|
||||||
@ -694,4 +694,3 @@ void janet_buffer_format(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,17 +219,17 @@ Janet janet_get(Janet ds, Janet key) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JANET_ABSTRACT:
|
case JANET_ABSTRACT:
|
||||||
{
|
{
|
||||||
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
||||||
if (type->get) {
|
if (type->get) {
|
||||||
value = (type->get)(janet_unwrap_abstract(ds),key);
|
value = (type->get)(janet_unwrap_abstract(ds),key);
|
||||||
} else {
|
} else {
|
||||||
janet_panicf("no getter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
janet_panicf("no getter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
||||||
value = janet_wrap_nil();
|
value = janet_wrap_nil();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -278,17 +278,17 @@ Janet janet_getindex(Janet ds, int32_t index) {
|
|||||||
case JANET_STRUCT:
|
case JANET_STRUCT:
|
||||||
value = janet_struct_get(janet_unwrap_struct(ds), janet_wrap_integer(index));
|
value = janet_struct_get(janet_unwrap_struct(ds), janet_wrap_integer(index));
|
||||||
break;
|
break;
|
||||||
case JANET_ABSTRACT:
|
case JANET_ABSTRACT:
|
||||||
{
|
{
|
||||||
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
||||||
if (type->get) {
|
if (type->get) {
|
||||||
value = (type->get)(janet_unwrap_abstract(ds),janet_wrap_integer(index));
|
value = (type->get)(janet_unwrap_abstract(ds),janet_wrap_integer(index));
|
||||||
} else {
|
} else {
|
||||||
janet_panicf("no getter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
janet_panicf("no getter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
||||||
value = janet_wrap_nil();
|
value = janet_wrap_nil();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -350,15 +350,15 @@ void janet_putindex(Janet ds, int32_t index, Janet value) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JANET_ABSTRACT:
|
case JANET_ABSTRACT:
|
||||||
{
|
{
|
||||||
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
||||||
if (type->put) {
|
if (type->put) {
|
||||||
(type->put)(janet_unwrap_abstract(ds),janet_wrap_integer(index),value);
|
(type->put)(janet_unwrap_abstract(ds),janet_wrap_integer(index),value);
|
||||||
} else {
|
} else {
|
||||||
janet_panicf("no setter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
janet_panicf("no setter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,15 +400,14 @@ void janet_put(Janet ds, Janet key, Janet value) {
|
|||||||
janet_table_put(janet_unwrap_table(ds), key, value);
|
janet_table_put(janet_unwrap_table(ds), key, value);
|
||||||
break;
|
break;
|
||||||
case JANET_ABSTRACT:
|
case JANET_ABSTRACT:
|
||||||
{
|
{
|
||||||
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
JanetAbstractType *type = (JanetAbstractType *)janet_abstract_type(janet_unwrap_abstract(ds));
|
||||||
if (type->put) {
|
if (type->put) {
|
||||||
(type->put)(janet_unwrap_abstract(ds),key,value);
|
(type->put)(janet_unwrap_abstract(ds),key,value);
|
||||||
} else {
|
} else {
|
||||||
janet_panicf("no setter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
janet_panicf("no setter for %T ", JANET_TFLAG_LENGTHABLE, ds);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ static Janet call_nonfn(JanetFiber *fiber, Janet callee) {
|
|||||||
Janet ds, key;
|
Janet ds, key;
|
||||||
if (argn != 1) janet_panicf("%v called with arity %d, expected 1", callee, argn);
|
if (argn != 1) janet_panicf("%v called with arity %d, expected 1", callee, argn);
|
||||||
if (janet_checktypes(callee, JANET_TFLAG_INDEXED | JANET_TFLAG_DICTIONARY |
|
if (janet_checktypes(callee, JANET_TFLAG_INDEXED | JANET_TFLAG_DICTIONARY |
|
||||||
JANET_TFLAG_STRING | JANET_TFLAG_BUFFER | JANET_TFLAG_ABSTRACT)) {
|
JANET_TFLAG_STRING | JANET_TFLAG_BUFFER | JANET_TFLAG_ABSTRACT)) {
|
||||||
ds = callee;
|
ds = callee;
|
||||||
key = fiber->data[fiber->stackstart];
|
key = fiber->data[fiber->stackstart];
|
||||||
} else {
|
} else {
|
||||||
|
@ -67,7 +67,7 @@ extern "C" {
|
|||||||
/* Check 64-bit vs 32-bit */
|
/* Check 64-bit vs 32-bit */
|
||||||
#if ((defined(__x86_64__) || defined(_M_X64)) \
|
#if ((defined(__x86_64__) || defined(_M_X64)) \
|
||||||
&& (defined(JANET_UNIX) || defined(JANET_WINDOWS))) \
|
&& (defined(JANET_UNIX) || defined(JANET_WINDOWS))) \
|
||||||
|| (defined(_WIN64)) /* Windows 64 bit */ \
|
|| (defined(_WIN64)) /* Windows 64 bit */ \
|
||||||
|| (defined(__ia64__) && defined(__LP64__)) /* Itanium in LP64 mode */ \
|
|| (defined(__ia64__) && defined(__LP64__)) /* Itanium in LP64 mode */ \
|
||||||
|| defined(__alpha__) /* DEC Alpha */ \
|
|| defined(__alpha__) /* DEC Alpha */ \
|
||||||
|| (defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)) /* BE */ \
|
|| (defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)) /* BE */ \
|
||||||
|
@ -8,331 +8,331 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>fileTypes</key>
|
<key>fileTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>janet</string>
|
<string>janet</string>
|
||||||
</array>
|
</array>
|
||||||
<key>foldingStartMarker</key>
|
<key>foldingStartMarker</key>
|
||||||
<string>\{</string>
|
<string>\{</string>
|
||||||
<key>foldingStopMarker</key>
|
<key>foldingStopMarker</key>
|
||||||
<string>\}</string>
|
<string>\}</string>
|
||||||
<key>foldingStartMarker</key>
|
<key>foldingStartMarker</key>
|
||||||
<string>\[</string>
|
<string>\[</string>
|
||||||
<key>foldingStopMarker</key>
|
<key>foldingStopMarker</key>
|
||||||
<string>\]</string>
|
<string>\]</string>
|
||||||
<key>foldingStartMarker</key>
|
<key>foldingStartMarker</key>
|
||||||
<string>\(</string>
|
<string>\(</string>
|
||||||
<key>foldingStopMarker</key>
|
<key>foldingStopMarker</key>
|
||||||
<string>\)</string>
|
<string>\)</string>
|
||||||
<key>keyEquivalent</key>
|
<key>keyEquivalent</key>
|
||||||
<string>^~L</string>
|
<string>^~L</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>Janet</string>
|
<string>Janet</string>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#all</string>
|
<string>#all</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>repository</key>
|
<key>repository</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>all</key>
|
<key>all</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#comment</string>
|
<string>#comment</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#parens</string>
|
<string>#parens</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#brackets</string>
|
<string>#brackets</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#braces</string>
|
<string>#braces</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#readermac</string>
|
<string>#readermac</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#string</string>
|
<string>#string</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#longstring</string>
|
<string>#longstring</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#literal</string>
|
<string>#literal</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#corelib</string>
|
<string>#corelib</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#r-number</string>
|
<string>#r-number</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#dec-number</string>
|
<string>#dec-number</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#hex-number</string>
|
<string>#hex-number</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#keysym</string>
|
<string>#keysym</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#symbol</string>
|
<string>#symbol</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>comment</key>
|
<key>comment</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.comment.janet</string>
|
<string>punctuation.definition.comment.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(#).*$</string>
|
<string>(#).*$</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>comment.line.janet</string>
|
<string>comment.line.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>braces</key>
|
<key>braces</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>begin</key>
|
<key>begin</key>
|
||||||
<string>(@?{)</string>
|
<string>(@?{)</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.braces.begin.janet</string>
|
<string>punctuation.definition.braces.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>end</key>
|
<key>end</key>
|
||||||
<string>(})</string>
|
<string>(})</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.braces.end.janet</string>
|
<string>punctuation.definition.braces.end.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#all</string>
|
<string>#all</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>brackets</key>
|
<key>brackets</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>begin</key>
|
<key>begin</key>
|
||||||
<string>(@?\[)</string>
|
<string>(@?\[)</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.brackets.begin.janet</string>
|
<string>punctuation.definition.brackets.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>end</key>
|
<key>end</key>
|
||||||
<string>(\])</string>
|
<string>(\])</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.brackets.end.janet</string>
|
<string>punctuation.definition.brackets.end.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#all</string>
|
<string>#all</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>parens</key>
|
<key>parens</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>begin</key>
|
<key>begin</key>
|
||||||
<string>(@?\()</string>
|
<string>(@?\()</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.parens.begin.janet</string>
|
<string>punctuation.definition.parens.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>end</key>
|
<key>end</key>
|
||||||
<string>(\))</string>
|
<string>(\))</string>
|
||||||
<key>captures</key>
|
<key>captures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.parens.end.janet</string>
|
<string>punctuation.definition.parens.end.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>include</key>
|
<key>include</key>
|
||||||
<string>#all</string>
|
<string>#all</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>readermac</key>
|
<key>readermac</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>[\'\~\;\,]</string>
|
<string>[\'\~\;\,]</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.other.janet</string>
|
<string>punctuation.other.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<!-- string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*]) token match here (?![\.:\w_\-=!@\$%^&?|\\/<>*])</string -->
|
<!-- string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*]) token match here (?![\.:\w_\-=!@\$%^&?|\\/<>*])</string -->
|
||||||
<key>literal</key>
|
<key>literal</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])(true|false|nil)(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])(true|false|nil)(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.language.janet</string>
|
<string>constant.language.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>corelib</key>
|
<key>corelib</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])(%ALLSYMBOLS%)(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])(%ALLSYMBOLS%)(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>keyword.control.janet</string>
|
<string>keyword.control.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>keysym</key>
|
<key>keysym</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*]):[\.:\w_\-=!@\$%^&?|\\/<>*]*</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*]):[\.:\w_\-=!@\$%^&?|\\/<>*]*</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.keyword.janet</string>
|
<string>constant.keyword.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>symbol</key>
|
<key>symbol</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[\.a-zA-Z_\-=!@\$%^&?|\\/<>*][\.:\w_\-=!@\$%^&?|\\/<>*]*</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[\.a-zA-Z_\-=!@\$%^&?|\\/<>*][\.:\w_\-=!@\$%^&?|\\/<>*]*</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>variable.other.janet</string>
|
<string>variable.other.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>hex-number</key>
|
<key>hex-number</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?0x([_\da-fA-F]+|[_\da-fA-F]+\.[_\da-fA-F]*|\.[_\da-fA-F]+)(&[+-]?[\da-fA-F]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?0x([_\da-fA-F]+|[_\da-fA-F]+\.[_\da-fA-F]*|\.[_\da-fA-F]+)(&[+-]?[\da-fA-F]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.numeric.hex.janet</string>
|
<string>constant.numeric.hex.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>dec-number</key>
|
<key>dec-number</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?([_\d]+|[_\d]+\.[_\d]*|\.[_\d]+)([eE&][+-]?[\d]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?([_\d]+|[_\d]+\.[_\d]*|\.[_\d]+)([eE&][+-]?[\d]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.numeric.decimal.janet</string>
|
<string>constant.numeric.decimal.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>r-number</key>
|
<key>r-number</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?\d\d?r([_\w]+|[_\w]+\.[_\w]*|\.[_\w]+)(&[+-]?[\w]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
<string>(?<![\.:\w_\-=!@\$%^&?|\\/<>*])[-+]?\d\d?r([_\w]+|[_\w]+\.[_\w]*|\.[_\w]+)(&[+-]?[\w]+)?(?![\.:\w_\-=!@\$%^&?|\\/<>*])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.numeric.decimal.janet</string>
|
<string>constant.numeric.decimal.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>string</key>
|
<key>string</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>begin</key>
|
<key>begin</key>
|
||||||
<string>(@?")</string>
|
<string>(@?")</string>
|
||||||
<key>beginCaptures</key>
|
<key>beginCaptures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.string.begin.janet</string>
|
<string>punctuation.definition.string.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>end</key>
|
<key>end</key>
|
||||||
<string>(")</string>
|
<string>(")</string>
|
||||||
<key>endCaptures</key>
|
<key>endCaptures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.string.end.janet</string>
|
<string>punctuation.definition.string.end.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>string.quoted.double.janet</string>
|
<string>string.quoted.double.janet</string>
|
||||||
<key>patterns</key>
|
<key>patterns</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(\\[ne0zft"\\']|\\x[0-9a-fA-F][0-9a-fA-f])</string>
|
<string>(\\[ne0zft"\\']|\\x[0-9a-fA-F][0-9a-fA-f])</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.character.escape.janet</string>
|
<string>constant.character.escape.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<key>longstring</key>
|
<key>longstring</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>begin</key>
|
<key>begin</key>
|
||||||
<string>(@?)(`+)</string>
|
<string>(@?)(`+)</string>
|
||||||
<key>beginCaptures</key>
|
<key>beginCaptures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.string.begin.janet</string>
|
<string>punctuation.definition.string.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>2</key>
|
<key>2</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.string.begin.janet</string>
|
<string>punctuation.definition.string.begin.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>end</key>
|
<key>end</key>
|
||||||
<string>\2</string>
|
<string>\2</string>
|
||||||
<key>endCaptures</key>
|
<key>endCaptures</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1</key>
|
<key>1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>punctuation.definition.string.end.janet</string>
|
<string>punctuation.definition.string.end.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>string.quoted.triple.janet</string>
|
<string>string.quoted.triple.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>nomatch</key>
|
<key>nomatch</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>\S+</string>
|
<string>\S+</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>invalid.illegal.janet</string>
|
<string>invalid.illegal.janet</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>scopeName</key>
|
<key>scopeName</key>
|
||||||
<string>source.janet</string>
|
<string>source.janet</string>
|
||||||
<key>uuid</key>
|
<key>uuid</key>
|
||||||
|
108
tools/xxd.c
108
tools/xxd.c
@ -33,72 +33,72 @@
|
|||||||
|
|
||||||
int main(int argc, const char **argv) {
|
int main(int argc, const char **argv) {
|
||||||
|
|
||||||
static const char hex[] = "0123456789ABCDEF";
|
static const char hex[] = "0123456789ABCDEF";
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
int32_t totalRead = 0;
|
int32_t totalRead = 0;
|
||||||
int lineIndex = 0;
|
int lineIndex = 0;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4) {
|
||||||
fprintf(stderr, "Usage: %s infile outfile symbol\n", argv[0]);
|
fprintf(stderr, "Usage: %s infile outfile symbol\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the files */
|
/* Open the files */
|
||||||
FILE *in = fopen(argv[1], "rb");
|
FILE *in = fopen(argv[1], "rb");
|
||||||
FILE *out = fopen(argv[2], "wb");
|
FILE *out = fopen(argv[2], "wb");
|
||||||
|
|
||||||
/* Check if files open successfully */
|
/* Check if files open successfully */
|
||||||
if (in == NULL) {
|
if (in == NULL) {
|
||||||
fprintf(stderr, "Could not open input file %s\n", argv[1]);
|
fprintf(stderr, "Could not open input file %s\n", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (out == NULL) {
|
} else if (out == NULL) {
|
||||||
fprintf(stderr, "Could not open output file %s\n", argv[2]);
|
fprintf(stderr, "Could not open output file %s\n", argv[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the header */
|
/* Write the header */
|
||||||
fprintf(out, "/* Auto generated - DO NOT EDIT */\n\n#include <stdint.h>\n\n");
|
fprintf(out, "/* Auto generated - DO NOT EDIT */\n\n#include <stdint.h>\n\n");
|
||||||
fprintf(out, "static const unsigned char bytes_%s[] = {", argv[3]);
|
fprintf(out, "static const unsigned char bytes_%s[] = {", argv[3]);
|
||||||
|
|
||||||
/* Read in chunks from buffer */
|
/* Read in chunks from buffer */
|
||||||
while ((bytesRead = fread(buf, 1, sizeof(buf), in)) > 0) {
|
while ((bytesRead = fread(buf, 1, sizeof(buf), in)) > 0) {
|
||||||
size_t i;
|
size_t i;
|
||||||
totalRead += bytesRead;
|
totalRead += bytesRead;
|
||||||
for (i = 0; i < bytesRead; ++i) {
|
for (i = 0; i < bytesRead; ++i) {
|
||||||
int byte = ((uint8_t *)buf) [i];
|
int byte = ((uint8_t *)buf) [i];
|
||||||
|
|
||||||
/* Write the byte */
|
/* Write the byte */
|
||||||
if (lineIndex++ == 0) {
|
if (lineIndex++ == 0) {
|
||||||
if (line++)
|
if (line++)
|
||||||
fputc(',', out);
|
fputc(',', out);
|
||||||
fputs("\n\t", out);
|
fputs("\n\t", out);
|
||||||
} else {
|
} else {
|
||||||
fputs(", ", out);
|
fputs(", ", out);
|
||||||
}
|
}
|
||||||
fputs("0x", out);
|
fputs("0x", out);
|
||||||
fputc(hex[byte >> 4], out);
|
fputc(hex[byte >> 4], out);
|
||||||
fputc(hex[byte & 0xF], out);
|
fputc(hex[byte & 0xF], out);
|
||||||
|
|
||||||
/* Make line index wrap */
|
/* Make line index wrap */
|
||||||
if (lineIndex >= PERLINE)
|
if (lineIndex >= PERLINE)
|
||||||
lineIndex = 0;
|
lineIndex = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the tail */
|
/* Write the tail */
|
||||||
fputs("\n};\n\n", out);
|
fputs("\n};\n\n", out);
|
||||||
|
|
||||||
fprintf(out, "const unsigned char *%s = bytes_%s;\n\n", argv[3], argv[3]);
|
fprintf(out, "const unsigned char *%s = bytes_%s;\n\n", argv[3], argv[3]);
|
||||||
|
|
||||||
/* Write chunk size */
|
/* Write chunk size */
|
||||||
fprintf(out, "int32_t %s_size = %d;\n", argv[3], totalRead);
|
fprintf(out, "int32_t %s_size = %d;\n", argv[3], totalRead);
|
||||||
|
|
||||||
/* Close the file handles */
|
/* Close the file handles */
|
||||||
fclose(in);
|
fclose(in);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user