Skip to content

Commit

Permalink
Iteration30 (#683)
Browse files Browse the repository at this point in the history
* #658 : creating dpa
* [FIXED] "__typeof self" expression inside the nested class / closure
* [REDUX] iterator method
* #496 : adding support the private fields
  • Loading branch information
arakov authored Aug 22, 2024
1 parent 1c7219f commit 53e24d1
Show file tree
Hide file tree
Showing 67 changed files with 1,386 additions and 583 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

BUILD_TAG: 6.2.3
BUILD_TAG: 6.3.0

permissions:
contents: read
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- [ADDED] method reference - &myMethod
- [FIXED] single dispatcher : if an argument is nillable, it can accept nil value
- [ADDED] String interpolation
- [REDUX] iterator method
- [ADDED] #496 : private fields

- ELC
- [FIXED] private constructor must be called directly
Expand All @@ -18,6 +20,7 @@
- [FIXED] only public classes can be loaded in run-time
- [ADDED] #637 : bt optimization 4 unit test
- [FIXED] var attribute is allowed to be in the method argument list
- [FIXED] "__typeof self" expression inside the nested class / closure

- VM
- [FIXED] GC_ALLOC routine for vm mode
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.2
6.3.0
1 change: 1 addition & 0 deletions bin/templates/lib60.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
<forward key="$lazy">system'BaseLazyExpression</forward>
<forward key="$nullable">system'Nullable#1</forward>
<forward key="$ptr">system'UnsafePointer</forward>
<forward key="$yieldit">system'YieldStateEnumerator</forward>
</forwards>
</configuration>
1 change: 1 addition & 0 deletions bin/templates/lib60.config
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
<forward key="$ptr">system'UnsafePointer</forward>
<forward key="$preloaded">meta$preloadedSymbols</forward>
<forward key="$entry">meta$preloadedSymbols</forward>
<forward key="$yieldit">system'YieldStateEnumerator</forward>
</forwards>
</configuration>
2 changes: 1 addition & 1 deletion build/aarch64/build_package_arm64.script
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
RELEASE=elena-6.2.3.aarch64-linux
RELEASE=elena-6.3.0.aarch64-linux

mkdir -p /usr/share/elena
mkdir -p /etc/elena/
Expand Down
2 changes: 1 addition & 1 deletion build/aarch64/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: elena-lang
Version: 6.2.3
Version: 6.3.0
Architecture: aarch64
Maintainer: Alex Rakov <[email protected]>
Depends: libc6 (>= 2.1)
Expand Down
2 changes: 1 addition & 1 deletion build/amd64/build_package_amd64.script
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
RELEASE=elena-6.2.3.amd64-linux
RELEASE=elena-6.3.0.amd64-linux

mkdir -p /usr/share/elena
mkdir -p /etc/elena/
Expand Down
2 changes: 1 addition & 1 deletion build/amd64/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: elena-lang
Version: 6.2.3
Version: 6.3.0
Architecture: amd64
Maintainer: Alex Rakov <[email protected]>
Depends: libc6 (>= 2.1)
Expand Down
2 changes: 2 additions & 0 deletions build/create_package_x64.bat
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ copy %~dp0\..\bin\scripts\*.es %~dp0\x64\bin\scripts\
copy %~dp0\..\doc\license %~dp0\x64\doc\
copy %~dp0\..\doc\contributors %~dp0\x64\doc\
copy %~dp0\..\readme.md %~dp0\x64\
copy %~dp0\..\CHANGELOG.md %~dp0\x64\
copy %~dp0\..\VERSION %~dp0\x64\

md %~dp0\x64\src60\system
xcopy %~dp0\..\src60\system\*.l %~dp0\x64\src60\system /s
Expand Down
4 changes: 2 additions & 2 deletions build/elena_inno.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3CAA69D3-0F98-44B1-A73E-E864BA51D5BD}
AppName=ELENA Programming Language
AppVersion=6.2.3
AppVersion=6.3.0
;AppVerName=ELENA Programming Language 6.2.0
AppPublisher=Alexey Rakov
AppPublisherURL=http://github.com/ELENA-LANG/elena-lang
Expand All @@ -18,7 +18,7 @@ DefaultGroupName=ELENA Programming Language
AllowNoIcons=yes
LicenseFile=..\doc\license
InfoAfterFile=..\CHANGELOG.md
OutputBaseFilename=elena-lang-6.2.0.x86-setup
OutputBaseFilename=elena-lang-6.3.0.x86-win-setup
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes
Expand Down
2 changes: 1 addition & 1 deletion build/i386/build_package_i386.script
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
RELEASE=elena-6.2.3.i386-linux
RELEASE=elena-6.3.0.i386-linux

mkdir -p /usr/share/elena
mkdir -p /etc/elena/
Expand Down
2 changes: 1 addition & 1 deletion build/i386/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: elena-lang
Version: 6.2.3
Version: 6.3.0
Architecture: i386
Maintainer: Alex Rakov <[email protected]>
Depends: libc6 (>= 2.1)
Expand Down
2 changes: 1 addition & 1 deletion build/ppc64le/build_package_ppc64le.script
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
RELEASE=elena-6.2.3.ppc64le-linux
RELEASE=elena-6.3.0.ppc64le-linux

mkdir -p /usr/share/elena
mkdir -p /etc/elena/
Expand Down
2 changes: 1 addition & 1 deletion build/ppc64le/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: elena-lang
Version: 6.2.3
Version: 6.3.0
Architecture: ppc64le
Maintainer: Alex Rakov <[email protected]>
Depends: libc6 (>= 2.1)
Expand Down
28 changes: 28 additions & 0 deletions doc/features
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,31 @@ public program()
----------------------------------------------------------------------------

var s := var s := $"a_{ 1 }_b_{ 2 }_c";

----------------------------------------------------------------------------
user-defined literals
----------------------------------------------------------------------------

import extensions;

sealed struct OctalNumber
{
int value;

int cast() = value;

constructor(int n)
{
value := n;
}

cast o(string s)
{
value := s.toInt(8);
}
}

public program()
{
var n := 12o;
}
49 changes: 39 additions & 10 deletions doc/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,58 @@ In development:
------

[development]
### EPIC: elena 6.3 ###
### EPIC: elena 6.4 ###

=== Iteration 30 (16.8) ===
=== Iteration 31 ===
--------------------------------------
dev:
- async programming (general concept, SynchronizationContext, ThreadPool, Task, AsyncLocal<T>, ThreadStatic)
- upndown (connector)
- async programming
- chat: add mutex (see dpa_queue)
- #496
gen:
- lpad
- lpad : generate a code based on a record
maint:
- #679
port:
- #658 : vscode extension (debug adapter)
- #658 : connect with ldbg from VSCode
prom: posting weekly
--------------------------------------
- lpad : generate a code based on a record
- User-defined string literals
--------------------------------------
- #658 : connect with ldbg from VSCode

=== Iteration 32 ===
--------------------------------------
dev:
gen:
maint:
port:
prom:
--------------------------------------
--------------------------------------

### EPIC: elena 6.4 ###
=== Iteration 33 ===
--------------------------------------
dev:
gen:
maint:
port:
prom:
--------------------------------------
--------------------------------------

=== Iteration 31 ===
=== Iteration 34 ===
--------------------------------------
dev:
gen:
maint:
port:
prom:
--------------------------------------
--------------------------------------

### EPIC: elena 6.5 ###

=== Iteration 35 ===
--------------------------------------
dev:
gen:
Expand Down
12 changes: 12 additions & 0 deletions elenasrc3/common/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ bool PathUtil :: checkExtension(path_t path, ustr_t extension)
return PathUtil::checkExtension(path, *wExtension);
}

void PathUtil :: makeCorrectExePath(PathString& target)
{
if (!PathUtil::checkExtension(*target, "exe")) {
target.appendExtension("exe");
}
}

#elif __GNUG__

#include <unistd.h>
Expand Down Expand Up @@ -115,6 +122,11 @@ bool PathUtil :: removeFile(path_t path)
{
return ::remove(path.str()) != 0;;
}

void PathUtil::makeCorrectExePath(PathString& target)
{
}

#endif


Expand Down
2 changes: 2 additions & 0 deletions elenasrc3/common/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ namespace elena_lang
#endif

static void combineCanonicalized(PathString& target, path_t subpath);

static void makeCorrectExePath(PathString& target);
};

// --- PathString ---
Expand Down
67 changes: 67 additions & 0 deletions elenasrc3/dpa/dpa_queue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//---------------------------------------------------------------------------
// E L E N A P r o j e c t: ELENA Debugger Adapater
//
// This file contains the DPA queue declarations
//
// (C)2024, by Aleksey Rakov
//---------------------------------------------------------------------------

#ifndef DPA_QUEUE_H
#define DPA_QUEUE_H

#include <queue>
#include <condition_variable>
#include <mutex>
#include <optional>

namespace dpa
{
// --- ContentReader ---
template <typename T>
class ThreadQueue
{
bool _closed = false;
std::queue<T> _queue;
std::condition_variable _cv;
std::mutex _mutex;

public:
void close();

void put(const T& in);
std::optional<T> take();
};

template <typename T>
void ThreadQueue<T> :: close()
{
std::unique_lock<std::mutex> lock(_mutex);
_closed = true;
_cv.notify_all();
}

template <typename T>
void ThreadQueue<T> :: put(const T& in)
{
std::unique_lock<std::mutex> lock(_mutex);
auto notify = _queue.size() == 0 && !_closed;
_queue.push(in);
if (notify)
_cv.notify_all();
}

template <typename T>
std::optional<T> ThreadQueue<T> :: take()
{
std::unique_lock<std::mutex> lock(_mutex);
_cv.wait(lock, [&] { return _queue.size() > 0 || _closed; });
if (_queue.size() == 0) {
return std::optional<T>();
}
auto out = std::move(_queue.front());
_queue.pop();
return std::optional<T>(std::move(out));
}
}

#endif
38 changes: 38 additions & 0 deletions elenasrc3/dpa/dpa_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,43 @@ Session :: Session()

Session :: ~Session()
{
_inbox.close();
if (_recvThread.joinable()) {
_recvThread.join();
}
if (_dispatchThread.joinable()) {
_dispatchThread.join();
}
_reader.close();
}

void Session :: connect()
{
_reader = ContentReader();
}

Payload Session :: getPayload()
{
return {};
}

void Session :: start(const ClosedHandler& onClose)
{
_recvThread = std::thread([this/*, onClose*/] {
while (_reader.isOpen()) {
if (auto payload = getPayload()) {
_inbox.put(std::move(payload));
}
}
//if (onClose) {
// onClose();
//}
});

_dispatchThread = std::thread([this] {
while (auto payload = _inbox.take()) {
payload.value()();
}
});

}
Loading

0 comments on commit 53e24d1

Please sign in to comment.