Skip to content

Commit

Permalink
-- TO, u-scc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lvv committed Dec 14, 2011
1 parent 632feec commit 5c1d5bb
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ b-field.in
t
x
bench

.old
2 changes: 1 addition & 1 deletion cj.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef std::deque<std::string> dstr;
#define FORt(N) FOR(t,0,N)
#define FORm(N) FOR(m,0,N)

#define FORic(I,C) for (long I=0; I<(long)C.size(); I++)
#define FORic(i,C) for (long i=0; i<(long)C.size(); i++)
#define FORitc(IT,C) for (auto IT=C.begin(); IT != C.end(); IT++)
#define FORr(IT,B,E) for (auto IT=B; IT != E; IT++)

Expand Down
1 change: 1 addition & 0 deletions index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ ENCODING

Take a look on Boost.Locale it is a part of it
DB
SQL connectors -- http://www.reddit.com/r/cpp/comments/mrbc5/how_to_connect_to_an_sql_database/
http://soci.sourceforge.net/
https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.RDB
http://webtoolkit.eu/wt#/blog/2009/11/26/wt__dbo__an_orm__c___style
Expand Down
2 changes: 1 addition & 1 deletion simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define LVV_SIMPLE_H

#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 7 ) )
#error "error: SCC/simple.h does not support GCC earlier than 4.7"
#error "SCC/simple.h does not support GCC earlier than 4.7"
#endif

//#if defined(__GXX_EXPERIMENTAL_CXX0X__) && ( __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 4 ) ) )
Expand Down
93 changes: 56 additions & 37 deletions u-scc
Original file line number Diff line number Diff line change
@@ -1,50 +1,69 @@
time (
echo ---------------------------------------------------------
echo "" | scc -v 1 &&
echo -e "\n1"
echo ---------------------------------------------------------
echo "" | scc -v 'vector<int> V{1,2}; V' &&
echo -e "\n{1, 2}"
echo ---------------------------------------------------------
echo "" | scc -v 'int A[2] = {1,2}; A' &&
echo -e "\n{1, 2}"
echo ---------------------------------------------------------
echo -e '1 2\n11 22\n111 222' | scc -v -p 'F(1)=9;' &&
echo -e '\n1 9\n11 9\n111 9'
echo ---------------------------------------------------------
echo \
'1 -
2
3 none
4 abc' | scc -v -p 'F(1)=RR(F(1),R("^(none|-)?$"),"n/a");' &&
echo 'scc 1'
scc 1 &&
echo 1

echo -e '\n1 n/a\n2 n/a\n3 n/a\n4 abc'
echo ---------------------------------------------------------
echo -e 'aaa bbb\nccc ddd' | scc -v -p 'F.push_front(NR+1);' &&
echo -e '\n1 aaa bbb\n2 ccc ddd'
echo ---------------------------------------------------------
echo -e 'aaa bbb\nccc ddd' | scc -v -p 'field(NR+1)+" "' &&
echo -e '\n1 aaa bbb\n2 ccc ddd'
echo "scc 'vector<int> V{1,2}; V'"
scc 'vector<int> V{1,2}; V' &&
echo -e "{1, 2}"

echo ---------------------------------------------------------
echo -e "AA\nBB\nCC" | scc -v 'WRL if (RS(line, R(argv[1]))) cout << line << endl;' 'A|B' &&
echo -e "\nAA\nBB"
echo "scc 'int A[2] = {1,2}; A'"
scc 'int A[2] = {1,2}; A' &&
echo -e "{1, 2}"

#echo ---------------------------------------------------------
#echo "echo -e '1 2\n11 22\n111 222' | scc -p 'F(1)=9;'"
# echo -e '1 2\n11 22\n111 222' | scc -p 'F(1)=9;' &&
#echo -e '\n1 9\n11 9\n111 9'

#echo ---------------------------------------------------------
#echo "echo -e \"1 -\n2\n3 none\n4 abc\" | scc -p 'F(1)=RR(F(1),R(\"^(none|-)?$\"),"n/a");'"
# echo -e "1 -\n2\n3 none\n4 abc" | scc -p 'F(1)=RR(F(1),R( "^(none|-)?$" ),"n/a");' &&
#echo -e '\n1 n/a\n2 n/a\n3 n/a\n4 abc'

#echo ---------------------------------------------------------
#echo "echo -e 'aaa bbb\nccc ddd' | scc -p 'F.push_front(NR+1);'"
# echo -e 'aaa bbb\nccc ddd' | scc -p 'F.push_front(NR+1);' &&
#echo -e '\n1 aaa bbb\n2 ccc ddd'

#echo ---------------------------------------------------------
#echo -e 'aaa bbb\nccc ddd' | scc -p 'field(NR+1)+" "' &&
#echo -e 'aaa bbb\nccc ddd' | scc -p 'field(NR+1)+" "' &&
#echo -e '\n1 aaa bbb\n2 ccc ddd'

#echo ---------------------------------------------------------
#echo -e "AA\nBB\nCC" | scc 'WRL if (RS(line, R(argv[1]))) cout << line << endl;' 'A|B' &&
#echo -e "\nAA\nBB"

echo ---------------------------------------------------------
echo aaa bbb aaa | scc -v 'str w; map<str,int> m; while(cin>>w) m[w]++; m' &&
echo "echo aaa bbb aaa | scc 'str w; map<str,int> m; while(cin>>w) m[w]++; m'"
echo aaa bbb aaa | scc 'str w; map<str,int> m; while(cin>>w) m[w]++; m' &&
echo -e "\n{⟨aaa,2⟩, ⟨bbb,1⟩}"

echo ---------------------------------------------------------
command df | scc -v 'WRL n+=F2; n' &&
echo "df | scc 'WRL n+=F2; n'"
command df | scc 'WRL n+=F2; n' &&
echo "" &&
command df | awk '{n+=$3;}; END{print n}'

#echo ---------------------------------------------------------
#scc 'str s="aa bb"; RR(s, R("(\\w+)"),"*\\1*")' &&
#echo -e "\n*aa* *bb*"

#echo ---------------------------------------------------------
#echo '"aa", "bb\"-, bb", "cc"' | scc 'IFS=CSV ; WRL for (str f:F) cout << f << endl;' &&
#echo -e "\naa\nbb\"-, bb\ncc"

#echo ---------------------------------------------------------
#echo 1:2:3 | scc -i: -o '","' -p
#echo 1 2 3 | scc -I '"(\\S+)(\\s+|$)"' -o '","' -p

echo ---------------------------------------------------------
echo "AAA BBB CCC" | scc -v 'int t=0; str s; while(cin>>s) t++; t' &&
echo -e "\n3"
echo ---------------------------------------------------------
scc -v 'str s="aa bb"; RR(s, R("(\\w+)"),"*\\1*")' &&
echo -e "\n*aa* *bb*"
echo ---------------------------------------------------------
echo '"aa", "bb\"-, bb", "cc"' | scc -v 'IFS=CSV ; WRL for (str f:F) cout << f << endl;' &&
echo -e "\naa\nbb\"-, bb\ncc"
echo 'vint A{1,2,3}; copy(A.bb, A.ee, outi); str S("ABC"); copy(S.bb, S.ee, outi); cout<<endl;'
scc 'vint A{1,2,3}; copy(A.bb, A.ee, outi); str S("ABC"); copy(S.bb, S.ee, outi); cout<<endl;'
echo 1 2 3 A B C

echo 1:2:3 | scc -i: -o '","' -p
echo 1 2 3 | scc -I '"(\\S+)(\\s+|$)"' -o '","' -p
)

0 comments on commit 5c1d5bb

Please sign in to comment.