mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge branch 'master' into 1444-local
This commit is contained in:
		
							
								
								
									
										521
									
								
								samples/AGS Script/GlobalScript.asc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										521
									
								
								samples/AGS Script/GlobalScript.asc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,521 @@
 | 
			
		||||
// main global script file
 | 
			
		||||
 | 
			
		||||
// A function that initializes a bunch of stuff.
 | 
			
		||||
function initialize_control_panel() { 
 | 
			
		||||
  // Centre the control panel
 | 
			
		||||
  gPanel.Centre(); 
 | 
			
		||||
  // Centre the Restart dialog as well
 | 
			
		||||
  gRestartYN.Centre(); 
 | 
			
		||||
  if (!IsSpeechVoxAvailable()) { 
 | 
			
		||||
    // If there is no speech-vox file, and therefore no speech,
 | 
			
		||||
    // disable all the controls related with speech.
 | 
			
		||||
    lblVoice.Visible = false;  
 | 
			
		||||
    btnVoice.Visible = false;  
 | 
			
		||||
    sldVoice.Visible = false;
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    // If there *is*, then set it to voice and text. It's best to use
 | 
			
		||||
    // both whenever possible, for the player's sake.
 | 
			
		||||
    SetVoiceMode(eSpeechVoiceAndText); 
 | 
			
		||||
    // And reflect this in the control panel.
 | 
			
		||||
    btnVoice.Text = "Voice and Text"; 
 | 
			
		||||
  }
 | 
			
		||||
  if (!System.SupportsGammaControl) {
 | 
			
		||||
    // If we can't change the gamma settings, disable the relevant options.
 | 
			
		||||
    sldGamma.Visible = false; 
 | 
			
		||||
    lblGamma.Visible = false;
 | 
			
		||||
  } 
 | 
			
		||||
  
 | 
			
		||||
  //And now, set all the defaults
 | 
			
		||||
  System.Volume = 100;
 | 
			
		||||
  sldAudio.Value = System.Volume;
 | 
			
		||||
  SetGameSpeed(40);
 | 
			
		||||
  sldSpeed.Value = 40;
 | 
			
		||||
  if (IsSpeechVoxAvailable()) {
 | 
			
		||||
     SetVoiceMode(eSpeechVoiceAndText);
 | 
			
		||||
     btnVoice.Text = "Voice and Text";
 | 
			
		||||
     sldVoice.Value = 255;
 | 
			
		||||
     SetSpeechVolume(255);
 | 
			
		||||
  }
 | 
			
		||||
  if (System.SupportsGammaControl) {
 | 
			
		||||
    System.Gamma = 100;
 | 
			
		||||
    sldGamma.Value = 100;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Called when the game starts, before the first room is loaded
 | 
			
		||||
function game_start() {   
 | 
			
		||||
  // Put the code all in a function and then just call the function. 
 | 
			
		||||
  // It saves cluttering up places like game_start.
 | 
			
		||||
  initialize_control_panel(); 
 | 
			
		||||
  // Use the KeyboardMovement module to, per default, replicate the standard
 | 
			
		||||
  // keyboard movement of most Sierra games. See KeyboardMovement.txt for more info
 | 
			
		||||
  KeyboardMovement.SetMode(eKeyboardMovement_Tapping); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function repeatedly_execute() {
 | 
			
		||||
  
 | 
			
		||||
  // Put here anything you want to happen every game cycle, even when
 | 
			
		||||
  // the game is paused. This will not run when the game is blocked
 | 
			
		||||
  // inside a command like a blocking Walk()
 | 
			
		||||
  
 | 
			
		||||
  if (IsGamePaused() == 1) return;
 | 
			
		||||
 | 
			
		||||
  // Put here anything you want to happen every game cycle, but not
 | 
			
		||||
  // when the game is paused.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function repeatedly_execute_always() {
 | 
			
		||||
  
 | 
			
		||||
  // Put anything you want to happen every game cycle, even
 | 
			
		||||
  // when the game is blocked inside a command like a
 | 
			
		||||
  // blocking Walk().
 | 
			
		||||
  // You cannot run blocking commands from this function.
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function show_inventory_window () 
 | 
			
		||||
{
 | 
			
		||||
  gInventory.Visible = true;
 | 
			
		||||
  // switch to the Use cursor (to select items with)
 | 
			
		||||
  mouse.Mode = eModeInteract;
 | 
			
		||||
  // But, override the appearance to look like the arrow
 | 
			
		||||
  mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function show_save_game_dialog()
 | 
			
		||||
{
 | 
			
		||||
  gSaveGame.Visible = true;
 | 
			
		||||
  // Get the list of save games
 | 
			
		||||
  lstSaveGamesList.FillSaveGameList();
 | 
			
		||||
  if (lstSaveGamesList.ItemCount > 0)
 | 
			
		||||
  {
 | 
			
		||||
    // If there is at least one, set the default text
 | 
			
		||||
    // to be the first game's name
 | 
			
		||||
    txtNewSaveName.Text = lstSaveGamesList.Items[0];
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    // No save games yet, default empty text.
 | 
			
		||||
    txtNewSaveName.Text = "";
 | 
			
		||||
  }
 | 
			
		||||
  mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
  gIconbar.Visible = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function show_restore_game_dialog()
 | 
			
		||||
{
 | 
			
		||||
  gRestoreGame.Visible = true;
 | 
			
		||||
  lstRestoreGamesList.FillSaveGameList();
 | 
			
		||||
  mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
  gIconbar.Visible = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function close_save_game_dialog()
 | 
			
		||||
{
 | 
			
		||||
  gSaveGame.Visible = false;
 | 
			
		||||
  mouse.UseDefaultGraphic();
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function close_restore_game_dialog()
 | 
			
		||||
{
 | 
			
		||||
  gRestoreGame.Visible = false;
 | 
			
		||||
  mouse.UseDefaultGraphic();
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Called when a key is pressed. keycode holds the key's ASCII code
 | 
			
		||||
function on_key_press(eKeyCode keycode) {
 | 
			
		||||
  // The following is called before "if game is paused keycode=0", so
 | 
			
		||||
  // it'll happen even when the game is paused.
 | 
			
		||||
  
 | 
			
		||||
  if ((keycode == eKeyEscape) && gRestartYN.Visible) {
 | 
			
		||||
    //Use ESC to cancel restart.
 | 
			
		||||
    gRestartYN.Visible = false; 
 | 
			
		||||
    gIconbar.Visible = true;
 | 
			
		||||
    // If the panel's not ON, then the player must have gotten here by tapping F9,
 | 
			
		||||
    // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
 | 
			
		||||
    // because it's already a pointer. Get used to thinking like this!!
 | 
			
		||||
    if (!gPanel.Visible) mouse.UseDefaultGraphic(); 
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if ((keycode == eKeyEscape) && gPanel.Visible) {
 | 
			
		||||
    // Use ESC to turn the panel off.
 | 
			
		||||
    gPanel.Visible = false; 
 | 
			
		||||
    mouse.UseDefaultGraphic();
 | 
			
		||||
    gIconbar.Visible = true;
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if ((keycode == eKeyEscape) && (gSaveGame.Visible))
 | 
			
		||||
  {
 | 
			
		||||
    // Use ESC to close the save game dialog
 | 
			
		||||
    close_save_game_dialog();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if ((keycode == eKeyEscape) && (gRestoreGame.Visible))
 | 
			
		||||
  {
 | 
			
		||||
    // Use ESC to close the restore game dialog
 | 
			
		||||
    close_restore_game_dialog();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if (keycode == eKeyReturn) { 
 | 
			
		||||
    // ENTER, in this case merely confirms restart
 | 
			
		||||
    if (gRestartYN.Visible) RestartGame();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (IsGamePaused() || (IsInterfaceEnabled() == 0))
 | 
			
		||||
  {
 | 
			
		||||
    // If the game is paused with a modal GUI on the
 | 
			
		||||
    // screen, or the player interface is disabled in
 | 
			
		||||
    // a cut scene, ignore any keypresses.
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // FUNCTION KEYS AND SYSTEM SHORTCUTS
 | 
			
		||||
  if (keycode == eKeyEscape) {
 | 
			
		||||
    // ESC
 | 
			
		||||
    gPanel.Visible = true; 
 | 
			
		||||
    gIconbar.Visible = false;
 | 
			
		||||
    mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
  }
 | 
			
		||||
  if (keycode == eKeyCtrlQ)  QuitGame(1);   // Ctrl-Q
 | 
			
		||||
  if (keycode == eKeyF5) show_save_game_dialog();   // F5
 | 
			
		||||
  if (keycode == eKeyF7) show_restore_game_dialog();  // F7
 | 
			
		||||
  if (keycode == eKeyF9) {
 | 
			
		||||
    // F9, asks the player to confirm restarting (so much better to always confirm first)
 | 
			
		||||
    gRestartYN.Visible = true;  
 | 
			
		||||
    gIconbar.Visible = false;
 | 
			
		||||
    mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
  }
 | 
			
		||||
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp");  // F12
 | 
			
		||||
  if (keycode == eKeyTab)   show_inventory_window();  // Tab, show inventory
 | 
			
		||||
 | 
			
		||||
  // GAME COMMAND SHORTCUTS
 | 
			
		||||
  if (keycode == 'W') mouse.Mode=eModeWalkto; //Notice this alternate way to indicate keycodes.
 | 
			
		||||
  if (keycode == 'L') mouse.Mode=eModeLookat; //Note that all we do here is set modes.
 | 
			
		||||
  if (keycode == 'U') mouse.Mode=eModeInteract; //If you want something else to happen, such as GUI buttons highlighting,
 | 
			
		||||
  if (keycode == 'T') mouse.Mode=eModeTalkto; //you'll need some more scripting done.
 | 
			
		||||
  if (keycode == 'I') mouse.Mode=eModeUseinv; //But this will, as-is, give you some standard keyboard shortcuts your players will very much appreciate.
 | 
			
		||||
 | 
			
		||||
  // For extra cursor modes, such as pick up, feel free to add as you will.
 | 
			
		||||
  // Uncomment the line below if you use the "Pick Up" mode.
 | 
			
		||||
  //if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup; 
 | 
			
		||||
 | 
			
		||||
  // DEBUG FUNCTIONS
 | 
			
		||||
  if (keycode == eKeyCtrlS)  Debug(0,0);  // Ctrl-S, give all inventory
 | 
			
		||||
  if (keycode == eKeyCtrlV)  Debug(1,0);  // Ctrl-V, version
 | 
			
		||||
  if (keycode == eKeyCtrlA)  Debug(2,0);  // Ctrl-A, show walkable areas
 | 
			
		||||
  if (keycode == eKeyCtrlX)  Debug(3,0);  // Ctrl-X, teleport to room
 | 
			
		||||
  if (keycode == eKeyCtrlW && game.debug_mode) 
 | 
			
		||||
    player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function on_mouse_click(MouseButton button) {
 | 
			
		||||
  // called when a mouse button is clicked. button is either LEFT or RIGHT
 | 
			
		||||
  if (IsGamePaused() == 1) {
 | 
			
		||||
    // Game is paused, so do nothing (ie. don't allow mouse click)
 | 
			
		||||
  }
 | 
			
		||||
  else if (button == eMouseLeft) {
 | 
			
		||||
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
 | 
			
		||||
  }
 | 
			
		||||
  else if (button == eMouseRight || button == eMouseWheelSouth){
 | 
			
		||||
    // right-click our mouse-wheel down, so cycle cursor
 | 
			
		||||
    mouse.SelectNextMode();
 | 
			
		||||
  }
 | 
			
		||||
  else if (button == eMouseMiddle) { 
 | 
			
		||||
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
 | 
			
		||||
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
 | 
			
		||||
    // leave our options open - what if you have a special script triggered
 | 
			
		||||
    // on "walking" mode?
 | 
			
		||||
    ProcessClick(mouse.x, mouse.y, eModeWalkto); 
 | 
			
		||||
  }
 | 
			
		||||
  else if (button == eMouseWheelNorth) { 
 | 
			
		||||
    // Mouse-wheel up, cycle cursors 
 | 
			
		||||
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
 | 
			
		||||
    // of eNums, when it suits us)...
 | 
			
		||||
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1; 
 | 
			
		||||
    else 
 | 
			
		||||
    { 
 | 
			
		||||
      // ...but if it is WALK mode...
 | 
			
		||||
      if (player.ActiveInventory!=null) 
 | 
			
		||||
      {
 | 
			
		||||
        //...and the player has a selected inventory item, set mouse mode to UseInv. 
 | 
			
		||||
        mouse.Mode=eModeUseinv; 
 | 
			
		||||
      }
 | 
			
		||||
      else 
 | 
			
		||||
      {
 | 
			
		||||
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
 | 
			
		||||
        mouse.Mode=eModeTalkto; 
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function interface_click(int interface, int button) {
 | 
			
		||||
  // This function is obsolete, from 2.62 and earlier versions.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnInvUp_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  invCustomInv.ScrollUp();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnInvDown_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  invCustomInv.ScrollDown();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnInvOK_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
	// They pressed the OK button, close the GUI
 | 
			
		||||
	gInventory.Visible = false;
 | 
			
		||||
	mouse.UseDefaultGraphic();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnInvSelect_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  
 | 
			
		||||
	// They pressed SELECT, so switch to the Get cursor
 | 
			
		||||
	mouse.Mode = eModeInteract;
 | 
			
		||||
	// But, override the appearance to look like the arrow
 | 
			
		||||
	mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconInv_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  
 | 
			
		||||
  show_inventory_window();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconCurInv_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  
 | 
			
		||||
  if (player.ActiveInventory != null)
 | 
			
		||||
    mouse.Mode = eModeUseinv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconSave_Click(GUIControl *control, MouseButton button) 
 | 
			
		||||
{
 | 
			
		||||
  show_save_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconLoad_Click(GUIControl *control, MouseButton button) 
 | 
			
		||||
{
 | 
			
		||||
  show_restore_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconExit_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  
 | 
			
		||||
  QuitGame(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnIconAbout_Click(GUIControl *control, MouseButton button) {
 | 
			
		||||
  
 | 
			
		||||
  gPanel.Visible=true;
 | 
			
		||||
  gIconbar.Visible=false;
 | 
			
		||||
  mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function cEgo_Look()
 | 
			
		||||
{
 | 
			
		||||
  Display("Damn, I'm looking good!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function cEgo_Interact()
 | 
			
		||||
{
 | 
			
		||||
  Display("You rub your hands up and down your clothes.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function cEgo_Talk()
 | 
			
		||||
{
 | 
			
		||||
  Display("Talking to yourself is a sign of madness!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//START OF CONTROL PANEL FUNCTIONS
 | 
			
		||||
function btnSave_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gPanel.Visible = false;
 | 
			
		||||
  mouse.UseDefaultGraphic();
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
  Wait(1);
 | 
			
		||||
  btnIconSave_Click(btnIconSave, eMouseLeft);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function gControl_OnClick(GUI *theGui, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnAbout_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
Display("Adventure Game Studio run-time engine default game.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnQuit_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gPanel.Visible = false;
 | 
			
		||||
  Wait(1);
 | 
			
		||||
  QuitGame(1);
 | 
			
		||||
  gPanel.Visible = true;
 | 
			
		||||
  gIconbar.Visible = false;
 | 
			
		||||
  mouse.UseModeGraphic(eModePointer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnLoad_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gPanel.Visible = false;
 | 
			
		||||
  mouse.UseDefaultGraphic();
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
  Wait(1);
 | 
			
		||||
  btnIconLoad_Click(btnIconLoad, eMouseLeft);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnResume_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gPanel.Visible = false;
 | 
			
		||||
  mouse.UseDefaultGraphic();
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function sldAudio_OnChange(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  System.Volume = sldAudio.Value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function sldVoice_OnChange(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  // Sets voice volume. Note that we don't check for the existence of speech.vox - 
 | 
			
		||||
  // we did that in game_start, so if it's not there the slider won't even be available.
 | 
			
		||||
  SetSpeechVolume(sldVoice.Value); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnVoice_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  // Note that we don't check for the existence of speech.vox - we did that in game_start,
 | 
			
		||||
  // so if it's not there the button won't even be available.
 | 
			
		||||
  if (btnVoice.Text == "Voice and Text") { 
 | 
			
		||||
    SetVoiceMode(eSpeechVoiceOnly); 
 | 
			
		||||
    btnVoice.Text = "Voice only";
 | 
			
		||||
  }
 | 
			
		||||
  else if (btnVoice.Text == "Voice only") {
 | 
			
		||||
    SetVoiceMode(eSpeechTextOnly);
 | 
			
		||||
    btnVoice.Text = "Text only";
 | 
			
		||||
  }
 | 
			
		||||
  else if (btnVoice.Text == "Text only") {
 | 
			
		||||
    SetVoiceMode(eSpeechVoiceAndText);
 | 
			
		||||
    btnVoice.Text = "Voice and Text";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function sldGamma_OnChange(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  // Set the gamma. Note there's no need to check for anything else, as we ensured,
 | 
			
		||||
  // in game_start, that the slider won't even appear if it's not possible to do this.
 | 
			
		||||
  System.Gamma = sldGamma.Value; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnDefault_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  // Reset everything to default. You'll have to edit these as well as the sliders
 | 
			
		||||
  // if you'd rather have different default parameters.
 | 
			
		||||
  System.Volume = 100;
 | 
			
		||||
  sldAudio.Value = System.Volume;
 | 
			
		||||
  sldSpeed.Value = 40;
 | 
			
		||||
  SetGameSpeed(40);
 | 
			
		||||
  if (IsSpeechVoxAvailable()) {
 | 
			
		||||
     SetVoiceMode(eSpeechVoiceAndText);
 | 
			
		||||
     btnVoice.Text = "Voice and Text";
 | 
			
		||||
     sldVoice.Value = 255;
 | 
			
		||||
     SetSpeechVolume(255);
 | 
			
		||||
  }
 | 
			
		||||
  if (System.SupportsGammaControl) {
 | 
			
		||||
    System.Gamma = 100;
 | 
			
		||||
    sldGamma.Value = 100;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
//END OF CONTROL PANEL FUNCTIONS
 | 
			
		||||
 | 
			
		||||
function dialog_request(int param) 
 | 
			
		||||
{
 | 
			
		||||
  // This is used by the dialog text parser if you need to process
 | 
			
		||||
  // text that the player types in to the parser.
 | 
			
		||||
  // It is not used by default.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function sldSpeed_OnChange(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  SetGameSpeed(sldSpeed.Value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnRestart_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gRestartYN.Visible=true;
 | 
			
		||||
  gIconbar.Visible=false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnRestartYes_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  RestartGame();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnRestartNo_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  gRestartYN.Visible = false;
 | 
			
		||||
  gIconbar.Visible = true;
 | 
			
		||||
  // If the panel's not ON, then the player must have gotten here by tapping F9,
 | 
			
		||||
  // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
 | 
			
		||||
  // because it's already a pointer. Get used to thinking like this!!
 | 
			
		||||
  if (!gPanel.Visible) mouse.UseDefaultGraphic(); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnCancelSave_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  close_save_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
 | 
			
		||||
  int i = 0;
 | 
			
		||||
  while (i < lstSaveGamesList.ItemCount)
 | 
			
		||||
  {
 | 
			
		||||
    if (lstSaveGamesList.Items[i] == txtNewSaveName.Text)
 | 
			
		||||
    {
 | 
			
		||||
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i];
 | 
			
		||||
    }
 | 
			
		||||
    i++;
 | 
			
		||||
  }
 | 
			
		||||
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
 | 
			
		||||
  close_save_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnCancelRestore_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  close_restore_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  if (lstRestoreGamesList.SelectedIndex >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
 | 
			
		||||
  }
 | 
			
		||||
  close_restore_game_dialog();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function lstSaveGamesList_OnSelectionCh(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function txtNewSaveName_OnActivate(GUIControl *control)
 | 
			
		||||
{
 | 
			
		||||
  // Pressing return in the text box simulates clicking the Save button
 | 
			
		||||
  btnSaveGame_OnClick(control, eMouseLeft);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
 | 
			
		||||
{
 | 
			
		||||
  if (lstSaveGamesList.SelectedIndex >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
 | 
			
		||||
    lstSaveGamesList.FillSaveGameList();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								samples/AGS Script/GlobalScript.ash
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								samples/AGS Script/GlobalScript.ash
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
// Main header script - this will be included into every script in
 | 
			
		||||
// the game (local and global). Do not place functions here; rather,
 | 
			
		||||
// place import definitions and #define names here to be used by all
 | 
			
		||||
// scripts.
 | 
			
		||||
							
								
								
									
										216
									
								
								samples/AGS Script/KeyboardMovement_102.asc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								samples/AGS Script/KeyboardMovement_102.asc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,216 @@
 | 
			
		||||
// Main script for module 'KeyboardMovement'
 | 
			
		||||
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
// DEFINITIONS
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
 | 
			
		||||
#define DISTANCE 10000// distance player walks in Tapping mode before he stops
 | 
			
		||||
 | 
			
		||||
enum KeyboardMovement_Directions {
 | 
			
		||||
	eKeyboardMovement_Stop, 
 | 
			
		||||
	eKeyboardMovement_DownLeft, 
 | 
			
		||||
	eKeyboardMovement_Down, 
 | 
			
		||||
	eKeyboardMovement_DownRight, 
 | 
			
		||||
	eKeyboardMovement_Left, 
 | 
			
		||||
	eKeyboardMovement_Right, 
 | 
			
		||||
	eKeyboardMovement_UpLeft, 
 | 
			
		||||
	eKeyboardMovement_Up, 
 | 
			
		||||
	eKeyboardMovement_UpRight
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
// VARIABLES
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
 | 
			
		||||
// keycodes as variables for future key customization functions (static variables?):
 | 
			
		||||
int KeyboardMovement_KeyDown = 380; // down arrow
 | 
			
		||||
int KeyboardMovement_KeyLeft = 375; // left arrow
 | 
			
		||||
int KeyboardMovement_KeyRight = 377; // right arrow
 | 
			
		||||
int KeyboardMovement_KeyUp = 372; // up arrow
 | 
			
		||||
int KeyboardMovement_KeyDownRight = 381; // PgDn (numpad)
 | 
			
		||||
int KeyboardMovement_KeyUpRight = 373; // PgUp (numpad)
 | 
			
		||||
int KeyboardMovement_KeyDownLeft = 379; // End (numpad)
 | 
			
		||||
int KeyboardMovement_KeyUpLeft = 371; // Home (numpad)
 | 
			
		||||
int KeyboardMovement_KeyStop = 376; // 5 (numpad)
 | 
			
		||||
 | 
			
		||||
KeyboardMovement_Modes KeyboardMovement_Mode = eKeyboardMovement_None; // stores current keyboard control mode (disabled by default)
 | 
			
		||||
 | 
			
		||||
KeyboardMovement_Directions KeyboardMovement_CurrentDirection = eKeyboardMovement_Stop; // stores current walking direction of player character
 | 
			
		||||
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
// USER FUNCTIONS
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
static function KeyboardMovement::SetMode(KeyboardMovement_Modes mode) {
 | 
			
		||||
	KeyboardMovement_Mode = mode;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
// key customization functions here
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
// EVENT HANDLER FUNCTIONS
 | 
			
		||||
//****************************************************************************************************
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
function repeatedly_execute() {
 | 
			
		||||
 | 
			
		||||
	//--------------------------------------------------
 | 
			
		||||
	// Pressing mode
 | 
			
		||||
	//--------------------------------------------------
 | 
			
		||||
 | 
			
		||||
	if ((IsGamePaused() == true) || (KeyboardMovement_Mode != eKeyboardMovement_Pressing) || (IsInterfaceEnabled() == false) || (player.on == false)) return 0;
 | 
			
		||||
	  // if game is paused, module or mode disabled, interface disabled or player character hidden, quit function
 | 
			
		||||
 | 
			
		||||
	KeyboardMovement_Directions newdirection; // declare variable storing new direction
 | 
			
		||||
 | 
			
		||||
	// get new direction:
 | 
			
		||||
	if ( ((IsKeyPressed(KeyboardMovement_KeyDown)) && (IsKeyPressed(KeyboardMovement_KeyRight))) || (IsKeyPressed(KeyboardMovement_KeyDownRight)) ) newdirection = eKeyboardMovement_DownRight; // if down&right arrows or PgDn (numeric pad) held down, set new direction to Down-Right
 | 
			
		||||
	else if ( ((IsKeyPressed(KeyboardMovement_KeyUp)) && (IsKeyPressed(KeyboardMovement_KeyRight))) || (IsKeyPressed(KeyboardMovement_KeyUpRight)) ) newdirection = eKeyboardMovement_UpRight; // up&right arrows or PgUp (numpad)
 | 
			
		||||
	else if ( ((IsKeyPressed(KeyboardMovement_KeyDown)) && (IsKeyPressed(KeyboardMovement_KeyLeft))) || (IsKeyPressed(KeyboardMovement_KeyDownLeft)) ) newdirection = eKeyboardMovement_DownLeft; // down&left arrows or End (numpad)
 | 
			
		||||
	else if ( ((IsKeyPressed(KeyboardMovement_KeyUp)) && (IsKeyPressed(KeyboardMovement_KeyLeft))) || (IsKeyPressed(KeyboardMovement_KeyUpLeft)) ) newdirection = eKeyboardMovement_UpLeft; // up&left arrows or Home (numpad)
 | 
			
		||||
	else if (IsKeyPressed(KeyboardMovement_KeyDown)) newdirection = eKeyboardMovement_Down; // down arrow
 | 
			
		||||
	else if (IsKeyPressed(KeyboardMovement_KeyLeft)) newdirection = eKeyboardMovement_Left; // left arrow
 | 
			
		||||
	else if (IsKeyPressed(KeyboardMovement_KeyRight)) newdirection = eKeyboardMovement_Right; // right arrow
 | 
			
		||||
	else if (IsKeyPressed(KeyboardMovement_KeyUp)) newdirection = eKeyboardMovement_Up; // up arrow
 | 
			
		||||
	else newdirection = eKeyboardMovement_Stop; // if none of the above held down, set it to stop player character
 | 
			
		||||
 | 
			
		||||
	if (IsKeyPressed(KeyboardMovement_KeyStop)) newdirection = eKeyboardMovement_Stop; // if 5 (numeric pad) held down, stop player character, regardless of whether some of the above are held down
 | 
			
		||||
 | 
			
		||||
	if (newdirection != KeyboardMovement_CurrentDirection) { // if new direction is different from current direction
 | 
			
		||||
 | 
			
		||||
		if (newdirection == eKeyboardMovement_Stop) player.StopMoving(); // if new direction is the Stop command, stop movement of player character
 | 
			
		||||
		else { // if new direction is NOT the Stop command
 | 
			
		||||
 | 
			
		||||
			int dx, dy; // declare variables storing new walk coordinates
 | 
			
		||||
			if (newdirection == eKeyboardMovement_DownRight) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_UpRight) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_DownLeft) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_UpLeft) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Down) {
 | 
			
		||||
				dx = 0;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Left) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Right) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Up) {
 | 
			
		||||
				dx = 0;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			player.WalkStraight(player.x + dx, player.y + dy, eNoBlock); // walk player character to the new coordinates
 | 
			
		||||
		}
 | 
			
		||||
		KeyboardMovement_CurrentDirection = newdirection; // update current direction to new direction
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
function on_key_press(int keycode) {
 | 
			
		||||
 | 
			
		||||
	//--------------------------------------------------
 | 
			
		||||
	// Tapping mode
 | 
			
		||||
	//--------------------------------------------------
 | 
			
		||||
 | 
			
		||||
	if ((IsGamePaused() == true) || (KeyboardMovement_Mode != eKeyboardMovement_Tapping) || (IsInterfaceEnabled() == false) || (player.on == false)) return 0;
 | 
			
		||||
	  // if game is paused, module or mode disabled, interface disabled or player character hidden, quit function
 | 
			
		||||
 | 
			
		||||
	KeyboardMovement_Directions newdirection; // declare variable storing new direction
 | 
			
		||||
 | 
			
		||||
	// get new direction:
 | 
			
		||||
	if (keycode == KeyboardMovement_KeyDownRight) newdirection = eKeyboardMovement_DownRight; // if down-right key pressed, set new direction to Down-Right
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyUpRight) newdirection = eKeyboardMovement_UpRight;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyDownLeft) newdirection = eKeyboardMovement_DownLeft;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyUpLeft) newdirection = eKeyboardMovement_UpLeft;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyDown) newdirection = eKeyboardMovement_Down;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyLeft) newdirection = eKeyboardMovement_Left;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyRight) newdirection = eKeyboardMovement_Right;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyUp) newdirection = eKeyboardMovement_Up;
 | 
			
		||||
	else if (keycode == KeyboardMovement_KeyStop) newdirection = eKeyboardMovement_Stop; // if stop key pressed, set to stop player character
 | 
			
		||||
 | 
			
		||||
	if (newdirection != KeyboardMovement_CurrentDirection) { // if new direction is different from current direction
 | 
			
		||||
 | 
			
		||||
		if (newdirection == eKeyboardMovement_Stop) player.StopMoving(); // if new direction is the Stop command, stop movement of player character
 | 
			
		||||
		else { // if new direction is NOT the Stop command
 | 
			
		||||
 | 
			
		||||
			int dx, dy; // declare variables storing new walk coordinates
 | 
			
		||||
			if (newdirection == eKeyboardMovement_DownRight) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_UpRight) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_DownLeft) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_UpLeft) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Down) {
 | 
			
		||||
				dx = 0;
 | 
			
		||||
				dy = DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Left) {
 | 
			
		||||
				dx = -DISTANCE;
 | 
			
		||||
				dy = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Right) {
 | 
			
		||||
				dx = DISTANCE;
 | 
			
		||||
				dy = 0;
 | 
			
		||||
			}
 | 
			
		||||
			else if (newdirection == eKeyboardMovement_Up) {
 | 
			
		||||
				dx = 0;
 | 
			
		||||
				dy = -DISTANCE;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			player.WalkStraight(player.x + dx, player.y + dy, eNoBlock); // walk player character to the new coordinates
 | 
			
		||||
		}
 | 
			
		||||
		KeyboardMovement_CurrentDirection = newdirection; // update current direction to new direction
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	else { // if new direction is same as current direction
 | 
			
		||||
		player.StopMoving(); // stop player character
 | 
			
		||||
		KeyboardMovement_CurrentDirection = eKeyboardMovement_Stop; // update current direction
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
 | 
			
		||||
function on_event(EventType event, int data) {
 | 
			
		||||
 | 
			
		||||
	if (event == eEventLeaveRoom) KeyboardMovement_CurrentDirection = eKeyboardMovement_Stop;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//====================================================================================================
 | 
			
		||||
							
								
								
									
										13
									
								
								samples/AGS Script/KeyboardMovement_102.ash
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								samples/AGS Script/KeyboardMovement_102.ash
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
// Script header for module 'KeyboardMovement'
 | 
			
		||||
 | 
			
		||||
#define KeyboardMovement_VERSION 101
 | 
			
		||||
 | 
			
		||||
enum KeyboardMovement_Modes {
 | 
			
		||||
	eKeyboardMovement_None, 
 | 
			
		||||
	eKeyboardMovement_Tapping, 
 | 
			
		||||
	eKeyboardMovement_Pressing
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct KeyboardMovement {
 | 
			
		||||
	import static function SetMode(KeyboardMovement_Modes mode);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										18
									
								
								samples/APL/DeepakChopra.apl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								samples/APL/DeepakChopra.apl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
⍝   You can try this at http://tryapl.org/
 | 
			
		||||
⍝   I can not explain how much I suddenly love this crypto-language
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Starts     ← 'Experiential truth ' 'The physical world ' 'Non-judgment '       'Quantum physics '
 | 
			
		||||
Middles    ← 'nurtures an '        'projects onto '      'imparts reality to ' 'constructs with '
 | 
			
		||||
Qualifiers ← 'abundance of '       'the barrier of '     'self-righteous '     'potential '
 | 
			
		||||
Finishes   ← 'marvel.'             'choices.'            'creativity.'         'actions.'
 | 
			
		||||
 | 
			
		||||
rf     ← {(?⍴⍵)⊃⍵}
 | 
			
		||||
erf    ← {rf ¨ ⍵}
 | 
			
		||||
 | 
			
		||||
deepak ← {erf Starts Middles Qualifiers Finishes}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
deepak ⍬
 | 
			
		||||
							
								
								
									
										304
									
								
								samples/Chapel/distributions.chpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										304
									
								
								samples/Chapel/distributions.chpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,304 @@
 | 
			
		||||
//
 | 
			
		||||
// Distributions Primer
 | 
			
		||||
//
 | 
			
		||||
// This primer demonstrates uses of some of Chapel's standard
 | 
			
		||||
// distributions.  To use these distributions in a Chapel program,
 | 
			
		||||
// the respective module must be used:
 | 
			
		||||
//
 | 
			
		||||
use BlockDist, CyclicDist, BlockCycDist, ReplicatedDist;
 | 
			
		||||
use DimensionalDist2D, ReplicatedDim, BlockCycDim;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// For each distribution, we'll create a distributed domain and array
 | 
			
		||||
// and then initialize it just to give a brief flavor of how the
 | 
			
		||||
// distribution maps across locales.  Running this example on 6
 | 
			
		||||
// locales does a nice job of illustrating the distribution
 | 
			
		||||
// characteristics.
 | 
			
		||||
//
 | 
			
		||||
// All of these distributions support options to map to a different
 | 
			
		||||
// virtual locale grid than the one used by default (a
 | 
			
		||||
// multidimensional factoring of the built-in Locales array), as well
 | 
			
		||||
// as to control the amount of parallelism used in data parallel
 | 
			
		||||
// loops.  See the Standard Distributions chapter of the language spec
 | 
			
		||||
// for more details.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Make the program size configurable from the command line.
 | 
			
		||||
//
 | 
			
		||||
config const n = 8;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Declare a 2-dimensional domain Space that we will later use to
 | 
			
		||||
// initialize the distributed domains.
 | 
			
		||||
//
 | 
			
		||||
const Space = {1..n, 1..n};
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The Block distribution distributes a bounding box from
 | 
			
		||||
// n-dimensional space across the target locale array viewed as an
 | 
			
		||||
// n-dimensional virtual locale grid.  The bounding box is blocked
 | 
			
		||||
// into roughly equal portions across the locales.  Note that domains
 | 
			
		||||
// declared over a Block distribution can also store indices outside
 | 
			
		||||
// of the bounding box; the bounding box is merely used to compute
 | 
			
		||||
// the blocking of space.
 | 
			
		||||
//
 | 
			
		||||
// In this example, we declare a 2-dimensional Block-distributed
 | 
			
		||||
// domain BlockSpace and a Block-distributed array BA declared over
 | 
			
		||||
// the domain.
 | 
			
		||||
//
 | 
			
		||||
const BlockSpace = Space dmapped Block(boundingBox=Space);
 | 
			
		||||
var BA: [BlockSpace] int;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// To illustrate how the index set is distributed across locales,
 | 
			
		||||
// we'll use a forall loop to initialize each array element to the
 | 
			
		||||
// locale ID that stores that index/element/iteration.
 | 
			
		||||
//
 | 
			
		||||
forall ba in BA do
 | 
			
		||||
  ba = here.id;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Output the Block-distributed array to visually see how the elements
 | 
			
		||||
// are partitioned across the locales.
 | 
			
		||||
//
 | 
			
		||||
writeln("Block Array Index Map");
 | 
			
		||||
writeln(BA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Most of Chapel's standard distributions support an optional
 | 
			
		||||
// targetLocales argument that permits you to pass in your own
 | 
			
		||||
// array of locales to be targeted.  In general, the targetLocales
 | 
			
		||||
// argument should match the rank of the distribution.  So for
 | 
			
		||||
// example, to map a Block to a [numLocales x 1] view of the
 | 
			
		||||
// locale set, one could do something like this:
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// We start by creating our own array of the locale values.  Here
 | 
			
		||||
// we use the standard array reshape function for convenience,
 | 
			
		||||
// but more generally, this array could be accessed/assigned like any
 | 
			
		||||
// other.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
var MyLocaleView = {0..#numLocales, 1..1};
 | 
			
		||||
var MyLocales: [MyLocaleView] locale = reshape(Locales, MyLocaleView);
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Then we'll declare a distributed domain/array that targets
 | 
			
		||||
// this view of the locales:
 | 
			
		||||
// 
 | 
			
		||||
 | 
			
		||||
const BlockSpace2 = Space dmapped Block(boundingBox=Space,
 | 
			
		||||
                                        targetLocales=MyLocales);
 | 
			
		||||
var BA2: [BlockSpace2] int;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Then we'll do a similar computation as before to verify where
 | 
			
		||||
// everything ended up:
 | 
			
		||||
//
 | 
			
		||||
forall ba in BA2 do
 | 
			
		||||
  ba = here.id;
 | 
			
		||||
 | 
			
		||||
writeln("Block Array Index Map");
 | 
			
		||||
writeln(BA2);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Next, we'll perform a similar computation for the Cyclic distribution.
 | 
			
		||||
// Cyclic distributions start at a designated n-dimensional index and
 | 
			
		||||
// distribute the n-dimensional space across an n-dimensional array
 | 
			
		||||
// of locales in a round-robin fashion (in each dimension).  As with
 | 
			
		||||
// the Block distribution, domains may be declared using the
 | 
			
		||||
// distribution who have lower indices that the starting index; that
 | 
			
		||||
// value should just be considered a parameterization of how the
 | 
			
		||||
// distribution is defined.
 | 
			
		||||
//
 | 
			
		||||
const CyclicSpace = Space dmapped Cyclic(startIdx=Space.low);
 | 
			
		||||
var CA: [CyclicSpace] int;
 | 
			
		||||
 | 
			
		||||
forall ca in CA do
 | 
			
		||||
  ca = here.id;
 | 
			
		||||
 | 
			
		||||
writeln("Cyclic Array Index Map");
 | 
			
		||||
writeln(CA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Next, we'll declare a Block-Cyclic distribution.  These
 | 
			
		||||
// distributions also deal out indices in a round-robin fashion,
 | 
			
		||||
// but rather than dealing out singleton indices, they deal out blocks
 | 
			
		||||
// of indices.  Thus, the BlockCyclic distribution is parameterized
 | 
			
		||||
// by a starting index (as with Cyclic) and a block size (per
 | 
			
		||||
// dimension) specifying how large the chunks to be dealt out are.
 | 
			
		||||
// 
 | 
			
		||||
const BlkCycSpace = Space dmapped BlockCyclic(startIdx=Space.low, 
 | 
			
		||||
                                              blocksize=(2, 3));
 | 
			
		||||
var BCA: [BlkCycSpace] int;
 | 
			
		||||
 | 
			
		||||
forall bca in BCA do
 | 
			
		||||
  bca = here.id;
 | 
			
		||||
 | 
			
		||||
writeln("Block-Cyclic Array Index Map");
 | 
			
		||||
writeln(BCA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The ReplicatedDist distribution is different: each of the
 | 
			
		||||
// original domain's indices - and the corresponding array elements -
 | 
			
		||||
// is replicated onto each locale. (Note: consistency among these
 | 
			
		||||
// array replicands is NOT maintained automatically.)
 | 
			
		||||
//
 | 
			
		||||
// This replication is observable in some cases but not others,
 | 
			
		||||
// as shown below. Note: this behavior may change in the future.
 | 
			
		||||
//
 | 
			
		||||
const ReplicatedSpace = Space dmapped ReplicatedDist();
 | 
			
		||||
var RA: [ReplicatedSpace] int;
 | 
			
		||||
 | 
			
		||||
// The replication is observable - this visits each replicand.
 | 
			
		||||
forall ra in RA do
 | 
			
		||||
  ra = here.id;
 | 
			
		||||
 | 
			
		||||
writeln("Replicated Array Index Map, ", RA.numElements, " elements total");
 | 
			
		||||
writeln(RA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The replication is observable when the replicated array is
 | 
			
		||||
// on the left-hand side. If the right-hand side is not replicated,
 | 
			
		||||
// it is copied into each replicand.
 | 
			
		||||
// We illustrate this using a non-distributed array.
 | 
			
		||||
//
 | 
			
		||||
var A: [Space] int = [(i,j) in Space] i*100 + j;
 | 
			
		||||
RA = A;
 | 
			
		||||
writeln("Replicated Array after being array-assigned into");
 | 
			
		||||
writeln(RA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Analogously, each replicand will be visited and
 | 
			
		||||
// other participated expressions will be computed on each locale
 | 
			
		||||
// (a) when the replicated array is assigned a scalar:
 | 
			
		||||
//       RA = 5;
 | 
			
		||||
// (b) when it appears first in a zippered forall loop:
 | 
			
		||||
//       forall (ra, a) in zip(RA, A) do ...;
 | 
			
		||||
// (c) when it appears in a for loop:
 | 
			
		||||
//       for ra in RA do ...;
 | 
			
		||||
//
 | 
			
		||||
// Zippering (RA,A) or (A,RA) in a 'for' loop will generate
 | 
			
		||||
// an error due to their different number of elements.
 | 
			
		||||
 | 
			
		||||
// Let RA store the Index Map again, for the examples below.
 | 
			
		||||
forall ra in RA do
 | 
			
		||||
  ra = here.id;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Only the local replicand is accessed - replication is NOT observable
 | 
			
		||||
// and consistency is NOT maintained - when:
 | 
			
		||||
// (a) the replicated array is indexed - an individual element is read...
 | 
			
		||||
//
 | 
			
		||||
on Locales(0) do
 | 
			
		||||
  writeln("on ", here, ": ", RA(Space.low));
 | 
			
		||||
on Locales(LocaleSpace.high) do
 | 
			
		||||
  writeln("on ", here, ": ", RA(Space.low));
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
// ...or an individual element is written;
 | 
			
		||||
on Locales(LocaleSpace.high) do
 | 
			
		||||
  RA(Space.low) = 7777;
 | 
			
		||||
 | 
			
		||||
writeln("Replicated Array after being indexed into");
 | 
			
		||||
writeln(RA);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// (b) the replicated array is on the right-hand side of an assignment...
 | 
			
		||||
//
 | 
			
		||||
on Locales(LocaleSpace.high) do
 | 
			
		||||
  A = RA + 4;
 | 
			
		||||
writeln("Non-Replicated Array after assignment from Replicated Array + 4");
 | 
			
		||||
writeln(A);
 | 
			
		||||
writeln();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// (c) ...or, generally, the replicated array or domain participates
 | 
			
		||||
//     in a zippered forall loop, but not in the first position.
 | 
			
		||||
//     The loop could look like:
 | 
			
		||||
//
 | 
			
		||||
//       forall (a, (i,j), ra) in (A, ReplicatedSpace, RA) do ...;
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The DimensionalDist2D distribution lets us build a 2D distribution
 | 
			
		||||
// as a composition of specifiers for individual dimensions.
 | 
			
		||||
// Under such a "dimensional" distribution each dimension is handled
 | 
			
		||||
// independently of the other.
 | 
			
		||||
//
 | 
			
		||||
// The dimension specifiers are similar to the corresponding multi-dimensional
 | 
			
		||||
// distributions in constructor arguments and index-to-locale mapping rules.
 | 
			
		||||
// However, instead of an array of locales, a specifier constructor
 | 
			
		||||
// accepts just the number of locales that the indices in the corresponding
 | 
			
		||||
// dimension will be distributed across.
 | 
			
		||||
//
 | 
			
		||||
// The DimensionalDist2D constructor requires:
 | 
			
		||||
// * an [0..nl1-1, 0..nl2-1] array of locales, where
 | 
			
		||||
//   nl1 and nl2 are the number of locales in each dimension, and
 | 
			
		||||
// * two dimension specifiers, created for nl1 and nl2 locale counts, resp.
 | 
			
		||||
//
 | 
			
		||||
// Presently, the following dimension specifiers are available
 | 
			
		||||
// (shown here with their constructor arguments):
 | 
			
		||||
//
 | 
			
		||||
// * ReplicatedDim(numLocales)
 | 
			
		||||
// * BlockDim(numLocales, boundingBoxLow, boundingBoxHigh)
 | 
			
		||||
// * BlockCyclicDim(lowIdx, blockSize, numLocales)
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The following example creates a dimensional distribution that
 | 
			
		||||
// replicates over 2 locales (when available) in the first dimemsion
 | 
			
		||||
// and distributes using block-cyclic distribution in the second dimension.
 | 
			
		||||
// The example computes nl1 and nl2 and reshapes MyLocales correspondingly.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
var (nl1, nl2) = if numLocales == 1 then (1, 1) else (2, numLocales/2);
 | 
			
		||||
MyLocaleView = {0..#nl1, 0..#nl2};
 | 
			
		||||
MyLocales = reshape(Locales[0..#nl1*nl2], MyLocaleView);
 | 
			
		||||
 | 
			
		||||
const DimReplicatedBlockcyclicSpace = Space
 | 
			
		||||
  dmapped DimensionalDist2D(MyLocales,
 | 
			
		||||
                            new ReplicatedDim(numLocales = nl1),
 | 
			
		||||
                            new BlockCyclicDim(numLocales = nl2,
 | 
			
		||||
                                               lowIdx = 1, blockSize = 2));
 | 
			
		||||
 | 
			
		||||
var DRBA: [DimReplicatedBlockcyclicSpace] int;
 | 
			
		||||
 | 
			
		||||
// The ReplicatedDim specifier always accesses the local replicand.
 | 
			
		||||
// (This differs from how the ReplicatedDist distribution works.)
 | 
			
		||||
//
 | 
			
		||||
// This example visits each replicand. The behavior is the same
 | 
			
		||||
// regardless of the second index into MyLocales below.
 | 
			
		||||
 | 
			
		||||
for locId1 in 0..#nl1 do on MyLocales[locId1, 0] {
 | 
			
		||||
 | 
			
		||||
  forall drba in DRBA do
 | 
			
		||||
    drba = here.id;
 | 
			
		||||
 | 
			
		||||
  writeln("Dimensional2D(Replicated,BlockCyclic) Array Index Map",
 | 
			
		||||
          " from ", here);
 | 
			
		||||
 | 
			
		||||
  // Technicality: 'writeln(DRBA)' would read DRBA always on Locale 0.
 | 
			
		||||
  // Since we want to see what DRBA contains on the current locale,
 | 
			
		||||
  // we use 'Helper' that is mapped using the default distribution.
 | 
			
		||||
  // 'Helper = DRBA' captures the view of DRBA on the current locale,
 | 
			
		||||
  // which we then print out.
 | 
			
		||||
 | 
			
		||||
  const Helper: [Space] int = DRBA;
 | 
			
		||||
  writeln(Helper);
 | 
			
		||||
  writeln();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								samples/Chapel/hello.chpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/Chapel/hello.chpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
writeln("Hello, world!");    // print 'Hello, world!' to the console
 | 
			
		||||
							
								
								
									
										1692
									
								
								samples/Chapel/lulesh.chpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1692
									
								
								samples/Chapel/lulesh.chpl
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										147
									
								
								samples/Chapel/nbody.chpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								samples/Chapel/nbody.chpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,147 @@
 | 
			
		||||
/* The Computer Language Benchmarks Game
 | 
			
		||||
   http://benchmarksgame.alioth.debian.org/
 | 
			
		||||
 | 
			
		||||
   contributed by Albert Sidelnik
 | 
			
		||||
   modified by Brad Chamberlain
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The number of timesteps to simulate; may be set via the command-line
 | 
			
		||||
//
 | 
			
		||||
config const n = 10000;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// Constants representing pi, the solar mass, and the number of days per year
 | 
			
		||||
//
 | 
			
		||||
const pi = 3.141592653589793,
 | 
			
		||||
      solarMass = 4 * pi**2,
 | 
			
		||||
      daysPerYear = 365.24;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// a record representing one of the bodies in the solar system
 | 
			
		||||
//
 | 
			
		||||
record body {
 | 
			
		||||
  var pos: 3*real;
 | 
			
		||||
  var v: 3*real;
 | 
			
		||||
  var mass: real;  // does not change after it is set up
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// the array of bodies that we'll be simulating
 | 
			
		||||
//
 | 
			
		||||
var bodies = [/* sun */
 | 
			
		||||
              new body(mass = solarMass),
 | 
			
		||||
 | 
			
		||||
              /* jupiter */
 | 
			
		||||
              new body(pos = ( 4.84143144246472090e+00,
 | 
			
		||||
                              -1.16032004402742839e+00,
 | 
			
		||||
                              -1.03622044471123109e-01),
 | 
			
		||||
                         v = ( 1.66007664274403694e-03 * daysPerYear,
 | 
			
		||||
                               7.69901118419740425e-03 * daysPerYear,
 | 
			
		||||
                              -6.90460016972063023e-05 * daysPerYear),
 | 
			
		||||
                      mass =   9.54791938424326609e-04 * solarMass),
 | 
			
		||||
  
 | 
			
		||||
              /* saturn */
 | 
			
		||||
              new body(pos = ( 8.34336671824457987e+00,
 | 
			
		||||
                               4.12479856412430479e+00,
 | 
			
		||||
                              -4.03523417114321381e-01),
 | 
			
		||||
                         v = (-2.76742510726862411e-03 * daysPerYear,
 | 
			
		||||
                               4.99852801234917238e-03 * daysPerYear,
 | 
			
		||||
                               2.30417297573763929e-05 * daysPerYear),
 | 
			
		||||
                      mass =   2.85885980666130812e-04 * solarMass),
 | 
			
		||||
 | 
			
		||||
              /* uranus */
 | 
			
		||||
              new body(pos = ( 1.28943695621391310e+01,
 | 
			
		||||
                              -1.51111514016986312e+01,
 | 
			
		||||
                              -2.23307578892655734e-01),
 | 
			
		||||
                         v = ( 2.96460137564761618e-03 * daysPerYear,
 | 
			
		||||
                               2.37847173959480950e-03 * daysPerYear,
 | 
			
		||||
                              -2.96589568540237556e-05 * daysPerYear),
 | 
			
		||||
                      mass =   4.36624404335156298e-05 * solarMass),
 | 
			
		||||
 | 
			
		||||
              /* neptune */
 | 
			
		||||
              new body(pos = ( 1.53796971148509165e+01,
 | 
			
		||||
                              -2.59193146099879641e+01,
 | 
			
		||||
                               1.79258772950371181e-01),
 | 
			
		||||
                         v = ( 2.68067772490389322e-03 * daysPerYear,
 | 
			
		||||
                               1.62824170038242295e-03 * daysPerYear,
 | 
			
		||||
                              -9.51592254519715870e-05 * daysPerYear),
 | 
			
		||||
                      mass =   5.15138902046611451e-05 * solarMass)
 | 
			
		||||
              ];
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// the number of bodies to be simulated
 | 
			
		||||
//
 | 
			
		||||
const numbodies = bodies.numElements;
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// The computation involves initializing the sun's velocity,
 | 
			
		||||
// writing the initial energy, advancing the system through 'n'
 | 
			
		||||
// timesteps, and writing the final energy.
 | 
			
		||||
//
 | 
			
		||||
proc main() {
 | 
			
		||||
  initSun();
 | 
			
		||||
 | 
			
		||||
  writef("%.9r\n", energy());
 | 
			
		||||
  for 1..n do
 | 
			
		||||
    advance(0.01);
 | 
			
		||||
  writef("%.9r\n", energy());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// compute the sun's initial velocity
 | 
			
		||||
//
 | 
			
		||||
proc initSun() {
 | 
			
		||||
  const p = + reduce (for b in bodies do (b.v * b.mass));
 | 
			
		||||
  bodies[1].v = -p / solarMass;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// advance the positions and velocities of all the bodies
 | 
			
		||||
//
 | 
			
		||||
proc advance(dt) {
 | 
			
		||||
  for i in 1..numbodies {
 | 
			
		||||
    for j in i+1..numbodies {
 | 
			
		||||
      updateVelocities(bodies[i], bodies[j]);
 | 
			
		||||
      
 | 
			
		||||
      inline proc updateVelocities(ref b1, ref b2) {
 | 
			
		||||
        const dpos = b1.pos - b2.pos,
 | 
			
		||||
               mag = dt / sqrt(sumOfSquares(dpos))**3;
 | 
			
		||||
        
 | 
			
		||||
        b1.v -= dpos * b2.mass * mag;
 | 
			
		||||
        b2.v += dpos * b1.mass * mag;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  for b in bodies do
 | 
			
		||||
    b.pos += dt * b.v;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// compute the energy of the bodies
 | 
			
		||||
//
 | 
			
		||||
proc energy() {
 | 
			
		||||
  var e = 0.0;
 | 
			
		||||
  
 | 
			
		||||
  for i in 1..numbodies {
 | 
			
		||||
    const b1 = bodies[i];
 | 
			
		||||
    
 | 
			
		||||
    e += 0.5 * b1.mass * sumOfSquares(b1.v);
 | 
			
		||||
    
 | 
			
		||||
    for j in i+1..numbodies {
 | 
			
		||||
      const b2 = bodies[j];
 | 
			
		||||
      
 | 
			
		||||
      e -= (b1.mass * b2.mass) / sqrt(sumOfSquares(b1.pos - b2.pos));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  return e;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// a helper routine to compute the sum of squares of a 3-tuple's components
 | 
			
		||||
//
 | 
			
		||||
inline proc sumOfSquares(x)
 | 
			
		||||
  return x(1)**2 + x(2)**2 + x(3)**2;
 | 
			
		||||
							
								
								
									
										145
									
								
								samples/Chapel/quicksort.chpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								samples/Chapel/quicksort.chpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,145 @@
 | 
			
		||||
//
 | 
			
		||||
// An example of a parallel quick sort implementation that uses
 | 
			
		||||
// "cobegin" to make each recursive call in parallel and "serial" to
 | 
			
		||||
// limit the number of threads.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
use Random, Time; // for random number generation and the Timer class
 | 
			
		||||
 | 
			
		||||
var timer: Timer; // to time the sort
 | 
			
		||||
 | 
			
		||||
config var n: int = 2**15;      // the size of the array to be sorted
 | 
			
		||||
config var thresh: int = 1;     // the recursive depth to serialize
 | 
			
		||||
config var verbose: int = 0;    // print out this many elements in array
 | 
			
		||||
config var timing: bool = true; // set timing to false to disable timer
 | 
			
		||||
 | 
			
		||||
var A: [1..n] real; // array of real numbers
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// initialize array with random numbers
 | 
			
		||||
//
 | 
			
		||||
fillRandom(A);
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// print out front of array if verbose flag is set
 | 
			
		||||
//
 | 
			
		||||
if verbose > 0 then
 | 
			
		||||
  writeln("A[1..", verbose, "] = ", A[1..verbose]);
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// start timer, call parallel quick sort routine, stop timer
 | 
			
		||||
//
 | 
			
		||||
if timing then timer.start();
 | 
			
		||||
pqsort(A, thresh);
 | 
			
		||||
if timing then timer.stop();
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// report sort time
 | 
			
		||||
//
 | 
			
		||||
if timing then writeln("sorted in ", timer.elapsed(), " seconds");
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// print out front of array if verbose flag is set
 | 
			
		||||
//   values should now be in sorted order
 | 
			
		||||
//
 | 
			
		||||
if verbose > 0 then
 | 
			
		||||
  writeln("A[1..", verbose, "] = ", A[1..verbose]);
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// verify that array is sorted or halt
 | 
			
		||||
//
 | 
			
		||||
for i in 2..n do
 | 
			
		||||
  if A(i) < A(i-1) then
 | 
			
		||||
    halt("A(", i-1, ") == ", A(i-1), " > A(", i, ") == ", A(i));
 | 
			
		||||
 | 
			
		||||
writeln("verification success");
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// pqsort -- parallel quick sort
 | 
			
		||||
//
 | 
			
		||||
//   arr: generic 1D array of values (real, int, ...)
 | 
			
		||||
//   thresh: number of recursive calls to make before serializing
 | 
			
		||||
//   low: lower bound of array to start sort at, defaults to whole array
 | 
			
		||||
//   high: upper bound of array to stop sort at, defaults to whole array
 | 
			
		||||
//
 | 
			
		||||
proc pqsort(arr: [],
 | 
			
		||||
           thresh: int,
 | 
			
		||||
           low: int = arr.domain.low,
 | 
			
		||||
           high: int = arr.domain.high) where arr.rank == 1 {
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // base case: arr[low..high] is small enough to bubble sort
 | 
			
		||||
  //
 | 
			
		||||
  if high - low < 8 {
 | 
			
		||||
    bubbleSort(arr, low, high);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // determine pivot and partition arr[low..high]
 | 
			
		||||
  //
 | 
			
		||||
  const pivotVal = findPivot();
 | 
			
		||||
  const pivotLoc = partition(pivotVal);
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // make recursive calls to parallel quick sort each unsorted half of
 | 
			
		||||
  // the array; if thresh is 0 or less, start executing conquer tasks
 | 
			
		||||
  // serially
 | 
			
		||||
  //
 | 
			
		||||
  serial thresh <= 0 do cobegin {
 | 
			
		||||
    pqsort(arr, thresh-1, low, pivotLoc-1);
 | 
			
		||||
    pqsort(arr, thresh-1, pivotLoc+1, high);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // findPivot -- helper routine to find pivot value using simple
 | 
			
		||||
  //              median-of-3 method, returns pivot value
 | 
			
		||||
  //
 | 
			
		||||
  proc findPivot() {
 | 
			
		||||
    const mid = low + (high-low+1) / 2;
 | 
			
		||||
 | 
			
		||||
    if arr(mid) < arr(low) then arr(mid) <=> arr(low);
 | 
			
		||||
    if arr(high) < arr(low) then arr(high) <=> arr(low);
 | 
			
		||||
    if arr(high) < arr(mid) then arr(high) <=> arr(mid);
 | 
			
		||||
 | 
			
		||||
    const pivotVal = arr(mid);
 | 
			
		||||
    arr(mid) = arr(high-1);
 | 
			
		||||
    arr(high-1) = pivotVal;
 | 
			
		||||
 | 
			
		||||
    return pivotVal;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  // partition -- helper routine to partition array such that all
 | 
			
		||||
  //              values less than pivot are to its left and all
 | 
			
		||||
  //              values greater than pivot are to its right, returns
 | 
			
		||||
  //              pivot location
 | 
			
		||||
  //
 | 
			
		||||
  proc partition(pivotVal) {
 | 
			
		||||
    var ilo = low, ihi = high-1;
 | 
			
		||||
    while (ilo < ihi) {
 | 
			
		||||
      do { ilo += 1; } while arr(ilo) < pivotVal;
 | 
			
		||||
      do { ihi -= 1; } while pivotVal < arr(ihi);
 | 
			
		||||
      if (ilo < ihi) {
 | 
			
		||||
        arr(ilo) <=> arr(ihi);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    arr(high-1) = arr(ilo);
 | 
			
		||||
    arr(ilo) = pivotVal;
 | 
			
		||||
    return ilo;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
// bubbleSort -- bubble sort for base case of quick sort
 | 
			
		||||
//
 | 
			
		||||
//   arr: generic 1D array of values (real, int, ...)
 | 
			
		||||
//   low: lower bound of array to start sort at
 | 
			
		||||
//   high: upper bound of array to stop sort at
 | 
			
		||||
//
 | 
			
		||||
proc bubbleSort(arr: [], low: int, high: int) where arr.rank == 1 {
 | 
			
		||||
  for i in low..high do
 | 
			
		||||
    for j in low..high-1 do
 | 
			
		||||
      if arr(j) > arr(j+1) then
 | 
			
		||||
        arr(j) <=> arr(j+1);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										239
									
								
								samples/ColdFusion CFC/exampleScript.cfc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								samples/ColdFusion CFC/exampleScript.cfc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,239 @@
 | 
			
		||||
/**
 | 
			
		||||
********************************************************************************
 | 
			
		||||
ContentBox - A Modular Content Platform
 | 
			
		||||
Copyright 2012 by Luis Majano and Ortus Solutions, Corp
 | 
			
		||||
www.gocontentbox.org | www.luismajano.com | www.ortussolutions.com
 | 
			
		||||
********************************************************************************
 | 
			
		||||
Apache License, Version 2.0
 | 
			
		||||
 | 
			
		||||
Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
********************************************************************************
 | 
			
		||||
* A generic content service for content objects
 | 
			
		||||
*/
 | 
			
		||||
component extends="coldbox.system.orm.hibernate.VirtualEntityService" singleton{
 | 
			
		||||
 | 
			
		||||
	// DI
 | 
			
		||||
	property name="settingService"			inject="id:settingService@cb";
 | 
			
		||||
	property name="cacheBox"				inject="cachebox";
 | 
			
		||||
	property name="log"						inject="logbox:logger:{this}";
 | 
			
		||||
	property name="customFieldService" 	 	inject="customFieldService@cb";
 | 
			
		||||
	property name="categoryService" 	 	inject="categoryService@cb";
 | 
			
		||||
	property name="commentService" 	 		inject="commentService@cb";
 | 
			
		||||
	property name="contentVersionService"	inject="contentVersionService@cb";
 | 
			
		||||
	property name="authorService"			inject="authorService@cb";
 | 
			
		||||
	property name="populator"				inject="wirebox:populator";
 | 
			
		||||
	property name="systemUtil"				inject="SystemUtil@cb";
 | 
			
		||||
	
 | 
			
		||||
	/*
 | 
			
		||||
	* Constructor
 | 
			
		||||
	* @entityName.hint The content entity name to bind this service to.
 | 
			
		||||
	*/
 | 
			
		||||
	ContentService function init(entityName="cbContent"){
 | 
			
		||||
		// init it
 | 
			
		||||
		super.init(entityName=arguments.entityName, useQueryCaching=true);
 | 
			
		||||
 | 
			
		||||
		// Test scope coloring in pygments
 | 
			
		||||
		this.colorTestVar = "Just for testing pygments!";
 | 
			
		||||
		cookie.colorTestVar = "";
 | 
			
		||||
		client.colorTestVar = ""
 | 
			
		||||
		session.colorTestVar = "";
 | 
			
		||||
		application.colorTestVar = "";
 | 
			
		||||
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Clear all content caches
 | 
			
		||||
	* @async.hint Run it asynchronously or not, defaults to false
 | 
			
		||||
	*/
 | 
			
		||||
	function clearAllCaches(boolean async=false){
 | 
			
		||||
		var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
		// Get appropriate cache provider
 | 
			
		||||
		var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
		cache.clearByKeySnippet(keySnippet="cb-content",async=arguments.async);
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Clear all page wrapper caches
 | 
			
		||||
	* @async.hint Run it asynchronously or not, defaults to false
 | 
			
		||||
	*/
 | 
			
		||||
	function clearAllPageWrapperCaches(boolean async=false){
 | 
			
		||||
		var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
		// Get appropriate cache provider
 | 
			
		||||
		var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
		cache.clearByKeySnippet(keySnippet="cb-content-pagewrapper",async=arguments.async);
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Clear all page wrapper caches
 | 
			
		||||
	* @slug.hint The slug partial to clean on
 | 
			
		||||
	* @async.hint Run it asynchronously or not, defaults to false
 | 
			
		||||
	*/
 | 
			
		||||
	function clearPageWrapperCaches(required any slug, boolean async=false){
 | 
			
		||||
		var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
		// Get appropriate cache provider
 | 
			
		||||
		var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
		cache.clearByKeySnippet(keySnippet="cb-content-pagewrapper-#arguments.slug#",async=arguments.async);
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Clear a page wrapper cache
 | 
			
		||||
	* @slug.hint The slug to clean
 | 
			
		||||
	* @async.hint Run it asynchronously or not, defaults to false
 | 
			
		||||
	*/
 | 
			
		||||
	function clearPageWrapper(required any slug, boolean async=false){
 | 
			
		||||
		var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
		// Get appropriate cache provider
 | 
			
		||||
		var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
		cache.clear("cb-content-pagewrapper-#arguments.slug#/");
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Searches published content with cool paramters, remember published content only
 | 
			
		||||
	* @searchTerm.hint The search term to search
 | 
			
		||||
	* @max.hint The maximum number of records to paginate
 | 
			
		||||
	* @offset.hint The offset in the pagination
 | 
			
		||||
	* @asQuery.hint Return as query or array of objects, defaults to array of objects
 | 
			
		||||
	* @sortOrder.hint The sorting of the search results, defaults to publishedDate DESC
 | 
			
		||||
	* @isPublished.hint Search for published, non-published or both content objects [true, false, 'all']
 | 
			
		||||
	* @searchActiveContent.hint Search only content titles or both title and active content. Defaults to both.
 | 
			
		||||
	*/
 | 
			
		||||
	function searchContent(
 | 
			
		||||
		any searchTerm="", 
 | 
			
		||||
		numeric max=0, 
 | 
			
		||||
		numeric offset=0, 
 | 
			
		||||
		boolean asQuery=false, 
 | 
			
		||||
		any sortOrder="publishedDate DESC", 
 | 
			
		||||
		any isPublished=true, 
 | 
			
		||||
		boolean searchActiveContent=true){
 | 
			
		||||
 | 
			
		||||
		var results = {};
 | 
			
		||||
		var c = newCriteria();
 | 
			
		||||
 | 
			
		||||
		// only published content
 | 
			
		||||
		if( isBoolean( arguments.isPublished ) ){
 | 
			
		||||
			// Published bit
 | 
			
		||||
			c.isEq( "isPublished", javaCast( "Boolean", arguments.isPublished ) );
 | 
			
		||||
			// Published eq true evaluate other params
 | 
			
		||||
			if( arguments.isPublished ){
 | 
			
		||||
				c.isLt("publishedDate", now() )
 | 
			
		||||
				.$or( c.restrictions.isNull("expireDate"), c.restrictions.isGT("expireDate", now() ) )
 | 
			
		||||
				.isEq("passwordProtection","");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Search Criteria
 | 
			
		||||
		if( len( arguments.searchTerm ) ){
 | 
			
		||||
			// like disjunctions
 | 
			
		||||
			c.createAlias("activeContent","ac");
 | 
			
		||||
			// Do we search title and active content or just title?
 | 
			
		||||
			if( arguments.searchActiveContent ){
 | 
			
		||||
				c.$or( c.restrictions.like("title","%#arguments.searchTerm#%"),
 | 
			
		||||
				  	  c.restrictions.like("ac.content", "%#arguments.searchTerm#%") );
 | 
			
		||||
			}
 | 
			
		||||
			else{
 | 
			
		||||
				c.like( "title", "%#arguments.searchTerm#%" ); 
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// run criteria query and projections count
 | 
			
		||||
		results.count = c.count( "contentID" );
 | 
			
		||||
		results.content = c.resultTransformer( c.DISTINCT_ROOT_ENTITY )
 | 
			
		||||
							.list(offset=arguments.offset, max=arguments.max, sortOrder=arguments.sortOrder, asQuery=arguments.asQuery);
 | 
			
		||||
	
 | 
			
		||||
		return results;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/********************************************* PRIVATE *********************************************/
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	* Update the content hits
 | 
			
		||||
	* @contentID.hint The content id to update
 | 
			
		||||
	*/
 | 
			
		||||
	private function syncUpdateHits(required contentID){
 | 
			
		||||
		var q = new Query(sql="UPDATE cb_content SET hits = hits + 1 WHERE contentID = #arguments.contentID#").execute();
 | 
			
		||||
		return this;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	private function closureTest(){
 | 
			
		||||
		methodCall(
 | 
			
		||||
			param1,
 | 
			
		||||
			function( arg1, required arg2 ){
 | 
			
		||||
				var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
				// Get appropriate cache provider
 | 
			
		||||
				var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
				cache.clear("cb-content-pagewrapper-#arguments.slug#/");
 | 
			
		||||
				return this;
 | 
			
		||||
			},
 | 
			
		||||
			param1
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private function StructliteralTest(){
 | 
			
		||||
		return {
 | 
			
		||||
			foo = bar,
 | 
			
		||||
			brad = 'Wood',
 | 
			
		||||
			func = function( arg1, required arg2 ){
 | 
			
		||||
				var settings = settingService.getAllSettings(asStruct=true);
 | 
			
		||||
				// Get appropriate cache provider
 | 
			
		||||
				var cache = cacheBox.getCache( settings.cb_content_cacheName );
 | 
			
		||||
				cache.clear("cb-content-pagewrapper-#arguments.slug#/");
 | 
			
		||||
				return this;
 | 
			
		||||
			},
 | 
			
		||||
			array = [
 | 
			
		||||
				1,
 | 
			
		||||
				2,
 | 
			
		||||
				3,
 | 
			
		||||
				4,
 | 
			
		||||
				5,
 | 
			
		||||
				'test',
 | 
			
		||||
				'testing',
 | 
			
		||||
				'testerton',
 | 
			
		||||
				{
 | 
			
		||||
					foo = true,
 | 
			
		||||
					brad = false,
 | 
			
		||||
					wood = null
 | 
			
		||||
				}
 | 
			
		||||
			],
 | 
			
		||||
			last = "final"
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private function arrayliteralTest(){
 | 
			
		||||
		return [
 | 
			
		||||
			1,
 | 
			
		||||
			2,
 | 
			
		||||
			3,
 | 
			
		||||
			4,
 | 
			
		||||
			5,
 | 
			
		||||
			'test',
 | 
			
		||||
			'testing',
 | 
			
		||||
			'testerton',
 | 
			
		||||
			{
 | 
			
		||||
				foo = true,
 | 
			
		||||
				brad = false,
 | 
			
		||||
				wood = null
 | 
			
		||||
			},
 | 
			
		||||
			'testy-von-testavich'
 | 
			
		||||
		];
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								samples/ColdFusion CFC/exampleTag.cfc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								samples/ColdFusion CFC/exampleTag.cfc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<cfcomponent>
 | 
			
		||||
	
 | 
			
		||||
	<cffunction name="init" access="public" returntype="any">
 | 
			
		||||
		<cfargument name="arg1" type="any" required="true">
 | 
			
		||||
		<cfset this.myVariable = arguments.arg1>
 | 
			
		||||
 | 
			
		||||
		<cfreturn this>
 | 
			
		||||
	</cffunction>
 | 
			
		||||
 | 
			
		||||
	<cffunction name="testFunc" access="private" returntype="void">
 | 
			
		||||
		<cfargument name="arg1" type="any" required="false">
 | 
			
		||||
		
 | 
			
		||||
		<cfif structKeyExists(arguments, "arg1")>
 | 
			
		||||
			<cfset writeoutput("Argument exists")>
 | 
			
		||||
		</cfif>
 | 
			
		||||
	</cffunction>
 | 
			
		||||
	
 | 
			
		||||
</cfcomponent>
 | 
			
		||||
							
								
								
									
										50
									
								
								samples/ColdFusion/example.cfm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								samples/ColdFusion/example.cfm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
<!--- cfcomment --->
 | 
			
		||||
<!--- nested <!--- cfcomment ---> --->
 | 
			
		||||
<!--- multi-line
 | 
			
		||||
nested
 | 
			
		||||
<!---
 | 
			
		||||
cfcomment
 | 
			
		||||
--->
 | 
			
		||||
--->
 | 
			
		||||
<!-- html comment -->
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
<title>Date Functions</title>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
<cfset RightNow = Now()>
 | 
			
		||||
<cfoutput>
 | 
			
		||||
 #RightNow#<br />
 | 
			
		||||
 #DateFormat(RightNow)#<br />
 | 
			
		||||
 #DateFormat(RightNow,"mm/dd/yy")#<br />
 | 
			
		||||
 #TimeFormat(RightNow)#<br />
 | 
			
		||||
 #TimeFormat(RightNow,"hh:mm tt")#<br />
 | 
			
		||||
 #IsDate(RightNow)#<br />
 | 
			
		||||
 #IsDate("January 31, 2007")#<br />
 | 
			
		||||
 #IsDate("foo")#<br />
 | 
			
		||||
 #DaysInMonth(RightNow)#
 | 
			
		||||
</cfoutput>
 | 
			
		||||
<cfset x="x">
 | 
			
		||||
<cfset y="y">
 | 
			
		||||
<cfset z="z">
 | 
			
		||||
<cfoutput group="x">
 | 
			
		||||
    #x#
 | 
			
		||||
    <cfoutput>#y#</cfoutput>
 | 
			
		||||
    #z#
 | 
			
		||||
</cfoutput>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
<cfset person = "Paul">
 | 
			
		||||
<cfset greeting = "Hello #person#">
 | 
			
		||||
 | 
			
		||||
<cfset greeting = "Hello" & " world!">
 | 
			
		||||
<cfset a = 5>
 | 
			
		||||
<cfset b = 10>
 | 
			
		||||
<cfset c = a^b>
 | 
			
		||||
<cfset c = a MOD b>
 | 
			
		||||
<cfset c = a / b>
 | 
			
		||||
<cfset c = a * b>
 | 
			
		||||
<cfset c = a + b>
 | 
			
		||||
<cfset c = a - b>
 | 
			
		||||
<!--- <!-- another <!--- nested --> ---> comment --->
 | 
			
		||||
							
								
								
									
										23
									
								
								samples/EmberScript/momentComponent.em
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								samples/EmberScript/momentComponent.em
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
class App.FromNowView extends Ember.View
 | 
			
		||||
    tagName: 'time'
 | 
			
		||||
    template: Ember.Handlebars.compile '{{view.output}}'
 | 
			
		||||
    output: ~>
 | 
			
		||||
        return moment(@value).fromNow()
 | 
			
		||||
 | 
			
		||||
    didInsertElement: ->
 | 
			
		||||
        @tick()
 | 
			
		||||
 | 
			
		||||
    tick: ->
 | 
			
		||||
        f = ->
 | 
			
		||||
            @notifyPropertyChange 'output'
 | 
			
		||||
            @tick()
 | 
			
		||||
 | 
			
		||||
        nextTick = Ember.run.later(this, f, 1000)
 | 
			
		||||
        @set 'nextTick', nextTick
 | 
			
		||||
 | 
			
		||||
    willDestroyElement: ->
 | 
			
		||||
        nextTick = @nextTick
 | 
			
		||||
        Ember.run.cancel nextTick
 | 
			
		||||
 | 
			
		||||
Ember.Handlebars.helper 'fromNow', App.FromNowView
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								samples/IGOR Pro/functions.ipf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								samples/IGOR Pro/functions.ipf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
#pragma rtGlobals=3
 | 
			
		||||
 | 
			
		||||
Function FooBar()
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
Function FooBarSubType() : ButtonControl
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
Function/D FooBarVar()
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
static Function FooBarStatic()
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
threadsafe static Function FooBarStaticThreadsafe()
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
threadsafe Function FooBarThread()
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
Function CallOperationsAndBuiltInFuncs(string var)
 | 
			
		||||
 | 
			
		||||
	string someDQString = "abcd"
 | 
			
		||||
 | 
			
		||||
	Make/N=(1,2,3,4) myWave
 | 
			
		||||
	Redimension/N=(-1,-1,-1,5) myWave
 | 
			
		||||
 | 
			
		||||
	print strlen(someDQString)
 | 
			
		||||
 | 
			
		||||
	return 0
 | 
			
		||||
End
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										21
									
								
								samples/IGOR Pro/generic.ipf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								samples/IGOR Pro/generic.ipf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
#pragma rtGlobals=3
 | 
			
		||||
 | 
			
		||||
StrConstant myConstString="abcd"
 | 
			
		||||
// some comment
 | 
			
		||||
constant myConst=123
 | 
			
		||||
 | 
			
		||||
Structure struct1
 | 
			
		||||
	string str
 | 
			
		||||
	variable var
 | 
			
		||||
EndStructure
 | 
			
		||||
 | 
			
		||||
static Structure struct2
 | 
			
		||||
	string str
 | 
			
		||||
	variable var
 | 
			
		||||
EndStructure
 | 
			
		||||
 | 
			
		||||
#include "someFile"
 | 
			
		||||
 | 
			
		||||
#ifdef NOT_DEFINED
 | 
			
		||||
	// conditional compilation
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										43
									
								
								samples/LookML/comments.view.lookml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								samples/LookML/comments.view.lookml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
- view: comments
 | 
			
		||||
  fields:
 | 
			
		||||
 | 
			
		||||
  - dimension: id
 | 
			
		||||
    primary_key: true
 | 
			
		||||
    type: int
 | 
			
		||||
    sql: ${TABLE}.id
 | 
			
		||||
 | 
			
		||||
  - dimension: body
 | 
			
		||||
    sql: ${TABLE}.body
 | 
			
		||||
 | 
			
		||||
  - dimension_group: created
 | 
			
		||||
    type: time
 | 
			
		||||
    timeframes: [time, date, week, month]
 | 
			
		||||
    sql: ${TABLE}.created_at
 | 
			
		||||
 | 
			
		||||
  - dimension: headline_id
 | 
			
		||||
    type: int
 | 
			
		||||
    hidden: true
 | 
			
		||||
    sql: ${TABLE}.headline_id
 | 
			
		||||
 | 
			
		||||
  - dimension_group: updated
 | 
			
		||||
    type: time
 | 
			
		||||
    timeframes: [time, date, week, month]
 | 
			
		||||
    sql: ${TABLE}.updated_at
 | 
			
		||||
 | 
			
		||||
  - dimension: user_id
 | 
			
		||||
    type: int
 | 
			
		||||
    hidden: true
 | 
			
		||||
    sql: ${TABLE}.user_id
 | 
			
		||||
 | 
			
		||||
  - measure: count
 | 
			
		||||
    type: count
 | 
			
		||||
    detail: detail*
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  # ----- Detail ------
 | 
			
		||||
  sets:
 | 
			
		||||
    detail:
 | 
			
		||||
      - id
 | 
			
		||||
      - headlines.id
 | 
			
		||||
      - headlines.name
 | 
			
		||||
      - users.id
 | 
			
		||||
							
								
								
									
										9
									
								
								samples/Opal/DeepakChopra.opal
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								samples/Opal/DeepakChopra.opal
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
-- Deepak Chopra nonsense text generator
 | 
			
		||||
-- see https://github.com/StoneCypher/DeepakChopra_Opal/
 | 
			
		||||
 | 
			
		||||
starts = ["Experiential truth ", "The physical world ", "Non-judgment ", "Quantum physics "]
 | 
			
		||||
middles = ["nurtures an ", "projects onto ", "imparts reality to ", "constructs with "]
 | 
			
		||||
qualifiers = ["abundance of ", "the barrier of ", "self-righteous ", "potential "]
 | 
			
		||||
finishes = ["marvel.", "choices.", "creativity.", "actions."]
 | 
			
		||||
 | 
			
		||||
alert starts.sample + middles.sample + qualifiers.sample + finishes.sample
 | 
			
		||||
							
								
								
									
										13
									
								
								samples/OpenSCAD/not_simple.scad
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								samples/OpenSCAD/not_simple.scad
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
// A more complicated 3D shape in OpenSCAD
 | 
			
		||||
$fn=32;
 | 
			
		||||
 | 
			
		||||
difference() {
 | 
			
		||||
    // main shape
 | 
			
		||||
    union() {
 | 
			
		||||
        translate( [ 0, 0,  2 ] ) cube( [ 15, 15, 4 ], center=true );
 | 
			
		||||
        translate( [ 0, 0, 13 ] ) cylinder( h=25, r1=5, r2=3, center=true );
 | 
			
		||||
        translate( [ 0, 0, 28 ] ) sphere( r=6 );
 | 
			
		||||
    }
 | 
			
		||||
    // hole through center
 | 
			
		||||
    translate( [ 0, 0, 17 ] ) cylinder( h=35, r=2, center=true );
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								samples/OpenSCAD/simple.scad
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								samples/OpenSCAD/simple.scad
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
// Simple sphere in OpenSCAD
 | 
			
		||||
 | 
			
		||||
sphere( r=10 );
 | 
			
		||||
							
								
								
									
										447
									
								
								samples/Perl/example.cgi
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										447
									
								
								samples/Perl/example.cgi
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,447 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
# v1.0
 | 
			
		||||
# nagiostat, program to insert performance-data from Nagios into RRD-archives
 | 
			
		||||
# Copyright (C) 2004  Carl Bingel / Svensk IT konsult AB
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program; if not, write to the Free Software
 | 
			
		||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
## Basic configuration options
 | 
			
		||||
my $BASE_DIR = "/usr/share/nagiostat";
 | 
			
		||||
my $CONFIG_FILE = "/etc/nagios/nagiostat.conf";  ## Config-file location
 | 
			
		||||
my $DEBUG_LOG_FILE = "/var/spool/nagiostat/debug.log";    ## Specify where to create log-file and what filename (must be writable by nagios-user!)
 | 
			
		||||
my $DEBUGLEVEL = 1;              ## 0=Nothing, 1=Errors, 2=Warnings, 3=Debug
 | 
			
		||||
my $DEBUGOUTPUT = 0;		 ## 0=file, 1=STDERR, 2=STDOUT (for cgi)
 | 
			
		||||
 | 
			
		||||
require 'shellwords.pl';
 | 
			
		||||
 | 
			
		||||
## Global vars
 | 
			
		||||
my $DEBUG_TIMESTAMP=0;
 | 
			
		||||
 | 
			
		||||
## Find out how program is run
 | 
			
		||||
if( $ARGV[0] eq "-t") {		## -t = test configuration-file
 | 
			
		||||
  print STDERR "nagiostat: Testing configuration-file..\n";
 | 
			
		||||
  $DEBUGLEVEL=3;
 | 
			
		||||
  $DEBUGOUTPUT=1;    ## output errors to console and not file
 | 
			
		||||
  my $c = &read_config();
 | 
			
		||||
  abort();
 | 
			
		||||
} elsif( $ARGV[0] eq "-p") {	## -p = parse performance-data (when started by nagios)
 | 
			
		||||
  &parse_perfdata();
 | 
			
		||||
} else {
 | 
			
		||||
  if( exists $ENV{'GATEWAY_INTERFACE'}) {	## we are run as a CGI-script!
 | 
			
		||||
    $DEBUGOUTPUT=2;  ## output errors to web-browser
 | 
			
		||||
    &run_as_cgi();
 | 
			
		||||
  } else {                                ## print some help-info
 | 
			
		||||
    print STDERR "nagiostat: usage:
 | 
			
		||||
        -t	Test configuration-file
 | 
			
		||||
        -p	Parse/import performance-data (used when called from nagios)
 | 
			
		||||
";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
abort();
 | 
			
		||||
 | 
			
		||||
sub abort {
 | 
			
		||||
   ## logfile: write blank if we wrote anything...
 | 
			
		||||
   if( $DEBUG_TIMESTAMP!=0) {
 | 
			
		||||
     debug( 1, "");	
 | 
			
		||||
   }
 | 
			
		||||
   exit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
##
 | 
			
		||||
##  Program is called as CGI
 | 
			
		||||
##
 | 
			
		||||
sub run_as_cgi {
 | 
			
		||||
   use CGI;
 | 
			
		||||
   my $cgi = new CGI;
 | 
			
		||||
   
 | 
			
		||||
   my $graph_name = $cgi->param( "graph_name");
 | 
			
		||||
   my $graph_iteration = $cgi->param( "graph_iteration");
 | 
			
		||||
 | 
			
		||||
   if( $graph_iteration eq "") {
 | 
			
		||||
      print "Content-type: text/html\nExpires: 0\n\n";
 | 
			
		||||
   } else {
 | 
			
		||||
      print "Content-type: image/gif\nExpires: 0\n\n";
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   my $config = read_config();
 | 
			
		||||
 | 
			
		||||
   if( $graph_name eq "") {      
 | 
			
		||||
      ##
 | 
			
		||||
      ## display index of graphs
 | 
			
		||||
      ##
 | 
			
		||||
      display_htmltemplate( $config->{'htmltemplatepath'}."/".$config->{'graphindextemplate'}, $graph_name, $config);
 | 
			
		||||
   } else {                      ## display graph
 | 
			
		||||
      if( ! exists $config->{'graphs'}->{$graph_name}) {
 | 
			
		||||
         debug( 1, "ERROR: Graph '$graph_name' does not exist!");
 | 
			
		||||
         exit;
 | 
			
		||||
      } elsif( $graph_iteration eq "") {
 | 
			
		||||
         ##
 | 
			
		||||
         ## Display HTML-page with all the graphs
 | 
			
		||||
         ##
 | 
			
		||||
         if( ! -r $config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'}) {
 | 
			
		||||
            debug( 1, "ERROR: HTML-template '".($config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'})."' is not readable by effective userid!");
 | 
			
		||||
            exit;
 | 
			
		||||
         }
 | 
			
		||||
         display_htmltemplate( $config->{'htmltemplatepath'}."/".$config->{'graphs'}->{$graph_name}->{'htmltemplate'}, $graph_name, $config);
 | 
			
		||||
      } else {                   
 | 
			
		||||
         ##
 | 
			
		||||
         ## generate graph (call 'rrdtool graph')
 | 
			
		||||
         ##
 | 
			
		||||
         my $rrdtool_cmdline = $config->{'rrdtoolpath'}." graph - ".join( " ", @{$config->{'plottemplates'}->{ $config->{'graphs'}->{$graph_name}->{'plottemplate'} } }); 
 | 
			
		||||
         
 | 
			
		||||
         ## expand variables
 | 
			
		||||
         my $rrdarchive = $config->{'rrdarchivepath'}."/".$config->{'graphs'}->{$graph_name}->{'rrdfilename'};
 | 
			
		||||
         $rrdtool_cmdline =~ s/\$f/$rrdarchive/g;
 | 
			
		||||
         my $t_start = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'starttime'};
 | 
			
		||||
         $rrdtool_cmdline =~ s/\$s/$t_start/g;
 | 
			
		||||
         my $t_end = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'endtime'};
 | 
			
		||||
         $rrdtool_cmdline =~ s/\$e/$t_end/g;
 | 
			
		||||
         my $t_descr = $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} }->[$graph_iteration]->{'description'};
 | 
			
		||||
         $rrdtool_cmdline =~ s/\$d/$t_descr/g;
 | 
			
		||||
 | 
			
		||||
         ## Call rrdtool (should probably be fixed to call it in a better way, like exec)
 | 
			
		||||
         print `$rrdtool_cmdline`;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## Display HTML template (and do variable-substitution and other stuff)
 | 
			
		||||
##
 | 
			
		||||
sub display_htmltemplate {
 | 
			
		||||
   my( $filename, $graph_name, $config) = @_;
 | 
			
		||||
 | 
			
		||||
   if( -r $filename) {
 | 
			
		||||
      open( HTML, $filename);
 | 
			
		||||
      while( <HTML>) {
 | 
			
		||||
         ## All is a big regex.. :-)
 | 
			
		||||
         s/\$(\w+)/my $t=sub {   
 | 
			
		||||
            my $varname = $_[0];
 | 
			
		||||
            if( $varname eq "GRAPHNAME") {                           ## return the name of the graph
 | 
			
		||||
               if( $config->{'graphs'}->{$graph_name}->{'title'} ne "") {
 | 
			
		||||
                  return( $config->{'graphs'}->{$graph_name}->{'title'});
 | 
			
		||||
               } else {
 | 
			
		||||
                  return( "Graph ".$graph_name);
 | 
			
		||||
               }
 | 
			
		||||
            } elsif( $varname eq "CURRENTTIME") {                    ## return current date-time
 | 
			
		||||
               return( localtime());
 | 
			
		||||
            } elsif( $varname eq "GRAPHINDEX" || $varname eq "GRAPHINDEX_ONEROW") {    ## return HTML-code for index of the different graphs
 | 
			
		||||
               my $return_html;
 | 
			
		||||
               foreach my $gn ( sort keys %{$config->{'graphs'}}) {           
 | 
			
		||||
                     $return_html.=(($varname eq "GRAPHINDEX")?"<LI>":"").
 | 
			
		||||
                     "<A HREF=\"?graph_name=$gn\">".($config->{'graphs'}->{$gn}->{'title'})."<\/A>".                  # must escape slash since were inside an regex!
 | 
			
		||||
                     (($varname eq "GRAPHINDEX_ONEROW")?"  ":"");
 | 
			
		||||
               }
 | 
			
		||||
               return( $return_html);
 | 
			
		||||
            } elsif( $varname eq "GRAPH_AUTOGENERATE") {             ## return HTML-code for displaying the actual graph-images
 | 
			
		||||
               my $iteration_id=0;
 | 
			
		||||
               my $return_html;
 | 
			
		||||
               foreach my $time ( @{ $config->{'graphtimetemplates'}->{ $config->{'graphs'}->{$graph_name}->{'graphtimetemplate'} } }) {
 | 
			
		||||
                 $return_html.="<P>".($time->{'description'})."<BR><IMG SRC=\"?graph_name=$graph_name&graph_iteration=$iteration_id\">"; 
 | 
			
		||||
                 $iteration_id++;
 | 
			
		||||
               }
 | 
			
		||||
               return( $return_html);
 | 
			
		||||
            } else {                                                 ## unknown variable
 | 
			
		||||
               return( "##UNKNOWN-VARIABLE##");
 | 
			
		||||
            }
 | 
			
		||||
         }; &$t($1)/eig;   ## i thought that regex would never end!
 | 
			
		||||
         print;
 | 
			
		||||
      }
 | 
			
		||||
      close( HTML);
 | 
			
		||||
   } else {
 | 
			
		||||
      print "ERROR: HTML-template '$filename' does not exist or is not readable by effective userid.";
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
##
 | 
			
		||||
##  Process incoming performance-data (parse output from check-plugin and insert values into rrd-archives)
 | 
			
		||||
##
 | 
			
		||||
sub parse_perfdata {
 | 
			
		||||
 | 
			
		||||
  $DEBUG_TIMESTAMP=0;
 | 
			
		||||
  
 | 
			
		||||
  my $config = read_config();
 | 
			
		||||
 | 
			
		||||
  my $rrd_updates;
 | 
			
		||||
 | 
			
		||||
  ##  Provide more symbolic names (same names as the macros in nagios configuration-file)
 | 
			
		||||
 | 
			
		||||
  my( $LASTCHECK, $HOSTNAME, $SERVICEDESCR, $SERVICESTATE, $OUTPUT, $PERFDATA) = split( /\|!!\|/, $ARGV[1]);
 | 
			
		||||
  debug( 3, "**INCOMING PERFDATA:\n  LASTCHECK=$LASTCHECK\n  HOSTNAME=$HOSTNAME\n  SERVICEDESCR=\"$SERVICEDESCR\"\n  SERVICESTATE=\"$SERVICESTATE\"\n  OUTPUT=\"$OUTPUT\"\n  PERFDATA=\"$PERFDATA\"");
 | 
			
		||||
  
 | 
			
		||||
  my $host_and_descr_found;
 | 
			
		||||
  ## Loop through all host_regexes
 | 
			
		||||
  foreach my $host_regex ( keys %{$config->{'regexes'}}) {
 | 
			
		||||
    ## Loop through all service_description_regexes
 | 
			
		||||
    foreach my $service_regex ( keys %{$config->{'regexes'}->{$host_regex}}) {
 | 
			
		||||
      if( ($HOSTNAME =~ m/$host_regex/i) && ($SERVICEDESCR =~ m/$service_regex/i) ) {     ## match!
 | 
			
		||||
        $host_and_descr_found=1;
 | 
			
		||||
        ## Loop through all InsertValue-lines with same host and service_description match
 | 
			
		||||
        foreach my $insert_value ( @{$config->{'regexes'}->{$host_regex}->{$service_regex}} ) {
 | 
			
		||||
          ## Loop through all regexes that should match values in the output/perfdata
 | 
			
		||||
          foreach my $regex ( @{ $config->{'valueregextemplates'}->{$insert_value->{'regextemplate'}} }) {
 | 
			
		||||
             my $regex_string = $regex->{'regex'};
 | 
			
		||||
             if( $regex->{'regex_what'} eq "output") {         ## do regex on "output"
 | 
			
		||||
                if( $OUTPUT =~ m/$regex_string/) {
 | 
			
		||||
                   debug( 3, " +VALUE: ".$1);
 | 
			
		||||
                   push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'value'}}, $1);
 | 
			
		||||
                   push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'dsaname'}}, $regex->{'dsaname'});
 | 
			
		||||
                   $rrd_updates->{$insert_value->{'rrdarchive'}}->{'rrdcreatetemplate'} = $insert_value->{'rrdcreatetemplate'};  #$config->{'regexes'}->{$host_regex}->{$service_regex}->[0]->{'rrdcreatetemplate'};
 | 
			
		||||
                } else {
 | 
			
		||||
                   debug( 2, "**WARNING: No match for value with regex on output '$regex_string'.");
 | 
			
		||||
                }
 | 
			
		||||
             } else {                                          ## do regex on "perfdata"
 | 
			
		||||
                if( $PERFDATA =~ m/$regex_string/) {
 | 
			
		||||
                   debug( 3, " +VALUE: ".$1);
 | 
			
		||||
                   push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'value'}}, $1);
 | 
			
		||||
                   push( @{$rrd_updates->{$insert_value->{'rrdarchive'}}->{'dsaname'}}, $regex->{'dsaname'});
 | 
			
		||||
                   $rrd_updates->{$insert_value->{'rrdarchive'}}->{'rrdcreatetemplate'} = $insert_value->{'rrdcreatetemplate'};  #$config->{'regexes'}->{$host_regex}->{$service_regex}->[0]->{'rrdcreatetemplate'};
 | 
			
		||||
                } else {
 | 
			
		||||
                   debug( 2, "**WARNING: No match for value with regex on perfdata '$regex_string'.");
 | 
			
		||||
                }
 | 
			
		||||
             }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if( !$host_and_descr_found) {
 | 
			
		||||
    debug( 2, "**WARNING: Hostname and description didn't match any of the regexes in the config-file.");
 | 
			
		||||
  } else {
 | 
			
		||||
    ##
 | 
			
		||||
    ## Insert the value into the RRD by calling the rrdtool (may be several rrd-archives)
 | 
			
		||||
    ##
 | 
			
		||||
    foreach my $archive ( keys %{$rrd_updates}) {
 | 
			
		||||
      debug( 3, " =INSERT into '$archive': ".join( ",", @{$rrd_updates->{$archive}->{'value'}} )." DSA-names=".join( ",", @{$rrd_updates->{$archive}->{'dsaname'}}) );
 | 
			
		||||
      
 | 
			
		||||
      my $rrdarchive_filename = $config->{'rrdarchivepath'}."/".$archive;
 | 
			
		||||
      
 | 
			
		||||
      ## Create RRD-Archive (according to template) if it does not exist
 | 
			
		||||
      if( ! -e $rrdarchive_filename) {
 | 
			
		||||
         my $rrdtool_cmdline = $config->{'rrdtoolpath'}." create ".$rrdarchive_filename." ".(join( " ", @{$config->{'rrdcreatetemplates'}->{$rrd_updates->{$archive}->{'rrdcreatetemplate'}}}));
 | 
			
		||||
         debug( 2, "**CREATING: $rrdarchive_filename, cmdline='".$rrdtool_cmdline."'.");
 | 
			
		||||
         `$rrdtool_cmdline`;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ## Check if rrd-archive is writable
 | 
			
		||||
      if( ! -w $rrdarchive_filename) {					## check wheter RRD-archive exists
 | 
			
		||||
        debug( 1, "!!ERROR: RRD-archive '".$rrdarchive_filename."' does not exist or is not writable by effective UID."); abort();
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      ## Assemle command-line for rrdtool
 | 
			
		||||
      my $rrdtool_cmdline = $config->{'rrdtoolpath'}." update ".$rrdarchive_filename.
 | 
			
		||||
	                    " --template ".join( ":", @{$rrd_updates->{$archive}->{'dsaname'}}).
 | 
			
		||||
                            " $LASTCHECK:".join( ":", @{$rrd_updates->{$archive}->{'value'}});
 | 
			
		||||
      debug( 3, " !RRDCMDLINE: ".$rrdtool_cmdline);
 | 
			
		||||
      my $result = `$rrdtool_cmdline`;
 | 
			
		||||
      if( $result ne "") {
 | 
			
		||||
        debug( 1, "!!RESULT: $result");
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##
 | 
			
		||||
##  Read config-file and check for errors
 | 
			
		||||
##
 | 
			
		||||
sub read_config {
 | 
			
		||||
  my $config;
 | 
			
		||||
  open( CONFIG, $CONFIG_FILE);
 | 
			
		||||
  my( $line_counter);
 | 
			
		||||
  while( <CONFIG>) {
 | 
			
		||||
    $line_counter++;
 | 
			
		||||
    chomp;
 | 
			
		||||
    my( @args) = &shellwords( $_);
 | 
			
		||||
    my $orig_confline = $_;
 | 
			
		||||
    $args[0] = uc( $args[0]);
 | 
			
		||||
  
 | 
			
		||||
    if( $args[0] eq "INSERTVALUE") {	##  INSERTVALUE-command
 | 
			
		||||
      shift @args;
 | 
			
		||||
      my( $rrd_filename, $rrdcreatetemplate, $hostname_regex, $servicedescr_regex, $regex_template) = @args;
 | 
			
		||||
 | 
			
		||||
      if( ! exists $config->{'rrdcreatetemplates'}->{$rrdcreatetemplate}) {
 | 
			
		||||
         debug( 1, "!!ERROR: RRDCreateTemplate '$rrdcreatetemplate' is not defined but refered to in line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( $hostname_regex !~ m/^\/(.*)\/$/) {			## verify hostname regex
 | 
			
		||||
        debug( 1, "!!ERROR: Hostname regex should be enclosed in slashes, i.e. /HOSTNAME/ and optionally enclosed in quotes if needed. Conf-line $line_counter."); abort();
 | 
			
		||||
      } else {
 | 
			
		||||
        $hostname_regex = $1;
 | 
			
		||||
      }
 | 
			
		||||
      if( $servicedescr_regex !~ m/^\/(.*)\/$/) {			## verify service description regex
 | 
			
		||||
        debug( 1, "!!ERROR: Service-description regex should be enclosed in slashes, i.e. /SERVICEDESCR/ and optionally enclosed in quotes if needed. Config-line $line_counter.");
 | 
			
		||||
        abort();
 | 
			
		||||
      } else {
 | 
			
		||||
        $servicedescr_regex = $1;
 | 
			
		||||
      }
 | 
			
		||||
      if( ! exists $config->{'valueregextemplates'}->{$regex_template}) {  ## verify value-regex-template exists
 | 
			
		||||
         debug( 1, "!!ERROR: VALUEREGEXTEMPLATE '$regex_template' is not defined on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      push( @{$config->{'regexes'}->{$hostname_regex}->{$servicedescr_regex}}, {
 | 
			
		||||
            'rrdarchive' => $rrd_filename,
 | 
			
		||||
            'rrdcreatetemplate' => $rrdcreatetemplate,
 | 
			
		||||
            'regextemplate' => $regex_template
 | 
			
		||||
            } );
 | 
			
		||||
    } elsif( $args[0] =~ m/^(\s*)#/ || $args[0] eq "") {	## comment or blank row
 | 
			
		||||
      ## do nuthin
 | 
			
		||||
    } elsif( $args[0] eq "RRDTOOLPATH") {               ## RRDToolPath args: path
 | 
			
		||||
      $config->{'rrdtoolpath'} = $args[1];
 | 
			
		||||
    } elsif( $args[0] eq "PLOTTEMPLATE") {		## PlotTemplate args: name,htmltemplate,parameters..
 | 
			
		||||
      shift @args;
 | 
			
		||||
      my( $name, @params) = @args;
 | 
			
		||||
      if( $name eq "") {
 | 
			
		||||
        debug( 1, "!!ERROR: PLOTTEMPLATE-name must be specified on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( exists $config->{'plottemplates'}->{$name}) {
 | 
			
		||||
        debug( 1, "!!ERROR: PLOTTTEMPLATE-names must be uniqe. Duplicate name found on line: $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      $config->{'plottemplates'}->{$name} = [ @params];
 | 
			
		||||
    } elsif( $args[0] eq "GRAPHTIMETEMPLATE") {         ## GraphTimeTemplate args: name,parameters..
 | 
			
		||||
      shift @args;
 | 
			
		||||
      my( $name, @params) = @args;
 | 
			
		||||
      if( $name eq "") {
 | 
			
		||||
        debug( 1, "!!ERROR: GRAPHTIMETEMPLATE-name must be specified on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( exists $config->{'graphtimetemplates'}->{$name}) {
 | 
			
		||||
        debug( 1, "!!ERROR: GRAPHTIMETEMPLATE-names must be uniqe. Duplicate name found on line: $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      foreach my $time_template (@params) {
 | 
			
		||||
         my( $t_start, $t_end, @t_descr) = split( /:/, $time_template);
 | 
			
		||||
         my $t_descr = join( ":", @t_descr);    # workaround if ':' is used in description-string
 | 
			
		||||
         if( $t_start eq "" || $t_end eq "") {
 | 
			
		||||
            debug( 1, "!!ERROR: GRAPHTIMETEMPLATE, each time-definition should be defined as '<starttime>:<endtime>:<description>' on line $line_counter.");
 | 
			
		||||
         }
 | 
			
		||||
         push( @{$config->{'graphtimetemplates'}->{$name}}, {
 | 
			
		||||
             'starttime' => $t_start,
 | 
			
		||||
             'endtime' => $t_end,
 | 
			
		||||
             'description' => $t_descr
 | 
			
		||||
         });
 | 
			
		||||
      }
 | 
			
		||||
    } elsif( $args[0] eq "RRDCREATETEMPLATE") {         ## RRDCreateTemplate
 | 
			
		||||
      shift @args;
 | 
			
		||||
      my( $name, @params) = @args;
 | 
			
		||||
      if( $name eq "") {
 | 
			
		||||
        debug( 1, "!!ERROR: RRDCREATETEMPLATE-name must be specified on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( exists $config->{'rrdcreatetemplates'}->{$name}) {
 | 
			
		||||
        debug( 1, "!!ERROR: RRDCREATETEMPLATE-names must be uniq. Duplicate name found on line: $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      $config->{'rrdcreatetemplates'}->{$name} = [ @params];
 | 
			
		||||
    } elsif( $args[0] eq "VALUEREGEXTEMPLATE") {        ## ValueRegexTemplate
 | 
			
		||||
      shift @args;
 | 
			
		||||
      my( $template_name, @regexes) = @args;
 | 
			
		||||
      if( $template_name eq "") {
 | 
			
		||||
         debug( 1, "!!ERROR: VALUEREGEXTEMPLATE-name must be specified on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      foreach my $r (@regexes) {
 | 
			
		||||
         if( $r !~ m/^(output|perfdata):(\w+):\/(.*)\/$/) {
 | 
			
		||||
           debug( 1, "!!ERROR: Value-regex should be formatted as 'output:dsaname:/regex/' or 'perfdata:dsaname:/regex/' depending on in which field to extract the data. The value should be within parantheses in the regex. Config-line $line_counter.");
 | 
			
		||||
           abort();
 | 
			
		||||
         } else {
 | 
			
		||||
           my( $regex_what, $dsa_name, $regex) = ( $1, $2, $3);
 | 
			
		||||
           push( @{$config->{'valueregextemplates'}->{$template_name}}, { 
 | 
			
		||||
                   'regex_what' => $regex_what, 
 | 
			
		||||
                   'regex' => $regex, 
 | 
			
		||||
                   'dsaname' => $dsa_name
 | 
			
		||||
                  } );
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
    } elsif( $args[0] eq "RRDARCHIVEPATH") {            ## RRDARCHIVEPATH
 | 
			
		||||
      $config->{'rrdarchivepath'} = $args[1];
 | 
			
		||||
    } elsif( $args[0] eq "HTMLTEMPLATEPATH") {          ## HTMLTemplatePath
 | 
			
		||||
      $config->{'htmltemplatepath'} = $args[1];
 | 
			
		||||
    } elsif( $args[0] eq "GRAPHINDEXTEMPLATE") {        ## GraphIndexTemplate
 | 
			
		||||
      $config->{'graphindextemplate'} = $args[1];
 | 
			
		||||
    } elsif( $args[0] eq "GRAPH") {			## GRAPH args: name,rrdfilename,rrdcreatetemplate,graphtimetemplate,plottemplate,htmltemplate
 | 
			
		||||
      if( $args[1] eq "") {
 | 
			
		||||
	debug( 1, "!!ERROR: GRAPH-name must be specified on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( ! exists $config->{'graphtimetemplates'}->{$args[3]}) {
 | 
			
		||||
        debug( 1, "!!ERROR: Unknown GRAPHTIMETEMPLATE on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( ! exists $config->{'plottemplates'}->{$args[4]}) {
 | 
			
		||||
        debug( 1, "!!ERROR: Unknown PLOTTEMPLATE on line $line_counter."); abort();
 | 
			
		||||
      }
 | 
			
		||||
      if( exists $config->{'graphs'}->{$args[1]}) {
 | 
			
		||||
        debug( 1, "!!ERROR: Graphnames must be uniqe. Duplicate name found on line: $line_counter.");
 | 
			
		||||
        abort();
 | 
			
		||||
      } else {
 | 
			
		||||
        $config->{'graphs'}->{$args[1]} = {
 | 
			
		||||
		'graphname' => $args[1],
 | 
			
		||||
		'rrdfilename' => $args[2],
 | 
			
		||||
                'graphtimetemplate' => $args[3],
 | 
			
		||||
                'plottemplate' => $args[4],
 | 
			
		||||
                'htmltemplate' => $args[5],
 | 
			
		||||
                'title' => $args[6]
 | 
			
		||||
        };
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      debug( 1, "!!ERROR: Unknown config-file directive on line $line_counter: '".$args[0]."'");
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  close( CONFIG);
 | 
			
		||||
 | 
			
		||||
  if( ! -x $config->{'rrdtoolpath'}) {
 | 
			
		||||
    debug( 1, "!!ERROR: RRDTOOLPATH does not point to executable rrdtool-binary.");
 | 
			
		||||
    abort();
 | 
			
		||||
  }
 | 
			
		||||
  if( ! -x $config->{'rrdarchivepath'}) {
 | 
			
		||||
     debug( 1, "!!ERROR: RRDARCHIVEPATH, '".($config->{'rrdarchivepath'})."' is not readable by effective userid."); abort();
 | 
			
		||||
  }
 | 
			
		||||
  if( ! -x $config->{'htmltemplatepath'}) {
 | 
			
		||||
     debug( 1, "!!ERROR: HTMLTEMPLATEPATH, '".($config->{'htmltemplatepath'})."' is not readable by effective userid."); abort();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return( $config);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 
 | 
			
		||||
##  Write debug-output/logging
 | 
			
		||||
##
 | 
			
		||||
sub debug {
 | 
			
		||||
  my( $level, $msg) = @_;
 | 
			
		||||
  if( $DEBUGLEVEL >= $level) {
 | 
			
		||||
 | 
			
		||||
    ## write timestamp
 | 
			
		||||
    if( !$DEBUG_TIMESTAMP) {	
 | 
			
		||||
      $DEBUG_TIMESTAMP=1;
 | 
			
		||||
      debug( 1, scalar localtime());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ## write to file or STDERR
 | 
			
		||||
    if( $DEBUGOUTPUT == 0) {
 | 
			
		||||
      open( DEBUGOUTPUT, ">>".$DEBUG_LOG_FILE);
 | 
			
		||||
      print DEBUGOUTPUT $msg."\n";
 | 
			
		||||
      close( DEBUGOUTPUT);
 | 
			
		||||
    } elsif( $DEBUGOUTPUT == 2) {
 | 
			
		||||
      print "<BR><PRE>$msg</PRE>";
 | 
			
		||||
    } else {
 | 
			
		||||
      print STDERR $msg."\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								samples/Perl/strict.t
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								samples/Perl/strict.t
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
use Test::Base;
 | 
			
		||||
 | 
			
		||||
__DATA__
 | 
			
		||||
=== Strict Test
 | 
			
		||||
 | 
			
		||||
--- perl strict
 | 
			
		||||
my $x = 5;
 | 
			
		||||
--- strict
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
my $x = 5;
 | 
			
		||||
							
								
								
									
										10
									
								
								samples/PigLatin/example.pig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								samples/PigLatin/example.pig
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
/**
 | 
			
		||||
 * sample.pig
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
REGISTER $SOME_JAR;
 | 
			
		||||
 | 
			
		||||
A = LOAD 'person' USING PigStorage() AS (name:chararray, age:int); -- Load person
 | 
			
		||||
B = FOREACH A generate name;
 | 
			
		||||
DUMP B;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										68
									
								
								samples/SQF/fn_remoteExecFnc.sqf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								samples/SQF/fn_remoteExecFnc.sqf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Author: commy2
 | 
			
		||||
 *
 | 
			
		||||
 * Execute a function on a remote machine in mp.
 | 
			
		||||
 * 
 | 
			
		||||
 * Argument:
 | 
			
		||||
 * 0: Function arguments (Array)
 | 
			
		||||
 * 1: Function to execute, has to be defined on the remote machine first (String)
 | 
			
		||||
 * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (Object OR Number, optional default: 2)
 | 
			
		||||
 * 		Mode 0: execute on this machine only
 | 
			
		||||
 * 		Mode 1: execute on server
 | 
			
		||||
 * 		Mode 2: execute on all clients + server
 | 
			
		||||
 * 		Mode 3: execute on dedicated only
 | 
			
		||||
 * 
 | 
			
		||||
 * Return value:
 | 
			
		||||
 * Nothing
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
private ["_arguments", "_function", "_unit", "_id"];
 | 
			
		||||
 | 
			
		||||
AGM_Core_remoteFnc = _this;
 | 
			
		||||
 | 
			
		||||
_arguments = _this select 0;
 | 
			
		||||
_function = call compile (_this select 1);
 | 
			
		||||
_unit = _this select 2;
 | 
			
		||||
 | 
			
		||||
if (isNil "_unit") then {
 | 
			
		||||
	_unit = 2;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if (typeName _unit == "SCALAR") exitWith {
 | 
			
		||||
	switch (_unit) do {
 | 
			
		||||
		case 0 : {
 | 
			
		||||
			_arguments call _function;
 | 
			
		||||
		};
 | 
			
		||||
		case 1 : {
 | 
			
		||||
			if (isServer) then {
 | 
			
		||||
				_arguments call _function;
 | 
			
		||||
			} else {
 | 
			
		||||
				publicVariableServer "AGM_Core_remoteFnc";
 | 
			
		||||
			};
 | 
			
		||||
		};
 | 
			
		||||
		case 2 : {
 | 
			
		||||
			_arguments call _function;
 | 
			
		||||
 | 
			
		||||
			AGM_Core_remoteFnc set [2, 0];
 | 
			
		||||
			publicVariable "AGM_Core_remoteFnc";
 | 
			
		||||
		};
 | 
			
		||||
		case 3 : {
 | 
			
		||||
			if (isDedicated) then {
 | 
			
		||||
				_arguments call _function;
 | 
			
		||||
			} else {
 | 
			
		||||
				if (!isServer) then {publicVariableServer "AGM_Core_remoteFnc"};
 | 
			
		||||
			};
 | 
			
		||||
		};
 | 
			
		||||
	};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if (local _unit) then {
 | 
			
		||||
	_arguments call _function;
 | 
			
		||||
} else {
 | 
			
		||||
	if (isServer) then {
 | 
			
		||||
		_id = owner _unit;
 | 
			
		||||
		_id publicVariableClient "AGM_Core_remoteFnc";
 | 
			
		||||
	} else {
 | 
			
		||||
		publicVariableServer "AGM_Core_remoteFnc";
 | 
			
		||||
	};
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										19
									
								
								samples/SQF/macros.hqf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								samples/SQF/macros.hqf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
#include <version.hqf>
 | 
			
		||||
 | 
			
		||||
#define SET(VAR,VALUE) private #VAR; VAR = VALUE;
 | 
			
		||||
#define CONV(VAR,ARRAY,POOL) VAR = ARRAY select (POOL find VAR);
 | 
			
		||||
 | 
			
		||||
#define ALL_HITPOINTS_MAN [ \
 | 
			
		||||
  "HitHead", "HitBody", \
 | 
			
		||||
  "HitLeftArm", "HitRightArm", \
 | 
			
		||||
  "HitLeftLeg","HitRightLeg" \
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
#define ALL_HITPOINTS_VEH [ \
 | 
			
		||||
  "HitBody", "HitHull", "HitEngine", "HitFuel", \
 | 
			
		||||
  "HitTurret", "HitGun", \
 | 
			
		||||
  "HitLTrack", "HitRTrack", \
 | 
			
		||||
  "HitLFWheel", "HitRFWheel", "HitLF2Wheel", "HitRF2Wheel", "HitLMWheel", "HitRMWheel", "HitLBWheel", "HitRBWheel", \
 | 
			
		||||
  "HitAvionics", "HitHRotor", "HitVRotor", \
 | 
			
		||||
  "HitRGlass", "HitLGlass", "HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6" \
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										119
									
								
								samples/TeX/authortitle.cbx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								samples/TeX/authortitle.cbx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
\ProvidesFile{authortitle.cbx}
 | 
			
		||||
[\abx@cbxid]
 | 
			
		||||
 | 
			
		||||
\ExecuteBibliographyOptions{uniquename,uniquelist,autocite=footnote}
 | 
			
		||||
 | 
			
		||||
\renewcommand*{\iffinalcitedelim}{\iflastcitekey}
 | 
			
		||||
 | 
			
		||||
\newbool{cbx:parens}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{cite}{%
 | 
			
		||||
  \iffieldundef{shorthand}
 | 
			
		||||
    {\ifnameundef{labelname}
 | 
			
		||||
       {}
 | 
			
		||||
       {\printnames{labelname}%
 | 
			
		||||
        \setunit{\nametitledelim}}%
 | 
			
		||||
     \usebibmacro{cite:title}}%
 | 
			
		||||
    {\usebibmacro{cite:shorthand}}}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{citetitle}{%
 | 
			
		||||
  \iffieldundef{shorthand}
 | 
			
		||||
    {\usebibmacro{cite:title}}%
 | 
			
		||||
    {\usebibmacro{cite:shorthand}}}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{textcite}{%
 | 
			
		||||
  \ifnameundef{labelname}
 | 
			
		||||
    {}
 | 
			
		||||
    {\printnames{labelname}%
 | 
			
		||||
     \setunit{%
 | 
			
		||||
       \global\booltrue{cbx:parens}%
 | 
			
		||||
       \addspace\bibopenparen}}%
 | 
			
		||||
  \ifnumequal{\value{citecount}}{1}
 | 
			
		||||
    {\usebibmacro{prenote}}
 | 
			
		||||
    {}%
 | 
			
		||||
  \iffieldundef{shorthand}
 | 
			
		||||
    {\usebibmacro{cite:title}}%
 | 
			
		||||
    {\usebibmacro{cite:shorthand}}}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{cite:title}{%
 | 
			
		||||
  \printtext[bibhyperref]{%
 | 
			
		||||
    \printfield[citetitle]{labeltitle}}}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{cite:shorthand}{%
 | 
			
		||||
  \printtext[bibhyperref]{\printfield{shorthand}}}
 | 
			
		||||
 | 
			
		||||
\newbibmacro*{textcite:postnote}{%
 | 
			
		||||
  \iffieldundef{postnote}
 | 
			
		||||
    {\ifbool{cbx:parens}
 | 
			
		||||
       {\bibcloseparen}
 | 
			
		||||
       {}}
 | 
			
		||||
    {\ifbool{cbx:parens}
 | 
			
		||||
       {\postnotedelim}
 | 
			
		||||
       {\addspace\bibopenparen}%
 | 
			
		||||
     \printfield{postnote}\bibcloseparen}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\cite}
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{cite}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand*{\cite}
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{citetitle}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\parencite}[\mkbibparens]
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{cite}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand*{\parencite}[\mkbibparens]
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{citetitle}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{cite}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{cite}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
 | 
			
		||||
  {\usebibmacro{prenote}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \usebibmacro{cite}}
 | 
			
		||||
  {\multicitedelim}
 | 
			
		||||
  {\usebibmacro{postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareCiteCommand{\textcite}
 | 
			
		||||
  {\boolfalse{cbx:parens}}
 | 
			
		||||
  {\usebibmacro{citeindex}%
 | 
			
		||||
   \iffirstcitekey
 | 
			
		||||
     {\setcounter{textcitetotal}{1}}
 | 
			
		||||
     {\stepcounter{textcitetotal}%
 | 
			
		||||
      \textcitedelim}%
 | 
			
		||||
   \usebibmacro{textcite}}
 | 
			
		||||
  {\ifbool{cbx:parens}
 | 
			
		||||
     {\bibcloseparen\global\boolfalse{cbx:parens}}
 | 
			
		||||
     {}}
 | 
			
		||||
  {\usebibmacro{textcite:postnote}}
 | 
			
		||||
 | 
			
		||||
\DeclareMultiCiteCommand{\textcites}{\textcite}{}
 | 
			
		||||
 | 
			
		||||
\endinput
 | 
			
		||||
							
								
								
									
										554
									
								
								samples/TeX/english.lbx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										554
									
								
								samples/TeX/english.lbx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,554 @@
 | 
			
		||||
\ProvidesFile{english.lbx}
 | 
			
		||||
[\abx@lbxid]
 | 
			
		||||
 | 
			
		||||
\DeclareRedundantLanguages{english,american}{english,american,british,
 | 
			
		||||
canadian,australian,newzealand,USenglish,UKenglish}
 | 
			
		||||
 | 
			
		||||
\DeclareBibliographyExtras{%
 | 
			
		||||
  \protected\def\bibrangedash{%
 | 
			
		||||
    \textendash\penalty\hyphenpenalty}% breakable dash
 | 
			
		||||
  \protected\def\bibdatedash{\bibrangedash}%
 | 
			
		||||
  \def\finalandcomma{\addcomma}%
 | 
			
		||||
  \def\finalandsemicolon{\addsemicolon}%
 | 
			
		||||
  \protected\def\mkbibordinal#1{%
 | 
			
		||||
    \begingroup
 | 
			
		||||
    \@tempcnta0#1\relax\number\@tempcnta
 | 
			
		||||
    \@whilenum\@tempcnta>100\do{\advance\@tempcnta-100\relax}%
 | 
			
		||||
    \ifnum\@tempcnta>20
 | 
			
		||||
      \@whilenum\@tempcnta>9\do{\advance\@tempcnta-10\relax}%
 | 
			
		||||
    \fi
 | 
			
		||||
    \ifcase\@tempcnta th\or st\or nd\or rd\else th\fi
 | 
			
		||||
    \endgroup}%
 | 
			
		||||
  \protected\def\mkbibmascord{\mkbibordinal}%
 | 
			
		||||
  \protected\def\mkbibfemord{\mkbibordinal}%
 | 
			
		||||
  \protected\def\mkbibneutord{\mkbibordinal}%
 | 
			
		||||
  \protected\def\mkbibdatelong#1#2#3{%
 | 
			
		||||
    \iffieldundef{#2}
 | 
			
		||||
      {}
 | 
			
		||||
      {\mkbibmonth{\thefield{#2}}%
 | 
			
		||||
       \iffieldundef{#3}
 | 
			
		||||
         {\iffieldundef{#1}{}{\space}}
 | 
			
		||||
	 {\nobreakspace}}%
 | 
			
		||||
    \iffieldundef{#3}
 | 
			
		||||
      {}
 | 
			
		||||
      {\stripzeros{\thefield{#3}}%
 | 
			
		||||
       \iffieldundef{#1}{}{,\space}}%
 | 
			
		||||
     \iffieldbibstring{#1}
 | 
			
		||||
       {\bibstring{\thefield{#1}}}
 | 
			
		||||
       {\stripzeros{\thefield{#1}}}}%
 | 
			
		||||
  \protected\def\mkbibdateshort#1#2#3{%
 | 
			
		||||
    \iffieldundef{#2}
 | 
			
		||||
      {}
 | 
			
		||||
      {\mkdatezeros{\thefield{#2}}%
 | 
			
		||||
       \iffieldundef{#3}
 | 
			
		||||
         {\iffieldundef{#1}{}{/}}
 | 
			
		||||
         {/}}%
 | 
			
		||||
    \iffieldundef{#3}
 | 
			
		||||
      {}
 | 
			
		||||
      {\mkdatezeros{\thefield{#3}}%
 | 
			
		||||
       \iffieldundef{#1}{}{/}}%
 | 
			
		||||
     \iffieldbibstring{#1}
 | 
			
		||||
       {\bibstring{\thefield{#1}}}
 | 
			
		||||
       {\mkdatezeros{\thefield{#1}}}}%
 | 
			
		||||
  \savecommand\mkbibrangecomp
 | 
			
		||||
  \savecommand\mkbibrangecompextra
 | 
			
		||||
  \savecommand\mkbibrangeterse
 | 
			
		||||
  \savecommand\mkbibrangeterseextra
 | 
			
		||||
  \protected\def\mkbibrangecomp{%
 | 
			
		||||
    \lbx@us@mkbibrangetrunc@long{long}}%
 | 
			
		||||
  \protected\def\mkbibrangeterse{%
 | 
			
		||||
    \lbx@us@mkbibrangetrunc@short{short}}%
 | 
			
		||||
  \protected\def\mkbibrangecompextra{%
 | 
			
		||||
    \lbx@us@mkbibrangetruncextra@long{long}}%
 | 
			
		||||
  \protected\def\mkbibrangeterseextra{%
 | 
			
		||||
    \lbx@us@mkbibrangetruncextra@short{short}}%
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
\UndeclareBibliographyExtras{%
 | 
			
		||||
  \restorecommand\mkbibrangecomp
 | 
			
		||||
  \restorecommand\mkbibrangecompextra
 | 
			
		||||
  \restorecommand\mkbibrangeterse
 | 
			
		||||
  \restorecommand\mkbibrangeterseextra
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
\DeclareBibliographyStrings{%
 | 
			
		||||
  bibliography     = {{Bibliography}{Bibliography}},
 | 
			
		||||
  references       = {{References}{References}},
 | 
			
		||||
  shorthands       = {{List of Abbreviations}{Abbreviations}},
 | 
			
		||||
  editor           = {{editor}{ed\adddot}},
 | 
			
		||||
  editors          = {{editors}{eds\adddot}},
 | 
			
		||||
  compiler         = {{compiler}{comp\adddot}},
 | 
			
		||||
  compilers        = {{compilers}{comp\adddot}},
 | 
			
		||||
  redactor         = {{redactor}{red\adddot}},
 | 
			
		||||
  redactors        = {{redactors}{red\adddot}},
 | 
			
		||||
  reviser          = {{reviser}{rev\adddot}},
 | 
			
		||||
  revisers         = {{revisers}{rev\adddot}},
 | 
			
		||||
  founder          = {{founder}{found\adddot}},
 | 
			
		||||
  founders         = {{founders}{found\adddot}},
 | 
			
		||||
  continuator      = {{continued}{cont\adddot}},% FIXME: unsure
 | 
			
		||||
  continuators     = {{continued}{cont\adddot}},% FIXME: unsure
 | 
			
		||||
  collaborator     = {{collaborator}{collab\adddot}},% FIXME: unsure
 | 
			
		||||
  collaborators    = {{collaborators}{collab\adddot}},% FIXME: unsure
 | 
			
		||||
  translator       = {{translator}{trans\adddot}},
 | 
			
		||||
  translators      = {{translators}{trans\adddot}},
 | 
			
		||||
  commentator      = {{commentator}{comm\adddot}},
 | 
			
		||||
  commentators     = {{commentators}{comm\adddot}},
 | 
			
		||||
  annotator        = {{annotator}{annot\adddot}},
 | 
			
		||||
  annotators       = {{annotators}{annot\adddot}},
 | 
			
		||||
  commentary       = {{commentary}{comm\adddot}},
 | 
			
		||||
  annotations      = {{annotations}{annot\adddot}},
 | 
			
		||||
  introduction     = {{introduction}{intro\adddot}},
 | 
			
		||||
  foreword         = {{foreword}{forew\adddot}},
 | 
			
		||||
  afterword        = {{afterword}{afterw\adddot}},
 | 
			
		||||
  editortr         = {{editor and translator}%
 | 
			
		||||
                      {ed\adddotspace and trans\adddot}},
 | 
			
		||||
  editorstr        = {{editors and translators}%
 | 
			
		||||
                      {eds\adddotspace and trans\adddot}},
 | 
			
		||||
  editorco         = {{editor and commentator}%
 | 
			
		||||
                      {ed\adddotspace and comm\adddot}},
 | 
			
		||||
  editorsco        = {{editors and commentators}%
 | 
			
		||||
                      {eds\adddotspace and comm\adddot}},
 | 
			
		||||
  editoran         = {{editor and annotator}%
 | 
			
		||||
                      {ed\adddotspace and annot\adddot}},
 | 
			
		||||
  editorsan        = {{editors and annotators}%
 | 
			
		||||
                      {eds\adddotspace and annot\adddot}},
 | 
			
		||||
  editorin         = {{editor and introduction}%
 | 
			
		||||
                      {ed\adddotspace and introd\adddot}},
 | 
			
		||||
  editorsin        = {{editors and introduction}%
 | 
			
		||||
                      {eds\adddotspace and introd\adddot}},
 | 
			
		||||
  editorfo         = {{editor and foreword}%
 | 
			
		||||
                      {ed\adddotspace and forew\adddot}},
 | 
			
		||||
  editorsfo        = {{editors and foreword}%
 | 
			
		||||
                      {eds\adddotspace and forew\adddot}},
 | 
			
		||||
  editoraf         = {{editor and afterword}%
 | 
			
		||||
                      {ed\adddotspace and afterw\adddot}},
 | 
			
		||||
  editorsaf        = {{editors and afterword}%
 | 
			
		||||
                      {eds\adddotspace and afterw\adddot}},
 | 
			
		||||
  editortrco       = {{editor, translator\finalandcomma\ and commentator}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\finalandcomma\ and comm\adddot}},
 | 
			
		||||
  editorstrco      = {{editors, translators\finalandcomma\ and commentators}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans\adddot\finalandcomma\ and comm\adddot}},
 | 
			
		||||
  editortran       = {{editor, translator\finalandcomma\ and annotator}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\finalandcomma\ and annot\adddot}},
 | 
			
		||||
  editorstran      = {{editors, translators\finalandcomma\ and annotators}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans\adddot\finalandcomma\ and annot\adddot}},
 | 
			
		||||
  editortrin       = {{editor, translator\finalandcomma\ and introduction}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorstrin      = {{editors, translators\finalandcomma\ and introduction}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editortrfo       = {{editor, translator\finalandcomma\ and foreword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorstrfo      = {{editors, translators\finalandcomma\ and foreword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editortraf       = {{editor, translator\finalandcomma\ and afterword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorstraf      = {{editors, translators\finalandcomma\ and afterword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorcoin       = {{editor, commentator\finalandcomma\ and introduction}%
 | 
			
		||||
                      {ed.,\addabbrvspace comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorscoin      = {{editors, commentators\finalandcomma\ and introduction}%
 | 
			
		||||
                      {eds.,\addabbrvspace comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorcofo       = {{editor, commentator\finalandcomma\ and foreword}%
 | 
			
		||||
                      {ed.,\addabbrvspace comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorscofo      = {{editors, commentators\finalandcomma\ and foreword}%
 | 
			
		||||
                      {eds.,\addabbrvspace comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorcoaf       = {{editor, commentator\finalandcomma\ and afterword}%
 | 
			
		||||
                      {ed.,\addabbrvspace comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorscoaf      = {{editors, commentators\finalandcomma\ and afterword}%
 | 
			
		||||
                      {eds.,\addabbrvspace comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editoranin       = {{editor, annotator\finalandcomma\ and introduction}%
 | 
			
		||||
                      {ed.,\addabbrvspace annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorsanin      = {{editors, annotators\finalandcomma\ and introduction}%
 | 
			
		||||
                      {eds.,\addabbrvspace annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editoranfo       = {{editor, annotator\finalandcomma\ and foreword}%
 | 
			
		||||
                      {ed.,\addabbrvspace annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorsanfo      = {{editors, annotators\finalandcomma\ and foreword}%
 | 
			
		||||
                      {eds.,\addabbrvspace annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editoranaf       = {{editor, annotator\finalandcomma\ and afterword}%
 | 
			
		||||
                      {ed.,\addabbrvspace annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorsanaf      = {{editors, annotators\finalandcomma\ and afterword}%
 | 
			
		||||
                      {eds.,\addabbrvspace annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editortrcoin     = {{editor, translator, commentator\finalandcomma\ and introduction}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorstrcoin    = {{editors, translators, commentators\finalandcomma\ and introduction}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editortrcofo     = {{editor, translator, commentator\finalandcomma\ and foreword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorstrcofo    = {{editors, translators, commentators\finalandcomma\ and foreword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editortrcoaf     = {{editor, translator, commentator\finalandcomma\ and afterword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorstrcoaf    = {{editors, translators, commentators\finalandcomma\ and afterword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editortranin     = {{editor, translator, annotator\finalandcomma\ and introduction}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editorstranin    = {{editors, translators, annotators\finalandcomma\ and introduction}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  editortranfo     = {{editor, translator, annotator\finalandcomma\ and foreword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editorstranfo    = {{editors, translators, annotators\finalandcomma\ and foreword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  editortranaf     = {{editor, translator, annotator\finalandcomma\ and afterword}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans., annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  editorstranaf    = {{editors, translators, annotators\finalandcomma\ and afterword}%
 | 
			
		||||
                      {eds.,\addabbrvspace trans., annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  translatorco     = {{translator and commentator}%
 | 
			
		||||
                      {trans\adddot\ and comm\adddot}},
 | 
			
		||||
  translatorsco    = {{translators and commentators}%
 | 
			
		||||
                      {trans\adddot\ and comm\adddot}},
 | 
			
		||||
  translatoran     = {{translator and annotator}%
 | 
			
		||||
                      {trans\adddot\ and annot\adddot}},
 | 
			
		||||
  translatorsan    = {{translators and annotators}%
 | 
			
		||||
                      {trans\adddot\ and annot\adddot}},
 | 
			
		||||
  translatorin     = {{translation and introduction}%
 | 
			
		||||
                      {trans\adddot\ and introd\adddot}},
 | 
			
		||||
  translatorsin    = {{translation and introduction}%
 | 
			
		||||
                      {trans\adddot\ and introd\adddot}},
 | 
			
		||||
  translatorfo     = {{translation and foreword}%
 | 
			
		||||
                      {trans\adddot\ and forew\adddot}},
 | 
			
		||||
  translatorsfo    = {{translation and foreword}%
 | 
			
		||||
                      {trans\adddot\ and forew\adddot}},
 | 
			
		||||
  translatoraf     = {{translation and afterword}%
 | 
			
		||||
                      {trans\adddot\ and afterw\adddot}},
 | 
			
		||||
  translatorsaf    = {{translation and afterword}%
 | 
			
		||||
                      {trans\adddot\ and afterw\adddot}},
 | 
			
		||||
  translatorcoin   = {{translation, commentary\finalandcomma\ and introduction}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  translatorscoin  = {{translation, commentary\finalandcomma\ and introduction}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  translatorcofo   = {{translation, commentary\finalandcomma\ and foreword}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  translatorscofo  = {{translation, commentary\finalandcomma\ and foreword}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  translatorcoaf   = {{translation, commentary\finalandcomma\ and afterword}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  translatorscoaf  = {{translation, commentary\finalandcomma\ and afterword}%
 | 
			
		||||
                      {trans., comm\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  translatoranin   = {{translation, annotations\finalandcomma\ and introduction}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  translatorsanin  = {{translation, annotations\finalandcomma\ and introduction}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and introd\adddot}},
 | 
			
		||||
  translatoranfo   = {{translation, annotations\finalandcomma\ and foreword}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  translatorsanfo  = {{translation, annotations\finalandcomma\ and foreword}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and forew\adddot}},
 | 
			
		||||
  translatoranaf   = {{translation, annotations\finalandcomma\ and afterword}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  translatorsanaf  = {{translation, annotations\finalandcomma\ and afterword}%
 | 
			
		||||
                      {trans., annot\adddot\finalandcomma\ and afterw\adddot}},
 | 
			
		||||
  byauthor         = {{by}{by}},
 | 
			
		||||
  byeditor         = {{edited by}{ed\adddotspace by}},
 | 
			
		||||
  bycompiler       = {{compiled by}{comp\adddotspace by}},
 | 
			
		||||
  byredactor       = {{redacted by}{red\adddotspace by}},
 | 
			
		||||
  byreviser        = {{revised by}{rev\adddotspace by}},
 | 
			
		||||
  byreviewer       = {{reviewed by}{rev\adddotspace by}},
 | 
			
		||||
  byfounder        = {{founded by}{found\adddotspace by}},
 | 
			
		||||
  bycontinuator    = {{continued by}{cont\adddotspace by}},
 | 
			
		||||
  bycollaborator   = {{in collaboration with}{in collab\adddotspace with}},% FIXME: unsure
 | 
			
		||||
  bytranslator     = {{translated \lbx@lfromlang\ by}{trans\adddot\ \lbx@sfromlang\ by}},
 | 
			
		||||
  bycommentator    = {{commented by}{comm\adddot\ by}},
 | 
			
		||||
  byannotator      = {{annotated by}{annot\adddot\ by}},
 | 
			
		||||
  withcommentator  = {{with a commentary by}{with a comment\adddot\ by}},
 | 
			
		||||
  withannotator    = {{with annotations by}{with annots\adddot\ by}},
 | 
			
		||||
  withintroduction = {{with an introduction by}{with an intro\adddot\ by}},
 | 
			
		||||
  withforeword     = {{with a foreword by}{with a forew\adddot\ by}},
 | 
			
		||||
  withafterword    = {{with an afterword by}{with an afterw\adddot\ by}},
 | 
			
		||||
  byeditortr       = {{edited and translated \lbx@lfromlang\ by}%
 | 
			
		||||
                      {ed\adddotspace and trans\adddot\ \lbx@sfromlang\ by}},
 | 
			
		||||
  byeditorco       = {{edited and commented by}%
 | 
			
		||||
                      {ed\adddotspace and comm\adddot\ by}},
 | 
			
		||||
  byeditoran       = {{edited and annotated by}%
 | 
			
		||||
                      {ed\adddotspace and annot\adddot\ by}},
 | 
			
		||||
  byeditorin       = {{edited, with an introduction, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace with an introd., by}},
 | 
			
		||||
  byeditorfo       = {{edited, with a foreword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace with a forew., by}},
 | 
			
		||||
  byeditoraf       = {{edited, with an afterword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace with an afterw., by}},
 | 
			
		||||
  byeditortrco     = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm\adddot\ by}},
 | 
			
		||||
  byeditortran     = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot\adddot\ by}},
 | 
			
		||||
  byeditortrin     = {{edited and translated \lbx@lfromlang, with an introduction, by}%
 | 
			
		||||
                      {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with an introd., by}},
 | 
			
		||||
  byeditortrfo     = {{edited and translated \lbx@lfromlang, with a foreword, by}%
 | 
			
		||||
                      {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with a forew., by}},
 | 
			
		||||
  byeditortraf     = {{edited and translated \lbx@lfromlang, with an afterword, by}%
 | 
			
		||||
                      {ed\adddotspace and trans\adddot\ \lbx@sfromlang, with an afterw., by}},
 | 
			
		||||
  byeditorcoin     = {{edited and commented, with an introduction, by}%
 | 
			
		||||
                      {ed\adddotspace and comm., with an introd., by}},
 | 
			
		||||
  byeditorcofo     = {{edited and commented, with a foreword, by}%
 | 
			
		||||
                      {ed\adddotspace and comm., with a forew., by}},
 | 
			
		||||
  byeditorcoaf     = {{edited and commented, with an afterword, by}%
 | 
			
		||||
                      {ed\adddotspace and comm., with an afterw., by}},
 | 
			
		||||
  byeditoranin     = {{edited and annotated, with an introduction, by}%
 | 
			
		||||
                      {ed\adddotspace and annot., with an introd., by}},
 | 
			
		||||
  byeditoranfo     = {{edited and annotated, with a foreword, by}%
 | 
			
		||||
                      {ed\adddotspace and annot., with a forew., by}},
 | 
			
		||||
  byeditoranaf     = {{edited and annotated, with an afterword, by}%
 | 
			
		||||
                      {ed\adddotspace and annot., with an afterw., by}},
 | 
			
		||||
  byeditortrcoin   = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with an introduction, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with an introd., by}},
 | 
			
		||||
  byeditortrcofo   = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with a foreword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with a forew., by}},
 | 
			
		||||
  byeditortrcoaf   = {{edited, translated \lbx@lfromlang\finalandcomma\ and commented, with an afterword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and comm., with an afterw., by}},
 | 
			
		||||
  byeditortranin   = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with an introduction, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with an introd., by}},
 | 
			
		||||
  byeditortranfo   = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with a foreword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with a forew., by}},
 | 
			
		||||
  byeditortranaf   = {{edited, translated \lbx@lfromlang\finalandcomma\ and annotated, with an afterword, by}%
 | 
			
		||||
                      {ed.,\addabbrvspace trans\adddot\ \lbx@sfromlang\finalandcomma\ and annot, with an afterw., by}},
 | 
			
		||||
  bytranslatorco   = {{translated \lbx@lfromlang\ and commented by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and comm\adddot\ by}},
 | 
			
		||||
  bytranslatoran   = {{translated \lbx@lfromlang\ and annotated by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and annot\adddot\ by}},
 | 
			
		||||
  bytranslatorin   = {{translated \lbx@lfromlang, with an introduction, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang, with an introd., by}},
 | 
			
		||||
  bytranslatorfo   = {{translated \lbx@lfromlang, with a foreword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang, with a forew., by}},
 | 
			
		||||
  bytranslatoraf   = {{translated \lbx@lfromlang, with an afterword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang, with an afterw., by}},
 | 
			
		||||
  bytranslatorcoin = {{translated \lbx@lfromlang\ and commented, with an introduction, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and comm., with an introd., by}},
 | 
			
		||||
  bytranslatorcofo = {{translated \lbx@lfromlang\ and commented, with a foreword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and comm., with a forew., by}},
 | 
			
		||||
  bytranslatorcoaf = {{translated \lbx@lfromlang\ and commented, with an afterword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and comm., with an afterw., by}},
 | 
			
		||||
  bytranslatoranin = {{translated \lbx@lfromlang\ and annotated, with an introduction, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and annot., with an introd., by}},
 | 
			
		||||
  bytranslatoranfo = {{translated \lbx@lfromlang\ and annotated, with a foreword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and annot., with a forew., by}},
 | 
			
		||||
  bytranslatoranaf = {{translated \lbx@lfromlang\ and annotated, with an afterword, by}%
 | 
			
		||||
                      {trans\adddot\ \lbx@sfromlang\ and annot., with an afterw., by}},
 | 
			
		||||
  and              = {{and}{and}},
 | 
			
		||||
  andothers        = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}},
 | 
			
		||||
  andmore          = {{et\addabbrvspace al\adddot}{et\addabbrvspace al\adddot}},
 | 
			
		||||
  volume           = {{volume}{vol\adddot}},
 | 
			
		||||
  volumes          = {{volumes}{vols\adddot}},
 | 
			
		||||
  involumes        = {{in}{in}},
 | 
			
		||||
  jourvol          = {{volume}{vol\adddot}},
 | 
			
		||||
  jourser          = {{series}{ser\adddot}},
 | 
			
		||||
  book             = {{book}{book}},
 | 
			
		||||
  part             = {{part}{part}},
 | 
			
		||||
  issue            = {{issue}{issue}},
 | 
			
		||||
  newseries        = {{new series}{new ser\adddot}},
 | 
			
		||||
  oldseries        = {{old series}{old ser\adddot}},
 | 
			
		||||
  edition          = {{edition}{ed\adddot}},
 | 
			
		||||
  reprint          = {{reprint}{repr\adddot}},
 | 
			
		||||
  reprintof        = {{reprint of}{repr\adddotspace of}},
 | 
			
		||||
  reprintas        = {{reprinted as}{rpt\adddotspace as}},
 | 
			
		||||
  reprintfrom      = {{reprinted from}{repr\adddotspace from}},
 | 
			
		||||
  reviewof         = {{review of}{rev\adddotspace of}},
 | 
			
		||||
  translationof    = {{translation of}{trans\adddotspace of}},
 | 
			
		||||
  translationas    = {{translated as}{trans\adddotspace as}},
 | 
			
		||||
  translationfrom  = {{translated from}{trans\adddotspace from}},
 | 
			
		||||
  origpubas        = {{originally published as}{orig\adddotspace pub\adddotspace as}},
 | 
			
		||||
  origpubin        = {{originally published in}{orig\adddotspace pub\adddotspace in}},
 | 
			
		||||
  astitle          = {{as}{as}},
 | 
			
		||||
  bypublisher      = {{by}{by}},
 | 
			
		||||
  page             = {{page}{p\adddot}},
 | 
			
		||||
  pages            = {{pages}{pp\adddot}},
 | 
			
		||||
  column           = {{column}{col\adddot}},
 | 
			
		||||
  columns          = {{columns}{cols\adddot}},
 | 
			
		||||
  line             = {{line}{l\adddot}},
 | 
			
		||||
  lines            = {{lines}{ll\adddot}},
 | 
			
		||||
  nodate           = {{no date}{n\adddot d\adddot}},
 | 
			
		||||
  verse            = {{verse}{v\adddot}},
 | 
			
		||||
  verses           = {{verses}{vv\adddot}},
 | 
			
		||||
  section          = {{section}{\S}},
 | 
			
		||||
  sections         = {{sections}{\S\S}},
 | 
			
		||||
  paragraph        = {{paragraph}{par\adddot}},
 | 
			
		||||
  paragraphs       = {{paragraphs}{par\adddot}},
 | 
			
		||||
  in               = {{in}{in}},
 | 
			
		||||
  inseries         = {{in}{in}},
 | 
			
		||||
  ofseries         = {{of}{of}},
 | 
			
		||||
  number           = {{number}{no\adddot}},
 | 
			
		||||
  chapter          = {{chapter}{chap\adddot}},
 | 
			
		||||
  mathesis         = {{Master's thesis}{MA\addabbrvspace thesis}},
 | 
			
		||||
  phdthesis        = {{PhD\addabbrvspace thesis}{PhD\addabbrvspace thesis}},
 | 
			
		||||
  candthesis       = {{Candidate thesis}{Cand\adddotspace thesis}},
 | 
			
		||||
  resreport        = {{research report}{research rep\adddot}},
 | 
			
		||||
  techreport       = {{technical report}{tech\adddotspace rep\adddot}},
 | 
			
		||||
  software         = {{computer software}{comp\adddotspace software}},
 | 
			
		||||
  datacd           = {{CD-ROM}{CD-ROM}},
 | 
			
		||||
  audiocd          = {{audio CD}{audio CD}},
 | 
			
		||||
  version          = {{version}{version}},
 | 
			
		||||
  url              = {{address}{address}},
 | 
			
		||||
  urlfrom          = {{available from}{available from}},
 | 
			
		||||
  urlseen          = {{visited on}{visited on}},
 | 
			
		||||
  inpreparation    = {{in preparation}{in preparation}},
 | 
			
		||||
  submitted        = {{submitted}{submitted}},
 | 
			
		||||
  forthcoming      = {{forthcoming}{forthcoming}},
 | 
			
		||||
  inpress          = {{in press}{in press}},
 | 
			
		||||
  prepublished     = {{pre-published}{pre-published}},
 | 
			
		||||
  citedas          = {{henceforth cited as}{henceforth cited as}},
 | 
			
		||||
  thiscite         = {{especially}{esp\adddot}},
 | 
			
		||||
  seenote          = {{see note}{see n\adddot}},
 | 
			
		||||
  quotedin         = {{quoted in}{qtd\adddotspace in}},
 | 
			
		||||
  idem             = {{idem}{idem}},
 | 
			
		||||
  idemsm           = {{idem}{idem}},
 | 
			
		||||
  idemsf           = {{eadem}{eadem}},
 | 
			
		||||
  idemsn           = {{idem}{idem}},
 | 
			
		||||
  idempm           = {{eidem}{eidem}},
 | 
			
		||||
  idempf           = {{eaedem}{eaedem}},
 | 
			
		||||
  idempn           = {{eadem}{eadem}},
 | 
			
		||||
  idempp           = {{eidem}{eidem}},
 | 
			
		||||
  ibidem           = {{ibidem}{ibid\adddot}},
 | 
			
		||||
  opcit            = {{op\adddotspace cit\adddot}{op\adddotspace cit\adddot}},
 | 
			
		||||
  loccit           = {{loc\adddotspace cit\adddot}{loc\adddotspace cit\adddot}},
 | 
			
		||||
  confer           = {{cf\adddot}{cf\adddot}},
 | 
			
		||||
  sequens          = {{sq\adddot}{sq\adddot}},
 | 
			
		||||
  sequentes        = {{sqq\adddot}{sqq\adddot}},
 | 
			
		||||
  passim           = {{passim}{pass\adddot}},
 | 
			
		||||
  see              = {{see}{see}},
 | 
			
		||||
  seealso          = {{see also}{see also}},
 | 
			
		||||
  backrefpage      = {{cited on page}{cit\adddotspace on p\adddot}},
 | 
			
		||||
  backrefpages     = {{cited on pages}{cit\adddotspace on pp\adddot}},
 | 
			
		||||
  january          = {{January}{Jan\adddot}},
 | 
			
		||||
  february         = {{February}{Feb\adddot}},
 | 
			
		||||
  march            = {{March}{Mar\adddot}},
 | 
			
		||||
  april            = {{April}{Apr\adddot}},
 | 
			
		||||
  may              = {{May}{May}},
 | 
			
		||||
  june             = {{June}{June}},
 | 
			
		||||
  july             = {{July}{July}},
 | 
			
		||||
  august           = {{August}{Aug\adddot}},
 | 
			
		||||
  september        = {{September}{Sept\adddot}},
 | 
			
		||||
  october          = {{October}{Oct\adddot}},
 | 
			
		||||
  november         = {{November}{Nov\adddot}},
 | 
			
		||||
  december         = {{December}{Dec\adddot}},
 | 
			
		||||
  langamerican     = {{American}{American}},
 | 
			
		||||
  langbrazilian    = {{Brazilian}{Brazilian}},
 | 
			
		||||
  langcatalan      = {{Catalan}{Catalan}},
 | 
			
		||||
  langcroatian     = {{Croatian}{Croatian}},
 | 
			
		||||
  langczech        = {{Czech}{Czech}},
 | 
			
		||||
  langdanish       = {{Danish}{Danish}},
 | 
			
		||||
  langdutch        = {{Dutch}{Dutch}},
 | 
			
		||||
  langenglish      = {{English}{English}},
 | 
			
		||||
  langfinnish      = {{Finnish}{Finnish}},
 | 
			
		||||
  langfrench       = {{French}{French}},
 | 
			
		||||
  langgerman       = {{German}{German}},
 | 
			
		||||
  langgreek        = {{Greek}{Greek}},
 | 
			
		||||
  langitalian      = {{Italian}{Italian}},
 | 
			
		||||
  langlatin        = {{Latin}{Latin}},
 | 
			
		||||
  langnorwegian    = {{Norwegian}{Norwegian}},
 | 
			
		||||
  langpolish       = {{Polish}{Polish}},
 | 
			
		||||
  langportuguese   = {{Portuguese}{Portuguese}},
 | 
			
		||||
  langrussian      = {{Russian}{Russian}},
 | 
			
		||||
  langslovene      = {{Slovene}{Slovene}},
 | 
			
		||||
  langspanish      = {{Spanish}{Spanish}},
 | 
			
		||||
  langswedish      = {{Swedish}{Swedish}},
 | 
			
		||||
  fromamerican     = {{from the American}{from the American}},
 | 
			
		||||
  frombrazilian    = {{from the Brazilian}{from the Brazilian}},
 | 
			
		||||
  fromcatalan      = {{from the Catalan}{from the Catalan}},
 | 
			
		||||
  fromcroatian     = {{from the Croatian}{from the Croatian}},
 | 
			
		||||
  fromczech        = {{from the Czech}{from the Czech}},
 | 
			
		||||
  fromdanish       = {{from the Danish}{from the Danish}},
 | 
			
		||||
  fromdutch        = {{from the Dutch}{from the Dutch}},
 | 
			
		||||
  fromenglish      = {{from the English}{from the English}},
 | 
			
		||||
  fromfinnish      = {{from the Finnish}{from the Finnish}},
 | 
			
		||||
  fromfrench       = {{from the French}{from the French}},
 | 
			
		||||
  fromgerman       = {{from the German}{from the German}},
 | 
			
		||||
  fromgreek        = {{from the Greek}{from the Greek}},
 | 
			
		||||
  fromitalian      = {{from the Italian}{from the Italian}},
 | 
			
		||||
  fromlatin        = {{from the Latin}{from the Latin}},
 | 
			
		||||
  fromnorwegian    = {{from the Norwegian}{from the Norwegian}},
 | 
			
		||||
  frompolish       = {{from the Polish}{from the Polish}},
 | 
			
		||||
  fromportuguese   = {{from the Portuguese}{from the Portuguese}},
 | 
			
		||||
  fromrussian      = {{from the Russian}{from the Russian}},
 | 
			
		||||
  fromslovene      = {{from the Slovene}{from the Slovene}},
 | 
			
		||||
  fromspanish      = {{from the Spanish}{from the Spanish}},
 | 
			
		||||
  fromswedish      = {{from the Swedish}{from the Swedish}},
 | 
			
		||||
  countryde        = {{Germany}{DE}},
 | 
			
		||||
  countryeu        = {{European Union}{EU}},
 | 
			
		||||
  countryep        = {{European Union}{EP}},
 | 
			
		||||
  countryfr        = {{France}{FR}},
 | 
			
		||||
  countryuk        = {{United Kingdom}{GB}},
 | 
			
		||||
  countryus        = {{United States of America}{US}},
 | 
			
		||||
  patent           = {{patent}{pat\adddot}},
 | 
			
		||||
  patentde         = {{German patent}{German pat\adddot}},
 | 
			
		||||
  patenteu         = {{European patent}{European pat\adddot}},
 | 
			
		||||
  patentfr         = {{French patent}{French pat\adddot}},
 | 
			
		||||
  patentuk         = {{British patent}{British pat\adddot}},
 | 
			
		||||
  patentus         = {{U.S\adddotspace patent}{U.S\adddotspace pat\adddot}},
 | 
			
		||||
  patreq           = {{patent request}{pat\adddot\ req\adddot}},
 | 
			
		||||
  patreqde         = {{German patent request}{German pat\adddot\ req\adddot}},
 | 
			
		||||
  patreqeu         = {{European patent request}{European pat\adddot\ req\adddot}},
 | 
			
		||||
  patreqfr         = {{French patent request}{French pat\adddot\ req\adddot}},
 | 
			
		||||
  patrequk         = {{British patent request}{British pat\adddot\ req\adddot}},
 | 
			
		||||
  patrequs         = {{U.S\adddotspace patent request}{U.S\adddotspace pat\adddot\ req\adddot}},
 | 
			
		||||
  file             = {{file}{file}},
 | 
			
		||||
  library          = {{library}{library}},
 | 
			
		||||
  abstract         = {{abstract}{abstract}},
 | 
			
		||||
  annotation       = {{annotations}{annotations}},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
\protected\gdef\lbx@us@mkbibrangetrunc@long#1#2{%
 | 
			
		||||
  \iffieldundef{#2year}
 | 
			
		||||
    {}
 | 
			
		||||
    {\printtext[#2date]{%
 | 
			
		||||
       \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
	 {\csuse{mkbibdate#1}{}{#2month}{#2day}}
 | 
			
		||||
	 {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
 | 
			
		||||
       \iffieldundef{#2endyear}
 | 
			
		||||
	 {}
 | 
			
		||||
	 {\iffieldequalstr{#2endyear}{}
 | 
			
		||||
            {\mbox{\bibdatedash}}
 | 
			
		||||
	    {\bibdatedash
 | 
			
		||||
	     \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
	       {\iffieldsequal{#2month}{#2endmonth}
 | 
			
		||||
        	  {\csuse{mkbibdate#1}{#2endyear}{}{#2endday}}
 | 
			
		||||
		  {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}
 | 
			
		||||
	       {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}}}
 | 
			
		||||
 | 
			
		||||
\protected\gdef\lbx@us@mkbibrangetrunc@short#1#2{%
 | 
			
		||||
  \iffieldundef{#2year}
 | 
			
		||||
    {}
 | 
			
		||||
    {\printtext[#2date]{%
 | 
			
		||||
       \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
         {\csuse{mkbibdate#1}{}{#2month}{#2day}}
 | 
			
		||||
         {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
 | 
			
		||||
       \iffieldundef{#2endyear}
 | 
			
		||||
         {}
 | 
			
		||||
         {\iffieldequalstr{#2endyear}{}
 | 
			
		||||
            {\mbox{\bibdatedash}}
 | 
			
		||||
            {\bibdatedash
 | 
			
		||||
             \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}}
 | 
			
		||||
 | 
			
		||||
\protected\gdef\lbx@us@mkbibrangetruncextra@long#1#2{%
 | 
			
		||||
  \iffieldundef{#2year}
 | 
			
		||||
    {}
 | 
			
		||||
    {\printtext[#2date]{%
 | 
			
		||||
       \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
         {\csuse{mkbibdate#1}{}{#2month}{#2day}}
 | 
			
		||||
         {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
 | 
			
		||||
       \iffieldundef{#2endyear}
 | 
			
		||||
         {\printfield{extrayear}}
 | 
			
		||||
         {\iffieldequalstr{#2endyear}{}
 | 
			
		||||
            {\printfield{extrayear}%
 | 
			
		||||
             \mbox{\bibdatedash}}
 | 
			
		||||
            {\bibdatedash
 | 
			
		||||
             \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
               {\iffieldsequal{#2month}{#2endmonth}
 | 
			
		||||
                  {\csuse{mkbibdate#1}{#2endyear}{}{#2endday}}
 | 
			
		||||
                  {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}
 | 
			
		||||
               {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}%
 | 
			
		||||
             \printfield{extrayear}}}}}}
 | 
			
		||||
 | 
			
		||||
\protected\gdef\lbx@us@mkbibrangetruncextra@short#1#2{%
 | 
			
		||||
  \iffieldundef{#2year}
 | 
			
		||||
    {}
 | 
			
		||||
    {\printtext[#2date]{%
 | 
			
		||||
       \iffieldsequal{#2year}{#2endyear}
 | 
			
		||||
         {\csuse{mkbibdate#1}{}{#2month}{#2day}}
 | 
			
		||||
         {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
 | 
			
		||||
       \iffieldundef{#2endyear}
 | 
			
		||||
         {\printfield{extrayear}}
 | 
			
		||||
         {\iffieldequalstr{#2endyear}{}
 | 
			
		||||
            {\printfield{extrayear}%
 | 
			
		||||
          \mbox{\bibdatedash}}
 | 
			
		||||
         {\bibdatedash
 | 
			
		||||
          \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
 | 
			
		||||
       \printfield{extrayear}}}}}}
 | 
			
		||||
 | 
			
		||||
\endinput
 | 
			
		||||
							
								
								
									
										6
									
								
								samples/TeX/verbose.bbx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								samples/TeX/verbose.bbx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
\ProvidesFile{verbose.bbx}
 | 
			
		||||
[\abx@bbxid]
 | 
			
		||||
 | 
			
		||||
\RequireBibliographyStyle{authortitle}
 | 
			
		||||
 | 
			
		||||
\endinput
 | 
			
		||||
		Reference in New Issue
	
	Block a user