text:
//--------------------------------------
// UTGB Project
//
// WIGParser.java
// Since: Aug 28, 2009
//
//--------------------------------------
package org.utgenome.format.wig;

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

import org.antlr.runtime.tree.*;

public class WIGParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "Description", "Name", "Value", "Attribute", "Eq", "Dot", "Digit", "HexDigit", "UnicodeChar", "EscapeSequence", "StringChar", "Int", "Frac", "Exp", "WhiteSpace", "StringChars", "String", "Integer", "Double", "Number", "QName"
    };
    public static final int Digit=10;
    public static final int Frac=16;
    public static final int HexDigit=11;
    public static final int Eq=8;
    public static final int Exp=17;
    public static final int Int=15;
    public static final int Description=4;
    public static final int UnicodeChar=12;
    public static final int StringChar=14;
    public static final int Name=5;
    public static final int String=20;
    public static final int Attribute=7;
    public static final int Dot=9;
    public static final int StringChars=19;
    public static final int EscapeSequence=13;
    public static final int QName=24;
    public static final int EOF=-1;
    public static final int Integer=21;
    public static final int Value=6;
    public static final int Double=22;
    public static final int WhiteSpace=18;
    public static final int Number=23;

    // delegates
    // delegators

        public WIGParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public WIGParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);

        }

    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return WIGParser.tokenNames; }
    public String getGrammarFileName() { return "WIG.g"; }

    public static class description_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "description"
    // WIG.g:101:1: description : descriptionName ( attribute )* -> ^( Description descriptionName ( attribute )* ) ;
    public final WIGParser.description_return description() throws RecognitionException {
        WIGParser.description_return retval = new WIGParser.description_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        WIGParser.descriptionName_return descriptionName1 = null;

        WIGParser.attribute_return attribute2 = null;

        RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute");
        RewriteRuleSubtreeStream stream_descriptionName=new RewriteRuleSubtreeStream(adaptor,"rule descriptionName");
        try {
            // WIG.g:101:12: ( descriptionName ( attribute )* -> ^( Description descriptionName ( attribute )* ) )
            // WIG.g:101:14: descriptionName ( attribute )*
            {
            pushFollow(FOLLOW_descriptionName_in_description424);
            descriptionName1=descriptionName();

            state._fsp--;

            stream_descriptionName.add(descriptionName1.getTree());
            // WIG.g:101:30: ( attribute )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==QName) ) {
                    alt1=1;
                }

                switch (alt1) {
            	case 1 :
            	    // WIG.g:101:30: attribute
            	    {
            	    pushFollow(FOLLOW_attribute_in_description426);
            	    attribute2=attribute();

            	    state._fsp--;

            	    stream_attribute.add(attribute2.getTree());

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);

            // AST REWRITE
            // elements: attribute, descriptionName
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 101:41: -> ^( Description descriptionName ( attribute )* )
            {
                // WIG.g:101:44: ^( Description descriptionName ( attribute )* )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(Description, "Description"), root_1);

                adaptor.addChild(root_1, stream_descriptionName.nextTree());
                // WIG.g:101:74: ( attribute )*
                while ( stream_attribute.hasNext() ) {
                    adaptor.addChild(root_1, stream_attribute.nextTree());

                }
                stream_attribute.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

        finally {
        }
        return retval;
    }
    // $ANTLR end "description"

    public static class descriptionName_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "descriptionName"
    // WIG.g:104:1: descriptionName : QName -> Name[$QName.text] ;
    public final WIGParser.descriptionName_return descriptionName() throws RecognitionException {
        WIGParser.descriptionName_return retval = new WIGParser.descriptionName_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token QName3=null;

        Object QName3_tree=null;
        RewriteRuleTokenStream stream_QName=new RewriteRuleTokenStream(adaptor,"token QName");

        try {
            // WIG.g:104:16: ( QName -> Name[$QName.text] )
            // WIG.g:104:18: QName
            {
            QName3=(Token)match(input,QName,FOLLOW_QName_in_descriptionName450);
            stream_QName.add(QName3);

            // AST REWRITE
            // elements:
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 104:24: -> Name[$QName.text]
            {
                adaptor.addChild(root_0, (Object)adaptor.create(Name, (QName3!=null?QName3.getText():null)));

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

        finally {
        }
        return retval;
    }
    // $ANTLR end "descriptionName"

    public static class attribute_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "attribute"
    // WIG.g:106:1: attribute : QName Eq attributeValue -> ^( Attribute Name[$QName.text] attributeValue ) ;
    public final WIGParser.attribute_return attribute() throws RecognitionException {
        WIGParser.attribute_return retval = new WIGParser.attribute_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token QName4=null;
        Token Eq5=null;
        WIGParser.attributeValue_return attributeValue6 = null;

        Object QName4_tree=null;
        Object Eq5_tree=null;
        RewriteRuleTokenStream stream_QName=new RewriteRuleTokenStream(adaptor,"token QName");
        RewriteRuleTokenStream stream_Eq=new RewriteRuleTokenStream(adaptor,"token Eq");
        RewriteRuleSubtreeStream stream_attributeValue=new RewriteRuleSubtreeStream(adaptor,"rule attributeValue");
        try {
            // WIG.g:106:10: ( QName Eq attributeValue -> ^( Attribute Name[$QName.text] attributeValue ) )
            // WIG.g:106:12: QName Eq attributeValue
            {
            QName4=(Token)match(input,QName,FOLLOW_QName_in_attribute464);
            stream_QName.add(QName4);

            Eq5=(Token)match(input,Eq,FOLLOW_Eq_in_attribute466);
            stream_Eq.add(Eq5);

            pushFollow(FOLLOW_attributeValue_in_attribute468);
            attributeValue6=attributeValue();

            state._fsp--;

            stream_attributeValue.add(attributeValue6.getTree());

            // AST REWRITE
            // elements: attributeValue
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 106:36: -> ^( Attribute Name[$QName.text] attributeValue )
            {
                // WIG.g:106:39: ^( Attribute Name[$QName.text] attributeValue )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(Attribute, "Attribute"), root_1);

                adaptor.addChild(root_1, (Object)adaptor.create(Name, (QName4!=null?QName4.getText():null)));
                adaptor.addChild(root_1, stream_attributeValue.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

        finally {
        }
        return retval;
    }
    // $ANTLR end "attribute"

    public static class attributeValue_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "attributeValue"
    // WIG.g:108:1: attributeValue : ( QName | String | Number ) -> Value[$attributeValue.text] ;
    public final WIGParser.attributeValue_return attributeValue() throws RecognitionException {
        WIGParser.attributeValue_return retval = new WIGParser.attributeValue_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token QName7=null;
        Token String8=null;
        Token Number9=null;

        Object QName7_tree=null;
        Object String8_tree=null;
        Object Number9_tree=null;
        RewriteRuleTokenStream stream_String=new RewriteRuleTokenStream(adaptor,"token String");
        RewriteRuleTokenStream stream_Number=new RewriteRuleTokenStream(adaptor,"token Number");
        RewriteRuleTokenStream stream_QName=new RewriteRuleTokenStream(adaptor,"token QName");

        try {
            // WIG.g:108:15: ( ( QName | String | Number ) -> Value[$attributeValue.text] )
            // WIG.g:108:17: ( QName | String | Number )
            {
            // WIG.g:108:17: ( QName | String | Number )
            int alt2=3;
            switch ( input.LA(1) ) {
            case QName:
                {
                alt2=1;
                }
                break;
            case String:
                {
                alt2=2;
                }
                break;
            case Number:
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }

            switch (alt2) {
                case 1 :
                    // WIG.g:108:18: QName
                    {
                    QName7=(Token)match(input,QName,FOLLOW_QName_in_attributeValue487);
                    stream_QName.add(QName7);

                    }
                    break;
                case 2 :
                    // WIG.g:108:26: String
                    {
                    String8=(Token)match(input,String,FOLLOW_String_in_attributeValue491);
                    stream_String.add(String8);

                    }
                    break;
                case 3 :
                    // WIG.g:108:35: Number
                    {
                    Number9=(Token)match(input,Number,FOLLOW_Number_in_attributeValue495);
                    stream_Number.add(Number9);

                    }
                    break;

            }

            // AST REWRITE
            // elements:
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 108:43: -> Value[$attributeValue.text]
            {
                adaptor.addChild(root_0, (Object)adaptor.create(Value, input.toString(retval.start,input.LT(-1))));

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

        finally {
        }
        return retval;
    }
    // $ANTLR end "attributeValue"

    // Delegated rules

    public static final BitSet FOLLOW_descriptionName_in_description424 = new BitSet(new long[]{0x0000000001000002L});
    public static final BitSet FOLLOW_attribute_in_description426 = new BitSet(new long[]{0x0000000001000002L});
    public static final BitSet FOLLOW_QName_in_descriptionName450 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_QName_in_attribute464 = new BitSet(new long[]{0x0000000000000100L});
    public static final BitSet FOLLOW_Eq_in_attribute466 = new BitSet(new long[]{0x0000000001900000L});
    public static final BitSet FOLLOW_attributeValue_in_attribute468 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_QName_in_attributeValue487 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_String_in_attributeValue491 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Number_in_attributeValue495 = new BitSet(new long[]{0x0000000000000002L});

}


text:
<?php
/**
 * Custom functions that act independently of the theme templates
 *
 * Eventually, some of the functionality here could be replaced by core features
 *
 * @package progression
 */

/**
 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
 */
function progression_page_menu_args( $args ) {
	$args['show_home'] = true;
	return $args;
}
add_filter( 'wp_page_menu_args', 'progression_page_menu_args' );

/**
 * Adds custom classes to the array of body classes.
 */
function progression_body_classes( $classes ) {
	// Adds a class of group-blog to blogs with more than 1 published author.
	if ( is_multi_author() ) {
		$classes[] = 'group-blog';
	}

	return $classes;
}
add_filter( 'body_class', 'progression_body_classes' );

/**
 * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
 */
function progression_enhanced_image_navigation( $url, $id ) {
	if ( ! is_attachment() && ! wp_attachment_is_image( $id ) )
		return $url;

	$image = get_post( $id );
	if ( ! empty( $image->post_parent ) && $image->post_parent != $id )
		$url .= '#main';

	return $url;
}
add_filter( 'attachment_link', 'progression_enhanced_image_navigation', 10, 2 );

if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) :
	/**
	 * Filters wp_title to print a neat <title> tag based on what is being viewed.
	 *
	 * @param string $title Default title text for current view.
	 * @param string $sep Optional separator.
	 * @return string The filtered title.
	 */
	function progression_wp_title( $title, $sep ) {
		if ( is_feed() ) {
			return $title;
		}

		global $page, $paged;

		// Add the blog name
		$title .= get_bloginfo( 'name', 'display' );

		// Add the blog description for the home/front page.
		$site_description = get_bloginfo( 'description', 'display' );
		if ( $site_description && ( is_home() || is_front_page() ) ) {
			$title .= " $sep $site_description";
		}

		// Add a page number if necessary:
		if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
			$title .= " $sep " . sprintf( __( 'Page %s', 'progression' ), max( $paged, $page ) );
		}

		return $title;
	}
	add_filter( 'wp_title', 'progression_wp_title', 10, 2 );

	/**
	 * Title shim for sites older than WordPress 4.1.
	 *
	 * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
	 * @todo Remove this function when WordPress 4.3 is released.
	 */
	function progression_render_title() {
		?>
		<title><?php wp_title( '|', true, 'right' ); ?></title>
		<?php
	}
	add_action( 'wp_head', 'progression_render_title' );
endif;

redpajama_set_name: RedPajamaGithub


text:
@implementation NSMutableSet (DWRandom)

- (id)randomObject
{
    if ([self count] > 0) {
        NSUInteger randomIndex = arc4random_uniform((unsigned int)[self count]);
        NSArray* array = [self allObjects];
        return array[randomIndex];
    }
    else {
        return nil;
    }
}

@end


text:
import conf
import g

import os
import stat
import sys
import time
import traceback
import zipfile

from item.jobsq.job_status import Job_Status

__all__ = ('Work_Item_Job',)

log = g.log.getLogger('work_item_job')

# ***

class Work_Item_Job(object):

   __slots__ = (
      'wtem',
      'mr_do',
      'stage_lookup',
      # For derived classes
      )

   # *** Constructor

   def __init__(self, wtem, mr_do):
      self.wtem = wtem
      self.mr_do = mr_do
      self.stage_lookup = None
      self.make_stage_lookup()

   #
   def make_stage_lookup(self):
      g.assurt(False) # Abstract

# ***

   class Ccp_Preempted(Exception):
      '''This exception lets us easily stop a job before it's finished.'''
      def __init__(self, message=''):
         Exception.__init__(self, message)

   # *** Stage processing framework.

   #
   def process_request_(self):

      # To support pause/resume, our stage fcns. are not always called (i.e.,
      # if they were called and completed during a previous operation, before
      # the pause), so put common callouts here... or in derived classes.

      log.debug('process_request called: wtem: %s' % (self.wtem,))
      log.debug(' >> wtem.latest_step: %s' % (self.wtem.latest_step,))
      log.debug(' >> wtem.latest_step.stage_num: %s'
                % (self.wtem.latest_step.stage_num,))

      time_0 = time.time()

      # Pick up where we left off.
      g.assurt(self.wtem.latest_step.status_text == 'working')
      last_stage_num = self.wtem.latest_step.stage_num or 0
      if not last_stage_num:
         self.process_stage_0()
         last_stage_num = 1

      try:
         # Process the job, stage by stage. The processing fcns. are listed
         # in self.stage_lookup. If a job is suspended or cancelled or if
         # Mr. Do! is shutting down, an exception is raised to escape the
         # processing loop; otherwise, the loop continues until the job is
         # completely processed.

         go_again = True
         while go_again:
            go_again = False
            stage_1 = last_stage_num - 1
            stage_n = self.get_num_stages()
            for lookup_num in xrange(stage_1, stage_n):
               log.debug('process_request_: on stage %d' % ((lookup_num + 1),))
               stage_fcn = self.stage_lookup[lookup_num]
               stage_fcn()
               # Indicate that this stage is complete. This also checks if the
               # user cancelled us or if Mr. Do! is stopping (and raises if so)
               self.stage_finalize()
               g.assurt(self.wtem.latest_step.stage_num == (lookup_num + 1))
               last_stage_num += 1
               # Substages are allowed to change the stage count.
               cur_stage_n = self.get_num_stages()
               if cur_stage_n != stage_n:
                  stage_n = cur_stage_n
                  log.debug('process_request_: new get_num_stages: %d'
                            % (stage_n,))
                  self.wtem.update_num_stages(stage_n)
                  go_again = True

      except Work_Item_Job.Ccp_Preempted, e:
         # This error means an outside force intervened and we should preempt
         # the job and shutdown. This could mean the job was canceled or
         # suspended, or that Mr. Do! is shutting down.
         log.debug('process_request_: Ccp_Preempted detected.')
         pass

      finally:
         self.job_cleanup()

      # Update the cumulative timer keeper.
      past_time = self.wtem.job_def.job_time_all or 0.0
      self.wtem.job_def.job_time_all = past_time + (time.time() - time_0)

   # *** Built-in Stage 0 fcn.

   #
   # Stage 0 simply records how many stages we expect to run, so the user has
   # some idea what to expect (though some stages complete almost immediately
   # and other stages could take hours to complete).
   #
   # Derived classes should implement process_stage_1 through process_stage_n.
   def process_stage_0(self):

      # Provide the name of the current stage.
      self.stage_initialize(stage_name='Starting up')

      # Perform the current stage.
      num_stages = self.get_num_stages()
      log.debug('process_stage_0: wtem.update_num_stages: %s' % (num_stages,))
      self.wtem.update_num_stages(num_stages)

      # Derived classes' stage fcn. do not call stage_finalize, just
      # stage_initialize. We call it here because process_stage_0 is special.
      self.stage_finalize()

   #
   def get_num_stages(self):
      n_stages = len(self.stage_lookup)
      g.assurt(n_stages > 0)
      return n_stages

   #
   def job_cleanup(self):
      # If the job failed, it's marked as such, otherwise, it's still marked
      # 'working'.
      if (self.wtem.latest_step.status_text in Job_Status.finished_statuses):
         # If we caught an error, we marked the job failed. If Mr. Do! is being
         # shutdown, we marked 'aborted'. If the user clicked Cancel in the
         # client, we mark 'canceled' (or 'suspended' for Suspend). So we only
         # won't have marked 'complete' if we're here
         g.assurt(self.wtem.latest_step.status_text != 'complete')
         pass # Already in a final state.
      else:
         log.debug('job_cleanup: marking complete.')
         g.assurt(self.wtem.latest_step.status_text == 'working')
         qb = None
         self.mr_do.stage_create_next(qb, self.wtem, 'complete')

   # *** Job-level status change.

   #
   def job_mark_complete(self):
      self.stage_initialize(stage_name='Finishing')
      # Raise an error so our cleanup fcn. is called. We'll mark complete
      # after we've cleaned up.
      raise Work_Item_Job.Ccp_Preempted()

   #
   # We can mark jobs failed for reasons that are the user's fault, or reasons
   # that are our own. Use warn to control the log file level.
   def job_mark_failed(self, failure_reason, warn=True):
      self.mr_do.process_failure(qb=None, wtem=self.wtem,
                  failure_reason=failure_reason, warn=warn)
      raise Work_Item_Job.Ccp_Preempted()

   # *** Stage-level status change.

   #
   def stage_initialize(self, stage_name):
      self.stage_work_item_update(stage_name=stage_name)

   #
   def stage_finalize(self):
      self.stage_work_item_update(stage_progress=100)

   #
   def stage_update(self, stage_progress):
      self.stage_work_item_update(stage_progress=stage_progress)

   #
   def stage_work_item_update(self, stage_name=None, stage_progress=None):

      # BUG 2688: Use transaction_retryable?

      # Refresh the step, in case the user canceled or suspended the job.
      # But keep a copy of callback_def, which a stage fcn. may have updated.
      self.wtem.latest_step.callback_data_prepare()
      callback_def = self.wtem.latest_step.callback_def
      log.verbose('stage_work_item_update: getting row lock: stack_id: %d'
                  % (self.wtem.stack_id,))
      self.wtem, qb = self.mr_do.wtem_refresh(self.wtem)
      # We've now got a lock on the item.

      # Restore the callback_def. The one in the database is older than the one
      # in Python.
      self.wtem.latest_step.reset_callback_def(callback_def)

      # If the caller passed in a stage_name, create a new stage.
      start_new_stage = (stage_name is not None)
      if start_new_stage:
         g.assurt(stage_name)
         g.assurt(not stage_progress)
      else:
         g.assurt(stage_progress >= 0)
         stage_name = self.wtem.latest_step.stage_name

      # Set the stage number. Either preserve the current number, increment it,
      # or -- for the very first stage (process_stage_0) -- set it to 0.
      stage_num = self.wtem.latest_step.stage_num
      if start_new_stage:
         if stage_num is not None:
            stage_num += 1
         else:
            stage_num = 0
      g.assurt(stage_num >= 0)

      # The new progress is passed in or inferred.
      if start_new_stage:
         stage_progress = 0
      else:
         stage_progress >= self.wtem.latest_step.stage_progress

      g.assurt((stage_progress >= 0) and (stage_progress <= 100))

      # The status_text is whatever it says in the database. Generally, this is
      # 'working', unless the user or a system event intervened (and set it to,
      # e.g., 'suspending' or 'canceling').
      status_text = self.wtem.latest_step.status_text
      g.assurt(status_text in ('working', 'canceling', 'suspending',))

      # Update the work item step's row in the database before checking for
      # shutdown conditions.
      if not start_new_stage:
         self.wtem.stage_update_current(qb, stage_num, stage_progress)
         # No need to lock here: we're just updating the stage progress.
         qb.db.transaction_begin_rw()
         log.verbose1('stage_work_item_update: updated stage: %s'
                      % (self.wtem.latest_step,))
      else:
         # The previous stage should be set to 100%.
         g.assurt((self.wtem.latest_step.stage_progress == 100)
                  or (stage_num == 0))

      # Check if we need to quit early.
      new_status_text = None
      if not self.mr_do.jobs_thread.keep_running.isSet():
         log.debug(
            'stage_work_item_update: suspending job (jobs thread is exiting')
         new_status_text = 'aborted'
      if status_text == 'suspending':
         log.debug('stage_work_item_update: suspending job...')
         new_status_text = 'suspended'
      elif status_text == 'canceling':
         log.debug('stage_work_item_update: canceling job...')
         new_status_text = 'canceled'
      elif status_text != 'working':
         g.assurt(self.wtem.latest_step.status_text
                  in Job_Status.finished_statuses)
         g.assurt(False) # This shouldn't happen, right?
      else:
         g.assurt(status_text == 'working')

      if new_status_text:
         # The last status message was either a stage update, or a
         # canceling/suspending request. Write the final status, either
         # aborted, suspended, or canceled.
         self.wtem.stage_create_next(qb, new_status_text, cancellable=False)
      elif start_new_stage:
         # Make a new row for the next stage.
         log.debug('============ Starting stage %d / %s ==='
                   % (stage_num, stage_name,))
         self.wtem.stage_create_next(qb, 'working', stage_num, stage_name,
                                     cancellable=True)

      # Record update and release the row lock on the work item.
      qb.db.transaction_commit()
      qb.db.close()
      qb.db = None

      if new_status_text:
         raise Work_Item_Job.Ccp_Preempted()

   # ***

   #
   def prog_update(self, prog_log):

      # This is called periodically by the prog logger. Update the status.

      if prog_log.loop_max:
         new_progress = int(100.0 * float(prog_log.progress)
                                  / float(prog_log.loop_max))
      else:
         log.warning('prog_update: no loop_max')
         new_progress = 0

      # Let process_request_ finalize the work item: don't show 100, show at
      # most 99% instead.
      if new_progress > 99:
         new_progress = 99

      # Don't bother updating unless the progress is different.
      if self.wtem.latest_step.stage_progress != new_progress:
         self.stage_work_item_update(stage_progress=new_progress)

   # ***

   #
   def make_working_directories(self):

      # We need a unique target directory. The work item already has dibs on a
      # unique UUID in the /ccp/var/cpdumps directory, so we'll just use that
      # as our base.

      # We use two directories, a '.out' and a '.fin'. The out-dir is populated
      # with files that the job creates, and the fin-dir just contains a zip
      # of the out-dir.

      # Make the directories.
      opath = self.make_working_directory('.out')
      ppath = self.make_working_directory('.fin')

      return opath

   #
   def make_working_directory(self, dir_suffix):

      # Make a name for the new directory.
      new_name = '%s%s' % (self.wtem.local_file_guid, dir_suffix,)
      new_path = os.path.join(conf.shapefile_directory, new_name)
      # Make the new directory.
      g.assurt(not os.path.exists(new_path))
      try:
         # MAGIC_NUMBER: Setup the directory permissions.
         os.mkdir(new_path, 02775)
         # 2013.05.06: Need to chmod?
         os.chmod(new_path, 02775)
      except OSError, e:
         log.error('do_reserve_directory: OSError: %s' % (str(e),))
         raise Exception(
            'route_analysis: Unable to reserve shaepfile directory.')

      return new_path

   #
   def do_create_archive(self):

      self.stage_initialize('Archiving output files')

      # Make the path, e.g., /ccp/var/cpdumps/{GUID}.out/Cyclopath_Export.zip

      oname = '%s.out' % self.wtem.local_file_guid
      opath = os.path.join(conf.shapefile_directory, oname)

      pname = '%s.fin' % self.wtem.local_file_guid
      ppath = os.path.join(conf.shapefile_directory, pname)

      zipfile_name = self.wtem.get_zipname()
      zname = '%s.zip' % (zipfile_name,)
      zpath = os.path.join(ppath, zname)

      log.verbose('do_create_archive: opath: %s / zpath: %s / wtem: %s'
                  % (opath, zpath, self.wtem,))

      # Make the zipfile.
      #
      # It might be easiest to use subprocess to call *nix's zip. But we do it
      # the hard way, in Python, using os.walk.

      zfile = zipfile.ZipFile(zpath, 'w')

      for dirpath, dirnames, filenames in os.walk(opath, topdown=True):
         log.verbose(' >> dirpath: %s' % dirpath)
         log.verbose(' >> dirnames: %s' % dirnames)
         log.verbose(' >> filenames: %s' % filenames)
         for fname in filenames:
            is_source = False
            log.verbose('dirpath: %s / fname: %s' % (dirpath, fname,))
            srcpath = os.path.join(opath, dirpath, fname)
            # The zip path should be relative, not absolute.
            zippath = srcpath.replace(opath, '').lstrip(os.path.sep)
            zfile.write(srcpath, arcname=zippath)

      zfile.close()

      try:
         # E.g., chmod 664
         os.chmod(zpath,   stat.S_IRUSR | stat.S_IWUSR
                         | stat.S_IRGRP | stat.S_IWGRP
                         | stat.S_IROTH)
      except OSError, e:
         # Not all work item types use all the exts we've defined.
         # NOTE: If a work item uses an ext not in local_file_exts,
         #       we won't delete it.
         log.error('do_create_archive: cannot chmod: %s' % (str(e),))

# FIXME: This should run after cleanup, eh??
   #
   def do_notify_users(self):

      self.stage_initialize('Notifying users')

      log.debug('do_notify_users: email_on_finish: %s'
                % (self.wtem.email_on_finish,))

      # FIXME: Implement this.

# ***

if (__name__ == '__main__'):
   pass


text:
using System;

/*
    Problem 8. Numbers from 1 to n

    Write a program that reads an integer number n from the console and prints all the numbers in the interval [1..n], each on a single line.
    Note: You may need to use a for-loop.
*/

class NumbersFromOneToN
{
    static void Main()
    {
        // Get the number n from console
        Console.Write("Enter integer number n: ");
        int num;

        while (!(int.TryParse(Console.ReadLine(), out num)))
        {
            Console.WriteLine("Input was not in correct format. You must enter integer number!");
            Console.Write("Enter integer number n: ");
        }
        // End of getting the number

        // Print the numbers
        for (int i = 1; i <= num; i++)
        {
            Console.WriteLine(i);
        }
    }
}


text:
layout: page
title: Strong - Mays Wedding
date: 2016-05-24
author: Peter Leonard
tags: weekly links, java
status: published
summary: Mauris sit amet tortor dui. Aliquam erat.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 05/31/2018
  endDate: 06/04/2018
  ctyhocn: AGSGHHX
  groupCode: SMW
published: true
---
Morbi non pellentesque velit. Sed luctus, sem vitae lobortis auctor, nulla risus dignissim lectus, venenatis suscipit sem dolor nec dolor. Etiam in ante tortor. Aenean in imperdiet nisi, vel lacinia nisl. Quisque faucibus tempor metus, sit amet finibus sem lobortis vitae. Integer faucibus elit ac neque bibendum, eget ultrices tellus volutpat. Etiam porta tortor et lectus egestas semper. Donec ornare laoreet libero, at lacinia enim malesuada nec. Vestibulum auctor, lectus nec consequat lacinia, turpis sem bibendum dolor, sed auctor erat neque ut velit. Cras gravida dolor ut ante pharetra fermentum.

1 Fusce rutrum eros vitae mi consectetur, eget commodo mi tincidunt
1 Fusce at odio eget ipsum bibendum tempus
1 Morbi fringilla turpis sed eros dignissim, sed placerat quam gravida
1 Aliquam rhoncus ex vitae augue lobortis, lacinia rutrum nunc mollis
1 Nunc nec lorem eu nisi ullamcorper scelerisque
1 Cras vitae arcu vel lectus sagittis molestie sed fringilla augue.

Etiam et turpis hendrerit, porttitor ante id, posuere turpis. Sed non pharetra sem. Donec sed turpis nec tellus mollis rutrum. Aenean id urna ornare, hendrerit est et, facilisis velit. Aliquam ante erat, aliquet rhoncus consectetur in, condimentum eu lorem. In euismod sapien eget turpis pulvinar faucibus. Donec sagittis sem at mattis ornare.


text:
package com.percyvega.service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.percyvega.model.Carrier;
import com.percyvega.model.CarrierInquiry;
import com.percyvega.model.Status;
import com.percyvega.repository.Db2RestRepository;
import com.percyvega.util.JacksonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;

@Service
public class Db2RestServiceImpl implements Db2RestService {

    private static final Logger logger = LoggerFactory.getLogger(Db2RestServiceImpl.class);

    private Db2RestRepository db2RestRepository;

    @Autowired
    public Db2RestServiceImpl(Db2RestRepository db2RestRepository) {
        this.db2RestRepository = db2RestRepository;
    }

    @Override
    @Transactional
    public Collection<CarrierInquiry> find(String statusName, String carrierName, int count) throws DataAccessException {
        Status status = Status.getByName(statusName);
        Carrier carrier = Carrier.getByName(carrierName);

        if (status == null)
            throw new RuntimeException(statusName + " is not a valid Status");
        if (carrier == null)
            throw new RuntimeException(carrierName + " is not a valid Carrier");
        if (count < 1 || count > 150)
            throw new RuntimeException(count + " is not a valid count value (1-150)");

        Collection<CarrierInquiry> carrierInquiries = db2RestRepository.find(status.getName(), carrier.getName(), count);

        for(CarrierInquiry carrierInquiry : carrierInquiries) {
            try {
                logger.debug("Processing: " + JacksonUtil.toJson(carrierInquiry));
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }

        return carrierInquiries;
    }

    @Override
    @Transactional
    public Collection<CarrierInquiry> findAndUpdate(String oldStatusName, String newStatusName, String carrierName, int count) throws DataAccessException {
        Status oldStatus = Status.getByName(oldStatusName);
        Status newStatus = Status.getByName(newStatusName);
        Carrier carrier = Carrier.getByName(carrierName);

        if (oldStatus == null)
            throw new RuntimeException(oldStatusName + " is not a valid old Status");
        if (newStatus == null)
            throw new RuntimeException(newStatusName + " is not a valid new Status");
        if (carrier == null)
            throw new RuntimeException(carrierName + " is not a valid Carrier");
        if (count < 1 || count > 150)
            throw new RuntimeException(count + " is not a valid count value (1-150)");

        Collection<CarrierInquiry> carrierInquiries = db2RestRepository.find(oldStatus.getName(), carrier.getName(), count);

        for(CarrierInquiry carrierInquiry : carrierInquiries) {
            try {
                logger.debug("Processing: " + JacksonUtil.toJson(carrierInquiry));
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
            carrierInquiry.setStatus(newStatus);
            carrierInquiry.setTryCount(carrierInquiry.getTryCount() + 1);
            save(carrierInquiry);
        }
        return carrierInquiries;
    }

    @Override
    public void save(CarrierInquiry carrierInquiry) throws DataAccessException {
        db2RestRepository.save(carrierInquiry);
    }

}


text:
//===------ DarwinToolChains.cpp - Job invocations (Darwin-specific) ------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#include "ToolChains.h"

#include "swift/Basic/Dwarf.h"
#include "swift/Basic/LLVM.h"
#include "swift/Basic/Platform.h"
#include "swift/Basic/Range.h"
#include "swift/Basic/TaskQueue.h"
#include "swift/Config.h"
#include "swift/Driver/Compilation.h"
#include "swift/Driver/Driver.h"
#include "swift/Driver/Job.h"
#include "swift/Frontend/Frontend.h"
#include "swift/Option/Options.h"
#include "clang/Basic/Version.h"
#include "clang/Driver/Util.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"

using namespace swift;
using namespace swift::driver;
using namespace llvm::opt;

std::string
toolchains::Darwin::findProgramRelativeToSwiftImpl(StringRef name) const {
  StringRef swiftPath = getDriver().getSwiftProgramPath();
  StringRef swiftBinDir = llvm::sys::path::parent_path(swiftPath);

  // See if we're in an Xcode toolchain.
  bool hasToolchain = false;
  llvm::SmallString<128> path{swiftBinDir};
  llvm::sys::path::remove_filename(path); // bin
  llvm::sys::path::remove_filename(path); // usr
  if (llvm::sys::path::extension(path) == ".xctoolchain") {
    hasToolchain = true;
    llvm::sys::path::remove_filename(path); // *.xctoolchain
    llvm::sys::path::remove_filename(path); // Toolchains
    llvm::sys::path::append(path, "usr", "bin");
  }

  StringRef paths[] = {swiftBinDir, path};
  auto pathsRef = llvm::makeArrayRef(paths);
  if (!hasToolchain)
    pathsRef = pathsRef.drop_back();

  auto result = llvm::sys::findProgramByName(name, pathsRef);
  if (result)
    return result.get();
  return {};
}

ToolChain::InvocationInfo
toolchains::Darwin::constructInvocation(const InterpretJobAction &job,
                                        const JobContext &context) const {
  InvocationInfo II = ToolChain::constructInvocation(job, context);

  SmallString<128> runtimeLibraryPath;
  getRuntimeLibraryPath(runtimeLibraryPath, context.Args, /*Shared=*/true);

  addPathEnvironmentVariableIfNeeded(II.ExtraEnvironment, "DYLD_LIBRARY_PATH",
                                     ":", options::OPT_L, context.Args,
                                     runtimeLibraryPath);
  addPathEnvironmentVariableIfNeeded(II.ExtraEnvironment, "DYLD_FRAMEWORK_PATH",
                                     ":", options::OPT_F, context.Args);
  // FIXME: Add options::OPT_Fsystem paths to DYLD_FRAMEWORK_PATH as well.
  return II;
}

static StringRef
getDarwinLibraryNameSuffixForTriple(const llvm::Triple &triple) {
  switch (getDarwinPlatformKind(triple)) {
  case DarwinPlatformKind::MacOS:
    return "osx";
  case DarwinPlatformKind::IPhoneOS:
    return "ios";
  case DarwinPlatformKind::IPhoneOSSimulator:
    return "iossim";
  case DarwinPlatformKind::TvOS:
    return "tvos";
  case DarwinPlatformKind::TvOSSimulator:
    return "tvossim";
  case DarwinPlatformKind::WatchOS:
    return "watchos";
  case DarwinPlatformKind::WatchOSSimulator:
    return "watchossim";
  }
  llvm_unreachable("Unsupported Darwin platform");
}

std::string toolchains::Darwin::sanitizerRuntimeLibName(StringRef Sanitizer,
                                                        bool shared) const {
  return (Twine("libclang_rt.") + Sanitizer + "_" +
          getDarwinLibraryNameSuffixForTriple(this->getTriple()) +
          (shared ? "_dynamic.dylib" : ".a"))
      .str();
}

static void addLinkRuntimeLibRPath(const ArgList &Args,
                                   ArgStringList &Arguments,
                                   StringRef DarwinLibName,
                                   const ToolChain &TC) {
  // Adding the rpaths might negatively interact when other rpaths are involved,
  // so we should make sure we add the rpaths last, after all user-specified
  // rpaths. This is currently true from this place, but we need to be
  // careful if this function is ever called before user's rpaths are emitted.
  assert(DarwinLibName.endswith(".dylib") && "must be a dynamic library");

  // Add @executable_path to rpath to support having the dylib copied with
  // the executable.
  Arguments.push_back("-rpath");
  Arguments.push_back("@executable_path");

  // Add the path to the resource dir to rpath to support using the dylib
  // from the default location without copying.

  SmallString<128> ClangLibraryPath;
  TC.getClangLibraryPath(Args, ClangLibraryPath);

  Arguments.push_back("-rpath");
  Arguments.push_back(Args.MakeArgString(ClangLibraryPath));
}

static void addLinkSanitizerLibArgsForDarwin(const ArgList &Args,
                                             ArgStringList &Arguments,
                                             StringRef Sanitizer,
                                             const ToolChain &TC,
                                             bool shared = true) {
  // Sanitizer runtime libraries requires C++.
  Arguments.push_back("-lc++");
  // Add explicit dependency on -lc++abi, as -lc++ doesn't re-export
  // all RTTI-related symbols that are used.
  Arguments.push_back("-lc++abi");

  auto LibName = TC.sanitizerRuntimeLibName(Sanitizer, shared);
  TC.addLinkRuntimeLib(Args, Arguments, LibName);

  if (shared)
    addLinkRuntimeLibRPath(Args, Arguments, LibName, TC);
}

/// Runs xcrun -f clang in order to find the location of Clang for
/// the currently active Xcode.
///
/// We get the "currently active" part by passing through the DEVELOPER_DIR
/// environment variable (along with the rest of the environment).
static bool findXcodeClangPath(llvm::SmallVectorImpl<char> &path) {
  assert(path.empty());

  auto xcrunPath = llvm::sys::findProgramByName("xcrun");
  if (!xcrunPath.getError()) {
    const char *args[] = {"-f", "clang", nullptr};
    sys::TaskQueue queue;
    queue.addTask(xcrunPath->c_str(), args, /*Env=*/llvm::None,
                  /*Context=*/nullptr,
                  /*SeparateErrors=*/true);
    queue.execute(nullptr,
                  [&path](sys::ProcessId PID, int returnCode, StringRef output,
                          StringRef errors,
                          sys::TaskProcessInformation ProcInfo,
                          void *unused) -> sys::TaskFinishedResponse {
                    if (returnCode == 0) {
                      output = output.rtrim();
                      path.append(output.begin(), output.end());
                    }
                    return sys::TaskFinishedResponse::ContinueExecution;
                  });
  }

  return !path.empty();
}

static void addVersionString(const ArgList &inputArgs, ArgStringList &arguments,
                             unsigned major, unsigned minor, unsigned micro) {
  llvm::SmallString<8> buf;
  llvm::raw_svector_ostream os{buf};
  os << major << '.' << minor << '.' << micro;
  arguments.push_back(inputArgs.MakeArgString(os.str()));
}

ToolChain::InvocationInfo
toolchains::Darwin::constructInvocation(const LinkJobAction &job,
                                        const JobContext &context) const {
  assert(context.Output.getPrimaryOutputType() == file_types::TY_Image &&
         "Invalid linker output type.");

  if (context.Args.hasFlag(options::OPT_static_executable,
                           options::OPT_no_static_executable, false)) {
    llvm::report_fatal_error("-static-executable is not supported on Darwin");
  }

  const Driver &D = getDriver();
  const llvm::Triple &Triple = getTriple();

  // Configure the toolchain.
  // By default, use the system `ld` to link.
  const char *LD = "ld";
  if (const Arg *A = context.Args.getLastArg(options::OPT_tools_directory)) {
    StringRef toolchainPath(A->getValue());

    // If there is a 'ld' in the toolchain folder, use that instead.
    if (auto toolchainLD =
            llvm::sys::findProgramByName("ld", {toolchainPath})) {
      LD = context.Args.MakeArgString(toolchainLD.get());
    }
  }

  InvocationInfo II = {LD};
  ArgStringList &Arguments = II.Arguments;

  if (context.shouldUseInputFileList()) {
    Arguments.push_back("-filelist");
    Arguments.push_back(context.getTemporaryFilePath("inputs", "LinkFileList"));
    II.FilelistInfos.push_back({Arguments.back(), file_types::TY_Object,
                                FilelistInfo::WhichFiles::Input});
  } else {
    addPrimaryInputsOfType(Arguments, context.Inputs, context.Args,
                           file_types::TY_Object);
  }

  addInputsOfType(Arguments, context.InputActions, file_types::TY_Object);

  if (context.OI.CompilerMode == OutputInfo::Mode::SingleCompile)
    addInputsOfType(Arguments, context.Inputs, context.Args,
                    file_types::TY_SwiftModuleFile, "-add_ast_path");
  else
    addPrimaryInputsOfType(Arguments, context.Inputs, context.Args,
                           file_types::TY_SwiftModuleFile, "-add_ast_path");

  // Add all .swiftmodule file inputs as arguments, preceded by the
  // "-add_ast_path" linker option.
  addInputsOfType(Arguments, context.InputActions,
                  file_types::TY_SwiftModuleFile, "-add_ast_path");

  switch (job.getKind()) {
  case LinkKind::None:
    llvm_unreachable("invalid link kind");
  case LinkKind::Executable:
    // The default for ld; no extra flags necessary.
    break;
  case LinkKind::DynamicLibrary:
    Arguments.push_back("-dylib");
    break;
  }

  assert(Triple.isOSDarwin());

  // FIXME: If we used Clang as a linker instead of going straight to ld,
  // we wouldn't have to replicate Clang's logic here.
  bool wantsObjCRuntime = false;
  if (Triple.isiOS())
    wantsObjCRuntime = Triple.isOSVersionLT(9);
  else if (Triple.isMacOSX())
    wantsObjCRuntime = Triple.isMacOSXVersionLT(10, 11);

  if (context.Args.hasFlag(options::OPT_link_objc_runtime,
                           options::OPT_no_link_objc_runtime,
                           /*Default=*/wantsObjCRuntime)) {
    llvm::SmallString<128> ARCLiteLib(D.getSwiftProgramPath());
    llvm::sys::path::remove_filename(ARCLiteLib); // 'swift'
    llvm::sys::path::remove_filename(ARCLiteLib); // 'bin'
    llvm::sys::path::append(ARCLiteLib, "lib", "arc");

    if (!llvm::sys::fs::is_directory(ARCLiteLib)) {
      // If we don't have a 'lib/arc/' directory, find the "arclite" library
      // relative to the Clang in the active Xcode.
      ARCLiteLib.clear();
      if (findXcodeClangPath(ARCLiteLib)) {
        llvm::sys::path::remove_filename(ARCLiteLib); // 'clang'
        llvm::sys::path::remove_filename(ARCLiteLib); // 'bin'
        llvm::sys::path::append(ARCLiteLib, "lib", "arc");
      }
    }

    if (!ARCLiteLib.empty()) {
      llvm::sys::path::append(ARCLiteLib, "libarclite_");
      ARCLiteLib += getPlatformNameForTriple(Triple);
      ARCLiteLib += ".a";

      Arguments.push_back("-force_load");
      Arguments.push_back(context.Args.MakeArgString(ARCLiteLib));

      // Arclite depends on CoreFoundation.
      Arguments.push_back("-framework");
      Arguments.push_back("CoreFoundation");
    } else {
      // FIXME: We should probably diagnose this, but this is not a place where
      // we can emit diagnostics. Silently ignore it for now.
    }
  }

  context.Args.AddAllArgValues(Arguments, options::OPT_Xlinker);
  context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group);
  for (const Arg *arg :
       context.Args.filtered(options::OPT_F, options::OPT_Fsystem)) {
    Arguments.push_back("-F");
    Arguments.push_back(arg->getValue());
  }

  if (context.Args.hasArg(options::OPT_enable_app_extension)) {
    // Keep this string fixed in case the option used by the
    // compiler itself changes.
    Arguments.push_back("-application_extension");
  }

  // Linking sanitizers will add rpaths, which might negatively interact when
  // other rpaths are involved, so we should make sure we add the rpaths after
  // all user-specified rpaths.
  if (context.OI.SelectedSanitizers & SanitizerKind::Address)
    addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "asan", *this);

  if (context.OI.SelectedSanitizers & SanitizerKind::Thread)
    addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "tsan", *this);

  // Only link in libFuzzer for executables.
  if (job.getKind() == LinkKind::Executable &&
      (context.OI.SelectedSanitizers & SanitizerKind::Fuzzer))
    addLinkSanitizerLibArgsForDarwin(context.Args, Arguments, "fuzzer", *this,
                                     /*shared=*/false);

  if (context.Args.hasArg(options::OPT_embed_bitcode,
                          options::OPT_embed_bitcode_marker)) {
    Arguments.push_back("-bitcode_bundle");
  }

  if (!context.OI.SDKPath.empty()) {
    Arguments.push_back("-syslibroot");
    Arguments.push_back(context.Args.MakeArgString(context.OI.SDKPath));
  }

  Arguments.push_back("-lobjc");
  Arguments.push_back("-lSystem");

  Arguments.push_back("-arch");
  Arguments.push_back(context.Args.MakeArgString(getTriple().getArchName()));

  // Add the runtime library link path, which is platform-specific and found
  // relative to the compiler.
  SmallString<128> RuntimeLibPath;
  getRuntimeLibraryPath(RuntimeLibPath, context.Args, /*Shared=*/true);

  // Link the standard library.
  Arguments.push_back("-L");
  if (context.Args.hasFlag(options::OPT_static_stdlib,
                           options::OPT_no_static_stdlib, false)) {
    SmallString<128> StaticRuntimeLibPath;
    getRuntimeLibraryPath(StaticRuntimeLibPath, context.Args, /*Shared=*/false);
    Arguments.push_back(context.Args.MakeArgString(StaticRuntimeLibPath));
    Arguments.push_back("-lc++");
    Arguments.push_back("-framework");
    Arguments.push_back("Foundation");
    Arguments.push_back("-force_load_swift_libs");
  } else {
    Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));
    // FIXME: We probably shouldn't be adding an rpath here unless we know ahead
    // of time the standard library won't be copied. SR-1967
    Arguments.push_back("-rpath");
    Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));
  }

  if (context.Args.hasArg(options::OPT_profile_generate)) {
    SmallString<128> LibProfile(RuntimeLibPath);
    llvm::sys::path::remove_filename(LibProfile); // remove platform name
    llvm::sys::path::append(LibProfile, "clang", "lib", "darwin");

    StringRef RT;
    if (Triple.isiOS()) {
      if (Triple.isTvOS())
        RT = "tvos";
      else
        RT = "ios";
    } else if (Triple.isWatchOS()) {
      RT = "watchos";
    } else {
      assert(Triple.isMacOSX());
      RT = "osx";
    }

    StringRef Sim;
    if (tripleIsAnySimulator(Triple)) {
      Sim = "sim";
    }

    llvm::sys::path::append(LibProfile,
                            "libclang_rt.profile_" + RT + Sim + ".a");

    // FIXME: Continue accepting the old path for simulator libraries for now.
    if (!Sim.empty() && !llvm::sys::fs::exists(LibProfile)) {
      llvm::sys::path::remove_filename(LibProfile);
      llvm::sys::path::append(LibProfile, "libclang_rt.profile_" + RT + ".a");
    }

    Arguments.push_back(context.Args.MakeArgString(LibProfile));
  }

  // FIXME: Properly handle deployment targets.
  assert(Triple.isiOS() || Triple.isWatchOS() || Triple.isMacOSX());
  if (Triple.isiOS()) {
    bool isiOSSimulator = tripleIsiOSSimulator(Triple);
    if (Triple.isTvOS()) {
      if (isiOSSimulator)
        Arguments.push_back("-tvos_simulator_version_min");
      else
        Arguments.push_back("-tvos_version_min");
    } else {
      if (isiOSSimulator)
        Arguments.push_back("-ios_simulator_version_min");
      else
        Arguments.push_back("-iphoneos_version_min");
    }
    unsigned major, minor, micro;
    Triple.getiOSVersion(major, minor, micro);
    addVersionString(context.Args, Arguments, major, minor, micro);
  } else if (Triple.isWatchOS()) {
    if (tripleIsWatchSimulator(Triple))
      Arguments.push_back("-watchos_simulator_version_min");
    else
      Arguments.push_back("-watchos_version_min");
    unsigned major, minor, micro;
    Triple.getOSVersion(major, minor, micro);
    addVersionString(context.Args, Arguments, major, minor, micro);
  } else {
    Arguments.push_back("-macosx_version_min");
    unsigned major, minor, micro;
    Triple.getMacOSXVersion(major, minor, micro);
    addVersionString(context.Args, Arguments, major, minor, micro);
  }

  Arguments.push_back("-no_objc_category_merging");

  // This should be the last option, for convenience in checking output.
  Arguments.push_back("-o");
  Arguments.push_back(
      context.Args.MakeArgString(context.Output.getPrimaryOutputFilename()));

  return II;
}


text:
#include <apr_lib.h>
#include <apr_strings.h>
#include <apr_time.h>
#include <apr_buckets.h>
#include <apr_thread_mutex.h>
#include <apr_thread_cond.h>

#include <httpd.h>
#include <http_protocol.h>
#include <http_log.h>

#include "h2_private.h"
#include "h2_util.h"
#include "h2_bucket_beam.h"

static void h2_beam_emitted(h2_bucket_beam *beam, h2_beam_proxy *proxy);

#define H2_BPROXY_NEXT(e)             APR_RING_NEXT((e), link)
#define H2_BPROXY_PREV(e)             APR_RING_PREV((e), link)
#define H2_BPROXY_REMOVE(e)           APR_RING_REMOVE((e), link)

#define H2_BPROXY_LIST_INIT(b)        APR_RING_INIT(&(b)->list, h2_beam_proxy, link);
#define H2_BPROXY_LIST_SENTINEL(b)    APR_RING_SENTINEL(&(b)->list, h2_beam_proxy, link)
#define H2_BPROXY_LIST_EMPTY(b)       APR_RING_EMPTY(&(b)->list, h2_beam_proxy, link)
#define H2_BPROXY_LIST_FIRST(b)       APR_RING_FIRST(&(b)->list)
#define H2_BPROXY_LIST_LAST(b)	      APR_RING_LAST(&(b)->list)
#define H2_PROXY_BLIST_INSERT_HEAD(b, e) do {				\
	h2_beam_proxy *ap__b = (e);                                        \
	APR_RING_INSERT_HEAD(&(b)->list, ap__b, h2_beam_proxy, link);	\
    } while (0)
#define H2_BPROXY_LIST_INSERT_TAIL(b, e) do {				\
	h2_beam_proxy *ap__b = (e);					\
	APR_RING_INSERT_TAIL(&(b)->list, ap__b, h2_beam_proxy, link);	\
    } while (0)
#define H2_BPROXY_LIST_CONCAT(a, b) do {					\
        APR_RING_CONCAT(&(a)->list, &(b)->list, h2_beam_proxy, link);	\
    } while (0)
#define H2_BPROXY_LIST_PREPEND(a, b) do {					\
        APR_RING_PREPEND(&(a)->list, &(b)->list, h2_beam_proxy, link);	\
    } while (0)

/*******************************************************************************
 * beam bucket with reference to beam and bucket it represents
 ******************************************************************************/

const apr_bucket_type_t h2_bucket_type_beam;

#define H2_BUCKET_IS_BEAM(e)     (e->type == &h2_bucket_type_beam)

struct h2_beam_proxy {
    apr_bucket_refcount refcount;
    APR_RING_ENTRY(h2_beam_proxy) link;
    h2_bucket_beam *beam;
    apr_bucket *bred;
    apr_size_t n;
};

static const char Dummy = '\0';

static apr_status_t beam_bucket_read(apr_bucket *b, const char **str,
                                     apr_size_t *len, apr_read_type_e block)
{
    h2_beam_proxy *d = b->data;
    if (d->bred) {
        const char *data;
        apr_status_t status = apr_bucket_read(d->bred, &data, len, block);
        if (status == APR_SUCCESS) {
            *str = data + b->start;
            *len = b->length;
        }
        return status;
    }
    *str = &Dummy;
    *len = 0;
    return APR_ECONNRESET;
}

static void beam_bucket_destroy(void *data)
{
    h2_beam_proxy *d = data;

    if (apr_bucket_shared_destroy(d)) {
        /* When the beam gets destroyed before this bucket, it will
         * NULLify its reference here. This is not protected by a mutex,
         * so it will not help with race conditions.
         * But it lets us shut down memory pool with circulare beam
         * references. */
        if (d->beam) {
            h2_beam_emitted(d->beam, d);
        }
        apr_bucket_free(d);
    }
}

static apr_bucket * h2_beam_bucket_make(apr_bucket *b,
                                        h2_bucket_beam *beam,
                                        apr_bucket *bred, apr_size_t n)
{
    h2_beam_proxy *d;

    d = apr_bucket_alloc(sizeof(*d), b->list);
    H2_BPROXY_LIST_INSERT_TAIL(&beam->proxies, d);
    d->beam = beam;
    d->bred = bred;
    d->n = n;

    b = apr_bucket_shared_make(b, d, 0, bred? bred->length : 0);
    b->type = &h2_bucket_type_beam;

    return b;
}

static apr_bucket *h2_beam_bucket_create(h2_bucket_beam *beam,
                                         apr_bucket *bred,
                                         apr_bucket_alloc_t *list,
                                         apr_size_t n)
{
    apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);

    APR_BUCKET_INIT(b);
    b->free = apr_bucket_free;
    b->list = list;
    return h2_beam_bucket_make(b, beam, bred, n);
}

const apr_bucket_type_t h2_bucket_type_beam = {
    "BEAM", 5, APR_BUCKET_DATA,
    beam_bucket_destroy,
    beam_bucket_read,
    apr_bucket_setaside_noop,
    apr_bucket_shared_split,
    apr_bucket_shared_copy
};

/*******************************************************************************
 * h2_blist, a brigade without allocations
 ******************************************************************************/

static apr_array_header_t *beamers;

void h2_register_bucket_beamer(h2_bucket_beamer *beamer)
{
    if (!beamers) {
        beamers = apr_array_make(apr_hook_global_pool, 10,
                                 sizeof(h2_bucket_beamer*));
    }
    APR_ARRAY_PUSH(beamers, h2_bucket_beamer*) = beamer;
}

static apr_bucket *h2_beam_bucket(h2_bucket_beam *beam,
                                  apr_bucket_brigade *dest,
                                  const apr_bucket *src)
{
    apr_bucket *b = NULL;
    int i;
    if (beamers) {
        for (i = 0; i < beamers->nelts && b == NULL; ++i) {
            h2_bucket_beamer *beamer;

            beamer = APR_ARRAY_IDX(beamers, i, h2_bucket_beamer*);
            b = beamer(beam, dest, src);
        }
    }
    return b;
}

