Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iteration23 #656

Merged
merged 29 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a0dc2f0
house keeping
arakov May 7, 2024
26277ad
housekeeping
arakov May 7, 2024
3177f40
housekeeping
arakov May 8, 2024
2de1b23
working on gtk ide
May 8, 2024
b3d74ac
ide : implementing simple app for linux
May 8, 2024
6cc4463
housekeeping
arakov May 8, 2024
a91af9e
Merge branch 'iteration23' of https://github.com/ELENA-LANG/elena-lan…
arakov May 8, 2024
81581a4
[ADDED] optimized ternary expressions
arakov May 9, 2024
9cf375c
[FIXED] declaring a field with a type of template based array
arakov May 11, 2024
da57ff3
housekeeping
arakov May 12, 2024
cd4ef8b
[ADDED] #89 : new functionality - MemoryStream, BitArray, SortedList,…
arakov May 12, 2024
3f631a9
fixing elt64-cli
arakov May 13, 2024
6f0a506
[ADDED] #95 : LiteralBuffer, WideBuffer
arakov May 13, 2024
cb21f08
working on ide
arakov May 13, 2024
ccec7ca
gtk ide : adding edit frame
arakov May 13, 2024
57f689b
working on ide for linux
May 13, 2024
6cb34c0
refactoring
arakov May 13, 2024
4b5e23d
ide linux : displaying tab
May 13, 2024
1733cc3
working on ide
May 13, 2024
9418fc9
fixing ide controller
arakov May 13, 2024
dcf0c6f
housekeeping
arakov May 14, 2024
c1f94af
#590 : elenavm : dynamic class inheritance - allocate in perm, copy v…
arakov May 15, 2024
b17017c
#590 : support output type list
arakov May 17, 2024
3c8427b
#590 : recognizing dispatch proxy
arakov May 21, 2024
3bbfd45
#590 : supporting weak interface flag
arakov May 22, 2024
ab43b0c
housekeeping
arakov May 22, 2024
fff368e
#590 : supporting dynamic interface implementation
arakov May 23, 2024
4895cd5
#609 : implementing dynamic interface implementation
arakov May 23, 2024
b0147a6
housekeeping
arakov May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
working on ide
  • Loading branch information
Alex authored and Alex committed May 13, 2024
commit 1733cc38c2224aee9e673b91ba6b25e8f1344860
133 changes: 133 additions & 0 deletions elenasrc3/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,137 @@ namespace elena_lang

#define DEFAULT_STR (elena_lang::ustr_t)nullptr

namespace elena_lang
{
// --- WideMessage ---
class WideMessage : public String<wide_c, MESSAGE_LEN>
{
public:
wstr_t operator*() const { return wstr_t(_string); }

void appendUstr(const char* s)
{
size_t len = length();

size_t subLen = MESSAGE_LEN - length();
StrConvertor::copy(_string + len, s, getlength(s), subLen);
_string[len + subLen] = 0;
}

WideMessage()
{
_string[0] = 0;
}
WideMessage(const char* s)
{
size_t len = MESSAGE_LEN;
StrConvertor::copy(_string, s, getlength(s), len);
_string[len] = 0;
}
WideMessage(const char* s1, const char* s2)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);

_string[len + len2] = 0;
}
WideMessage(const char* s1, const char* s2, const char* s3)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
size_t len3 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);
StrConvertor::copy(_string + len + len2, s3, getlength(s3), len3);

_string[len + len2 + len3] = 0;
}
WideMessage(const char* s1, const char* s2, const char* s3, const char* s4)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
size_t len3 = MESSAGE_LEN;
size_t len4 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);
StrConvertor::copy(_string + len + len2, s3, getlength(s3), len3);
StrConvertor::copy(_string + len + len2 + len3, s4, getlength(s4), len4);

_string[len + len2 + len3 + len4] = 0;
}
WideMessage(const wide_c* s)
{
copy(s);
}
WideMessage(const wide_c* s1, const wide_c* s2)
{
copy(s1);
append(s2);
}
};

// --- IdentifierString ---
class IdentifierString : public String<char, IDENTIFIER_LEN>
{
public:
ustr_t operator*() const { return ustr_t(_string); }

bool compare(ustr_t s)
{
return s.compare(_string);
}

bool compare(ustr_t s, size_t index, size_t length)
{
return ustr_t(_string + index).compare(s, length);
}

ref_t toRef(int radix = 10) const
{
return StrConvertor::toUInt(_string, radix);
}

IdentifierString() = default;

IdentifierString(ustr_t s)
: String(s)
{

}
IdentifierString(ustr_t s, size_t length)
: String(s, length)
{
}
IdentifierString(ustr_t s1, ustr_t s2)
: String(s1)
{
append(s2);
}

IdentifierString(ustr_t s1, ustr_t s2, ustr_t s3)
: String(s1)
{
append(s2);
append(s3);
}

IdentifierString(ustr_t s1, ustr_t s2, ustr_t s3, ustr_t s4)
: String(s1)
{
append(s2);
append(s3);
append(s4);
}

IdentifierString(wstr_t s)
{
size_t len = IDENTIFIER_LEN;
StrConvertor::copy(_string, s, getlength(s), len);
_string[len] = 0;
}
};
}

#endif // COMMON_H
153 changes: 11 additions & 142 deletions elenasrc3/engine/elena.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ namespace elena_lang

virtual SectionInfo getCoreSection(ref_t reference, bool silentMode) = 0;
virtual SectionInfo getSection(ReferenceInfo referenceInfo, ref_t mask, ref_t metaMask, bool silentMode) = 0;
virtual ClassSectionInfo getClassSections(ReferenceInfo referenceInfo, ref_t vmtMask, ref_t codeMask,
virtual ClassSectionInfo getClassSections(ReferenceInfo referenceInfo, ref_t vmtMask, ref_t codeMask,
bool silentMode) = 0;

virtual ModuleInfo getModule(ReferenceInfo referenceInfo, bool silentMode) = 0;
Expand Down Expand Up @@ -436,7 +436,7 @@ namespace elena_lang

virtual addr_t calculateVAddress(MemoryWriter& writer, ref_t addressMask) = 0;

virtual void writeSectionReference(MemoryBase* image, pos_t imageOffset, ref_t reference,
virtual void writeSectionReference(MemoryBase* image, pos_t imageOffset, ref_t reference,
SectionInfo* sectionInfo, pos_t sectionOffset, ref_t addressMask) = 0;

virtual void writeReference(MemoryBase& target, pos_t position, ref_t reference, pos_t disp,
Expand All @@ -461,7 +461,7 @@ namespace elena_lang

virtual void writeMDataRef32(MemoryBase& target, pos_t position,
pos_t disp, ref_t addressMask) = 0;
virtual void writeMDataRef64(MemoryBase& target, pos_t position,
virtual void writeMDataRef64(MemoryBase& target, pos_t position,
pos64_t disp, ref_t addressMask) = 0;

virtual mssg_t importMessage(mssg_t message, ModuleBase* module = nullptr) = 0;
Expand Down Expand Up @@ -519,8 +519,8 @@ namespace elena_lang
{
public:
virtual void prepare(
LibraryLoaderBase* loader,
ImageProviderBase* imageProvider,
LibraryLoaderBase* loader,
ImageProviderBase* imageProvider,
ReferenceHelperBase* helper,
LabelHelperBase* lh,
JITSettings settings,
Expand All @@ -532,9 +532,9 @@ namespace elena_lang

virtual void alignCode(MemoryWriter& writer, pos_t alignment, bool isText) = 0;

virtual void compileProcedure(ReferenceHelperBase* helper, MemoryReader& bcReader,
virtual void compileProcedure(ReferenceHelperBase* helper, MemoryReader& bcReader,
MemoryWriter& codeWriter, LabelHelperBase* lh) = 0;
virtual void compileSymbol(ReferenceHelperBase* helper, MemoryReader& bcReader,
virtual void compileSymbol(ReferenceHelperBase* helper, MemoryReader& bcReader,
MemoryWriter& codeWriter, LabelHelperBase* lh) = 0;

virtual void compileMetaList(ReferenceHelperBase* helper, MemoryReader& reader, MemoryWriter& writer, pos_t length) = 0;
Expand All @@ -547,11 +547,11 @@ namespace elena_lang

virtual void allocateVMT(MemoryWriter& vmtWriter, pos_t flags, pos_t vmtLength, pos_t staticLength) = 0;
virtual void addVMTEntry(mssg_t message, addr_t codeAddress, void* targetVMT, pos_t& entryCount) = 0;
virtual void updateVMTHeader(MemoryWriter& vmtWriter, addr_t parentAddress, addr_t classClassAddress,
virtual void updateVMTHeader(MemoryWriter& vmtWriter, addr_t parentAddress, addr_t classClassAddress,
ref_t flags, pos_t count, FieldAddressMap& staticValues, bool virtualMode) = 0;
virtual pos_t copyParentVMT(void* parentVMT, void* targetVMT) = 0;

virtual void allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length,
virtual void allocateHeader(MemoryWriter& writer, addr_t vmtAddress, int length,
bool structMode, bool virtualMode) = 0;
virtual void allocateBody(MemoryWriter& writer, int size) = 0;
virtual void writeInt32(MemoryWriter& writer, unsigned int value) = 0;
Expand All @@ -570,7 +570,7 @@ namespace elena_lang
virtual void addBreakpoint(MemoryWriter& writer, addr_t vaddress, bool virtualMode) = 0;

virtual pos_t addSignatureEntry(MemoryWriter& writer, addr_t vmtAddress, ref_t& targetMask, bool virtualMode) = 0;
virtual pos_t addActionEntry(MemoryWriter& messageWriter, MemoryWriter& messageBodyWriter,
virtual pos_t addActionEntry(MemoryWriter& messageWriter, MemoryWriter& messageBodyWriter,
ustr_t actionName, ref_t weakActionRef, ref_t signature, bool virtualMode) = 0;
virtual void addActionEntryStopper(MemoryWriter& messageWriter) = 0;
virtual void addSignatureStopper(MemoryWriter& messageWriter) = 0;
Expand Down Expand Up @@ -654,137 +654,6 @@ namespace elena_lang
virtual ~PresenterBase() = default;
};

// --- WideMessage ---
class WideMessage : public String<wide_c, MESSAGE_LEN>
{
public:
wstr_t operator*() const { return wstr_t(_string); }

void appendUstr(const char* s)
{
size_t len = length();

size_t subLen = MESSAGE_LEN - length();
StrConvertor::copy(_string + len, s, getlength(s), subLen);
_string[len + subLen] = 0;
}

WideMessage()
{
_string[0] = 0;
}
WideMessage(const char* s)
{
size_t len = MESSAGE_LEN;
StrConvertor::copy(_string, s, getlength(s), len);
_string[len] = 0;
}
WideMessage(const char* s1, const char* s2)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);

_string[len + len2] = 0;
}
WideMessage(const char* s1, const char* s2, const char* s3)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
size_t len3 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);
StrConvertor::copy(_string + len + len2, s3, getlength(s3), len3);

_string[len + len2 + len3] = 0;
}
WideMessage(const char* s1, const char* s2, const char* s3, const char* s4)
{
size_t len = MESSAGE_LEN;
size_t len2 = MESSAGE_LEN;
size_t len3 = MESSAGE_LEN;
size_t len4 = MESSAGE_LEN;
StrConvertor::copy(_string, s1, getlength(s1), len);
StrConvertor::copy(_string + len, s2, getlength(s2), len2);
StrConvertor::copy(_string + len + len2, s3, getlength(s3), len3);
StrConvertor::copy(_string + len + len2 + len3, s4, getlength(s4), len4);

_string[len + len2 + len3 + len4] = 0;
}
WideMessage(const wide_c* s)
{
copy(s);
}
WideMessage(const wide_c* s1, const wide_c* s2)
{
copy(s1);
append(s2);
}
};


// --- IdentifierString ---
class IdentifierString : public String<char, IDENTIFIER_LEN>
{
public:
ustr_t operator*() const { return ustr_t(_string); }

bool compare(ustr_t s)
{
return s.compare(_string);
}

bool compare(ustr_t s, size_t index, size_t length)
{
return ustr_t(_string + index).compare(s, length);
}

ref_t toRef(int radix = 10) const
{
return StrConvertor::toUInt(_string, radix);
}

IdentifierString() = default;

IdentifierString(ustr_t s)
: String(s)
{

}
IdentifierString(ustr_t s, size_t length)
: String(s, length)
{
}
IdentifierString(ustr_t s1, ustr_t s2)
: String(s1)
{
append(s2);
}

IdentifierString(ustr_t s1, ustr_t s2, ustr_t s3)
: String(s1)
{
append(s2);
append(s3);
}

IdentifierString(ustr_t s1, ustr_t s2, ustr_t s3, ustr_t s4)
: String(s1)
{
append(s2);
append(s3);
append(s4);
}

IdentifierString(wstr_t s)
{
size_t len = IDENTIFIER_LEN;
StrConvertor::copy(_string, s, getlength(s), len);
_string[len] = 0;
}
};

// --- QuoteString ---
class QuoteString : public String<char, LINE_LEN>
{
Expand Down Expand Up @@ -817,7 +686,7 @@ namespace elena_lang
else append(s[i]);
break;
case 2:
if ((s[i] < '0' || s[i] > '9') && (s[i] < 'A' || s[i] > 'F') && (s[i] < 'a' || s[i] > 'f'))
if ((s[i] < '0' || s[i] > '9') && (s[i] < 'A' || s[i] > 'F') && (s[i] < 'a' || s[i] > 'f'))
{
String<char, 12> number(s + index, i - index);
unic_c ch = StrConvertor::toInt(number.str(), (s[i] == 'h') ? 16 : 10);
Expand Down
4 changes: 4 additions & 0 deletions elenasrc3/gui/guicommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace elena_lang
typedef const wide_c* const_text_t;
typedef wstr_t text_str;

typedef WideString TextString;

#elif __GNUG__

#ifndef _T
Expand All @@ -31,6 +33,8 @@ namespace elena_lang
typedef const char* const_text_t;
typedef ustr_t text_str;

typedef IdentifierString TextString;

#endif

// --- Point ---
Expand Down
2 changes: 2 additions & 0 deletions elenasrc3/ide/codeblocks/elide_gtk.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
<Unit filename="../gtklinux/main.cpp" />
<Unit filename="../idecommon.cpp" />
<Unit filename="../idecommon.h" />
<Unit filename="../idecontroller.cpp" />
<Unit filename="../idecontroller.h" />
<Extensions />
</Project>
</CodeBlocks_project_file>
Loading