Skip to content

Commit

Permalink
small tweaks for docs/JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 9, 2024
1 parent 1dccab8 commit f843f52
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_120.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "jswrap_font_monofonto_120.h"
#include "jswrap_graphics.h"

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
// Monofonto (digits and colon only, for clock display) at 2bpp. Nominal height: 145px, cap height: 120px, total height = 120px

// Fixed width: 73px
Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_16.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_16.h"
#include "jswrap_graphics.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_18.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_18.h"
#include "jswrap_graphics.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_23.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_23.h"
#include "jswrap_graphics.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_28.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_28.h"
#include "jswrap_graphics.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_36.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_36.h"
#include "jswrap_graphics.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/pipboy/jswrap_font_monofonto_96.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Contains Custom Fonts
* ----------------------------------------------------------------------------
*/

/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
#include "jswrap_font_monofonto_96.h"
#include "jswrap_graphics.h"

Expand Down
13 changes: 8 additions & 5 deletions scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Builtin.prototype.getURL = function() {
anchor = this.class;
else if ("class" in this)
anchor = "l_"+this.class+"_"+this.name;
else
else
anchor = "l__global_"+this.name;
return "http://www.espruino.com/Reference#"+anchor;
};
Expand All @@ -44,12 +44,12 @@ function getBasicTernType(t) {
}

/// Get full Tern type - for tern.js json format
Builtin.prototype.getTernType = function() {
Builtin.prototype.getTernType = function() {
if (["class","library"].indexOf(this.type)>=0) {
return "fn()";
} else if (["function","method","staticmethod","constructor"].indexOf(this.type)>=0) {
// it's a function
var args = [];
var args = [];
if ("params" in this)
args = this.params.map(function (p) {
if (p[0]=="pin" && p[1]=="JsVar")
Expand All @@ -59,8 +59,8 @@ Builtin.prototype.getTernType = function() {
var ret = "";
if ("return_object" in this)
ret = " -> +"+this.return_object
else if ("return" in this)
ret = " -> "+getBasicTernType(this.return[0]);
else if ("return" in this)
ret = " -> "+getBasicTernType(this.return[0]);
return "fn("+args.join("\, ")+")"+ret;
} else {
return getBasicTernType(this.return[0]);
Expand All @@ -78,6 +78,9 @@ exports.getWrapperFiles = function (callback) {
/// Extract the /*JSON ... */ comments from a file and parse them
exports.readWrapperFile = function(filename) {
var contents = fs.readFileSync(filename).toString();
if (contents.includes("DO_NOT_INCLUDE_IN_DOCS")) {
return [[],[]]; // don't include jswrap files with the no-docs marker in them
}
var builtins = [];
var types = [];
var comments = contents.match( /\/\*JSON(?:(?!\*\/).|[\n\r])*\*\//g );
Expand Down

0 comments on commit f843f52

Please sign in to comment.