Skip to content

Commit

Permalink
wip #109: scaffold transcoder for Content-Type
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Mar 3, 2016
1 parent 8f16090 commit b988486
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
12 changes: 9 additions & 3 deletions src/base_defs
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,16 @@ Symbol: PLAIN_TEXT_MEDIA_SUBTYPE,NULL_STRUCTURE;
Symbol: CEPTR_TEXT_MEDIA_SUBTYPE,NULL_STRUCTURE;

Data: content_type_2_line_proc, (CONCAT_STR (RESULT_SYMBOL:LINE)
(LINE:"Content-type") (ASCII_CHAR:':')
(TRANSCODE (TRANSCODE_TO:LINE) (PARAM_REF:/2/1/1))
(LINE:"Content-Type") (ASCII_CHAR:':') (ASCII_CHAR:' ')
(IF (EQ_SYM (PARAM_REF:/2/1/1) (TEST_SYMBOL_SYMBOL:TEXT_MEDIA_TYPE))
(LINE:"text")
(LINE:"unknown"))
(ASCII_CHAR:'/')
(TRANSCODE (TRANSCODE_TO:LINE) (PARAM_REF:/2/1/2))
(IF (EQ_SYM (PARAM_REF:/2/1/2) (TEST_SYMBOL_SYMBOL:HTML_TEXT_MEDIA_SUBTYPE))
(LINE:"html")
(IF (EQ_SYM (PARAM_REF:/2/1/2) (TEST_SYMBOL_SYMBOL:PLAIN_TEXT_MEDIA_SUBTYPE))
(LINE:"plain")
(LINE:"ceptr"))))
);
Process: content_type_2_line,content_type_2_line_proc,"content type transcoder","output",SIGNATURE_SYMBOL,LINE,"input",SIGNATURE_SYMBOL,CONTENT_TYPE,0;

Expand Down
2 changes: 1 addition & 1 deletion src/base_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ void base_defs(SemTable *sem) {
sY(INTERNET_CONTEXT,HTML_TEXT_MEDIA_SUBTYPE,NULL_STRUCTURE);
sY(INTERNET_CONTEXT,PLAIN_TEXT_MEDIA_SUBTYPE,NULL_STRUCTURE);
sY(INTERNET_CONTEXT,CEPTR_TEXT_MEDIA_SUBTYPE,NULL_STRUCTURE);
sData(INTERNET_CONTEXT,content_type_2_line_proc,STX_OP,CONCAT_STR,STX_OP,RESULT_SYMBOL,LINE,STX_CP,STX_OP,LINE,"Content-type",STX_CP,STX_OP,ASCII_CHAR,':',STX_CP,STX_OP,TRANSCODE,STX_OP,TRANSCODE_TO,LINE,STX_CP,STX_OP,PARAM_REF,2,1,1,TREE_PATH_TERMINATOR,STX_CP,STX_CP,STX_OP,ASCII_CHAR,'/',STX_CP,STX_OP,TRANSCODE,STX_OP,TRANSCODE_TO,LINE,STX_CP,STX_OP,PARAM_REF,2,1,2,TREE_PATH_TERMINATOR,STX_CP,STX_CP,STX_CP);
sData(INTERNET_CONTEXT,content_type_2_line_proc,STX_OP,CONCAT_STR,STX_OP,RESULT_SYMBOL,LINE,STX_CP,STX_OP,LINE,"Content-Type",STX_CP,STX_OP,ASCII_CHAR,':',STX_CP,STX_OP,ASCII_CHAR,' ',STX_CP,STX_OP,IF,STX_OP,EQ_SYM,STX_OP,PARAM_REF,2,1,1,TREE_PATH_TERMINATOR,STX_CP,STX_OP,TEST_SYMBOL_SYMBOL,TEXT_MEDIA_TYPE,STX_CP,STX_CP,STX_OP,LINE,"text",STX_CP,STX_OP,LINE,"unknown",STX_CP,STX_CP,STX_OP,ASCII_CHAR,'/',STX_CP,STX_OP,IF,STX_OP,EQ_SYM,STX_OP,PARAM_REF,2,1,2,TREE_PATH_TERMINATOR,STX_CP,STX_OP,TEST_SYMBOL_SYMBOL,HTML_TEXT_MEDIA_SUBTYPE,STX_CP,STX_CP,STX_OP,LINE,"html",STX_CP,STX_OP,IF,STX_OP,EQ_SYM,STX_OP,PARAM_REF,2,1,2,TREE_PATH_TERMINATOR,STX_CP,STX_OP,TEST_SYMBOL_SYMBOL,PLAIN_TEXT_MEDIA_SUBTYPE,STX_CP,STX_CP,STX_OP,LINE,"plain",STX_CP,STX_OP,LINE,"ceptr",STX_CP,STX_CP,STX_CP,STX_CP,STX_CP);
sP(INTERNET_CONTEXT,content_type_2_line,content_type_2_line_proc,"content type transcoder","output",SIGNATURE_SYMBOL,LINE,"input",SIGNATURE_SYMBOL,CONTENT_TYPE,0);
sY(INTERNET_CONTEXT,CONTENT_ENCODING,CSTRING);
sY(INTERNET_CONTEXT,HTTP_REQUEST_METHOD,CSTRING);
Expand Down
26 changes: 19 additions & 7 deletions web/sysdefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2857,15 +2857,27 @@
{"sem":{ "ctx":0,"type":2,"id":93 },"surface":"content type transcoder"},
{"sem":{ "ctx":0,"type":3,"id":23 },"children":[
{"sem":{ "ctx":0,"type":2,"id":122 },"surface":{ "ctx":2,"type":2,"id":14 }},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"Content-type"},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"Content-Type"},
{"sem":{ "ctx":0,"type":2,"id":45 },"surface":":"},
{"sem":{ "ctx":0,"type":3,"id":6 },"children":[
{"sem":{ "ctx":0,"type":2,"id":203 },"surface":{ "ctx":2,"type":2,"id":14 }},
{"sem":{ "ctx":0,"type":2,"id":120 },"surface":"/2/1/1"}]},
{"sem":{ "ctx":0,"type":2,"id":45 },"surface":" "},
{"sem":{ "ctx":0,"type":3,"id":8 },"children":[
{"sem":{ "ctx":0,"type":3,"id":26 },"children":[
{"sem":{ "ctx":0,"type":2,"id":120 },"surface":"/2/1/1"},
{"sem":{ "ctx":3,"type":2,"id":11 },"surface":{ "ctx":6,"type":2,"id":20 }}]},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"text"},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"unknown"}]},
{"sem":{ "ctx":0,"type":2,"id":45 },"surface":"/"},
{"sem":{ "ctx":0,"type":3,"id":6 },"children":[
{"sem":{ "ctx":0,"type":2,"id":203 },"surface":{ "ctx":2,"type":2,"id":14 }},
{"sem":{ "ctx":0,"type":2,"id":120 },"surface":"/2/1/2"}]}]},
{"sem":{ "ctx":0,"type":3,"id":8 },"children":[
{"sem":{ "ctx":0,"type":3,"id":26 },"children":[
{"sem":{ "ctx":0,"type":2,"id":120 },"surface":"/2/1/2"},
{"sem":{ "ctx":3,"type":2,"id":11 },"surface":{ "ctx":6,"type":2,"id":21 }}]},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"html"},
{"sem":{ "ctx":0,"type":3,"id":8 },"children":[
{"sem":{ "ctx":0,"type":3,"id":26 },"children":[
{"sem":{ "ctx":0,"type":2,"id":120 },"surface":"/2/1/2"},
{"sem":{ "ctx":3,"type":2,"id":11 },"surface":{ "ctx":6,"type":2,"id":22 }}]},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"plain"},
{"sem":{ "ctx":2,"type":2,"id":14 },"surface":"ceptr"}]}]}]},
{"sem":{ "ctx":0,"type":2,"id":94 },"children":[
{"sem":{ "ctx":0,"type":2,"id":116 },"children":[
{"sem":{ "ctx":0,"type":2,"id":106 },"surface":"output"},
Expand Down

0 comments on commit b988486

Please sign in to comment.