Strange source import behaviour ..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange source import behaviour ..

GLASS mailing list
This following code is a small part of the source code I generate 
for my model. The source code is embedded in a shell script and
the source code is imported via topaz.

Please look at the line

(Date fromString: value usingFormat: #(3 2 1 $-  1 1 ))

ALL occurences of this source code is converted to:


(Date fromString: value usingFormat: #(3 2 1 hB 1 1 ))


in the database .... ?????????


Marten Feldtmann

%
category: 'model-json-support'
set compile_env: 0
classmethod: ES3APIElection
pumSimpleSwaggerModelNeoJsonMapping: mapping

    " Generator: 'Topaz/Gemstone (REST Server Smalltalk)' Version: '08.06.02-02.05.17' LastRun: '2015_12_19_10_24_04' "
    " Model-Version: '1.1.115'  "

    mapping
        mapProperty: #electionDate
        getter: [ :object | | value | ((value := object getElectionDate) ~= UndefinedObject and:[ value isNil not ]) ifTrue: [ value asStringUsingFormat: #(3 2 1 $-  1 1 ) ] ifFalse:[ nil ]]
        setter: [ :object :value | value ifNotNil:[ object setElectionDate: (Date fromString: value usingFormat: #(3 2 1 $-  1 1 )) ]].


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Strange source import behaviour ..

GLASS mailing list

Some additional infos:

The source code format is recognized as UTF8 by topaz:


output from topaz while executing the script:
...
fileformat is now utf8
sourcecodestringlcass is now Unicode16
...


The source code imspected via vi or gedit (under Ubuntu and notepad++ under Windows) is ok, BUT while executing topaz: topaz prints the source code (it was importing) to stdout and even there the source code has changed already from $- ...

After all this is not a real problem for me. I transfer this sequence to my runtime and the I change the code generator in that way, that it calls the runtime ... though it would be interesting to find the reason for that.

And the Gemstone/S version is 3.2.9 unter Ubuntu 14.04


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Strange source import behaviour ..

GLASS mailing list
>> The source code imspected via vi or gedit (under Ubuntu and notepad++ under Windows) is ok,

Using an editor that reads UTF-8 to find out whether the character is as encoded UTF-8 representation is not helpful. You need to use an editor that lets you examine the raw bytes in the file. i.e. a so-called hex editor

However, the fact that it is recognized as a UTF-8 file is interesting.

Try inspecting the $- character in the generator to see if it really has the value 16r2D or if it is a Unicode dash of some kind (i.e. code point > 127).


On Sat, Dec 19, 2015 at 9:26 AM, Marten Feldtmann via Glass <[hidden email]> wrote:

Some additional infos:

The source code format is recognized as UTF8 by topaz:


output from topaz while executing the script:
...
fileformat is now utf8
sourcecodestringlcass is now Unicode16
...


The source code imspected via vi or gedit (under Ubuntu and notepad++ under Windows) is ok, BUT while executing topaz: topaz prints the source code (it was importing) to stdout and even there the source code has changed already from $- ...

After all this is not a real problem for me. I transfer this sequence to my runtime and the I change the code generator in that way, that it calls the runtime ... though it would be interesting to find the reason for that.

And the Gemstone/S version is 3.2.9 unter Ubuntu 14.04


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Strange source import behaviour ..

GLASS mailing list
In reply to this post by GLASS mailing list

I got an answer, that $- is a special character in shell programming and this could be reason for it. Indeed the source code was within a shell script in a structure like this:

#!/bin/bash

....

cat << EOF | $GEMSTONE/bin/topaz -l

... 120000 lines of Smalltalk Source code

EOF


Marten


Marten Feldtmann via Glass <[hidden email]> hat am 19. Dezember 2015 um 18:26 geschrieben:

Some additional infos:

The source code format is recognized as UTF8 by topaz:


output from topaz while executing the script:
...
fileformat is now utf8
sourcecodestringlcass is now Unicode16
...


The source code imspected via vi or gedit (under Ubuntu and notepad++ under Windows) is ok, BUT while executing topaz: topaz prints the source code (it was importing) to stdout and even there the source code has changed already from $- ...

After all this is not a real problem for me. I transfer this sequence to my runtime and the I change the code generator in that way, that it calls the runtime ... though it would be interesting to find the reason for that.

And the Gemstone/S version is 3.2.9 unter Ubuntu 14.04


 

_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Strange source import behaviour ..

GLASS mailing list
In reply to this post by GLASS mailing list
[Re-send, to include list]

On 19.12.2015, at 18:43, Tobias Pape <[hidden email]> wrote:

> Hi Marten
> On 19.12.2015, at 17:16, Marten Feldtmann via Glass <[hidden email]> wrote:
>
>> This following code is a small part of the source code I generate
>> for my model. The source code is embedded in a shell script and
>> the source code is imported via topaz.
>>
>> Please look at the line
>>
>> (Date fromString: value usingFormat: #(3 2 1 $-  1 1 ))
>
> Are you starting something from a shell script? $- is a special variable,
> that can get expanded to things like hB. My shell, for example has '569XZgilms'
> and when I run
>
> sh -c 'echo $-'
>
> it looks awfully similar to yours:
>
> hBc
>
> You may either want to quote the $ (as in \$-) or
> file in from a file itself.
>
> Best regards
> -Tobias
>
>>
>> ALL occurences of this source code is converted to:
>>
>>
>> (Date fromString: value usingFormat: #(3 2 1 hB  1 1 ))
>>
>>
>> in the database .... ?????????
>>
>>
>> Marten Feldtmann
>>
>> %
>> category: 'model-json-support'
>> set compile_env: 0
>> classmethod: ES3APIElection
>> pumSimpleSwaggerModelNeoJsonMapping: mapping
>>
>>    " Generator: 'Topaz/Gemstone (REST Server Smalltalk)' Version: '08.06.02-02.05.17' LastRun: '2015_12_19_10_24_04' "
>>    " Model-Version: '1.1.115'  "
>>
>>    mapping
>>        mapProperty: #electionDate
>>        getter: [ :object | | value | ((value := object getElectionDate) ~= UndefinedObject and:[ value isNil not ]) ifTrue: [ value asStringUsingFormat: #(3 2 1 $-  1 1 ) ] ifFalse:[ nil ]]
>>        setter: [ :object :value | value ifNotNil:[ object setElectionDate: (Date fromString: value usingFormat: #(3 2 1 $-  1 1 )) ]].
>>
>> _______________________________________________
>> Glass mailing list
>> [hidden email]
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass