Fossil SCM
Made a few more functions static. th1 ob doc additions.
Commit
8027581c5e9e8754d9a629bc94b3baa7980d9e61
Parent
3167ff33f84ef83…
2 files changed
+8
-8
+19
-8
+8
-8
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -851,27 +851,27 @@ | ||
| 851 | 851 | ** by this function. |
| 852 | 852 | ** |
| 853 | 853 | ** If interp is destroyed before all statements are finalized, |
| 854 | 854 | ** it will finalize them but may emit a warning message. |
| 855 | 855 | */ |
| 856 | -int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt); | |
| 856 | +static int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt); | |
| 857 | 857 | |
| 858 | 858 | /* |
| 859 | 859 | ** Expects stmtId to be a statement identifier returned by |
| 860 | 860 | ** Th_AddStmt(). On success, finalizes the statement and returns 0. |
| 861 | 861 | ** On error (statement not found) non-0 is returned. After this |
| 862 | 862 | ** call, some subsequent call to Th_AddStmt() may return the |
| 863 | 863 | ** same statement ID. |
| 864 | 864 | */ |
| 865 | -int Th_FinalizeStmt(Th_Interp *interp, int stmtId); | |
| 865 | +static int Th_FinalizeStmt(Th_Interp *interp, int stmtId); | |
| 866 | 866 | |
| 867 | 867 | /* |
| 868 | 868 | ** Fetches the statement with the given ID, as returned by |
| 869 | 869 | ** Th_AddStmt(). Returns NULL if stmtId does not refer (or no longer |
| 870 | 870 | ** refers) to a statement added via Th_AddStmt(). |
| 871 | 871 | */ |
| 872 | -sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId); | |
| 872 | +static sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId); | |
| 873 | 873 | |
| 874 | 874 | |
| 875 | 875 | struct Th_Sqlite { |
| 876 | 876 | sqlite3_stmt ** aStmt; |
| 877 | 877 | int nStmt; |
| @@ -882,11 +882,11 @@ | ||
| 882 | 882 | static Th_Sqlite * Th_sqlite_manager( Th_Interp * interp ){ |
| 883 | 883 | void * p = Th_Data_Get( interp, Th_Sqlite_KEY ); |
| 884 | 884 | return p ? (Th_Sqlite*)p : NULL; |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | -int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt){ | |
| 887 | +static int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt){ | |
| 888 | 888 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 889 | 889 | int i, x; |
| 890 | 890 | sqlite3_stmt * s; |
| 891 | 891 | sqlite3_stmt ** list = sq->aStmt; |
| 892 | 892 | for( i = 0; i < sq->nStmt; ++i ){ |
| @@ -907,11 +907,11 @@ | ||
| 907 | 907 | sq->aStmt = list; |
| 908 | 908 | return x + 1; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | |
| 912 | -int Th_FinalizeStmt(Th_Interp *interp, int stmtId){ | |
| 912 | +static int Th_FinalizeStmt(Th_Interp *interp, int stmtId){ | |
| 913 | 913 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 914 | 914 | sqlite3_stmt * st; |
| 915 | 915 | int rc = 0; |
| 916 | 916 | assert( stmtId>0 && stmtId<=sq->nStmt ); |
| 917 | 917 | st = sq->aStmt[stmtId-1]; |
| @@ -922,30 +922,30 @@ | ||
| 922 | 922 | }else{ |
| 923 | 923 | return 1; |
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | -sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId){ | |
| 927 | +static sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId){ | |
| 928 | 928 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 929 | 929 | return ((stmtId<1) || (stmtId > sq->nStmt)) |
| 930 | 930 | ? NULL |
| 931 | 931 | : sq->aStmt[stmtId-1]; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | |
| 935 | 935 | static void finalizerSqlite( Th_Interp * interp, void * p ){ |
| 936 | - Th_Sqlite * sq = Th_sqlite_manager( interp ); | |
| 936 | + Th_Sqlite * sq = (Th_Sqlite *)p; | |
| 937 | 937 | int i; |
| 938 | 938 | sqlite3_stmt * st = NULL; |
| 939 | 939 | if(!sq) { |
| 940 | 940 | fossil_warning("Got a finalizer call for a NULL Th_Sqlite."); |
| 941 | 941 | return; |
| 942 | 942 | } |
| 943 | 943 | for( i = 0; i < sq->nStmt; ++i ){ |
| 944 | 944 | st = sq->aStmt[i]; |
| 945 | 945 | if(NULL != st){ |
| 946 | - fossil_warning("Auto-finalizing unfinalized query_prepare " | |
| 946 | + fossil_warning("Auto-finalizing unfinalized " | |
| 947 | 947 | "statement id #%d: %s", |
| 948 | 948 | i+1, sqlite3_sql(st)); |
| 949 | 949 | Th_FinalizeStmt( interp, i+1 ); |
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -851,27 +851,27 @@ | |
| 851 | ** by this function. |
| 852 | ** |
| 853 | ** If interp is destroyed before all statements are finalized, |
| 854 | ** it will finalize them but may emit a warning message. |
| 855 | */ |
| 856 | int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt); |
| 857 | |
| 858 | /* |
| 859 | ** Expects stmtId to be a statement identifier returned by |
| 860 | ** Th_AddStmt(). On success, finalizes the statement and returns 0. |
| 861 | ** On error (statement not found) non-0 is returned. After this |
| 862 | ** call, some subsequent call to Th_AddStmt() may return the |
| 863 | ** same statement ID. |
| 864 | */ |
| 865 | int Th_FinalizeStmt(Th_Interp *interp, int stmtId); |
| 866 | |
| 867 | /* |
| 868 | ** Fetches the statement with the given ID, as returned by |
| 869 | ** Th_AddStmt(). Returns NULL if stmtId does not refer (or no longer |
| 870 | ** refers) to a statement added via Th_AddStmt(). |
| 871 | */ |
| 872 | sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId); |
| 873 | |
| 874 | |
| 875 | struct Th_Sqlite { |
| 876 | sqlite3_stmt ** aStmt; |
| 877 | int nStmt; |
| @@ -882,11 +882,11 @@ | |
| 882 | static Th_Sqlite * Th_sqlite_manager( Th_Interp * interp ){ |
| 883 | void * p = Th_Data_Get( interp, Th_Sqlite_KEY ); |
| 884 | return p ? (Th_Sqlite*)p : NULL; |
| 885 | } |
| 886 | |
| 887 | int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt){ |
| 888 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 889 | int i, x; |
| 890 | sqlite3_stmt * s; |
| 891 | sqlite3_stmt ** list = sq->aStmt; |
| 892 | for( i = 0; i < sq->nStmt; ++i ){ |
| @@ -907,11 +907,11 @@ | |
| 907 | sq->aStmt = list; |
| 908 | return x + 1; |
| 909 | } |
| 910 | |
| 911 | |
| 912 | int Th_FinalizeStmt(Th_Interp *interp, int stmtId){ |
| 913 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 914 | sqlite3_stmt * st; |
| 915 | int rc = 0; |
| 916 | assert( stmtId>0 && stmtId<=sq->nStmt ); |
| 917 | st = sq->aStmt[stmtId-1]; |
| @@ -922,30 +922,30 @@ | |
| 922 | }else{ |
| 923 | return 1; |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId){ |
| 928 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 929 | return ((stmtId<1) || (stmtId > sq->nStmt)) |
| 930 | ? NULL |
| 931 | : sq->aStmt[stmtId-1]; |
| 932 | } |
| 933 | |
| 934 | |
| 935 | static void finalizerSqlite( Th_Interp * interp, void * p ){ |
| 936 | Th_Sqlite * sq = Th_sqlite_manager( interp ); |
| 937 | int i; |
| 938 | sqlite3_stmt * st = NULL; |
| 939 | if(!sq) { |
| 940 | fossil_warning("Got a finalizer call for a NULL Th_Sqlite."); |
| 941 | return; |
| 942 | } |
| 943 | for( i = 0; i < sq->nStmt; ++i ){ |
| 944 | st = sq->aStmt[i]; |
| 945 | if(NULL != st){ |
| 946 | fossil_warning("Auto-finalizing unfinalized query_prepare " |
| 947 | "statement id #%d: %s", |
| 948 | i+1, sqlite3_sql(st)); |
| 949 | Th_FinalizeStmt( interp, i+1 ); |
| 950 | } |
| 951 | } |
| 952 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -851,27 +851,27 @@ | |
| 851 | ** by this function. |
| 852 | ** |
| 853 | ** If interp is destroyed before all statements are finalized, |
| 854 | ** it will finalize them but may emit a warning message. |
| 855 | */ |
| 856 | static int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt); |
| 857 | |
| 858 | /* |
| 859 | ** Expects stmtId to be a statement identifier returned by |
| 860 | ** Th_AddStmt(). On success, finalizes the statement and returns 0. |
| 861 | ** On error (statement not found) non-0 is returned. After this |
| 862 | ** call, some subsequent call to Th_AddStmt() may return the |
| 863 | ** same statement ID. |
| 864 | */ |
| 865 | static int Th_FinalizeStmt(Th_Interp *interp, int stmtId); |
| 866 | |
| 867 | /* |
| 868 | ** Fetches the statement with the given ID, as returned by |
| 869 | ** Th_AddStmt(). Returns NULL if stmtId does not refer (or no longer |
| 870 | ** refers) to a statement added via Th_AddStmt(). |
| 871 | */ |
| 872 | static sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId); |
| 873 | |
| 874 | |
| 875 | struct Th_Sqlite { |
| 876 | sqlite3_stmt ** aStmt; |
| 877 | int nStmt; |
| @@ -882,11 +882,11 @@ | |
| 882 | static Th_Sqlite * Th_sqlite_manager( Th_Interp * interp ){ |
| 883 | void * p = Th_Data_Get( interp, Th_Sqlite_KEY ); |
| 884 | return p ? (Th_Sqlite*)p : NULL; |
| 885 | } |
| 886 | |
| 887 | static int Th_AddStmt(Th_Interp *interp, sqlite3_stmt * pStmt){ |
| 888 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 889 | int i, x; |
| 890 | sqlite3_stmt * s; |
| 891 | sqlite3_stmt ** list = sq->aStmt; |
| 892 | for( i = 0; i < sq->nStmt; ++i ){ |
| @@ -907,11 +907,11 @@ | |
| 907 | sq->aStmt = list; |
| 908 | return x + 1; |
| 909 | } |
| 910 | |
| 911 | |
| 912 | static int Th_FinalizeStmt(Th_Interp *interp, int stmtId){ |
| 913 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 914 | sqlite3_stmt * st; |
| 915 | int rc = 0; |
| 916 | assert( stmtId>0 && stmtId<=sq->nStmt ); |
| 917 | st = sq->aStmt[stmtId-1]; |
| @@ -922,30 +922,30 @@ | |
| 922 | }else{ |
| 923 | return 1; |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | static sqlite3_stmt * Th_GetStmt(Th_Interp *interp, int stmtId){ |
| 928 | Th_Sqlite * sq = Th_sqlite_manager(interp); |
| 929 | return ((stmtId<1) || (stmtId > sq->nStmt)) |
| 930 | ? NULL |
| 931 | : sq->aStmt[stmtId-1]; |
| 932 | } |
| 933 | |
| 934 | |
| 935 | static void finalizerSqlite( Th_Interp * interp, void * p ){ |
| 936 | Th_Sqlite * sq = (Th_Sqlite *)p; |
| 937 | int i; |
| 938 | sqlite3_stmt * st = NULL; |
| 939 | if(!sq) { |
| 940 | fossil_warning("Got a finalizer call for a NULL Th_Sqlite."); |
| 941 | return; |
| 942 | } |
| 943 | for( i = 0; i < sq->nStmt; ++i ){ |
| 944 | st = sq->aStmt[i]; |
| 945 | if(NULL != st){ |
| 946 | fossil_warning("Auto-finalizing unfinalized " |
| 947 | "statement id #%d: %s", |
| 948 | i+1, sqlite3_sql(st)); |
| 949 | Th_FinalizeStmt( interp, i+1 ); |
| 950 | } |
| 951 | } |
| 952 |
+19
-8
| --- www/th1_ob.wiki | ||
| +++ www/th1_ob.wiki | ||
| @@ -11,11 +11,11 @@ | ||
| 11 | 11 | Example usage: |
| 12 | 12 | |
| 13 | 13 | <nowiki><pre> |
| 14 | 14 | <th1> |
| 15 | 15 | puts "this is unbuffered" |
| 16 | -ob start | |
| 16 | +ob push # or: ob start (same thing) | |
| 17 | 17 | # all output until the next ob start|end gets collected |
| 18 | 18 | # in a buffer... |
| 19 | 19 | </th1> |
| 20 | 20 | |
| 21 | 21 | this is buffered |
| @@ -23,31 +23,37 @@ | ||
| 23 | 23 | <th1> |
| 24 | 24 | puts "current buffer level = " [ob level] "\n" |
| 25 | 25 | puts "this part is also collected in the buffer." |
| 26 | 26 | |
| 27 | 27 | # Collect the buffer's contents: |
| 28 | -set buf [ob get end] | |
| 28 | +set buf [ob get pop] | |
| 29 | 29 | # That is equivalent to: |
| 30 | 30 | # set buf [ob get] |
| 31 | -# ob end | |
| 31 | +# ob pop | |
| 32 | 32 | |
| 33 | 33 | puts "\nThis is now unbuffered, but we buffered: $buf\n" |
| 34 | 34 | </th1> |
| 35 | 35 | </pre></nowiki> |
| 36 | 36 | |
| 37 | 37 | The functions are summarized below... |
| 38 | 38 | |
| 39 | -<h2>ob start</h2> | |
| 39 | +<h2>ob push|start</h2> | |
| 40 | + | |
| 41 | +<tt>push</tt> and <tt>start</tt> are aliases ("start" comes from the PHP API, but | |
| 42 | +"push" is probably more natural to those working with th1). | |
| 40 | 43 | |
| 41 | 44 | <tt>ob start</tt> pushes a level of buffering onto the buffer stack, such that |
| 42 | 45 | future calls which generate output through the th1-internal mechanism will have it |
| 43 | 46 | transparently redirected to the current buffer. |
| 44 | 47 | |
| 45 | 48 | It is important that every call to <tt>ob start</tt> be followed up (eventually) |
| 46 | 49 | by either <tt>ob end</tt> or <tt>ob get end</tt>. |
| 47 | 50 | |
| 48 | -<h2>ob end</h2> | |
| 51 | +<h2>ob pop|end</h2> | |
| 52 | + | |
| 53 | +<tt>pop</tt> and <tt>end</tt> are aliases ("end" comes from the PHP API, but | |
| 54 | +"pop" is probably more natural to those working with th1). | |
| 49 | 55 | |
| 50 | 56 | This discards any current buffered contents and reverts the output state to |
| 51 | 57 | the one it had before the previous <tt>ob start</tt>. i.e. that might be another |
| 52 | 58 | buffering level or it might be the th1-normal output mechanism. |
| 53 | 59 | |
| @@ -61,15 +67,15 @@ | ||
| 61 | 67 | does not change the buffer stack level. |
| 62 | 68 | |
| 63 | 69 | <h2>ob get</h2> |
| 64 | 70 | |
| 65 | 71 | This fetches the current contents as a string. It optionally accepts |
| 66 | -either <tt>end</tt> or <tt>clean</tt>, in which cases it behaves like | |
| 67 | -either <tt>ob end</tt> or <tt>ob clean</tt>, respectively, in addition | |
| 72 | +either <tt>end</tt> (or its alias <tt>pop</tt>) or <tt>clean</tt>, in which cases it behaves like | |
| 73 | +either <tt>ob end|pop</tt> or <tt>ob clean</tt>, respectively, in addition | |
| 68 | 74 | to returning the buffer contents. i.e. <tt>ob get clean</tt> will |
| 69 | 75 | fetch the contents and clean up the buffer, but does not change the |
| 70 | -buffering level, whereas <tt>ob get end</tt> pops the buffer off the | |
| 76 | +buffering level, whereas <tt>ob get end|pop</tt> pops the buffer off the | |
| 71 | 77 | stack after fetching its contents. |
| 72 | 78 | |
| 73 | 79 | <h2>ob level</h2> |
| 74 | 80 | |
| 75 | 81 | Returns the current buffering level (0 if not buffering). |
| @@ -81,5 +87,10 @@ | ||
| 81 | 87 | fetched the buffer state (<tt>ob get</tt>), reverted TH1 to its |
| 82 | 88 | previous output mechanism, push the buffer state to TH1, revert TH1 |
| 83 | 89 | <em>back</em> to the current buffering state, and then clear the |
| 84 | 90 | current buffer contents (like <tt>ob clean</tt>). This does not change |
| 85 | 91 | the buffering level, though it temporarily behaves as if it does. |
| 92 | + | |
| 93 | +In other words, this function pushes the current buffer contents to the | |
| 94 | +next-lower output mechanism (which may be another ob buffering level, | |
| 95 | +fossil's internal CGI output buffer, or it might be be | |
| 96 | +<tt>fwrite(stdout)</tt>). | |
| 86 | 97 |
| --- www/th1_ob.wiki | |
| +++ www/th1_ob.wiki | |
| @@ -11,11 +11,11 @@ | |
| 11 | Example usage: |
| 12 | |
| 13 | <nowiki><pre> |
| 14 | <th1> |
| 15 | puts "this is unbuffered" |
| 16 | ob start |
| 17 | # all output until the next ob start|end gets collected |
| 18 | # in a buffer... |
| 19 | </th1> |
| 20 | |
| 21 | this is buffered |
| @@ -23,31 +23,37 @@ | |
| 23 | <th1> |
| 24 | puts "current buffer level = " [ob level] "\n" |
| 25 | puts "this part is also collected in the buffer." |
| 26 | |
| 27 | # Collect the buffer's contents: |
| 28 | set buf [ob get end] |
| 29 | # That is equivalent to: |
| 30 | # set buf [ob get] |
| 31 | # ob end |
| 32 | |
| 33 | puts "\nThis is now unbuffered, but we buffered: $buf\n" |
| 34 | </th1> |
| 35 | </pre></nowiki> |
| 36 | |
| 37 | The functions are summarized below... |
| 38 | |
| 39 | <h2>ob start</h2> |
| 40 | |
| 41 | <tt>ob start</tt> pushes a level of buffering onto the buffer stack, such that |
| 42 | future calls which generate output through the th1-internal mechanism will have it |
| 43 | transparently redirected to the current buffer. |
| 44 | |
| 45 | It is important that every call to <tt>ob start</tt> be followed up (eventually) |
| 46 | by either <tt>ob end</tt> or <tt>ob get end</tt>. |
| 47 | |
| 48 | <h2>ob end</h2> |
| 49 | |
| 50 | This discards any current buffered contents and reverts the output state to |
| 51 | the one it had before the previous <tt>ob start</tt>. i.e. that might be another |
| 52 | buffering level or it might be the th1-normal output mechanism. |
| 53 | |
| @@ -61,15 +67,15 @@ | |
| 61 | does not change the buffer stack level. |
| 62 | |
| 63 | <h2>ob get</h2> |
| 64 | |
| 65 | This fetches the current contents as a string. It optionally accepts |
| 66 | either <tt>end</tt> or <tt>clean</tt>, in which cases it behaves like |
| 67 | either <tt>ob end</tt> or <tt>ob clean</tt>, respectively, in addition |
| 68 | to returning the buffer contents. i.e. <tt>ob get clean</tt> will |
| 69 | fetch the contents and clean up the buffer, but does not change the |
| 70 | buffering level, whereas <tt>ob get end</tt> pops the buffer off the |
| 71 | stack after fetching its contents. |
| 72 | |
| 73 | <h2>ob level</h2> |
| 74 | |
| 75 | Returns the current buffering level (0 if not buffering). |
| @@ -81,5 +87,10 @@ | |
| 81 | fetched the buffer state (<tt>ob get</tt>), reverted TH1 to its |
| 82 | previous output mechanism, push the buffer state to TH1, revert TH1 |
| 83 | <em>back</em> to the current buffering state, and then clear the |
| 84 | current buffer contents (like <tt>ob clean</tt>). This does not change |
| 85 | the buffering level, though it temporarily behaves as if it does. |
| 86 |
| --- www/th1_ob.wiki | |
| +++ www/th1_ob.wiki | |
| @@ -11,11 +11,11 @@ | |
| 11 | Example usage: |
| 12 | |
| 13 | <nowiki><pre> |
| 14 | <th1> |
| 15 | puts "this is unbuffered" |
| 16 | ob push # or: ob start (same thing) |
| 17 | # all output until the next ob start|end gets collected |
| 18 | # in a buffer... |
| 19 | </th1> |
| 20 | |
| 21 | this is buffered |
| @@ -23,31 +23,37 @@ | |
| 23 | <th1> |
| 24 | puts "current buffer level = " [ob level] "\n" |
| 25 | puts "this part is also collected in the buffer." |
| 26 | |
| 27 | # Collect the buffer's contents: |
| 28 | set buf [ob get pop] |
| 29 | # That is equivalent to: |
| 30 | # set buf [ob get] |
| 31 | # ob pop |
| 32 | |
| 33 | puts "\nThis is now unbuffered, but we buffered: $buf\n" |
| 34 | </th1> |
| 35 | </pre></nowiki> |
| 36 | |
| 37 | The functions are summarized below... |
| 38 | |
| 39 | <h2>ob push|start</h2> |
| 40 | |
| 41 | <tt>push</tt> and <tt>start</tt> are aliases ("start" comes from the PHP API, but |
| 42 | "push" is probably more natural to those working with th1). |
| 43 | |
| 44 | <tt>ob start</tt> pushes a level of buffering onto the buffer stack, such that |
| 45 | future calls which generate output through the th1-internal mechanism will have it |
| 46 | transparently redirected to the current buffer. |
| 47 | |
| 48 | It is important that every call to <tt>ob start</tt> be followed up (eventually) |
| 49 | by either <tt>ob end</tt> or <tt>ob get end</tt>. |
| 50 | |
| 51 | <h2>ob pop|end</h2> |
| 52 | |
| 53 | <tt>pop</tt> and <tt>end</tt> are aliases ("end" comes from the PHP API, but |
| 54 | "pop" is probably more natural to those working with th1). |
| 55 | |
| 56 | This discards any current buffered contents and reverts the output state to |
| 57 | the one it had before the previous <tt>ob start</tt>. i.e. that might be another |
| 58 | buffering level or it might be the th1-normal output mechanism. |
| 59 | |
| @@ -61,15 +67,15 @@ | |
| 67 | does not change the buffer stack level. |
| 68 | |
| 69 | <h2>ob get</h2> |
| 70 | |
| 71 | This fetches the current contents as a string. It optionally accepts |
| 72 | either <tt>end</tt> (or its alias <tt>pop</tt>) or <tt>clean</tt>, in which cases it behaves like |
| 73 | either <tt>ob end|pop</tt> or <tt>ob clean</tt>, respectively, in addition |
| 74 | to returning the buffer contents. i.e. <tt>ob get clean</tt> will |
| 75 | fetch the contents and clean up the buffer, but does not change the |
| 76 | buffering level, whereas <tt>ob get end|pop</tt> pops the buffer off the |
| 77 | stack after fetching its contents. |
| 78 | |
| 79 | <h2>ob level</h2> |
| 80 | |
| 81 | Returns the current buffering level (0 if not buffering). |
| @@ -81,5 +87,10 @@ | |
| 87 | fetched the buffer state (<tt>ob get</tt>), reverted TH1 to its |
| 88 | previous output mechanism, push the buffer state to TH1, revert TH1 |
| 89 | <em>back</em> to the current buffering state, and then clear the |
| 90 | current buffer contents (like <tt>ob clean</tt>). This does not change |
| 91 | the buffering level, though it temporarily behaves as if it does. |
| 92 | |
| 93 | In other words, this function pushes the current buffer contents to the |
| 94 | next-lower output mechanism (which may be another ob buffering level, |
| 95 | fossil's internal CGI output buffer, or it might be be |
| 96 | <tt>fwrite(stdout)</tt>). |
| 97 |