apr_size_t h2_util_bl_print(char *buffer, apr_size_t bmax,
                            const char *tag, const char *sep,
                            h2_blist *bl)
{
    apr_size_t off = 0;
    const char *sp = "";
    apr_bucket *b;

    if (bl) {
        memset(buffer, 0, bmax--);
        off += apr_snprintf(buffer+off, bmax-off, "%s(", tag);
        for (b = H2_BLIST_FIRST(bl);
             bmax && (b != H2_BLIST_SENTINEL(bl));
             b = APR_BUCKET_NEXT(b)) {

            off += h2_util_bucket_print(buffer+off, bmax-off, b, sp);
            sp = " ";
        }
        off += apr_snprintf(buffer+off, bmax-off, ")%s", sep);
    }
    else {
        off += apr_snprintf(buffer+off, bmax-off, "%s(null)%s", tag, sep);
    }
    return off;
}

/*******************************************************************************
 * bucket beam that can transport buckets across threads
 ******************************************************************************/

static apr_status_t enter_yellow(h2_bucket_beam *beam, h2_beam_lock *pbl)
{
    h2_beam_mutex_enter *enter = beam->m_enter;
    if (enter) {
        void *ctx = beam->m_ctx;
        if (ctx) {
            return enter(ctx, pbl);
        }
    }
    pbl->mutex = NULL;
    pbl->leave = NULL;
    return APR_SUCCESS;
}

static void leave_yellow(h2_bucket_beam *beam, h2_beam_lock *pbl)
{
    if (pbl->leave) {
        pbl->leave(pbl->leave_ctx, pbl->mutex);
    }
}

static void report_consumption(h2_bucket_beam *beam, int force)
{
    if (force || beam->received_bytes != beam->reported_consumed_bytes) {
        if (beam->consumed_fn) {
            beam->consumed_fn(beam->consumed_ctx, beam, beam->received_bytes
                              - beam->reported_consumed_bytes);
        }
        beam->reported_consumed_bytes = beam->received_bytes;
    }
}

static void report_production(h2_bucket_beam *beam, int force)
{
    if (force || beam->sent_bytes != beam->reported_produced_bytes) {
        if (beam->produced_fn) {
            beam->produced_fn(beam->produced_ctx, beam, beam->sent_bytes
                              - beam->reported_produced_bytes);
        }
        beam->reported_produced_bytes = beam->sent_bytes;
    }
}

static apr_size_t calc_buffered(h2_bucket_beam *beam)
{
    apr_size_t len = 0;
    apr_bucket *b;
    for (b = H2_BLIST_FIRST(&beam->send_list);
         b != H2_BLIST_SENTINEL(&beam->send_list);
         b = APR_BUCKET_NEXT(b)) {
        if (b->length == ((apr_size_t)-1)) {
            /* do not count */
        }
        else if (APR_BUCKET_IS_FILE(b)) {
            /* if unread, has no real mem footprint. how to test? */
        }
        else {
            len += b->length;
        }
    }
    return len;
}

static void r_purge_sent(h2_bucket_beam *beam)
{
    apr_bucket *b;
    /* delete all sender buckets in purge brigade, needs to be called
     * from sender thread only */
    while (!H2_BLIST_EMPTY(&beam->purge_list)) {
        b = H2_BLIST_FIRST(&beam->purge_list);
        apr_bucket_delete(b);
    }
}

static apr_size_t calc_space_left(h2_bucket_beam *beam)
{
    if (beam->max_buf_size > 0) {
        apr_off_t len = calc_buffered(beam);
        return (beam->max_buf_size > len? (beam->max_buf_size - len) : 0);
    }
    return APR_SIZE_MAX;
}

static apr_status_t wait_cond(h2_bucket_beam *beam, apr_thread_mutex_t *lock)
{
    if (beam->timeout > 0) {
        return apr_thread_cond_timedwait(beam->m_cond, lock, beam->timeout);
    }
    else {
        return apr_thread_cond_wait(beam->m_cond, lock);
    }
}

static apr_status_t r_wait_space(h2_bucket_beam *beam, apr_read_type_e block,
                                 h2_beam_lock *pbl, apr_size_t *premain)
{
    *premain = calc_space_left(beam);
    while (!beam->aborted && *premain <= 0
           && (block == APR_BLOCK_READ) && pbl->mutex) {
        apr_status_t status;
        report_production(beam, 1);
        status = wait_cond(beam, pbl->mutex);
        if (APR_STATUS_IS_TIMEUP(status)) {
            return status;
        }
        r_purge_sent(beam);
        *premain = calc_space_left(beam);
    }
    return beam->aborted? APR_ECONNABORTED : APR_SUCCESS;
}

static void h2_beam_emitted(h2_bucket_beam *beam, h2_beam_proxy *proxy)
{
    h2_beam_lock bl;
    apr_bucket *b, *next;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        /* even when beam buckets are split, only the one where
         * refcount drops to 0 will call us */
        H2_BPROXY_REMOVE(proxy);
        /* invoked from receiver thread, the last beam bucket for the send
         * bucket is about to be destroyed.
         * remove it from the hold, where it should be now */
        if (proxy->bred) {
            for (b = H2_BLIST_FIRST(&beam->hold_list);
                 b != H2_BLIST_SENTINEL(&beam->hold_list);
                 b = APR_BUCKET_NEXT(b)) {
                 if (b == proxy->bred) {
                    break;
                 }
            }
            if (b != H2_BLIST_SENTINEL(&beam->hold_list)) {
                /* bucket is in hold as it should be, mark this one
                 * and all before it for purging. We might have placed meta
                 * buckets without a green proxy into the hold before it
                 * and schedule them for purging now */
                for (b = H2_BLIST_FIRST(&beam->hold_list);
                     b != H2_BLIST_SENTINEL(&beam->hold_list);
                     b = next) {
                    next = APR_BUCKET_NEXT(b);
                    if (b == proxy->bred) {
                        APR_BUCKET_REMOVE(b);
                        H2_BLIST_INSERT_TAIL(&beam->purge_list, b);
                        break;
                    }
                    else if (APR_BUCKET_IS_METADATA(b)) {
                        APR_BUCKET_REMOVE(b);
                        H2_BLIST_INSERT_TAIL(&beam->purge_list, b);
                    }
                    else {
                        /* another data bucket before this one in hold. this
                         * is normal since DATA buckets need not be destroyed
                         * in order */
                    }
                }

                proxy->bred = NULL;
            }
            else {
                /* it should be there unless we screwed up */
                ap_log_perror(APLOG_MARK, APLOG_WARNING, 0, beam->send_pool,
                              APLOGNO(03384) "h2_beam(%d-%s): emitted bucket not "
                              "in hold, n=%d", beam->id, beam->tag,
                              (int)proxy->n);
                ap_assert(!proxy->bred);
            }
        }
        /* notify anyone waiting on space to become available */
        if (!bl.mutex) {
            r_purge_sent(beam);
        }
        else if (beam->m_cond) {
            apr_thread_cond_broadcast(beam->m_cond);
        }
        leave_yellow(beam, &bl);
    }
}

static void h2_blist_cleanup(h2_blist *bl)
{
    apr_bucket *e;

    while (!H2_BLIST_EMPTY(bl)) {
        e = H2_BLIST_FIRST(bl);
        apr_bucket_delete(e);
    }
}

static apr_status_t beam_close(h2_bucket_beam *beam)
{
    if (!beam->closed) {
        beam->closed = 1;
        if (beam->m_cond) {
            apr_thread_cond_broadcast(beam->m_cond);
        }
    }
    return APR_SUCCESS;
}

static void beam_set_send_pool(h2_bucket_beam *beam, apr_pool_t *pool);
static void beam_set_recv_pool(h2_bucket_beam *beam, apr_pool_t *pool);

static apr_status_t beam_recv_cleanup(void *data)
{
    h2_bucket_beam *beam = data;
    /* receiver pool has gone away, clear references */
    beam->recv_buffer = NULL;
    beam->recv_pool = NULL;
    return APR_SUCCESS;
}

static void beam_set_recv_pool(h2_bucket_beam *beam, apr_pool_t *pool)
{
    /* if the beam owner is the sender, monitor receiver pool lifetime */
    if (beam->owner == H2_BEAM_OWNER_SEND && beam->recv_pool != pool) {
        if (beam->recv_pool) {
            apr_pool_cleanup_kill(beam->recv_pool, beam, beam_recv_cleanup);
        }
        beam->recv_pool = pool;
        if (beam->recv_pool) {
            apr_pool_pre_cleanup_register(beam->recv_pool, beam, beam_recv_cleanup);
        }
    }
}

static apr_status_t beam_send_cleanup(void *data)
{
    h2_bucket_beam *beam = data;
    /* sender has gone away, clear up all references to its memory */
    r_purge_sent(beam);
    h2_blist_cleanup(&beam->send_list);
    report_consumption(beam, 0);
    while (!H2_BPROXY_LIST_EMPTY(&beam->proxies)) {
        h2_beam_proxy *proxy = H2_BPROXY_LIST_FIRST(&beam->proxies);
        H2_BPROXY_REMOVE(proxy);
        proxy->beam = NULL;
        proxy->bred = NULL;
    }
    h2_blist_cleanup(&beam->purge_list);
    h2_blist_cleanup(&beam->hold_list);
    beam->send_pool = NULL;
    return APR_SUCCESS;
}

static void beam_set_send_pool(h2_bucket_beam *beam, apr_pool_t *pool)
{
    /* if the beam owner is the receiver, monitor sender pool lifetime */
    if (beam->owner == H2_BEAM_OWNER_RECV && beam->send_pool != pool) {
        if (beam->send_pool) {
            apr_pool_cleanup_kill(beam->send_pool, beam, beam_send_cleanup);
        }
        beam->send_pool = pool;
        if (beam->send_pool) {
            apr_pool_pre_cleanup_register(beam->send_pool, beam, beam_send_cleanup);
        }
    }
}

static apr_status_t beam_cleanup(void *data)
{
    h2_bucket_beam *beam = data;
    apr_status_t status = APR_SUCCESS;
    /* owner of the beam is going away, depending on its role, cleanup
     * strategies differ. */
    beam_close(beam);
    switch (beam->owner) {
        case H2_BEAM_OWNER_SEND:
            status = beam_send_cleanup(beam);
            beam->recv_buffer = NULL;
            beam->recv_pool = NULL;
            break;
        case H2_BEAM_OWNER_RECV:
            if (beam->recv_buffer) {
                apr_brigade_destroy(beam->recv_buffer);
            }
            beam->recv_buffer = NULL;
            beam->recv_pool = NULL;
            if (!H2_BLIST_EMPTY(&beam->send_list)) {
                ap_assert(beam->send_pool);
            }
            if (beam->send_pool) {
                /* sender has not cleaned up, its pool still lives.
                 * this is normal if the sender uses cleanup via a bucket
                 * such as the BUCKET_EOR for requests. In that case, the
                 * beam should have lost its mutex protection, meaning
                 * it is no longer used multi-threaded and we can safely
                 * purge all remaining sender buckets. */
                apr_pool_cleanup_kill(beam->send_pool, beam, beam_send_cleanup);
                ap_assert(!beam->m_enter);
                beam_send_cleanup(beam);
            }
            ap_assert(H2_BPROXY_LIST_EMPTY(&beam->proxies));
            ap_assert(H2_BLIST_EMPTY(&beam->send_list));
            ap_assert(H2_BLIST_EMPTY(&beam->hold_list));
            ap_assert(H2_BLIST_EMPTY(&beam->purge_list));
            break;
        default:
            ap_assert(NULL);
            break;
    }
    return status;
}

apr_status_t h2_beam_destroy(h2_bucket_beam *beam)
{
    apr_pool_cleanup_kill(beam->pool, beam, beam_cleanup);
    return beam_cleanup(beam);
}

apr_status_t h2_beam_create(h2_bucket_beam **pbeam, apr_pool_t *pool,
                            int id, const char *tag,
                            h2_beam_owner_t owner,
                            apr_size_t max_buf_size)
{
    h2_bucket_beam *beam;
    apr_status_t status = APR_SUCCESS;

    beam = apr_pcalloc(pool, sizeof(*beam));
    if (!beam) {
        return APR_ENOMEM;
    }

    beam->id = id;
    beam->tag = tag;
    beam->pool = pool;
    beam->owner = owner;
    H2_BLIST_INIT(&beam->send_list);
    H2_BLIST_INIT(&beam->hold_list);
    H2_BLIST_INIT(&beam->purge_list);
    H2_BPROXY_LIST_INIT(&beam->proxies);
    beam->max_buf_size = max_buf_size;
    apr_pool_pre_cleanup_register(pool, beam, beam_cleanup);

    *pbeam = beam;

    return status;
}

void h2_beam_buffer_size_set(h2_bucket_beam *beam, apr_size_t buffer_size)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->max_buf_size = buffer_size;
        leave_yellow(beam, &bl);
    }
}

apr_size_t h2_beam_buffer_size_get(h2_bucket_beam *beam)
{
    h2_beam_lock bl;
    apr_size_t buffer_size = 0;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        buffer_size = beam->max_buf_size;
        leave_yellow(beam, &bl);
    }
    return buffer_size;
}

void h2_beam_mutex_set(h2_bucket_beam *beam,
                       h2_beam_mutex_enter m_enter,
                       apr_thread_cond_t *cond,
                       void *m_ctx)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->m_enter = m_enter;
        beam->m_ctx   = m_ctx;
        beam->m_cond  = cond;
        leave_yellow(beam, &bl);
    }
}

void h2_beam_timeout_set(h2_bucket_beam *beam, apr_interval_time_t timeout)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->timeout = timeout;
        leave_yellow(beam, &bl);
    }
}

apr_interval_time_t h2_beam_timeout_get(h2_bucket_beam *beam)
{
    h2_beam_lock bl;
    apr_interval_time_t timeout = 0;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        timeout = beam->timeout;
        leave_yellow(beam, &bl);
    }
    return timeout;
}

void h2_beam_abort(h2_bucket_beam *beam)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        if (!beam->aborted) {
            beam->aborted = 1;
            r_purge_sent(beam);
            h2_blist_cleanup(&beam->send_list);
            report_consumption(beam, 0);
        }
        if (beam->m_cond) {
            apr_thread_cond_broadcast(beam->m_cond);
        }
        leave_yellow(beam, &bl);
    }
}

apr_status_t h2_beam_close(h2_bucket_beam *beam)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        r_purge_sent(beam);
        beam_close(beam);
        report_consumption(beam, 0);
        leave_yellow(beam, &bl);
    }
    return beam->aborted? APR_ECONNABORTED : APR_SUCCESS;
}

apr_status_t h2_beam_wait_empty(h2_bucket_beam *beam, apr_read_type_e block)
{
    apr_status_t status;
    h2_beam_lock bl;

    if ((status = enter_yellow(beam, &bl)) == APR_SUCCESS) {
        while (status == APR_SUCCESS
               && !H2_BLIST_EMPTY(&beam->send_list)
               && !H2_BPROXY_LIST_EMPTY(&beam->proxies)) {
            if (block == APR_NONBLOCK_READ || !bl.mutex) {
                status = APR_EAGAIN;
                break;
            }
            if (beam->m_cond) {
                apr_thread_cond_broadcast(beam->m_cond);
            }
            status = wait_cond(beam, bl.mutex);
        }
        leave_yellow(beam, &bl);
    }
    return status;
}

static void move_to_hold(h2_bucket_beam *beam,
                         apr_bucket_brigade *red_brigade)
{
    apr_bucket *b;
    while (red_brigade && !APR_BRIGADE_EMPTY(red_brigade)) {
        b = APR_BRIGADE_FIRST(red_brigade);
        APR_BUCKET_REMOVE(b);
        H2_BLIST_INSERT_TAIL(&beam->send_list, b);
    }
}

static apr_status_t append_bucket(h2_bucket_beam *beam,
                                  apr_bucket *b,
                                  apr_read_type_e block,
                                  h2_beam_lock *pbl)
{
    const char *data;
    apr_size_t len;
    apr_size_t space_left = 0;
    apr_status_t status;

    if (APR_BUCKET_IS_METADATA(b)) {
        if (APR_BUCKET_IS_EOS(b)) {
            beam->closed = 1;
        }
        APR_BUCKET_REMOVE(b);
        H2_BLIST_INSERT_TAIL(&beam->send_list, b);
        return APR_SUCCESS;
    }
    else if (APR_BUCKET_IS_FILE(b)) {
        /* file bucket lengths do not really count */
    }
    else {
        space_left = calc_space_left(beam);
        if (space_left > 0 && b->length == ((apr_size_t)-1)) {
            const char *data;
            status = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
            if (status != APR_SUCCESS) {
                return status;
            }
        }

        if (space_left < b->length) {
            status = r_wait_space(beam, block, pbl, &space_left);
            if (status != APR_SUCCESS) {
                return status;
            }
            if (space_left <= 0) {
                return APR_EAGAIN;
            }
        }
        /* space available, maybe need bucket split */
    }

    /* The fundamental problem is that reading a red bucket from
     * a green thread is a total NO GO, because the bucket might use
     * its pool/bucket_alloc from a foreign thread and that will
     * corrupt. */
    status = APR_ENOTIMPL;
    if (APR_BUCKET_IS_TRANSIENT(b)) {
        /* this takes care of transient buckets and converts them
         * into heap ones. Other bucket types might or might not be
         * affected by this. */
        status = apr_bucket_setaside(b, beam->send_pool);
    }
    else if (APR_BUCKET_IS_HEAP(b)) {
        /* For heap buckets read from a green thread is fine. The
         * data will be there and live until the bucket itself is
         * destroyed. */
        status = APR_SUCCESS;
    }
    else if (APR_BUCKET_IS_POOL(b)) {
        /* pool buckets are bastards that register at pool cleanup
         * to morph themselves into heap buckets. That may happen anytime,
         * even after the bucket data pointer has been read. So at
         * any time inside the green thread, the pool bucket memory
         * may disappear. yikes. */
        status = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
        if (status == APR_SUCCESS) {
            apr_bucket_heap_make(b, data, len, NULL);
        }
    }
    else if (APR_BUCKET_IS_FILE(b)) {
        /* For file buckets the problem is their internal readpool that
         * is used on the first read to allocate buffer/mmap.
         * Since setting aside a file bucket will de-register the
         * file cleanup function from the previous pool, we need to
         * call that from a red thread.
         * Additionally, we allow callbacks to prevent beaming file
         * handles across. The use case for this is to limit the number
         * of open file handles and rather use a less efficient beam
         * transport. */
        apr_file_t *fd = ((apr_bucket_file *)b->data)->fd;
        int can_beam = 1;
        if (beam->last_beamed != fd && beam->can_beam_fn) {
            can_beam = beam->can_beam_fn(beam->can_beam_ctx, beam, fd);
        }
        if (can_beam) {
            beam->last_beamed = fd;
            status = apr_bucket_setaside(b, beam->send_pool);
        }
        /* else: enter ENOTIMPL case below */
    }

    if (status == APR_ENOTIMPL) {
        /* we have no knowledge about the internals of this bucket,
         * but hope that after read, its data stays immutable for the
         * lifetime of the bucket. (see pool bucket handling above for
         * a counter example).
         * We do the read while in a red thread, so that the bucket may
         * use pools/allocators safely. */
        if (space_left < APR_BUCKET_BUFF_SIZE) {
            space_left = APR_BUCKET_BUFF_SIZE;
        }
        if (space_left < b->length) {
            apr_bucket_split(b, space_left);
        }
        status = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
        if (status == APR_SUCCESS) {
            status = apr_bucket_setaside(b, beam->send_pool);
        }
    }

    if (status != APR_SUCCESS && status != APR_ENOTIMPL) {
        return status;
    }

    APR_BUCKET_REMOVE(b);
    H2_BLIST_INSERT_TAIL(&beam->send_list, b);
    beam->sent_bytes += b->length;

    return APR_SUCCESS;
}

apr_status_t h2_beam_send(h2_bucket_beam *beam,
                          apr_bucket_brigade *red_brigade,
                          apr_read_type_e block)
{
    apr_bucket *b;
    apr_status_t status = APR_SUCCESS;
    h2_beam_lock bl;

    /* Called from the red thread to add buckets to the beam */
    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        r_purge_sent(beam);
        if (red_brigade) {
            beam_set_send_pool(beam, red_brigade->p);
        }

        if (beam->aborted) {
            move_to_hold(beam, red_brigade);
            status = APR_ECONNABORTED;
        }
        else if (red_brigade) {
            int force_report = !APR_BRIGADE_EMPTY(red_brigade);
            while (!APR_BRIGADE_EMPTY(red_brigade)
                   && status == APR_SUCCESS) {
                b = APR_BRIGADE_FIRST(red_brigade);
                status = append_bucket(beam, b, block, &bl);
            }
            report_production(beam, force_report);
            if (beam->m_cond) {
                apr_thread_cond_broadcast(beam->m_cond);
            }
        }
        report_consumption(beam, 0);
        leave_yellow(beam, &bl);
    }
    return status;
}

apr_status_t h2_beam_receive(h2_bucket_beam *beam,
                             apr_bucket_brigade *bb,
                             apr_read_type_e block,
                             apr_off_t readbytes)
{
    h2_beam_lock bl;
    apr_bucket *bred, *bgreen, *ng;
    int transferred = 0;
    apr_status_t status = APR_SUCCESS;
    apr_off_t remain = readbytes;

    /* Called from the green thread to take buckets from the beam */
    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
transfer:
        if (beam->aborted) {
            if (beam->recv_buffer && !APR_BRIGADE_EMPTY(beam->recv_buffer)) {
                apr_brigade_cleanup(beam->recv_buffer);
            }
            status = APR_ECONNABORTED;
            goto leave;
        }

        /* transfer enough buckets from our green brigade, if we have one */
        beam_set_recv_pool(beam, bb->p);
        while (beam->recv_buffer
               && !APR_BRIGADE_EMPTY(beam->recv_buffer)
               && (readbytes <= 0 || remain >= 0)) {
            bgreen = APR_BRIGADE_FIRST(beam->recv_buffer);
            if (readbytes > 0 && bgreen->length > 0 && remain <= 0) {
                break;
            }
            APR_BUCKET_REMOVE(bgreen);
            APR_BRIGADE_INSERT_TAIL(bb, bgreen);
            remain -= bgreen->length;
            ++transferred;
        }

        /* transfer from our red brigade, transforming red buckets to
         * green ones until we have enough */
        while (!H2_BLIST_EMPTY(&beam->send_list) && (readbytes <= 0 || remain >= 0)) {
            bred = H2_BLIST_FIRST(&beam->send_list);
            bgreen = NULL;

            if (readbytes > 0 && bred->length > 0 && remain <= 0) {
                break;
            }

            if (APR_BUCKET_IS_METADATA(bred)) {
                if (APR_BUCKET_IS_EOS(bred)) {
                    bgreen = apr_bucket_eos_create(bb->bucket_alloc);
                    beam->close_sent = 1;
                }
                else if (APR_BUCKET_IS_FLUSH(bred)) {
                    bgreen = apr_bucket_flush_create(bb->bucket_alloc);
                }
                else if (AP_BUCKET_IS_ERROR(bred)) {
                    ap_bucket_error *eb = (ap_bucket_error *)bred;
                    bgreen = ap_bucket_error_create(eb->status, eb->data,
                                                    bb->p, bb->bucket_alloc);
                }
            }
            else if (APR_BUCKET_IS_FILE(bred)) {
                /* This is set aside into the target brigade pool so that
                 * any read operation messes with that pool and not
                 * the red one. */
                apr_bucket_file *f = (apr_bucket_file *)bred->data;
                apr_file_t *fd = f->fd;
                int setaside = (f->readpool != bb->p);

                if (setaside) {
                    status = apr_file_setaside(&fd, fd, bb->p);
                    if (status != APR_SUCCESS) {
                        goto leave;
                    }
                    ++beam->files_beamed;
                }
                ng = apr_brigade_insert_file(bb, fd, bred->start, bred->length,
                                             bb->p);
#if APR_HAS_MMAP
                /* disable mmap handling as this leads to segfaults when
                 * the underlying file is changed while memory pointer has
                 * been handed out. See also PR 59348 */
                apr_bucket_file_enable_mmap(ng, 0);
#endif
                remain -= bred->length;
                ++transferred;
                APR_BUCKET_REMOVE(bred);
                H2_BLIST_INSERT_TAIL(&beam->hold_list, bred);
                ++transferred;
                continue;
            }
            else {
                /* create a "green" standin bucket. we took care about the
                 * underlying red bucket and its data when we placed it into
                 * the red brigade.
                 * the beam bucket will notify us on destruction that bred is
                 * no longer needed. */
                bgreen = h2_beam_bucket_create(beam, bred, bb->bucket_alloc,
                                               beam->buckets_sent++);
            }

            /* Place the red bucket into our hold, to be destroyed when no
             * green bucket references it any more. */
            APR_BUCKET_REMOVE(bred);
            H2_BLIST_INSERT_TAIL(&beam->hold_list, bred);
            beam->received_bytes += bred->length;
            if (bgreen) {
                APR_BRIGADE_INSERT_TAIL(bb, bgreen);
                remain -= bgreen->length;
                ++transferred;
            }
            else {
                bgreen = h2_beam_bucket(beam, bb, bred);
                while (bgreen && bgreen != APR_BRIGADE_SENTINEL(bb)) {
                    ++transferred;
                    remain -= bgreen->length;
                    bgreen = APR_BUCKET_NEXT(bgreen);
                }
            }
        }

        if (readbytes > 0 && remain < 0) {
            /* too much, put some back */
            remain = readbytes;
            for (bgreen = APR_BRIGADE_FIRST(bb);
                 bgreen != APR_BRIGADE_SENTINEL(bb);
                 bgreen = APR_BUCKET_NEXT(bgreen)) {
                 remain -= bgreen->length;
                 if (remain < 0) {
                     apr_bucket_split(bgreen, bgreen->length+remain);
                     beam->recv_buffer = apr_brigade_split_ex(bb,
                                                        APR_BUCKET_NEXT(bgreen),
                                                        beam->recv_buffer);
                     break;
                 }
            }
        }

        if (beam->closed
            && (!beam->recv_buffer || APR_BRIGADE_EMPTY(beam->recv_buffer))
            && H2_BLIST_EMPTY(&beam->send_list)) {
            /* beam is closed and we have nothing more to receive */
            if (!beam->close_sent) {
                apr_bucket *b = apr_bucket_eos_create(bb->bucket_alloc);
                APR_BRIGADE_INSERT_TAIL(bb, b);
                beam->close_sent = 1;
                ++transferred;
                status = APR_SUCCESS;
            }
        }

        if (transferred) {
            if (beam->m_cond) {
                apr_thread_cond_broadcast(beam->m_cond);
            }
            status = APR_SUCCESS;
        }
        else if (beam->closed) {
            status = APR_EOF;
        }
        else if (block == APR_BLOCK_READ && bl.mutex && beam->m_cond) {
            status = wait_cond(beam, bl.mutex);
            if (status != APR_SUCCESS) {
                goto leave;
            }
            goto transfer;
        }
        else {
            if (beam->m_cond) {
                apr_thread_cond_broadcast(beam->m_cond);
            }
            status = APR_EAGAIN;
        }
leave:
        leave_yellow(beam, &bl);
    }
    return status;
}

void h2_beam_on_consumed(h2_bucket_beam *beam,
                         h2_beam_io_callback *cb, void *ctx)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->consumed_fn = cb;
        beam->consumed_ctx = ctx;
        leave_yellow(beam, &bl);
    }
}

void h2_beam_on_produced(h2_bucket_beam *beam,
                         h2_beam_io_callback *cb, void *ctx)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->produced_fn = cb;
        beam->produced_ctx = ctx;
        leave_yellow(beam, &bl);
    }
}

void h2_beam_on_file_beam(h2_bucket_beam *beam,
                          h2_beam_can_beam_callback *cb, void *ctx)
{
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        beam->can_beam_fn = cb;
        beam->can_beam_ctx = ctx;
        leave_yellow(beam, &bl);
    }
}

apr_off_t h2_beam_get_buffered(h2_bucket_beam *beam)
{
    apr_bucket *b;
    apr_off_t l = 0;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        for (b = H2_BLIST_FIRST(&beam->send_list);
            b != H2_BLIST_SENTINEL(&beam->send_list);
            b = APR_BUCKET_NEXT(b)) {
            /* should all have determinate length */
            l += b->length;
        }
        leave_yellow(beam, &bl);
    }
    return l;
}

apr_off_t h2_beam_get_mem_used(h2_bucket_beam *beam)
{
    apr_bucket *b;
    apr_off_t l = 0;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        for (b = H2_BLIST_FIRST(&beam->send_list);
            b != H2_BLIST_SENTINEL(&beam->send_list);
            b = APR_BUCKET_NEXT(b)) {
            if (APR_BUCKET_IS_FILE(b)) {
                /* do not count */
            }
            else {
                /* should all have determinate length */
                l += b->length;
            }
        }
        leave_yellow(beam, &bl);
    }
    return l;
}

int h2_beam_empty(h2_bucket_beam *beam)
{
    int empty = 1;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        empty = (H2_BLIST_EMPTY(&beam->send_list)
                 && (!beam->recv_buffer || APR_BRIGADE_EMPTY(beam->recv_buffer)));
        leave_yellow(beam, &bl);
    }
    return empty;
}

int h2_beam_holds_proxies(h2_bucket_beam *beam)
{
    int has_proxies = 1;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        has_proxies = !H2_BPROXY_LIST_EMPTY(&beam->proxies);
        leave_yellow(beam, &bl);
    }
    return has_proxies;
}

int h2_beam_was_received(h2_bucket_beam *beam)
{
    int happend = 0;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        happend = (beam->received_bytes > 0);
        leave_yellow(beam, &bl);
    }
    return happend;
}

apr_size_t h2_beam_get_files_beamed(h2_bucket_beam *beam)
{
    apr_size_t n = 0;
    h2_beam_lock bl;

    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        n = beam->files_beamed;
        leave_yellow(beam, &bl);
    }
    return n;
}

int h2_beam_no_files(void *ctx, h2_bucket_beam *beam, apr_file_t *file)
{
    return 0;
}


text:
/*
 * File:   GameInterface.hpp
 * Author: Ale Strooisma
 *
 * Created on June 7, 2015, 7:53 PM
 */

#ifndef GAMEINTERFACE_HPP
#define	GAMEINTERFACE_HPP

#include <glm/mat4x4.hpp>

class Game3D;

/**
 * This interface provides access to the game loop. An instance of this interface
 * must be passed to the `Game3D` constructor.
 */
class GameInterface {
public:
	virtual ~GameInterface() {};
	/**
	 * This method can be used to get a way to access the `Game3D` object. It is
	 * called before the game loop starts and before `init` is called.
	 *
     * @param game the `Game3D` object running this game
     */
	virtual void setGame(Game3D* game) = 0;
	/**
	 * This method is called just before the game loop starts, but after the
	 * OpenGL context is initialized.
	 * Immediately after this function terminates, the window is made visible
	 * and the game loop starts.
     */
	virtual void init() = 0;
	/**
	 * This function is called each iteration of the game loop and should be
	 * implemented to update the game state.
	 *
     * @param dt the time since the last update call, in seconds
     */
	virtual void update(double dt) = 0;
	/**
	 * This function is called each iteration of the game loop and should be
	 * implemented to render the elements in the 3D space.
	 *
	 * The base matrix passed to this function contains the world-to-camera
	 * transformation, so the model-to-camera matrix that must be passed to the
	 * shaders/renderer has to be calculated by multiplying the base matrix with
	 * the model-to-world matrix.
	 *
     * @param base the base matrix from which the model-to-camera matrix should
	 * be calculated
     */
	virtual void renderWorld(glm::mat4 base) = 0;
	/**
	 * This function is called each iteration of the game loop and should be
	 * implemented to render the GUI overlay.
	 *
	 * In contrast to `renderWorld`, the matrix passed to this function does not
	 * include the world-to-camera transformation, so elements rendered in this
	 * function will be rendered with an orthogonal projection. In addition,
	 * elements rendered in this function will always be rendered over elements
	 * rendered in `renderWorld`.
	 *
     * @param base the base matrix from which the model-to-camera matrix should
	 * be calculated
     */
	virtual void renderHUD(glm::mat4 base) = 0;
	/**
	 * This function is called whenever the game loop ends, be it in a normal or
	 * exceptional way, so it should be used to clean up resources created in
	 * the `init` function.
     */
	virtual void shutdown() = 0;
	/**
	 * Implement this function to return `true` whenever the program should stop
	 * running. This is checked before each iteration of the game loop.
     * @return `true` if the program should stop
     */
	virtual bool shouldStop() = 0;
	/**
	 * Every iteration, just before rendering this function is called to account
	 * for effects of a window resize.
	 * Most likely this can be left empty, because the engine handles resizing.
	 * One exception is when extra cameras are defined. In that case you need to
	 * call `yourCamera.updateAspect(width, height)` here.
	 *
     * @param width the new window width
     * @param height the new window height
     */
	virtual void windowResized(int width, int height) = 0;
	/**
	 * @brief This function is called whenever the user tries to close the
	 * window. The window will only actually close if this function returns true.
	 *
	 * Note that this is not called when the window closes because shouldStop
	 * returns true.
	 *
     * @return
     */
	virtual bool windowClosed() = 0;
};

#endif	/* GAMEINTERFACE_HPP */


text:
package com.restfb.types.send;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

import com.restfb.AbstractJsonMapperTests;

class CallToActionTest extends AbstractJsonMapperTests {

  @Test
  void checkJson() {
    CallToAction action = new CallToAction("EXAMPLE_PAYLOAD");

    String json = createJsonMapper().toJson(action, true);
    assertEquals("{\"payload\":\"EXAMPLE_PAYLOAD\"}", json);
  }
}


text:
@class OFHeap;

// Functions used as the comparison in an OFHeap should return NSOrderedAscending if
// object1 should be above the heap as compared to object2.  That is, the 'least'
// object will be returned from the heap first.
typedef NSComparisonResult (*OFHeapComparisonFunction)(OFHeap *heap, __strong void *userInfo, id object1, id object2);

@interface OFHeap : OFObject
{
    __strong id *_objects;
    NSUInteger _count, _capacity;
    OFHeapComparisonFunction _comparisonFunction;
    __strong void *_userInfo;
}

- initWithCapacity:(NSUInteger)newCapacity compareFunction:(OFHeapComparisonFunction)comparisonFunction userInfo:(__strong void *)userInfo;

- initWithCapacity:(NSUInteger)newCapacity compareSelector:(SEL)comparisonSelector;

- (NSUInteger)count;

- (void)addObject:(id)anObject;

- (id)removeObject;
- (id)removeObjectLessThanObject:(id)object;

- (void)removeAllObjects;

- (id)peekObject;

@end


text:
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '..';
import { PaperProps } from '../Paper';
import { SnackbarContentClasses } from './snackbarContentClasses';

export interface SnackbarContentProps extends StandardProps<PaperProps, 'children'> {
  /**
   * The action to display. It renders after the message, at the end of the snackbar.
   */
  action?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<SnackbarContentClasses>;
  /**
   * The message to display.
   */
  message?: React.ReactNode;
  /**
   * The ARIA role attribute of the element.
   * @default 'alert'
   */
  role?: PaperProps['role'];
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme>;
}

/**
 *
 * Demos:
 *
 * - [Snackbars](https://mui.com/components/snackbars/)
 *
 * API:
 *
 * - [SnackbarContent API](https://mui.com/api/snackbar-content/)
 * - inherits [Paper API](https://mui.com/api/paper/)
 */
export default function SnackbarContent(props: SnackbarContentProps): JSX.Element;


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:state_pressed="true" >
		<shape>
			<solid
			    android:color="#55000000" />
			<padding
			    android:left="10dp"
			    android:top="10dp"
			    android:right="10dp"
			    android:bottom="10dp" />
		</shape>
	</item>

	<item>
		<shape>
			<solid
			    android:color="#29000000" />
			<padding
			    android:left="10dp"
			    android:top="10dp"
			    android:right="10dp"
			    android:bottom="10dp" />
		</shape>
	</item>
</selector><!-- From: file:/C:/Users/Nimish/Desktop/Final_Project/My_Notes/app/src/main/res/drawable/category_bg_selector.xml -->