I have compiled the code form svn trunk and haven't had any error after patching it with the attached file.
Is there other thing that I must do? What follows? Cheers 2009/12/8 Miguel Enrique Cobá Martínez (JIRA) <[email protected]>: > > [ > https://issues.apache.org/jira/browse/THRIFT-643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel > ] > > Miguel Enrique Cobá Martínez updated THRIFT-643: > ------------------------------------------------ > > Attachment: patch.888520 > > This patch solves the loading issues with the smalltalk generated code. > > >> Smalltalk generated code don't load on Squeak3.10.2-7179-basic and >> PharoCore-1.0-10491rc1 images >> ------------------------------------------------------------------------------------------------ >> >> Key: THRIFT-643 >> URL: https://issues.apache.org/jira/browse/THRIFT-643 >> Project: Thrift >> Issue Type: Bug >> Affects Versions: 0.2 >> Environment: Debian GNU/Linux Squeeze >> Smalltalk versions: >> - Squeak3.10.2-7179-basic >> - PharoCore-1.0-10491rc1 >> thrift svn revision: 887812 >> Reporter: Miguel Enrique Cobá Martínez >> Priority: Critical >> Fix For: 0.2 >> >> Attachments: patch.888520 >> >> >> I have found a bug in the generated code for the Smalltalk thrift interface. >> I used thrift svn revision: >> mig...@laptop:~/thrift-svn$ svn info >> Ruta: . >> URL: http://svn.apache.org/repos/asf/incubator/thrift/trunk >> Raíz del repositorio: http://svn.apache.org/repos/asf >> UUID del repositorio: 13f79535-47bb-0310-9956-ffa450edef68 >> Revisión: 888521 >> Tipo de nodo: directorio >> Agendado: normal >> Autor del último cambio: todd >> Revisión del último cambio: 887812 >> Fecha de último cambio: 2009-12-06 18:42:38 -0600 (dom 06 de dic de >> 2009) >> I did: >> bootstrap.sh >> configure >> make >> and then I tried to load the thrift smalltalk code from >> lib/st/thrift.st >> in a squeak Squeak3.10.2-7179-basic.zip, pristine image from squeak.org. >> That halted with an error about a duplicated readString method >> declaration. The error is fixed in the attached patch. >> Next I compiled the code for the cassandra thrift: >> https://svn.apache.org/repos/asf/incubator/cassandra/trunk/interface/cassandra.thrift >> with the command: >> ./compiler/cpp/thrift --gen st cassandra.thrift >> and tried to file in the generated code >> gen-st/cassandra.st >> in said image. >> Again the load halted. This time because of the underscores in the >> generated code for the cassandra thrift definition. Squeak (and derived >> smalltalks as Pharo) doesn't allow underscores in variable names (the >> underscore is a legacy character used for variable assigment). Anyway I >> have modified the code for smalltalk generator: >> compiler/cpp/src/generate/t_st_generator.cc >> so that when a variable name in the thrift definition has a "_" >> character, this is removed and the next character is converted to >> uppercase. e.g. a variable like column_name will be generated in >> smalltalk code as columnName. This way the code loads (and works >> correctly) on Squeak. >> The generated code has been tested in the following smalltalk images >> Squeak3.10.2-7179-basic.image >> PharoCore-1.0-10491rc1.image >> and in both of them the new generated code for cassandra works >> correctly. >> I haven't tested the code generation with a thrift spec other than >> cassandra, so maybe this will introduce some bugs. For my case it worked >> great. >> If anyone is using cassandra and want to test it, I installed the >> default cassandra server on localhost port 9160 and tested from Squeak >> and from Pharo by loading >> lib/st/thrift.st >> gen-st/cassandra.st >> Then in a Squeak or Pharo workspace: >> "Insert 10000 values" >> [| cp result client | >> client := CassandraClient binaryOnHost: 'localhost' port: 9160. >> cp := ColumnPath new >> columnFamily: 'Standard1'; >> column: 'col1'. >> 1 to: 10000 do: [ :i | >> result := client insertKeyspace: 'Keyspace1' >> key: 'row', i asString >> columnPath: cp >> value: 'v', i asString >> timestamp: 1 >> consistencyLevel: ((Cassandra enums at: 'ConsistencyLevel') at: >> 'QUORUM').]] timeToRun >> And read the values just inserted: >> "Read 10000 values" >> [| cp result client | >> client := CassandraClient binaryOnHost: 'localhost' port: 9160. >> cp := ColumnPath new >> columnFamily: 'Standard1'; >> column: 'col1'. >> 1 to: 10000 do: [ :i | >> result := client getKeyspace: 'Keyspace1' >> key: 'row', i asString >> columnPath: cp >> consistencyLevel: ((Cassandra enums at: 'ConsistencyLevel') at: >> 'QUORUM').]] timeToRun >> Regarding the patch, I am not a C++ expert and the drop_underscores() >> function surely can be improved by someone with more experience with C++ >> idioms. Essentially what it does is to convert: >> from -> to >> ----- ----- >> a_variable -> aVariable >> a_new_var -> aNewVar >> column_path -> columnPath >> variable -> variable >> Give it a try and if deemed good enough please add it to the thrift >> code. >> Those changes are published under the apache public license, the same as >> the thrift codebase. >> The patch is generated with >> svn diff -x -u > patch.888520 >> against revision 888520 of the thrift svn code. > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > >
