Skip to content

Irwin1985/BlackFox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlackFox

BlackFox is a tiny Visual FoxPro like grammar that abstracts some verbose code for modern language constructs like JSON notation, HTTP protocol and so forth.

Si te gusta mi trabajo puedes apoyarme con un donativo:
DONATE!

Gracias por tu apoyo!

Project Manager

Irwin Rodríguez (Toledo, Spain)

Latest Release

[BlackFox] - 1.0 - Beta Release 2020-09-30 20:44:08


Dependencies

JSONFox Application library for JSON related operations.

FoxThread Application library for Multithreading (Not yet implemented).

Examples

 Do LocFile("BlackFox", "app")

// JSON Examples 
// 1. Create JSON object from String literal.
Local lcJSONString
lcJSONString = '{"foo": "bar"}'
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  # This is a full line comment.
  CREATE JSON OBJECT MyObj FROM '<<lcJSONString>>'
ENDTEXT
?MyObj.foo 

// 2. Create JSON object from file.
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  CREATE JSON OBJECT MyObj FROM FILE 'c:\path\to\my\file.json'
ENDTEXT

// 3. Create JSON object from cursor.
Create Cursor cGames (game c(25), launched i(4))
Insert into cGames Values('Pac-Man', 1980)
Insert into cGames Values('Super Mario Bros', 1985)
Insert into cGames Values('Space Invaders', 1978)
Insert into cGames Values('The Legend of Zelda', 1986)

TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  CREATE JSON OBJECT MyObj FROM CURSOR cGames
ENDTEXT
?Myobj.cGames[1].game
?Myobj.cGames[1].launched

// 4. Create JSON object from variable.
Local lcJSONString
lcJSONString = '{"foo": "bar"}'
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  CREATE JSON OBJECT MyObj FROM lcJSONString
ENDTEXT
?MyObj.foo

// PRINT COMMAND
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  # Create JSON Object
  CREATE JSON OBJECT MyObj FROM FILE 'c:\path\to\my\file.json'

  # PRINT JSON OBJECT.
  PRINT JSON OBJECT MyOBJ TO MyVar
ENDTEXT
?MyVar

// Printing in screen
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  # Create JSON Object
  CREATE JSON OBJECT MyObj FROM FILE 'c:\path\to\my\file.json'

  # PRINT JSON OBJECT.
  PRINT JSON OBJECT MyOBJ IN SCREEN
ENDTEXT

// HTTP REQUEST COMMANDS
// 1. GET Request
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  # SEND HTTP USING GET METHOD
  HTTP GET MyHTTP 
    URL 'https://jsonplaceholder.typicode.com/todos/1'
    ADD HEADER 'Content-Type' with 'application/json'
ENDTEXT
?MyHTTP.responseText

// 2. POST Request
Local lcBody
Text to lcBody noshow
  {
    "Id": 78912,
    "Customer": "Jason Sweet",
    "Quantity": 1,
    "Price": 18.00
  }
endtext
TEXT TO _vfp.BlackFox NOSHOW TEXTMERGE PRETEXT 7
  # SEND HTTP USING POST METHOD
  HTTP POST MyHTTP 
    URL 'https://reqbin.com/echo/post/json'
	BODY '<<lcBody>>'
	ADD HEADER 'Content-Type' with 'application/json'	
ENDTEXT
?MyHTTP.responseText

Release History


2020-09-30

  • Beta Release

License

BlackFox is released under the MIT Licence.

About

BlackFox is a Command Based Interpreter embedded in Visual FoxPro.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors