Revert "Revert command line array object because it's broken by design"
This reverts commit a57c7f751023fe1d1edeabbf8683574ac7497e5e.
I pretty much hate to just revert your revert, but you failed to read my
replies, and failed to understand what i was talking about.
And YES we talked at fosdem about the platform issue, and do you
remember my answer, that back in time this might be the case, today is
different freebsd suppoerts setenv, and for windows we have a setenv
implementation in evil. And yes, vtorri also created a issue how bad and
evil this commit is, however, i still fail to see the issue since setenv
unsetenv and clearenv usages are taken as needed. (T7693)
The ownership question is answered in
https://phab.enlightenment.org/D7516#137367.
Can we please get into a state of technical discussions, and not *oh
shit, i am going to revert this* this has been in review for a long
time, a lots of people have tested it, we discussed things on it, and
there was 3 weeks of no reply from you.
The issues that exist will be dealed with. Feel free to create tasks if
you want :)
2019-02-12 12:34:30 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EFL_CORE_COMMAND_LINE_PROTECTED
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#define EFL_NOLEGACY_API_SUPPORT
|
|
|
|
#include <Efl_Core.h>
|
|
|
|
#include "efl_app_suite.h"
|
|
|
|
#include "../efl_check.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
} Efl_App_Test_CML_Data;
|
|
|
|
|
ecore: Rename EAPI macro to ECORE_API in Ecore library
Summary:
= The Rationale =
EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.
MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.
For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.
With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).
Example 1:
dll1:
```
EAPI void foo(void);
EAPI void bar()
{
foo();
}
```
dll2:
```
EAPI void foo()
{
printf ("foo\n");
}
```
This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`.
However, the following:
Example 2:
dll1:
```
EAPI extern int foo;
EAPI void foobar(void);
EAPI void bar()
{
foo = 5;
foobar();
}
```
dll2:
```
EAPI int foo = 0;
EAPI void foobar()
{
printf ("foo %d\n", foo);
}
```
This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.
Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
Reviewers: vtorri, raster
Reviewed By: raster
Subscribers: raster, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12271
2021-05-23 12:08:05 -07:00
|
|
|
#define ECORETEST_API
|
|
|
|
#define ECORETEST_API_WEAK
|
|
|
|
|
Revert "Revert command line array object because it's broken by design"
This reverts commit a57c7f751023fe1d1edeabbf8683574ac7497e5e.
I pretty much hate to just revert your revert, but you failed to read my
replies, and failed to understand what i was talking about.
And YES we talked at fosdem about the platform issue, and do you
remember my answer, that back in time this might be the case, today is
different freebsd suppoerts setenv, and for windows we have a setenv
implementation in evil. And yes, vtorri also created a issue how bad and
evil this commit is, however, i still fail to see the issue since setenv
unsetenv and clearenv usages are taken as needed. (T7693)
The ownership question is answered in
https://phab.enlightenment.org/D7516#137367.
Can we please get into a state of technical discussions, and not *oh
shit, i am going to revert this* this has been in review for a long
time, a lots of people have tested it, we discussed things on it, and
there was 3 weeks of no reply from you.
The issues that exist will be dealed with. Feel free to create tasks if
you want :)
2019-02-12 12:34:30 -08:00
|
|
|
#include "efl_app_test_cml.eo.h"
|
|
|
|
#include "efl_app_test_cml.eo.c"
|
|
|
|
|
|
|
|
static Eina_Array*
|
|
|
|
_construct_array(void)
|
|
|
|
{
|
|
|
|
Eina_Array *array = eina_array_new(16);
|
|
|
|
|
2019-02-14 03:28:23 -08:00
|
|
|
eina_array_push(array, eina_stringshare_add("/bin/sh"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("-C"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("foo"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("--test"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("--option=done"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("--"));
|
|
|
|
eina_array_push(array, eina_stringshare_add("asdf --test"));
|
Revert "Revert command line array object because it's broken by design"
This reverts commit a57c7f751023fe1d1edeabbf8683574ac7497e5e.
I pretty much hate to just revert your revert, but you failed to read my
replies, and failed to understand what i was talking about.
And YES we talked at fosdem about the platform issue, and do you
remember my answer, that back in time this might be the case, today is
different freebsd suppoerts setenv, and for windows we have a setenv
implementation in evil. And yes, vtorri also created a issue how bad and
evil this commit is, however, i still fail to see the issue since setenv
unsetenv and clearenv usages are taken as needed. (T7693)
The ownership question is answered in
https://phab.enlightenment.org/D7516#137367.
Can we please get into a state of technical discussions, and not *oh
shit, i am going to revert this* this has been in review for a long
time, a lots of people have tested it, we discussed things on it, and
there was 3 weeks of no reply from you.
The issues that exist will be dealed with. Feel free to create tasks if
you want :)
2019-02-12 12:34:30 -08:00
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char*
|
|
|
|
_construct_string(void)
|
|
|
|
{
|
|
|
|
return "/bin/sh -C foo --test --option=done -- \"asdf --test\"";
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_START_TEST(efl_core_cml_string)
|
|
|
|
{
|
|
|
|
Efl_App_Test_CML *cml = efl_add_ref(EFL_APP_TEST_CML_CLASS, NULL);
|
|
|
|
Eina_Array *content = _construct_array();
|
|
|
|
Eina_Stringshare *str;
|
|
|
|
Eina_Bool b;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
b = efl_core_command_line_command_string_set(cml, _construct_string());
|
|
|
|
ck_assert_int_ne(b, 0);
|
|
|
|
|
|
|
|
EINA_ACCESSOR_FOREACH(efl_core_command_line_command_access(cml), i, str)
|
|
|
|
{
|
|
|
|
ck_assert_str_eq(eina_array_data_get(content, i), str);
|
|
|
|
}
|
|
|
|
ck_assert_str_eq(efl_core_command_line_command_get(cml), _construct_string());
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST(efl_core_cml_array)
|
|
|
|
{
|
|
|
|
Efl_App_Test_CML *cml = efl_add_ref(EFL_APP_TEST_CML_CLASS, NULL);
|
|
|
|
Eina_Array *content1 = _construct_array();
|
|
|
|
Eina_Array *content2 = _construct_array();
|
|
|
|
Eina_Stringshare *str;
|
|
|
|
Eina_Bool b;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
b = efl_core_command_line_command_array_set(cml, content1);
|
|
|
|
ck_assert_int_ne(b, 0);
|
|
|
|
|
|
|
|
EINA_ACCESSOR_FOREACH(efl_core_command_line_command_access(cml), i, str)
|
|
|
|
{
|
|
|
|
ck_assert_str_eq(eina_array_data_get(content2, i), str);
|
|
|
|
}
|
|
|
|
ck_assert_str_eq(efl_core_command_line_command_get(cml), _construct_string());
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
void efl_test_efl_cml(TCase *tc)
|
|
|
|
{
|
|
|
|
tcase_add_test(tc, efl_core_cml_string);
|
|
|
|
tcase_add_test(tc, efl_core_cml_array);
|
|
|
|
}
|