175 lines
6 KiB
C
175 lines
6 KiB
C
/* Generated by Nim Compiler v1.9.0 */
|
|
#define NIM_INTBITS 32
|
|
|
|
#include "nimbase.h"
|
|
#include <string.h>
|
|
#undef LANGUAGE_C
|
|
#undef MIPSEB
|
|
#undef MIPSEL
|
|
#undef PPC
|
|
#undef R3000
|
|
#undef R4000
|
|
#undef i386
|
|
#undef linux
|
|
#undef mips
|
|
#undef near
|
|
#undef far
|
|
#undef powerpc
|
|
#undef unix
|
|
#define nimfr_(x, y)
|
|
#define nimln_(x, y)
|
|
typedef struct NimStrPayload NimStrPayload;
|
|
typedef struct NimStringV2 NimStringV2;
|
|
struct NimStrPayload {
|
|
NI cap;
|
|
NIM_CHAR data[SEQ_DECL_SIZE];
|
|
};
|
|
struct NimStringV2 {
|
|
NI len;
|
|
NimStrPayload* p;
|
|
};
|
|
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_224)(NimStringV2 msg);
|
|
N_LIB_PRIVATE N_NIMCALL(void, openDefaultBrowserImpl__pureZbrowsers_9)(NimStringV2 url);
|
|
N_LIB_PRIVATE N_NIMCALL(NI, nosexecShellCmd)(NimStringV2 command);
|
|
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src);
|
|
static N_INLINE(void, copyMem__system_1719)(void* dest, void* source, NI size);
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nospquoteShell)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, prepare__pureZbrowsers_6)(NimStringV2 s);
|
|
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, contains__pureZstrutils_1816)(NimStringV2 s, NimStringV2 sub);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___stdZassertions_16)(NimStringV2* dest, NimStringV2 src);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, absolutePath__stdZprivateZospaths50_343)(NimStringV2 path, NimStringV2 root);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosgetCurrentDir)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, rawNewString)(NI space);
|
|
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___stdZassertions_13)(NimStringV2* dest);
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[62+1];
|
|
} TM__CZNeKGdQ8AWxD1HSDIq5DQ_2 = { 62 | NIM_STRLIT_FLAG, "browsers.nim(75, 3) `url.len > 0` URL must not be empty string" };
|
|
static const NimStringV2 TM__CZNeKGdQ8AWxD1HSDIq5DQ_3 = {62, (NimStrPayload*)&TM__CZNeKGdQ8AWxD1HSDIq5DQ_2};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[5+1];
|
|
} TM__CZNeKGdQ8AWxD1HSDIq5DQ_4 = { 5 | NIM_STRLIT_FLAG, "open " };
|
|
static const NimStringV2 TM__CZNeKGdQ8AWxD1HSDIq5DQ_5 = {5, (NimStrPayload*)&TM__CZNeKGdQ8AWxD1HSDIq5DQ_4};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[3+1];
|
|
} TM__CZNeKGdQ8AWxD1HSDIq5DQ_6 = { 3 | NIM_STRLIT_FLAG, "://" };
|
|
static const NimStringV2 TM__CZNeKGdQ8AWxD1HSDIq5DQ_7 = {3, (NimStrPayload*)&TM__CZNeKGdQ8AWxD1HSDIq5DQ_6};
|
|
static const struct {
|
|
NI cap; NIM_CHAR data[7+1];
|
|
} TM__CZNeKGdQ8AWxD1HSDIq5DQ_8 = { 7 | NIM_STRLIT_FLAG, "file://" };
|
|
static const NimStringV2 TM__CZNeKGdQ8AWxD1HSDIq5DQ_9 = {7, (NimStrPayload*)&TM__CZNeKGdQ8AWxD1HSDIq5DQ_8};
|
|
extern NIM_BOOL nimInErrorMode__system_3980;
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
|
|
void* T1_;
|
|
T1_ = (void*)0;
|
|
T1_ = memcpy(dest, source, ((size_t) (size)));
|
|
}
|
|
static N_INLINE(void, copyMem__system_1719)(void* dest, void* source, NI size) {
|
|
nimCopyMem(dest, source, size);
|
|
}
|
|
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src) {
|
|
{
|
|
if (!(((NI)0) < src.len)) goto LA3_;
|
|
copyMem__system_1719(((void*) ((&(*(*dest).p).data[(*dest).len]))), ((void*) ((&(*src.p).data[((NI)0)]))), ((NI) ((NI)(src.len + ((NI)1)))));
|
|
(*dest).len += src.len;
|
|
}
|
|
LA3_: ;
|
|
}
|
|
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
|
|
NIM_BOOL* result;
|
|
result = (NIM_BOOL*)0;
|
|
result = (&nimInErrorMode__system_3980);
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(NimStringV2, prepare__pureZbrowsers_6)(NimStringV2 s) {
|
|
NimStringV2 result;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
result.len = 0; result.p = NIM_NIL;
|
|
{
|
|
NIM_BOOL T3_;
|
|
T3_ = (NIM_BOOL)0;
|
|
T3_ = contains__pureZstrutils_1816(s, TM__CZNeKGdQ8AWxD1HSDIq5DQ_7);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
if (!T3_) goto LA4_;
|
|
eqcopy___stdZassertions_16((&result), s);
|
|
}
|
|
goto LA1_;
|
|
LA4_: ;
|
|
{
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 colontmpD__2;
|
|
NimStringV2 T8_;
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
|
|
T8_.len = 0; T8_.p = NIM_NIL;
|
|
colontmpD_ = nosgetCurrentDir();
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA7_;
|
|
colontmpD__2 = absolutePath__stdZprivateZospaths50_343(s, colontmpD_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA7_;
|
|
T8_ = rawNewString(colontmpD__2.len + 7);
|
|
appendString((&T8_), TM__CZNeKGdQ8AWxD1HSDIq5DQ_9);
|
|
appendString((&T8_), colontmpD__2);
|
|
result = T8_;
|
|
{
|
|
LA7_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA1_: ;
|
|
}BeforeRet_: ;
|
|
return result;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, openDefaultBrowserImpl__pureZbrowsers_9)(NimStringV2 url) {
|
|
NimStringV2 colontmpD_;
|
|
NimStringV2 colontmpD__2;
|
|
NimStringV2 colontmpD__3;
|
|
NimStringV2 T2_;
|
|
NI T3_;
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
|
|
colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
|
|
colontmpD__3.len = 0; colontmpD__3.p = NIM_NIL;
|
|
T2_.len = 0; T2_.p = NIM_NIL;
|
|
colontmpD_ = prepare__pureZbrowsers_6(url);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
colontmpD__2 = nospquoteShell(colontmpD_);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
T2_ = rawNewString(colontmpD__2.len + 5);
|
|
appendString((&T2_), TM__CZNeKGdQ8AWxD1HSDIq5DQ_5);
|
|
appendString((&T2_), colontmpD__2);
|
|
colontmpD__3 = T2_;
|
|
T3_ = (NI)0;
|
|
T3_ = nosexecShellCmd(colontmpD__3);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
|
|
(void)(T3_);
|
|
{
|
|
LA1_:;
|
|
}
|
|
{
|
|
eqdestroy___stdZassertions_13((&colontmpD__3));
|
|
eqdestroy___stdZassertions_13((&colontmpD__2));
|
|
eqdestroy___stdZassertions_13((&colontmpD_));
|
|
}
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|
|
N_LIB_PRIVATE N_NIMCALL(void, openDefaultBrowser__pureZbrowsers_11)(NimStringV2 url) {
|
|
NIM_BOOL* nimErr_;
|
|
{nimErr_ = nimErrorFlag();
|
|
{
|
|
if (!!((((NI)0) < url.len))) goto LA3_;
|
|
failedAssertImpl__stdZassertions_224(TM__CZNeKGdQ8AWxD1HSDIq5DQ_3);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
openDefaultBrowserImpl__pureZbrowsers_9(url);
|
|
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
|
|
}BeforeRet_: ;
|
|
}
|