The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError Exception: ArrowInvalid Message: JSON parse error: The surrogate pair in string is invalid. in row 46 Traceback: Traceback (most recent call last): File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables dataset = json.load(f) File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load return loads(fp.read(), File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 2819) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single for _, table in generator: File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables raise e File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables pa_table = paj.read_json( File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: JSON parse error: The surrogate pair in string is invalid. in row 46 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response parquet_operations = convert_to_parquet(builder) File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet builder.download_and_prepare( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare self._download_and_prepare( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split for job_id, done, content in self._prepare_split_single( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating the dataset") from e datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string |
---|
### USER: In ABAP.
Add runtime measurement to REPL
*&---------------------------------------------------------------------*
*& Report ZUSR_LISP_REPL
*& https://github.com/mydoghasworms/abap-lisp
*& Simple REPL for Lisp Interpreter written in ABAP
*& Martin Ceronio, June 2015
*& martin.ceronio@infosize.co.za
*&---------------------------------------------------------------------*
report zusr_lisp_repl line-size 999.
include zlib_lisp.
data: lr_int type ref to lcl_lisp_interpreter. "The Lisp interpreter
parameters: input type string lower case.
parameters: output type string lower case.
at selection-screen output.
* Make result field output-only
loop at screen.
if screen-name = 'OUTPUT'.
screen-input = 0.
modify screen.
endif.
endloop.
at selection-screen.
* Initialize interpreter if not done yet
if lr_int is not bound.
create object lr_int.
endif.
* Evaluate given code
output = lr_int->eval_source( input ).
clear input.
load-of-program.
* Hitting execute gets us back to this event and initializes the interpreter,
* so we preferably want to avoid that happening inadvertently:
perform insert_into_excl(rsdbrunt) using: 'ONLI', 'SPOS', 'PRIN', 'SJOB'. ### ASSISTANT: No problem
*&---------------------------------------------------------------------*
*& Report ZUSR_LISP_REPL
*& https://github.com/mydoghasworms/abap-lisp
*& Simple REPL for Lisp Interpreter written in ABAP
*& Martin Ceronio, June 2015
*& martin.ceronio@infosize.co.za
*&---------------------------------------------------------------------*
report zusr_lisp_repl line-size 999.
include zlib_lisp.
data: lr_int type ref to lcl_lisp_interpreter. "The Lisp interpreter
data: rt_begin type i.
data: rt_end type i.
parameters: input type string lower case.
parameters: output type string lower case.
parameters: runtime type string lower case.
at selection-screen output.
* Make result field output-only
loop at screen.
if screen-name = 'OUTPUT' or screen-name = 'RUNTIME'.
screen-input = 0.
if screen-name = 'RUNTIME'.
screen-display_3d = 0.
endif.
modify screen.
endif.
endloop.
at selection-screen.
* Initialize interpreter if not done yet
if lr_int is not bound.
create object lr_int.
endif.
* Evaluate given code
get RUN TIME FIELD rt_begin.
output = lr_int->eval_source( input ).
get RUN TIME FIELD rt_end.
clear input.
runtime = |{ rt_end - rt_begin } microseconds|.
load-of-program.
* Hitting execute gets us back to this event and initializes the interpreter,
* so we preferably want to avoid that happening inadvertently:
perform insert_into_excl(rsdbrunt) using: 'ONLI', 'SPOS', 'PRIN', 'SJOB'. |
### USER: In ActionScript.
Add colors to Flash test to ease debugging.
package {
import stdio.Sprite
[SWF(width=0, height=0)]
public class flash_test extends Sprite {
public function main(): void {
test_body()
}
}
}
### ASSISTANT: No problem
package {
import stdio.Sprite
[SWF(width=100, height=100)]
public class flash_test extends Sprite {
public function flash_test(): void {
graphics.beginFill(0xff0000)
graphics.drawRect(10, 10, 80, 80)
graphics.endFill()
}
public function main(): void {
graphics.beginFill(0x0000ff)
graphics.drawRect(30, 30, 40, 40)
graphics.endFill()
test_body()
}
}
}
|
### USER: In ActionScript.
Handle null in validation elem iteration
/*
#
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# 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 MIT License for full details.
*/
package com.rpath.raf.views
{
import mx.core.UIComponent;
import mx.events.ValidationResultEvent;
import spark.components.Group;
public class CompoundInputItem extends Group
{
public function CompoundInputItem()
{
super();
// force height computation
minHeight = 0;
}
[Bindable]
public var inputFields:Array;
public override function validationResultHandler(event:ValidationResultEvent):void
{
// let our specific input controls mark themselves appropriately
for each (var elem:UIComponent in inputFields)
{
elem.validationResultHandler(event);
}
// propagate events beyond ourselves
super.validationResultHandler(event);
}
}
} ### ASSISTANT: No problem
/*
#
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# 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 MIT License for full details.
*/
package com.rpath.raf.views
{
import mx.core.UIComponent;
import mx.events.ValidationResultEvent;
import spark.components.Group;
public class CompoundInputItem extends Group
{
public function CompoundInputItem()
{
super();
// force height computation
minHeight = 0;
}
[Bindable]
public var inputFields:Array;
public override function validationResultHandler(event:ValidationResultEvent):void
{
// let our specific input controls mark themselves appropriately
for each (var elem:UIComponent in inputFields)
{
if (elem)
elem.validationResultHandler(event);
}
// propagate events beyond ourselves
super.validationResultHandler(event);
}
}
} |
### USER: In ActionScript.
Load sound directly on constructor
package io.github.jwhile.impetus
{
import flash.media.Sound;
import flash.media.SoundChannel;
public class ImpetusSound
{
private var url:String;
private var sound:Sound;
private var channels:Vector.<SoundChannel>;
public function ImpetusSound(url:String):void
{
this.url = url;
this.sound = new Sound();
this.channels = new Vector.<SoundChannel>;
}
}
}
### ASSISTANT: No problem
package io.github.jwhile.impetus
{
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
public class ImpetusSound
{
private var sound:Sound;
private var channels:Vector.<SoundChannel>;
public function ImpetusSound(url:String):void
{
this.sound = new Sound();
this.channels = new Vector.<SoundChannel>;
this.sound.load(new URLRequest(url));
}
}
}
|
### USER: In ActionScript.
Delete is now a non-core function
git-svn-id: f772d44cbf86d9968f12179c1556189f5afcea6e@658 e0ac87d7-b42b-0410-9034-8248a05cb448
import Drawable;
import Lobe;
import Core;
class Brain{
static var brain = new Array();
var mSelectionManager:SelectionManager;
static function makenewlobe(){
var newmov=(new Lobe(_root,_root.getNextHighestDepth()));
var topleft = new Point(100,40);
var botright = new Point(200,140);
newmov.commitBox(topleft, botright, 0);
var keyListener = {};
keyListener.onKeyDown = function()
{
var k = Key.getCode();
if(k == Key.DELETEKEY){
Brain.makenewlobe();
}
};
}
function Brain (root_mc:MovieClip) {
mSelectionManager = new SelectionManager(root_mc);
}
}
### ASSISTANT: No problem
import Drawable;
import Lobe;
import Core;
class Brain{
static var brain = new Array();
var mSelectionManager:SelectionManager;
static function makenewlobe(){
var newmov=(new Lobe(_root,_root.getNextHighestDepth()));
var topleft = new Point(100,40);
var botright = new Point(200,140);
newmov.commitBox(topleft, botright, 0);
}
function Brain (root_mc:MovieClip) {
mSelectionManager = new SelectionManager(root_mc);
var keyListener = {};
keyListener.onKeyDown = function()
{
var k = Key.getCode();
if(k == Key.DELETEKEY){
Brain.makenewlobe();
}
};
Key.addListener( keyListener );
}
}
|
### USER: In ActionScript.
Add a roadmap (of sorts)
### ASSISTANT: No problem
// [ ] Variable declaration
let name: type = expression;
// [ ] Basic types (arrow)
/*
byte (8-bit, unsigned)
bool (1-bit[*])
int8
int16
int32
int64
int128
uint8
uint16
uint32
uint64
uint128
intptr (size of a pointer, signed)
uintptr (size of a pointer, unsigned)
char (32-bit, unsigned)
float16
float32
float64
float128
*/
// [ ] Expressions
// [ ] - Add
// [ ] - Subtract
// [ ] - Multiply
// [ ] - Divide
// [ ] - Modulo
// [ ] - Logical And
// [ ] - Logical Or
// [ ] - Logical Not
// [ ] - Relational GT
// [ ] - Relational GE
// [ ] - Relational LT
// [ ] - Relational LE
// [ ] - Relational And
// [ ] - Relational Or
// [ ] - Bitwise And
// [ ] - Bitwise Or
// [ ] - Bitwise Xor
// [ ] - Bitwise Not
// [ ] Pointers
// [ ] - Type
// [ ] - Address Of
// [ ] - Dereference
// [ ] Cast
// [ ] Function declaration
def main() {
}
// [ ] Extern function declaration
extern def puts(s: *byte);
// [ ] Extern function declaration w/ABI
extern "stdcall" def CreateWindowExA();
// [ ] Function call (extern AND local)
main();
puts("Hello");
// [ ] Extern import
extern import "stdint.h";
// [ ] Module (namespace)
module cstdint { extern import "stdint.h"; }
// [ ] c module (built-in)
import "c";
/*
// [ ] Basic types (in C)
c.char
c.uchar
c.schar
c.int
c.uint
c.short
c.ushort
c.long
c.ulong
c.float
c.double
c.ldouble
*/
// [ ] BigInt
int // (∞-bit, signed)
|
### USER: In ActionScript.
Change this instance back. Varargs are still a nightmare and should
generally be avoided, but nobody's going to override this method and
we're always calling a regular method on the server, not a varargs method.
git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4622 542714f4-19e9-0310-aa3c-eee0fc999fb1
//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.crowd.data {
public class ManagerCaller
{
public function ManagerCaller (plobj :PlaceObject)
{
_plobj = plobj;
}
/**
* Called to call a method on the manager.
*/
public function invoke (method :String, args :Array = null) :void
{
_plobj.postMessage(method, args);
}
/** The place object we're thingy-ing for. */
protected var _plobj :PlaceObject;
}
}
### ASSISTANT: No problem
//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.crowd.data {
public class ManagerCaller
{
public function ManagerCaller (plobj :PlaceObject)
{
_plobj = plobj;
}
/**
* Called to call a method on the manager.
*/
public function invoke (method :String, ... args) :void
{
_plobj.postMessage(method, args);
}
/** The place object we're thingy-ing for. */
protected var _plobj :PlaceObject;
}
}
|
### USER: In ActionScript.
Clean up my comment, this is in a public API (and my comment wasn't helpful).
git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@166 ed5b42cb-e716-0410-a449-f6a68f950b19
package com.threerings.flex {
import mx.containers.HBox;
import mx.controls.Label;
import mx.controls.sliderClasses.Slider;
import mx.events.SliderEvent;
/**
* A simple component that displays a label to the left of a slider.
*/
public class LabeledSlider extends HBox
{
/** The slider, all public and accessable. Don't fuck it up! */
public var slider :Slider;
/**
* Create a LabeledSlider holding the specified slider.
*/
public function LabeledSlider (slider :Slider)
{
_label = new Label();
_label.text = String(slider.value);
addChild(_label);
this.slider = slider;
slider.showDataTip = false; // because we do it...
addChild(slider);
slider.addEventListener(SliderEvent.CHANGE, handleSliderChange, false, 0, true);
}
protected function handleSliderChange (event :SliderEvent) :void
{
_label.text = String(event.value);
}
protected var _label :Label;
}
}
### ASSISTANT: No problem
package com.threerings.flex {
import mx.containers.HBox;
import mx.controls.Label;
import mx.controls.sliderClasses.Slider;
import mx.events.SliderEvent;
/**
* A simple component that displays a label to the left of a slider.
*/
public class LabeledSlider extends HBox
{
/** The actual slider. */
public var slider :Slider;
/**
* Create a LabeledSlider holding the specified slider.
*/
public function LabeledSlider (slider :Slider)
{
_label = new Label();
_label.text = String(slider.value);
addChild(_label);
this.slider = slider;
slider.showDataTip = false; // because we do it...
addChild(slider);
slider.addEventListener(SliderEvent.CHANGE, handleSliderChange, false, 0, true);
}
protected function handleSliderChange (event :SliderEvent) :void
{
_label.text = String(event.value);
}
protected var _label :Label;
}
}
|
### USER: In ActionScript.
Return true if we succeeded.
git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4462 542714f4-19e9-0310-aa3c-eee0fc999fb1
package com.threerings.util {
import flash.net.URLRequest;
//import flash.net.navigateToURL; // function import
public class NetUtil
{
/**
* Convenience method to load a web page in the browser window without
* having to worry about SecurityErrors in various conditions.
*/
public static function navigateToURL (
url :String, preferSameWindowOrTab :Boolean = true) :void
{
var ureq :URLRequest = new URLRequest(url);
if (preferSameWindowOrTab) {
try {
flash.net.navigateToURL(ureq, "_self");
return;
} catch (err :SecurityError) {
// ignore; fall back to using a blank window, below...
}
}
// open in a blank window
try {
flash.net.navigateToURL(ureq);
} catch (err :SecurityError) {
Log.getLog(NetUtil).warning(
"Unable to navigate to URL [e=" + err + "].");
}
}
}
}
### ASSISTANT: No problem
package com.threerings.util {
import flash.net.URLRequest;
//import flash.net.navigateToURL; // function import
public class NetUtil
{
/**
* Convenience method to load a web page in the browser window without
* having to worry about SecurityErrors in various conditions.
*
* @return true if the url was unable to be loaded.
*/
public static function navigateToURL (
url :String, preferSameWindowOrTab :Boolean = true) :Boolean
{
var ureq :URLRequest = new URLRequest(url);
if (preferSameWindowOrTab) {
try {
flash.net.navigateToURL(ureq, "_self");
return true;
} catch (err :SecurityError) {
// ignore; fall back to using a blank window, below...
}
}
// open in a blank window
try {
flash.net.navigateToURL(ureq);
return true;
} catch (err :SecurityError) {
Log.getLog(NetUtil).warning(
"Unable to navigate to URL [e=" + err + "].");
}
return false; // failure!
}
}
}
|
### USER: In ActionScript.
Implement getPayload() method to extract SPS/PPS bytes
package com.axis.rtspclient {
import flash.events.Event;
import flash.external.ExternalInterface;
import flash.utils.ByteArray;
public class NALU extends Event {
public static const NEW_NALU:String = "NEW_NALU";
private var data:ByteArray;
public var ntype:uint;
public var nri:uint;
public var timestamp:uint;
public var bodySize:uint;
public function NALU(ntype:uint, nri:uint, data:ByteArray, timestamp:uint) {
super(NEW_NALU);
this.data = data;
this.ntype = ntype;
this.nri = nri;
this.timestamp = timestamp;
this.bodySize = data.bytesAvailable;
}
public function appendData(idata:ByteArray):void {
ByteArrayUtils.appendByteArray(data, idata);
this.bodySize = data.bytesAvailable;
}
public function isIDR():Boolean {
return (5 === ntype);
}
public function writeSize():uint {
return 2 + 2 + 1 + data.bytesAvailable;
}
public function writeStream(output:ByteArray):void {
output.writeUnsignedInt(data.bytesAvailable + 1); // NALU length + header
output.writeByte((0x0 & 0x80) | (nri & 0x60) | (ntype & 0x1F)); // NAL header
output.writeBytes(data, data.position);
}
}
}
### ASSISTANT: No problem
package com.axis.rtspclient {
import flash.events.Event;
import flash.external.ExternalInterface;
import flash.utils.ByteArray;
public class NALU extends Event {
public static const NEW_NALU:String = "NEW_NALU";
private var data:ByteArray;
public var ntype:uint;
public var nri:uint;
public var timestamp:uint;
public var bodySize:uint;
public function NALU(ntype:uint, nri:uint, data:ByteArray, timestamp:uint) {
super(NEW_NALU);
this.data = data;
this.ntype = ntype;
this.nri = nri;
this.timestamp = timestamp;
this.bodySize = data.bytesAvailable;
}
public function appendData(idata:ByteArray):void {
ByteArrayUtils.appendByteArray(data, idata);
this.bodySize = data.bytesAvailable;
}
public function isIDR():Boolean {
return (5 === ntype);
}
public function writeSize():uint {
return 2 + 2 + 1 + data.bytesAvailable;
}
public function writeStream(output:ByteArray):void {
output.writeUnsignedInt(data.bytesAvailable + 1); // NALU length + header
output.writeByte((0x0 & 0x80) | (nri & 0x60) | (ntype & 0x1F)); // NAL header
output.writeBytes(data, data.position);
}
public function getPayload():ByteArray {
var payload:ByteArray = new ByteArray();
data.position -= 1;
data.readBytes(payload, 0, data.bytesAvailable);
return payload;
}
}
}
|
### USER: In ActionScript.
Use `colorize` in readline test.
package {
import stdio.flash.Sprite
import stdio.process
import stdio.Interactive
[SWF(width=0, height=0)]
public class test_readline_flash extends Sprite implements Interactive {
public function main(): void {
process.prompt = "What’s your name? "
process.gets(function (name: String): void {
process.puts("Hello, " + name + "!")
process.prompt = "Favorite color? "
process.gets(function (color: String): void {
process.puts("I like " + color + " too!")
process.exit()
})
})
}
}
}
### ASSISTANT: No problem
package {
import stdio.colorize
import stdio.flash.Sprite
import stdio.process
import stdio.Interactive
[SWF(width=0, height=0)]
public class test_readline_flash extends Sprite implements Interactive {
public function main(): void {
process.prompt = "What’s your name? "
process.gets(function (name: String): void {
process.puts("Hello, " + name + "!")
process.prompt = "What’s your favorite color? "
process.gets(function (color: String): void {
color = color.toLowerCase()
process.puts(
"I like " + colorize(
"%{bold}%{" + color + "}" + color + "%{none}"
) + " too!"
)
process.exit()
})
})
}
}
}
|
### USER: In ActionScript.
Add URI tests to the asunit test suite
package {
import asunit.framework.TestSuite;
public class Suite extends TestSuite {
public function Suite() {
super();
addTest(new PlayerTest("testPass"));
}
}
}
### ASSISTANT: No problem
package {
import asunit.framework.TestSuite;
public class Suite extends TestSuite {
public function Suite() {
super();
addTest(new PlayerTest("testPass"));
addTest(new UriTest("test_isSafe"));
}
}
}
|
### USER: In ActionScript.
Store url & add getUrl() getter
package
{
import flash.media.Sound;
import flash.net.URLRequest;
public class ImpetusSound
{
private var sound:Sound;
private var channels:Vector.<ImpetusChannel>;
public function ImpetusSound(url:String):void
{
this.sound = new Sound();
this.channels = new Vector.<ImpetusChannel>;
this.sound.load(new URLRequest(url));
}
public function playNew():ImpetusChannel
{
var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));
channels.push(c);
return c;
}
public function stopAll():void
{
var len:int = this.channels.length;
for(var i:int; i < len; i++)
{
this.channels[i].stop();
}
}
}
}
### ASSISTANT: No problem
package
{
import flash.media.Sound;
import flash.net.URLRequest;
public class ImpetusSound
{
private var url:String;
private var sound:Sound;
private var channels:Vector.<ImpetusChannel>;
public function ImpetusSound(url:String):void
{
this.url = url;
this.sound = new Sound();
this.channels = new Vector.<ImpetusChannel>;
this.sound.load(new URLRequest(url));
}
public function get getUrl():String
{
return this.url
}
public function playNew():ImpetusChannel
{
var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));
channels.push(c);
return c;
}
public function stopAll():void
{
var len:int = this.channels.length;
for(var i:int; i < len; i++)
{
this.channels[i].stop();
}
}
}
}
|
### USER: In ActionScript.
Fix call super test case.
package {
class ClassA
{
public function ClassA()
{
trace('A');
}
protected function foo() : void
{
trace('a');
}
protected function bar() : void
{
trace('b');
}
}
class ClassC extends ClassA
{
public function ClassC()
{
trace('> C');
super();
foo();
bar();
trace('< C');
}
override protected function bar() : void {
super.bar();
trace('override b');
}
}
class ClassE extends ClassC
{
public function ClassE()
{
trace('> E');
super();
foo();
bar();
trace('< E');
}
override protected function bar() : void {
super.bar();
trace('override b again');
}
}
// var c = new ClassC();
// var e = new ClassE();
class X {
protected var
}
trace("--");
}
### ASSISTANT: No problem
package {
class ClassA
{
public function ClassA()
{
trace('A');
}
protected function foo() : void
{
trace('a');
}
protected function bar() : void
{
trace('b');
}
}
class ClassC extends ClassA
{
public function ClassC()
{
trace('> C');
super();
foo();
bar();
trace('< C');
}
override protected function bar() : void {
super.bar();
trace('override b');
}
}
class ClassE extends ClassC
{
public function ClassE()
{
trace('> E');
super();
foo();
bar();
trace('< E');
}
override protected function bar() : void {
super.bar();
trace('override b again');
}
}
trace("--");
}
|
### USER: In ActionScript.
Set currentInstance on prepare, not on instantiation time.
package flails.mxml {
import com.asfusion.mate.actions.AbstractServiceInvoker;
import com.asfusion.mate.actionLists.IScope;
import com.asfusion.mate.actions.IAction;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import flails.request.RequestPipe;
import flails.resource.Resources;
import flails.resource.Resource;
public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
public var resource:Resource;
public var data:Array;
public var type:String;
public var id:String;
public var parent:Object;
[Bindable] public var result:Object;
public function ResourcefulServiceInvoker() {
currentInstance = this;
}
override protected function prepare(scope:IScope):void {
super.prepare(scope);
}
override protected function run(scope:IScope):void {
trace ("Using resource " + resource);
var rp:RequestPipe = resource.newRequestPipe();
innerHandlersDispatcher = rp;
if (resultHandlers && resultHandlers.length > 0) {
createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
}
if (faultHandlers && faultHandlers.length > 0) {
createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
}
trace("calling " + type + "()");
rp[type].apply(rp, data);
}
}
} ### ASSISTANT: No problem
package flails.mxml {
import com.asfusion.mate.actions.AbstractServiceInvoker;
import com.asfusion.mate.actionLists.IScope;
import com.asfusion.mate.actions.IAction;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import flails.request.RequestPipe;
import flails.resource.Resources;
import flails.resource.Resource;
public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
private var _data:Array;
public var resource:Resource;
public var type:String;
public var id:String;
public var parent:Object;
[Bindable] public var result:Object;
public function set data(args:Object):void {
trace("setting data");
if (args is Array)
_data = args as Array;
else
_data = [args];
}
override protected function prepare(scope:IScope):void {
currentInstance = this;
super.prepare(scope);
}
override protected function run(scope:IScope):void {
trace ("Using resource " + resource);
var rp:RequestPipe = resource.newRequestPipe();
innerHandlersDispatcher = rp;
if (resultHandlers && resultHandlers.length > 0) {
createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
}
if (faultHandlers && faultHandlers.length > 0) {
createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
}
trace("calling " + type + "() with " + _data);
rp[type].apply(rp, _data);
}
}
} |
### USER: In ActionScript.
Implement IMXMLObject. Some defaults and checks.
/**
* Copyright (c) 2009 Lance Carlson
* See LICENSE for full license information.
*/
package flails.resource {
import flails.request.RequestPipe;
import flails.request.HTTPClient;
import flails.request.ResourcePathBuilder;
import flails.request.JSONFilter;
import flash.utils.getQualifiedClassName;
import mx.core.IMXMLObject;
public class Resource {
public var name:String;
public var instanceClass:Class;
public function Resource() {}
public function initialized(parent:Object, id:String):void {
}
public function index(resultHandler:Function, errorHandler:Function = null):void {
requestPipe(resultHandler, errorHandler).index();
}
public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
requestPipe(resultHandler, errorHandler).show(id);
}
public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
// TODO: The pluralization obviously needs to be taken care of
var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));
pipe.addEventListener("result", resultHandler);
return pipe;
}
}
}
### ASSISTANT: No problem
/**
* Copyright (c) 2009 Lance Carlson
* See LICENSE for full license information.
*/
package flails.resource {
import flails.request.RequestPipe;
import flails.request.HTTPClient;
import flails.request.ResourcePathBuilder;
import flails.request.JSONFilter;
import mx.core.IMXMLObject;
public class Resource implements IMXMLObject {
public var name:String;
public var instanceClass:Class;
public function Resource() {}
public function initialized(parent:Object, id:String):void {
if (name == null) throw new Error("Name not set for resource.");
if (instanceClass == null) instanceClass = Record;
}
public function index(resultHandler:Function, errorHandler:Function = null):void {
requestPipe(resultHandler, errorHandler).index();
}
public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
requestPipe(resultHandler, errorHandler).show(id);
}
public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
// TODO: The pluralization obviously needs to be taken care of
var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));
pipe.addEventListener("result", resultHandler);
return pipe;
}
}
}
|
### USER: In ActionScript.
Remove custom LoaderContext creation code.
package goplayer
{
import flash.display.Loader
import flash.events.Event
import flash.events.IOErrorEvent
import flash.net.URLRequest
import flash.system.ApplicationDomain
import flash.system.LoaderContext
import flash.system.SecurityDomain
public class FlashContentLoadAttempt
{
private const loader : Loader = new Loader
private var url : String
private var listener : FlashContentLoaderListener
public function FlashContentLoadAttempt
(url : String, listener : FlashContentLoaderListener)
{
this.url = url, this.listener = listener
loader.contentLoaderInfo.addEventListener
(Event.COMPLETE, handleContentLoaded)
loader.contentLoaderInfo.addEventListener
(IOErrorEvent.IO_ERROR, handleIOError)
}
public function execute() : void
{ loader.load(new URLRequest(url)) }
private function get loaderContext() : LoaderContext
{
const result : LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain))
result.securityDomain = SecurityDomain.currentDomain
return result
}
private function handleContentLoaded(event : Event) : void
{ listener.handleContentLoaded(loader.contentLoaderInfo) }
private function handleIOError(event : IOErrorEvent) : void
{ debug("Failed to load <" + url + ">: " + event.text) }
}
}
### ASSISTANT: No problem
package goplayer
{
import flash.display.Loader
import flash.events.Event
import flash.events.IOErrorEvent
import flash.net.URLRequest
import flash.system.ApplicationDomain
import flash.system.LoaderContext
import flash.system.SecurityDomain
public class FlashContentLoadAttempt
{
private const loader : Loader = new Loader
private var url : String
private var listener : FlashContentLoaderListener
public function FlashContentLoadAttempt
(url : String, listener : FlashContentLoaderListener)
{
this.url = url, this.listener = listener
loader.contentLoaderInfo.addEventListener
(Event.COMPLETE, handleContentLoaded)
loader.contentLoaderInfo.addEventListener
(IOErrorEvent.IO_ERROR, handleIOError)
}
public function execute() : void
{ loader.load(new URLRequest(url)) }
private function handleContentLoaded(event : Event) : void
{ listener.handleContentLoaded(loader.contentLoaderInfo) }
private function handleIOError(event : IOErrorEvent) : void
{ debug("Failed to load <" + url + ">: " + event.text) }
}
}
|
### USER: In ActionScript.
Move the images by their offset
//
// Flump - Copyright 2012 Three Rings Design
package flump.export {
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
import flump.xfl.XflTexture;
public class PackedTexture
{
public const holder :Sprite = new Sprite();
public var tex :XflTexture;
public var offset :Point;
public var w :int, h :int, a :int;
public var atlasX :int, atlasY :int;
public var atlasRotated :Boolean;
public function PackedTexture (tex :XflTexture, image :DisplayObject) {
this.tex = tex;
holder.addChild(image);
const bounds :Rectangle = image.getBounds(holder);
offset = new Point(bounds.x, bounds.y);
w = Math.ceil(bounds.width);
h = Math.ceil(bounds.height);
a = w * h;
}
public function toString () :String {
return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
}
}
}
### ASSISTANT: No problem
//
// Flump - Copyright 2012 Three Rings Design
package flump.export {
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
import flump.xfl.XflTexture;
public class PackedTexture
{
public const holder :Sprite = new Sprite();
public var tex :XflTexture;
public var offset :Point;
public var w :int, h :int, a :int;
public var atlasX :int, atlasY :int;
public var atlasRotated :Boolean;
public function PackedTexture (tex :XflTexture, image :DisplayObject) {
this.tex = tex;
holder.addChild(image);
const bounds :Rectangle = image.getBounds(holder);
image.x = -bounds.x;
image.y = -bounds.y;
offset = new Point(bounds.x, bounds.y);
w = Math.ceil(bounds.width);
h = Math.ceil(bounds.height);
a = w * h;
}
public function toString () :String {
return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
}
}
}
|
### USER: In ActionScript.
Make this optional, and not the default.
Turns out a bunch of shit makes the wrapper size a little bigger,
and some things seem to freak out when the wrapper has a size,
even when includeInLayout=false.
Flex you very much.
git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@616 ed5b42cb-e716-0410-a449-f6a68f950b19
//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.flex {
import flash.display.DisplayObject;
import mx.core.UIComponent;
/**
* Wraps a non-Flex component for use in Flex.
*/
public class FlexWrapper extends UIComponent
{
public function FlexWrapper (object :DisplayObject)
{
// don't capture mouse events in this wrapper
mouseEnabled = false;
addChild(object);
width = object.width;
height = object.height;
}
}
}
### ASSISTANT: No problem
//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.flex {
import flash.display.DisplayObject;
import mx.core.UIComponent;
/**
* Wraps a non-Flex component for use in Flex.
*/
public class FlexWrapper extends UIComponent
{
public function FlexWrapper (object :DisplayObject, inheritSize :Boolean = false)
{
// don't capture mouse events in this wrapper
mouseEnabled = false;
addChild(object);
if (inheritSize) {
width = object.width;
height = object.height;
}
}
}
}
|
### USER: In ActionScript.
Fix bug preventing running processes recursively.
package stdio {
import flash.display.*
import flash.utils.getQualifiedClassName
import flash.utils.setTimeout
public class Sprite extends flash.display.Sprite {
public function Sprite() {
stage.scaleMode = StageScaleMode.NO_SCALE
stage.align = StageAlign.TOP_LEFT
// Let the subclass constructor run first.
setTimeout(initialize, 0)
}
private function initialize(): void {
setup(loaderInfo, this, start)
}
private function start(): void {
if ("main" in this && this["main"].length === 0) {
this["main"]()
} else {
warn("Please write your main method like this:")
warn("public function main(): void {}")
process.exit(1)
}
}
private function warn(message: String): void {
process.warn(getQualifiedClassName(this) + ": " + message)
}
}
}
### ASSISTANT: No problem
package stdio {
import flash.display.*
import flash.utils.getQualifiedClassName
import flash.utils.setTimeout
public class Sprite extends flash.display.Sprite {
public function Sprite() {
if (stage) {
stage.scaleMode = StageScaleMode.NO_SCALE
stage.align = StageAlign.TOP_LEFT
}
// Let the subclass constructor run first.
setTimeout(initialize, 0)
}
private function initialize(): void {
setup(loaderInfo, this, start)
}
private function start(): void {
if ("main" in this && this["main"].length === 0) {
this["main"]()
} else {
warn("Please write your main method like this:")
warn("public function main(): void {}")
process.exit(1)
}
}
private function warn(message: String): void {
process.warn(getQualifiedClassName(this) + ": " + message)
}
}
}
|
### USER: In ActionScript.
Allow subclasses to choose not to call handleFrame() when
ADDED_TO_STAGE is received.
git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@253 ed5b42cb-e716-0410-a449-f6a68f950b19
//
// $Id$
package com.threerings.flash {
import flash.display.Sprite;
import flash.events.Event;
/**
* Convenience superclass to use for sprites that need to update every frame.
* (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
* will prevent an object from being garbage collected!)
*/
public class FrameSprite extends Sprite
{
public function FrameSprite ()
{
addEventListener(Event.ADDED_TO_STAGE, handleAdded);
addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
}
/**
* Called when we're added to the stage.
*/
protected function handleAdded (... ignored) :void
{
addEventListener(Event.ENTER_FRAME, handleFrame);
handleFrame(); // update immediately
}
/**
* Called when we're added to the stage.
*/
protected function handleRemoved (... ignored) :void
{
removeEventListener(Event.ENTER_FRAME, handleFrame);
}
/**
* Called to update our visual appearance prior to each frame.
*/
protected function handleFrame (... ignored) :void
{
// nothing here. Override in yor subclass.
}
}
}
### ASSISTANT: No problem
//
// $Id$
package com.threerings.flash {
import flash.display.Sprite;
import flash.events.Event;
/**
* Convenience superclass to use for sprites that need to update every frame.
* (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
* will prevent an object from being garbage collected!)
*/
public class FrameSprite extends Sprite
{
/**
* @param renderFrameUponAdding if true, the handleFrame() method
* is called whenever an ADDED_TO_STAGE event is received.
*/
public function FrameSprite (renderFrameUponAdding :Boolean = true)
{
_renderOnAdd = renderFrameUponAdding;
addEventListener(Event.ADDED_TO_STAGE, handleAdded);
addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
}
/**
* Called when we're added to the stage.
*/
protected function handleAdded (... ignored) :void
{
addEventListener(Event.ENTER_FRAME, handleFrame);
if (_renderOnAdd) {
handleFrame(); // update immediately
}
}
/**
* Called when we're added to the stage.
*/
protected function handleRemoved (... ignored) :void
{
removeEventListener(Event.ENTER_FRAME, handleFrame);
}
/**
* Called to update our visual appearance prior to each frame.
*/
protected function handleFrame (... ignored) :void
{
// nothing here. Override in yor subclass.
}
/** Should we call handleFrame() when we get ADDED_TO_STAGE? */
protected var _renderOnAdd :Boolean;
}
}
|
### USER: In ActionScript.
Add template for writing SWF unit tests
### ASSISTANT: No problem
/* -*- Mode: java; indent-tabs-mode: nil -*- */
/*
Compiled with:
java -jar utils/asc.jar -import playerglobal.abc -swf Template,100,100,10 test/swfs/test_TemplateTest.as
This template is for writing test SWFs using pure AS3. It allows for testing
UI events, screen and program state using the Shumway test harness.
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class TemplateTest extends Sprite {
public var loader;
public function TemplateTest() {
var child = new TestObject();
addChild(child);
addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
}
}
}
import flash.display.*;
import flash.events.*;
import flash.net.*;
class TestObject extends Sprite {
private var color: uint = 0xFFCC00;
private var pos: uint = 10;
private var size: uint = 80;
/*
In the constructor, install event listeners for testing events, and
construct and add child objects.
*/
public function TestObject() {
}
private var frameCount = 0;
/*
In the enterFrameHandler, make API calls per frame to test both
screen and program side-effects.
*/
function enterFrameHandler(event:Event):void {
frameCount++;
var target = event.target;
var loader = target.loader;
switch (frameCount) {
case 1:
(function () {
/*
Log test results in the standard format shown here to allow
for easy linking with monitor programs.
*/
var result = true ? "PASS" : "FAIL";
trace(result + ": test::Template/method ()");
trace(result + ": test::Template/get name ()");
trace(result + ": test::Template/set name ()");
})();
break;
default:
/*
Remove enterFrameHandler when done.
*/
parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
break;
}
}
}
|
### USER: In ActionScript.
Add a simple terminal-like output.
### ASSISTANT: No problem
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.net.XMLSocket;
public class swfcat extends Sprite
{
private var output_text:TextField;
private function puts(s:String):void
{
output_text.appendText(s + "
");
}
public function swfcat()
{
output_text = new TextField();
output_text.width = 400;
output_text.height = 300;
output_text.background = true;
output_text.backgroundColor = 0x001f0f;
output_text.textColor = 0x44CC44;
addChild(output_text);
}
}
}
|
### USER: In ActionScript.
Test case base class -- all AS test classes extend this.
### ASSISTANT: No problem
/*
Copyright 2009, Matthew Eernisse (mde@fleegix.org) and Slide, Inc.
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.
*/
package org.windmill {
import flash.display.Sprite;
import flash.display.Stage;
import org.windmill.WMAssert;
public class TestCase extends Sprite {
public var asserts:* = WMAssert;
// Get a reference to the Stage in the base class
// before the tests actually load so tests can all
// reference it
private var fakeStage:Stage = Windmill.getStage();
override public function get stage():Stage {
return fakeStage;
}
}
}
|
### USER: In ActionScript.
Fix 525654 - added test for runtime Vector specialization
### ASSISTANT: No problem
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is [Open Source Virtual Machine.].
*
* The Initial Developer of the Original Code is
* Adobe System Incorporated.
* Portions created by the Initial Developer are Copyright (C) 2007-2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adobe AS3 Team
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
Description:
Runtime specialization
Specialization of the Vector type can be done at runtime
instead of at compile time.
*/
function getVector() { return Vector; }
var CODE = 1007; // Instantiation attempted on a non-constructor.
startTest();
var TITLE="Runtime specialization";
writeHeaderToLog(TITLE);
var x = getVector().<int>;
y = new x();
y.push(1);
y.push(2);
y.push(3);
AddTestCase( "Vector constructed via runtime specialization",
3,
y.length);
AddTestCase( "Vector constructed via runtime specialization",
2,
y[1]);
var neg_result = "Failed to catch invalid construct";
try {
unspecialized = getVector();
var z = new unspecialized();
} catch ( ex )
{
neg_result = String(ex);
}
AddTestCase ( "Invalid use of unspecialized type in constructor", TYPEERROR + CODE, typeError(neg_result));
test();
|
### USER: In Ada.
Change the Event type to a limited type
-----------------------------------------------------------------------
-- util-events -- Events
-- Copyright (C) 2001, 2002, 2003, 2009, 2010 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Calendar;
package Util.Events is
type Event is tagged private;
-- Get the time identifying when the event was created.
function Get_Time (Ev : Event) return Ada.Calendar.Time;
type Event_Listener is limited interface;
private
type Event is tagged record
Date : Ada.Calendar.Time := Ada.Calendar.Clock;
end record;
end Util.Events;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- util-events -- Events
-- Copyright (C) 2001, 2002, 2003, 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Calendar;
package Util.Events is
type Event is tagged limited private;
-- Get the time identifying when the event was created.
function Get_Time (Ev : Event) return Ada.Calendar.Time;
type Event_Listener is limited interface;
private
type Event is tagged limited record
Date : Ada.Calendar.Time := Ada.Calendar.Clock;
end record;
end Util.Events;
|
### USER: In Ada.
Update to use the new command implementation
-----------------------------------------------------------------------
-- gen-commands-info -- Collect and give information about the project
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Info is
-- ------------------------------
-- Project Information Command
-- ------------------------------
-- This command collects information about the project and print it.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
procedure Execute (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Info;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-info -- Collect and give information about the project
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Info is
-- ------------------------------
-- Project Information Command
-- ------------------------------
-- This command collects information about the project and print it.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Info;
|
### USER: In Ada.
Update to use the new command implementation
-----------------------------------------------------------------------
-- gen-commands-docs -- Extract and generate documentation for the project
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Docs is
-- ------------------------------
-- Documentation Command
-- ------------------------------
-- This command extracts documentation from the project files and collect them
-- together to build the project documentation.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
procedure Execute (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Docs;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-docs -- Extract and generate documentation for the project
-- Copyright (C) 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Docs is
-- ------------------------------
-- Documentation Command
-- ------------------------------
-- This command extracts documentation from the project files and collect them
-- together to build the project documentation.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Docs;
|
### USER: In Ada.
Add Name parameter to the Help procedure
-----------------------------------------------------------------------
-- gen-commands-page -- Page creation command for dynamo
-- Copyright (C) 2011, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Page is
-- ------------------------------
-- Page Creation Command
-- ------------------------------
-- This command adds a XHTML page to the web application.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Page;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-page -- Page creation command for dynamo
-- Copyright (C) 2011, 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Page is
-- ------------------------------
-- Page Creation Command
-- ------------------------------
-- This command adds a XHTML page to the web application.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Page;
|
### USER: In Ada.
Add unit tests for the questionVote bean
-----------------------------------------------------------------------
-- awa-questions-services-tests -- Unit tests for question service
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Questions.Services.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Manager : AWA.Questions.Services.Question_Service_Access;
end record;
-- Test creation of a question.
procedure Test_Create_Question (T : in out Test);
-- Test list of questions.
procedure Test_List_Questions (T : in out Test);
end AWA.Questions.Services.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-questions-services-tests -- Unit tests for question service
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Questions.Services.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Manager : AWA.Questions.Services.Question_Service_Access;
end record;
-- Test creation of a question.
procedure Test_Create_Question (T : in out Test);
-- Test list of questions.
procedure Test_List_Questions (T : in out Test);
-- Test anonymous user voting for a question.
procedure Test_Question_Vote_Anonymous (T : in out Test);
-- Test voting for a question.
procedure Test_Question_Vote (T : in out Test);
private
-- Do a vote on a question through the question vote bean.
procedure Do_Vote (T : in out Test);
end AWA.Questions.Services.Tests;
|
### USER: In Ada.
Update to use the new command implementation
-----------------------------------------------------------------------
-- gen-commands-layout -- Layout creation command for dynamo
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Layout is
-- ------------------------------
-- Layout Creation Command
-- ------------------------------
-- This command adds a XHTML layout to the web application.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
procedure Execute (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Layout;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-layout -- Layout creation command for dynamo
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Layout is
-- ------------------------------
-- Layout Creation Command
-- ------------------------------
-- This command adds a XHTML layout to the web application.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Layout;
|
### USER: In Ada.
Use the MAT.Readers.Streams package for the file reader implementation
-----------------------------------------------------------------------
-- mat-readers-files -- Reader for files
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
with Util.Streams.Files;
package MAT.Readers.Files is
type File_Reader_Type is new Manager_Base with private;
-- Open the file.
procedure Open (Reader : in out File_Reader_Type;
Path : in String);
procedure Read_All (Reader : in out File_Reader_Type);
private
type File_Reader_Type is new Manager_Base with record
File : aliased Util.Streams.Files.File_Stream;
Stream : Util.Streams.Buffered.Buffered_Stream;
end record;
end MAT.Readers.Files;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-readers-files -- Reader for files
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
with Util.Streams.Files;
with MAT.Readers.Streams;
package MAT.Readers.Files is
type File_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with private;
-- Open the file.
procedure Open (Reader : in out File_Reader_Type;
Path : in String);
private
type File_Reader_Type is new MAT.Readers.Streams.Stream_Reader_Type with record
File : aliased Util.Streams.Files.File_Stream;
end record;
end MAT.Readers.Files;
|
### USER: In Ada.
Declare the Test_Set_Connection_Error test procedure
-----------------------------------------------------------------------
-- ado-drivers-tests -- Unit tests for database drivers
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Drivers.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test the Get_Config operation.
procedure Test_Get_Config (T : in out Test);
-- Test the Get_Driver operation.
procedure Test_Get_Driver (T : in out Test);
-- Test loading some invalid database driver.
procedure Test_Load_Invalid_Driver (T : in out Test);
-- Test the Get_Driver_Index operation.
procedure Test_Get_Driver_Index (T : in out Test);
end ADO.Drivers.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- ado-drivers-tests -- Unit tests for database drivers
-- Copyright (C) 2014, 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package ADO.Drivers.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test the Get_Config operation.
procedure Test_Get_Config (T : in out Test);
-- Test the Get_Driver operation.
procedure Test_Get_Driver (T : in out Test);
-- Test loading some invalid database driver.
procedure Test_Load_Invalid_Driver (T : in out Test);
-- Test the Get_Driver_Index operation.
procedure Test_Get_Driver_Index (T : in out Test);
-- Test the Set_Connection procedure with several error cases.
procedure Test_Set_Connection_Error (T : in out Test);
end ADO.Drivers.Tests;
|
### USER: In Ada.
Change Help command to accept in out command
-----------------------------------------------------------------------
-- druss-commands-status -- Druss status commands
-- Copyright (C) 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Druss.Commands.Status is
type Command_Type is new Druss.Commands.Drivers.Command_Type with null record;
procedure Do_Status (Command : in Command_Type;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Execute a status command to report information about the Bbox.
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in Command_Type;
Context : in out Context_Type);
end Druss.Commands.Status;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- druss-commands-status -- Druss status commands
-- Copyright (C) 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Druss.Commands.Status is
type Command_Type is new Druss.Commands.Drivers.Command_Type with null record;
procedure Do_Status (Command : in Command_Type;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Execute a status command to report information about the Bbox.
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
-- Write the help associated with the command.
overriding
procedure Help (Command : in out Command_Type;
Context : in out Context_Type);
end Druss.Commands.Status;
|
### USER: In Ada.
Add the data buffer in the Stream_Reader_Type type
-----------------------------------------------------------------------
-- mat-readers-streams -- Reader for streams
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
package MAT.Readers.Streams is
type Stream_Reader_Type is new Manager_Base with private;
-- Read the events from the stream and stop when the end of the stream is reached.
procedure Read_All (Reader : in out Stream_Reader_Type);
-- Read a message from the stream.
overriding
procedure Read_Message (Reader : in out Stream_Reader_Type;
Msg : in out Message);
private
type Stream_Reader_Type is new Manager_Base with record
Stream : Util.Streams.Buffered.Buffered_Stream;
end record;
end MAT.Readers.Streams;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-readers-streams -- Reader for streams
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
package MAT.Readers.Streams is
type Stream_Reader_Type is new Manager_Base with private;
-- Read the events from the stream and stop when the end of the stream is reached.
procedure Read_All (Reader : in out Stream_Reader_Type);
-- Read a message from the stream.
overriding
procedure Read_Message (Reader : in out Stream_Reader_Type;
Msg : in out Message);
private
type Stream_Reader_Type is new Manager_Base with record
Stream : Util.Streams.Buffered.Buffered_Stream;
Data : Util.Streams.Buffered.Buffer_Access;
end record;
end MAT.Readers.Streams;
|
### USER: In Ada.
Call the Finish procedure after executing the testsuite
Finish will destroy the AWA application that was allocated dynamically
-----------------------------------------------------------------------
-- AWA - Unit tests
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with AWA.Testsuite;
with Util.Tests;
with AWA.Tests;
procedure AWA_Harness is
procedure Harness is new Util.Tests.Harness (AWA.Testsuite.Suite,
AWA.Tests.Initialize);
begin
Harness ("awa-tests.xml");
end AWA_Harness;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- AWA - Unit tests
-- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with AWA.Testsuite;
with Util.Tests;
with AWA.Tests;
procedure AWA_Harness is
procedure Harness is new Util.Tests.Harness (AWA.Testsuite.Suite,
AWA.Tests.Initialize,
AWA.Tests.Finish);
begin
Harness ("awa-tests.xml");
end AWA_Harness;
|
### USER: In Ada.
Add the new unit tests
-----------------------------------------------------------------------
-- mat-testsuite - MAT Testsuite
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Readers.Tests;
with MAT.Targets.Tests;
with MAT.Frames.Tests;
with MAT.Memory.Tests;
package body MAT.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
MAT.Frames.Tests.Add_Tests (Result);
MAT.Memory.Tests.Add_Tests (Result);
MAT.Readers.Tests.Add_Tests (Result);
MAT.Targets.Tests.Add_Tests (Result);
return Result;
end Suite;
end MAT.Testsuite;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-testsuite - MAT Testsuite
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Readers.Tests;
with MAT.Targets.Tests;
with MAT.Frames.Tests;
with MAT.Memory.Tests;
with MAT.Expressions.Tests;
package body MAT.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
MAT.Expressions.Tests.Add_Tests (Result);
MAT.Frames.Tests.Add_Tests (Result);
MAT.Memory.Tests.Add_Tests (Result);
MAT.Readers.Tests.Add_Tests (Result);
MAT.Targets.Tests.Add_Tests (Result);
return Result;
end Suite;
end MAT.Testsuite;
|
### USER: In Ada.
Declare the new Test_Null_Locale procedure
-----------------------------------------------------------------------
-- locales.tests -- Unit tests for Locales
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Locales.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Get_Locale (T : in out Test);
procedure Test_Hash_Locale (T : in out Test);
procedure Test_Compare_Locale (T : in out Test);
procedure Test_Get_Locales (T : in out Test);
end Util.Locales.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- util-locales-tests -- Unit tests for Locales
-- Copyright (C) 2009, 2010, 2011, 2022 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Locales.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Get_Locale (T : in out Test);
procedure Test_Hash_Locale (T : in out Test);
procedure Test_Compare_Locale (T : in out Test);
procedure Test_Get_Locales (T : in out Test);
procedure Test_Null_Locale (T : in out Test);
end Util.Locales.Tests;
|
### USER: In Ada.
ports-mgmt/synth: Upgrade version 1.21 => 1.22
Two minor bug fixes:
* A specific check during test mode would emit a failure to stdout when
testing devel/py-setuptools27. It turns out that there's a file there
with a space in the filename. The filename was an argument for
/usr/bin//file and it wasn't escaped. The file in question had
parentheses too which the shell was trying to process. The fix was
to escape the filename in the /usr/bin/file command.
* The builders were mounting the source directory from "/usr/src", not
$sysroot/usr/src as intended. This potentially causes breakage when
the $sysroot reflects a different versions/release than the host
machine has (e.g. making FreeBSD 10.2 packages on FreeBSD 11-current).
Now the source directory mount is relative to profile's $sysroot.
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
package Definitions is
pragma Pure;
synth_version_major : constant String := "1";
synth_version_minor : constant String := "21";
copyright_years : constant String := "2015-2016";
host_localbase : constant String := "/usr/local";
host_pkg8 : constant String := host_localbase & "/sbin/pkg";
jobs_per_cpu : constant := 2;
type cpu_range is range 1 .. 32;
type scanners is range cpu_range'First .. cpu_range'Last;
type builders is range cpu_range'First .. cpu_range'Last * jobs_per_cpu;
end Definitions;
### ASSISTANT: No problem
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
package Definitions is
pragma Pure;
synth_version_major : constant String := "1";
synth_version_minor : constant String := "22";
copyright_years : constant String := "2015-2016";
host_localbase : constant String := "/usr/local";
host_pkg8 : constant String := host_localbase & "/sbin/pkg";
jobs_per_cpu : constant := 2;
type cpu_range is range 1 .. 32;
type scanners is range cpu_range'First .. cpu_range'Last;
type builders is range cpu_range'First .. cpu_range'Last * jobs_per_cpu;
end Definitions;
|
### USER: In Ada.
Declare the Test_List_Tables procedure to test the 'list -t' command
-----------------------------------------------------------------------
-- awa-commands-tests -- Test the AWA.Commands
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with Ada.Strings.Unbounded;
package AWA.Commands.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test start and stop command.
procedure Test_Start_Stop (T : in out Test);
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0);
end AWA.Commands.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-commands-tests -- Test the AWA.Commands
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with Ada.Strings.Unbounded;
package AWA.Commands.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test start and stop command.
procedure Test_Start_Stop (T : in out Test);
procedure Test_List_Tables (T : in out Test);
procedure Execute (T : in out Test;
Command : in String;
Input : in String;
Output : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String;
Status : in Natural := 0);
end AWA.Commands.Tests;
|
### USER: In Ada.
Add the new unit tests
-----------------------------------------------------------------------
-- Security testsuite - Ada Security Test suite
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Security.OpenID.Tests;
with Security.Permissions.Tests;
with Security.Policies.Tests;
with Security.OAuth.JWT.Tests;
package body Security.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Ret : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Security.OAuth.JWT.Tests.Add_Tests (Ret);
Security.OpenID.Tests.Add_Tests (Ret);
Security.Permissions.Tests.Add_Tests (Ret);
Security.Policies.Tests.Add_Tests (Ret);
return Ret;
end Suite;
end Security.Testsuite;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- Security testsuite - Ada Security Test suite
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Security.OpenID.Tests;
with Security.Permissions.Tests;
with Security.Policies.Tests;
with Security.OAuth.JWT.Tests;
with Security.OAuth.Clients.Tests;
package body Security.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Ret : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Security.OAuth.JWT.Tests.Add_Tests (Ret);
Security.OpenID.Tests.Add_Tests (Ret);
Security.Permissions.Tests.Add_Tests (Ret);
Security.Policies.Tests.Add_Tests (Ret);
Security.OAuth.Clients.Tests.Add_Tests (Ret);
return Ret;
end Suite;
end Security.Testsuite;
|
### USER: In Ada.
Add the new unit tests
-----------------------------------------------------------------------
-- mat-testsuite - MAT Testsuite
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Readers.Tests;
package body MAT.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
MAT.Readers.Tests.Add_Tests (Result);
return Result;
end Suite;
end MAT.Testsuite;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-testsuite - MAT Testsuite
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Readers.Tests;
with MAT.Targets.Tests;
package body MAT.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
MAT.Readers.Tests.Add_Tests (Result);
MAT.Targets.Tests.Add_Tests (Result);
return Result;
end Suite;
end MAT.Testsuite;
|
### USER: In Ada.
Fix running the testsuite with AUnit: create the 'regtests/result' directory if it does not exist
-----------------------------------------------------------------------
-- Util -- Utilities
-- Copyright (C) 2009, 2010 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Testsuite;
with Util.Tests;
procedure Util_Harness is
procedure Harness is new Util.Tests.Harness (Util.Testsuite.Suite);
begin
Harness ("util-tests.xml");
end Util_Harness;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- Util -- Utilities
-- Copyright (C) 2009, 2010 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Directories;
with Util.Testsuite;
with Util.Tests;
with Util.Properties;
procedure Util_Harness is
procedure Initialize (Props : in Util.Properties.Manager);
procedure Harness is new Util.Tests.Harness (Util.Testsuite.Suite, Initialize);
procedure Initialize (Props : in Util.Properties.Manager) is
pragma Unreferenced (Props);
Path : constant String := Util.Tests.Get_Test_Path ("regtests/result");
begin
if not Ada.Directories.Exists (Path) then
Ada.Directories.Create_Directory (Path);
end if;
end Initialize;
begin
Harness ("util-tests.xml");
end Util_Harness;
|
### USER: In Ada.
Add new unit tests to check the Permissions.Definition package
-----------------------------------------------------------------------
-- Security-permissions-tests - Unit tests for Security.Permissions
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Security.Permissions.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Add_Permission and Get_Permission_Index
procedure Test_Add_Permission (T : in out Test);
end Security.Permissions.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- Security-permissions-tests - Unit tests for Security.Permissions
-- Copyright (C) 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Security.Permissions.Tests is
package P_Admin is new Permissions.Definition ("admin");
package P_Create is new Permissions.Definition ("create");
package P_Update is new Permissions.Definition ("update");
package P_Delete is new Permissions.Definition ("delete");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Add_Permission and Get_Permission_Index
procedure Test_Add_Permission (T : in out Test);
-- Test the permission created by the Definition package.
procedure Test_Define_Permission (T : in out Test);
-- Test Get_Permission on invalid permission name.
procedure Test_Get_Invalid_Permission (T : in out Test);
end Security.Permissions.Tests;
|
### USER: In Ada.
Add the Ada beans in the workspace documentation
-----------------------------------------------------------------------
-- awa-workspaces -- Module workspaces
-- Copyright (C) 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
-- == Introduction ==
-- The *workspaces* plugin defines a workspace area for other plugins.
--
-- == Data Model ==
-- @include Workspace.hbm.xml
--
package AWA.Workspaces is
end AWA.Workspaces;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-workspaces -- Module workspaces
-- Copyright (C) 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
-- == Introduction ==
-- The *workspaces* plugin defines a workspace area for other plugins.
--
-- == Ada Beans ==
-- @include workspaces.xml
--
-- == Data Model ==
-- @include Workspace.hbm.xml
--
package AWA.Workspaces is
end AWA.Workspaces;
|
### USER: In Ada.
Remove the declaration of Usage procedure
-----------------------------------------------------------------------
-- gen-commands -- Commands for dynamo
-- Copyright (C) 2011, 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Commands.Drivers;
with Gen.Generator;
package Gen.Commands is
package Drivers is
new Util.Commands.Drivers (Context_Type => Gen.Generator.Handler,
Driver_Name => "gen-commands");
subtype Command is Drivers.Command_Type;
subtype Command_Access is Drivers.Command_Access;
subtype Argument_List is Util.Commands.Argument_List;
Driver : Drivers.Driver_Type;
-- Print dynamo usage
procedure Usage;
-- Print dynamo short usage.
procedure Short_Help_Usage;
end Gen.Commands;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands -- Commands for dynamo
-- Copyright (C) 2011, 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Commands.Drivers;
with Gen.Generator;
package Gen.Commands is
package Drivers is
new Util.Commands.Drivers (Context_Type => Gen.Generator.Handler,
Driver_Name => "gen-commands");
subtype Command is Drivers.Command_Type;
subtype Command_Access is Drivers.Command_Access;
subtype Argument_List is Util.Commands.Argument_List;
Driver : Drivers.Driver_Type;
-- Print dynamo short usage.
procedure Short_Help_Usage;
end Gen.Commands;
|
### USER: In Ada.
Change the Argument_List to an interface with a Get_Count and Get_Argument operation
-----------------------------------------------------------------------
-- util-commands -- Support to make command line tools
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Strings.Vectors;
package Util.Commands is
subtype Argument_List is Util.Strings.Vectors.Vector;
end Util.Commands;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- util-commands -- Support to make command line tools
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Util.Commands is
-- The argument list interface that gives access to command arguments.
type Argument_List is limited interface;
-- Get the number of arguments available.
function Get_Count (List : in Argument_List) return Natural is abstract;
-- Get the argument at the given position.
function Get_Argument (List : in Argument_List;
Pos : in Positive) return String is abstract;
end Util.Commands;
|
### USER: In Ada.
Add the Test_Create_Wiki_Content unit test
-----------------------------------------------------------------------
-- awa-wikis-modules-tests -- Unit tests for wikis service
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Wikis.Modules.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Manager : AWA.Wikis.Modules.Wiki_Module_Access;
end record;
-- Test creation of a wiki space.
procedure Test_Create_Wiki_Space (T : in out Test);
-- Test creation of a wiki page.
procedure Test_Create_Wiki_Page (T : in out Test);
end AWA.Wikis.Modules.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-wikis-modules-tests -- Unit tests for wikis service
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Wikis.Modules.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with record
Manager : AWA.Wikis.Modules.Wiki_Module_Access;
end record;
-- Test creation of a wiki space.
procedure Test_Create_Wiki_Space (T : in out Test);
-- Test creation of a wiki page.
procedure Test_Create_Wiki_Page (T : in out Test);
-- Test creation of a wiki page content.
procedure Test_Create_Wiki_Content (T : in out Test);
end AWA.Wikis.Modules.Tests;
|
### USER: In Ada.
Fix the unit test to use AWA.Tests.Test for the correct test setup
-----------------------------------------------------------------------
-- awa-changelogs-tests -- Tests for changelogs
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package AWA.Changelogs.Modules.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Add_Log (T : in out Test);
end AWA.Changelogs.Modules.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-changelogs-tests -- Tests for changelogs
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Changelogs.Modules.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with null record;
procedure Test_Add_Log (T : in out Test);
end AWA.Changelogs.Modules.Tests;
|
### USER: In Ada.
Fix style warnings: add missing overriding and update and then/or else conditions
-----------------------------------------------------------------------
-- awa-sysadmin --
-- Copyright (C) 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package AWA.Sysadmin is
pragma Pure;
end AWA.Sysadmin;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-sysadmin -- sysadmin module
-- Copyright (C) 2019, 2022 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package AWA.Sysadmin is
pragma Pure;
end AWA.Sysadmin;
|
### USER: In Ada.
Use the Is_Test_Enabled function to ignore or take into account the
test when it is added in the testsuite.
-----------------------------------------------------------------------
-- AUnit utils - Helper for writing unit tests
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package body Util.Test_Caller is
procedure Add_Test (Suite : in Util.Tests.Access_Test_Suite;
Test_Name : in String;
Method : in Caller.Test_Method) is
begin
Suite.Add_Test (Caller.Create (Test_Name, Method));
end Add_Test;
end Util.Test_Caller;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- AUnit utils - Helper for writing unit tests
-- Copyright (C) 2009, 2010, 2011, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package body Util.Test_Caller is
procedure Add_Test (Suite : in Util.Tests.Access_Test_Suite;
Test_Name : in String;
Method : in Caller.Test_Method) is
begin
if Util.Tests.Is_Test_Enabled (Test_Name) then
Suite.Add_Test (Caller.Create (Test_Name, Method));
end if;
end Add_Test;
end Util.Test_Caller;
|
### USER: In Ada.
Add Name parameter to the Help procedure
-----------------------------------------------------------------------
-- gen-commands-propset -- Set a property on dynamo project
-- Copyright (C) 2011, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Propset is
-- ------------------------------
-- Propset Command
-- ------------------------------
-- This command sets a property in the dynamo project configuration.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Propset;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-propset -- Set a property on dynamo project
-- Copyright (C) 2011, 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Propset is
-- ------------------------------
-- Propset Command
-- ------------------------------
-- This command sets a property in the dynamo project configuration.
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Propset;
|
### USER: In Ada.
Declare the UString subtype to simplify the implementation and use of Unbounded_String
-----------------------------------------------------------------------
-- Gen -- Code Generator
-- Copyright (C) 2009, 2010, 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen is
-- Library SVN identification
SVN_URL : constant String := "https://ada-gen.googlecode.com/svn/trunk";
-- Revision used (must run 'make version' to update)
SVN_REV : constant Positive := 1095;
end Gen;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen -- Code Generator
-- Copyright (C) 2009, 2010, 2011, 2021 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
package Gen is
-- Library SVN identification
SVN_URL : constant String := "https://ada-gen.googlecode.com/svn/trunk";
-- Revision used (must run 'make version' to update)
SVN_REV : constant Positive := 1095;
subtype UString is Ada.Strings.Unbounded.Unbounded_String;
function To_UString (Value : in String) return UString
renames Ada.Strings.Unbounded.To_Unbounded_String;
function To_String (Value : in UString) return String
renames Ada.Strings.Unbounded.To_String;
function Length (Value : in UString) return Natural
renames Ada.Strings.Unbounded.Length;
function "=" (Left, Right : in UString) return Boolean
renames Ada.Strings.Unbounded."=";
function "=" (Left : in UString; Right : in String) return Boolean
renames Ada.Strings.Unbounded."=";
end Gen;
|
### USER: In Ada.
Declare the Location function to format a file,line,function code location
-----------------------------------------------------------------------
-- mat-formats - Format various types for the console or GUI interface
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Types;
package MAT.Formats is
-- Format the address into a string.
function Addr (Value : in MAT.Types.Target_Addr) return String;
-- Format the size into a string.
function Size (Value : in MAT.Types.Target_Size) return String;
end MAT.Formats;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-formats - Format various types for the console or GUI interface
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with MAT.Types;
package MAT.Formats is
-- Format the address into a string.
function Addr (Value : in MAT.Types.Target_Addr) return String;
-- Format the size into a string.
function Size (Value : in MAT.Types.Target_Size) return String;
-- Format a file, line, function information into a string.
function Location (File : in Ada.Strings.Unbounded.Unbounded_String;
Line : in Natural;
Func : in Ada.Strings.Unbounded.Unbounded_String) return String;
end MAT.Formats;
|
### USER: In Ada.
Implement the Size function to format sizes
-----------------------------------------------------------------------
-- mat-formats - Format various types for the console or GUI interface
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package body MAT.Formats is
-- ------------------------------
-- Format the address into a string.
-- ------------------------------
function Addr (Value : in MAT.Types.Target_Addr) return String is
Hex : constant String := MAT.Types.Hex_Image (Value);
begin
return Hex;
end Addr;
end MAT.Formats;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-formats - Format various types for the console or GUI interface
-- Copyright (C) 2015 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package body MAT.Formats is
-- ------------------------------
-- Format the address into a string.
-- ------------------------------
function Addr (Value : in MAT.Types.Target_Addr) return String is
Hex : constant String := MAT.Types.Hex_Image (Value);
begin
return Hex;
end Addr;
-- ------------------------------
-- Format the size into a string.
-- ------------------------------
function Size (Value : in MAT.Types.Target_Size) return String is
Result : constant String := MAT.Types.Target_Size'Image (Value);
begin
if Result (Result'First) = ' ' then
return Result (Result'First + 1 .. Result'Last);
else
return Result;
end if;
end Size;
end MAT.Formats;
|
### USER: In Ada.
Use Util.Log.Loggers.Initialize to configure the loggers
-----------------------------------------------------------------------
-- mat-types -- Global types
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
with Readline;
with MAT.Commands;
with MAT.Targets;
procedure Matp is
procedure Interactive_Loop is
Target : MAT.Targets.Target_Type;
begin
loop
declare
Line : constant String := Readline.Get_Line ("matp>");
begin
MAT.Commands.Execute (Target, Line);
exception
when MAT.Commands.Stop_Interp =>
return;
end;
end loop;
exception
when Ada.IO_Exceptions.End_Error =>
return;
end Interactive_Loop;
begin
Interactive_Loop;
end Matp;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-types -- Global types
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
with Readline;
with MAT.Commands;
with MAT.Targets;
with Util.Log.Loggers;
procedure Matp is
procedure Interactive_Loop is
Target : MAT.Targets.Target_Type;
begin
loop
declare
Line : constant String := Readline.Get_Line ("matp>");
begin
MAT.Commands.Execute (Target, Line);
exception
when MAT.Commands.Stop_Interp =>
return;
end;
end loop;
exception
when Ada.IO_Exceptions.End_Error =>
return;
end Interactive_Loop;
begin
Util.Log.Loggers.Initialize ("matp.properties");
Interactive_Loop;
end Matp;
|
### USER: In Ada.
Use the Message_Type and MAT.Events.Probes.Probe_Manager_Type types
-----------------------------------------------------------------------
-- mat-readers-streams -- Reader for streams
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
package MAT.Readers.Streams is
type Stream_Reader_Type is new Manager_Base with private;
-- Read the events from the stream and stop when the end of the stream is reached.
procedure Read_All (Reader : in out Stream_Reader_Type);
-- Read a message from the stream.
overriding
procedure Read_Message (Reader : in out Stream_Reader_Type;
Msg : in out Message);
private
type Stream_Reader_Type is new Manager_Base with record
Stream : Util.Streams.Buffered.Buffered_Stream;
Data : Util.Streams.Buffered.Buffer_Access;
end record;
end MAT.Readers.Streams;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-readers-streams -- Reader for streams
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Streams.Buffered;
with MAT.Events.Probes;
with MAT.Events.Targets;
package MAT.Readers.Streams is
type Stream_Reader_Type is new MAT.Events.Probes.Probe_Manager_Type with private;
-- Read the events from the stream and stop when the end of the stream is reached.
procedure Read_All (Reader : in out Stream_Reader_Type);
-- Read a message from the stream.
overriding
procedure Read_Message (Reader : in out Stream_Reader_Type;
Msg : in out Message_Type);
private
type Stream_Reader_Type is new MAT.Events.Probes.Probe_Manager_Type with record
Stream : Util.Streams.Buffered.Buffered_Stream;
Data : Util.Streams.Buffered.Buffer_Access;
end record;
end MAT.Readers.Streams;
|
### USER: In Ada.
Fix applied for Linux resource usage
-- t0026.adb - Sat Jan 11 23:18:41 2014
--
-- (c) Warren W. Gay VE3WWG ve3wwg@gmail.com
--
-- Protected under the following license:
-- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999
with Ada.Text_IO;
with Posix;
use Posix;
procedure T0026 is
use Ada.Text_IO;
Child : pid_t := -1;
Resource : s_rusage;
Status : int_t := 0;
Error : errno_t;
pragma Volatile(Error);
begin
Put_Line("Test 0026 - Wait3");
Fork(Child,Error);
pragma Assert(Error = 0);
if Child = 0 then
-- Child fork
for Count in Natural(0)..10000000 loop
Error := 0;
end loop;
Sys_Exit(42);
end if;
Wait3(Child,0,Status,Resource,Error);
pragma Assert(Error = 0);
pragma Assert(WIFEXITED(Status));
pragma Assert(WEXITSTATUS(Status) = 42);
pragma Assert(Resource.ru_utime.tv_usec > 0);
pragma Assert(Resource.ru_stime.tv_usec > 0);
Put_Line("Test 0026 Passed.");
end T0026;
### ASSISTANT: No problem
-- t0026.adb - Sat Jan 11 23:18:41 2014
--
-- (c) Warren W. Gay VE3WWG ve3wwg@gmail.com
--
-- Protected under the following license:
-- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999
with Ada.Text_IO;
with Posix;
use Posix;
procedure T0026 is
use Ada.Text_IO;
Child : pid_t := -1;
Resource : s_rusage;
Status : int_t := 0;
Error : errno_t;
pragma Volatile(Error);
begin
Put_Line("Test 0026 - Wait3");
Fork(Child,Error);
pragma Assert(Error = 0);
if Child = 0 then
-- Child fork
for Count in Natural(0)..10000000 loop
Error := 0;
end loop;
Sys_Exit(42);
end if;
Wait3(Child,0,Status,Resource,Error);
pragma Assert(Error = 0);
pragma Assert(WIFEXITED(Status));
pragma Assert(WEXITSTATUS(Status) = 42);
pragma Assert(Resource.ru_utime.tv_usec > 0);
pragma Assert(Resource.ru_stime.tv_usec >= 0);
Put_Line("Test 0026 Passed.");
end T0026;
|
### USER: In Ada.
Add new unit tests to check the Permissions.Definition package
-----------------------------------------------------------------------
-- Security-permissions-tests - Unit tests for Security.Permissions
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Security.Permissions.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Add_Permission and Get_Permission_Index
procedure Test_Add_Permission (T : in out Test);
end Security.Permissions.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- Security-permissions-tests - Unit tests for Security.Permissions
-- Copyright (C) 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Security.Permissions.Tests is
package P_Admin is new Permissions.Definition ("admin");
package P_Create is new Permissions.Definition ("create");
package P_Update is new Permissions.Definition ("update");
package P_Delete is new Permissions.Definition ("delete");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test Add_Permission and Get_Permission_Index
procedure Test_Add_Permission (T : in out Test);
-- Test the permission created by the Definition package.
procedure Test_Define_Permission (T : in out Test);
-- Test Get_Permission on invalid permission name.
procedure Test_Get_Invalid_Permission (T : in out Test);
end Security.Permissions.Tests;
|
### USER: In Ada.
Add Name parameter to the Help procedure
-----------------------------------------------------------------------
-- gen-commands-distrib -- Distrib command for dynamo
-- Copyright (C) 2012, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Distrib is
-- ------------------------------
-- Distrib Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Distrib;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-distrib -- Distrib command for dynamo
-- Copyright (C) 2012, 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Distrib is
-- ------------------------------
-- Distrib Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Distrib;
|
### USER: In Ada.
Add Name parameter to the Help procedure
-----------------------------------------------------------------------
-- gen-commands-project -- Project creation command for dynamo
-- Copyright (C) 2011, 2017, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Project is
-- ------------------------------
-- Generator Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Project;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-project -- Project creation command for dynamo
-- Copyright (C) 2011, 2017, 2018, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Project is
-- ------------------------------
-- Generator Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in out Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in out Command;
Name : in String;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Project;
|
### USER: In Ada.
Declare the Extract_Redirect function to help a unit test in extracting
the result from a redirection
-----------------------------------------------------------------------
-- Aawa-tests-helpers - Helpers for AWA unit tests
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package AWA.Tests.Helpers is
end AWA.Tests.Helpers;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-tests-helpers - Helpers for AWA unit tests
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with ASF.Responses.Mockup;
with Ada.Strings.Unbounded;
package AWA.Tests.Helpers is
-- Extract from the Location header the part that is after the given base string.
-- If the Location header does not start with the base string, returns the empty
-- string.
function Extract_Redirect (Reply : in ASF.Responses.Mockup.Response'Class;
Base : in String) return String;
function Extract_Redirect (Reply : in ASF.Responses.Mockup.Response'Class;
Base : in String) return Ada.Strings.Unbounded.Unbounded_String;
end AWA.Tests.Helpers;
|
### USER: In Ada.
Define Sha1 procedure with a Stream_Ref object
-----------------------------------------------------------------------
-- babel-files-signatures -- Signatures calculation
-- Copyright (C) 2014 Stephane.Carrez
-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Babel.Files;
with Babel.Files.Buffers;
with Babel.Files.Maps;
package Babel.Files.Signatures is
-- Compute the SHA1 signature of the data stored in the buffer.
procedure Sha1 (Buffer : in Babel.Files.Buffers.Buffer;
Result : out Util.Encoders.SHA1.Hash_Array);
-- Write the SHA1 checksum for the files stored in the map.
procedure Save_Checksum (Path : in String;
Files : in Babel.Files.Maps.File_Map);
end Babel.Files.Signatures;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- babel-files-signatures -- Signatures calculation
-- Copyright (C) 2014, 2015, 2016 Stephane.Carrez
-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Babel.Files;
with Babel.Files.Buffers;
with Babel.Files.Maps;
with Babel.Streams.Refs;
package Babel.Files.Signatures is
-- Compute the SHA1 signature of the data stored in the buffer.
procedure Sha1 (Buffer : in Babel.Files.Buffers.Buffer;
Result : out Util.Encoders.SHA1.Hash_Array);
-- Compute the SHA1 signature of the file stream.
procedure Sha1 (Stream : in Babel.Streams.Refs.Stream_Ref;
Result : out Util.Encoders.SHA1.Hash_Array);
-- Write the SHA1 checksum for the files stored in the map.
procedure Save_Checksum (Path : in String;
Files : in Babel.Files.Maps.File_Map);
end Babel.Files.Signatures;
|
### USER: In Ada.
Declare Test_AES procedure and remove Test_AES_Stream
-----------------------------------------------------------------------
-- util-streams-tests -- Unit tests for encoding buffered streams
-- Copyright (C) 2017, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Streams.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Base64_Stream (T : in out Test);
procedure Test_AES_Stream (T : in out Test);
end Util.Streams.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- util-streams-tests -- Unit tests for encoding buffered streams
-- Copyright (C) 2017, 2019 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with Util.Encoders.AES;
package Util.Streams.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_AES (T : in out Test;
Item : in String;
Count : in Positive;
Mode : in Util.Encoders.AES.AES_Mode;
Label : in String);
procedure Test_Base64_Stream (T : in out Test);
end Util.Streams.Tests;
|
### USER: In Ada.
Add the new unit tests
-----------------------------------------------------------------------
-- Security testsuite - Ada Security Test suite
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Security.OpenID.Tests;
with Security.Permissions.Tests;
with Security.Policies.Tests;
with Security.OAuth.JWT.Tests;
package body Security.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Ret : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Security.OAuth.JWT.Tests.Add_Tests (Ret);
Security.OpenID.Tests.Add_Tests (Ret);
Security.Permissions.Tests.Add_Tests (Ret);
Security.Policies.Tests.Add_Tests (Ret);
return Ret;
end Suite;
end Security.Testsuite;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- Security testsuite - Ada Security Test suite
-- Copyright (C) 2011, 2012, 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Security.OpenID.Tests;
with Security.Permissions.Tests;
with Security.Policies.Tests;
with Security.OAuth.JWT.Tests;
with Security.OAuth.Clients.Tests;
package body Security.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
function Suite return Util.Tests.Access_Test_Suite is
Ret : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Security.OAuth.JWT.Tests.Add_Tests (Ret);
Security.OpenID.Tests.Add_Tests (Ret);
Security.Permissions.Tests.Add_Tests (Ret);
Security.Policies.Tests.Add_Tests (Ret);
Security.OAuth.Clients.Tests.Add_Tests (Ret);
return Ret;
end Suite;
end Security.Testsuite;
|
### USER: In Ada.
Update the unit test declaration
-----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with ADO.Databases;
with ADO.Sessions;
package Regtests is
-- ------------------------------
-- Get the database manager to be used for the unit tests
-- ------------------------------
function Get_Controller return ADO.Databases.DataSource'Class;
-- ------------------------------
-- Get the readonly connection database to be used for the unit tests
-- ------------------------------
function Get_Database return ADO.Sessions.Session;
-- ------------------------------
-- Get the writeable connection database to be used for the unit tests
-- ------------------------------
function Get_Master_Database return ADO.Sessions.Master_Session;
-- ------------------------------
-- Initialize the test database
-- ------------------------------
procedure Initialize (Name : in String);
end Regtests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- ADO Tests -- Database sequence generator
-- Copyright (C) 2009, 2010, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with ADO.Sessions;
with ADO.Sessions.Sources;
package Regtests is
-- ------------------------------
-- Get the database manager to be used for the unit tests
-- ------------------------------
function Get_Controller return ADO.Sessions.Sources.Data_Source'Class;
-- ------------------------------
-- Get the readonly connection database to be used for the unit tests
-- ------------------------------
function Get_Database return ADO.Sessions.Session;
-- ------------------------------
-- Get the writeable connection database to be used for the unit tests
-- ------------------------------
function Get_Master_Database return ADO.Sessions.Master_Session;
-- ------------------------------
-- Initialize the test database
-- ------------------------------
procedure Initialize (Name : in String);
end Regtests;
|
### USER: In Ada.
Adjust this test for recent sroa improvements.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@66791 91177308-0d34-0410-b5e6-96231b3b80d8
-- RUN: %llvmgcc -S -O2 %s -I%p/Support -o - | grep 105 | count 2
package body Element_Copy is
function F return VariableSizedField is
X : VariableSizedField;
begin
return X;
end;
end;
### ASSISTANT: No problem
-- RUN: %llvmgcc -S -O2 %s -I%p/Support -o - | grep 6899714
package body Element_Copy is
function F return VariableSizedField is
X : VariableSizedField;
begin
return X;
end;
end;
|
### USER: In Ada.
Add the permission in the documentation
-----------------------------------------------------------------------
-- security -- Security
-- Copyright (C) 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
-- == Introduction ==
--
--
-- @include security-contexts.ads
-- @include security-controllers.ads
package Security is
end Security;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- security -- Security
-- Copyright (C) 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
-- == Introduction ==
-- The <tt>Security</tt> package provides security frameworks that allows
-- an application to use OpenID or OAuth security frameworks. This security
-- framework was first developed within the Ada Server Faces project.
--
-- @include security-permissions.ads
-- @include security-openid.ads
-- @include security-oauth.ads
-- @include security-contexts.ads
-- @include security-controllers.ads
package Security is
end Security;
|
### USER: In Ada.
Change the Definition function into a Register procedure
-----------------------------------------------------------------------
-- widgets-factory -- Factory for widget Components
-- Copyright (C) 2013 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with ASF.Factory;
package ASF.Components.Widgets.Factory is
-- Get the widget component factory.
function Definition return ASF.Factory.Factory_Bindings_Access;
end ASF.Components.Widgets.Factory;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- widgets-factory -- Factory for widget Components
-- Copyright (C) 2013, 2018 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with ASF.Factory;
package ASF.Components.Widgets.Factory is
-- Register the widget component factory.
procedure Register (Factory : in out ASF.Factory.Component_Factory);
end ASF.Components.Widgets.Factory;
|
### USER: In Ada.
Update to use the new command implementation
-----------------------------------------------------------------------
-- gen-commands-plugins -- Plugin creation and management commands for dynamo
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Plugins is
-- ------------------------------
-- Generator Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
procedure Execute (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Plugins;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- gen-commands-plugins -- Plugin creation and management commands for dynamo
-- Copyright (C) 2012, 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
package Gen.Commands.Plugins is
-- ------------------------------
-- Generator Command
-- ------------------------------
type Command is new Gen.Commands.Command with null record;
-- Execute the command with the arguments.
overriding
procedure Execute (Cmd : in Command;
Name : in String;
Args : in Argument_List'Class;
Generator : in out Gen.Generator.Handler);
-- Write the help associated with the command.
overriding
procedure Help (Cmd : in Command;
Generator : in out Gen.Generator.Handler);
end Gen.Commands.Plugins;
|
### USER: In Ada.
Move the Document type to Wiki.Documents package
-----------------------------------------------------------------------
-- wiki-plugins -- Wiki plugins
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Wiki.Attributes;
with Wiki.Nodes;
-- == Plugins ==
-- The <b>Wiki.Plugins</b> package defines the plugin interface that is used by the wiki
-- engine to provide pluggable extensions in the Wiki.
--
package Wiki.Plugins is
pragma Preelaborate;
type Wiki_Plugin is limited interface;
type Wiki_Plugin_Access is access all Wiki_Plugin'Class;
-- Expand the plugin configured with the parameters for the document.
procedure Expand (Plugin : in out Wiki_Plugin;
Document : in out Wiki.Nodes.Document;
Params : in out Wiki.Attributes.Attribute_List) is abstract;
end Wiki.Plugins;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- wiki-plugins -- Wiki plugins
-- Copyright (C) 2016 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Wiki.Attributes;
with Wiki.Documents;
-- == Plugins ==
-- The <b>Wiki.Plugins</b> package defines the plugin interface that is used by the wiki
-- engine to provide pluggable extensions in the Wiki.
--
package Wiki.Plugins is
pragma Preelaborate;
type Wiki_Plugin is limited interface;
type Wiki_Plugin_Access is access all Wiki_Plugin'Class;
-- Expand the plugin configured with the parameters for the document.
procedure Expand (Plugin : in out Wiki_Plugin;
Document : in out Wiki.Documents.Document;
Params : in out Wiki.Attributes.Attribute_List) is abstract;
end Wiki.Plugins;
|
### USER: In Ada.
Update to use the target Initialize_Options procedure
-----------------------------------------------------------------------
-- mat-types -- Global types
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
with MAT.Commands;
with MAT.Targets;
with MAT.Consoles.Text;
with MAT.Readers.Streams.Sockets;
procedure Matp is
Target : MAT.Targets.Target_Type;
Options : MAT.Commands.Options_Type;
Console : aliased MAT.Consoles.Text.Console_Type;
Server : MAT.Readers.Streams.Sockets.Socket_Listener_Type;
begin
Target.Console (Console'Unchecked_Access);
MAT.Commands.Initialize_Options (Target, Options);
MAT.Commands.Initialize_Files (Target);
Server.Start (Options.Address);
MAT.Commands.Interactive (Target);
Server.Stop;
exception
when Ada.IO_Exceptions.End_Error | MAT.Commands.Usage_Error =>
Server.Stop;
end Matp;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- mat-types -- Global types
-- Copyright (C) 2014 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
with MAT.Commands;
with MAT.Targets;
with MAT.Consoles.Text;
with MAT.Readers.Streams.Sockets;
procedure Matp is
Target : MAT.Targets.Target_Type;
Console : aliased MAT.Consoles.Text.Console_Type;
Server : MAT.Readers.Streams.Sockets.Socket_Listener_Type;
begin
Target.Console (Console'Unchecked_Access);
Target.Initialize_Options;
MAT.Commands.Initialize_Files (Target);
Server.Start (Options.Address);
MAT.Commands.Interactive (Target);
Server.Stop;
exception
when Ada.IO_Exceptions.End_Error | MAT.Targets.Usage_Error =>
Server.Stop;
end Matp;
|
### USER: In Ada.
Declare the Verify_Anonymous procedure to check the invitation page
-----------------------------------------------------------------------
-- awa-workspaces-tests -- Unit tests for workspaces and invitations
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Workspaces.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with null record;
-- Test sending an invitation.
procedure Test_Invite_User (T : in out Test);
end AWA.Workspaces.Tests;
### ASSISTANT: No problem
-----------------------------------------------------------------------
-- awa-workspaces-tests -- Unit tests for workspaces and invitations
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
-- 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.
-----------------------------------------------------------------------
with Util.Tests;
with AWA.Tests;
package AWA.Workspaces.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new AWA.Tests.Test with null record;
-- Verify the anonymous access for the invitation page.
procedure Verify_Anonymous (T : in out Test;
Key : in String);
-- Test sending an invitation.
procedure Test_Invite_User (T : in out Test);
end AWA.Workspaces.Tests;
|
End of preview.